Skip to content

D-MPS-9 MORK query_multi oracle + math-compiler Stage A matrix and Stage B (E1) probe - #1690

Merged
AdaWorldAPI merged 6 commits into
mainfrom
ccr-0455e606-wmtsor
Oct 22, 2026
Merged

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

Conversation

@AdaWorldAPI

@AdaWorldAPI AdaWorldAPI commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

Lab only. MORK stays behind the boundary module as the oracle; nothing is wired into Quack or R2IL, and the native execution path is unchanged.

This branch carries three pieces, in commit order:

  1. D-MPS-9: the MORK query_multi oracle.
  2. Docs only: the Stage A gap matrix.
  3. Stage B: the E1 probe, crates/egglog-r2il-probe/.

1. D-MPS-9: MORK as differential oracle

mork-pathmap-probe/src/boundary.rs: a general MORK arm, mork_rules(facts, rules).

  • Input is Lance-owned plain data (OracleRule, OracleAtom, OracleTerm, OracleFacts). No crepe type enters the crate, and no upstream type leaves it.
  • Output is the distinct head tuples (TupleSet, MORK's set semantics, oracle only) plus OracleCost.
  • Each rule runs as its own MM2 exec.
  • Before the exec, the body is parsed with Space::parse_sexpr and enumerated with Space::query_multi, counting callbacks. That times MORK's unification alone, without text decode.
    • The callback's bool is a continue flag (space.rs:1253, :1343, :1364).
    • The callback fires only after a successful unify.
  • Rules wider than MORK's 63-child arity are refused before parsing (MORK_MAX_CHILDREN).

crepe-plan-probe/src/mork_api.rs: to_oracle(rule) runs admit first and returns its refusal unchanged. A constant above u32 is refused by name (ConstOutOfRange).

crepe-plan-probe/tests/mork_differential.rs (new, 7 tests):

  • Six fixtures, each with MORK's set equal to the reference set, and each non-empty:
    • family;
    • family_noisy;
    • two_way;
    • star3;
    • a body constant;
    • a three-atom chain.
  • MORK's callback count equals the reference derivation count over deduplicated facts.
  • to_oracle refuses exactly what admit refuses.

crepe-plan-probe/examples/mork_split.rs (new): cost split, native vs MORK. It asserts answer-set equality first.

Verification:

  • 47 + 59 tests pass.
  • Clippy and fmt are clean.
  • Four disable runs are red: constants encoded as variables, counting only Ok callbacks, to_oracle without admit, and the arity guard removed.

Cost split (n = 10,000; median of 5; Xeon @ 2.10 GHz, 4 vCPU, shared host):

arm µs
native prepare 162
native Count(BAG) terminal 17.6
native Bindings(BAG) handle (deferred) 2.8
native: enumerate all answers 188
MORK encode + build 3,564
MORK unification only 12,289
MORK exec + text decode 23,548

The MORK rows are oracle reference costs, not gates. See the open question below on reporting out-of-fold costs.

2. Stage A gap matrix (docs only)

entries/2026-10-22-math-compiler-gap-matrix.md: an inventory of egglog → R2IL pieces against falsifiers E1–E5, under D-RFT-2.

3. Stage B: E1 end to end, probe-local (crates/egglog-r2il-probe/)

E1 is exact-integer symbolic substitution: a = 2b, b = 2c, z = 2a gives z = 8c. It is not a population measure, so there is no SUM fold, contract::Measure is unchanged, and no opcode or egglog change is added. Coordinated on EXO-50 /043.

The pipeline:

  • Laws. Two probe laws, MulAssoc and ConstFold. The rule id carries the contract's set_rules::Arith domain:
    • Exact admits both;
    • Wrapping admits MulAssoc only;
    • Checked and Ieee refuse both.
  • egglog, cold and bounded, public API only:
    • proofs mode;
    • (run arith 1) stepped up to fuel, with a typed Saturated / Incomplete;
    • prove-variants gives the extraction plus a proof, which egglog checks before and after simplification.
  • Extraction is egglog's own. Non-target variables are (Def String :cost 1000), so the cheapest non-trivial variant is the answer.
  • Lowering is straight-line R2IL scalar INT_MULT through FoldDialect, in the procs.rs pattern.
  • Oracle: an independent i128 substitution over the original premises.

Results (13 tests):

  • Exact: (Mul (Num 8) (Var "c")), one INT_MULT, equal to the oracle.
  • Checked: three INT_MULTs. The domain changes the program.
  • Missing premise: refused (UnboundVar), the oracle returns None, and egglog cannot prove z = 8c while it can prove z = 4b.
  • Overflow counterexamples refuse in both domains; the boundary passes.
  • A Wrapping term is not lowered onto checked arithmetic.
  • Extraction is deterministic, and bounded fuel reports Incomplete.
  • A nine-hop logical traceroute.

Six disable runs, all red:

  • Checked admits MulAssoc;
  • Def without its cost;
  • Wrapping is lowered;
  • Overflow is mapped away;
  • the goal's own name is accepted as the answer;
  • every step is read as saturated.

Cost: encode 2 µs, lower + execute 5 µs. The egglog phase is timed in Compiled::timings.egglog but deliberately not printed.

Open

  • Operator ruling needed: may cold, out-of-fold costs (the egglog compile, the MORK oracle) be reported? CLAUDE.md forbids millisecond results anywhere. The MORK rows above and the egglog phase are of that kind.
  • MORK's add_sexpr, remove_sexpr, dump_sexpr and transform_multi_multi verbs; the memory/sharing measurement; allocation counts (D-MPS-4).
  • E2–E5 beyond what E1 exercises. Measure::Scale stays gated on a real population-measure consumer, in a separate PR.

Board:

  • entries/2026-10-22-d-mps-9-mork-oracle.md
  • entries/2026-10-22-math-compiler-gap-matrix.md
  • entries/2026-10-22-math-compiler-stage-b-e1.md
  • STATUS_BOARD D-MPS-9, plan §7d, AGENT_LOG

🤖 Generated with Claude Code

https://claude.ai/code/session_01G22yT6htkcdyXsihxxXdrg

…tests

Not yet compiled or tested; the central gate runs next.

- boundary.rs: OracleRule/OracleFacts/TupleSet/OracleCost and mork_rules:
  any admitted conjunctive rule set run through MORK exec, answers as a set,
  plus MORK's unification alone (Space::query_multi callback count, no decode).
- mork_api::to_oracle maps an admitted Rule to the oracle's input.
- tests/mork_differential.rs: six fixtures vs the reference as sets, match
  count vs reference derivations over distinct facts, refusals unchanged.
- examples/mork_split.rs: native prepare/fold/terminal vs MORK cost split.

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

- Gate: mork-pathmap-probe 46 tests, crepe-plan-probe 59 tests (7 new
  differential), release; clippy -D warnings and fmt clean on both.
- Disable runs, each red then restored: constants as variables (5 red),
  count only Ok callbacks (1 red), to_oracle without admit (1 red).
- mork_split: the Bindings outcome is a deferred handle, so its execute
  time never read the answers; one full enumeration is now timed (188 us
  vs 17.6 us for the count terminal at n = 10 000).
- clippy: contains() instead of iter().any() in check_rule.
- Board: entry 2026-10-22-d-mps-9-mork-oracle (results, cost split, open
  verbs, slim_ptrs correction), STATUS_BOARD D-MPS-9 row, plan §7d,
  AGENT_LOG, regenerated entries index.

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

coderabbitai Bot commented Oct 22, 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: 02ae2fd6-3c96-417e-bf2a-98261f83f888
  • 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 22, 2026 05:36
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 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-22T05:39:02.106994Z bd62d55 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: bd62d55f37

ℹ️ 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/mork-pathmap-probe/src/boundary.rs
…rsing

Codex P2 on #1690: a 63-atom body or 63-term head passed admit and reached
MORK's encoder, whose six-bit arity tag asserts a < 64.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G22yT6htkcdyXsihxxXdrg
Exact-integer symbolic substitution (a = 2b, b = 2c, z = 2a gives z = 8c)
compiled cold by egglog through its public API (proofs mode, prove-variants,
every proof checked by egglog), lowered onto the existing R2IL scalar INT_MULT
through FoldDialect, and compared with an independent i128 oracle.

- Law domains are the contract's set_rules::Arith; the probe owns two laws
  (MulAssoc, ConstFold) whose rule id carries the domain. Checked and Ieee
  refuse reassociation; ConstFold is Exact only.
- Extraction is egglog's own: non-target variables are (Def String :cost 1000),
  so the cheapest variant other than the goal's own name is the answer.
- Falsifiers: missing premise refuses (UnboundVar, oracle None, egglog cannot
  prove 8c); overflow counterexamples refuse in Exact and Checked with the
  i64::MAX/8 boundary passing; a Wrapping term is not lowered onto checked
  arithmetic; extraction is deterministic; bounded fuel reports Incomplete.
- No contract::Measure change, no new opcode, no egglog change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G22yT6htkcdyXsihxxXdrg
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G22yT6htkcdyXsihxxXdrg
@AdaWorldAPI AdaWorldAPI changed the title D-MPS-9: MORK as differential oracle for every admitted query_multi pattern D-MPS-9 MORK query_multi oracle + math-compiler Stage A matrix and Stage B (E1) probe Oct 22, 2026
@AdaWorldAPI
AdaWorldAPI merged commit 9cafc8a into main Oct 22, 2026
15 checks passed
AdaWorldAPI pushed a commit that referenced this pull request Oct 22, 2026
…xecuted P0 falsifiers

#1696 merged (df214bb), so #1694/#1695 are no longer stranded; the
contradictory-premise counterexample has been executed (14 vs 21 by premise
order) and is fixed for linear E1 in #1698 (11ca3fe), together with the
checked-overflow range guard.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G22yT6htkcdyXsihxxXdrg
AdaWorldAPI added a commit that referenced this pull request Oct 22, 2026
…-gap-review

docs(math-foundry): record #1690–#1695 gaps and proof guards
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