NonMinusIntegerExpr

pub enum NonMinusIntegerExpr<T: Atomic> {
    Atom(T),
    Const(u32),
    NegConst(u32),
    Param(Parameter),
    BinaryExpr(Box<NonMinusIntegerExpr<T>>, NonMinusIntegerOp, Box<NonMinusIntegerExpr<T>>),
}
Expand description

Integer expression that does not contain a minus operator, i.e., no negations or subtractions, only negated constants are allowed.

Variants§

§

Atom(T)

Atomic of type T

§

Const(u32)

Integer constant

§

NegConst(u32)

Negated integer constant

§

Param(Parameter)

Parameter

§

BinaryExpr(Box<NonMinusIntegerExpr<T>>, NonMinusIntegerOp, Box<NonMinusIntegerExpr<T>>)

Integer expression combining two Integer expressions through an arithmetic operator

Implementations§

Source§

impl<T> NonMinusIntegerExpr<T>
where T: Atomic,

Source

pub fn remove_div(self) -> Result<NoDivIntegerExpr<T>, ConstraintRewriteError>

Remove all division operators from the expression

This function recursively evaluates the expression and tries to simplify it by removing all division operators. If the formula is not linear arithmetic, an error is returned. This is the case if a parameter or atom appears in the denominator of a division.

Note that we do not implement full symbolic math, therefore it could be the case that the expression is linear arithmetic but requires simplification (e.g. that violating atom also appears in the denominator and could be removed by a simplification step).

Source

pub fn try_to_fraction(&self) -> Option<Fraction>

Attempt to parse the expression into a fraction by recursively evaluating the expression

This function returns None if the expression contains any atoms or parameters. Otherwise, it returns a fraction equivalent to the original expression

Trait Implementations§

Source§

impl<T: Clone + Atomic> Clone for NonMinusIntegerExpr<T>

Source§

fn clone(&self) -> NonMinusIntegerExpr<T>

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: Debug + Atomic> Debug for NonMinusIntegerExpr<T>

Source§

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

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

impl<T: Atomic> Display for NonMinusIntegerExpr<T>

Source§

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

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

impl<T: Atomic> From<IntegerExpression<T>> for NonMinusIntegerExpr<T>

Source§

fn from(val: IntegerExpression<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: Atomic> From<NonMinusIntegerExpr<T>> for IntegerExpression<T>

Source§

fn from(val: NonMinusIntegerExpr<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: PartialEq + Atomic> PartialEq for NonMinusIntegerExpr<T>

Source§

fn eq(&self, other: &NonMinusIntegerExpr<T>) -> 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<T: Atomic> TryFrom<NonMinusIntegerExpr<T>> for NoDivIntegerExpr<T>

Source§

type Error = ConstraintRewriteError

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

fn try_from(value: NonMinusIntegerExpr<T>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<T: Atomic> StructuralPartialEq for NonMinusIntegerExpr<T>

Auto Trait Implementations§

§

impl<T> Freeze for NonMinusIntegerExpr<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for NonMinusIntegerExpr<T>
where T: RefUnwindSafe,

§

impl<T> Send for NonMinusIntegerExpr<T>
where T: Send,

§

impl<T> Sync for NonMinusIntegerExpr<T>
where T: Sync,

§

impl<T> Unpin for NonMinusIntegerExpr<T>
where T: Unpin,

§

impl<T> UnwindSafe for NonMinusIntegerExpr<T>
where T: 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> 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 = 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.