Skip to content

Remove the e-graph search now that synthesis replaces it - #67

Merged
rollrat merged 1 commit into
claude/egraph-netlistfrom
claude/drop-egg
Nov 8, 2026
Merged

rollrat merged 1 commit into
claude/egraph-netlistfrom
claude/drop-egg

Conversation

@rollrat

@rollrat rollrat commented Oct 10, 2026

Copy link
Copy Markdown
Member

Stacked on #61.

Why

#61 added an e-graph search (egg) for equivalent NOR netlists. Its netlists with fewer gates or less depth were nearly all unbuildable. What lasted was the diagnosis of why construction steps time out (too many live nets, inputs that branch around a gate) and the exact synthesis built on it. Synthesis designs buildable netlists directly, proves minimum torch counts, and gave the actual gains: a 2-bit adder about a fifth smaller, and a 4:1 mux built for the first time.

The e-graph code no longer had a use. It cost about 900 lines and the egg dependency (9 crates).

What

  • Deletes exact/egraph.rs, exact/egraph_extract.rsdsl, and egg.
  • Synthesis gets its own expression evaluator (synthesis::truth_table: ~ & ^ |, tightest first), with a precedence test.
  • The output-depth helper moves to NorNetlist::output_depths.
  • The e-graph's 8-gate full adder stays as text (WIDE_FULL_ADDER in exact/tests.rs); the chaining test uses it.
  • The circuit harness drops CIRCUIT=egraph-full-adder. Any netlist still runs as CIRCUIT=netlist CIRCUIT_NETLIST=..., and EGRAPH_CHAIN is renamed CIRCUIT_CHAIN.
  • docs/egraph_netlists.md stays as the experiment record. It now says its measurements come from commit 600ad6d. The live harness and diagnostic knobs moved to docs/nor_synthesis.md.

Test plan

  • cargo test --release --lib exact::: 27 passed, including the new synthesis_truth_tables_follow_precedence.
  • CIRCUIT=netlist CIRCUIT_CHAIN=2 with WIDE_FULL_ADDER reproduces the e-graph runs' counts (7 live nets, 2 continuing inputs).
  • synthesize_buildable_circuits still finds nor9's 9 torches in 9 steps, proven.

🤖 Generated with Claude Code

The e-graph experiment (#61) found full adders with fewer gates or less
depth, but nearly all of them were unbuildable. Its lasting results were
the diagnosis of why construction steps time out and the exact
synthesis built on it. Synthesis designs netlists that are buildable by
construction, proves minimum torch counts, and gave the actual gains: a
2-bit adder about a fifth smaller and a 4:1 mux built for the first
time. The e-graph code had no remaining use but cost about 900 lines and
the egg dependency (9 crates).

- egraph.rs and egraph_extract.rsdsl are deleted, along with egg.
- Synthesis gets its own expression evaluator
  (synthesis::truth_table), with a precedence test.
- The output-depth helper moves to NorNetlist::output_depths.
- The e-graph's 8-gate full adder stays as WIDE_FULL_ADDER text. The
  chaining test uses it.
- The harness drops CIRCUIT=egraph-full-adder. Any netlist still runs as
  CIRCUIT=netlist, and EGRAPH_CHAIN is now CIRCUIT_CHAIN.
- docs/egraph_netlists.md is kept as the experiment record. It notes that
  its measurements come from commit 600ad6d. The live harness knobs are
  documented in docs/nor_synthesis.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rollrat
rollrat added this pull request to stack #58 October 10, 2026 00:01
@rollrat
rollrat marked this pull request as ready for review November 8, 2026 06:23
@rollrat
rollrat merged commit 1364d6a into master Nov 8, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant