]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/computation/csn_lpr.ma
update in basic_2
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / computation / csn_lpr.ma
1 (**************************************************************************)
2 (*       ___                                                              *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||         The HELM team.                                      *)
8 (*      ||A||         http://helm.cs.unibo.it                             *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU General Public License Version 2                  *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 include "basic_2/grammar/tstc_tstc.ma".
16 include "basic_2/computation/cprs_cprs.ma".
17 include "basic_2/computation/csn_alt.ma".
18 include "basic_2/computation/csn_lift.ma".
19
20 (* CONTEXT-SENSITIVE STRONGLY NORMALIZING TERMS *****************************)
21
22 (* Advanced properties ******************************************************)
23
24 lemma csn_lpr_conf: ∀L1,L2. L1 ⊢ ➡ L2 → ∀T. L1 ⊢ ⬊* T → L2 ⊢ ⬊* T.
25 #L1 #L2 #HL12 #T #H @(csn_ind_alt … H) -T #T #_ #IHT
26 @csn_intro #T0 #HLT0 #HT0
27 @IHT /2 width=2/ -IHT -HT0 /2 width=3 by lpr_cpr_trans/
28 qed.
29
30 lemma csn_abbr: ∀a,L,V. L ⊢ ⬊* V → ∀T. L. ⓓV ⊢ ⬊* T → L ⊢ ⬊* ⓓ{a}V. T.
31 #a #L #V #HV elim HV -V #V #_ #IHV #T #HT @(csn_ind_alt … HT) -T #T #HT #IHT
32 @csn_intro #X #H1 #H2
33 elim (cpr_inv_abbr1 … H1) -H1 *
34 [ #V1 #T1 #HLV1 #HLT1 #H destruct
35   elim (eq_false_inv_tpair_sn … H2) -H2
36   [ #HV1 @IHV // /2 width=1/ -HV1
37     @(csn_lpr_conf (L. ⓓV)) /2 width=1/ -HLV1 /2 width=3 by csn_cpr_trans/
38   | -IHV -HLV1 * #H destruct /3 width=1/
39   ]
40 | -IHV -IHT -H2 #T0 #HLT0 #HT0
41   lapply (csn_cpr_trans … HT … HLT0) -T #HLT0
42   lapply (csn_inv_lift … HLT0 … HT0) -T0 /2 width=3/
43 ]
44 qed.
45
46 fact csn_appl_beta_aux: ∀a,L,W. L ⊢ ⬊* W → ∀U. L ⊢ ⬊* U →
47                         ∀V,T. U = ⓓ{a}V. T → L ⊢ ⬊* ⓐV. ⓛ{a}W. T.
48 #a #L #W #H elim H -W #W #_ #IHW #X #H @(csn_ind_alt … H) -X #X #HVT #IHVT #V #T #H destruct
49 lapply (csn_fwd_pair_sn … HVT) #HV
50 lapply (csn_fwd_bind_dx … HVT) #HT -HVT
51 @csn_intro #X #H #H2
52 elim (cpr_inv_appl1 … H) -H *
53 [ #V0 #Y #HLV0 #H #H0 destruct
54   elim (cpr_fwd_abst1 … H Abbr V) -H #W0 #T0 #HLW0 #HLT0 #H destruct
55   elim (eq_false_inv_beta … H2) -H2
56   [ -IHVT #HW0 @IHW -IHW [1,5: // |3: skip ] -HLW0 /2 width=1/ -HW0
57     @csn_abbr /2 width=3 by csn_cpr_trans/ -HV
58     @(csn_lpr_conf (L.ⓓV)) /2 width=1/ -V0 /2 width=3 by csn_cpr_trans/
59   | -IHW -HLW0 -HV -HT * #H #HVT0 destruct
60     @(IHVT … HVT0) -IHVT -HVT0 // /3 width=1/
61   ]
62 | -IHW -IHVT -H2 #b #V0 #W0 #T0 #T1 #HLV0 #HLT01 #H1 #H2 destruct
63   lapply (cpr_lsubr_trans … HLT01 (L.ⓓV) ?) -HLT01 /2 width=1/ #HLT01
64   @csn_abbr /2 width=3 by csn_cpr_trans/ -HV
65   @(csn_lpr_conf (L. ⓓV)) /2 width=1/ -V0 /2 width=3 by csn_cpr_trans/
66 | -IHW -IHVT -HV -HT -H2 #b #V0 #V1 #W0 #W1 #T0 #T1 #_ #_ #_ #_ #H destruct
67 ]
68 qed-.
69
70 (* Basic_1: was: sn3_beta *)
71 lemma csn_appl_beta: ∀a,L,W. L ⊢ ⬊* W → ∀V,T. L ⊢ ⬊* ⓓ{a}V. T →
72                      L ⊢ ⬊* ⓐV. ⓛ{a}W. T.
73 /2 width=3 by csn_appl_beta_aux/ qed.
74
75 fact csn_appl_theta_aux: ∀a,L,U. L ⊢ ⬊* U → ∀V1,V2. ⇧[0, 1] V1 ≡ V2 →
76                          ∀V,T. U = ⓓ{a}V. ⓐV2. T → L ⊢ ⬊* ⓐV1. ⓓ{a}V. T.
77 #a #L #X #H @(csn_ind_alt … H) -X #X #HVT #IHVT #V1 #V2 #HV12 #V #T #H destruct
78 lapply (csn_fwd_pair_sn … HVT) #HV
79 lapply (csn_fwd_bind_dx … HVT) -HVT #HVT
80 @csn_intro #X #HL #H
81 elim (cpr_inv_appl1 … HL) -HL *
82 [ -HV #V0 #Y #HLV10 #HL #H0 destruct
83   elim (cpr_inv_abbr1 … HL) -HL *
84   [ #V3 #T3 #HV3 #HLT3 #H0 destruct
85     elim (lift_total V0 0 1) #V4 #HV04
86     elim (term_eq_dec (ⓓ{a}V.ⓐV2.T) (ⓓ{a}V3.ⓐV4.T3))
87     [ -IHVT #H0 destruct
88       elim (eq_false_inv_tpair_sn … H) -H
89       [ -HLV10 -HV3 -HLT3 -HVT
90         >(lift_inj … HV12 … HV04) -V4
91         #H elim H //
92       | * #_ #H elim H //
93       ]
94     | -H -HVT #H
95       lapply (cpr_lift … HLV10 (L. ⓓV) … HV12 … HV04) -HLV10 -HV12 /2 width=1/ #HV24
96       @(IHVT … H … HV04) -IHVT // -H -HV04 /4 width=1/
97     ]
98   | -H -IHVT #T0 #HLT0 #HT0 #H0 destruct
99     lapply (csn_cpr_trans … HVT (ⓐV2.T0) ?) /2 width=1/ -T #HVT0
100     lapply (csn_inv_lift L … 1 HVT0 ? ? ?) -HVT0 [ /2 width=4/ |2,3: skip | /2 width=1/ ] -V2 -T0 #HVY
101     @(csn_cpr_trans … HVY) /2 width=1/
102   ]
103 | -HV -HV12 -HVT -IHVT -H #b #V0 #W0 #T0 #T1 #_ #_ #H destruct
104 | -IHVT -H #b #V0 #V3 #W0 #W1 #T0 #T1 #HLV10 #HV03 #HLW01 #HLT01 #H1 #H2 destruct
105   lapply (cpr_lift … HLV10 (L. ⓓW0) … HV12 … HV03) -HLV10 -HV12 -HV03 /2 width=1/ #HLV23
106   @csn_abbr /2 width=3 by csn_cpr_trans/ -HV
107   @(csn_lpr_conf (L. ⓓW0)) /2 width=1/ -W1
108   @(csn_cprs_trans … HVT) -HVT /3 width=1/
109 ]
110 qed-.
111
112 lemma csn_appl_theta: ∀a,V1,V2. ⇧[0, 1] V1 ≡ V2 →
113                       ∀L,V,T. L ⊢ ⬊* ⓓ{a}V. ⓐV2. T → L ⊢ ⬊* ⓐV1. ⓓ{a}V. T.
114 /2 width=5 by csn_appl_theta_aux/ qed.
115
116 (* Basic_1: was only: sn3_appl_appl *)
117 lemma csn_appl_simple_tstc: ∀L,V. L ⊢ ⬊* V → ∀T1.
118                             L ⊢ ⬊* T1 →
119                             (∀T2. L ⊢ T1 ➡* T2 → (T1 ≃ T2 → ⊥) → L ⊢ ⬊* ⓐV. T2) →
120                             𝐒⦃T1⦄ → L ⊢ ⬊* ⓐV. T1.
121 #L #V #H @(csn_ind … H) -V #V #_ #IHV #T1 #H @(csn_ind … H) -T1 #T1 #H1T1 #IHT1 #H2T1 #H3T1
122 @csn_intro #X #HL #H
123 elim (cpr_inv_appl1_simple … HL ?) -HL //
124 #V0 #T0 #HLV0 #HLT10 #H0 destruct
125 elim (eq_false_inv_tpair_sn … H) -H
126 [ -IHT1 #HV0
127   @(csn_cpr_trans … (ⓐV0.T1)) /2 width=1/ -HLT10
128   @IHV -IHV // -H1T1 -H3T1 /2 width=1/ -HV0
129   #T2 #HLT12 #HT12
130   @(csn_cpr_trans … (ⓐV.T2)) /2 width=1/ -HLV0
131   @H2T1 -H2T1 // -HLT12 /2 width=1/
132 | -IHV -H1T1 -HLV0 * #H #H1T10 destruct
133   elim (tstc_dec T1 T0) #H2T10
134   [ @IHT1 -IHT1 // /2 width=1/ -H1T10 /2 width=3/ -H3T1
135     #T2 #HLT02 #HT02
136     @H2T1 -H2T1 /2 width=3/ -HLT10 -HLT02 /3 width=3/
137   | -IHT1 -H3T1 -H1T10
138     @H2T1 -H2T1 /2 width=1/
139   ]
140 ]
141 qed.