Commit 49fb46a
feat(L2): T_App_L2_Eff — Phase D slice 3 option 5a code lands (#209)
## Summary
Phase D slice 3 implementation under option 5a (owner-picked in PR
#208). Adds `T_App_L2_Eff` as a sibling constructor to `L2_lift_l1` in
`has_type_l2`, moving the elimination form of effect-typed `TFunEff`
lambdas out of L1 and into L2 per `PRESERVATION-DESIGN.md` §5.1 lines
468-474.
## What changed
- **New constructor `T_App_L2_Eff`** in `formal/TypingL2.v` after
`L2_lift_l1`. Threading: `e1 : (R → R1)` produces an effect-typed
lambda; `e2 : (R1 → R_in)` evaluates the argument matching the lambda's
declared input env; `EApp e1 e2 : (R → R_out)` consumes the body's
declared output region. No side condition at elimination (the `(forall
r, In r R -> In r R_in)` side condition already lives on
`T_Lam_L1_*_Eff` slice 2).
- **`project_l2_to_l1` refactored to option-return.** `T_App_L2_Eff`
cases have no L1 counterpart by design — that is the architectural point
of option 5a. The comment block documents the migration path for
callers.
- **`weaken_modality` rewritten by structural induction.** Old: project
to L1, weaken at L1, lift back. New: case on the L2 derivation;
`L2_lift_l1` lifts via `linear_to_affine`; `T_App_L2_Eff` weakens the
two sub-derivations recursively and reconstructs at Affine.
## Verification
- `coqc 8.18.0` full `formal/` build clean (10 .v files)
- Zero new `Admitted` / `Axiom` / `admit.` in `TypingL2.v`
- `Print Assumptions weaken_modality` → `Closed under the global
context`
- `Print Assumptions weaken_modality_le` → `Closed under the global
context`
- `Print Assumptions weaken_modality_le_strict_is_weaken_modality` →
`Closed under the global context`
## Owner-directive compliance (CLAUDE.md §🛑 Owner directive 2026-05-27)
- ✅ `Semantics.v` untouched (legacy `preservation` left as `Admitted`)
- ✅ `Typing.v` untouched (legacy judgment intact for `Counterexample.v`)
- ✅ `Counterexample.v` untouched
- ✅ No new admits or axioms anywhere
- ✅ Cross-layer fix per `PRESERVATION-DESIGN.md` §5.1 — not a
single-layer patch
## Companion docs
- `formal/PHASE-D-REDESIGN.md` slice 3 sub-sub-addendum (landed in #208)
- `.machine_readable/6a2/STATE.a2ml` phase flipped `owner-escalation →
implementation` (#208)
## What this does NOT close
`preservation_l1` as currently stated cannot Qed under option 5a alone —
slice 4a (TFunEff path) closes by inversion vacuity at L1, but slice 4b
(legacy `TFun` body-R-rigidity) carries forward into `preservation_l2`
via L1 importation as honest inherited debt.
## Next slices (out of scope here)
1. State `preservation_l2` over `has_type_l2`. Effect-typed paths get
the slice 4a case for free; legacy `TFun` paths carry forward the L1
admit via `L2_lift_l1`.
2. Phase B Slice 1 (TEcho linearity wire) + Phase C (list-vs-multiset
bridge) unlock once `preservation_l2` lands.
## Test plan
- [x] `coqc 8.18.0` build clean
- [x] `Print Assumptions` confirms zero axioms on new code
- [x] Diff scoped to `formal/TypingL2.v` only (no Makefile noise)
- [ ] CI green on merge
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 79cb1b0 commit 49fb46a
1 file changed
Lines changed: 64 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| |||
88 | 90 | | |
89 | 91 | | |
90 | 92 | | |
91 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
92 | 116 | | |
93 | 117 | | |
94 | 118 | | |
| |||
114 | 138 | | |
115 | 139 | | |
116 | 140 | | |
117 | | - | |
118 | | - | |
119 | | - | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
120 | 154 | | |
121 | 155 | | |
122 | 156 | | |
123 | 157 | | |
124 | | - | |
| 158 | + | |
125 | 159 | | |
126 | | - | |
| 160 | + | |
| 161 | + | |
127 | 162 | | |
128 | 163 | | |
129 | 164 | | |
| |||
136 | 171 | | |
137 | 172 | | |
138 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
139 | 180 | | |
140 | 181 | | |
141 | 182 | | |
142 | 183 | | |
143 | 184 | | |
144 | 185 | | |
145 | | - | |
146 | | - | |
147 | | - | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
148 | 197 | | |
149 | 198 | | |
150 | 199 | | |
| |||
0 commit comments