Commit 5741ee3
authored
proof(L3.K): rewrite Echo.v K-free — eliminate eq_rect_eq dependency (#173)
## Summary
Discharges the K proof-debt documented in `formal/Echo.v`'s top-of-file
comment (introduced in PR #166, tracked in `docs/proof-debt.adoc` via
#169). Rewrites two definitions/lemmas that previously pulled in Coq's
`Eqdep.Eq_rect_eq.eq_rect_eq` (K / UIP) axiom via `dependent
destruction`, using the K-free motive-trick template established in
`formal/Modality.v` (#168).
## Changes
1. **New helper** `mode_le_affine_first : mode_le Affine m2 -> m2 =
Affine` — raw dependent match with sort-indexed motive. Mirrors
`Modality.v`'s `modality_le_affine_first`.
2. **`mode_le_trans` rewritten as a `Definition`** (not tactic-derived)
using the same shape as `Modality.v`'s `modality_le_trans`: pattern
match on `H12`; the `Linear_le_Affine` case uses `mode_le_affine_first`
+ `eq_rect` to transport the result through `m3 = Affine`.
3. **`degrade_mode_comp` no longer uses `dependent destruction`**. In
each non-trivial case:
```coq
pose proof (mode_le_affine_first m3 p23) as Heq.
generalize dependent p23. rewrite Heq. intros p23.
rewrite (mode_le_prop _ _ p23 Affine_le_Affine).
reflexivity.
```
This canonicalises `m3` to `Affine` via `mode_le_affine_first`, then
collapses `p23` to the unique `Affine_le_Affine` constructor via
`mode_le_prop` (already K-free from #166).
4. Top-of-file comment changed from "Proof-debt note (axiom
dependencies)" to "K-freedom" documentation.
5. `Coq.Program.Equality` import removed.
## Verification
`Print Assumptions` on every previously-K-using or K-inheriting lemma:
| Lemma | Status |
|---|---|
| `mode_le_trans` | Closed under the global context |
| `degrade_mode_comp` | Closed under the global context |
| `degrade_mode_compose` | Closed under the global context |
| `degrade_mode_via_join` | Closed under the global context |
| `no_section_collapse_to_residue` | Closed under the global context |
| `mode_le_prop` | Closed under the global context |
The entire `formal/` project (9 .v files) builds clean with zero admits
and zero axiom dependencies beyond the documented L1 admits in
`Semantics_L1.v`.
## Why this matters
Aligns Echo.v with:
- The Agda upstream's `--safe --without-K` discipline
(`echo-types/proofs/agda/EchoLinear.agda`).
- The rest of the Ephapax Coq codebase (per `Print Assumptions` on
`value_R_G_preserving_l1`, `subst_preserves_typing_l1`,
`weaken_modality`, etc. — all K-free).
Closes the L3.K proof-debt item.
## Branch base
Stacked off `proof/l1-region-threading-design` (head `30ce697`,
post-#172). Will rebase to `main` when #153 lands.
## Test plan
- [x] `coqc 8.18.0` builds `Echo.v` cleanly, 0 admits
- [x] Clean full-project rebuild passes — 9 .v files
- [x] `Print Assumptions` confirms K elimination
- [x] No semantic changes — same lemmas, K-free proofs only
- [ ] CI green
- [ ] Review: K-free template matches `Modality.v`; proof-debt closure
note in commit can also be added to `docs/proof-debt.adoc` as a
follow-up doc tweak
Refs PR #166, PR #168, PR #169.
🤖 Generated with [Claude Code](https://claude.com/claude-code)1 parent 30ce697 commit 5741ee3
1 file changed
Lines changed: 65 additions & 31 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
81 | 79 | | |
82 | 80 | | |
83 | | - | |
84 | 81 | | |
85 | 82 | | |
86 | 83 | | |
| |||
110 | 107 | | |
111 | 108 | | |
112 | 109 | | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
113 | 131 | | |
114 | | - | |
115 | | - | |
116 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
117 | 136 | | |
118 | 137 | | |
119 | 138 | | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
127 | 149 | | |
128 | 150 | | |
129 | 151 | | |
| |||
303 | 325 | | |
304 | 326 | | |
305 | 327 | | |
306 | | - | |
307 | | - | |
308 | | - | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
309 | 343 | | |
310 | 344 | | |
311 | 345 | | |
| |||
0 commit comments