Skip to main content

EGraph

Struct EGraph 

Source
pub struct EGraph<L: Language, N: Analysis<L> = ()> {
    pub analysis: N,
    /* private fields */
}
Expand description

A datastructure to efficiently represent congruence relations on terms with binders.

Fields§

§analysis: N

Implementations§

Source§

impl<L: Language, N: Analysis<L>> EGraph<L, N>

Source

pub fn explain_equivalence( &mut self, t1: RecExpr<L>, t2: RecExpr<L>, ) -> ProvenEq

Source§

impl<L: Language, N: Analysis<L>> EGraph<L, N>

Source

pub fn is_alive(&self, i: Id) -> bool

Returns whether an id is still alive, or whether it was merged into another class.

Source

pub fn find_applied_id(&self, i: &AppliedId) -> AppliedId

Source

pub fn ids(&self) -> Vec<Id>

Source§

impl<L: Language, N: Analysis<L>> EGraph<L, N>

Source

pub fn add_syn_expr(&mut self, re: RecExpr<L>) -> AppliedId

Source

pub fn add_syn(&mut self, enode: L) -> AppliedId

Source§

impl<L: Language, N: Analysis<L>> EGraph<L, N>

Source

pub fn add_expr(&mut self, re: RecExpr<L>) -> AppliedId

Source

pub fn add(&mut self, enode: L) -> AppliedId

Source

pub fn lookup(&self, n: &L) -> Option<AppliedId>

Source§

impl<L: Language, N: Analysis<L>> EGraph<L, N>

Source

pub fn alloc_empty_eclass(&mut self, slots: &SmallHashSet<Slot>) -> Id

Source§

impl<L: Language, N: Analysis<L>> EGraph<L, N>

Source

pub fn union(&mut self, l: &AppliedId, r: &AppliedId) -> bool

Source

pub fn union_justified( &mut self, l: &AppliedId, r: &AppliedId, j: Option<String>, ) -> bool

Source

pub fn union_instantiations( &mut self, from_pat: &Pattern<L>, to_pat: &Pattern<L>, subst: &Subst, justification: Option<String>, ) -> bool

Source§

impl<L: Language, N: Analysis<L>> EGraph<L, N>

Source

pub fn mk_identity_applied_id(&self, i: Id) -> AppliedId

Source

pub fn check(&self)

Source§

impl<L: Language, N: Analysis<L>> EGraph<L, N>

Source

pub fn new(analysis: N) -> Self

Creates an empty e-graph.

Source

pub fn with_subst_method<S: SubstMethod<L, N>>(analysis: N) -> Self

Creates an empty e-graph, while specifying the substitution method to use.

Source

pub fn slots(&self, id: Id) -> SmallHashSet<Slot>

Source

pub fn analysis_data(&self, i: Id) -> &N::Data

Source

pub fn analysis_data_mut(&mut self, i: Id) -> &mut N::Data

Source

pub fn enodes(&self, i: Id) -> HashSet<L>

Source

pub fn enodes_applied(&self, i: &AppliedId) -> Vec<L>

Source

pub fn total_number_of_nodes(&self) -> usize

Source

pub fn eq(&self, a: &AppliedId, b: &AppliedId) -> bool

Checks that two AppliedIds are semantically equal.

Source

pub fn dump(&self)

Prints the contents of the E-Graph. Helpful for debugging.

Source

pub fn get_syn_expr(&self, i: &AppliedId) -> RecExpr<L>

Returns the canonical term corresponding to i.

This function will use EGraph::get_syn_node repeatedly to build up this term.

Source

pub fn get_syn_node(&self, i: &AppliedId) -> L

Returns the canonical e-node corresponding to i.

Source§

impl<L: Language, N: Analysis<L>> EGraph<L, N>

Source

pub fn progress(&self) -> ProgressMeasure

Computes the ProgressMeasure of this E-Graph.

Trait Implementations§

Source§

impl<L: Language, N: Analysis<L>> Debug for EGraph<L, N>

Source§

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

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

impl<L: Language, N: Analysis<L> + Default> Default for EGraph<L, N>

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<L, N = ()> !Freeze for EGraph<L, N>

§

impl<L, N = ()> !RefUnwindSafe for EGraph<L, N>

§

impl<L, N = ()> !Send for EGraph<L, N>

§

impl<L, N = ()> !Sync for EGraph<L, N>

§

impl<L, N> Unpin for EGraph<L, N>
where N: Unpin, L: Unpin, <N as Analysis<L>>::Data: Unpin,

§

impl<L, N> UnsafeUnpin for EGraph<L, N>
where N: UnsafeUnpin,

§

impl<L, N = ()> !UnwindSafe for EGraph<L, N>

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