]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/computation/lprs_cprs.ma
partial commit: "computation" component ...
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / computation / lprs_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/computation/cprs_cprs.ma".
16 include "basic_2/computation/lprs.ma".
17
18 (* SN PARALLEL COMPUTATION ON LOCAL ENVIRONMENTS ****************************)
19
20 (* Advanced properties ******************************************************)
21
22 lemma lprs_pair: ∀I,G,L1,L2. ⦃G, L1⦄ ⊢ ➡* L2 →
23                  ∀V1,V2. ⦃G, L1⦄ ⊢ V1 ➡* V2 → ⦃G, L1.ⓑ{I}V1⦄ ⊢ ➡* L2.ⓑ{I}V2.
24 /2 width=1 by TC_lpx_sn_pair/ qed.
25
26 (* Advanced inversion lemmas ************************************************)
27
28 lemma lprs_inv_pair1: ∀I,G,K1,L2,V1. ⦃G, K1.ⓑ{I}V1⦄ ⊢ ➡* L2 →
29                       ∃∃K2,V2. ⦃G, K1⦄ ⊢ ➡* K2 & ⦃G, K1⦄ ⊢ V1 ➡* V2 &
30                                L2 = K2.ⓑ{I}V2.
31 /3 width=3 by TC_lpx_sn_inv_pair1, lpr_cprs_trans/ qed-.
32
33 lemma lprs_inv_pair2: ∀I,G,L1,K2,V2. ⦃G, L1⦄ ⊢ ➡* K2.ⓑ{I}V2 →
34                       ∃∃K1,V1. ⦃G, K1⦄ ⊢ ➡* K2 & ⦃G, K1⦄ ⊢ V1 ➡* V2 &
35                                L1 = K1.ⓑ{I}V1.
36 /3 width=3 by TC_lpx_sn_inv_pair2, lpr_cprs_trans/ qed-.
37
38 (* Properties on context-sensitive parallel computation for terms ***********)
39
40 lemma lprs_cpr_trans: ∀G. s_r_trans … (cpr G) (lprs G).
41 /3 width=5 by s_r_trans_TC2, lpr_cprs_trans/ qed-.
42
43 (* Basic_1: was just: pr3_pr3_pr3_t *)
44 lemma lprs_cprs_trans: ∀G. s_rs_trans … (cpr G) (lprs G).
45 /3 width=5 by s_r_trans_TC1, lprs_cpr_trans/ qed-.
46
47 lemma lprs_cprs_conf_dx: ∀G,L0,T0,T1. ⦃G, L0⦄ ⊢ T0 ➡* T1 →
48                          ∀L1. ⦃G, L0⦄ ⊢ ➡* L1 →
49                          ∃∃T. ⦃G, L1⦄ ⊢ T1 ➡* T & ⦃G, L1⦄ ⊢ T0 ➡* T.
50 #G #L0 #T0 #T1 #HT01 #L1 #H elim H -L1
51 [ #L1 #HL01
52   elim (cprs_lpr_conf_dx … HT01 … HL01) -L0 /2 width=3/
53 | #L #L1 #_ #HL1 * #T #HT1 #HT0 -L0
54   elim (cprs_lpr_conf_dx … HT1 … HL1) -HT1 #T2 #HT2 #HT12
55   elim (cprs_lpr_conf_dx … HT0 … HL1) -L #T3 #HT3 #HT03
56   elim (cprs_conf … HT2 … HT3) -T #T #HT2 #HT3
57   lapply (cprs_trans … HT03 … HT3) -T3
58   lapply (cprs_trans … HT12 … HT2) -T2 /2 width=3/
59 ]
60 qed-.
61
62 lemma lprs_cpr_conf_dx: ∀G,L0,T0,T1. ⦃G, L0⦄ ⊢ T0 ➡ T1 →
63                         ∀L1. ⦃G, L0⦄ ⊢ ➡* L1 →
64                         ∃∃T. ⦃G, L1⦄ ⊢ T1 ➡* T & ⦃G, L1⦄ ⊢ T0 ➡* T.
65 /3 width=3 by lprs_cprs_conf_dx, cpr_cprs/ qed-.
66
67 lemma lprs_cprs_conf_sn: ∀G,L0,T0,T1. ⦃G, L0⦄ ⊢ T0 ➡* T1 →
68                          ∀L1. ⦃G, L0⦄ ⊢ ➡* L1 →
69                          ∃∃T. ⦃G, L0⦄ ⊢ T1 ➡* T & ⦃G, L1⦄ ⊢ T0 ➡* T.
70 #G #L0 #T0 #T1 #HT01 #L1 #HL01
71 elim (lprs_cprs_conf_dx … HT01 … HL01) -HT01 #T #HT1
72 lapply (lprs_cprs_trans … HT1 … HL01) -HT1 /2 width=3/
73 qed-.
74
75 lemma lprs_cpr_conf_sn: ∀G,L0,T0,T1. ⦃G, L0⦄ ⊢ T0 ➡ T1 →
76                         ∀L1. ⦃G, L0⦄ ⊢ ➡* L1 →
77                         ∃∃T. ⦃G, L0⦄ ⊢ T1 ➡* T & ⦃G, L1⦄ ⊢ T0 ➡* T.
78 /3 width=3 by lprs_cprs_conf_sn, cpr_cprs/ qed-.
79
80 lemma cprs_bind2: ∀G,L,V1,V2. ⦃G, L⦄ ⊢ V1 ➡* V2 →
81                   ∀I,T1,T2. ⦃G, L.ⓑ{I}V2⦄ ⊢ T1 ➡* T2 →
82                   ∀a. ⦃G, L⦄ ⊢ ⓑ{a,I}V1.T1 ➡* ⓑ{a,I}V2.T2.
83 #G #L #V1 #V2 #HV12 #I #T1 #T2 #HT12
84 lapply (lprs_cprs_trans … HT12 (L.ⓑ{I}V1) ?) /2 width=1/
85 qed.
86
87 (* Inversion lemmas on context-sensitive parallel computation for terms *****)
88
89 (* Basic_1: was: pr3_gen_abst *)
90 lemma cprs_inv_abst1: ∀a,G,L,W1,T1,U2. ⦃G, L⦄ ⊢ ⓛ{a}W1.T1 ➡* U2 →
91                       ∃∃W2,T2. ⦃G, L⦄ ⊢ W1 ➡* W2 & ⦃G, L.ⓛW1⦄ ⊢ T1 ➡* T2 &
92                                U2 = ⓛ{a}W2.T2.
93 #a #G #L #V1 #T1 #U2 #H @(cprs_ind … H) -U2 /2 width=5/
94 #U0 #U2 #_ #HU02 * #V0 #T0 #HV10 #HT10 #H destruct
95 elim (cpr_inv_abst1 … HU02) -HU02 #V2 #T2 #HV02 #HT02 #H destruct
96 lapply (lprs_cpr_trans … HT02 (L.ⓛV1) ?) /2 width=1/ -HT02 #HT02
97 lapply (cprs_strap1 … HV10 … HV02) -V0
98 lapply (cprs_trans … HT10 … HT02) -T0 /2 width=5/
99 qed-.
100
101 lemma cprs_inv_abst: ∀a,G,L,W1,W2,T1,T2. ⦃G, L⦄ ⊢ ⓛ{a}W1.T1 ➡* ⓛ{a}W2.T2 →
102                      ⦃G, L⦄ ⊢ W1 ➡* W2 ∧ ⦃G, L.ⓛW1⦄ ⊢ T1 ➡* T2.
103 #a #G #L #W1 #W2 #T1 #T2 #H
104 elim (cprs_inv_abst1 … H) -H #W #T #HW1 #HT1 #H destruct /2 width=1/
105 qed-.
106
107 (* Basic_1: was pr3_gen_abbr *)
108 lemma cprs_inv_abbr1: ∀a,G,L,V1,T1,U2. ⦃G, L⦄ ⊢ ⓓ{a}V1.T1 ➡* U2 → (
109                       ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ➡* V2 & ⦃G, L.ⓓV1⦄ ⊢ T1 ➡* T2 &
110                                U2 = ⓓ{a}V2.T2
111                       ) ∨
112                       ∃∃T2. ⦃G, L.ⓓV1⦄ ⊢ T1 ➡* T2 & ⇧[0, 1] U2 ≡ T2 & a = true.
113 #a #G #L #V1 #T1 #U2 #H @(cprs_ind … H) -U2 /3 width=5/
114 #U0 #U2 #_ #HU02 * *
115 [ #V0 #T0 #HV10 #HT10 #H destruct
116   elim (cpr_inv_abbr1 … HU02) -HU02 *
117   [ #V2 #T2 #HV02 #HT02 #H destruct
118     lapply (lprs_cpr_trans … HT02 (L.ⓓV1) ?) /2 width=1/ -HT02 #HT02
119     lapply (cprs_strap1 … HV10 … HV02) -V0
120     lapply (cprs_trans … HT10 … HT02) -T0 /3 width=5/
121   | #T2 #HT02 #HUT2
122     lapply (lprs_cpr_trans … HT02 (L.ⓓV1) ?) -HT02 /2 width=1/ -V0 #HT02
123     lapply (cprs_trans … HT10 … HT02) -T0 /3 width=3/
124   ]
125 | #U1 #HTU1 #HU01
126   elim (lift_total U2 0 1) #U #HU2
127   lapply (cpr_lift … HU02 (L.ⓓV1) … HU01 … HU2) -U0 /2 width=1/ /4 width=3/
128 ]
129 qed-.
130
131 (* More advanced properties *************************************************)
132
133 lemma lprs_pair2: ∀I,G,L1,L2. ⦃G, L1⦄ ⊢ ➡* L2 →
134                   ∀V1,V2. ⦃G, L2⦄ ⊢ V1 ➡* V2 → ⦃G, L1.ⓑ{I}V1⦄ ⊢ ➡* L2.ⓑ{I}V2.
135 /3 width=3 by lprs_pair, lprs_cprs_trans/ qed.