Commit d2baf75
proof(L2): complete L2-modality migration of L1 preservation development
The L2-modality commit (4e87a05) added the `modality` index to
`has_type_l1` and split Lam/Case/If into `_Linear`/`_Affine` variants in
TypingL1.v, but never migrated Semantics_L1.v — leaving the entire
1515-line L1 preservation development (and Counterexample.v) broken.
This completes that migration so the development compiles again.
TypingL1.v:
- Replace the free-floating `T_Forget_Affine_L1` rule (which prepended an
extra binding to the output context, falsifying
`typing_preserves_length_l1` and `value_R_G_preserving_l1`) with proper
per-binder mode splits: `T_Let_L1_Linear`/`_Affine` and
`T_LetLin_L1_Linear`/`_Affine`, mirroring the existing Lam/Case
treatment. Affine variants relax the bound-var output flag to any `u`
(the affine "implicit drop"); all rules stay length-preserving.
Semantics_L1.v:
- Quantify every lemma over an explicit modality `m` (a Section variable
fails: `induction Htype` generalises the index, severing
cross-references to other m-dependent lemmas).
- Make the structural lemmas case-count-robust.
- Thread `m` and the mode-split through region-shrink, shift, subst, and
the 33-case preservation dispatch (econstructor auto-selects the mode
variant in congruence-step cases).
- The 4 affine-β subcases (Let/LetLin-Val, Case-Inl/Inr) are admitted with
documentation: they need a generalised affine substitution lemma,
tracked as L2 follow-up — distinct from the pre-existing linear
App/Pair/region-liveness soundness gaps.
Counterexample.v:
- `bad_input_untypable_l1` / `t_loc_l1_R_preserving` now quantify over `m`:
the bad input is untypable in every modality.
Full development builds clean from scratch (coqc 8.18, all 6 modules).
Legacy `Semantics.v` untouched.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 4e87a05 commit d2baf75
3 files changed
Lines changed: 432 additions & 280 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | | - | |
168 | | - | |
| 167 | + | |
| 168 | + | |
169 | 169 | | |
170 | 170 | | |
171 | | - | |
| 171 | + | |
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
175 | | - | |
| 175 | + | |
| 176 | + | |
176 | 177 | | |
177 | | - | |
178 | | - | |
| 178 | + | |
| 179 | + | |
179 | 180 | | |
180 | | - | |
| 181 | + | |
181 | 182 | | |
182 | 183 | | |
183 | 184 | | |
184 | 185 | | |
185 | 186 | | |
186 | | - | |
| 187 | + | |
187 | 188 | | |
188 | 189 | | |
189 | 190 | | |
190 | | - | |
| 191 | + | |
191 | 192 | | |
192 | 193 | | |
193 | 194 | | |
| |||
204 | 205 | | |
205 | 206 | | |
206 | 207 | | |
207 | | - | |
| 208 | + | |
208 | 209 | | |
209 | 210 | | |
210 | 211 | | |
| |||
0 commit comments