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/grammar/tstc_tstc.ma".
16 include "basic_2/computation/cpxs_cpxs.ma".
17 include "basic_2/computation/csn_alt.ma".
18 include "basic_2/computation/csn_lift.ma".
20 (* CONTEXT-SENSITIVE EXTENDED STRONGLY NORMALIZING TERMS ********************)
22 (* Advanced properties ******************************************************)
24 lemma csn_lpx_conf: ∀h,g,L1,L2. ⦃h, L1⦄ ⊢ ➡[g] L2 →
25 ∀T. ⦃h, L1⦄ ⊢ ⬊*[g] T → ⦃h, L2⦄ ⊢ ⬊*[g] T.
26 #h #g #L1 #L2 #HL12 #T #H @(csn_ind_alt … H) -T #T #_ #IHT
27 @csn_intro #T0 #HLT0 #HT0
28 @IHT /2 width=2/ -IHT -HT0 /2 width=3 by lpx_cpx_trans/
31 lemma csn_abst: ∀h,g,a,L,W. ⦃h, L⦄ ⊢ ⬊*[g] W →
32 ∀T. ⦃h, L.ⓛW⦄ ⊢ ⬊*[g] T → ⦃h, L⦄ ⊢ ⬊*[g] ⓛ{a}W.T.
33 #h #g #a #L #W #HW @(csn_ind … HW) -W #W #_ #IHW #T #HT @(csn_ind … HT) -T #T #HT #IHT
35 elim (cpx_inv_abst1 … H1) -H1
36 #W0 #T0 #HLW0 #HLT0 #H destruct
37 elim (eq_false_inv_tpair_sn … H2) -H2
38 [ -IHT #H lapply (csn_cpx_trans … HLT0) // -HT
39 #HT0 lapply (csn_lpx_conf … (L.ⓛW0) … HT0) -HT0 /2 width=1/ /3 width=1/
40 | -IHW -HLW0 -HT * #H destruct /3 width=1/
44 lemma csn_abbr: ∀h,g,a,L,V. ⦃h, L⦄ ⊢ ⬊*[g] V →
45 ∀T. ⦃h, L.ⓓV⦄ ⊢ ⬊*[g] T → ⦃h, L⦄ ⊢ ⬊*[g] ⓓ{a}V. T.
46 #h #g #a #L #V #HV elim HV -V #V #_ #IHV #T #HT @(csn_ind_alt … HT) -T #T #HT #IHT
48 elim (cpx_inv_abbr1 … H1) -H1 *
49 [ #V1 #T1 #HLV1 #HLT1 #H destruct
50 elim (eq_false_inv_tpair_sn … H2) -H2
51 [ #HV1 @IHV // /2 width=1/ -HV1
52 @(csn_lpx_conf … (L. ⓓV)) /2 width=1/ -HLV1 /2 width=3 by csn_cpx_trans/
53 | -IHV -HLV1 * #H destruct /3 width=1/
55 | -IHV -IHT -H2 #T0 #HLT0 #HT0
56 lapply (csn_cpx_trans … HT … HLT0) -T #HLT0
57 lapply (csn_inv_lift … HLT0 … HT0) -T0 /2 width=3/
61 fact csn_appl_beta_aux: ∀h,g,a,L,U1. ⦃h, L⦄ ⊢ ⬊*[g] U1 → ∀V. ⦃h, L⦄ ⊢ ⬊*[g] V →
62 ∀W,T1. U1 = ⓛ{a}W.T1 → (
63 ∀T2. ⦃h, L.ⓛW⦄ ⊢ T1 ➡*[g] T2 → ⦃h, L⦄ ⊢ ⬊*[g] ⓓ{a}V.T2
64 ) → ⦃h, L⦄ ⊢ ⬊*[g] ⓐV.ⓛ{a}W.T1.
65 #h #g #a #L #X1 #H @(csn_ind … H) -X1
66 #X1 #HT1 #IHT1 #X2 #H @(csn_ind … H) -X2
67 #V #HV #IHV #W #T1 #H1 #IHT2 destruct
69 elim (cpx_inv_appl1 … H1) -H1 *
70 [ #V0 #Y #HLV0 #H #H0 destruct
71 elim (cpx_inv_abst1 … H) -H #W0 #T0 #HLW0 #HLT0 #H destruct
72 elim (eq_false_inv_tpair_dx … H2) -H2
73 [ lapply (csn_cpx_trans … HV … HLV0) -HV #HV0 #HWT0
74 @IHT1 -IHT1 [4,5: // |1: skip |2,3: /2 width=1/ ] -HWT0 -HV0 #T2 #HT02
75 lapply (lpx_cpxs_trans … HT02 (L.ⓛW) ?) [ /2 width=1/ ] -W0 #HT02
76 lapply (cpxs_strap2 … HLT0 … HT02) -T0 #HT12
77 lapply (IHT2 … HT12) -T1 #HT2
78 @(csn_cpx_trans … HT2) -HT2 /2 width=1/
79 | -HV -HT1 -IHT1 -HLW0 -HLT0 * #H #HV0 destruct
80 @IHV -IHV [1,3: // |2: /2 width=1/ ] -HV0 #T2 #HT02
81 lapply (IHT2 … HT02) -IHT2 -HT02 #HT2
82 @(csn_cpx_trans … HT2) -HT2 /2 width=1/
84 | -HT1 -IHT1 -HV -IHV -H2 #b #V0 #W0 #T0 #T3 #HLV0 #HLT01 #H1 #H2 destruct
85 lapply (IHT2 T3 ?) [ /2 width=1/ ] -IHT2 -HLT01 #HT3
86 @(csn_cpx_trans … HT3) -HT3 /2 width=1/
87 | -HT1 -IHT1 -HV -IHV -IHT2 -H2 #b #V0 #V1 #W0 #W1 #T0 #T3 #_ #_ #_ #_ #H destruct
91 (* Basic_1: was just: sn3_beta *)
92 lemma csn_appl_beta: ∀h,g,a,L,W,T1. ⦃h, L⦄ ⊢ ⬊*[g] ⓛ{a}W.T1 → ∀V. (
93 ∀T2. ⦃h, L.ⓛW⦄ ⊢ T1 ➡*[g] T2 → ⦃h, L⦄ ⊢ ⬊*[g] ⓓ{a}V.T2
94 ) → ⦃h, L⦄ ⊢ ⬊*[g] ⓐV.ⓛ{a}W.T1.
95 #h #g #a #L #W #T1 #HWT1 #V #IHT2 lapply (IHT2 T1 ?) //
96 #HVT1 lapply (csn_fwd_pair_sn … HVT1) -HVT1
97 /3 width=3 by csn_appl_beta_aux/ qed.
99 fact csn_appl_theta_aux: ∀h,g,a,L,U. ⦃h, L⦄ ⊢ ⬊*[g] U → ∀V1,V2. ⇧[0, 1] V1 ≡ V2 →
100 ∀V,T. U = ⓓ{a}V.ⓐV2.T → ⦃h, L⦄ ⊢ ⬊*[g] ⓐV1.ⓓ{a}V.T.
101 #h #g #a #L #X #H @(csn_ind_alt … H) -X #X #HVT #IHVT #V1 #V2 #HV12 #V #T #H destruct
102 lapply (csn_fwd_pair_sn … HVT) #HV
103 lapply (csn_fwd_bind_dx … HVT) -HVT #HVT
105 elim (cpx_inv_appl1 … HL) -HL *
106 [ -HV #V0 #Y #HLV10 #HL #H0 destruct
107 elim (cpx_inv_abbr1 … HL) -HL *
108 [ #V3 #T3 #HV3 #HLT3 #H0 destruct
109 elim (lift_total V0 0 1) #V4 #HV04
110 elim (term_eq_dec (ⓓ{a}V.ⓐV2.T) (ⓓ{a}V3.ⓐV4.T3))
112 elim (eq_false_inv_tpair_sn … H) -H
113 [ -HLV10 -HV3 -HLT3 -HVT
114 >(lift_inj … HV12 … HV04) -V4
119 lapply (cpx_lift … HLV10 (L. ⓓV) … HV12 … HV04) -HLV10 -HV12 /2 width=1/ #HV24
120 @(IHVT … H … HV04) -IHVT // -H -HV04 /4 width=1/
122 | -H -IHVT #T0 #HLT0 #HT0 #H0 destruct
123 lapply (csn_cpx_trans … HVT (ⓐV2.T0) ?) /2 width=1/ -T #HVT0
124 lapply (csn_inv_lift … L … 1 HVT0 ? ? ?) -HVT0 [ /2 width=4/ |2,3: skip | /2 width=1/ ] -V2 -T0 #HVY
125 @(csn_cpx_trans … HVY) /2 width=1/
127 | -HV -HV12 -HVT -IHVT -H #b #V0 #W0 #T0 #T1 #_ #_ #H destruct
128 | -IHVT -H #b #V0 #V3 #W0 #W1 #T0 #T1 #HLV10 #HV03 #HLW01 #HLT01 #H1 #H2 destruct
129 lapply (cpx_lift … HLV10 (L. ⓓW0) … HV12 … HV03) -HLV10 -HV12 -HV03 /2 width=1/ #HLV23
130 @csn_abbr /2 width=3 by csn_cpx_trans/ -HV
131 @(csn_lpx_conf … (L. ⓓW0)) /2 width=1/ -W1
132 @(csn_cpxs_trans … HVT) -HVT /3 width=1/
136 lemma csn_appl_theta: ∀h,g,a,V1,V2. ⇧[0, 1] V1 ≡ V2 →
137 ∀L,V,T. ⦃h, L⦄ ⊢ ⬊*[g] ⓓ{a}V.ⓐV2.T → ⦃h, L⦄ ⊢ ⬊*[g] ⓐV1.ⓓ{a}V.T.
138 /2 width=5 by csn_appl_theta_aux/ qed.
140 (* Basic_1: was just: sn3_appl_appl *)
141 lemma csn_appl_simple_tstc: ∀h,g,L,V. ⦃h, L⦄ ⊢ ⬊*[g] V → ∀T1. ⦃h, L⦄ ⊢ ⬊*[g] T1 →
142 (∀T2. ⦃h, L⦄ ⊢ T1 ➡*[g] T2 → (T1 ≃ T2 → ⊥) → ⦃h, L⦄ ⊢ ⬊*[g] ⓐV.T2) →
143 𝐒⦃T1⦄ → ⦃h, L⦄ ⊢ ⬊*[g] ⓐV.T1.
144 #h #g #L #V #H @(csn_ind … H) -V #V #_ #IHV #T1 #H @(csn_ind … H) -T1 #T1 #H1T1 #IHT1 #H2T1 #H3T1
146 elim (cpx_inv_appl1_simple … HL ?) -HL //
147 #V0 #T0 #HLV0 #HLT10 #H0 destruct
148 elim (eq_false_inv_tpair_sn … H) -H
150 @(csn_cpx_trans … (ⓐV0.T1)) /2 width=1/ -HLT10
151 @IHV -IHV // -H1T1 -H3T1 /2 width=1/ -HV0
153 @(csn_cpx_trans … (ⓐV.T2)) /2 width=1/ -HLV0
154 @H2T1 -H2T1 // -HLT12 /2 width=1/
155 | -IHV -H1T1 -HLV0 * #H #H1T10 destruct
156 elim (tstc_dec T1 T0) #H2T10
157 [ @IHT1 -IHT1 // /2 width=1/ -H1T10 /2 width=3/ -H3T1
159 @H2T1 -H2T1 /2 width=3/ -HLT10 -HLT02 /3 width=3/
161 @H2T1 -H2T1 /2 width=1/