Skip to content

Commit 2aebf63

Browse files
committed
docs: port §4.8.1 + §5.1 + L1 admit enumeration to main
Brings three doc-only improvements from the design branch onto main: 1. PRESERVATION-DESIGN.md §4.8.1 (from design-branch PR #170 — T_Var strengthening landed via the m-indexed has_type_l1 in #176). Docs what §4.8 path (3) closes and what it does not. 2. PRESERVATION-DESIGN.md §5.1 (from design-branch PR #172) — L1's lambda-rigidity gap (S_App_Step2 / S_Pair_Step2 admits in preservation_l1) closes at L2 Phase 2 via effect-typed TFun. Documents the §5 table's "✓ (L1 fix)" cell as conditional, and explains why effect-typing is L2's job not L1's. 3. docs/proof-debt.adoc — adds the L1 admit enumeration that the design branch carried via PR #169. Eight current escape-hatch sites in Semantics_L1.v listed by file:line per the trusted-base policy substring-match convention. Plus the Echo.v K-closure note (from PR #173's main re-port). No source/proof changes — pure documentation. Allows the trusted-base reduction policy check to substring-match all escape-hatch sites in Semantics_L1.v. Refs design-branch PRs #169 / #170 / #172 / #173, PR #176 (L2 hybrid).
1 parent 22e5a3e commit 2aebf63

3 files changed

Lines changed: 191 additions & 23 deletions

File tree

docs/proof-debt.adoc

Lines changed: 58 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -149,21 +149,70 @@ for refutation budgets (`docs/proof-debt.adoc` §(b) in that repo).
149149
close — namely the affine side, which needs L2 + the weakening
150150
lemma).
151151

