Skip to main content

FlatConstraint

Struct FlatConstraint 

Source
pub struct FlatConstraint<T: Types> {
    pub binders: Vec<(T::Var, Sort<T>)>,
    pub assumptions: FxIndexSet<Pred<T>>,
    pub head: Pred<T>,
    pub tag: Option<T::Tag>,
}

Fields§

§binders: Vec<(T::Var, Sort<T>)>

All of the binders that come before the head.

NOTE: There should be no duplicates among the binders which are used (so e.g. UNDERSCORE appearing multiple times is OK).

§assumptions: FxIndexSet<Pred<T>>

All of the assumptions (i.e. a flattened conjunction of predicates from all of the binders)

§head: Pred<T>§tag: Option<T::Tag>

Implementations§

Source§

impl<T: Types> FlatConstraint<T>

Source

pub fn remove_binders( &self, vars: &HashSet<T::Var>, ) -> (Vec<ConstDecl<T>>, FlatConstraint<T>)

Removes any binder corresponding to a given var. Returns the new constraint along with the removed binders and their sorts.

NOTE: Assumes that all binders are unique and therefore there are no name clashes.

Source

pub fn add_assumption(&mut self, assumption: Pred<T>)

Source

pub fn preconditions(&self) -> FxIndexSet<Pred<T>>

Source

pub fn wkvars_and_constrs( &self, ) -> Vec<(WKVar<T>, FlatConstraint<T>, Vec<FlatConstraint<T>>)>

Each element of the output is a wkvar, the constraint it corresponds to, and the other constraints which must also hold.

We essentially “decompose” each assumption which contains a wkvar in order to transform the constraint into one in which that wkvar is exposed.

These decompositions are of two forms.

  1. Hoisting existentials to the top level.
  2. Splitting disjuncts using the below property. When we split a disjunct, we generate other constraints. A more sophisticated analysis might try and solve multiple constraints simultaneously; if we were to do this, we would probably want to change how this algorithm works to avoid redundancy, e.g. by instead of generating ((wkvar, constr, other_constrs) outputs generating (all_constrs) outputs and letting consumers choose which wkvars to solve in each constr.
(p || q) => c
==
(p => c) && (q => c)

Trait Implementations§

Source§

impl<T: Types> Clone for FlatConstraint<T>

Source§

fn clone(&self) -> Self

Returns a duplicate 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<T: Types> Debug for FlatConstraint<T>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> Freeze for FlatConstraint<T>
where <T as Types>::KVar: Freeze, <T as Types>::Tag: Freeze, <T as Types>::Var: Freeze, <T as Types>::Real: Freeze, <T as Types>::String: Freeze, <T as Types>::Sort: Freeze,

§

impl<T> RefUnwindSafe for FlatConstraint<T>

§

impl<T> Send for FlatConstraint<T>
where <T as Types>::KVar: Send, <T as Types>::Tag: Send, <T as Types>::Var: Send, <T as Types>::Real: Send, <T as Types>::String: Send, <T as Types>::Sort: Send,

§

impl<T> Sync for FlatConstraint<T>
where <T as Types>::KVar: Sync, <T as Types>::Tag: Sync, <T as Types>::Var: Sync, <T as Types>::Real: Sync, <T as Types>::String: Sync, <T as Types>::Sort: Sync,

§

impl<T> Unpin for FlatConstraint<T>
where <T as Types>::KVar: Unpin, <T as Types>::Tag: Unpin, <T as Types>::Var: Unpin, <T as Types>::Real: Unpin, <T as Types>::String: Unpin, <T as Types>::Sort: Unpin,

§

impl<T> UnwindSafe for FlatConstraint<T>
where <T as Types>::KVar: UnwindSafe, <T as Types>::Tag: UnwindSafe, <T as Types>::Var: UnwindSafe, <T as Types>::Real: UnwindSafe, <T as Types>::String: UnwindSafe, <T as Types>::Sort: UnwindSafe,

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, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
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, 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.