You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(tg-6): differential rung — execute generated wasm and check semantics
TG-6 differential rung. compiler/tangle-wasm/tests/differential.rs adds wasmi
(a pure-Rust wasm interpreter) as a DEV-dependency and executes the generated
wasm modules, supplying reference host primitives (tangle_rt.alloc_strands
initialises the identity strand array; tangle_rt.swap_strands swaps two cells).
It then checks the executed strand permutation equals an independent in-Rust
reference model over: the trefoil; non-commuting pairs (s1 s2 != s2 s1);
braid-relation pairs (s1 s2 s1 == s2 s1 s2); and a 5-strand weave.
This validates the wasm codegen against the braid permutation semantics --
catching wrong crossing indices, wrong generator call order, miscounted
strands, or a non-instantiable module. Honest scope: it is NOT a cross-binary
diff against compiler/lib/eval.ml, and the Markov-move helpers are not yet
exercised; a full source<->wasm bisimulation (WasmCert) remains research-grade.
The shipped backend keeps no runtime dependency (wasmi is dev-only). cargo test
green (10 existing unit tests + 2 differential). Docs: PROOF-NEEDS (TG-6 rung
landed), CHANGELOG, STATE.a2ml.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
"BLOCKED (TG-8): dialects are README-only — need one dialect implemented (AST+parser+HasType/Step+eval) before conservativity is even stateable",
40
40
"RUNG-DONE (TG-7): out-of-band braid_equiv (Dehornoy handle reduction) in compiler/lib/braid_equiv.ml — decides braid-group equivalence WITHOUT changing == (compiler/test/tg7, 2220 assertions). Routing == through it stays an owner decision; Lean correctness research-grade.",
41
-
"BLOCKED (TG-6): no wasm runtime wired in — add wasmtime/wasmer dev-dep + exec harness before differential testing; full bisimulation research-grade",
41
+
"RUNG-DONE (TG-6): wasm differential — compiler/tangle-wasm/tests/differential.rs executes generated wasm via wasmi (dev-dep) and checks strand permutation == reference model (trefoil, non-commuting, braid-relation, 5-strand). Codegen-vs-semantics; not a cross-binary eval.ml diff; full bisimulation research-grade.",
42
42
]
43
43
44
44
[blockers-and-issues]
@@ -48,11 +48,11 @@ issues = []
48
48
actions = [
49
49
"TG-7 OWNER DECISION (rung done): out-of-band braid_equiv now exists (compiler/lib/braid_equiv.ml). Decide whether to route `==`/Step.eqBraids through it (semantics change to eval.ml + Lean + proofs) or keep them list-equality and use braid_equiv only as a tool.",
50
50
"TG-8 prerequisite: implement one dialect end-to-end (virtual-knot suggested) as the conservativity template; dialects are currently README-only.",
51
-
"TG-6 prerequisite: wire a wasm runtime (wasmtime/wasmer dev-dep) + exec harness to enable differential testing.",
51
+
"TG-6 (rung done): optional next rungs = cross-binary differential vs eval.ml; Markov-helper coverage; Lean/WasmCert bisimulation (research-grade).",
52
52
"TangleIR Julia: implement EchoClosed node in KRLAdapter.jl per contract (quandledb session)",
Copy file name to clipboardExpand all lines: PROOF-NEEDS.md
+22-16Lines changed: 22 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,7 +58,7 @@ Cross-referenced to [PROOF-NARRATIVE.md §3](PROOF-NARRATIVE.md#3-remaining-obli
58
58
| TG-3 | OCaml `typecheck.ml` refines the Lean `HasType` spec | TP | Lean 4 + translation validation | P1 | — | **LANDED** (translation-validation level — [`proofs/TG3-REFINEMENT.md`](proofs/TG3-REFINEMENT.md)). Reduced via TG-2 (`infer ≡ HasType`) to "OCaml `infer_expr` ≡ Lean `infer` on the core fragment", then discharged by: (a) a closure proof (core fragment never yields `TTangle`, strengthened tree-IH); (b) 496 Lean kernel-checked obligations in [`proofs/TG3Differential.lean`](proofs/TG3Differential.lean) generated from `infer_expr` by `compiler/test/tg3/tg3_emit.ml` (`by decide`; run `proofs/check-tg3-differential.sh`); (c) 1008 OCaml `--check` assertions (`dune runtest`). Complete divergence catalogue: **D1** `close` (OCaml `Tangle[I,I]` vs Lean `word 0` — sole boundary gateway, + downstream D1b/c/d) and **D2** `bool==bool` (OCaml accepts, Lean rejects). Extra-core feature list (model-later / declare-non-core) in TG3-REFINEMENT §3. Not claimed: a universal Lean proof over all OCaml runs (would require reflecting `typecheck.ml`); refinement is OCaml→Lean only |
59
59
| TG-4 | Pretty-print/parse round-trip on closed values | INV | OCaml property test (cheap) | P2 | 4h |**LANDED** (PR #46 — OCaml property test in `compiler/test/test_roundtrip.ml`, 26-entry corpus including 8 echo/product constructors; 52 round-trip runs) |
60
60
| TG-5 |`compositional.ml` (418 LoC) rewriter preserves types | TP | OCaml property test | P2 | — |**LANDED** (`compiler/test/tg5/tg5_invariants.ml`, 189 assertions in `dune runtest`). compositional is below the Ty layer, so "preserves types" = preserves the PD-lowering structural invariants + echo residue-recovery: `OpenWord`/`ClosedDiagram`/`EchoClosed` each pinned (closedness, `\|crossings\|`=unit-length, source unit-expanded, **verbatim residue** for `EchoClose` with `expand(residue)=diagram word` and echo-diagram pdv1-identical to plain `close`), error paths, count pins. Lean IR model = optional later rung |
| TG-6 | WASM compilation preserves semantics (source eval ≡ wasm exec) | TP / ALG |differential + Lean bisimulation | P1 |— |**RUNG LANDED (differential)**: `compiler/tangle-wasm/tests/differential.rs` EXECUTES the generated wasm with the `wasmi` interpreter (dev-dep) and checks the braid strand-permutation equals an independent reference model (trefoil, non-commuting pairs, braid-relation pairs, 5-strand weave). Validates codegen vs the permutation semantics; not a cross-binary diff against `eval.ml`, and Markov helpers untested. Full source↔wasm bisimulation (WasmCert) remains research-grade|
62
62
| TG-7 |`Step.eqBraids` decides braid-group equivalence (not list equality) | ALG / DOM | OCaml + Lean 4 | P2 | — |**RUNG LANDED (non-semantic)**: `compiler/lib/braid_equiv.ml` decides braid-group equivalence via Dehornoy handle reduction, out-of-band (leaves `==`/`Step.eqBraids` as list equality). Tested (`compiler/test/tg7`, 2220 assertions: defining relations + 400 constructed-equivalent pairs + invariant-distinguished negatives). **Still OWNER-GATED**: whether to route `==` through it (a semantics change to eval.ml + Lean Step + proofs) is a language-design decision; Lean correctness (Garside/Dehornoy) remains research-grade |
63
63
| TG-8 | Each dialect (braid-calculus, quantum-circuit, skein-algebra, string-diagram, virtual-knot) is a conservative extension of core | TP | Lean 4 per-dialect | P3 | 1w each | NOT STARTED |
64
64
| TG-9 | LSP diagnostics are a subset of `HasType` failures (no LSP-only diagnostics) | INV | Audit + refactor | P2 | — |**LANDED** (`tangle-lsp` delegates all diagnostics to `tanglec --check` ⇒ `compiler/lib/check.ml`; hand-rolled LSP-only false positives removed. Subset holds by construction. Tests: `test_check.ml` + tangle-lsp unit/delegation tests) |
@@ -70,11 +70,12 @@ assumptions each rests on, see PROOF-NARRATIVE.md.
70
70
## Scoping of the remaining obligations (2026-06-14)
71
71
72
72
Concrete approach, effort, risk, and dependencies for what is left after
73
-
TG-0/1/2/3/4/5/9/10 landed. The three that remain are each **blocked on a
74
-
prerequisite, not on effort** (parallel readiness assessment, 2026-06-14):
75
-
TG-8 needs a dialect to actually exist as code; TG-7 needs an owner decision on
76
-
braid-equality semantics; TG-6 needs a wasm runtime stood up. **No further
77
-
auto-landing without those prerequisites.**
73
+
TG-0/1/2/3/4/5/9/10 landed. **Landable rungs of TG-6 and TG-7 also landed**
74
+
(2026-06-14): TG-6 now has a `wasmi` differential test executing the generated
75
+
wasm; TG-7 has an out-of-band `braid_equiv` checker. What genuinely remains is
76
+
**prerequisite-gated, not effort-gated**: TG-8 needs a dialect to exist as code;
77
+
TG-7's *semantics change* needs an owner decision; TG-6's *full bisimulation*
78
+
and TG-7's *Lean correctness proof* are research-grade.
0 commit comments