Repository navigation
D-CMR-1 / D-RA-2: the contract owns single-table set algebra; relalg delegates - #1644
Conversation
…gates
lance_graph_contract::set_algebra (zero dependencies):
- SetExpr {All, Empty, Sym, Res, And, Or, Not}, Res (one-lane residual),
Cmp; normalize = the one implementation of the single-table rewrites
(De Morgan, associative flattening, idempotence, complement pairs,
per-lane interval fusion/merge, absorption).
- Absorption is matched against flattened sibling sets, one child at a
time: closes ISS-RELALG-ABSORPTION-AFTER-DE-MORGAN (N17).
- Runs: sorted disjoint half-open intervals with intersect / union /
difference / complement(universe); complement refuses a set past the
declared universe.
- Tests: differential vs materialized bitsets (3,000 random nested
expressions), no leaf growth, N17 + dual, partial-cover silence twin,
flatten-before-depth, Runs laws vs bitsets incl. empty/full/boundary.
lance-graph-relalg: normalize converts Rel <-> SetExpr and delegates.
Public API unchanged; the 16 existing tests pass unchanged; N17
regression in tests/absorption_n17.rs. Disable runs recorded in
entries/2026-10-20-d-cmr-1-set-algebra.md.
Board: LATEST_STATE contract inventory, STATUS_BOARD D-CMR-1 / D-RA-2,
ISSUES N17, entry + index.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013z2e1YXkm6o6HNrDn5BPWA
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Warning Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013z2e1YXkm6o6HNrDn5BPWA
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 705a505c60
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…17 pin CI (probe) showed crepe-plan-probe's pin m_the_known_absorption_gap firing: the compound-x case is now fixed, as the pin asked to be told. Its Or-x variant exposed a second absorption shape: after De Morgan, (¬P0 ∧ ¬P2) ∨ (¬P0 ∧ ¬P2 ∧ ¬P1), i.e. one dual child a sub-conjunction of another. normalize now also drops And(ms) in an Or when a sibling And(ks) has every k in ms (dually in an And). Red first (absorption_of_a_superset_conjunction), green after, disable-verified; the bitset differential stays green. crepe-plan-probe: the pin is flipped to assert both compound cases now reduce, renamed ..._is_closed_and_not_produced. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013z2e1YXkm6o6HNrDn5BPWA
union re-sorted n+m intervals through from_intervals while the type promises cost linear in intervals. Now a two-pointer merge of the two canonical lists. Covered by runs_obey_the_set_laws_against_bitsets; dropping the max in the merge turns it red. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013z2e1YXkm6o6HNrDn5BPWA
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013z2e1YXkm6o6HNrDn5BPWA
…entries index after #1643 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013z2e1YXkm6o6HNrDn5BPWA
PR_ARC entry for #1644; LATEST_STATE main-after-#1644; STATUS D-CMR-1 Shipped, D-RA-2 updated; ISSUES N17 resolved by #1644; the D-CMR-1 entry carries the post-merge measurement: holo-h14d-probe stage 1 now widens 0 of 2,000 programs by the rewrite (was 2). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013z2e1YXkm6o6HNrDn5BPWA
board: record #1644 (D-CMR-1) merged; N17 measured closed (0 of 2,000 widened)
Implements the first architecture PR named by
ADR-2026-10-20-SIX§2 (entries/2026-10-20-six-decisions.md, on main via #1640). The single-table rewrites move into the contract, independent of any physical layout. relalg becomes a consumer.Dependency diagram
Before
After
The contract's
Cargo.tomlis unchanged; it still has no dependencies.What is in the contract
SetExpr:All | Empty | Sym(u32) | Res(Res) | And | Or | Not.Symis an opaque two-valued set. It does not name a plane or a bitset; relalg mapsPlane(i)onto it.Resis a residual predicate on one lane, with the same fields as relalg'sAtom.normalize: relalg's rules, ported unchanged except for absorption.Rules: De Morgan, associative flattening, idempotence, complement pairs, per-lane interval fusion and merge.
Absorption is matched against flattened sibling sets, in two forms:
And(ms)inside anOris dropped when some membermis already covered by the siblings:mis a sibling, or anOrwhose members are all siblings.And(ks)has everykamongms. This isx ∨ (x ∧ y)withxitself a conjunction.Both have duals inside an
And. Children are dropped one at a time, each checked only against the children still kept. This closes N17 (ISS-RELALG-ABSORPTION-AFTER-DE-MORGAN):¬(x ∧ (x ∨ y))now reduces to¬xwhenxis a leaf, anAndor anOr.Flattening happens before relalg's slot admission.
No rule distributes, so normalization never grows an expression; a test checks this.
Runs: sorted, disjoint, half-open intervals.∩,∪and∖are each a single merge pass, O(n + m).complement(universe)returnsErr(OutOfUniverse)when the set reaches past the given universe.relalg
normalizeconvertsReltoSetExpr, calls the contract and converts back.symbolic,run, lowering and the public API are unchanged.Regression results (relalg, before vs after)
tests/rewrites.rsconversion_round_trips)tests/absorption_n17.rs(new)cargo test -p lance-graph-contract --lib set_algebra: 10 passed.cargo check --all-targetspasses forholo-h14d-probe,lance-graph-mettaandcrepe-plan-probe.-D warningsis clean on the contract and on relalg.crepe-plan-probe: its test
m_the_known_absorption_gap_is_untouched_and_not_producedpinned N17 as unfixed and asked to be updated when that changed. CIprobecaught it. The test is renamed..._is_closed_and_not_producedand now asserts that both compound cases reduce. ItsOrcase also exposed absorption form 2, which was added with a red-first test.Algebra-law tests (contract)
normalize(e)is compared againsteover materialized bitsets with an explicit universe (N = 97), for 3,000 random nested expressions. The test also checks idempotence and that the rewrites fired on most inputs (anti-vacuity).Runslaws. ∩, ∪, ∖ and complement are compared with bitsets, together with canonical form, De Morgan, distributivity, identities and double complement. Universes tested: 0, 1, 2, 63, 64, 65 and 100.Disable probes (each restored afterwards)
normalizereturns its inputrewrites.rstests and both N17 tests fail, so relalg really exercises the contractabsorption_of_a_superset_conjunctionfailsall→any)maxdropped in theunionmergeruns_obey_the_set_laws_against_bitsetsfailsScope held
No joins, positional gathers, relational AST ownership, recursion, D-MPS-8 or
graph_hop. Measures onRuns(Count,Sum) are not in this PR.Board updates:
LATEST_STATE: contract inventory.STATUS_BOARD: D-CMR-1 and D-RA-2.ISSUES: N17.2026-10-20-d-cmr-1-set-algebra.md, plus the entries index.mainis merged in (#1641); its conflicts were in board files only.🤖 Generated with Claude Code
https://claude.ai/code/session_013z2e1YXkm6o6HNrDn5BPWA