1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 include "basic_2/dynamic/snv_aaa.ma".
16 include "basic_2/dynamic/snv_cpes.ma".
17 include "basic_2/dynamic/lsubsv_lstas.ma".
19 (* STRATIFIED NATIVE VALIDITY FOR TERMS *************************************)
21 (* Properties on sn parallel reduction for local environments ***************)
23 fact lstas_cpr_lpr_aux: ∀h,g,G0,L0,T0.
24 (∀G1,L1,T1. ⦃G0, L0, T0⦄ >≡[h, g] ⦃G1, L1, T1⦄ → IH_snv_lstas h g G1 L1 T1) →
25 (∀G1,L1,T1. ⦃G0, L0, T0⦄ >≡[h, g] ⦃G1, L1, T1⦄ → IH_snv_cpr_lpr h g G1 L1 T1) →
26 (∀G1,L1,T1. ⦃G0, L0, T0⦄ >≡[h, g] ⦃G1, L1, T1⦄ → IH_da_cpr_lpr h g G1 L1 T1) →
27 (∀G1,L1,T1. ⦃G0, L0, T0⦄ >≡[h, g] ⦃G1, L1, T1⦄ → IH_lstas_cpr_lpr h g G1 L1 T1) →
28 ∀G1,L1,T1. G0 = G1 → L0 = L1 → T0 = T1 → IH_lstas_cpr_lpr h g G1 L1 T1.
29 #h #g #G0 #L0 #T0 #IH4 #IH3 #IH2 #IH1 #G1 #L1 * * [|||| * ]
30 [ #k #_ #_ #_ #_ #l1 #l2 #_ #_ #X2 #H2 #X3 #H3 #L2 #_ -IH4 -IH3 -IH2 -IH1
31 >(lstas_inv_sort1 … H2) -X2
32 >(cpr_inv_sort1 … H3) -X3 /2 width=3 by ex2_intro/
33 | #i #HG0 #HL0 #HT0 #H1 #l1 #l2 @(nat_ind_plus … l2) -l2 [ #_ | #l2 #_ #Hl21 ] #Hl1 #X2 #H2 #X3 #H3 #L2 #HL12 destruct -IH4 -IH3
34 [ lapply (lstas_inv_O … H2) -H2 #H destruct -IH1 -H1 -l1 /4 width=5 by lpr_cpcs_conf, cpr_cpcs_dx, ex2_intro/ ]
35 elim (snv_inv_lref … H1) -H1 #I0 #K0 #X0 #HK0 #HX0
36 elim (da_inv_lref … Hl1) -Hl1 * #K1 [ #V1 | #W1 #l0 ] #HLK1 [ #HVl1 | #HWl1 #H destruct ]
37 lapply (drop_mono … HK0 … HLK1) -HK0 #H destruct
38 elim (lstas_inv_lref1 … H2) -H2 * #K0 #V0 #W0 [2,4: #X0 ] #HK0 [1,2: #_ -X0 ] #HVW0 #HX2
39 lapply (drop_mono … HK0 … HLK1) -HK0 #H destruct
40 [ lapply (le_plus_to_le_r … Hl21) -Hl21 #Hl21 ]
41 lapply (fqup_lref … G1 … HLK1) #HKV1
42 elim (lpr_drop_conf … HLK1 … HL12) -HL12 #X #H #HLK2
43 elim (lpr_inv_pair1 … H) -H #K2 [ #W2 | #V2 ] #HK12 [ #HW12 | #HV12 ] #H destruct
44 lapply (drop_fwd_drop2 … HLK2) #H2
45 elim (cpr_inv_lref1 … H3) -H3
46 [1,3: #H destruct -HLK1
47 |2,4: * #K0 #V0 #X0 #H #HVX0 #HX0
48 lapply (drop_mono … H … HLK1) -H -HLK1 #H destruct
50 [ lapply (IH2 … HWl1 … HW12 … HK12) /2 width=1 by fqup_fpbg/ -IH2 #H
51 elim (da_inv_sta … H) -H
52 elim (IH1 … HWl1 … HVW0 … HW12 … HK12) -IH1 -HVW0 /2 width=1 by fqup_fpbg/ #V2 #HWV2 #HV2
53 elim (lift_total V2 0 (i+1))
54 /3 width=12 by cpcs_lift, lstas_ldec, ex2_intro/
55 | elim (IH1 … HVl1 … HVW0 … HV12 … HK12) -IH1 -HVl1 -HVW0 -HV12 -HK12 -IH2 /2 width=1 by fqup_fpbg/ #W2 #HVW2 #HW02
56 elim (lift_total W2 0 (i+1))
57 /4 width=12 by cpcs_lift, lstas_ldef, ex2_intro/
58 | elim (IH1 … HVl1 … HVW0 … HVX0 … HK12) -IH1 -HVl1 -HVW0 -HVX0 -HK12 -IH2 -V2 /2 width=1 by fqup_fpbg/ -l1 #W2 #HXW2 #HW02
59 elim (lift_total W2 0 (i+1))
60 /3 width=12 by cpcs_lift, lstas_lift, ex2_intro/
62 | #p #_ #_ #HT0 #H1 destruct -IH4 -IH3 -IH2 -IH1
63 elim (snv_inv_gref … H1)
64 | #a #I #V1 #T1 #HG0 #HL0 #HT0 #H1 #l1 #l2 #Hl21 #Hl1 #X2 #H2 #X3 #H3 #L2 #HL12 destruct -IH4 -IH3 -IH2
65 elim (snv_inv_bind … H1) -H1 #_ #HT1
66 lapply (da_inv_bind … Hl1) -Hl1 #Hl1
67 elim (lstas_inv_bind1 … H2) -H2 #U1 #HTU1 #H destruct
68 elim (cpr_inv_bind1 … H3) -H3 *
69 [ #V2 #T2 #HV12 #HT12 #H destruct
70 elim (IH1 … Hl1 … HTU1 … HT12 (L2.ⓑ{I}V2)) -IH1 -Hl1 -HTU1 -HT12 /2 width=1 by fqup_fpbg, lpr_pair/ -T1
71 /4 width=5 by cpcs_bind2, lpr_cpr_conf, lstas_bind, ex2_intro/
72 | #T3 #HT13 #HXT3 #H1 #H2 destruct
73 elim (IH1 … Hl1 … HTU1 … HT13 (L2.ⓓV1)) -IH1 -Hl1 -HTU1 -HT13 /2 width=1 by fqup_fpbg, lpr_pair/ -T1 -HL12 #U3 #HTU3 #HU13
74 elim (lstas_inv_lift1 … HTU3 L2 … HXT3) -T3
75 /5 width=8 by cpcs_cpr_strap1, cpcs_bind1, cpr_zeta, drop_drop, ex2_intro/
77 | #V1 #T1 #HG0 #HL0 #HT0 #H1 #l1 #l2 #Hl21 #Hl1 #X2 #H2 #X3 #H3 #L2 #HL12 destruct
78 elim (snv_inv_appl … H1) -H1 #a #W1 #U1 #l0 #HV1 #HT1 #HVW1 #HTU1
79 lapply (da_inv_flat … Hl1) -Hl1 #Hl1
80 elim (lstas_inv_appl1 … H2) -H2 #X #HT1U #H destruct
81 elim (cpr_inv_appl1 … H3) -H3 *
82 [ #V2 #T2 #HV12 #HT12 #H destruct -a -l0 -W1 -U1 -HV1 -IH4 -IH3 -IH2
83 elim (IH1 … Hl1 … HT1U … HT12 … HL12) -IH1 -Hl1 -HT1U
84 /4 width=5 by fqup_fpbg, cpcs_flat, lpr_cpr_conf, lstas_appl, ex2_intro/
85 | #b #V2 #W2 #W3 #T2 #T3 #HV12 #HW23 #HT23 #H1 #H2 destruct
86 elim (snv_inv_bind … HT1) -HT1 #HW2 #HT2
87 lapply (da_inv_bind … Hl1) -Hl1 #Hl1
88 elim (lstas_inv_bind1 … HT1U) -HT1U #U #HT2U #H destruct
89 elim (cpds_inv_abst1 … HTU1) -HTU1 #W0 #U0 #HW20 #_ #H destruct -U0 -l0
90 elim (snv_fwd_da … HW2) #l0 #HW2l
91 lapply (cpds_div … W2 … 0 … HVW1) /2 width=3 by cprs_cpds/ -W0 #H21
92 elim (snv_fwd_da … HV1) #l #HV1l
93 elim (da_cpes_aux … IH4 IH3 IH2 … HW2l … HV1l … H21) /2 width=1 by fqup_fpbg/ #_ #H
94 <minus_n_O #H0 destruct >(plus_minus_m_m l 1) in HV1l; // -H #HV1l
95 lapply (cpes_cpr_lpr_aux … IH2 IH1 … H21 … HW23 … HV12 … HL12) -H21 /2 width=1 by fqup_fpbg/ #H32
96 lapply (IH3 … HW23 … HL12) /2 width=1 by fqup_fpbg/ #HW3
97 lapply (IH3 … HV12 … HL12) /2 width=1 by fqup_fpbg/ #HV2
98 lapply (IH2 … HW2l … HW23 … HL12) /2 width=1 by fqup_fpbg/ -HW2 -HW2l #HW3l
99 lapply (IH2 … HV1l … HV12 … HL12) /2 width=1 by fqup_fpbg/ -HV1 -HV1l #HV2l
100 elim (IH1 … Hl1 … HT2U … HT23 (L2.ⓛW3)) -HT2U /2 width=1 by fqup_fpbg, lpr_pair/ #U3 #HTU3 #HU23
101 elim (lsubsv_lstas_trans … g … HTU3 … Hl21 … (L2.ⓓⓝW3.V2)) -HTU3
102 [ #U4 #HT3U4 #HU43 -IH1 -IH2 -IH3 -IH4 -l -l1 -HW3 -HV2 -HT2
103 @(ex2_intro … (ⓓ{b}ⓝW3.V2.U4)) /2 width=1 by lstas_bind/ -HT3U4
104 @(cpcs_canc_dx … (ⓓ{b}ⓝW3.V2.U3)) /2 width=1 by cpcs_bind_dx/ -HU43
105 @(cpcs_cpr_strap1 … (ⓐV2.ⓛ{b}W3.U3)) /2 width=1 by cpr_beta/
106 /4 width=3 by cpcs_flat, cpcs_bind2, lpr_cpr_conf/
108 @(lsubsv_beta … (l-1)) /3 width=7 by fqup_fpbg/
109 @hsnv_cast [1,2: // ] #l0 #Hl0
110 lapply (cpes_le_aux … IH4 IH3 IH2 IH1 … HW3l … HV2l … l0 … H32) -IH4 -IH3 -IH2 -IH1 -HW3l -HV2l -H32
111 /3 width=5 by fpbg_fpbs_trans, fqup_fpbg, cpr_lpr_fpbs, le_S_S/
112 | -IH1 -IH3 -IH4 /3 width=9 by fqup_fpbg, lpr_pair/
114 | #b #V0 #V2 #W0 #W2 #T0 #T2 #HV10 #HV02 #HW02 #HT02 #H1 #H2 destruct -a -l0 -W1 -HV1 -IH4 -IH3 -IH2
115 elim (snv_inv_bind … HT1) -HT1 #_ #HT0
116 lapply (da_inv_bind … Hl1) -Hl1 #Hl1
117 elim (lstas_inv_bind1 … HT1U) -HT1U #U0 #HTU0 #H destruct
118 elim (IH1 … Hl1 … HTU0 … HT02 (L2.ⓓW2)) -IH1 -Hl1 -HTU0 /2 width=1 by fqup_fpbg, lpr_pair/ -T0 #U2 #HTU2 #HU02
119 lapply (lpr_cpr_conf … HL12 … HV10) -HV10 #HV10
120 lapply (lpr_cpr_conf … HL12 … HW02) -L1 #HW02
121 lapply (cpcs_bind2 b … HW02 … HU02) -HW02 -HU02 #HU02
122 lapply (cpcs_flat … HV10 … HU02 Appl) -HV10 -HU02 #HU02
123 lapply (cpcs_cpr_strap1 … HU02 (ⓓ{b}W2.ⓐV2.U2) ?)
124 /4 width=3 by lstas_appl, lstas_bind, cpr_theta, ex2_intro/
126 | #W1 #T1 #HG0 #HL0 #HT0 #H1 #l1 #l2 @(nat_ind_plus … l2) -l2 [ #_ | #l2 #_ #Hl21 ] #Hl1 #X2 #H2 #X3 #H3 #L2 #HL12 destruct -IH4 -IH3 -IH2
127 [ lapply (lstas_inv_O … H2) -H2 #H destruct -IH1 -H1 -l1 /4 width=5 by lpr_cpcs_conf, cpr_cpcs_dx, ex2_intro/ ]
128 elim (snv_inv_cast … H1) -H1 #U1 #_ #HT1 #_ #_ -U1
129 lapply (da_inv_flat … Hl1) -Hl1 #Hl1
130 lapply (lstas_inv_cast1 … H2) -H2 #HTU1
131 elim (cpr_inv_cast1 … H3) -H3
132 [ * #U2 #T2 #_ #HT12 #H destruct
133 elim (IH1 … Hl1 … HTU1 … HT12 … HL12) -IH1 -Hl1 -HTU1 -HL12
134 /3 width=3 by fqup_fpbg, lstas_cast, ex2_intro/
135 | #HT1X3 elim (IH1 … Hl1 … HTU1 … HT1X3 … HL12) -IH1 -Hl1 -HTU1 -HL12
136 /2 width=3 by fqup_fpbg, ex2_intro/