152+
=== `formal/Semantics_L1.v` — in-flight L1 admits (post-#176 L2 hybrid)
153+
154+
After the L2 hybrid landing (#176), main's `Semantics_L1.v` carries
155+
the following escape-hatch sites. All are tracked, structurally
156+
diagnosed, and sequenced under the four-layer redesign plan.
157+
158+
NOTE: line numbers are point-in-time and may shift with subsequent
159+
edits. The substring match is `file:line`; entries below cover the
160+
current positions on main.
161+
162+
* **`formal/Semantics_L1.v:343`** — `Admitted.` capping one of the
163+
region-shrink helpers (T_Region_Active_L1 shadowed case at the
164+
list-vs-multiset boundary). Three documented closure approaches
165+
in-file.
166+
* **`formal/Semantics_L1.v:400`** — `Admitted.` (related
167+
region-shrink admit; same structural class as L343).
168+
* **`formal/Semantics_L1.v:412`** — `Admitted.` (related).
169+
* **`formal/Semantics_L1.v:520`** — `Admitted.` (related).
170+
* **`formal/Semantics_L1.v:608`** — `Axiom region_liveness_at_split_l1`.
171+
Documented in-file as universally false; the residual obstacle is
172+
T_Region_Active_L1 with binder=rv. Three closure paths documented:
173+
(i) restate with `no_region_active_pop_of rv e` side condition,
174+
(ii) multi-set `region_env`, (iii) weaker contextual signature.
175+
L1.G follow-up converts this to a Lemma + 1 narrow admit (per
176+
PR #178 / its main re-port).
177+
* **`formal/Semantics_L1.v:632`** — `Admitted.` capping
178+
`preservation_l1` (related to L1.G's gap above; L2-gated per
179+
§5.1 — closes once L2 Phase 2's effect-typed `TFun` lands).
180+
* **`formal/Semantics_L1.v:703`** — `admit.` inside `preservation_l1`
181+
for one of the lambda-rigidity admits (S_App_Step2 / S_Pair_Step2
182+
per §4.8 + §5.1).
183+
* **`formal/Semantics_L1.v:704`** — `Admitted.` capping
184+
`preservation_l1` (same lambda-rigidity gap).
185+
186+
All are tracked in the L1 closure plan and sequenced under the
187+
four-layer redesign. None are soundness-relevant in the legacy
188+
`Semantics.v`; they live entirely on the L1 redesign side.
189+
190+
=== `formal/Echo.v` — L3 layer K dependency CLOSED 2026-05-27
191+
192+
PR #173 (design branch) / its main re-port discharged the
193+
`Eqdep.Eq_rect_eq` (K / UIP) dependency in `mode_le_trans` +
194+
`degrade_mode_comp` via the motive-trick K-free template from
195+
`formal/Modality.v`. **All Echo.v lemmas are now closed under the
196+
global context** — zero K, zero UIP, zero axioms. Entry kept here
197+
for historical visibility; no current escape hatch in `Echo.v`.
198+
152199
== What this repo does *not* establish today
153200

154201
Per `formal/PRESERVATION-DESIGN.md` §12.15.4, even after the in-flight
155202
L1 work lands, the following remain open and are tracked here so
156203
downstream consumers do not overclaim:
157204

158-
* The `ephapax-affine` sublanguage is not separately mechanised.
159-
Rust `LinearChecker` and `AffineChecker` are independent
160-
(behavioural tests only); the Coq judgment covers a single
161-
judgment resembling linear discipline. The Linear ⇒ Affine lemma
162-
is L2 work, not L1.
163-
* No mechanised correspondence between the Rust checkers and the Coq
164-
judgment.
165-
* L3 `formal/Echo.v` does not exist; the theory lives upstream at
166-
`hyperpolymath/echo-types`.
205+
* The `ephapax-affine` sublanguage's mechanisation in `formal/`
206+
exists (post-#176: `has_type_l1` carries the modality parameter,
207+
`linear_to_affine : has_type_l1 Linear ... → has_type_l1 Affine ...`
208+
is Qed, mode-specific T_Lam_L1_*, T_Case_L1_*, T_If_L1_* land).
209+
The Rust `AffineChecker` is independent (behavioural tests only);
210+
no mechanised correspondence between the Rust checkers and the
211+
Coq judgment.
212+
* L3 `formal/Echo.v` mechanises the residue type former layer per
213+
PRESERVATION-DESIGN.md §6 (Mode, LEcho, weaken, EchoR + headline
214+
`no_section_collapse_to_residue`). Type-former integration into
215+
Syntax.v / Typing.v / Semantics.v is forward-looking.
167216
* L4 mode-elaboration soundness is a research track, not scheduled.
168217

169218
Per the policy schema, these are *plan items* rather than (d) DEBT

formal/PRESERVATION-DESIGN.md

Lines changed: 93 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,35 @@ proof-engineering gap but a calculus-design gap.
317317
The L1.E PR documents this in-source. None of (1)/(2)/(3) is in scope
318318
for the L1 minimal-fix; each is a follow-up. See ROADMAP for sequencing.
319319

320+
### 4.8.1 Resolution path (3) landed 2026-05-27 — and what it does not close
321+
322+
`T_Var_Lin_L1` and `T_Var_Unr_L1` were strengthened with the premise
323+
`forall r, In r (free_regions T) -> In r R` (originally as PR #170
324+
on the design branch, subsumed into the m-indexed main via #176).
325+
The strengthening:
326+
327+
- **Closes the source-level soundness gap**: programs like
328+
329+
let_lin x = (ELoc 0 "r") in (ELet (ERegion "r" (EI32 5)) (EDrop (EVar 1)))
330+
331+
no longer type, because the `EDrop (EVar 1)` site fails the
332+
variable rule's new well-formedness premise at R = `[]`.
333+
334+
What the strengthening does **not** close: the
335+
`region_liveness_at_split_l1` lemma's residual admit (formerly the
336+
opaque `Axiom`, converted to an Admitted Lemma with 28-of-29 cases
337+
proved concretely in the L1.G follow-up). An empirical closure
338+
attempt closes most cases trivially via the IH chain, but the
339+
T_Region_Active_L1 case with `binder = rv` exhibits a real
340+
counterexample even under the strengthened judgment:
341+
342+
ERegion rv (EI32 5) : TBase TI32 — In rv R, In rv R' = False
343+
(because remove_first_L1 pops the only rv)
344+
345+
Three follow-up paths (side-conditioned lemma, multi-set R,
346+
contextual weaker signature) remain L1 follow-up work, independent
347+
of and additional to this §4.8 resolution.
348+
320349
---
321350

322351
## 5. Layer 2 in detail — Linear vs Affine modality
@@ -376,7 +405,7 @@ recipe (echo-types' `degradeMode-comp`, `EchoLinear.agda:93-101`).
376405

377406
| Property | Ephapax-Linear | Ephapax-Affine |
378407
|---|---|---|
379-
| Preservation | ✓ (L1 fix) | ✓ (same fix; Affine derivations are L1-safe by weakening) |
408+
| Preservation | ✓ (L1 fix, *conditional on §5.1*) | ✓ (same fix; Affine derivations are L1-safe by weakening) |
380409
| Progress |||
381410
| **No-leak** (every introduced linear value is consumed) | proved | does **not** hold; replaced by "no-duplicate" |
382411
| **No-duplicate** | trivially (Linear ⇒ no-duplicate) | proved as a structural property |
@@ -387,6 +416,69 @@ Cross-mode: the Linear ⇒ Affine weakening lemma is a single induction.
387416
Combined with monomode preservation, this gives Affine preservation
388417
for free.
389418

419+
### 5.1 Cross-layer dependency: L1's lambda-rigidity gap closes at L2
420+
421+
The "Preservation ✓ (L1 fix)" cell above is **not realised by L1 alone**.
422+
`formal/Semantics_L1.v`'s `preservation_l1` is currently `Admitted`
423+
because of three internal admits in its proof body:
424+
425+
- `S_StringConcat_Step2` — tractable; needs a
426+
`step_pop_disjoint_from_type_l1` lemma.
427+
- `S_App_Step2` and `S_Pair_Step2` — the **lambda-rigidity gap** per
428+
§4.8: `T_Lam_L1_*` fixes the body's region environment at lambda-
429+
creation time; the rules give no way to re-derive the lambda's
430+
typing at a shifted `R'` after the inner step.
431+
432+
§4.8.1 records that path (3) — strengthening `T_Var_*_L1` — landed
433+
2026-05-27 via PR #170 (and subsumed via #176). It closes the
434+
source-level *variable* soundness gap but leaves the lambda-body
435+
case open because the body's typing is fixed at `T_Lam_L1_*`-
436+
introduction, not at variable-use. Path (3) is necessary but **not
437+
sufficient**.
438+
439+
**Path (1) — effect-typed lambdas — is L2 Phase 2's mechanism.** The
440+
mode-specific `T_Lam_L1_Linear` / `T_Lam_L1_Affine` constructors
441+
should carry an annotation of the body's region effect (how `R`
442+
shifts through the body). Concretely, the lambda type would extend
443+
from
444+
445+
```
446+
TFun T1 T2
447+
```
448+
449+
to
450+
451+
```
452+
TFun T1 T2 (R_in : region_env) (R_out : region_env)
453+
```
454+
455+
(or an equivalent abstract `Effect` parameter). At application time,
456+
`T_App_L1` would consume `R_in` and produce `R_out`, threading the
457+
region change properly. This lets `S_App_Step2`'s preservation
458+
close: the lambda's typing at the post-step `R'` is derived from the
459+
recorded effect, not blocked by rigid `T_Lam` introduction.
460+
461+
**Sequencing.** The current `T_Lam_L1_*` rules (per the L2 mode-
462+
split table above) carry only the per-type-flag changes. The
463+
effect-typed `TFun` is an additional, orthogonal extension planned
464+
for L2 Phase 2. When it lands, the L1 preservation closure can
465+
return and discharge the lambda-rigidity admits in
466+
`Semantics_L1.v`.
467+
468+
**Why this isn't L1's job.** Effect-typed function types are a
469+
typing-layer property, not a region-layer property. Adding them to
470+
L1's unparameterised judgment would conflate the two. L2 is the
471+
natural home: the modality parameter is *already* a typing-layer
472+
decoration; the effect annotation rides alongside it. After L2's
473+
effect-typed TFun lands, L1's gap closes by importation, not by
474+
re-deriving L1.
475+
476+
Until that follow-up lands, the §5 table's "Preservation ✓" should
477+
be read as "achievable under the L1 architecture once L2 effect-
478+
typed lambdas are introduced". The Linear ⇒ Affine weakening
479+
(`linear_to_affine` Qed, PR #176) is independent of this dependency
480+
and already ships.
481+
390482
---
391483

392484
## 6. Layer 3 — Echo / residue, in design

formal/PROOF-STATUS.a2ml

Lines changed: 40 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,20 @@
33
#
44
# PROOF-STATUS.a2ml — machine-readable Coq proof state
55
#
6-
# Snapshot of formal/*.v as of 2026-05-27 (post-L1.A through L1.F).
6+
# Snapshot of formal/*.v as of 2026-05-27 (post-L1.A through L1.F,
7+
# post-#176 L2 hybrid, post-#180 K-free Echo.v, post-#181 Axiom→Lemma).
78
# Consumed by automated proof-debt trackers, status dashboards, and
89
# CI gates that need to know "what counts as proven here".
910
#
10-
# Human-readable companion: formal/PRESERVATION-DESIGN.md §4.7 and §4.8.
11+
# Human-readable companion: formal/PRESERVATION-DESIGN.md §4.7, §4.8,
12+
# §4.8.1, §5.1.
1113

1214
[metadata]
13-
version = "1.0.0"
15+
version = "1.1.0"
1416
snapshot-date = "2026-05-27"
15-
design-branch = "proof/l1-region-threading-design"
1617
spec-doc = "formal/PRESERVATION-DESIGN.md"
1718
counterexample = "formal/Counterexample.v"
19+
note = "Design-branch is superseded by main's L2 hybrid (#176/#177). All L1+L2+L3 work now lives on main."
1820

1921
# ============================================================================
2022
# FILES — what's in formal/ and its proof-status posture
@@ -61,12 +63,36 @@ note = "Legacy preservation has 1 residual admit (S_Region_Step + T_Region_Activ
6163

6264
[[files]]
6365
path = "formal/Semantics_L1.v"
64-
purpose = "L1 preservation theorem + helpers"
66+
purpose = "L1 preservation theorem + helpers (now m-indexed per #176)"
6567
status = "active"
66-
admit-count = 4
67-
axiom-count = 1
68-
admitted-lemma-count = 2
69-
landed-in = ["PR-157", "PR-158", "PR-159", "PR-160", "PR-161", "PR-162", "PR-163"]
68+
admit-count = 4 # post-#181: 1 in region_liveness_at_split_l1_gen + 3 lambda-rigidity in preservation_l1
69+
axiom-count = 0 # post-#181: Axiom region_liveness_at_split_l1 → Lemma + 1 admit
70+
admitted-lemma-count = 3 # region_shrink_..._gen + region_liveness_at_split_l1_gen + preservation_l1
71+
landed-in = ["PR-157", "PR-158", "PR-159", "PR-160", "PR-161", "PR-162", "PR-163", "PR-176", "PR-181"]
72+
73+
[[files]]
74+
path = "formal/Modality.v"
75+
purpose = "L2 modality datatype + thin-poset (Linear ≤ Affine)"
76+
status = "stable"
77+
qed-only = true
78+
landed-in = ["PR-168", "PR-176"]
79+
note = "K-free throughout. All Qed lemmas (refl/trans/prop) closed under the global context."
80+
81+
[[files]]
82+
path = "formal/TypingL2.v"
83+
purpose = "L2 has_type_l2 modality-indexed judgment skeleton"
84+
status = "stable"
85+
qed-only = true
86+
landed-in = "PR-168"
87+
note = "Single L2_lift_l1 constructor + weaken_modality Qed (zero axioms). Mode-specific T_Lam_*, T_Case_*, T_If_* now live directly on m-indexed has_type_l1 per #176; this file's role is to be the cross-layer entry point for callers wanting the L2 framing explicitly."
88+
89+
[[files]]
90+
path = "formal/Echo.v"
91+
purpose = "L3 residue/echo type former — forward-looking scaffold"
92+
status = "stable"
93+
qed-only = true
94+
landed-in = ["PR-166", "PR-167", "PR-180"]
95+
note = "K-free throughout (post-#180/#173). Headlines: Echo fiber, LEcho mode-polymorphic carrier, weaken Linear→Affine, EchoR + collapse_to_residue + no_section_collapse_to_residue (the irreversibility theorem; closed under the global context, zero axioms)."
7096

7197
# ============================================================================
7298
# L1 PROOF CHAIN — Qed lemmas
@@ -181,11 +207,12 @@ follow-up = "see PRESERVATION-DESIGN.md §4.8"
181207
[[proof-debt]]
182208
id = "L1.C-region-liveness"
183209
file = "Semantics_L1.v"
184-
line-anchor = "region_liveness_at_split_l1 (Axiom)"
185-
class = "carry-invariant-through-induction"
210+
line-anchor = "region_liveness_at_split_l1_gen T_Region_Active_L1 r=rv (post-#181)"
211+
class = "structurally-false-as-universal"
186212
tractable = true
187-
diagnosis = "subst_typing_gen_l1 needs to know that In rv R_inner at each compound-rule split point. The outer call provides In rv R; the inductive descent doesn't propagate it because T_Var_Lin_L1 doesn't enforce In rv R."
188-
closes-when = "one of (1) strengthen T_Var_Lin_L1 to require In rv R, (2) add a side condition to subst_typing_gen_l1 stating In rv R at every R_inner reached, (3) prove a region-liveness corollary of L1.B's count monotonicity"
213+
diagnosis = "ERegion rv (EI32 5) at R = [rv] gives In rv R but In rv R' = False (the rule pops the only rv from R_body). The Lemma's universal statement is false in this sub-case; 28/29 cases proved concretely via PR #181."
214+
closes-when = "one of (i) restate with a no_region_active_pop_of rv e side condition + discharge at the 9 call sites in subst_typing_gen_l1, (ii) multi-set region_env, (iii) weaker contextual signature"
215+
status-history = "Axiom (pre-#181) → Lemma with 1 narrow admit (post-#181). Transparency improvement, not soundness."
189216

190217
# ============================================================================
191218
# DOCUMENTATION POINTERS

0 commit comments

Comments
 (0)