1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 notation "hvbox( T1 break ⊢ ▶ ▶ * [ term 46 d , break term 46 e ] break term 46 T2 )"
16 non associative with precedence 45
17 for @{ 'PSubstStarSnAlt $T1 $d $e $T2 }.
19 include "basic_2/unfold/ltpss_dx_ltpss_dx.ma".
20 include "basic_2/unfold/ltpss_sn_ltpss_sn.ma".
22 (* SN PARALLEL UNFOLD ON LOCAL ENVIRONMENTS *********************************)
24 (* alternative definition of ltpss_sn *)
25 definition ltpssa: nat → nat → relation lenv ≝
26 λd,e. TC … (ltpss_dx d e).
28 interpretation "parallel unfold (local environment, sn variant) alternative"
29 'PSubstStarSnAlt L1 d e L2 = (ltpssa d e L1 L2).
31 (* Basic eliminators ********************************************************)
33 lemma ltpssa_ind: ∀d,e,L1. ∀R:predicate lenv. R L1 →
34 (∀L,L2. L1 ⊢ ▶▶* [d, e] L → L ▶* [d, e] L2 → R L → R L2) →
35 ∀L2. L1 ⊢ ▶▶* [d, e] L2 → R L2.
36 #d #e #L1 #R #HL1 #IHL1 #L2 #HL12 @(TC_star_ind … HL1 IHL1 … HL12) //
39 lemma ltpssa_ind_dx: ∀d,e,L2. ∀R:predicate lenv. R L2 →
40 (∀L1,L. L1 ▶* [d, e] L → L ⊢ ▶▶* [d, e] L2 → R L → R L1) →
41 ∀L1. L1 ⊢ ▶▶* [d, e] L2 → R L1.
42 #d #e #L2 #R #HL2 #IHL2 #L1 #HL12 @(TC_star_ind_dx … HL2 IHL2 … HL12) //
45 (* Basic properties *********************************************************)
47 lemma ltpssa_refl: ∀L,d,e. L ⊢ ▶▶* [d, e] L.
50 lemma ltpssa_tpss2: ∀I,L1,V1,V2,e. L1 ⊢ V1 ▶*[0, e] V2 →
51 ∀L2. L1 ⊢ ▶▶* [0, e] L2 →
52 L1.ⓑ{I}V1 ⊢ ▶▶* [O, e + 1] L2.ⓑ{I}V2.
53 #I #L1 #V1 #V2 #e #HV12 #L2 #H @(ltpssa_ind … H) -L2
54 [ /3 width=1/ | /3 width=5/ ]
57 lemma ltpssa_tpss1: ∀I,L1,V1,V2,d,e. L1 ⊢ V1 ▶*[d, e] V2 →
58 ∀L2. L1 ⊢ ▶▶* [d, e] L2 →
59 L1.ⓑ{I}V1 ⊢ ▶▶* [d + 1, e] L2.ⓑ{I}V2.
60 #I #L1 #V1 #V2 #d #e #HV12 #L2 #H @(ltpssa_ind … H) -L2
61 [ /3 width=1/ | /3 width=5/ ]
64 lemma ltpss_sn_ltpssa: ∀L1,L2,d,e. L1 ⊢ ▶* [d, e] L2 → L1 ⊢ ▶▶* [d, e] L2.
65 #L1 #L2 #d #e #H elim H -L1 -L2 -d -e // /2 width=1/
68 lemma ltpss_sn_dx_trans_eq: ∀L1,L,d,e. L1 ⊢ ▶* [d, e] L →
69 ∀L2. L ▶* [d, e] L2 → L1 ⊢ ▶* [d, e] L2.
70 #L1 #L #d #e #H elim H -L1 -L -d -e
72 lapply (ltpss_dx_inv_atom1 … H) -H #H destruct //
74 lapply (ltpss_dx_inv_refl_O2 … H) -H #H destruct //
75 | #L1 #L #I #V1 #V #e #_ #HV1 #IHL1 #X #H
76 elim (ltpss_dx_inv_tpss21 … H ?) -H // <minus_plus_m_m
77 #L2 #V2 #HL2 #HV2 #H destruct
78 lapply (IHL1 … HL2) -L #HL12
79 lapply (ltpss_sn_tpss_trans_eq … HV2 … HL12) -HV2 #HV2
80 lapply (tpss_trans_eq … HV1 HV2) -V /2 width=1/
81 | #L1 #L #I #V1 #V #d #e #_ #HV1 #IHL1 #X #H
82 elim (ltpss_dx_inv_tpss11 … H ?) -H // <minus_plus_m_m
83 #L2 #V2 #HL2 #HV2 #H destruct
84 lapply (IHL1 … HL2) -L #HL12
85 lapply (ltpss_sn_tpss_trans_eq … HV2 … HL12) -HV2 #HV2
86 lapply (tpss_trans_eq … HV1 HV2) -V /2 width=1/
90 lemma ltpss_dx_sn_trans_eq: ∀L1,L,d,e. L1 ▶* [d, e] L →
91 ∀L2. L ⊢ ▶* [d, e] L2 → L1 ⊢ ▶* [d, e] L2.
94 lemma ltpssa_strip: ∀L0,L1,d1,e1. L0 ⊢ ▶▶* [d1, e1] L1 →
95 ∀L2,d2,e2. L0 ▶* [d2, e2] L2 →
96 ∃∃L. L1 ▶* [d2, e2] L & L2 ⊢ ▶▶* [d1, e1] L.
99 (* Basic inversion lemmas ***************************************************)
101 lemma ltpssa_ltpss_sn: ∀L1,L2,d,e. L1 ⊢ ▶▶* [d, e] L2 → L1 ⊢ ▶* [d, e] L2.
102 #L1 #L2 #d #e #H @(ltpssa_ind … H) -L2 // /2 width=3/
105 (* Advanced properties ******************************************************)
107 lemma ltpss_sn_strip: ∀L0,L1,d1,e1. L0 ⊢ ▶* [d1, e1] L1 →
108 ∀L2,d2,e2. L0 ▶* [d2, e2] L2 →
109 ∃∃L. L1 ▶* [d2, e2] L & L2 ⊢ ▶* [d1, e1] L.
110 #L0 #L1 #d1 #e1 #H #L2 #d2 #e2 #HL02
111 lapply (ltpss_sn_ltpssa … H) -H #HL01
112 elim (ltpssa_strip … HL01 … HL02) -L0
113 /3 width=3 by ltpssa_ltpss_sn, ex2_intro/
116 (* Note: this should go in ltpss_sn_ltpss_sn.ma *)
117 lemma ltpss_sn_tpss_conf: ∀L0,T2,U2,d2,e2. L0 ⊢ T2 ▶* [d2, e2] U2 →
118 ∀L1,d1,e1. L0 ⊢ ▶* [d1, e1] L1 →
119 ∃∃T. L1 ⊢ T2 ▶* [d2, e2] T &
120 L0 ⊢ U2 ▶* [d1, e1] T.
121 #L0 #T2 #U2 #d2 #e2 #HTU2 #L1 #d1 #e1 #H
122 lapply (ltpss_sn_ltpssa … H) -H #H @(ltpssa_ind … H) -L1 /2 width=3/ -HTU2
123 #L #L1 #H #HL1 * #T #HT2 #HU2T
124 lapply (ltpssa_ltpss_sn … H) -H #HL0
125 lapply (ltpss_sn_dx_trans_eq … HL0 … HL1) -HL0 #HL01
126 elim (ltpss_dx_tpss_conf … HT2 … HL1) -HT2 -HL1 #T0 #HT20 #HT0
127 lapply (ltpss_sn_tpss_trans_eq … HT0 … HL01) -HT0 -HL01 #HT0
128 lapply (tpss_trans_eq … HU2T HT0) -T /2 width=3/
131 (* Note: this should go in ltpss_sn_ltpss_sn.ma *)
132 lemma ltpss_sn_tpss_trans_down: ∀L0,L1,T2,U2,d1,e1,d2,e2. d2 + e2 ≤ d1 →
133 L1 ⊢ ▶* [d1, e1] L0 → L0 ⊢ T2 ▶* [d2, e2] U2 →
134 ∃∃T. L1 ⊢ T2 ▶* [d2, e2] T & L1 ⊢ T ▶* [d1, e1] U2.
135 #L0 #L1 #T2 #U2 #d1 #e1 #d2 #e2 #Hde2d1 #H #HTU2
136 lapply (ltpss_sn_ltpssa … H) -H #HL10
137 @(ltpssa_ind_dx … HL10) -L1 /2 width=3/ -HTU2
138 #L1 #L #HL1 #_ * #T #HT2 #HTU2
139 elim (ltpss_dx_tpss_trans_down … HL1 HT2) -HT2 // #T0 #HT20 #HT0 -Hde2d1
140 lapply (tpss_trans_eq … HT0 HTU2) -T #HT0U2
141 lapply (ltpss_dx_tpss_trans_eq … HT0U2 … HL1) -HT0U2 -HL1 /2 width=3/
144 (* Main properties **********************************************************)
146 theorem ltpssa_conf: ∀L0,L1,d1,e1. L0 ⊢ ▶▶* [d1, e1] L1 →
147 ∀L2,d2,e2. L0 ⊢ ▶▶* [d2, e2] L2 →
148 ∃∃L. L1 ⊢ ▶▶* [d2, e2] L & L2 ⊢ ▶▶* [d1, e1] L.
151 (* Note: this should go in ltpss_sn_ltpss_sn.ma *)
152 theorem ltpss_sn_conf: ∀L0,L1,d1,e1. L0 ⊢ ▶* [d1, e1] L1 →
153 ∀L2,d2,e2. L0 ⊢ ▶* [d2, e2] L2 →
154 ∃∃L. L1 ⊢ ▶* [d2, e2] L & L2 ⊢ ▶* [d1, e1] L.
155 #L0 #L1 #d1 #e1 #H1 #L2 #d2 #e2 #H2
156 lapply (ltpss_sn_ltpssa … H1) -H1 #HL01
157 lapply (ltpss_sn_ltpssa … H2) -H2 #HL02
158 elim (ltpssa_conf … HL01 … HL02) -L0
159 /3 width=3 by ltpssa_ltpss_sn, ex2_intro/