Skip to main content

PolynomialInterpretation

Struct PolynomialInterpretation 

Source
pub struct PolynomialInterpretation {
    pub interpretations: HashMap<String, Vec<i64>>,
}
Expand description

A polynomial interpretation for proving termination of a TRS.

Each function symbol f of arity n is mapped to a polynomial p_f(x_1, …, x_n) with natural-number coefficients. A TRS is terminating if for every rule l → r, the polynomial interpretation satisfies Pol(l) > Pol(r) (as natural numbers for all assignments ≥ 0).

Fields§

§interpretations: HashMap<String, Vec<i64>>

Maps function symbol names to their polynomial coefficients.

For a unary symbol the vector [c0, c1] represents c0 + c1 * x1. For a binary symbol [c0, c1, c2] represents c0 + c1x1 + c2x2. Constants (arity 0) are represented as [c0].

Implementations§

Source§

impl PolynomialInterpretation

Source

pub fn new() -> Self

Create an empty polynomial interpretation.

Source

pub fn set(&mut self, symbol: impl Into<String>, coefficients: Vec<i64>)

Register an interpretation for symbol f: coefficients [c0, c1, …].

Source

pub fn eval(&self, t: &Term, assignment: &[i64]) -> i64

Evaluate the polynomial interpretation of term t given variable assignment.

Variable Var(i) maps to assignment[i].

Source

pub fn orients_rule(&self, rule: &Rule, max_val: i64) -> bool

Check whether rule lhs → rhs is oriented by this interpretation for all variable assignments in [0, max_val]^n.

Source

pub fn proves_termination(&self, trs: &Trs, max_val: i64) -> bool

Check whether this interpretation proves termination of the given TRS (all rules are strictly oriented for assignments in [0, max_val]^n).

Trait Implementations§

Source§

impl Clone for PolynomialInterpretation

Source§

fn clone(&self) -> PolynomialInterpretation

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 Debug for PolynomialInterpretation

Source§

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

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

impl Default for PolynomialInterpretation

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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