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