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/computation/cpxs_cpxs.ma".
16 include "basic_2/computation/csx_alt.ma".
17 include "basic_2/computation/csx_lift.ma".
19 (* CONTEXT-SENSITIVE EXTENDED STRONGLY NORMALIZING TERMS ********************)
21 (* Advanced properties ******************************************************)
23 lemma csx_lpx_conf: ∀h,o,G,L1,L2. ⦃G, L1⦄ ⊢ ➡[h, o] L2 →
24 ∀T. ⦃G, L1⦄ ⊢ ⬊*[h, o] T → ⦃G, L2⦄ ⊢ ⬊*[h, o] T.
25 #h #o #G #L1 #L2 #HL12 #T #H @(csx_ind_alt … H) -T
26 /4 width=3 by csx_intro, lpx_cpx_trans/
29 lemma csx_abst: ∀h,o,a,G,L,W. ⦃G, L⦄ ⊢ ⬊*[h, o] W →
30 ∀T. ⦃G, L.ⓛW⦄ ⊢ ⬊*[h, o] T → ⦃G, L⦄ ⊢ ⬊*[h, o] ⓛ{a}W.T.
31 #h #o #a #G #L #W #HW @(csx_ind … HW) -W #W #_ #IHW #T #HT @(csx_ind … HT) -T #T #HT #IHT
33 elim (cpx_inv_abst1 … H1) -H1
34 #W0 #T0 #HLW0 #HLT0 #H destruct
35 elim (eq_false_inv_tpair_sn … H2) -H2
36 [ -IHT #H lapply (csx_cpx_trans … HLT0) // -HT
37 #HT0 lapply (csx_lpx_conf … (L.ⓛW0) … HT0) -HT0 /3 width=1 by lpx_pair/
38 | -IHW -HLW0 -HT * #H destruct /3 width=1 by/
42 lemma csx_abbr: ∀h,o,a,G,L,V. ⦃G, L⦄ ⊢ ⬊*[h, o] V →
43 ∀T. ⦃G, L.ⓓV⦄ ⊢ ⬊*[h, o] T → ⦃G, L⦄ ⊢ ⬊*[h, o] ⓓ{a}V. T.
44 #h #o #a #G #L #V #HV elim HV -V #V #_ #IHV #T #HT @(csx_ind_alt … HT) -T #T #HT #IHT
46 elim (cpx_inv_abbr1 … H1) -H1 *
47 [ #V1 #T1 #HLV1 #HLT1 #H destruct
48 elim (eq_false_inv_tpair_sn … H2) -H2
49 [ /4 width=5 by csx_cpx_trans, csx_lpx_conf, lpx_pair/
50 | -IHV -HLV1 * #H destruct /3 width=1 by cpx_cpxs/
53 /3 width=8 by csx_cpx_trans, csx_inv_lift, drop_drop/
57 fact csx_appl_beta_aux: ∀h,o,a,G,L,U1. ⦃G, L⦄ ⊢ ⬊*[h, o] U1 →
58 ∀V,W,T1. U1 = ⓓ{a}ⓝW.V.T1 → ⦃G, L⦄ ⊢ ⬊*[h, o] ⓐV.ⓛ{a}W.T1.
59 #h #o #a #G #L #X #H @(csx_ind … H) -X
60 #X #HT1 #IHT1 #V #W #T1 #H1 destruct
62 elim (cpx_inv_appl1 … H1) -H1 *
63 [ -HT1 #V0 #Y #HLV0 #H #H0 destruct
64 elim (cpx_inv_abst1 … H) -H #W0 #T0 #HLW0 #HLT0 #H destruct
65 @IHT1 -IHT1 [4: // | skip |3: #H destruct /2 width=1 by/ ] -H2
66 lapply (lsubr_cpx_trans … HLT0 (L.ⓓⓝW.V) ?) -HLT0 /3 width=1 by cpx_bind, cpx_flat, lsubr_beta/
67 | -IHT1 -H2 #b #V0 #W0 #W2 #T0 #T2 #HLV0 #HLW02 #HLT02 #H1 #H3 destruct
68 lapply (lsubr_cpx_trans … HLT02 (L.ⓓⓝW0.V) ?) -HLT02
69 /4 width=5 by csx_cpx_trans, cpx_bind, cpx_flat, lsubr_beta/
70 | -HT1 -IHT1 -H2 #b #V0 #V1 #W0 #W1 #T0 #T3 #_ #_ #_ #_ #H destruct
74 (* Basic_1: was just: sn3_beta *)
75 lemma csx_appl_beta: ∀h,o,a,G,L,V,W,T. ⦃G, L⦄ ⊢ ⬊*[h, o] ⓓ{a}ⓝW.V.T → ⦃G, L⦄ ⊢ ⬊*[h, o] ⓐV.ⓛ{a}W.T.
76 /2 width=3 by csx_appl_beta_aux/ qed.
78 fact csx_appl_theta_aux: ∀h,o,a,G,L,U. ⦃G, L⦄ ⊢ ⬊*[h, o] U → ∀V1,V2. ⬆[0, 1] V1 ≡ V2 →
79 ∀V,T. U = ⓓ{a}V.ⓐV2.T → ⦃G, L⦄ ⊢ ⬊*[h, o] ⓐV1.ⓓ{a}V.T.
80 #h #o #a #G #L #X #H @(csx_ind_alt … H) -X #X #HVT #IHVT #V1 #V2 #HV12 #V #T #H destruct
81 lapply (csx_fwd_pair_sn … HVT) #HV
82 lapply (csx_fwd_bind_dx … HVT) -HVT #HVT
84 elim (cpx_inv_appl1 … HL) -HL *
85 [ -HV #V0 #Y #HLV10 #HL #H0 destruct
86 elim (cpx_inv_abbr1 … HL) -HL *
87 [ #V3 #T3 #HV3 #HLT3 #H0 destruct
88 elim (lift_total V0 0 1) #V4 #HV04
89 elim (eq_term_dec (ⓓ{a}V.ⓐV2.T) (ⓓ{a}V3.ⓐV4.T3))
91 elim (eq_false_inv_tpair_sn … H) -H
92 [ -HLV10 -HV3 -HLT3 -HVT
93 >(lift_inj … HV12 … HV04) -V4
98 lapply (cpx_lift … HLV10 (L.ⓓV) (Ⓕ) … HV12 … HV04) -HLV10 -HV12 /2 width=1 by drop_drop/ #HV24
99 @(IHVT … H … HV04) -IHVT /4 width=1 by cpx_cpxs, cpx_bind, cpx_flat/
101 | -H -IHVT #T0 #HLT0 #HT0 #H0 destruct
102 lapply (csx_cpx_trans … HVT (ⓐV2.T0) ?) /2 width=1 by cpx_flat/ -T #HVT0
103 lapply (csx_inv_lift … L … (Ⓕ) … 1 HVT0 ? ? ?) -HVT0
104 /3 width=5 by csx_cpx_trans, cpx_pair_sn, drop_drop, lift_flat/
106 | -HV -HV12 -HVT -IHVT -H #b #V0 #W0 #W1 #T0 #T1 #_ #_ #_ #H destruct
107 | -IHVT -H #b #V0 #V3 #W0 #W1 #T0 #T1 #HLV10 #HV03 #HLW01 #HLT01 #H1 #H2 destruct
108 lapply (cpx_lift … HLV10 (L. ⓓW0) … HV12 … HV03) -HLV10 -HV12 -HV03 /2 width=2 by drop_drop/ #HLV23
109 @csx_abbr /2 width=3 by csx_cpx_trans/ -HV
110 @(csx_lpx_conf … (L.ⓓW0)) /2 width=1 by lpx_pair/ -W1
111 /4 width=5 by csx_cpxs_trans, cpx_cpxs, cpx_flat/
115 lemma csx_appl_theta: ∀h,o,a,V1,V2. ⬆[0, 1] V1 ≡ V2 →
116 ∀G,L,V,T. ⦃G, L⦄ ⊢ ⬊*[h, o] ⓓ{a}V.ⓐV2.T → ⦃G, L⦄ ⊢ ⬊*[h, o] ⓐV1.ⓓ{a}V.T.
117 /2 width=5 by csx_appl_theta_aux/ qed.