Skip to main content

EGraph

Struct EGraph 

Source
pub struct EGraph { /* private fields */ }
Expand description

Extended equality graph for congruence closure with E-node tracking.

Provides richer structure than CongruenceClosure for proof reconstruction.

Implementations§

Source§

impl EGraph

Source

pub fn new() -> Self

Create an empty E-graph.

Source

pub fn add_expr(&mut self, expr: Expr) -> usize

Add an expression to the E-graph (creating a new singleton class if not present).

Source

pub fn find_class(&self, expr: &Expr) -> Option<usize>

Get the class ID for an expression, if present.

Source

pub fn merge_classes(&mut self, id1: usize, id2: usize, proof: Option<Expr>)

Merge two equivalence classes.

Source

pub fn are_equal(&self, e1: &Expr, e2: &Expr) -> bool

Check if two expressions are in the same class.

Source

pub fn add_equality(&mut self, e1: Expr, e2: Expr, proof: Option<Expr>)

Add an equality e1 = e2 with optional proof.

Source

pub fn num_classes(&self) -> usize

Get the number of equivalence classes.

Source

pub fn get_class(&self, id: usize) -> Option<&ENode>

Get an E-node by class ID.

Source

pub fn representative(&self, expr: &Expr) -> Option<&Expr>

Get the representative of the class containing expr.

Source

pub fn clear(&mut self)

Clear the E-graph.

Trait Implementations§

Source§

impl Default for EGraph

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