Struct term_rewriting::Rule [−][src]
Fields
lhs: Term
rhs: Vec<Term>
Methods
impl Rule
[src]
impl Rule
pub fn display(&self, sig: &Signature) -> String
[src]
pub fn display(&self, sig: &Signature) -> String
A serialized representation of the Rule.
pub fn pretty(&self, sig: &Signature) -> String
[src]
pub fn pretty(&self, sig: &Signature) -> String
A human-readable serialization of the Rule.
pub fn size(&self) -> usize
[src]
pub fn size(&self) -> usize
Return the total number of subterms across all terms in the rule.
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
Return the number of RHSs in the rule
pub fn is_empty(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
Is the rule empty?
pub fn rhs(&self) -> Option<Term>
[src]
pub fn rhs(&self) -> Option<Term>
Give the lone RHS, if it exists
pub fn clauses(&self) -> Vec<Rule>
[src]
pub fn clauses(&self) -> Vec<Rule>
Return a list of the clauses in the Rule
.
pub fn new(lhs: Term, rhs: Vec<Term>) -> Option<Rule>
[src]
pub fn new(lhs: Term, rhs: Vec<Term>) -> Option<Rule>
Construct a rewrite rule from a left-hand-side (LHS) Term
with one
or more right-hand-side (RHS) Term
s. Returns None
if the rule is
not valid.
Valid rules meet two conditions:
lhs
is anApplication
. This prevents a single rule from matching all possible terms- A
Term
inrhs
can only use aVariable
if it appears inlhs
. This prevents rewrites from inventing arbitrary terms.
pub fn add(&mut self, t: Term)
[src]
pub fn add(&mut self, t: Term)
Add a clause to the rule from a term.
pub fn merge(&mut self, r: &Rule)
[src]
pub fn merge(&mut self, r: &Rule)
Add clauses to the rule from another rule.
pub fn discard(&mut self, r: &Rule) -> Option<Rule>
[src]
pub fn discard(&mut self, r: &Rule) -> Option<Rule>
Discard clauses from the rule.
pub fn contains(&self, r: &Rule) -> Option<HashMap<Variable, Term>>
[src]
pub fn contains(&self, r: &Rule) -> Option<HashMap<Variable, Term>>
Check whether the rule contains certain clauses.
pub fn variables(&self) -> Vec<Variable>
[src]
pub fn variables(&self) -> Vec<Variable>
Get all the Variables in the Rule.
pub fn operators(&self) -> Vec<Operator>
[src]
pub fn operators(&self) -> Vec<Operator>
Get all the Operators in the Rule.
pub fn subterms(&self) -> Vec<(usize, &Term, Place)>
[src]
pub fn subterms(&self) -> Vec<(usize, &Term, Place)>
Get all the subterms and places in a Rule.
pub fn at(&self, p: &[usize]) -> Option<&Term>
[src]
pub fn at(&self, p: &[usize]) -> Option<&Term>
Get a specific subterm in a Rule
pub fn replace(&self, place: &[usize], subterm: Term) -> Option<Rule>
[src]
pub fn replace(&self, place: &[usize], subterm: Term) -> Option<Rule>
Replace one subterm with another in a Rule
pub fn pmatch(r1: Rule, r2: Rule) -> Option<HashMap<Variable, Term>>
[src]
pub fn pmatch(r1: Rule, r2: Rule) -> Option<HashMap<Variable, Term>>
Match one rule against another.
pub fn unify(r1: Rule, r2: Rule) -> Option<HashMap<Variable, Term>>
[src]
pub fn unify(r1: Rule, r2: Rule) -> Option<HashMap<Variable, Term>>
Unify two rules.
pub fn alpha(r1: &Rule, r2: &Rule) -> Option<HashMap<Variable, Term>>
[src]
pub fn alpha(r1: &Rule, r2: &Rule) -> Option<HashMap<Variable, Term>>
Compute the alpha equivalence between two rules.
pub fn substitute(&self, sub: &HashMap<Variable, Term>) -> Rule
[src]
pub fn substitute(&self, sub: &HashMap<Variable, Term>) -> Rule
Substitute through a rule
Trait Implementations
impl Debug for Rule
[src]
impl Debug for Rule
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Clone for Rule
[src]
impl Clone for Rule
fn clone(&self) -> Rule
[src]
fn clone(&self) -> Rule
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl PartialEq for Rule
[src]
impl PartialEq for Rule
fn eq(&self, other: &Rule) -> bool
[src]
fn eq(&self, other: &Rule) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rule) -> bool
[src]
fn ne(&self, other: &Rule) -> bool
This method tests for !=
.
impl Eq for Rule
[src]
impl Eq for Rule
impl Hash for Rule
[src]
impl Hash for Rule