Skip to content

D-RFT-0 / D-QSP-0: Kleene form of set normalization (SQL NULL), PostgreSQL differential - #1668

Merged
AdaWorldAPI merged 5 commits into
mainfrom
ccr-0455e606-wmtsor
Oct 21, 2026
Merged

AdaWorldAPI merged 5 commits into
mainfrom
ccr-0455e606-wmtsor

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

What

Implements D-RFT-0 / D-QSP-0 from the #1667 plans (claim: EXO-50 session_01G22yT6htkcdyXsihxxXdrg/031). #1667 is unchanged and stays the planning reference.

The defect. contract::set_algebra::normalize is two-valued: a union that covers a lane becomes All, and a whole-lane conjunct disappears. On a NULL row, both turn UNKNOWN into TRUE.

PostgreSQL 16.14: SELECT count(*) FROM (VALUES (1),(NULL)) v(x) WHERE x<5 OR x>=5 returns 1; All would count 2. Because of this, set_rules::SetNormalize refused every rewrite under Truth::ThreeValued.

The fix. It is precise rather than a blanket refusal:

  • New set_algebra::{Logic, normalize_kleene, normalize_with}. In Kleene mode:
    • a covered I32 lane becomes x >= i32::MIN, which is TRUE exactly on the non-NULL rows (an existing Res, no new vocabulary);
    • a covered U32 lane keeps its atoms;
    • every other rewrite already keeps the TRUE rows under Kleene logic (argument in the module docs).
  • Two-valued normalize is unchanged. relalg's 8 suites pass.
  • SetNormalize under ThreeValued now applies the Kleene form. Complement and RelationalDifference still refuse.
  • Quack Filter::sql_where is already correct and is not touched.

Evidence

check result
Kleene evaluator, 3000 random exprs with NULL lanes TRUE rows identical; twin: two-valued wrong on the same inputs
six lane covers, one at a time Kleene keeps 1 of 2; two-valued keeps 2
catalogue, 600 three-valued measures, all rules answer = Kleene oracle
examples/k3_pg_parity.rs, PostgreSQL 16.14, 2000 exprs × 200 rows as written = Kleene oracle = normalize_kleene on 2000/2000 (1537 rewritten); two-valued wrong on 474
contract suite, clippy -D warnings, Rust 1.99.0 green

Disable runs, each red on its named test:

  • D1: I32 cover → All;
  • D2: no whole-lane atom;
  • D3: U32 cover → All;
  • D4: SetNormalize uses the two-valued form;
  • D5: whole-lane atom also beside !=. This one was green at first; it is now pinned by normalize_kleene_never_grows_leaf_count.

Re-pinned: the experiment-E test that asserted SetNormalize → NotTwoValued now asserts the Kleene rewrite and the unchanged count. The example skips with SKIP without a PostgreSQL server, so CI does not depend on one.

Also in this PR (docs only)

entries/2026-10-21-d-rft-d-lfa-0-assessment.md:

  • the smallest falsifiable D-RFT-1..5 sequence;
  • the rs-graph-llm → lance-graph-flow copy-versus-reuse census, with the Rubicon mapping and a falsifier;
  • the physical-shape proof plan.

It is a PROPOSAL with no measurements, and it claims none of those D-ids.

Open

  • Sym is assumed two-valued under ThreeValued (contract statement).
  • Not covered: NULL literals / NOT IN (…, NULL), COALESCE, nullable arithmetic, empty/all-NULL SUM, COUNT(expr).
  • No PostgreSQL job in CI.

Do not merge automatically.


Generated by Claude Code

`set_algebra::normalize` is two-valued. A union that covers a lane
becomes `All`, and a conjunct that covers a lane disappears. On a NULL
row both promote UNKNOWN to TRUE. PostgreSQL 16 keeps 1 of the rows
`(1), (NULL)` for `WHERE x < 5 OR x >= 5`; `All` keeps both. That is
why `set_rules::SetNormalize` refused every rewrite under
`Truth::ThreeValued`.

`normalize_kleene` (and `normalize_with(e, Logic)`) changes only those
cases:
- a covered I32 lane becomes `x >= i32::MIN`, which is TRUE exactly on
  the non-NULL rows;
- a covered U32 lane keeps its atoms.

Every other rewrite keeps the rows where the expression is TRUE under
Kleene logic. Two-valued `normalize` is unchanged; relalg's 8 test
suites still pass.

