pub struct CompilerEGraph { /* private fields */ }Implementations§
Source§impl CompilerEGraph
impl CompilerEGraph
pub fn new() -> Self
pub fn node_count(&self) -> usize
pub fn find(&mut self, id: NodeId) -> NodeId
Sourcepub fn canonical_node(&mut self, id: NodeId) -> CompilerENode
pub fn canonical_node(&mut self, id: NodeId) -> CompilerENode
The stored node with children mapped to their CURRENT class roots.
Sourcepub fn class_members(&mut self, id: NodeId) -> Vec<NodeId> ⓘ
pub fn class_members(&mut self, id: NodeId) -> Vec<NodeId> ⓘ
Member node ids of id’s class, in insertion order (deterministic).
Sourcepub fn add(&mut self, node: CompilerENode) -> NodeId
pub fn add(&mut self, node: CompilerENode) -> NodeId
Hash-consing insert: an existing congruent node is returned instead of allocating. Literal leaves seed their own class facts.
Sourcepub fn union(&mut self, a: NodeId, b: NodeId) -> bool
pub fn union(&mut self, a: NodeId, b: NodeId) -> bool
Merge two classes. Facts intersect (both described the same value). Returns true if a merge actually happened.
Sourcepub fn rebuild(&mut self)
pub fn rebuild(&mut self)
Restore the congruence invariant: parents of merged classes are re-canonicalized; newly congruent pairs are unioned (worklist).
pub fn set_scalar(&mut self, id: NodeId, kind: ScalarKind)
pub fn set_int_range(&mut self, id: NodeId, lo: i64, hi: i64)
pub fn scalar_of(&mut self, id: NodeId) -> Option<ScalarKind>
pub fn int_range(&mut self, id: NodeId) -> Option<(i64, i64)>
Sourcepub fn int_value(&mut self, id: NodeId) -> Option<i64>
pub fn int_value(&mut self, id: NodeId) -> Option<i64>
A PROVEN single value (point interval) — sound grounds for folding.
pub fn proven_nonneg(&mut self, id: NodeId) -> bool
Sourcepub fn set_collection(&mut self, id: NodeId)
pub fn set_collection(&mut self, id: NodeId)
Mark the class a proven collection (list/text/map/set).
pub fn proven_collection(&mut self, id: NodeId) -> bool
pub fn proven_list(&mut self, id: NodeId) -> bool
Sourcepub fn class_has_bool(&mut self, id: NodeId, b: bool) -> bool
pub fn class_has_bool(&mut self, id: NodeId, b: bool) -> bool
Does the class contain the literal Bool(b)?
Sourcepub fn provably_total(&mut self, id: NodeId) -> bool
pub fn provably_total(&mut self, id: NodeId) -> bool
Whole-tree totality: the class has at least one member whose op is total and whose children are recursively total. A rewrite may only DELETE (stop evaluating) a provably total subterm — anything else could erase a runtime error or an effect. Bottom-up fixpoint, cycle-tolerant (cycles stay “not yet proven” until a leaf grounds them).
Totality is FACT-CONDITIONAL where the op’s only failure mode is a
kind error: Len/Copy/Contains never raise over a PROVEN
collection, and raise a type error over anything unproven — so
without the fact they stay non-total, exactly like fold.rs’s
fail-closed expr_is_total.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CompilerEGraph
impl RefUnwindSafe for CompilerEGraph
impl Send for CompilerEGraph
impl Sync for CompilerEGraph
impl Unpin for CompilerEGraph
impl UnsafeUnpin for CompilerEGraph
impl UnwindSafe for CompilerEGraph
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.