Skip to content

Commit cabce00

Browse files
docs(L2): CHANGELOG + PROOF-NEEDS — L2 modality landing + L2-β tracking (#177)
## Summary Follow-up doc PR for L2 landing (PR #176, merged as `c9683d1`). Updates human-readable docs + cleans an accidentally-tracked aux file: - **CHANGELOG.md**: new "Four-layer preservation redesign" section summarising L1 (PR #153-line), L2 (PR #176), L3 (PR #166/#167) with file pointers and the ephapax-affine ≠ AffineScript disambiguation hook. - **PROOF-NEEDS.md**: updates current-state inventory to list `TypingL1.v`, `Modality.v`, `Semantics_L1.v`, `TypingL2.v`, `Echo.v`, `Counterexample.v` with their L2 status (linear_to_affine Qed zero axioms; 6 L1 lemmas L2-β regressed). Splits "What needs proving" into L2-β follow-up + legacy-preservation entries. - **`formal/.Semantics_admitted.aux`**: untracked (build artifact, per `.gitignore` `.*.aux` policy). No code changes — docs + dotfile cleanup only. ## Test plan - [x] No conflict markers in PROOF-NEEDS.md (clean merge with main's Path-3 at-pre helper additions) - [x] Build still clean locally - [ ] CI burn-in 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent c9683d1 commit cabce00

3 files changed

Lines changed: 46 additions & 45 deletions

File tree

CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,37 @@ All notable changes to Ephapax are documented here.
55

66
## [Unreleased]
77

8+
### Four-layer preservation redesign (2026-05-26 → 2026-05-27)
9+
10+
- **L1 — region capabilities** (PRs #153-line, integration branch
11+
`proof/l1-region-threading-design`): introduces `has_type_l1` with
12+
R-threading in `formal/TypingL1.v`. Supporting lemmas in
13+
`formal/Semantics_L1.v`. Counterexample regression (`bad_input_untypable_l1`)
14+
Qed in `formal/Counterexample.v`. `preservation_l1` Admitted with 4
15+
residual admits in R-weakening territory.
16+
- **L2 — Linear/Affine modality** (PR #176, this entry): `has_type_l1`
17+
carries `m : Modality` parameter so a single judgment specialises to
18+
ephapax-linear AND ephapax-affine. New `formal/Modality.v` with K-free
19+
thin poset (`modality_le` at `Type` sort + `_refl`/`_trans`/`_prop`).
20+
Mode-split constructors for `T_Lam` / `T_Case` / `T_If`; remaining 21
21+
rules modality-polymorphic. **`linear_to_affine` Qed, closed under the
22+
global context (zero axioms).** Mirrors `EchoLinear.agda:38-58`'s
23+
`weaken : LEcho linear → LEcho affine`. `weaken_modality` at the L2
24+
layer dispatches through `linear_to_affine`. Six pre-L2 `Semantics_L1.v`
25+
lemmas regressed to `Admitted` (bullet-structure rewrite needed for
26+
the 3 new Affine-only constructors); restoration tracked as L2-β.
27+
`Counterexample.bad_input_untypable_l1` generalised to `forall m,
28+
~ has_type_l1 m ...` — Qed under both indices.
29+
- **L3 — Echo / residue** (PRs #166, #167-line, parallel track):
30+
`formal/Echo.v` scaffold with `Mode + LEcho + decoration-commuting
31+
weakening`; `EchoR` residue + no-section irreversibility headline.
32+
Decouples residue layer from typing layer; couples through L2's
33+
thin-poset structure.
34+
- **Disambiguation, durable**: `ephapax-affine ≠ AffineScript`. They are
35+
separate languages sharing only the typed-wasm target. Per `README`,
36+
`CLAUDE.md`, `.machine_readable/disambiguation.a2ml` hooks landed via
37+
PRs #152 / affinescript#393 / typed-wasm#73.
38+
839
### Proof state (2026-05-20 → 2026-05-21)
940
- **Coq `preservation` reduction campaign**: 910 open goals → 12 (98.7% reduction). PR chain:
1041
- **#92** — honest framing: replaced unsubstantiated "Qed 2026-04-27" claim with `Admitted.`

PROOF-NEEDS.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,19 @@
22

33
## Current state
44
- `formal/Syntax.v` — Coq formalization of Ephapax syntax (clean)
5-
- `formal/Semantics.v` — Coq operational semantics
5+
- `formal/Semantics.v` — Coq legacy operational semantics
66
- `step_preserves_type`**Qed** (closed 2026-05-26 via [Path 3 at-pre helper](#path-3-at-pre-helper))
77
- `step_output_context_eq` (Lemma B) — **Qed** (closed 2026-05-26 via Path 3)
88
- `step_preserves_type_at_pre`**Admitted** (NEW helper; 8 of 35 cases remain admitted, falls through to `all: admit.` catch-all)
99
- `step_output_context_eq_at_pre`**Admitted** (NEW helper; analogous shape)
10-
- `preservation`**Admitted** (12 cascading goals — separate problem, region-env weakening for non-values)
11-
- `formal/Typing.v` — Coq typing rules (clean)
10+
- `preservation`**Admitted** (12 cascading goals — separate problem, region-env weakening for non-values; superseded by L1 redesign — see `formal/PRESERVATION-DESIGN.md`)
11+
- `formal/Typing.v` — Coq typing rules, legacy (clean)
12+
- `formal/TypingL1.v`**L2** Coq typing rules: `has_type_l1` indexed by `m : Modality ∈ {Linear, Affine}`. 21 modality-polymorphic constructors + 3 mode-split rule pairs (T_Lam / T_Case / T_If Linear vs Affine). `linear_to_affine` **Qed (zero axioms)**. Mode-split mechanises the PRESERVATION-DESIGN.md §5 distinction.
13+
- `formal/Modality.v` — K-free `Modality` datatype + `modality_le` thin poset + `_refl`/`_trans`/`_prop` lemmas. Mirrors `echo-types/proofs/agda/EchoLinear.agda:75-101`.
14+
- `formal/Semantics_L1.v` — L1 operational semantics; `preservation_l1` Admitted under `forall m : Modality, ...`. Six supporting lemmas L2-β regressed (bullet-structure rewrite needed for the new Affine-only constructors).
15+
- `formal/TypingL2.v` — thin re-indexing wrapper: `has_type_l2 m R G e T R' G' := L2_lift_l1 m (TypingL1.has_type_l1 m ...)`. `weaken_modality` dispatches through `TypingL1.linear_to_affine`.
16+
- `formal/Echo.v`**L3** echo residue scaffold (`Mode + LEcho + decoration-commuting weakening + EchoR + no-section irreversibility`).
17+
- `formal/Counterexample.v``bad_input_untypable_l1 : forall m, ~ has_type_l1 m ...` Qed (regression witness under both modes).
1218
- `src/formal/Ephapax/Formal/RegionLinear.idr` — Idris2 region-based linearity proof (explicitly states "REAL proof — not believe_me, not assert_total")
1319
- 17 Idris2 files across formal verification layer
1420
- No `believe_me`, `sorry`, or `assert_total` in Idris2 source code
@@ -22,6 +28,12 @@ The at-pre helpers' S_Region_Step case is structurally simpler than the original
2228
Most of the helpers' OTHER cases were closed by copying step_preserves_type's and step_output_context_eq's tactic blocks verbatim (patterns use `?R`/`?R'` polymorphically and match at-pre framing trivially). What remains in each helper is the per-goal cases (~8 of 35), pending case-by-case closure.
2329

2430
## What needs proving
31+
32+
### L2-β follow-up (post-PR #176)
33+
- **6 L1 supporting lemmas in `Semantics_L1.v`** — bullet-structure rewrite of the `induction Htype` proofs to account for the 3 new Affine-only constructors (T_Lam_L1_Affine, T_Case_L1_Affine, T_If_L1_Affine). Each restoration adds 3 `discriminate` dispatches on the `Linear = Affine` equality and re-aligns case bullets. Mechanical; ~2-3 hours.
34+
- **`preservation_l1` body** under `forall m`: Linear branch is the old partial proof (12 admits in R-weakening territory); Affine branch needs the supporting lemmas above plus mode-aware handling for T_Lam_Affine / T_Case_Affine / T_If_Affine. Estimated 3-4 sessions once the supporting lemmas are restored.
35+
36+
### Legacy preservation
2537
- **`step_preserves_type_at_pre`**: Close the remaining ~8 admitted cases (the per-goal cases of step_preserves_type's structure that need explicit blocks: S_StringConcat_Step2, S_Let_Step, S_LetLin_Step, S_App_Step2, S_If_Step, S_Pair_Step1, S_Pair_Step2, S_Case_Step). Each ~30 LOC, ported from step_preserves_type's "Per-goal" section (lines 5033-5562). Estimated 2-3h.
2638
- **`step_output_context_eq_at_pre`**: Close ~11 remaining admitted cases (the per-goal cases + S_Region_Step). Patterns parallel step_output_context_eq's body. Estimated 2-3h.
2739
- **`preservation`**: Close the remaining **12 open goals** — the RIGHT branch (R' = remove_first r R) sub-cases of each congruence step rule. These need a **region-env weakening for non-values** lemma that doesn't follow trivially from current infrastructure. Per the handoff doc, this is a deeper problem: when a binder steps to exit region r, the sibling expression might still mention r and not be typeable at the post-step R'. Closing requires either (a) a strengthened type invariant preventing such configurations, (b) a weakened preservation statement, or (c) a region-env weakening helper that case-analyses on the sibling's syntactic shape. Estimated 4-8h.

formal/.Semantics_admitted.aux

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

0 commit comments

Comments
 (0)