Skip to content

Commit 2fe5d0b

Browse files
claudehyperpolymath
authored andcommitted
chore(betlang): housekeeping — axiom-free doc reconciliation, rot untrack, SPDX, license badge
Reconcile docs to the axiom-free reality. substTop_preserves_typing is a proved theorem (proofs/BetLang.lean:918), verified by `lake build`; zero `axiom` declarations remain. Six artefacts still called it a live axiom: - docs/proof-debt.adoc: move substTop from §(c) NECESSARY AXIOM to §(a) DISCHARGED; marker count 1 -> 0. - PROOF-STATUS.md: TP-4 -> Done; axiom-free note; banned-patterns wording. - PROOF-NEEDS.md: TP-4 status -> done. - .machine_readable/6a2/STATE.a2ml: M4 done; axioms=[]; remaining 10->9; drop already-merged-PR (#53/#54/#55) next-actions. - README.md / README.adoc / EXPLAINME.adoc: "one permitted axiom" -> axiom-free. Untrack build rot + tidy: - remove 8 stale *.bak.20250719-182140 backups. - untrack 321 Gleam build artefacts under lsp/bet-lsp/build/ (already gitignored). - remove broken root symlink SPEC.core.scm (target migrated .scm -> .a2ml). - gitignore lake-manifest.json (zero-dep project; regenerated on every build). Conformance: - add SPDX headers to core/betlang.rkt, lib/ternary.rkt, repl/shell.rkt, tests/basics.rkt (Mustfile requires SPDX on .rkt). - drop redundant/incorrect PMPL-1.0 license badge (LICENSE + SPDX = MPL-2.0). Verified: `lake build` green (Lean v4.15.0), tools/proof-scan.sh clean, working tree clean. No Lean sources changed. https://claude.ai/code/session_01VwbFNQJw23tW8tqM7utWku
1 parent 3ac22ca commit 2fe5d0b

342 files changed

Lines changed: 59 additions & 56639 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,4 @@ dist/
4949
*.olean
5050
lake-packages/
5151
lakefile.olean
52+
lake-manifest.json

.machine_readable/6a2/STATE.a2ml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,33 +34,30 @@ milestones = [
3434
"M1: Proof foundation — lakefile.lean + proofs.yml CI + banned-pattern gate [DONE #53]",
3535
"M2: Governance clean — licence, language policy, Racket tests, timeout [DONE #54]",
3636
"M3: Echo types core — Type::Echo/EchoR, unify, lower, Lean Ty.echo/echoR [DONE #55]",
37-
"M4: Discharge substTop_preserves_typing axiom (PROOF-STATUS TP-4)",
37+
"M4: Discharge substTop_preserves_typing axiom (PROOF-STATUS TP-4) [DONE — now a proved theorem; axiom-free core]",
3838
"M5: Echo operations — echo_intro, proj1, echo_to_residue; typing rules",
3939
"M6: sample_echo / bet_echo probabilistic bridge",
4040
"M7: Julia backend Phase 2 — core language features",
4141
]
4242

4343
[proof-obligations]
4444
# See PROOF-STATUS.md for the full register (13 obligations)
45-
proved = ["TP-1 Progress", "TP-2 Preservation", "TP-3 Monad laws"]
46-
axioms = ["substTop_preserves_typing (classified, standards#203, docs/proof-debt.adoc)"]
47-
remaining = 10
45+
proved = ["TP-1 Progress", "TP-2 Preservation", "TP-3 Monad laws", "TP-4 substTop_preserves_typing (discharged — axiom-free)"]
46+
axioms = []
47+
remaining = 9
4848

4949
[blockers-and-issues]
5050
issues = [
5151
"bet-wasm E0308: pre-existing WASM backend breakage (match arm type mismatch, not caused by any of #53-55)",
52-
"substTop_preserves_typing: classified axiom; discharge is M4 (Phase 2 proofs)",
5352
"Echo operations deferred: no echo_intro/proj1/echo_to_residue until runtime/proof story settled",
5453
]
5554

5655
[critical-next-actions]
5756
actions = [
58-
"Merge PR #54 → main (all-green)",
59-
"Rebase PR #53 onto updated main, re-CI, merge",
60-
"Retarget PR #55 to main, mark ready, merge",
61-
"Phase 2 proof obligations: discharge substTop_preserves_typing",
62-
"Echo operations pass: introduce echo_intro, echo_to_residue, proj1; typing rules in Lean",
57+
"TP-5: Echo-operation typing rules + metatheory in Lean (echo_intro, echo_to_residue, proj1)",
6358
"sample_echo / bet_echo probabilistic bridge (Dist T → Echo T)",
59+
"Julia backend Phase 2 — core language features",
60+
"bet-wasm E0308: fix pre-existing WASM backend match-arm type mismatch",
6461
]
6562

6663
[language-policy]

EXPLAINME.adoc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ there.
8080
* **Preservation** — typing is invariant under small-step reduction.
8181
* **Distribution monad laws** — the probability monad is correctly structured.
8282

83-
One permitted axiom: `substTop_preserves_typing` — classified, triaged in
84-
`docs/proof-debt.adoc`, tracked as standards#203.
83+
Axiom-free: `substTop_preserves_typing` is a proved theorem (formerly a
84+
classified axiom, since discharged; see `docs/proof-debt.adoc` §(a), standards#203).
8585

8686
Proof infrastructure: `lakefile.lean`, `lean-toolchain` (pins `leanprover/lean4:v4.15.0`),
8787
`.github/workflows/proofs.yml` (runs `lake build` + `tools/proof-scan.sh` on every PR).
@@ -222,8 +222,8 @@ structurally: `Echo T ~ Echo T'` iff `T ~ T'`.
222222

223223
=== Proof debt
224224

225-
`docs/proof-debt.adoc` — records the single classified axiom
226-
(`substTop_preserves_typing`, standards#203). No other unsoundness.
225+
`docs/proof-debt.adoc` — records the discharged `substTop_preserves_typing`
226+
lemma (formerly a classified axiom; standards#203). No axioms remain; no other unsoundness.
227227

228228
=== PROOF-STATUS.md
229229

@@ -269,7 +269,6 @@ Tracks the 13 proof obligations across their completion stages. Currently 3/13 d
269269
* Runtime residue payload for `Echo T` / `EchoR T` — ghost-erased until operations demand
270270
* WASM backend (`compiler/bet-wasm/`) — pre-existing breakage, non-critical
271271
* Julia backend Phase 2 — active but separate work stream
272-
* `substTop_preserves_typing` discharge — Phase 2 proof obligation
273272

274273
== For AI agents
275274

PROOF-NEEDS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ This file defines *what* must be proven. Completion is tracked in
2727
| TP-1 | Progress (well-typed ⇒ value or steps) | TP | Lean4 | P1 | ✅ done |
2828
| TP-2 | Preservation (typing preserved under step) | TP | Lean4 | P1 | ✅ done |
2929
| TP-3 | Distribution monad laws (×3) | TP | Lean4 | P1 | ✅ done |
30-
| TP-4 | Discharge `substTop_preserves_typing` axiom | TP | Lean4 | P1 | remaining |
30+
| TP-4 | Discharge `substTop_preserves_typing` axiom | TP | Lean4 | P1 | ✅ done |
3131
| TP-5 | Echo-operation typing rules + metatheory (Progress/Preservation) | TP | Lean4 | P2 | remaining |
3232
| SEM-1 | Continuous measure-theoretic denotation | SEM | Lean4 | P2 | remaining |
3333
| STAT-1 | Maximum entropy of uniform ternary = log₂3 | STAT | Lean4 | P2 | remaining |

PROOF-STATUS.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,12 @@ See `docs/AFFINESCRIPT-ALIGNMENT.adoc` for the phased plan and
2929
| TP-1 | Progress — well-typed closed term is a value or steps | Lean4 | `proofs/BetLang.lean` | `lake build` (CI: `proofs.yml`) |
3030
| TP-2 | Preservation — typing preserved under reduction | Lean4 | `proofs/BetLang.lean` | `lake build` (CI: `proofs.yml`) |
3131
| TP-3 | Distribution monad laws (left id, right id, assoc) | Lean4 | `proofs/BetLang.lean` | `lake build` (CI: `proofs.yml`) |
32+
| TP-4 | Discharge `substTop_preserves_typing` (de Bruijn subst lemma) — now a proved theorem, axiom-free | Lean4 | `proofs/BetLang.lean` | `lake build` (CI: `proofs.yml`) |
3233

33-
> Note: TP-2 currently depends on the classified necessary axiom
34-
> `substTop_preserves_typing` (`proofs/BetLang.lean`). It is an explicit
35-
> axiom, **not** a `sorry`see `docs/proof-debt.adoc` §(c). Discharging
36-
> it (TP-4) yields an axiom-free core.
34+
> Note: TP-2 is axiom-free. `substTop_preserves_typing`
35+
> (`proofs/BetLang.lean:918`) is a fully proved `theorem` — the former
36+
> classified axiom (TP-4) has been discharged (see `docs/proof-debt.adoc`
37+
> §(a)). No `axiom` declarations remain.
3738
3839
## Proofs In Progress
3940

@@ -51,7 +52,6 @@ See `docs/AFFINESCRIPT-ALIGNMENT.adoc` for the phased plan and
5152

5253
| ID | Proof | Category | Prover | Phase | Priority |
5354
|----|-------|----------|--------|-------|----------|
54-
| TP-4 | Discharge `substTop_preserves_typing` (de Bruijn subst lemma) | TP | Lean4 | 2 | P1 |
5555
| TP-5 | Echo-operation typing rules + metatheory — mirror `bet-check`'s functor/comonad surface (`echo`, `echo_map`, `echo_output`, `echo_duplicate`, `echo_to_residue`, `sample_echo`), incl. the comonad laws from `EchoGradedComonad.agda` | TP | Lean4 | 2 | P2 |
5656
| SEM-1 | Continuous measure-theoretic denotational semantics | SEM | Lean4 | 2 | P2 |
5757
| STAT-1 | Maximum entropy of uniform ternary = log₂3 bits | STAT | Lean4 | 2 | P2 |
@@ -75,8 +75,9 @@ just proof-scan # banned-pattern gate only
7575

7676
`sorry` / `admit` (Lean), `Admitted` (Coq), `postulate` / `believe_me` /
7777
`assert_total` (Idris2/Agda), `unsafeCoerce`. Enforced by
78-
`tools/proof-scan.sh` in CI (`.github/workflows/proofs.yml`). The single
79-
classified `axiom` is permitted by policy (standards#203).
78+
`tools/proof-scan.sh` in CI (`.github/workflows/proofs.yml`). No `axiom`
79+
declarations remain; any future classified `axiom` would be permitted by
80+
policy (standards#203) and registered in `docs/proof-debt.adoc`.
8081

8182
## Changelog
8283

README.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ Over time, the full **uncertainty number tower migrates here**.
7979
=== Lean 4 — Proof / Verification Layer
8080

8181
* Machine-checks **Progress**, **Preservation**, and distribution **monad laws**
82-
* **Zero `sorry`** — one permitted classified axiom (`substTop_preserves_typing`,
83-
see `docs/proof-debt.adoc`)
82+
* **Zero `sorry`, zero `axiom`** — `substTop_preserves_typing` is fully proved
83+
(formerly a classified axiom, since discharged; see `docs/proof-debt.adoc`)
8484
* `lakefile.lean` + `lean-toolchain` make proofs a first-class Lake project
8585
* `.github/workflows/proofs.yml` verifies every PR via `lake build`
8686

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
[![Sponsor](https://img.shields.io/badge/Sponsor-%E2%9D%A4-pink?logo=github)](https://github.com/sponsors/hyperpolymath)
55
[![License: MPL-2.0](https://img.shields.io/badge/License-MPL--2.0-blue.svg)](LICENSE)
6-
[![License: PMPL-1.0](https://img.shields.io/badge/License-PMPL--1.0-indigo.svg)](PALIMPSEST.adoc)
76

87
# BetLang
98

@@ -64,7 +63,7 @@ demand a payload. See [docs/echo-types.adoc](docs/echo-types.adoc).
6463

6564
- `lakefile.lean` + `lean-toolchain` → buildable Lake project
6665
- `.github/workflows/proofs.yml` → CI-checked on every PR (`lake build` + banned-pattern scan)
67-
- One permitted classified axiom: `substTop_preserves_typing` (see `docs/proof-debt.adoc`)
66+
- Axiom-free: `substTop_preserves_typing` is fully proved — no `axiom`/`sorry` (see `docs/proof-debt.adoc`)
6867

6968
---
7069

@@ -117,7 +116,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md). For a guided tour, read [EXPLAINME.adoc]
117116

118117
## License
119118

120-
BetLang uses **PMPL-1.0** (Palimpsest Public License). SPDX identifier: `MPL-2.0`.
119+
BetLang is licensed under **MPL-2.0**. SPDX identifier: `MPL-2.0`.
121120

122121
See [LICENSE](LICENSE) and [PALIMPSEST.adoc](PALIMPSEST.adoc).
123122

SPEC.core.scm

Lines changed: 0 additions & 1 deletion
This file was deleted.

core/betlang.rkt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#lang racket
2+
; SPDX-License-Identifier: MPL-2.0
3+
; SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell (hyperpolymath)
24
(provide bet
35
bet/weighted
46
bet/conditional

core/betlang.rkt.bak.20250719-182140

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)