]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/rt_computation/cpxs_tsts.ma
- advances on lfxs for lfpxs
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / rt_computation / cpxs_tsts.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/syntax/tsts.ma".
16 include "basic_2/rt_computation/lfpxs_cpxs.ma".
17
18 (* UNCOUNTED CONTEXT-SENSITIVE PARALLEL RT-COMPUTATION FOR TERMS ************)
19
20 (* Forward lemmas with same top term structure ******************************)
21 (*
22 lemma cpxs_fwd_cnx: ∀h,o,G,L,T. ⦃G, L⦄ ⊢ ⬈[h, o] 𝐍⦃T⦄ → ∀U. ⦃G, L⦄ ⊢ T ⬈*[h, o] U → T ≂ U.
23 #h #o #G #L #T #HT #U #H
24 >(cpxs_inv_cnx1 … H HT) -G -L -T //
25 qed-.
26 *)
27 lemma cpxs_fwd_sort: ∀h,G,L,U,s. ⦃G, L⦄ ⊢ ⋆s ⬈*[h] U →
28                      ⋆s ≂ U ∨ ⦃G, L⦄ ⊢ ⋆(next h s) ⬈*[h] U.
29 #h #G #L #U #s #H elim (cpxs_inv_sort1 … H) -H *
30 [ #H destruct /2 width=1 by or_introl/
31 | #n #H destruct
32   @or_intror >iter_S <(iter_n_Sm … (next h)) // (**)
33 ]
34 qed-.
35
36 (* Basic_1: was just: pr3_iso_beta *)
37 lemma cpxs_fwd_beta: ∀h,p,G,L,V,W,T,U. ⦃G, L⦄ ⊢ ⓐV.ⓛ{p}W.T ⬈*[h] U →
38                      ⓐV.ⓛ{p}W.T ≂ U ∨ ⦃G, L⦄ ⊢ ⓓ{p}ⓝW.V.T ⬈*[h] U.
39 #h #p #G #L #V #W #T #U #H elim (cpxs_inv_appl1 … H) -H *
40 [ #V0 #T0 #_ #_ #H destruct /2 width=1 by tsts_pair, or_introl/
41 | #b #W0 #T0 #HT0 #HU
42   elim (cpxs_inv_abst1 … HT0) -HT0 #W1 #T1 #HW1 #HT1 #H destruct
43   lapply (lsubr_cpxs_trans … HT1 (L.ⓓⓝW.V) ?) -HT1
44   /5 width=3 by cpxs_trans, cpxs_bind, cpxs_pair_sn, lsubr_beta, or_intror/
45 | #b #V1 #V2 #V0 #T1 #_ #_ #HT1 #_
46   elim (cpxs_inv_abst1 … HT1) -HT1 #W2 #T2 #_ #_ #H destruct
47 ]
48 qed-.
49
50 (* Note: probably this is an inversion lemma *)
51 lemma cpxs_fwd_delta: ∀h,o,I,G,L,K,V1,i. ⬇[i] L ≡ K.ⓑ{I}V1 →
52                       ∀V2. ⬆[0, i + 1] V1 ≡ V2 →
53                       ∀U. ⦃G, L⦄ ⊢ #i ⬈*[h, o] U →
54                       #i ≂ U ∨ ⦃G, L⦄ ⊢ V2 ⬈*[h, o] U.
55 #h #o #I #G #L #K #V1 #i #HLK #V2 #HV12 #U #H
56 elim (cpxs_inv_lref1 … H) -H /2 width=1 by or_introl/
57 * #I0 #K0 #V0 #U0 #HLK0 #HVU0 #HU0
58 lapply (drop_mono … HLK0 … HLK) -HLK0 #H destruct
59 /4 width=10 by cpxs_lift, drop_fwd_drop2, or_intror/
60 qed-.
61
62 lemma cpxs_fwd_theta: ∀h,o,a,G,L,V1,V,T,U. ⦃G, L⦄ ⊢ ⓐV1.ⓓ{a}V.T ⬈*[h, o] U →
63                       ∀V2. ⬆[0, 1] V1 ≡ V2 → ⓐV1.ⓓ{a}V.T ≂ U ∨
64                       ⦃G, L⦄ ⊢ ⓓ{a}V.ⓐV2.T ⬈*[h, o] U.
65 #h #o #a #G #L #V1 #V #T #U #H #V2 #HV12
66 elim (cpxs_inv_appl1 … H) -H *
67 [ -HV12 #V0 #T0 #_ #_ #H destruct /2 width=1 by tsts_pair, or_introl/
68 | #b #W #T0 #HT0 #HU
69   elim (cpxs_inv_abbr1 … HT0) -HT0 *
70   [ #V3 #T3 #_ #_ #H destruct
71   | #X #HT2 #H #H0 destruct
72     elim (lift_inv_bind1 … H) -H #W2 #T2 #HW2 #HT02 #H destruct
73     @or_intror @(cpxs_trans … HU) -U (**) (* explicit constructor *)
74     @(cpxs_trans … (+ⓓV.ⓐV2.ⓛ{b}W2.T2)) [ /3 width=1 by cpxs_flat_dx, cpxs_bind_dx/ ] -T
75     @(cpxs_strap2 … (ⓐV1.ⓛ{b}W.T0)) [2: /2 width=1 by cpxs_beta_dx/ ]
76     /4 width=7 by cpx_zeta, lift_bind, lift_flat/
77   ]
78 | #b #V3 #V4 #V0 #T0 #HV13 #HV34 #HT0 #HU
79   @or_intror @(cpxs_trans … HU) -U (**) (* explicit constructor *)
80   elim (cpxs_inv_abbr1 … HT0) -HT0 *
81   [ #V5 #T5 #HV5 #HT5 #H destruct
82     lapply (cpxs_lift … HV13 (L.ⓓV) … HV12 … HV34) -V1 -V3
83     /3 width=2 by cpxs_flat, cpxs_bind, drop_drop/
84   | #X #HT1 #H #H0 destruct
85     elim (lift_inv_bind1 … H) -H #V5 #T5 #HV05 #HT05 #H destruct
86     lapply (cpxs_lift … HV13 (L.ⓓV0) … HV12 … HV34) -V3 /2 width=2 by drop_drop/ #HV24
87     @(cpxs_trans … (+ⓓV.ⓐV2.ⓓ{b}V5.T5)) [ /3 width=1 by cpxs_flat_dx, cpxs_bind_dx/ ] -T
88     @(cpxs_strap2 … (ⓐV1.ⓓ{b}V0.T0)) [ /4 width=7 by cpx_zeta, lift_bind, lift_flat/ ] -V -V5 -T5
89     @(cpxs_strap2 … (ⓓ{b}V0.ⓐV2.T0)) /3 width=3 by cpxs_pair_sn, cpxs_bind_dx, cpr_cpx, cpr_theta/
90   ]
91 ]
92 qed-.
93
94 lemma cpxs_fwd_cast: ∀h,o,G,L,W,T,U. ⦃G, L⦄ ⊢ ⓝW.T ⬈*[h, o] U →
95                      ∨∨ ⓝW. T ≂ U | ⦃G, L⦄ ⊢ T ⬈*[h, o] U | ⦃G, L⦄ ⊢ W ⬈*[h, o] U.
96 #h #o #G #L #W #T #U #H
97 elim (cpxs_inv_cast1 … H) -H /2 width=1 by or3_intro1, or3_intro2/ *
98 #W0 #T0 #_ #_ #H destruct /2 width=1 by tsts_pair, or3_intro0/
99 qed-.