]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/rt_computation/rsx_lpxs.ma
milestone update in basic_2, update in ground and static_2
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / rt_computation / rsx_lpxs.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/rt_computation/lpxs_reqx.ma".
16 include "basic_2/rt_computation/lpxs_lpxs.ma".
17 include "basic_2/rt_computation/rsx_rsx.ma".
18
19 (* STRONGLY NORMALIZING REFERRED LOCAL ENVS FOR EXTENDED RT-TRANSITION ******)
20
21 (* Properties with extended rt-computation for full local environments ******)
22
23 (* Basic_2A1: uses: lsx_intro_alt *)
24 lemma rsx_intro_lpxs (G):
25       ∀L1,T. (∀L2. ❪G,L1❫ ⊢ ⬈* L2 → (L1 ≛[T] L2 → ⊥) → G ⊢ ⬈*𝐒[T] L2) →
26       G ⊢ ⬈*𝐒[T] L1.
27 /4 width=1 by lpx_lpxs, rsx_intro/ qed-.
28
29 (* Basic_2A1: uses: lsx_lpxs_trans *)
30 lemma rsx_lpxs_trans (G):
31       ∀L1,T. G ⊢ ⬈*𝐒[T] L1 →
32       ∀L2. ❪G,L1❫ ⊢ ⬈* L2 → G ⊢ ⬈*𝐒[T] L2.
33 #G #L1 #T #HL1 #L2 #H @(lpxs_ind_dx … H) -L2
34 /2 width=3 by rsx_lpx_trans/
35 qed-.
36
37 (* Eliminators with extended rt-computation for full local environments *****)
38
39 lemma rsx_ind_lpxs_reqx (G) (T) (Q:predicate lenv):
40       (∀L1. G ⊢ ⬈*𝐒[T] L1 →
41         (∀L2. ❪G,L1❫ ⊢ ⬈* L2 → (L1 ≛[T] L2 → ⊥) → Q L2) →
42         Q L1
43       ) →
44       ∀L1. G ⊢ ⬈*𝐒[T] L1 →
45       ∀L0. ❪G,L1❫ ⊢ ⬈* L0 → ∀L2. L0 ≛[T] L2 → Q L2.
46 #G #T #Q #IH #L1 #H @(rsx_ind … H) -L1
47 #L1 #HL1 #IH1 #L0 #HL10 #L2 #HL02
48 @IH -IH /3 width=3 by rsx_lpxs_trans, rsx_reqx_trans/ -HL1 #K2 #HLK2 #HnLK2
49 lapply (reqx_rneqx_trans … HL02 … HnLK2) -HnLK2 #H
50 elim (reqx_lpxs_trans … HLK2 … HL02) -L2 #K0 #HLK0 #HK02
51 lapply (rneqx_reqx_canc_dx … H … HK02) -H #HnLK0
52 elim (reqx_dec L1 L0 T) #H
53 [ lapply (reqx_rneqx_trans … H … HnLK0) -H -HnLK0 #Hn10
54   lapply (lpxs_trans … HL10 … HLK0) -L0 #H10
55   elim (lpxs_rneqx_inv_step_sn … H10 …  Hn10) -H10 -Hn10
56   /3 width=8 by reqx_trans/
57 | elim (lpxs_rneqx_inv_step_sn … HL10 … H) -HL10 -H #L #K #HL1 #HnL1 #HLK #HKL0
58   elim (reqx_lpxs_trans … HLK0 … HKL0) -L0
59   /3 width=8 by lpxs_trans, reqx_trans/
60 ]
61 qed-.
62
63 (* Basic_2A1: uses: lsx_ind_alt *)
64 lemma rsx_ind_lpxs (G) (T) (Q:predicate lenv):
65       (∀L1. G ⊢ ⬈*𝐒[T] L1 →
66         (∀L2. ❪G,L1❫ ⊢ ⬈* L2 → (L1 ≛[T] L2 → ⊥) → Q L2) →
67         Q L1
68       ) →
69       ∀L. G ⊢ ⬈*𝐒[T] L → Q L.
70 #G #T #Q #IH #L #HL
71 @(rsx_ind_lpxs_reqx … IH … HL) -IH -HL // (**) (* full auto fails *)
72 qed-.
73
74 (* Advanced properties ******************************************************)
75
76 fact rsx_bind_lpxs_aux (G):
77      ∀p,I,L1,V. G ⊢ ⬈*𝐒[V] L1 →
78      ∀Y,T. G ⊢ ⬈*𝐒[T] Y →
79      ∀L2. Y = L2.ⓑ[I]V → ❪G,L1❫ ⊢ ⬈* L2 →
80      G ⊢ ⬈*𝐒[ⓑ[p,I]V.T] L2.
81 #G #p #I #L1 #V #H @(rsx_ind_lpxs … H) -L1
82 #L1 #_ #IHL1 #Y #T #H @(rsx_ind_lpxs … H) -Y
83 #Y #HY #IHY #L2 #H #HL12 destruct
84 @rsx_intro_lpxs #L0 #HL20
85 lapply (lpxs_trans … HL12 … HL20) #HL10 #H
86 elim (rneqx_inv_bind … H) -H [ -IHY | -HY -IHL1 -HL12 ]
87 [ #HnV elim (reqx_dec L1 L2 V)
88   [ #HV @(IHL1 … HL10) -IHL1 -HL12 -HL10
89     /3 width=4 by rsx_lpxs_trans, lpxs_bind_refl_dx, reqx_canc_sn/ (**) (* full auto too slow *)
90   | -HnV -HL10 /4 width=4 by rsx_lpxs_trans, lpxs_bind_refl_dx/
91   ]
92 | /3 width=4 by lpxs_bind_refl_dx/
93 ]
94 qed-.
95
96 (* Basic_2A1: uses: lsx_bind *)
97 lemma rsx_bind (G):
98       ∀p,I,L,V. G ⊢ ⬈*𝐒[V] L →
99       ∀T. G ⊢ ⬈*𝐒[T] L.ⓑ[I]V →
100       G ⊢ ⬈*𝐒[ⓑ[p,I]V.T] L.
101 /2 width=3 by rsx_bind_lpxs_aux/ qed.
102
103 (* Basic_2A1: uses: lsx_flat_lpxs *)
104 lemma rsx_flat_lpxs (G):
105       ∀I,L1,V. G ⊢ ⬈*𝐒[V] L1 →
106       ∀L2,T. G ⊢ ⬈*𝐒[T] L2 → ❪G,L1❫ ⊢ ⬈* L2 →
107       G ⊢ ⬈*𝐒[ⓕ[I]V.T] L2.
108 #G #I #L1 #V #H @(rsx_ind_lpxs … H) -L1
109 #L1 #HL1 #IHL1 #L2 #T #H @(rsx_ind_lpxs … H) -L2
110 #L2 #HL2 #IHL2 #HL12 @rsx_intro_lpxs
111 #L0 #HL20 lapply (lpxs_trans … HL12 … HL20)
112 #HL10 #H elim (rneqx_inv_flat … H) -H [ -HL1 -IHL2 | -HL2 -IHL1 ]
113 [ #HnV elim (reqx_dec L1 L2 V)
114   [ #HV @(IHL1 … HL10) -IHL1 -HL12 -HL10
115     /3 width=5 by rsx_lpxs_trans, reqx_canc_sn/ (**) (* full auto too slow: 47s *)
116   | -HnV -HL10 /3 width=4 by rsx_lpxs_trans/
117   ]
118 | /3 width=3 by/
119 ]
120 qed-.
121
122 (* Basic_2A1: uses: lsx_flat *)
123 lemma rsx_flat (G):
124       ∀I,L,V. G ⊢ ⬈*𝐒[V] L →
125       ∀T. G ⊢ ⬈*𝐒[T] L → G ⊢ ⬈*𝐒[ⓕ[I]V.T] L.
126 /2 width=3 by rsx_flat_lpxs/ qed.
127
128 fact rsx_bind_lpxs_void_aux (G):
129      ∀p,I,L1,V. G ⊢ ⬈*𝐒[V] L1 →
130      ∀Y,T. G ⊢ ⬈*𝐒[T] Y →
131      ∀L2. Y = L2.ⓧ → ❪G,L1❫ ⊢ ⬈* L2 →
132      G ⊢ ⬈*𝐒[ⓑ[p,I]V.T] L2.
133 #G #p #I #L1 #V #H @(rsx_ind_lpxs … H) -L1
134 #L1 #_ #IHL1 #Y #T #H @(rsx_ind_lpxs … H) -Y
135 #Y #HY #IHY #L2 #H #HL12 destruct
136 @rsx_intro_lpxs #L0 #HL20
137 lapply (lpxs_trans … HL12 … HL20) #HL10 #H
138 elim (rneqx_inv_bind_void … H) -H [ -IHY | -HY -IHL1 -HL12 ]
139 [ #HnV elim (reqx_dec L1 L2 V)
140   [ #HV @(IHL1 … HL10) -IHL1 -HL12 -HL10
141     /3 width=6 by rsx_lpxs_trans, lpxs_bind_refl_dx, reqx_canc_sn/ (**) (* full auto too slow *)
142   | -HnV -HL10 /4 width=4 by rsx_lpxs_trans, lpxs_bind_refl_dx/
143   ]
144 | /3 width=4 by lpxs_bind_refl_dx/
145 ]
146 qed-.
147
148 lemma rsx_bind_void (G):
149       ∀p,I,L,V. G ⊢ ⬈*𝐒[V] L →
150       ∀T. G ⊢ ⬈*𝐒[T] L.ⓧ →
151       G ⊢ ⬈*𝐒[ⓑ[p,I]V.T] L.
152 /2 width=3 by rsx_bind_lpxs_void_aux/ qed.