pub struct UninterpretedFn {
    name: String,
    annotation: String,
    arguments: Vec<FnArgument>,
    tree: Option<FnTree>,
    expression: String,
}
Expand description

An uninterpreted function of a partially specified model.

Field arguments hold information regarding properties of the function with respect to each of its arguments (in order). It also tracks the arity.

You can leave the function completely unspecified, or you can add an “partial expression”. Field tree holds the parsed version of that formula, while expression tracks the original formula.

Fields§

§name: String§annotation: String§arguments: Vec<FnArgument>§tree: Option<FnTree>§expression: String

Implementations§

source§

impl UninterpretedFn

Creating new UninterpretedFn instances.

source

pub fn new_without_constraints( name: &str, arity: usize, ) -> Result<UninterpretedFn, String>

Create new UninterpretedFn object that has no constraints regarding monotonicity, essentiality, or its expression. Annotation is empty.

source

pub fn new( name: &str, annotation: &str, expression: &str, arguments: Vec<FnArgument>, model: &ModelState, own_id: &UninterpretedFnId, ) -> Result<UninterpretedFn, String>

Create new UninterpretedFn instance given all its raw components.

The model and function’s ID are used for validity check during argument parsing.

source

pub fn with_new_expression( original_fn: UninterpretedFn, new_expression: &str, context: &ModelState, own_id: &UninterpretedFnId, ) -> Result<UninterpretedFn, String>

Create uninterpreted function using another one as a template, but changing the expression. The provided original function object is consumed.

source

pub fn with_substituted_fn_symbol( original_fn: UninterpretedFn, old_id: &UninterpretedFnId, new_id: &UninterpretedFnId, context: &ModelState, ) -> UninterpretedFn

Create uninterpreted function from another one, substituting all occurrences of a given function symbol in the syntactic tree. The provided original function object is consumed.

source§

impl UninterpretedFn

Editing UninterpretedFn instances.

source

pub fn set_name(&mut self, new_name: &str) -> Result<(), String>

Rename this uninterpreted fn.

source

pub fn set_annotation(&mut self, annotation: &str)

Change annotation of this uninterpreted fn.

source

pub fn set_arity(&mut self, new_arity: usize) -> Result<(), String>

Change arity of this uninterpreted fn.

If arity is made larger, default arguments (without monotonicity/essentiality constraints) are added. If arity is made smaller, last arguments are dropped. These must not be used in function’s expression.

source

pub fn drop_last_argument(&mut self) -> Result<(), String>

Drop the last argument of the function, essentially decrementing the arity of this uninterpreted fn. The last argument must not be used in function’s expression.

source

pub fn add_argument( &mut self, monotonicity: Monotonicity, essentiality: Essentiality, )

Add an argument with specified monotonicity/essentiality. Argument is added at the end of the current argument list.

source

pub fn add_default_argument(&mut self)

Add default argument (with unknown monotonicity/essentiality) for this function. Argument is added at the end of the current argument list.

source

pub fn set_fn_expression( &mut self, new_expression: &str, model: &ModelState, own_id: &UninterpretedFnId, ) -> Result<(), String>

Set the function’s expression to a given string.

model is used to provide context regarding valid IDs.

We also need ID of this uninterpreted function to ensure that the expression is not defined recursively, i.e., to check that expression of function f does not contain f inside.

source

pub fn set_argument( &mut self, index: usize, argument: FnArgument, ) -> Result<(), String>

Set properties of an argument with given index (starting from 0).

source

pub fn set_essential( &mut self, index: usize, essential: Essentiality, ) -> Result<(), String>

Set Essentiality of argument with given index (starting from 0).

source

pub fn set_monotonic( &mut self, index: usize, monotone: Monotonicity, ) -> Result<(), String>

Set Monotonicity of argument with given index (starting from 0).

source

pub fn set_all_arguments( &mut self, argument_list: Vec<FnArgument>, ) -> Result<(), String>

Set the properties for all arguments (essentially replacing the current version). The number of arguments must stay the same, not changing arity.

source

pub fn substitute_fn_symbol( &mut self, old_id: &UninterpretedFnId, new_id: &UninterpretedFnId, context: &ModelState, )

Substitute all occurrences of a given function symbol in the syntactic tree.

source§

impl UninterpretedFn

Observing UninterpretedFn instances.

source

pub fn get_name(&self) -> &str

Human-readable name of this uninterpreted fn.

source

pub fn get_annotation(&self) -> &str

Annotation of this uninterpreted fn.

source

pub fn get_arity(&self) -> usize

Read arity (number of arguments) of this uninterpreted fn.

source

fn get_highest_var_idx_in_expression(&self) -> Option<usize>

Get highest index of a variable that is actually used in the function’s expression. This number might be lower than function’s actual arity.

source

pub fn get_fn_expression(&self) -> &str

Get function’s expression.

source

pub fn get_argument(&self, index: usize) -> &FnArgument

Get function’s argument (FnArgument object) on given index (starting from 0).

source

pub fn get_essential(&self, index: usize) -> &Essentiality

Get Essentiality of argument with given index (starting from 0).

source

pub fn get_monotonic(&self, index: usize) -> &Monotonicity

Get Monotonicity of argument with given index (starting from 0).

source

pub fn get_all_arguments(&self) -> &Vec<FnArgument>

Get list of all ordered arguments (FnArgument objects) of this function.

source

pub fn collect_variables(&self) -> HashSet<VarId>

Return a set of all variables that are actually used as inputs in this function.

source

pub fn collect_fn_symbols(&self) -> HashSet<UninterpretedFnId>

Return a set of all uninterpreted fns that are actually used in this function.

Trait Implementations§

source§

impl Clone for UninterpretedFn

source§

fn clone(&self) -> UninterpretedFn

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for UninterpretedFn

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for UninterpretedFn

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for UninterpretedFn

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq for UninterpretedFn

source§

fn eq(&self, other: &UninterpretedFn) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for UninterpretedFn

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for UninterpretedFn

source§

impl StructuralPartialEq for UninterpretedFn

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<'de, D, R> CommandArg<'de, R> for D
where D: Deserialize<'de>, R: Runtime,

§

fn from_command(command: CommandItem<'de, R>) -> Result<D, InvokeError>

Derives an instance of Self from the [CommandItem]. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T

§

impl<T> UserEvent for T
where T: Debug + Clone + Send + 'static,