]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambda_delta/Basic_2/computation/csn_lcpr.ma
- more properties on strongly normalizing terms ...
[helm.git] / matita / matita / contribs / lambda_delta / Basic_2 / computation / csn_lcpr.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/reducibility/lcpr_cpr.ma".
17 include "Basic_2/computation/cprs_cprs.ma".
18 include "Basic_2/computation/csn_lift.ma".
19 include "Basic_2/computation/csn_cpr.ma".
20 include "Basic_2/computation/csn_cprs.ma".
21
22 (* CONTEXT-SENSITIVE STRONGLY NORMALIZING TERMS *****************************)
23
24 (* Advanced properties ******************************************************)
25
26 lemma csn_lcpr_conf: ∀L1,L2. L1 ⊢ ➡ L2 → ∀T. L1 ⊢ ⬇* T → L2 ⊢ ⬇* T.
27 #L1 #L2 #HL12 #T #H @(csn_ind_cprs … H) -T #T #_ #IHT
28 @csn_intro #T0 #HLT0 #HT0
29 @IHT /2 width=2/ -IHT -HT0 /2 width=3/
30 qed.
31
32 lemma csn_abbr: ∀L,V. L ⊢ ⬇* V → ∀T. L. ⓓV ⊢ ⬇* T → L ⊢ ⬇* ⓓV. T.
33 #L #V #HV elim HV -V #V #_ #IHV #T #HT @(csn_ind_cprs … HT) -T #T #HT #IHT
34 @csn_intro #X #H1 #H2
35 elim (cpr_inv_abbr1 … H1) -H1 *
36 [ #V0 #V1 #T1 #HLV0 #HLV01 #HLT1 #H destruct
37   lapply (cpr_intro … HLV0 HLV01) -HLV01 #HLV1
38   lapply (ltpr_cpr_trans (L. ⓓV) … HLT1) /2 width=1/ -V0 #HLT1
39   elim (eq_false_inv_tpair_sn … H2) -H2
40   [ #HV1 @IHV // /2 width=1/ -HV1
41     @(csn_lcpr_conf (L. ⓓV)) /2 width=1/ -HLV1 /2 width=3/
42   | -IHV -HLV1 * #H destruct /3 width=1/
43   ]
44 | -IHV -IHT -H2 #T0 #HT0 #HLT0
45   lapply (csn_inv_lift … HT … HT0) -HT /2 width=3/
46 ]
47 qed.
48
49 fact csn_appl_beta_aux: ∀L,W. L ⊢ ⬇* W → ∀U. L ⊢ ⬇* U →
50                         ∀V,T. U = ⓓV. T → L ⊢ ⬇* ⓐV. ⓛW. T.
51 #L #W #H elim H -W #W #_ #IHW #X #H @(csn_ind_cprs … H) -X #X #HVT #IHVT #V #T #H destruct
52 lapply (csn_fwd_pair_sn … HVT) #HV
53 lapply (csn_fwd_bind_dx … HVT) #HT -HVT
54 @csn_intro #X #H #H2
55 elim (cpr_inv_appl1 … H) -H *
56 [ #V0 #Y #HLV0 #H #H0 destruct
57   elim (cpr_inv_abst1 … H Abbr V) -H #W0 #T0 #HLW0 #HLT0 #H destruct
58   elim (eq_false_inv_beta … H2) -H2
59   [ -IHVT #HW0 @IHW -IHW [1,5: // |3: skip ] -HLW0 /2 width=1/ -HW0
60     @csn_abbr /2 width=3/ -HV
61     @(csn_lcpr_conf (L. ⓓV)) /2 width=1/ -V0 /2 width=3/
62   | -IHW -HLW0 -HV -HT * #H #HVT0 destruct
63     @(IHVT … HVT0) -IHVT -HVT0 // /2 width=1/
64   ]
65 | -IHW -IHVT -H2 #V0 #W0 #T0 #T1 #HLV0 #HLT01 #H1 #H2 destruct
66   lapply (lcpr_cpr_trans (L. ⓓV) … HLT01) -HLT01 /2 width=1/ #HLT01
67   @csn_abbr /2 width=3/ -HV
68   @(csn_lcpr_conf (L. ⓓV)) /2 width=1/ -V0 /2 width=3/
69 | -IHW -IHVT -HV -HT -H2 #V0 #V1 #W0 #W1 #T0 #T1 #_ #_ #_ #_ #H destruct
70 ]
71 qed.
72
73 (* Basic_1: was: sn3_beta *)
74 lemma csn_appl_beta: ∀L,W. L ⊢ ⬇* W → ∀V,T. L ⊢ ⬇* (ⓓV. T) → (**)
75                      L ⊢ ⬇* ⓐV. ⓛW. T.
76 /2 width=3/ qed.
77
78 fact csn_appl_theta_aux: ∀L,U. L ⊢ ⬇* U → ∀V1,V2. ⇧[0, 1] V1 ≡ V2 →
79                          ∀V,T. U = ⓓV. ⓐV2. T → L ⊢ ⬇* ⓐV1. ⓓV. T.
80 #L #X #H @(csn_ind_cprs … H) -X #X #HVT #IHVT #V1 #V2 #HV12 #V #T #H destruct
81 lapply (csn_fwd_pair_sn … HVT) #HV
82 lapply (csn_fwd_bind_dx … HVT) -HVT #HVT
83 @csn_intro #X #HL #H
84 elim (cpr_inv_appl1 … HL) -HL *
85 [ -HV #V0 #Y #HLV10 #HL #H0 destruct
86   elim (cpr_inv_abbr1 … HL) -HL *
87   [ #V3 #V4 #T3 #HV3 #HLV34 #HLT3 #H0 destruct
88     lapply (cpr_intro … HV3 HLV34) -HLV34 #HLV34
89     elim (lift_total V0 0 1) #V5 #HV05
90     elim (term_eq_dec (ⓓV.ⓐV2.T) (ⓓV4.ⓐV5.T3))
91     [ -IHVT #H0 destruct
92       elim (eq_false_inv_tpair_sn … H) -H
93       [ -HLV10 -HLV34 -HV3 -HLT3 -HVT
94         >(lift_inj … HV12 … HV05) -V5
95         #H elim (H ?) //
96       | * #_ #H elim (H ?) //
97       ]
98     | -H -HVT #H
99       lapply (cpr_lift (L. ⓓV) … HV12 … HV05 HLV10) -HLV10 -HV12 /2 width=1/ #HV25
100       lapply (ltpr_cpr_trans (L. ⓓV) … HLT3) /2 width=1/ -HLT3 #HLT3
101       @(IHVT … H … HV05) -IHVT // -H -HV05 /3 width=1/
102     ]
103   | -H -IHVT #T0 #HT0 #HLT0
104     @(csn_cpr_trans … (ⓐV1.T0)) /2 width=1/ -V0 -Y
105     @(csn_inv_lift … 0 1 HVT) /2 width=1/
106   ]
107 | -HV -HV12 -HVT -IHVT -H #V0 #W0 #T0 #T1 #_ #_ #H destruct
108 | -IHVT -H #V0 #V3 #W0 #W1 #T0 #T1 #HLV10 #HLW01 #HLT01 #HV03 #H1 #H2 destruct
109   lapply (cpr_lift (L. ⓓW0) … HV12 … HV03 HLV10) -HLV10 -HV12 -HV03 /2 width=1/ #HLV23
110   lapply (lcpr_cpr_trans (L. ⓓW0) … HLT01) -HLT01 /2 width=1/ #HLT01
111   @csn_abbr /2 width=3/ -HV
112   @(csn_lcpr_conf (L. ⓓW0)) /2 width=1/ -W1
113   @(csn_cprs_trans … HVT) -HVT /2 width=1/
114 ]
115 qed.
116
117 (* Basic_1: was: sn3_appl_bind *)
118 lemma csn_appl_theta: ∀V1,V2. ⇧[0, 1] V1 ≡ V2 →
119                       ∀L,V,T. L ⊢ ⬇* ⓓV. ⓐV2. T → L ⊢ ⬇* ⓐV1. ⓓV. T.
120 /2 width=5/ qed.
121
122 (* Basic_1: was only: sn3_appl_appl *)
123 lemma csn_appl_simple_tstc: ∀L,V. L ⊢ ⬇* V → ∀T1.
124                             L ⊢ ⬇* T1 →
125                             (∀T2. L ⊢ T1 ➡* T2 → (T1 ≃ T2 → False) → L ⊢ ⬇* ⓐV. T2) →
126                             𝐒[T1] → L ⊢ ⬇* ⓐV. T1.
127 #L #V #H @(csn_ind … H) -V #V #_ #IHV #T1 #H @(csn_ind … H) -T1 #T1 #H1T1 #IHT1 #H2T1 #H3T1
128 @csn_intro #X #HL #H
129 elim (cpr_inv_appl1_simple … HL ?) -HL //
130 #V0 #T0 #HLV0 #HLT10 #H0 destruct
131 elim (eq_false_inv_tpair_sn … H) -H
132 [ -IHT1 #HV0
133   @(csn_cpr_trans … (ⓐV0.T1)) /2 width=1/ -HLT10
134   @IHV -IHV // -H1T1 -H3T1 /2 width=1/ -HV0
135   #T2 #HLT12 #HT12
136   @(csn_cpr_trans … (ⓐV.T2)) /2 width=1/ -HLV0
137   @H2T1 -H2T1 // -HLT12 /2 width=1/
138 | -IHV -H1T1 -HLV0 * #H #H1T10 destruct
139   elim (tstc_dec T1 T0) #H2T10
140   [ @IHT1 -IHT1 // /2 width=1/ -H1T10 /2 width=3/ -H3T1
141     #T2 #HLT02 #HT02
142     @H2T1 -H2T1 /2 width=3/ -HLT10 -HLT02 /3 width=3/
143   | -IHT1 -H3T1 -H1T10
144     @H2T1 -H2T1 /2 width=1/
145   ]
146 ]
147 qed.