Commit 491ff14
feat(L1): Phase 3b Stage 1b — subst_typing_gen_l1_m_tfuneff Qed (zero axioms)
Ships the substitution-lemma half of Stage 1b. Closed TFunEff values
can now be substituted at depth k into leaf-only outer expressions
with full L1-typing preservation.
Lemma signature:
forall m R Gin e T R' Gout,
has_type_l1 m R Gin e T R' Gout ->
forall k Ta Tb R_in_v R_out_v v u_in,
nth_error Gin k = Some (TFunEff Ta Tb R_in_v R_out_v, u_in) ->
is_value v ->
tfuneff_lambda_free e = true -> (P1)
(forall r, In r (regions_introduced_by e) -> In r R_in_v) -> (P2)
expr_closed_below 0 v = true -> (P3)
has_type_l1 m R (remove_at k Gin) v
(TFunEff Ta Tb R_in_v R_out_v) R (remove_at k Gin) ->
forall u_out,
nth_error Gout k = Some (TFunEff Ta Tb R_in_v R_out_v, u_out) ->
has_type_l1 m R (remove_at k Gin) (subst k v e) T R'
(remove_at k Gout).
Mirrors Phase 2's [subst_typing_gen_l1_m_ground_nonlinear] structurally
with two swaps:
- Phase 2's [ground_nonlinear_retype_l1_m] (R, G-poly retype for
ground non-linear values, no side conditions) is replaced by
[closed_value_typing_RG_poly_l1_m] (closed TFunEff value RG-poly
retype, requires R' ⊆ R_in side condition). The side condition is
discharged at each compound-rule call site via
[sub_R_in_R_in_via_value_l1_m]: chain (sub-derivation R' ⊆ outer R
via count_occ_le_l1_m) + (outer R ⊆ R_in_v via the substituent's
T_Lam_L1_*_Eff formation side condition, extracted by
value_TFunEff_R_subset_R_in_l1_m).
- Phase 2's [ground_nonlinear_value_shift_id_l1] is replaced by
[closed_value_shift_id_l1_m] for binder-traversal shift-identity.
Inner T_Lam_L1_* / T_Lam_L1_*_Eff cases discharge via [discriminate]
on P1 (tfuneff_lambda_free (ELam _ _) = false).
Two new supporting lemmas in Semantics_L1.v:
- [closed_value_typing_RG_poly_l1_m] — combined RG-poly retype
chaining [closed_value_typing_G_poly_l1_m] with
[tfuneff_lambda_retype_l1_m] (PR #224).
- [value_TFunEff_R_subset_R_in_l1_m] — extracts the lambda-formation
side condition R ⊆ R_in from any TFunEff value typing. Trivial
inversion proof.
- [sub_R_in_R_in_via_value_l1_m] — packages the R-subset chain used
at every compound-rule call site in subst_typing_gen_l1_m_tfuneff.
Print Assumptions verdict on all four new lemmas:
- subst_typing_gen_l1_m_tfuneff: Closed under the global context
- closed_value_typing_G_poly_l1_m: Closed under the global context
- closed_value_typing_RG_poly_l1_m: Closed under the global context
- closed_below_k_typing_outer_tail_irrelevant_l1_m: Closed under the global context
Zero new axioms. Zero new admits. Stage 1b's L1-level deliverable is
complete; the L2 β-wrapper [preservation_l2_app_eff_beta_tfuneff_l1]
+ L2-judgment surface lemma ship next on this branch.
Owner-directive compliance (CLAUDE.md 2026-05-27):
- ✅ No touch to formal/Semantics.v / Typing.v / Counterexample.v.
- ✅ No closure of residual Semantics_L1.v admits attempted.
- ✅ Anti-pattern detector clean across all four stages of the
4-stage Phase 3b plan (#235 → #239 / #240 / #241 / #242).
- ✅ Strictly NEW infrastructure orthogonal to legacy.
Build oracle (coqc 8.18.0): clean across all 12 .v files.
Refs:
- ephapax issue #249 (Stage 1b tracking; this commit is the L1 half).
- ephapax PR #252 (Stage 1a prerequisite — tfuneff_lambda_free
+ Counterexample_L2_nested + design doc).
- ephapax issue #239 (parent Stage 1).
- formal/SUBST-LEMMA-GENERALIZATION-DESIGN.md Phase 3b Stage 1b.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent e2e56e4 commit 491ff14
1 file changed
Lines changed: 480 additions & 0 deletions
0 commit comments