Struct egg::TreeTerm

source ·
pub struct TreeTerm<L: Language> {
    pub node: L,
    pub backward_rule: Option<Symbol>,
    pub forward_rule: Option<Symbol>,
    pub child_proofs: Vec<TreeExplanation<L>>,
    /* private fields */
}
Expand description

An explanation for a term and its equivalent children. Each child is a proof transforming the initial child into the final child term. The initial term is given by taking each first sub-term in each child_proofs recursively. The final term is given by all of the final terms in each child_proofs.

If forward_rule is provided, then this TreeTerm’s initial term can be derived from the previous TreeTerm by applying the rule. Similarly, if backward_rule is provided, then the previous TreeTerm’s final term is given by applying the rule to this TreeTerm’s initial term.

TreeTerms are flattened by first flattening child_proofs, then wrapping the flattened proof with this TreeTerm’s node.

Fields§

§node: L

A node representing this TreeTerm’s operator. The children of the node should be ignored.

§backward_rule: Option<Symbol>

A rule rewriting this TreeTerm’s initial term back to the last TreeTerm’s final term.

§forward_rule: Option<Symbol>

A rule rewriting the last TreeTerm’s final term to this TreeTerm’s initial term.

§child_proofs: Vec<TreeExplanation<L>>

A list of child proofs, each transforming the initial term to the final term for that child.

Implementations§

source§

impl<L: Language> TreeTerm<L>

source

pub fn new(node: L, child_proofs: Vec<TreeExplanation<L>>) -> TreeTerm<L>

Construct a new TreeTerm given its node and child_proofs.

source

pub fn get_initial_flat_term(&self) -> FlatTerm<L>

Get a FlatTerm representing the first term in this proof.

source

pub fn get_last_flat_term(&self) -> FlatTerm<L>

Get a FlatTerm representing the final term in this proof.

source

pub fn flatten_explanation(&self) -> FlatExplanation<L>

Construct the FlatExplanation for this TreeTerm.

Trait Implementations§

source§

impl<L: Clone + Language> Clone for TreeTerm<L>

source§

fn clone(&self) -> TreeTerm<L>

Returns a copy 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<L: Debug + Language> Debug for TreeTerm<L>

source§

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

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

impl<L: Language + Display + FromOp> Display for TreeTerm<L>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<L> RefUnwindSafe for TreeTerm<L>where L: RefUnwindSafe,

§

impl<L> !Send for TreeTerm<L>

§

impl<L> !Sync for TreeTerm<L>

§

impl<L> Unpin for TreeTerm<L>where L: Unpin,

§

impl<L> UnwindSafe for TreeTerm<L>where L: UnwindSafe + RefUnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. 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 Twhere 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 Twhere T: Clone,

§

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 Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.