How egraphs-good/egg works
Main Components
a) Core E-Graph Engine Components:
• EGraph Module (src/egraph.rs)
• EClass Module (src/eclass.rs)
• Pattern Matching System (src/pattern.rs)
• Rewrite System (src/rewrite.rs)
• Extraction System (src/extract.rs, src/lp_extract.rs)
b) Supporting Components:
• Union-Find Data Structure (src/unionfind.rs)
• Language Framework (src/language.rs)
• Explanation System (src/explain.rs)
┌─ Core Layer ─────────────────────┐
• ┌─────────┐ ┌─────────────────┐ │
• EGraph │←→│ Union-Find │ │
• ┘ └─────────────────┘ │
• ↕ ↕ │
• ┌─────────┐ ┌─────────────────┐ │
• EClass │←→│ Pattern Matching│ │
• ┘ └─────────────────┘ │
• ┘
• ↑ ↑
┌─ Extension Layer ───────────────┐
• ┌─────────┐ ┌───────────────┐ │
• Rewrite │ │ Extraction │ │
• System │ │ (Normal/LP) │ │
• ┘ └───────────────┘ │
• ┘
• ↑ ↑
┌─ Interface Layer ──────────────┐
• ┌─────────┐ ┌──────────────┐ │
• Language │ │ Explanation │ │
• Framework│ │ System │ │
• ┘ └──────────────┘ │
• ┘
Additional Details
A side panel showing:
• Supported Features:
• Equality Saturation
• Pattern Matching
• Custom Language Definition
• Extraction Strategies
• External Dependencies:
• CBC Solver (for LP extraction)
• Rust Standard Library
Implementation Notes
• Clear boundaries between the different modules
• Public APIs with bold borders
• Version information
• Notes about performance-critical paths
Testing Components
A separate section showing:
• Test Framework (tests/)
• Example Implementations:
• Propositional Logic
• Math Operations
• Lambda Calculus