Commit 0356a74
proof(L1.G): strengthen T_Var_*_L1 with region well-formedness (§4.8 path 3) (#170)
## Summary
Lands resolution path 3 from `formal/PRESERVATION-DESIGN.md §4.8` —
strengthens `T_Var_Lin_L1` / `T_Var_Unr_L1` with the premise
```coq
forall r, In r (free_regions T) -> In r R
```
closing the source-level soundness gap where a variable of type `TString
r` could be used at an `R` no longer containing `r`. Stacked onto the L1
umbrella PR #153.
## What this PR does
- **`formal/TypingL1.v`** — strengthens both variable rules; header
comment links to §4.8 resolution path 3.
- **`formal/Semantics_L1.v`** — fixes the hypothesis renumbering (the
new well-formedness premise lands at `H1` for both rules) via explicit
`rename H1 into Hwf` + threading through `T_Var_*_L1` applications.
Touches `shift_typing_gen_l1` and `subst_typing_gen_l1`. The existing
`region_shrink_preserves_typing_l1_gen` gains two T_Var-case admits
(joining the existing two T_Region-case admits — that lemma is already
`Admitted`); the wrapper `region_shrink_preserves_typing_l1` is
unchanged.
- **`formal/PRESERVATION-DESIGN.md §4.8.1`** — new sub-section records
the landing and the residual axiom obstacle.
## What this PR does NOT do — and why
It does **not** close `Axiom region_liveness_at_split_l1`. An empirical
closure attempt (replacing `Axiom` with `Lemma`, doing structural
induction) shows 23 of 25 cases close trivially via IH chains, but
`T_Region_Active_L1` with binder=rv remains a genuine obstacle even
under the strengthened judgment. Minimal counterexample at the typing
level:
```
ERegion rv (EI32 5) : TBase TI32 -| [] at R = [rv]
```
The rule pops the only `rv` on exit, so `In rv R'` is false. The axiom's
in-source header (`Semantics_L1.v` around L895) now documents this
finding with three follow-up closure paths (side-conditioned lemma,
multi-set `R`, contextual weaker signature). Closing it is L1 follow-up
work — independent of, and additional to, this §4.8 resolution.
## Counterexample regression
`bad_input_untypable_l1` in `Counterexample.v` still closes `Qed.` —
that proof inverts `T_Pair_L1` / `T_Loc_L1` / `T_Region_*_L1`, not
`T_Var_*_L1`, so the strengthening is orthogonal.
## Test plan
- [x] `cd formal && coq_makefile -f _CoqProject -o build.mk && make -f
build.mk -j2` — clean rebuild green (~31s, coqc 8.18.0)
- [x] `Counterexample.v` still Qed on `bad_input_untypable_l1`
- [x] `Semantics_L1.v` still Qed on the 22 lemmas that were Qed pre-PR
- [x] No new admits in `Semantics.v` (legacy judgment untouched)
- [x] Empirical closure attempt of `region_liveness_at_split_l1` ran;
23/25 cases via IH chains, T_Region_Active_L1 obstacle confirmed
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 3089859 commit 0356a74
3 files changed
Lines changed: 152 additions & 27 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
291 | 324 | | |
292 | 325 | | |
293 | 326 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
334 | 334 | | |
335 | 335 | | |
336 | 336 | | |
337 | | - | |
338 | | - | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
339 | 344 | | |
340 | 345 | | |
341 | 346 | | |
| |||
723 | 728 | | |
724 | 729 | | |
725 | 730 | | |
726 | | - | |
727 | | - | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
728 | 736 | | |
729 | 737 | | |
730 | 738 | | |
731 | 739 | | |
732 | 740 | | |
733 | 741 | | |
| 742 | + | |
734 | 743 | | |
735 | 744 | | |
736 | 745 | | |
737 | 746 | | |
738 | 747 | | |
739 | | - | |
740 | | - | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
741 | 752 | | |
742 | 753 | | |
743 | 754 | | |
744 | 755 | | |
| 756 | + | |
745 | 757 | | |
746 | 758 | | |
747 | 759 | | |
748 | 760 | | |
| 761 | + | |
749 | 762 | | |
750 | 763 | | |
751 | 764 | | |
| |||
885 | 898 | | |
886 | 899 | | |
887 | 900 | | |
888 | | - | |
889 | | - | |
890 | | - | |
891 | | - | |
892 | | - | |
893 | | - | |
894 | | - | |
895 | | - | |
896 | | - | |
897 | | - | |
898 | | - | |
899 | | - | |
900 | | - | |
901 | | - | |
902 | | - | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
903 | 977 | | |
904 | 978 | | |
905 | 979 | | |
| |||
929 | 1003 | | |
930 | 1004 | | |
931 | 1005 | | |
932 | | - | |
933 | | - | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
934 | 1012 | | |
935 | | - | |
936 | | - | |
| 1013 | + | |
| 1014 | + | |
937 | 1015 | | |
938 | 1016 | | |
939 | 1017 | | |
| |||
947 | 1025 | | |
948 | 1026 | | |
949 | 1027 | | |
| 1028 | + | |
950 | 1029 | | |
951 | 1030 | | |
952 | 1031 | | |
953 | 1032 | | |
954 | 1033 | | |
955 | 1034 | | |
| 1035 | + | |
956 | 1036 | | |
957 | | - | |
958 | | - | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
959 | 1040 | | |
960 | 1041 | | |
961 | 1042 | | |
| |||
965 | 1046 | | |
966 | 1047 | | |
967 | 1048 | | |
| 1049 | + | |
968 | 1050 | | |
969 | 1051 | | |
970 | 1052 | | |
971 | 1053 | | |
| 1054 | + | |
972 | 1055 | | |
973 | 1056 | | |
974 | 1057 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
98 | 105 | | |
99 | 106 | | |
100 | 107 | | |
| 108 | + | |
101 | 109 | | |
102 | 110 | | |
103 | 111 | | |
104 | 112 | | |
105 | 113 | | |
| 114 | + | |
106 | 115 | | |
107 | 116 | | |
108 | 117 | | |
| |||
0 commit comments