`SetNormalize` under three-valued semantics now applies the Kleene form
instead of refusing. The Complement and RelationalDifference guards are
unchanged.

Tests:
- an independent Kleene evaluator over 3000 random expressions with
  NULL lanes, plus its twin showing the two-valued form wrong on some
  of the same inputs;
- the six lane covers one at a time;
- a catalogue differential over 600 three-valued measures, all rules.

Re-pinned: the two experiment-E tests that asserted
`SetNormalize` → `NotTwoValued` now assert the rewrite and the
unchanged count.

Example `k3_pg_parity` (PostgreSQL 16.14, 2000 expressions × 200 rows):
- as written = Kleene oracle = normalize_kleene on 2000/2000
  (1537 rewritten);
- two-valued normalize is wrong on 474.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G22yT6htkcdyXsihxxXdrg
…s (docs)

- entries/2026-10-21-d-rft-0-kleene-normalization.md: the defect, the
  precise fix, the PostgreSQL differential and 5 disable runs.
- entries/2026-10-21-d-rft-d-lfa-0-assessment.md: the smallest falsifiable
  D-RFT-1..5 sequence, the rs-graph-llm copy-versus-reuse census with the
  Rubicon mapping, and the physical-shape proof plan. PROPOSAL; nothing in
  it is measured.
- STATUS_BOARD: new D-RFT / D-QSP section. LATEST_STATE: contract
  inventory delta. entries index regenerated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G22yT6htkcdyXsihxxXdrg
@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a4f8f52e-f7b0-42d9-8424-18d3ba966bcc
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@AdaWorldAPI
AdaWorldAPI marked this pull request as ready for review October 21, 2026 18:58
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T19:00:20.929752Z 82e9374 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 82e937499e

ℹ️ 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".

Comment thread crates/lance-graph-contract/examples/k3_pg_parity.rs Outdated
psql answers while it reads, so writing the whole script before draining
stdout blocks once the stdout pipe fills (Codex review on #1668).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G22yT6htkcdyXsihxxXdrg
…p; egglog/datafrog/Ascent evaluation

Exploration map (ADOPT-NOW/PROBE/PARK/SKIP, nothing adopted): reconciled
D-RFT ID table, stratum/carrier/equality declaration per step, 12 named
count-fold probes, the Semijoin ADMISSION B gap and the oracle-scope
question. Two companion entries: the PostgreSQL construct map onto the
ClassView polyfill surfaces, and the three-engine evaluation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G22yT6htkcdyXsihxxXdrg
@AdaWorldAPI
AdaWorldAPI merged commit 0868c2c into main Oct 21, 2026
7 of 8 checks passed
AdaWorldAPI pushed a commit that referenced this pull request Oct 21, 2026
#1668's co-research entry led with 'D-QSP / D-RFT / D-LFA', so the index
derived the same id as #1667's plan entry, and the index on main was
regenerated before the merge brought in a 420th entry. Retitle the
entry and regenerate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G22yT6htkcdyXsihxxXdrg
AdaWorldAPI pushed a commit that referenced this pull request Oct 21, 2026
Operator-approved amendment after #1670:
- D-LFA-1: a structured Rubicon reference flow and an optimized variant
  are GKAT-equivalent (same actions, declared guards and projections),
  plus a separate trace check that RequestCommit never occurs without
  a valid revision and MUL authorization. RequestCommit is an intent,
  not a Lance write. Three disable runs; GoTo/GoBack refused;
  WaitForInput is an observation at resume; the snapshot/codebook
  generation gate stays independent.
- Guard projection: WHERE {T} vs CHECK {T,U} declared per guard, never
  interchanged; commit authorization never inherits CHECK semantics.
- D-LFA-2: integration with graph-flow, thought-git verbs, Kanban
  transitions and authorized proposals against the from-scratch oracle;
  no second scheduler, evaluator, state store or commit owner.
- D-GKAT-0: independent, unclaimed fixture probe (G1, G2, G5); no
  runtime, dependency or executor.
D-RFT-2 unchanged; D-RFT-4 keeps thought binding/frontier.
Co-research map: D-GKAT-0 and P-GKAT-RUBICON probe rows.
STATUS_BOARD: D-RFT-0 shipped (#1668); D-LFA-1/2 and D-GKAT-0 rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G22yT6htkcdyXsihxxXdrg
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