pub struct Declaration<D: ToSort, R: ToSort> {
pub name: Identifier<'static>,
pub domain: Vec<D>,
pub range: R,
pub span: Option<Span>,
}Expand description
Specification for declarations of functions (and constants, and sorts).
Declaration objects are passed to the Solver::declare() method to declare entities in a solver, by specifying all the attributes of such declarations. Then, the method returns a Declared object which is an opaque shared reference to a specific Declaration object which represents the actual entity the solver is keeping track of.
The Declaration<D, R> type is parametric in two ToSort types D and R used to represent
the sort of the domain and of the range of the function, respectively. These can be e.g.,
Sort itself or the result of the sort! macro. See the documentation of ToSort for details.
The fields are public and the type can be constructed freely, but some constructors are also provided (function(), constant(), and sort()), for common cases.
Fields§
§name: Identifier<'static>The name of the declared function.
domain: Vec<D>The domain of the declared function, i.e. the sorts of its arguments.
range: RThe range of the declared function, i.e. its return type.
span: Option<Span>The optional source span the declaration comes from.
Implementations§
Source§impl<D: ToSort, R: ToSort> Declaration<D, R>
impl<D: ToSort, R: ToSort> Declaration<D, R>
Sourcepub fn function<'a>(
name: impl Into<Identifier<'a>>,
domain: impl IntoIterator<Item = D>,
range: R,
) -> Declaration<D, R>
pub fn function<'a>( name: impl Into<Identifier<'a>>, domain: impl IntoIterator<Item = D>, range: R, ) -> Declaration<D, R>
Declare a function (or a constant, or a sort).
This is the most general constructor. It is more convenient than directly constructing the
Declaration struct because of implicit conversions of the arguments and the absence
of the span argument which is put to None by default, since most of the time when
using the API directly, declarations do not have a source span.
If the declaration do have a span it can be set using over().
In the following example we declare a function taking a integer argument and returning a real and we set it to a given span.
solver.declare(Declaration::function("f", [sort!(Int)], sort!(Real)))?;Source§impl<D: ToSort> Declaration<D, Sort>
impl<D: ToSort> Declaration<D, Sort>
Sourcepub fn predicate<'a>(
name: impl Into<Identifier<'a>>,
domain: impl IntoIterator<Item = D>,
) -> Declaration<D, Sort>
pub fn predicate<'a>( name: impl Into<Identifier<'a>>, domain: impl IntoIterator<Item = D>, ) -> Declaration<D, Sort>
Declare a predicate (i.e. a function returning Core::Bool().
This is equivalent to Declaration::function(name, domain, theories::Core::Bool()).
Source§impl<R: ToSort> Declaration<Sort, R>
impl<R: ToSort> Declaration<Sort, R>
Sourcepub fn constant<'a>(
name: impl Into<Identifier<'a>>,
sort: R,
) -> Declaration<Sort, R>
pub fn constant<'a>( name: impl Into<Identifier<'a>>, sort: R, ) -> Declaration<Sort, R>
Declare a constant (i.e. a function with no arguments).
This is equivalent to Declaration::function(name, Vec::<Sort>::new(), sort).
Source§impl Declaration<Sort, Sort>
impl Declaration<Sort, Sort>
Sourcepub fn sort<'a>(name: impl Into<Identifier<'a>>) -> Declaration<Sort, Sort>
pub fn sort<'a>(name: impl Into<Identifier<'a>>) -> Declaration<Sort, Sort>
Declare a sort (i.e. a constant of the special sort Sort::sort()).
This is equivalent to Declaration::constant(name, Sort::sort()).
Sourcepub fn boolean<'a>(name: impl Into<Identifier<'a>>) -> Declaration<Sort, Sort>
pub fn boolean<'a>(name: impl Into<Identifier<'a>>) -> Declaration<Sort, Sort>
Declare a Boolean constant (i.e. a constant of sort Core::Bool().
This is equivalent to Declaration::constant(name, theories::Core::Bool()).
Sourcepub fn integer<'a>(name: impl Into<Identifier<'a>>) -> Declaration<Sort, Sort>
pub fn integer<'a>(name: impl Into<Identifier<'a>>) -> Declaration<Sort, Sort>
Declare an integer constant (i.e. a constant of sort Ints::Int().
This is equivalent to Declaration::constant(name, theories::Ints::Int()).
Sourcepub fn real<'a>(name: impl Into<Identifier<'a>>) -> Declaration<Sort, Sort>
pub fn real<'a>(name: impl Into<Identifier<'a>>) -> Declaration<Sort, Sort>
Declare a real constant (i.e. a constant of sort Reals::Real().
This is equivalent to Declaration::constant(name, theories::Reals::Real()).
Trait Implementations§
impl<D: Eq + ToSort, R: Eq + ToSort> Eq for Declaration<D, R>
impl<D: PartialEq + ToSort, R: PartialEq + ToSort> StructuralPartialEq for Declaration<D, R>
Auto Trait Implementations§
impl<D, R> Freeze for Declaration<D, R>
impl<D, R> RefUnwindSafe for Declaration<D, R>
impl<D, R> Send for Declaration<D, R>
impl<D, R> Sync for Declaration<D, R>
impl<D, R> Unpin for Declaration<D, R>
impl<D, R> UnsafeUnpin for Declaration<D, R>
impl<D, R> UnwindSafe for Declaration<D, R>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more