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/csx_alt.ma".
18 include "basic_2/computation/csx_lift.ma".
20 (* CONTEXT-SENSITIVE EXTENDED STRONGLY NORMALIZING TERMS ********************)
22 (* Advanced properties ******************************************************)
24 lemma csx_llpx_conf: ∀h,g,G,L1,T. ⦃G, L1⦄ ⊢ ⬊*[h, g] T →
25 ∀L2. ⦃G, L1⦄ ⊢ ➡[h, g, T, 0] L2 → ⦃G, L2⦄ ⊢ ⬊*[h, g] T.
26 #h #g #G #L1 #T #H @(csx_ind_alt … H) -T
27 /5 width=3 by csx_intro_cpxs, cpxs_llpx_trans, cpxs_llpx_conf/ (* 2 cpxs_llpx_trans *)
30 lemma csx_abst: ∀h,g,a,G,L,W. ⦃G, L⦄ ⊢ ⬊*[h, g] W →
31 ∀T. ⦃G, L.ⓛW⦄ ⊢ ⬊*[h, g] T → ⦃G, L⦄ ⊢ ⬊*[h, g] ⓛ{a}W.T.
32 #h #g #a #G #L #W #HW @(csx_ind … HW) -W #W #_ #IHW #T #HT @(csx_ind … HT) -T #T #HT #IHT
34 elim (cpx_inv_abst1 … H1) -H1
35 #W0 #T0 #HLW0 #HLT0 #H destruct
36 elim (eq_false_inv_tpair_sn … H2) -H2
37 [ -IHT #H lapply (csx_cpx_trans … HLT0) // -HT
38 #HT0 lapply (csx_llpx_conf … HT0 (L.ⓛW0)) -HT0
39 /4 width=4 by llpx_bind_repl_O/
40 | -IHW -HLW0 -HT * #H destruct /3 width=1 by/
44 lemma csx_abbr: ∀h,g,a,G,L,V. ⦃G, L⦄ ⊢ ⬊*[h, g] V →
45 ∀T. ⦃G, L.ⓓV⦄ ⊢ ⬊*[h, g] T → ⦃G, L⦄ ⊢ ⬊*[h, g] ⓓ{a}V. T.
46 #h #g #a #G #L #V #HV elim HV -V #V #_ #IHV #T #HT @(csx_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 [ /4 width=9 by csx_cpx_trans, csx_llpx_conf, llpx_bind_repl_O/
52 | -IHV -HLV1 * #H destruct /3 width=1 by cpx_cpxs/
55 /3 width=8 by csx_cpx_trans, csx_inv_lift, ldrop_drop/
59 fact csx_appl_beta_aux: ∀h,g,a,G,L,U1. ⦃G, L⦄ ⊢ ⬊*[h, g] U1 →
60 ∀V,W,T1. U1 = ⓓ{a}ⓝW.V.T1 → ⦃G, L⦄ ⊢ ⬊*[h, g] ⓐV.ⓛ{a}W.T1.
61 #h #g #a #G #L #X #H @(csx_ind … H) -X
62 #X #HT1 #IHT1 #V #W #T1 #H1 destruct
64 elim (cpx_inv_appl1 … H1) -H1 *
65 [ -HT1 #V0 #Y #HLV0 #H #H0 destruct
66 elim (cpx_inv_abst1 … H) -H #W0 #T0 #HLW0 #HLT0 #H destruct
67 @IHT1 -IHT1 [4: // | skip |3: #H destruct /2 width=1 by/ ] -H2
68 lapply (lsubr_cpx_trans … HLT0 (L.ⓓⓝW.V) ?) -HLT0 /3 width=1 by cpx_bind, cpx_flat, lsubr_abst/
69 | -IHT1 -H2 #b #V0 #W0 #W2 #T0 #T2 #HLV0 #HLW02 #HLT02 #H1 #H3 destruct
70 lapply (lsubr_cpx_trans … HLT02 (L.ⓓⓝW0.V) ?) -HLT02
71 /4 width=5 by csx_cpx_trans, cpx_bind, cpx_flat, lsubr_abst/
72 | -HT1 -IHT1 -H2 #b #V0 #V1 #W0 #W1 #T0 #T3 #_ #_ #_ #_ #H destruct
76 (* Basic_1: was just: sn3_beta *)
77 lemma csx_appl_beta: ∀h,g,a,G,L,V,W,T. ⦃G, L⦄ ⊢ ⬊*[h, g] ⓓ{a}ⓝW.V.T → ⦃G, L⦄ ⊢ ⬊*[h, g] ⓐV.ⓛ{a}W.T.
78 /2 width=3 by csx_appl_beta_aux/ qed.
80 fact csx_appl_theta_aux: ∀h,g,a,G,L,U. ⦃G, L⦄ ⊢ ⬊*[h, g] U → ∀V1,V2. ⇧[0, 1] V1 ≡ V2 →
81 ∀V,T. U = ⓓ{a}V.ⓐV2.T → ⦃G, L⦄ ⊢ ⬊*[h, g] ⓐV1.ⓓ{a}V.T.
82 #h #g #a #G #L #X #H @(csx_ind_alt … H) -X #X #HVT #IHVT #V1 #V2 #HV12 #V #T #H destruct
83 lapply (csx_fwd_pair_sn … HVT) #HV
84 lapply (csx_fwd_bind_dx … HVT) -HVT #HVT
86 elim (cpx_inv_appl1 … HL) -HL *
87 [ -HV #V0 #Y #HLV10 #HL #H0 destruct
88 elim (cpx_inv_abbr1 … HL) -HL *
89 [ #V3 #T3 #HV3 #HLT3 #H0 destruct
90 elim (lift_total V0 0 1) #V4 #HV04
91 elim (eq_term_dec (ⓓ{a}V.ⓐV2.T) (ⓓ{a}V3.ⓐV4.T3))
93 elim (eq_false_inv_tpair_sn … H) -H
94 [ -HLV10 -HV3 -HLT3 -HVT
95 >(lift_inj … HV12 … HV04) -V4
100 lapply (cpx_lift … HLV10 (L.ⓓV) (Ⓣ) … HV12 … HV04) -HLV10 -HV12 /2 width=1 by ldrop_drop/ #HV24
101 @(IHVT … H … HV04) -IHVT /4 width=1 by cpx_cpxs, cpx_bind, cpx_flat/
103 | -H -IHVT #T0 #HLT0 #HT0 #H0 destruct
104 lapply (csx_cpx_trans … HVT (ⓐV2.T0) ?) /2 width=1 by cpx_flat/ -T #HVT0
105 lapply (csx_inv_lift … L … (Ⓣ) … 1 HVT0 ? ? ?) -HVT0
106 /3 width=5 by csx_cpx_trans, cpx_pair_sn, ldrop_drop, lift_flat/
108 | -HV -HV12 -HVT -IHVT -H #b #V0 #W0 #W1 #T0 #T1 #_ #_ #_ #H destruct
109 | -IHVT -H #b #V0 #V3 #W0 #W1 #T0 #T1 #HLV10 #HV03 #HLW01 #HLT01 #H1 #H2 destruct
110 lapply (cpx_lift … HLV10 (L. ⓓW0) … HV12 … HV03) -HLV10 -HV12 -HV03 /2 width=2 by ldrop_drop/ #HLV23
111 @csx_abbr /2 width=3 by csx_cpx_trans/ -HV
112 @(csx_llpx_conf … (L.ⓓW0)) /2 width=4 by llpx_bind_repl_O/ -W1
113 /4 width=5 by csx_cpxs_trans, cpx_cpxs, cpx_flat/
117 lemma csx_appl_theta: ∀h,g,a,V1,V2. ⇧[0, 1] V1 ≡ V2 →
118 ∀G,L,V,T. ⦃G, L⦄ ⊢ ⬊*[h, g] ⓓ{a}V.ⓐV2.T → ⦃G, L⦄ ⊢ ⬊*[h, g] ⓐV1.ⓓ{a}V.T.
119 /2 width=5 by csx_appl_theta_aux/ qed.
121 (* Basic_1: was just: sn3_appl_appl *)
122 lemma csx_appl_simple_tstc: ∀h,g,G,L,V. ⦃G, L⦄ ⊢ ⬊*[h, g] V → ∀T1. ⦃G, L⦄ ⊢ ⬊*[h, g] T1 →
123 (∀T2. ⦃G, L⦄ ⊢ T1 ➡*[h, g] T2 → (T1 ≃ T2 → ⊥) → ⦃G, L⦄ ⊢ ⬊*[h, g] ⓐV.T2) →
124 𝐒⦃T1⦄ → ⦃G, L⦄ ⊢ ⬊*[h, g] ⓐV.T1.
125 #h #g #G #L #V #H @(csx_ind … H) -V #V #_ #IHV #T1 #H @(csx_ind … H) -T1 #T1 #H1T1 #IHT1 #H2T1 #H3T1
127 elim (cpx_inv_appl1_simple … HL) -HL //
128 #V0 #T0 #HLV0 #HLT10 #H0 destruct
129 elim (eq_false_inv_tpair_sn … H) -H
131 @(csx_cpx_trans … (ⓐV0.T1)) /2 width=1 by cpx_flat/ -HLT10
132 @IHV -IHV /4 width=3 by csx_cpx_trans, cpx_pair_sn/
133 | -IHV -H1T1 -HLV0 * #H #H1T10 destruct
134 elim (tstc_dec T1 T0) #H2T10
135 [ @IHT1 -IHT1 /4 width=3 by cpxs_strap2, cpxs_strap1, tstc_canc_sn, simple_tstc_repl_dx/
136 | -IHT1 -H3T1 -H1T10 /3 width=1 by cpx_cpxs/