]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/rt_computation/cpxs.ma
severe bug found in parallel zeta
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / rt_computation / cpxs.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 "ground_2/lib/star.ma".
16 include "basic_2/notation/relations/predtystar_5.ma".
17 include "basic_2/rt_transition/cpx.ma".
18
19 (* UNBOUND CONTEXT-SENSITIVE PARALLEL RT-COMPUTATION FOR TERMS **************)
20
21 definition cpxs: sh → relation4 genv lenv term term ≝
22                  λh,G. CTC … (cpx h G).
23
24 interpretation "unbound context-sensitive parallel rt-computation (term)"
25    'PRedTyStar h G L T1 T2 = (cpxs h G L T1 T2).
26
27 (* Basic eliminators ********************************************************)
28
29 lemma cpxs_ind: ∀h,G,L,T1. ∀Q:predicate term. Q T1 →
30                 (∀T,T2. ⦃G, L⦄ ⊢ T1 ⬈*[h] T → ⦃G, L⦄ ⊢ T ⬈[h] T2 → Q T → Q T2) →
31                 ∀T2. ⦃G, L⦄ ⊢ T1 ⬈*[h] T2 → Q T2.
32 #h #L #G #T1 #Q #HT1 #IHT1 #T2 #HT12
33 @(TC_star_ind … HT1 IHT1 … HT12) //
34 qed-.
35
36 lemma cpxs_ind_dx: ∀h,G,L,T2. ∀Q:predicate term. Q T2 →
37                    (∀T1,T. ⦃G, L⦄ ⊢ T1 ⬈[h] T → ⦃G, L⦄ ⊢ T ⬈*[h] T2 → Q T → Q T1) →
38                    ∀T1. ⦃G, L⦄ ⊢ T1 ⬈*[h] T2 → Q T1.
39 #h #G #L #T2 #Q #HT2 #IHT2 #T1 #HT12
40 @(TC_star_ind_dx … HT2 IHT2 … HT12) //
41 qed-.
42
43 (* Basic properties *********************************************************)
44
45 lemma cpxs_refl: ∀h,G,L,T. ⦃G, L⦄ ⊢ T ⬈*[h] T.
46 /2 width=1 by inj/ qed.
47
48 lemma cpx_cpxs: ∀h,G,L,T1,T2. ⦃G, L⦄ ⊢ T1 ⬈[h] T2 → ⦃G, L⦄ ⊢ T1 ⬈*[h] T2.
49 /2 width=1 by inj/ qed.
50
51 lemma cpxs_strap1: ∀h,G,L,T1,T. ⦃G, L⦄ ⊢ T1 ⬈*[h] T →
52                    ∀T2. ⦃G, L⦄ ⊢ T ⬈[h] T2 → ⦃G, L⦄ ⊢ T1 ⬈*[h] T2.
53 normalize /2 width=3 by step/ qed-.
54
55 lemma cpxs_strap2: ∀h,G,L,T1,T. ⦃G, L⦄ ⊢ T1 ⬈[h] T →
56                    ∀T2. ⦃G, L⦄ ⊢ T ⬈*[h] T2 → ⦃G, L⦄ ⊢ T1 ⬈*[h] T2.
57 normalize /2 width=3 by TC_strap/ qed-.
58
59 (* Basic_2A1: was just: cpxs_sort *)
60 lemma cpxs_sort: ∀h,G,L,s,n. ⦃G, L⦄ ⊢ ⋆s ⬈*[h] ⋆((next h)^n s).
61 #h #G #L #s #n elim n -n /2 width=1 by cpx_cpxs/
62 #n >iter_S /2 width=3 by cpxs_strap1/
63 qed.
64
65 lemma cpxs_bind_dx: ∀h,G,L,V1,V2. ⦃G, L⦄ ⊢ V1 ⬈[h] V2 →
66                     ∀I,T1,T2. ⦃G, L. ⓑ{I}V1⦄ ⊢ T1 ⬈*[h] T2 →
67                     ∀p. ⦃G, L⦄ ⊢ ⓑ{p,I}V1.T1 ⬈*[h] ⓑ{p,I}V2.T2.
68 #h #G #L #V1 #V2 #HV12 #I #T1 #T2 #HT12 #a @(cpxs_ind_dx … HT12) -T1
69 /3 width=3 by cpxs_strap2, cpx_cpxs, cpx_pair_sn, cpx_bind/
70 qed.
71
72 lemma cpxs_flat_dx: ∀h,G,L,V1,V2. ⦃G, L⦄ ⊢ V1 ⬈[h] V2 →
73                     ∀T1,T2. ⦃G, L⦄ ⊢ T1 ⬈*[h] T2 →
74                     ∀I. ⦃G, L⦄ ⊢ ⓕ{I}V1.T1 ⬈*[h] ⓕ{I}V2.T2.
75 #h #G #L #V1 #V2 #HV12 #T1 #T2 #HT12 @(cpxs_ind … HT12) -T2
76 /3 width=5 by cpxs_strap1, cpx_cpxs, cpx_pair_sn, cpx_flat/
77 qed.
78
79 lemma cpxs_flat_sn: ∀h,G,L,T1,T2. ⦃G, L⦄ ⊢ T1 ⬈[h] T2 →
80                     ∀V1,V2. ⦃G, L⦄ ⊢ V1 ⬈*[h] V2 →
81                     ∀I. ⦃G, L⦄ ⊢ ⓕ{I}V1.T1 ⬈*[h] ⓕ{I}V2.T2.
82 #h #G #L #T1 #T2 #HT12 #V1 #V2 #H @(cpxs_ind … H) -V2
83 /3 width=5 by cpxs_strap1, cpx_cpxs, cpx_pair_sn, cpx_flat/
84 qed.
85
86 lemma cpxs_pair_sn: ∀h,I,G,L,V1,V2. ⦃G, L⦄ ⊢ V1 ⬈*[h] V2 →
87                     ∀T. ⦃G, L⦄ ⊢ ②{I}V1.T ⬈*[h] ②{I}V2.T.
88 #h #I #G #L #V1 #V2 #H @(cpxs_ind … H) -V2
89 /3 width=3 by cpxs_strap1, cpx_pair_sn/
90 qed.
91
92 lemma cpxs_zeta (h) (G) (L) (V):
93                 ∀T1,T. ⬆*[1] T ≘ T1 →
94                 ∀T2. ⦃G, L⦄ ⊢ T ⬈*[h] T2 → ⦃G, L⦄ ⊢ +ⓓV.T1 ⬈*[h] T2.
95 #h #G #L #V #T1 #T #HT1 #T2 #H @(cpxs_ind … H) -T2
96 /3 width=3 by cpxs_strap1, cpx_cpxs, cpx_zeta/
97 qed.
98
99 (* Basic_2A1: was: cpxs_zeta *)
100 lemma cpxs_zeta_dx (h) (G) (L) (V):
101                    ∀T2,T. ⬆*[1] T2 ≘ T →
102                    ∀T1. ⦃G, L.ⓓV⦄ ⊢ T1 ⬈*[h] T → ⦃G, L⦄ ⊢ +ⓓV.T1 ⬈*[h] T2.
103 #h #G #L #V #T2 #T #HT2 #T1 #H @(cpxs_ind_dx … H) -T1
104 /3 width=3 by cpxs_strap2, cpx_cpxs, cpx_bind, cpx_zeta/
105 qed.
106
107 lemma cpxs_eps: ∀h,G,L,T1,T2. ⦃G, L⦄ ⊢ T1 ⬈*[h] T2 →
108                 ∀V. ⦃G, L⦄ ⊢ ⓝV.T1 ⬈*[h] T2.
109 #h #G #L #T1 #T2 #H @(cpxs_ind … H) -T2
110 /3 width=3 by cpxs_strap1, cpx_cpxs, cpx_eps/
111 qed.
112
113 (* Basic_2A1: was: cpxs_ct *)
114 lemma cpxs_ee: ∀h,G,L,V1,V2. ⦃G, L⦄ ⊢ V1 ⬈*[h] V2 →
115                ∀T. ⦃G, L⦄ ⊢ ⓝV1.T ⬈*[h] V2.
116 #h #G #L #V1 #V2 #H @(cpxs_ind … H) -V2
117 /3 width=3 by cpxs_strap1, cpx_cpxs, cpx_ee/
118 qed.
119
120 lemma cpxs_beta_dx: ∀h,p,G,L,V1,V2,W1,W2,T1,T2.
121                     ⦃G, L⦄ ⊢ V1 ⬈[h] V2 → ⦃G, L.ⓛW1⦄ ⊢ T1 ⬈*[h] T2 → ⦃G, L⦄ ⊢ W1 ⬈[h] W2 →
122                     ⦃G, L⦄ ⊢ ⓐV1.ⓛ{p}W1.T1 ⬈*[h] ⓓ{p}ⓝW2.V2.T2.
123 #h #p #G #L #V1 #V2 #W1 #W2 #T1 #T2 #HV12 * -T2
124 /4 width=7 by cpx_cpxs, cpxs_strap1, cpxs_bind_dx, cpxs_flat_dx, cpx_beta/
125 qed.
126
127 lemma cpxs_theta_dx: ∀h,p,G,L,V1,V,V2,W1,W2,T1,T2.
128                      ⦃G, L⦄ ⊢ V1 ⬈[h] V → ⬆*[1] V ≘ V2 → ⦃G, L.ⓓW1⦄ ⊢ T1 ⬈*[h] T2 →
129                      ⦃G, L⦄ ⊢ W1 ⬈[h] W2 → ⦃G, L⦄ ⊢ ⓐV1.ⓓ{p}W1.T1 ⬈*[h] ⓓ{p}W2.ⓐV2.T2.
130 #h #p #G #L #V1 #V #V2 #W1 #W2 #T1 #T2 #HV1 #HV2 * -T2 
131 /4 width=9 by cpx_cpxs, cpxs_strap1, cpxs_bind_dx, cpxs_flat_dx, cpx_theta/
132 qed.
133
134 (* Basic inversion lemmas ***************************************************)
135
136 (* Basic_2A1: wa just: cpxs_inv_sort1 *)
137 lemma cpxs_inv_sort1: ∀h,G,L,X2,s. ⦃G, L⦄ ⊢ ⋆s ⬈*[h] X2 →
138                       ∃n. X2 = ⋆((next h)^n s).
139 #h #G #L #X2 #s #H @(cpxs_ind … H) -X2 /2 width=2 by ex_intro/
140 #X #X2 #_ #HX2 * #n #H destruct
141 elim (cpx_inv_sort1 … HX2) -HX2 #H destruct /2 width=2 by ex_intro/
142 @(ex_intro … (↑n)) >iter_S //
143 qed-.
144
145 lemma cpxs_inv_cast1: ∀h,G,L,W1,T1,U2. ⦃G, L⦄ ⊢ ⓝW1.T1 ⬈*[h] U2 →
146                       ∨∨ ∃∃W2,T2. ⦃G, L⦄ ⊢ W1 ⬈*[h] W2 & ⦃G, L⦄ ⊢ T1 ⬈*[h] T2 & U2 = ⓝW2.T2
147                        | ⦃G, L⦄ ⊢ T1 ⬈*[h] U2
148                        | ⦃G, L⦄ ⊢ W1 ⬈*[h] U2.
149 #h #G #L #W1 #T1 #U2 #H @(cpxs_ind … H) -U2 /3 width=5 by or3_intro0, ex3_2_intro/
150 #U2 #U #_ #HU2 * /3 width=3 by cpxs_strap1, or3_intro1, or3_intro2/ *
151 #W #T #HW1 #HT1 #H destruct
152 elim (cpx_inv_cast1 … HU2) -HU2 /3 width=3 by cpxs_strap1, or3_intro1, or3_intro2/ *
153 #W2 #T2 #HW2 #HT2 #H destruct
154 lapply (cpxs_strap1 … HW1 … HW2) -W
155 lapply (cpxs_strap1 … HT1 … HT2) -T /3 width=5 by or3_intro0, ex3_2_intro/
156 qed-.