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,
impl<T> NonMinusIntegerExpr<T>where
T: Atomic,
Sourcepub fn remove_div(self) -> Result<NoDivIntegerExpr<T>, ConstraintRewriteError>
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).
Sourcepub fn try_to_fraction(&self) -> Option<Fraction>
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>
impl<T: Clone + Atomic> Clone for NonMinusIntegerExpr<T>
Source§fn clone(&self) -> NonMinusIntegerExpr<T>
fn clone(&self) -> NonMinusIntegerExpr<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more