Skip to content

Commit f32b687

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 f32b687

2 files changed

Lines changed: 151 additions & 10 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

0 commit comments

Comments
 (0)