]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/etc/cpr/ltpss_sn_alt.etc
- basic_2: induction for preservation results now uses supclosure
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / etc / cpr / ltpss_sn_alt.etc
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 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 }.
18
19 include "basic_2/unfold/ltpss_dx_ltpss_dx.ma".
20 include "basic_2/unfold/ltpss_sn_ltpss_sn.ma".
21
22 (* SN PARALLEL UNFOLD ON LOCAL ENVIRONMENTS *********************************)
23
24 (* alternative definition of ltpss_sn *)
25 definition ltpssa: nat → nat → relation lenv ≝
26                    λd,e. TC … (ltpss_dx d e).
27
28 interpretation "parallel unfold (local environment, sn variant) alternative"
29    'PSubstStarSnAlt L1 d e L2 = (ltpssa d e L1 L2).
30
31 (* Basic eliminators ********************************************************)
32
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) //
37 qed-.
38
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) //
43 qed-.
44
45 (* Basic properties *********************************************************)
46
47 lemma ltpssa_refl: ∀L,d,e. L ⊢ ▶▶* [d, e] L.
48 /2 width=1/ qed.
49
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/ ]
55 qed.
56
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/ ]
62 qed.
63
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/
66 qed.
67
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
71 [ #d #e #X #H
72   lapply (ltpss_dx_inv_atom1 … H) -H #H destruct //
73 | #L #I #V #X #H
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/
87 ]
88 qed.
89
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.
92 /3 width=3/ qed.
93
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.
97 /3 width=3/ qed.
98
99 (* Basic inversion lemmas ***************************************************)
100
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/
103 qed-.
104
105 (* Advanced properties ******************************************************)
106
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/
114 qed.
115
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/
129 qed.
130
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/
142 qed.
143
144 (* Main properties **********************************************************)
145
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.
149 /3 width=3/ qed.
150
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/
160 qed.