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
fix(tg-0): Tangle.lean compiles cleanly + wire CI build oracle (#33)
Closes#32 (TG-0).
Problem
=======
Empirical audit on 2026-06-01 found `proofs/Tangle.lean` had **121
errors** on every Lean 4 version v4.9 through v4.16. The 2026-03-30
commit titled *"feat: add Lean 4 formal proofs — progress, preservation,
determinism"* with body *"Zero sorry. ... Covers knot-theoretic
compose/tensor/close operations"* was committed without ever compiling.
No CI ran Lean, so the broken claim went undetected for ~2 months.
Fix
===
**62 inserts / 51 deletes**, zero `sorry` / `axiom` / `admit` / `Admitted`.
All 4 headline theorems preserved in full:
- `progress` — well-typed closed terms are values or can step
- `preservation` — stepping preserves types
- `determinism` — the step relation is deterministic
- `type_safety` — progress + preservation corollary
Auxiliary lemmas (`canonical_*`, `value_no_step`, `generatorWidth_*`)
also preserved.
What changed mechanically:
1. `foldl_max_init`: replaced terse one-liner with explicit
`rw [ih (max a (g.idx+1)), ih (max 0 (g.idx+1))]` — the old
`rw [ih, ih (max 0 _)]` left omega with an unresolved metavariable.
2. `foldl_shift_init`: replaced `split <;> omega` (couldn't close the
if-then-else interaction) with `by_cases hrest : rest = []` plus
targeted simp/omega per branch.
3. `cases ht with | tComposeWord ... =>` and siblings (tTensorWord,
tEqWord, tEqNum, tEqStr, tAddNum, tCloseWord, tPipeline): dropped
one underscore per pattern; modern Lean does not bind Γ as a
separate name when it unifies to `[]`.
4. Progress sub-goals for `composeIdL`/`composeIdR`/`tensorIdL`/
`tensorIdR`: removed spurious explicit args; `Step` constructors
have only implicit args.
5. `composeWords` arm of preservation: added
`rw [← generatorWidth_append]` so the resulting type matches.
6. `tensorWords` arm of preservation: replaced broken split/rename_i
with explicit `have hgoal` and targeted `rw`.
7. `congrArg (·.compose _) (ih h)` and siblings: replaced left-side
dot-notation sections (which produced `?m = ?m` failures because
`_` became a fresh per-side metavar) with `rw [ih h]`. Right-side
forms (`Expr.compose _ ·`) still work unchanged.
CI build oracle
===============
- `proofs/lean-toolchain`: pins `leanprover/lean4:v4.14.0`. Verified
0 errors on v4.10–v4.16 inclusive.
- `.github/workflows/lean-proofs.yml`: builds `proofs/Tangle.lean` on
every PR / push to `main` that touches `proofs/**` or the workflow.
Two gates: (a) `lean Tangle.lean` returns 0 errors; (b) no
`sorry`/`axiom`/`admit`/`Admitted` outside comments.
- Future drift fails CI rather than landing silently — same shape as
the ephapax `coq-build.yml` rule
[[feedback-proof-pr-build-oracle-is-only-truth]].
Truthful narrative update
=========================
- `PROOF-NARRATIVE.md` §2: adds "Build oracle" sub-section recording
the 121→0 trajectory; cross-documents echo-types audit as
NOT-RELEVANT (per [[proofs-must-check-and-cross-doc-echo-types]]).
- `ASSUMPTIONS.md` changelog: new 2026-06-01 row noting TG-0 closure
and the CI gate.
Unblocks
========
- TG-1 (let-binding extension, #26) — was blocked on a base file that
did not compile. Now unblocked.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
| 2026-06-01 | A-TG-9.1 reformulated under TG-9 Option B — accept LSP-only categories instead of pretending refinement (full Option A queued at #28). See `compiler/tangle-lsp/docs/lsp-diagnostic-categories.md`. | TG-9 Option B PR |
73
+
| 2026-06-01 | TG-0 closed: `proofs/Tangle.lean` previously had 121 errors on Lean 4.9–4.16 (commit 8ce7be7 was committed without ever compiling). Repaired: 62/51 diff, 0 errors on Lean 4.10–4.16. CI oracle at `.github/workflows/lean-proofs.yml` pinned to v4.14.0 via `proofs/lean-toolchain`. Sorry/axiom/admit slippage check added. Closes hyperpolymath/tangle#32. | TG-0 PR |
0 commit comments