]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambda_delta/basic_2/unfold/ltpss_sn_alt.ma
7a453d270097fd12a7aec7a2c5444baa92832167
[helm.git] / matita / matita / contribs / lambda_delta / basic_2 / unfold / ltpss_sn_alt.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/unfold/ltpss_dx_ltpss_dx.ma".
16 include "basic_2/unfold/ltpss_sn_ltpss_sn.ma".
17
18 (* SN PARALLEL UNFOLD ON LOCAL ENVIRONMENTS *********************************)
19
20 (* alternative definition of ltpss_sn *)
21 definition ltpssa: nat → nat → relation lenv ≝
22                    λd,e. TC … (ltpss_dx d e).
23
24 interpretation "parallel unfold (local environment, sn variant) alternative"
25    'PSubstStarSnAlt L1 d e L2 = (ltpssa d e L1 L2).
26
27 (* Basic eliminators ********************************************************)
28
29 lemma ltpssa_ind: ∀d,e,L1. ∀R:predicate lenv. R L1 →
30                   (∀L,L2. L1 ⊢ ▶▶* [d, e] L → L ▶* [d, e] L2 → R L → R L2) →
31                   ∀L2. L1 ⊢ ▶▶* [d, e] L2 → R L2.
32 #d #e #L1 #R #HL1 #IHL1 #L2 #HL12 @(TC_star_ind … HL1 IHL1 … HL12) //
33 qed-.
34
35 lemma ltpssa_ind_dx: ∀d,e,L2. ∀R:predicate lenv. R L2 →
36                      (∀L1,L. L1 ▶* [d, e] L → L ⊢ ▶▶* [d, e] L2 → R L → R L1) →
37                      ∀L1. L1 ⊢ ▶▶* [d, e] L2 → R L1.
38 #d #e #L2 #R #HL2 #IHL2 #L1 #HL12 @(TC_star_ind_dx … HL2 IHL2 … HL12) //
39 qed-.
40
41 (* Basic properties *********************************************************)
42
43 lemma ltpssa_refl: ∀L,d,e. L ⊢ ▶▶* [d, e] L.
44 /2 width=1/ qed.
45
46 lemma ltpssa_tpss2: ∀I,L1,V1,V2,e. L1 ⊢ V1 ▶*[0, e] V2 →
47                     ∀L2. L1 ⊢ ▶▶* [0, e] L2 →
48                     L1.ⓑ{I}V1 ⊢ ▶▶* [O, e + 1] L2.ⓑ{I}V2.
49 #I #L1 #V1 #V2 #e #HV12 #L2 #H @(ltpssa_ind … H) -L2
50 [ /3 width=1/ | /3 width=5/ ]
51 qed.
52
53 lemma ltpssa_tpss1: ∀I,L1,V1,V2,d,e. L1 ⊢ V1 ▶*[d, e] V2 →
54                     ∀L2. L1 ⊢ ▶▶* [d, e] L2 →
55                     L1.ⓑ{I}V1 ⊢ ▶▶* [d + 1, e] L2.ⓑ{I}V2.
56 #I #L1 #V1 #V2 #d #e #HV12 #L2 #H @(ltpssa_ind … H) -L2
57 [ /3 width=1/ | /3 width=5/ ]
58 qed.
59
60 lemma ltpss_sn_ltpssa: ∀L1,L2,d,e. L1 ⊢ ▶* [d, e] L2 → L1 ⊢ ▶▶* [d, e] L2.
61 #L1 #L2 #d #e #H elim H -L1 -L2 -d -e // /2 width=1/
62 qed.
63
64 lemma ltpss_sn_dx_trans_eq: ∀L1,L,d,e. L1 ⊢ ▶* [d, e] L →
65                             ∀L2. L ▶* [d, e] L2 → L1 ⊢ ▶* [d, e] L2.
66 #L1 #L #d #e #H elim H -L1 -L -d -e
67 [ #d #e #X #H
68   lapply (ltpss_dx_inv_atom1 … H) -H #H destruct //
69 | #L #I #V #X #H
70   lapply (ltpss_dx_inv_refl_O2 … H) -H #H destruct //
71 | #L1 #L #I #V1 #V #e #_ #HV1 #IHL1 #X #H
72   elim (ltpss_dx_inv_tpss21 … H ?) -H // <minus_plus_m_m
73   #L2 #V2 #HL2 #HV2 #H destruct
74   lapply (IHL1 … HL2) -L #HL12
75   lapply (ltpss_sn_tpss_trans_eq … HV2 … HL12) -HV2 #HV2
76   lapply (tpss_trans_eq … HV1 HV2) -V /2 width=1/
77 | #L1 #L #I #V1 #V #d #e #_ #HV1 #IHL1 #X #H
78   elim (ltpss_dx_inv_tpss11 … H ?) -H // <minus_plus_m_m
79   #L2 #V2 #HL2 #HV2 #H destruct
80   lapply (IHL1 … HL2) -L #HL12
81   lapply (ltpss_sn_tpss_trans_eq … HV2 … HL12) -HV2 #HV2
82   lapply (tpss_trans_eq … HV1 HV2) -V /2 width=1/
83 ]
84 qed.
85
86 lemma ltpss_dx_sn_trans_eq: ∀L1,L,d,e. L1 ▶* [d, e] L →
87                             ∀L2. L ⊢ ▶* [d, e] L2 → L1 ⊢ ▶* [d, e] L2.
88 /3 width=3/ qed.
89
90 lemma ltpssa_strip: ∀L0,L1,d1,e1. L0 ⊢ ▶▶* [d1, e1] L1 →
91                     ∀L2,d2,e2. L0 ▶* [d2, e2] L2 →
92                     ∃∃L. L1 ▶* [d2, e2] L & L2 ⊢ ▶▶* [d1, e1] L.
93 /3 width=3/ qed.
94
95 (* Basic inversion lemmas ***************************************************)
96
97 lemma ltpssa_ltpss_sn: ∀L1,L2,d,e. L1 ⊢ ▶▶* [d, e] L2 → L1 ⊢ ▶* [d, e] L2.
98 #L1 #L2 #d #e #H @(ltpssa_ind … H) -L2 // /2 width=3/
99 qed-.
100
101 (* Advanced properties ******************************************************)
102
103 lemma ltpss_sn_strip: ∀L0,L1,d1,e1. L0 ⊢ ▶* [d1, e1] L1 →
104                       ∀L2,d2,e2. L0 ▶* [d2, e2] L2 →
105                       ∃∃L. L1 ▶* [d2, e2] L & L2 ⊢ ▶* [d1, e1] L.
106 #L0 #L1 #d1 #e1 #H #L2 #d2 #e2 #HL02
107 lapply (ltpss_sn_ltpssa … H) -H #HL01
108 elim (ltpssa_strip … HL01 … HL02) -L0
109 /3 width=3 by ltpssa_ltpss_sn, ex2_1_intro/
110 qed.
111
112 (* Note: this should go in ltpss_sn_ltpss_sn.ma *)
113 lemma ltpss_sn_tpss_conf: ∀L0,T2,U2,d2,e2. L0 ⊢ T2 ▶* [d2, e2] U2 →
114                           ∀L1,d1,e1. L0 ⊢ ▶* [d1, e1] L1 →
115                           ∃∃T. L1 ⊢ T2 ▶* [d2, e2] T &
116                                L0 ⊢ U2 ▶* [d1, e1] T.
117 #L0 #T2 #U2 #d2 #e2 #HTU2 #L1 #d1 #e1 #H
118 lapply (ltpss_sn_ltpssa … H) -H #H @(ltpssa_ind … H) -L1 /2 width=3/ -HTU2
119 #L #L1 #H #HL1 * #T #HT2 #HU2T
120 lapply (ltpssa_ltpss_sn … H) -H #HL0
121 lapply (ltpss_sn_dx_trans_eq … HL0 … HL1) -HL0 #HL01
122 elim (ltpss_dx_tpss_conf … HT2 … HL1) -HT2 -HL1 #T0 #HT20 #HT0
123 lapply (ltpss_sn_tpss_trans_eq … HT0 … HL01) -HT0 -HL01 #HT0
124 lapply (tpss_trans_eq … HU2T HT0) -T /2 width=3/
125 qed.
126
127 (* Note: this should go in ltpss_sn_ltpss_sn.ma *)
128 lemma ltpss_sn_tpss_trans_down: ∀L0,L1,T2,U2,d1,e1,d2,e2. d2 + e2 ≤ d1 →
129                                 L1 ⊢ ▶* [d1, e1] L0 → L0 ⊢ T2 ▶* [d2, e2] U2 →
130                                 ∃∃T. L1 ⊢ T2 ▶* [d2, e2] T & L1 ⊢ T ▶* [d1, e1] U2.
131 #L0 #L1 #T2 #U2 #d1 #e1 #d2 #e2 #Hde2d1 #H #HTU2
132 lapply (ltpss_sn_ltpssa … H) -H #HL10
133 @(ltpssa_ind_dx … HL10) -L1 /2 width=3/ -HTU2
134 #L1 #L #HL1 #_ * #T #HT2 #HTU2
135 elim (ltpss_dx_tpss_trans_down … HL1 HT2) -HT2 // #T0 #HT20 #HT0 -Hde2d1
136 lapply (tpss_trans_eq … HT0 HTU2) -T #HT0U2
137 lapply (ltpss_dx_tpss_trans_eq … HT0U2 … HL1) -HT0U2 -HL1 /2 width=3/
138 qed.
139
140 (* Main properties **********************************************************)
141
142 theorem ltpssa_conf: ∀L0,L1,d1,e1. L0 ⊢ ▶▶* [d1, e1] L1 →
143                      ∀L2,d2,e2. L0 ⊢ ▶▶* [d2, e2] L2 →
144                      ∃∃L. L1 ⊢ ▶▶* [d2, e2] L & L2 ⊢ ▶▶* [d1, e1] L.
145 /3 width=3/ qed.
146
147 (* Note: this should go in ltpss_sn_ltpss_sn.ma *)
148 theorem ltpss_sn_conf: ∀L0,L1,d1,e1. L0 ⊢ ▶* [d1, e1] L1 →
149                        ∀L2,d2,e2. L0 ⊢ ▶* [d2, e2] L2 →
150                        ∃∃L. L1 ⊢ ▶* [d2, e2] L & L2 ⊢ ▶* [d1, e1] L.
151 #L0 #L1 #d1 #e1 #H1 #L2 #d2 #e2 #H2
152 lapply (ltpss_sn_ltpssa … H1) -H1 #HL01
153 lapply (ltpss_sn_ltpssa … H2) -H2 #HL02
154 elim (ltpssa_conf … HL01 … HL02) -L0
155 /3 width=3 by ltpssa_ltpss_sn, ex2_1_intro/
156 qed.