]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2A/computation/cprs_cprs.ma
milestone update in ground_2 and basic_2A
[helm.git] / matita / matita / contribs / lambdadelta / basic_2A / 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 "ground_2/xoa/ex_4_5.ma".
16 include "basic_2A/reduction/lpr_lpr.ma".
17 include "basic_2A/computation/cprs_lift.ma".
18
19 (* CONTEXT-SENSITIVE PARALLEL COMPUTATION ON TERMS **************************)
20
21 (* Main properties **********************************************************)
22
23 (* Basic_1: was: pr3_t *)
24 (* Basic_1: includes: pr1_t *)
25 theorem cprs_trans: ∀G,L. Transitive … (cprs G L).
26 normalize /2 width=3 by trans_TC/ qed-.
27
28 (* Basic_1: was: pr3_confluence *)
29 (* Basic_1: includes: pr1_confluence *)
30 theorem cprs_conf: ∀G,L. confluent2 … (cprs G L) (cprs G L).
31 normalize /3 width=3 by cpr_conf, TC_confluent2/ qed-.
32
33 theorem cprs_bind: ∀a,I,G,L,V1,V2,T1,T2. ⦃G, L.ⓑ{I}V1⦄ ⊢ T1 ➡* T2 → ⦃G, L⦄ ⊢ V1 ➡* V2 →
34                    ⦃G, L⦄ ⊢ ⓑ{a,I}V1.T1 ➡* ⓑ{a,I}V2.T2.
35 #a #I #G #L #V1 #V2 #T1 #T2 #HT12 #H @(cprs_ind … H) -V2
36 /3 width=5 by cprs_trans, cprs_bind_dx/
37 qed.
38
39 (* Basic_1: was: pr3_flat *)
40 theorem cprs_flat: ∀I,G,L,V1,V2,T1,T2. ⦃G, L⦄ ⊢ T1 ➡* T2 → ⦃G, L⦄ ⊢ V1 ➡* V2 →
41                    ⦃G, L⦄ ⊢ ⓕ{I}V1.T1 ➡* ⓕ{I}V2.T2.
42 #I #G #L #V1 #V2 #T1 #T2 #HT12 #H @(cprs_ind … H) -V2
43 /3 width=3 by cprs_flat_dx, cprs_strap1, cpr_pair_sn/
44 qed.
45
46 theorem cprs_beta_rc: ∀a,G,L,V1,V2,W1,W2,T1,T2.
47                       ⦃G, L⦄ ⊢ V1 ➡ V2 → ⦃G, L.ⓛW1⦄ ⊢ T1 ➡* T2 → ⦃G, L⦄ ⊢ W1 ➡* W2 →
48                       ⦃G, L⦄ ⊢ ⓐV1.ⓛ{a}W1.T1 ➡* ⓓ{a}ⓝW2.V2.T2.
49 #a #G #L #V1 #V2 #W1 #W2 #T1 #T2 #HV12 #HT12 #H @(cprs_ind … H) -W2 /2 width=1 by cprs_beta_dx/
50 #W #W2 #_ #HW2 #IHW1 (**) (* fulla uto too slow 14s *)
51 @(cprs_trans … IHW1) -IHW1 /3 width=1 by cprs_flat_dx, cprs_bind/
52 qed.
53
54 theorem cprs_beta: ∀a,G,L,V1,V2,W1,W2,T1,T2.
55                    ⦃G, L.ⓛW1⦄ ⊢ T1 ➡* T2 → ⦃G, L⦄ ⊢ W1 ➡* W2 → ⦃G, L⦄ ⊢ V1 ➡* V2 →
56                    ⦃G, L⦄ ⊢ ⓐV1.ⓛ{a}W1.T1 ➡* ⓓ{a}ⓝW2.V2.T2.
57 #a #G #L #V1 #V2 #W1 #W2 #T1 #T2 #HT12 #HW12 #H @(cprs_ind … H) -V2 /2 width=1 by cprs_beta_rc/
58 #V #V2 #_ #HV2 #IHV1
59 @(cprs_trans … IHV1) -IHV1 /3 width=1 by cprs_flat_sn, cprs_bind/
60 qed.
61
62 theorem cprs_theta_rc: ∀a,G,L,V1,V,V2,W1,W2,T1,T2.
63                        ⦃G, L⦄ ⊢ V1 ➡ V → ⬆[0, 1] V ≡ V2 → ⦃G, L.ⓓW1⦄ ⊢ T1 ➡* T2 →
64                        ⦃G, L⦄ ⊢ W1 ➡* W2 → ⦃G, L⦄ ⊢ ⓐV1.ⓓ{a}W1.T1 ➡* ⓓ{a}W2.ⓐV2.T2.
65 #a #G #L #V1 #V #V2 #W1 #W2 #T1 #T2 #HV1 #HV2 #HT12 #H @(cprs_ind … H) -W2
66 /3 width=5 by cprs_trans, cprs_theta_dx, cprs_bind_dx/
67 qed.
68
69 theorem cprs_theta: ∀a,G,L,V1,V,V2,W1,W2,T1,T2.
70                     ⬆[0, 1] V ≡ V2 → ⦃G, L⦄ ⊢ W1 ➡* W2 → ⦃G, L.ⓓW1⦄ ⊢ T1 ➡* T2 →
71                     ⦃G, L⦄ ⊢ V1 ➡* V → ⦃G, L⦄ ⊢ ⓐV1.ⓓ{a}W1.T1 ➡* ⓓ{a}W2.ⓐV2.T2.
72 #a #G #L #V1 #V #V2 #W1 #W2 #T1 #T2 #HV2 #HW12 #HT12 #H @(cprs_ind_dx … H) -V1
73 /3 width=3 by cprs_trans, cprs_theta_rc, cprs_flat_dx/
74 qed.
75
76 (* Advanced inversion lemmas ************************************************)
77
78 (* Basic_1: was pr3_gen_appl *)
79 lemma cprs_inv_appl1: ∀G,L,V1,T1,U2. ⦃G, L⦄ ⊢ ⓐV1.T1 ➡* U2 →
80                       ∨∨ ∃∃V2,T2.       ⦃G, L⦄ ⊢ V1 ➡* V2 & ⦃G, L⦄ ⊢ T1 ➡* T2 &
81                                         U2 = ⓐV2. T2
82                        | ∃∃a,W,T.       ⦃G, L⦄ ⊢ T1 ➡* ⓛ{a}W.T &
83                                         ⦃G, L⦄ ⊢ ⓓ{a}ⓝW.V1.T ➡* U2
84                        | ∃∃a,V0,V2,V,T. ⦃G, L⦄ ⊢ V1 ➡* V0 & ⬆[0,1] V0 ≡ V2 &
85                                         ⦃G, L⦄ ⊢ T1 ➡* ⓓ{a}V.T &
86                                         ⦃G, L⦄ ⊢ ⓓ{a}V.ⓐV2.T ➡* U2.
87 #G #L #V1 #T1 #U2 #H @(cprs_ind … H) -U2 /3 width=5 by or3_intro0, ex3_2_intro/
88 #U #U2 #_ #HU2 * *
89 [ #V0 #T0 #HV10 #HT10 #H destruct
90   elim (cpr_inv_appl1 … HU2) -HU2 *
91   [ #V2 #T2 #HV02 #HT02 #H destruct /4 width=5 by cprs_strap1, or3_intro0, ex3_2_intro/
92   | #a #V2 #W #W2 #T #T2 #HV02 #HW2 #HT2 #H1 #H2 destruct
93     lapply (cprs_strap1 … HV10 … HV02) -V0 #HV12
94     lapply (lsubr_cpr_trans … HT2 (L.ⓓⓝW.V1) ?) -HT2
95     /5 width=5 by cprs_bind, cprs_flat_dx, cpr_cprs, lsubr_beta, ex2_3_intro, or3_intro1/
96   | #a #V #V2 #W0 #W2 #T #T2 #HV0 #HV2 #HW02 #HT2 #H1 #H2 destruct
97     /5 width=10 by cprs_flat_sn, cprs_bind_dx, cprs_strap1, ex4_5_intro, or3_intro2/
98   ]
99 | /4 width=9 by cprs_strap1, or3_intro1, ex2_3_intro/
100 | /4 width=11 by cprs_strap1, or3_intro2, ex4_5_intro/
101 ]
102 qed-.
103
104 (* Properties concerning sn parallel reduction on local environments ********)
105
106 (* Basic_1: was just: pr3_pr2_pr2_t *)
107 (* Basic_1: includes: pr3_pr0_pr2_t *)
108 lemma lpr_cpr_trans: ∀G. s_r_transitive … (cpr G) (λ_. lpr G).
109 #G #L2 #T1 #T2 #HT12 elim HT12 -G -L2 -T1 -T2
110 [ /2 width=3 by/
111 | #G #L2 #K2 #V0 #V2 #W2 #i #HLK2 #_ #HVW2 #IHV02 #L1 #HL12
112   elim (lpr_drop_trans_O1 … HL12 … HLK2) -L2 #X #HLK1 #H
113   elim (lpr_inv_pair2 … H) -H #K1 #V1 #HK12 #HV10 #H destruct
114   /4 width=6 by cprs_strap2, cprs_delta/
115 |3,7: /4 width=1 by lpr_pair, cprs_bind, cprs_beta/
116 |4,6: /3 width=1 by cprs_flat, cprs_eps/
117 |5,8: /4 width=3 by lpr_pair, cprs_zeta, cprs_theta, cprs_strap1/
118 ]
119 qed-.
120
121 lemma cpr_bind2: ∀G,L,V1,V2. ⦃G, L⦄ ⊢ V1 ➡ V2 → ∀I,T1,T2. ⦃G, L.ⓑ{I}V2⦄ ⊢ T1 ➡ T2 →
122                  ∀a. ⦃G, L⦄ ⊢ ⓑ{a,I}V1.T1 ➡* ⓑ{a,I}V2.T2.
123 /4 width=5 by lpr_cpr_trans, cprs_bind_dx, lpr_pair/ qed.
124
125 (* Advanced properties ******************************************************)
126
127 (* Basic_1: was only: pr3_pr2_pr3_t pr3_wcpr0_t *)
128 lemma lpr_cprs_trans: ∀G. s_rs_transitive … (cpr G) (λ_. lpr G).
129 #G @s_r_trans_CTC1 /2 width=3 by lpr_cpr_trans/ (**) (* full auto fails *)
130 qed-.
131
132 (* Basic_1: was: pr3_strip *)
133 (* Basic_1: includes: pr1_strip *)
134 lemma cprs_strip: ∀G,L. confluent2 … (cprs G L) (cpr G L).
135 normalize /4 width=3 by cpr_conf, TC_strip1/ qed-.
136
137 lemma cprs_lpr_conf_dx: ∀G,L0,T0,T1. ⦃G, L0⦄ ⊢ T0 ➡* T1 → ∀L1. ⦃G, L0⦄ ⊢ ➡ L1 →
138                         ∃∃T. ⦃G, L1⦄ ⊢ T1 ➡* T & ⦃G, L1⦄ ⊢ T0 ➡* T.
139 #G #L0 #T0 #T1 #H @(cprs_ind … H) -T1 /2 width=3 by ex2_intro/
140 #T #T1 #_ #HT1 #IHT0 #L1 #HL01 elim (IHT0 … HL01)
141 #T2 #HT2 #HT02 elim (lpr_cpr_conf_dx … HT1 … HL01) -L0
142 #T3 #HT3 #HT13 elim (cprs_strip … HT2 … HT3) -T
143 /4 width=5 by cprs_strap2, cprs_strap1, ex2_intro/
144 qed-.
145
146 lemma cprs_lpr_conf_sn: ∀G,L0,T0,T1. ⦃G, L0⦄ ⊢ T0 ➡* T1 →
147                         ∀L1. ⦃G, L0⦄ ⊢ ➡ L1 →
148                         ∃∃T. ⦃G, L0⦄ ⊢ T1 ➡* T & ⦃G, L1⦄ ⊢ T0 ➡* T.
149 #G #L0 #T0 #T1 #HT01 #L1 #HL01 elim (cprs_lpr_conf_dx … HT01 … HL01) -HT01
150 /3 width=3 by lpr_cprs_trans, ex2_intro/
151 qed-.
152
153 lemma cprs_bind2_dx: ∀G,L,V1,V2. ⦃G, L⦄ ⊢ V1 ➡ V2 →
154                      ∀I,T1,T2. ⦃G, L.ⓑ{I}V2⦄ ⊢ T1 ➡* T2 →
155                      ∀a. ⦃G, L⦄ ⊢ ⓑ{a,I}V1.T1 ➡* ⓑ{a,I}V2.T2.
156 /4 width=5 by lpr_cprs_trans, cprs_bind_dx, lpr_pair/ qed.