]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/computation/cprs.ma
lambdadelta
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / computation / 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/notation/relations/predstar_3.ma".
16 include "basic_2/reduction/cnr.ma".
17
18 (* CONTEXT-SENSITIVE PARALLEL COMPUTATION ON TERMS **************************)
19
20 (* Basic_1: includes: pr1_pr0 *)
21 definition cprs: lenv → relation term ≝ LTC … cpr.
22
23 interpretation "context-sensitive parallel computation (term)"
24    'PRedStar L T1 T2 = (cprs L T1 T2).
25
26 (* Basic eliminators ********************************************************)
27
28 lemma cprs_ind: ∀L,T1. ∀R:predicate term. R T1 →
29                 (∀T,T2. L ⊢ T1 ➡* T → L ⊢ T ➡ T2 → R T → R T2) →
30                 ∀T2. L ⊢ T1 ➡* T2 → R T2.
31 #L #T1 #R #HT1 #IHT1 #T2 #HT12
32 @(TC_star_ind … HT1 IHT1 … HT12) //
33 qed-.
34
35 lemma cprs_ind_dx: ∀L,T2. ∀R:predicate term. R T2 →
36                    (∀T1,T. L ⊢ T1 ➡ T → L ⊢ T ➡* T2 → R T → R T1) →
37                    ∀T1. L ⊢ T1 ➡* T2 → R T1.
38 #L #T2 #R #HT2 #IHT2 #T1 #HT12
39 @(TC_star_ind_dx … HT2 IHT2 … HT12) //
40 qed-.
41
42 (* Basic properties *********************************************************)
43
44 (* Basic_1: was: pr3_pr2 *)
45 lemma cpr_cprs: ∀L,T1,T2. L ⊢ T1 ➡ T2 → L ⊢ T1 ➡* T2.
46 /2 width=1/ qed.
47
48 (* Basic_1: was: pr3_refl *)
49 lemma cprs_refl: ∀L,T. L ⊢ T ➡* T.
50 /2 width=1/ qed.
51
52 lemma cprs_strap1: ∀L,T1,T,T2.
53                    L ⊢ T1 ➡* T → L ⊢ T ➡ T2 → L ⊢ T1 ➡* T2.
54 normalize /2 width=3/ qed.
55
56 (* Basic_1: was: pr3_step *)
57 lemma cprs_strap2: ∀L,T1,T,T2.
58                    L ⊢ T1 ➡ T → L ⊢ T ➡* T2 → L ⊢ T1 ➡* T2.
59 normalize /2 width=3/ qed.
60
61 lemma lsubx_cprs_trans: lsub_trans … cprs lsubx.
62 /3 width=5 by lsubx_cpr_trans, TC_lsub_trans/
63 qed-.
64
65 (* Basic_1: was: pr3_pr1 *)
66 lemma tprs_cprs: ∀L,T1,T2. ⋆ ⊢ T1 ➡* T2 → L ⊢ T1 ➡* T2.
67 #L #T1 #T2 #H @(lsubx_cprs_trans … H) -H //
68 qed.
69
70 lemma cprs_bind_dx: ∀L,V1,V2. L ⊢ V1 ➡ V2 → ∀I,T1,T2. L. ⓑ{I}V1 ⊢ T1 ➡* T2 →
71                     ∀a. L ⊢ ⓑ{a,I}V1. T1 ➡* ⓑ{a,I}V2. T2.
72 #L #V1 #V2 #HV12 #I #T1 #T2 #HT12 #a @(cprs_ind_dx … HT12) -T1
73 /3 width=1/ /3 width=3/
74 qed.
75
76 (* Basic_1: was only: pr3_thin_dx *)
77 lemma cprs_flat_dx: ∀I,L,V1,V2. L ⊢ V1 ➡ V2 → ∀T1,T2. L ⊢ T1 ➡* T2 →
78                     L ⊢ ⓕ{I} V1. T1 ➡* ⓕ{I} V2. T2.
79 #I #L #V1 #V2 #HV12 #T1 #T2 #HT12 @(cprs_ind … HT12) -T2 /3 width=1/
80 #T #T2 #_ #HT2 #IHT1
81 @(cprs_strap1 … IHT1) -V1 -T1 /2 width=1/
82 qed.
83
84 lemma cprs_flat_sn: ∀I,L,T1,T2. L ⊢ T1 ➡ T2 → ∀V1,V2. L ⊢ V1 ➡* V2 →
85                     L ⊢ ⓕ{I} V1. T1 ➡* ⓕ{I} V2. T2.
86 #I #L #T1 #T2 #HT12 #V1 #V2 #H @(cprs_ind … H) -V2 /3 width=1/
87 #V #V2 #_ #HV2 #IHV1
88 @(cprs_strap1 … IHV1) -V1 -T1 /2 width=1/
89 qed.
90
91 lemma cprs_zeta: ∀L,V,T1,T,T2. ⇧[0, 1] T2 ≡ T →
92                  L.ⓓV ⊢ T1 ➡* T → L ⊢ +ⓓV.T1 ➡* T2.
93 #L #V #T1 #T #T2 #HT2 #H @(TC_ind_dx … T1 H) -T1 /3 width=3/
94 qed.
95
96 lemma cprs_tau: ∀L,T1,T2. L ⊢ T1 ➡* T2 → ∀V. L ⊢ ⓝV.T1 ➡* T2.
97 #L #T1 #T2 #H elim H -T2 /2 width=3/ /3 width=1/
98 qed.
99
100 lemma cprs_beta_dx: ∀a,L,V1,V2,W1,W2,T1,T2.
101                     L ⊢ V1 ➡ V2 → L ⊢ W1 ➡ W2 → L.ⓛW1 ⊢ T1 ➡* T2 →
102                     L ⊢ ⓐV1.ⓛ{a}W1.T1 ➡* ⓓ{a}ⓝW2.V2.T2.
103 #a #L #V1 #V2 #W1 #W2 #T1 #T2 #HV12 #HW12 * -T2 /3 width=1/
104 /4 width=7 by cprs_strap1, cprs_bind_dx, cprs_flat_dx, cpr_beta/ (**) (* auto too slow without trace *)
105 qed.
106
107 lemma cprs_theta_dx: ∀a,L,V1,V,V2,W1,W2,T1,T2.
108                      L ⊢ V1 ➡ V → ⇧[0, 1] V ≡ V2 → L.ⓓW1 ⊢ T1 ➡* T2 →
109                      L ⊢ W1 ➡ W2 → L ⊢ ⓐV1.ⓓ{a}W1.T1 ➡* ⓓ{a}W2.ⓐV2.T2.
110 #a #L #V1 #V #V2 #W1 #W2 #T1 #T2 #HV1 #HV2 * -T2 [ /3 width=3/ ]
111 /4 width=9 by cprs_strap1, cprs_bind_dx, cprs_flat_dx, cpr_theta/ (**) (* auto too slow without trace *)
112 qed.
113
114 (* Basic inversion lemmas ***************************************************)
115
116 (* Basic_1: was: pr3_gen_sort *)
117 lemma cprs_inv_sort1: ∀L,U2,k. L ⊢ ⋆k ➡* U2 → U2 = ⋆k.
118 #L #U2 #k #H @(cprs_ind … H) -U2 //
119 #U2 #U #_ #HU2 #IHU2 destruct
120 >(cpr_inv_sort1 … HU2) -HU2 //
121 qed-.
122
123 (* Basic_1: was: pr3_gen_cast *)
124 lemma cprs_inv_cast1: ∀L,W1,T1,U2. L ⊢ ⓝW1.T1 ➡* U2 → L ⊢ T1 ➡* U2 ∨
125                       ∃∃W2,T2. L ⊢ W1 ➡* W2 & L ⊢ T1 ➡* T2 & U2 = ⓝW2.T2.
126 #L #W1 #T1 #U2 #H @(cprs_ind … H) -U2 /3 width=5/
127 #U2 #U #_ #HU2 * /3 width=3/ *
128 #W #T #HW1 #HT1 #H destruct
129 elim (cpr_inv_cast1 … HU2) -HU2 /3 width=3/ *
130 #W2 #T2 #HW2 #HT2 #H destruct /4 width=5/
131 qed-.
132
133 (* Basic_1: was: nf2_pr3_unfold *)
134 lemma cprs_inv_cnr1: ∀L,T,U. L ⊢ T ➡* U → L ⊢ 𝐍⦃T⦄ → T = U.
135 #L #T #U #H @(cprs_ind_dx … H) -T //
136 #T0 #T #H1T0 #_ #IHT #H2T0
137 lapply (H2T0 … H1T0) -H1T0 #H destruct /2 width=1/
138 qed-.
139
140 (* Basic_1: removed theorems 13:
141    pr1_head_1 pr1_head_2 pr1_comp
142    clear_pr3_trans pr3_cflat pr3_gen_bind
143    pr3_head_1 pr3_head_2 pr3_head_21 pr3_head_12
144    pr3_iso_appl_bind pr3_iso_appls_appl_bind pr3_iso_appls_bind
145 *)