Skip to content

Term encoding: rebuild via correlated OR - #2

Draft
oflatt-claude wants to merge 2 commits into
saulshanabrook:mainfrom
oflatt-claude:encoding-rebuild-via-or
Draft

Term encoding: rebuild via correlated OR#2
oflatt-claude wants to merge 2 commits into
saulshanabrook:mainfrom
oflatt-claude:encoding-rebuild-via-or

Conversation

@oflatt-claude

Copy link
Copy Markdown

Draft. Changes the term encoding's generated rebuild rule (non-proof mode) to the correlated OR form, so rebuilding is delta-driven and per-row deduplicated. Proof mode keeps the existing rule. ~1.20× faster than the previous rebuild on math-microbenchmark, with byte-identical results. Changes confined to the egglog/ subtree.

Stacked on the "Add OR" PR. GitHub can't base a PR on a fork branch across repos, so this PR's diff also contains the OR feature commit; the net-new change here is the single commit "Term encoding: rebuild via correlated OR" (5 files under egglog/). Review/merge the feature PR first.

Rebuild dispatch (egglog/src/proofs/proof_encoding.rs):

  • Proof mode → unchanged (guarded-OR over UF-index lookups).
  • Non-proof → per-sort hidden staleness relation + maintenance rule, and per constructor: an OR over stale eq-sort columns (≥2 cols) or a plain delta-driven rule (1 col); 0 eq-sort cols → no rule.

Verified on the underlying egglog tree: full .egg harness 747/747 (term-encoding treatment now exercises the OR rebuild; proofs use the old rule), 17/17 disjunction, make nits clean. Exactly one program-text snapshot changed (rule form only); no output/print-size snapshots changed, confirming identical results.

🤖 Generated with Claude Code

oflatt and others added 2 commits July 2, 2026 18:15
Applies the disjunction feature to the egglog subtree: a rule query may
contain (OR (branch) (branch) ...), where each branch is a conjunction of
facts; the rule matches when any branch matches, and only variables common to
every branch (or bound by the surrounding conjunction) may be used outside the
OR. Correlated branches are supported and compile to a fused, deduplicating,
seminaive/delta-driven union node in the core-relations free-join engine.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Changes the term encoding's generated rebuild rule (non-proof mode) to the
correlated OR form, so rebuilding is delta-driven and deduplicated per row.
Proof mode keeps the existing rule. Measured ~1.20x faster than the previous
rebuild on math-microbenchmark, with identical results.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

2 participants