Skip to main content

Expr

Struct Expr 

Source
pub struct Expr(/* private fields */);
Expand description

An expression: an immutable value, cheap to clone and share.

Implementations§

Source§

impl Expr

Source

pub fn relation(r: &Relation) -> Expr

The relation as an expression. A relation of arity 0 gives an ill-formed expression (arity.zero).

Source

pub fn variable(v: &Variable) -> Expr

The variable as an expression, of its arity.

Source

pub fn none() -> Expr

none, the empty set.

Source

pub fn univ() -> Expr

univ, every atom.

Source

pub fn iden() -> Expr

iden, every pair of an atom with itself.

Source

pub fn arity(&self) -> Option<usize>

The arity, or None if the expression is ill-formed.

Source

pub fn kind(&self) -> &ExprKind

What the expression is made of.

Source

pub fn place(&self) -> &Place

Where it was built.

Source

pub fn own_errors(&self) -> &[Error]

The errors recorded when this node was built, not its parts’.

Source

pub fn placed(&self, place: Place) -> Expr

The same node, at another place: for a node built from model text, the place in the text. Errors recorded at this node move with it.

Source

pub fn same_node(&self, other: &Expr) -> bool

Whether two handles are the same node.

Source

pub fn apply_binary(&self, op: BinaryOp, other: &Expr) -> Expr

self op other, for any binary operator.

Source

pub fn apply_unary(&self, op: UnaryOp) -> Expr

op self, for any unary operator.

Source

pub fn apply_multiplicity(&self, m: Multiplicity) -> Formula

m self, for any multiplicity.

Source

pub fn union(&self, other: &Expr) -> Expr

self + other

Source

pub fn intersection(&self, other: &Expr) -> Expr

self & other

Source

pub fn difference(&self, other: &Expr) -> Expr

self - other

Source

pub fn join(&self, other: &Expr) -> Expr

self . other

Source

pub fn product(&self, other: &Expr) -> Expr

self -> other

Source

pub fn override_with(&self, other: &Expr) -> Expr

self ++ other

Source

pub fn domain_restriction(&self, other: &Expr) -> Expr

self <: other, with self the set.

Source

pub fn range_restriction(&self, other: &Expr) -> Expr

self :> other, with other the set.

Source

pub fn prime(&self) -> Expr

self', the value in the next state.

Source

pub fn transpose(&self) -> Expr

~self

Source

pub fn closure(&self) -> Expr

^self

Source

pub fn reflexive_closure(&self) -> Expr

*self

Source

pub fn comprehension(decls: Vec<Decl>, formula: &Formula) -> Expr

{x1: e1, ..., xm: em | formula}, of arity m.

Source

pub fn if_then_else(condition: &Formula, then: &Expr, otherwise: &Expr) -> Expr

condition => then else otherwise

Source

pub fn is_in(&self, other: &Expr) -> Formula

self in other

Source

pub fn equals(&self, other: &Expr) -> Formula

self = other

Source

pub fn count(&self) -> IntExpr

#self, the number of its tuples (LOGIC.md 16.2).

Source

pub fn sum(&self) -> IntExpr

sum self, the integers of a set’s integer atoms, added (LOGIC.md 16.2).

Source

pub fn some(&self) -> Formula

some self

Source

pub fn no(&self) -> Formula

no self

Source

pub fn one(&self) -> Formula

one self

Source

pub fn lone(&self) -> Formula

lone self

Trait Implementations§

Source§

impl Clone for Expr

Source§

fn clone(&self) -> Expr

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Expr

Source§

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

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

impl Display for Expr

Expressions are written fully parenthesized, so the text is unambiguous.

Source§

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

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

impl From<&Relation> for Expr

Source§

fn from(r: &Relation) -> Expr

Converts to this type from the input type.
Source§

impl From<&Variable> for Expr

Source§

fn from(v: &Variable) -> Expr

Converts to this type from the input type.

Auto Trait Implementations§

§

impl Forget for Expr

§

impl Freeze for Expr
where *const ArcInner<ExprNode> is !null: Freeze, PhantomData<ArcInner<ExprNode>>: Freeze,

§

impl Move for Expr

§

impl RefUnwindSafe for Expr

§

impl Send for Expr
where Arc<ExprNode>: Send,

§

impl Sync for Expr
where Arc<ExprNode>: Sync,

§

impl Unpin for Expr
where Arc<ExprNode>: Unpin,

§

impl UnsafeUnpin for Expr
where *const ArcInner<ExprNode> is !null: UnsafeUnpin, PhantomData<ArcInner<ExprNode>>: UnsafeUnpin,

§

impl UnwindSafe for Expr
where Arc<ExprNode>: 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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§

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.