]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/computation/cprs_tstc.ma
update in basic_2
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / computation / cprs_tstc.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/grammar/tstc.ma".
16 include "basic_2/computation/lprs_cprs.ma".
17
18 (* CONTEXT-SENSITIVE PARALLEL COMPUTATION ON TERMS **************************)
19
20 (* Forward lemmas involving same top term constructor ***********************)
21
22 lemma cprs_fwd_cnf: ∀L,T. L ⊢ 𝐍⦃T⦄ → ∀U. L ⊢ T ➡* U → T ≃ U.
23 #L #T #HT #U #H
24 >(cprs_inv_cnf1 … H HT) -L -T //
25 qed-.
26
27 (* Basic_1: was: pr3_iso_beta *)
28 lemma cprs_fwd_beta: ∀a,L,V,W,T,U. L ⊢ ⓐV. ⓛ{a}W. T ➡* U →
29                      ⓐV. ⓛ{a}W. T ≃ U ∨ L ⊢ ⓓ{a}V. T ➡* U.
30 #a #L #V #W #T #U #H
31 elim (cprs_inv_appl1 … H) -H *
32 [ #V0 #T0 #_ #_ #H destruct /2 width=1/
33 | #b #V0 #W0 #T0 #HV0 #HT0 #HU
34   elim (cprs_fwd_abst1 … HT0 Abbr V) -HT0 #W1 #T1 #_ #HT1 #H destruct -W1
35   @or_intror -W
36   @(cprs_trans … HU) -U /2 width=1/ (**) (* explicit constructor *)
37 | #b #V1 #V2 #V0 #T1 #_ #_ #HT1 #_
38   elim (cprs_fwd_abst1 … HT1 Abbr V) -HT1 #W2 #T2 #_ #_ #H destruct
39 ]
40 qed-.
41
42 (* Note: probably this is an inversion lemma *)
43 lemma cprs_fwd_delta: ∀L,K,V1,i. ⇩[0, i] L ≡ K. ⓓV1 →
44                       ∀V2. ⇧[0, i + 1] V1 ≡ V2 →
45                       ∀U. L ⊢ #i ➡* U →
46                       #i ≃ U ∨ L ⊢ V2 ➡* U.
47 #L #K #V1 #i #HLK #V2 #HV12 #U #H
48 elim (cprs_inv_lref1 … H) -H /2 width=1/
49 * #K0 #V0 #U0 #HLK0 #HVU0 #HU0
50 lapply (ldrop_mono … HLK0 … HLK) -HLK0 #H destruct
51 lapply (ldrop_fwd_ldrop2 … HLK) -HLK /3 width=9/
52 qed-.
53
54 lemma cprs_fwd_theta: ∀a,L,V1,V,T,U. L ⊢ ⓐV1. ⓓ{a}V. T ➡* U →
55                       ∀V2. ⇧[0, 1] V1 ≡ V2 → ⓐV1. ⓓ{a}V. T ≃ U ∨
56                       L ⊢ ⓓ{a}V. ⓐV2. T ➡* U.
57 #a #L #V1 #V #T #U #H #V2 #HV12
58 elim (cprs_inv_appl1 … H) -H *
59 [ -HV12 #V0 #T0 #_ #_ #H destruct /2 width=1/
60 | #b #V0 #W #T0 #HV10 #HT0 #HU
61   elim (cprs_inv_abbr1 … HT0) -HT0 *
62   [ #V3 #T3 #_ #_ #H destruct
63   | #X #HT2 #H #H0 destruct
64     elim (lift_inv_bind1 … H) -H #W2 #T2 #HW2 #HT02 #H destruct
65     @or_intror @(cprs_trans … HU) -U (**) (* explicit constructor *)
66     @(cprs_trans … (+ⓓV.ⓐV2.ⓛ{b}W2.T2)) [ /3 width=1/ ] -T
67     @(cprs_strap2 … (ⓐV1.ⓛ{b}W.T0)) [ /5 width=7/ ] -V -V2 -W2 -T2
68     @(cprs_strap2 … (ⓓ{b}V1.T0)) [ /3 width=1/ ] -W /2 width=1/
69   ]
70 | #b #V3 #V4 #V0 #T0 #HV13 #HV34 #HT0 #HU
71   @or_intror @(cprs_trans … HU) -U (**) (* explicit constructor *)
72   elim (cprs_inv_abbr1 … HT0) -HT0 *
73   [ #V5 #T5 #HV5 #HT5 #H destruct
74     lapply (cprs_lift … HV13 (L.ⓓV) … HV12 … HV34) -V1 -V3 /2 width=1/
75     /3 width=1/
76   | #X #HT1 #H #H0 destruct
77     elim (lift_inv_bind1 … H) -H #V5 #T5 #HV05 #HT05 #H destruct
78     lapply (cprs_lift … HV13 (L.ⓓV0) … HV12 … HV34) -V3 /2 width=1/ #HV24
79     @(cprs_trans … (+ⓓV.ⓐV2.ⓓ{b}V5.T5)) [ /3 width=1/ ] -T
80     @(cprs_strap2 … (ⓐV1.ⓓ{b}V0.T0)) [ /5 width=7/ ] -V -V5 -T5
81     @(cprs_strap2 … (ⓓ{b}V0.ⓐV2.T0)) [ /3 width=3/ ] -V1 /3 width=1/
82   ]
83 ]
84 qed-.
85
86 lemma cprs_fwd_tau: ∀L,W,T,U. L ⊢ ⓝW. T ➡* U →
87                     ⓝW. T ≃ U ∨ L ⊢ T ➡* U.
88 #L #W #T #U #H
89 elim (cprs_inv_cast1 … H) -H /2 width=1/ *
90 #W0 #T0 #_ #_ #H destruct /2 width=1/
91 qed-.