Skip to main content

Crate semi_persistent_egraph

Crate semi_persistent_egraph 

Source

Re-exports§

pub use classes::EClasses;
pub use config::EGraphConfig;
pub use id::ENodeId;
pub use id::ENodeKind;
pub use id::OpId;
pub use id::SortId;
pub use registry::OpRegistry;
pub use registry::SortRegistry;
pub use union_find::UnionFind;
pub use semi_persistent_containers as containers;

Modules§

ac_invariants
Executable invariant checks for the AC reduced-basis (design §6b/§9a/§9b).
apply
Compiled RHS terms and apply function.
ast
AST types for the Semper surface language.
au
Anti-unification over the frozen e-graph.
caches
Generic node caches — hash-consing tables parameterized by id types.
canon
Canonization strategies for node children during rebuild.
cc
AC congruence completion: superposition + inter-reduction during rebuild.
classes
Equivalence classes with integrated union-find and parent use-lists.
compile
Pattern compiler: flatten recursive patterns into atomic constraints.
config
E-graph configuration trait — bundles all id types for a concrete e-graph.
director
Director bitmatrix primitives for the future alpha-equivalence design.
ematch
E-matching execution over flattened relational atoms.
extract
Optimal term extraction: pull the lowest-cost term from an e-class.
id
Concrete e-graph identifier types.
index
Transient sorted indices for leapfrog triejoin, bulk-rebuilt from e-graph state.
interpret
Layer 7: Command language interpreter.
lca
Batch LCA queries on the proof forest via Bender–Farach-Colton.
leapfrog
Leapfrog triejoin — intersect N sorted iterators.
lit_model
Literal value model — defines the value representation, literal sorts, and primitive operations available for computation in rules.
literal
Literal value interning.
model
Configurable literal model with macro-generated minimal enums.
multiplicity
Multiplicities for AC multiset nodes.
multiset
Multiset algebra over canonical AC child slices.
node_store
Generic node store facade — caches + typed routing, parameterized by id types.
node_types
Generic node types for the e-graph node stores.
nodes
Concrete local DenseId types (one per node kind) and DefaultNodeIds.
parser
New parser for the unified surface syntax (§36).
phase_timing
Per-phase wall-clock accounting for the saturation round loop.
registry
Sort and operator registries.
resolve
Resolve pass: validate and type-check flat atoms against OpRegistry + LitModel.
saturate
Equality saturation driver loop.
schedule
Query scheduler: order variables and assign index constraints.
sortcheck
Sort-checking: validate that all terms and patterns are well-sorted, resolve operator and sort names to dense ids, produce CCommand.
surface_ast
Surface AST — uniform syntax before resolve-time dispatch.
typed_routing
Typed routing table: maps global id G → NodeRef<I>.
union_find
Semi-persistent union-find with optional proof tracking.
viz
E-graph visualization: export to GraphViz DOT.

Macros§

impl_mset_child_pair
The five mset_child_* bodies for a config whose C is MSetChild<G, M> — i.e. any config that stores AC children as an id/multiplicity pair. Emitted rather than hand-written per config so the checked increment in mset_child_merge cannot drift between configs: a duplicated hand-written impl is where an unchecked + 1 can hide.

Structs§

EGraph
EGraphToken
IdFactory
Sequential id allocator.
ProofDumpStats
Aggregate counts from EGraph::dump_all_proofs.
SparseSet
Semi-persistent sparse set with stable IDs.

Enums§

CompletionOutcome
Outcome of the AC congruence-completion pass inside rebuild.
UnionBy
Survivor policy for class merges (--union-by). Rank leaves the choice to the union-find’s rank heuristic (the historical default). The directed criteria absorb the cheap side, reading the verified per-class counters: Size compares member counts (bounds the semi-naive touched-log pushes to amortized O(n log n) — a node is absorbed at most log n times), Uses compares use-list lengths (bounds recanonization work the same way), and Sum adds the two, bounding their aggregate movement. Survivor identity is intended to be semantically irrelevant because class payloads are merge-folded (design doc §9a), and finite differential tests compare the policies. This is not an end-to-end equivalence theorem; budget-, goal-, or order-sensitive runs may follow different operational paths.

Constants§

DEFAULT_COMPLETION_NODE_BUDGET
Default node-growth budget for one completion-enabled rebuild (see EGraph::set_completion_node_budget).

Traits§

DenseId
An id type in bijection with a dense usize range [0, max). Used to index arena vectors (list ids → heads, node ids → nodes). Modeled like IndexLike (ghost as_nat + injective + bounded) plus exec as_usize / from_usize.
IndexLike
Bijection between an exec index type and nat.

Type Aliases§

EGraph31
Type alias for the default 31-bit configuration.
EGraph63
Type alias for the 63-bit configuration.
EGraphM16
Type alias for 31-bit ids with a 16-bit multiplicity (crate::nodes::ConfigM16).