]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambda_delta/basic_2/computation/cprs_cprs.ma
8f94b0fa7a9641c10abcbac0e4972984c1915494
[helm.git] / matita / matita / contribs / lambda_delta / basic_2 / computation / cprs_cprs.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/reducibility/cpr_lift.ma".
16 include "basic_2/reducibility/cpr_cpr.ma".
17 include "basic_2/reducibility/lfpr_cpr.ma".
18 include "basic_2/computation/cprs_lfpr.ma".
19
20 (* CONTEXT-SENSITIVE PARALLEL COMPUTATION ON TERMS **************************)
21
22 (* Advanced properties ******************************************************)
23
24 lemma cprs_abst_dx: ∀L,V1,V2. L ⊢ V1 ➡ V2 → ∀V,T1,T2.
25                     L.ⓛV ⊢ T1 ➡* T2 → ∀a. L ⊢ ⓛ{a}V1. T1 ➡* ⓛ{a}V2. T2.
26 #L #V1 #V2 #HV12 #V #T1 #T2 #HT12 #a @(cprs_ind … HT12) -T2
27 [ /3 width=2/
28 | /3 width=6 by cprs_strap1, cpr_abst/ (**) (* /3 width=6/ is too slow *)
29 ]
30 qed.
31
32 lemma cprs_abbr1_dx: ∀L,V1,V2. L ⊢ V1 ➡ V2 → ∀T1,T2. L. ⓓV1 ⊢ T1 ➡* T2 →
33                      ∀a. L ⊢ ⓓ{a}V1. T1 ➡* ⓓ{a}V2. T2.
34 #L #V1 #V2 #HV12 #T1 #T2 #HT12 #a @(cprs_ind_dx … HT12) -T1
35 [ /3 width=5/
36 | #T1 #T #HT1 #_ #IHT1
37   @(cprs_strap2 … IHT1) -IHT1 /2 width=1/
38 ]
39 qed.
40
41 lemma cpr_abbr1: ∀L,V1,V2. L ⊢ V1 ➡ V2 → ∀T1,T2. L. ⓓV1 ⊢ T1 ➡ T2 →
42                  ∀a. L ⊢ ⓓ{a}V1. T1 ➡* ⓓ{a}V2. T2.
43 /3 width=1/ qed.
44
45 lemma cpr_abbr2: ∀L,V1,V2. L ⊢ V1 ➡ V2 → ∀T1,T2. L. ⓓV2 ⊢ T1 ➡ T2 →
46                  ∀a. L ⊢ ⓓ{a}V1. T1 ➡* ⓓ{a}V2. T2.
47 #L #V1 #V2 #HV12 #T1 #T2 #HT12
48 lapply (lfpr_cpr_trans (L. ⓓV1) … HT12) /2 width=1/
49 qed.
50
51 (* Basic_1: was: pr3_strip *)
52 lemma cprs_strip: ∀L,T1,T. L ⊢ T ➡* T1 → ∀T2. L ⊢ T ➡ T2 →
53                   ∃∃T0. L ⊢ T1 ➡ T0 & L ⊢ T2 ➡* T0.
54 /3 width=3/ qed.
55
56 (* Advanced inversion lemmas ************************************************)
57
58 (* Basic_1: was pr3_gen_appl *)
59 lemma cprs_inv_appl1: ∀L,V1,T1,U2. L ⊢ ⓐV1. T1 ➡* U2 →
60                       ∨∨ ∃∃V2,T2.       L ⊢ V1 ➡* V2 & L ⊢ T1 ➡* T2 &
61                                         U2 = ⓐV2. T2
62                        | ∃∃a,V2,W,T.    L ⊢ V1 ➡* V2 &
63                                         L ⊢ T1 ➡* ⓛ{a}W. T & L ⊢ ⓓ{a}V2. T ➡* U2
64                        | ∃∃a,V0,V2,V,T. L ⊢ V1 ➡* V0 & ⇧[0,1] V0 ≡ V2 &
65                                         L ⊢ T1 ➡* ⓓ{a}V. T & L ⊢ ⓓ{a}V. ⓐV2. T ➡* U2.
66 #L #V1 #T1 #U2 #H @(cprs_ind … H) -U2 /3 width=5/
67 #U #U2 #_ #HU2 * *
68 [ #V0 #T0 #HV10 #HT10 #H destruct
69   elim (cpr_inv_appl1 … HU2) -HU2 *
70   [ #V2 #T2 #HV02 #HT02 #H destruct /4 width=5/
71   | #a #V2 #W2 #T #T2 #HV02 #HT2 #H1 #H2 destruct /4 width=7/
72   | #a #V #V2 #W0 #W2 #T #T2 #HV0 #HW02 #HT2 #HV2 #H1 #H2 destruct
73     @or3_intro2 @(ex4_5_intro … HV2 HT10) /2 width=3/ /3 width=1/ (**) (* explicit constructor. /5 width=8/ is too slow because TC_transitive gets in the way *) 
74   ]
75 | /4 width=9/
76 | /4 width=11/
77 ]
78 qed-.
79
80 (* Main propertis ***********************************************************)
81
82 (* Basic_1: was: pr3_confluence *)
83 theorem cprs_conf: ∀L,T1,T. L ⊢ T ➡* T1 → ∀T2. L ⊢ T ➡* T2 →
84                    ∃∃T0. L ⊢ T1 ➡* T0 & L ⊢ T2 ➡* T0.
85 /3 width=3/ qed.
86
87 (* Basic_1: was: pr3_t *)
88 theorem cprs_trans: ∀L,T1,T. L ⊢ T1 ➡* T → ∀T2. L ⊢ T ➡* T2 → L ⊢ T1 ➡* T2.
89 /2 width=3/ qed.
90
91 (* Basic_1: was: pr3_flat *)
92 lemma cprs_flat: ∀I,L,T1,T2. L ⊢ T1 ➡* T2 → ∀V1,V2. L ⊢ V1 ➡* V2 →
93                  L ⊢ ⓕ{I} V1. T1 ➡* ⓕ{I} V2. T2.
94 #I #L #T1 #T2 #HT12 #V1 #V2 #HV12 @(cprs_ind … HV12) -V2 /2 width=1/
95 #V #V2 #_ #HV2 #IHV1
96 @(cprs_trans … IHV1) -IHV1 /2 width=1/
97 qed.
98
99 lemma cprs_abst: ∀L,V1,V2. L ⊢ V1 ➡* V2 → ∀V,T1,T2.
100                  L.ⓛV ⊢ T1 ➡* T2 → ∀a. L ⊢ ⓛ{a}V1. T1 ➡* ⓛ{a}V2. T2.
101 #L #V1 #V2 #HV12 #V #T1 #T2 #HT12 #a @(cprs_ind … HV12) -V2
102 [ lapply (cprs_lsubs_trans … HT12 (L.ⓛV1) ?) -HT12 /2 width=2/
103 | #V0 #V2 #_ #HV02 #IHV01
104   @(cprs_trans … IHV01) -V1 /2 width=2/
105 ]
106 qed.
107
108 lemma cprs_abbr1: ∀L,V1,T1,T2. L. ⓓV1 ⊢ T1 ➡* T2 → ∀V2. L ⊢ V1 ➡* V2 →
109                   ∀a.L ⊢ ⓓ{a}V1. T1 ➡* ⓓ{a}V2. T2.
110 #L #V1 #T1 #T2 #HT12 #V2 #HV12 #a @(cprs_ind … HV12) -V2 /2 width=1/
111 #V #V2 #_ #HV2 #IHV1
112 @(cprs_trans … IHV1) -IHV1 /2 width=1/
113 qed.
114
115 lemma cprs_abbr2_dx: ∀L,V1,V2. L ⊢ V1 ➡ V2 → ∀T1,T2. L. ⓓV2 ⊢ T1 ➡* T2 →
116                      ∀a. L ⊢ ⓓ{a}V1. T1 ➡* ⓓ{a}V2. T2.
117 #L #V1 #V2 #HV12 #T1 #T2 #HT12 #a @(cprs_ind_dx … HT12) -T1
118 [ /2 width=1/
119 | #T1 #T #HT1 #_ #IHT1
120   lapply (lfpr_cpr_trans (L. ⓓV1) … HT1) -HT1 /2 width=1/ #HT1
121   @(cprs_trans … IHT1) -IHT1 /2 width=1/
122 ]
123 qed.
124
125 lemma cprs_abbr2: ∀L,V1,V2. L ⊢ V1 ➡* V2 → ∀T1,T2. L. ⓓV2 ⊢ T1 ➡* T2 →
126                   ∀a. L ⊢ ⓓ{a}V1. T1 ➡* ⓓ{a}V2. T2.
127 #L #V1 #V2 #HV12 @(cprs_ind … HV12) -V2 /2 width=1/
128 #V #V2 #_ #HV2 #IHV1 #T1 #T2 #HT12 #a
129 lapply (IHV1 T1 T1 ? a) -IHV1 // #HV1
130 @(cprs_trans … HV1) -HV1 /2 width=1/
131 qed.
132
133 lemma cprs_beta_dx: ∀L,V1,V2,W,T1,T2.
134                     L ⊢ V1 ➡ V2 → L.ⓛW ⊢ T1 ➡* T2 →
135                     ∀a.L ⊢ ⓐV1.ⓛ{a}W.T1 ➡* ⓓ{a}V2.T2.
136 #L #V1 #V2 #W #T1 #T2 #HV12 #HT12 #a @(cprs_ind … HT12) -T2
137 [ /3 width=1/
138 | -HV12 #T #T2 #_ #HT2 #IHT1
139   lapply (cpr_lsubs_trans … HT2 (L.ⓓV2) ?) -HT2 /2 width=1/ #HT2
140   @(cprs_trans … IHT1) -V1 -W -T1 /3 width=1/
141 ]
142 qed.
143
144 (* Basic_1: was only: pr3_pr2_pr3_t pr3_wcpr0_t *)
145 lemma lcpr_cprs_trans: ∀L1,L2. ⦃L1⦄ ➡ ⦃L2⦄ →
146                        ∀T1,T2. L2 ⊢ T1 ➡* T2 → L1 ⊢ T1 ➡* T2.
147 #L1 #L2 #HL12 #T1 #T2 #H @(cprs_ind … H) -T2 //
148 #T #T2 #_ #HT2 #IHT2
149 @(cprs_trans … IHT2) /2 width=3/
150 qed.