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 include "basic_2/rt_computation/lpxs_rdeq.ma".
16 include "basic_2/rt_computation/lpxs_lpxs.ma".
17 include "basic_2/rt_computation/rdsx_rdsx.ma".
19 (* STRONGLY NORMALIZING REFERRED LOCAL ENV.S FOR UNBOUND RT-TRANSITION ******)
21 (* Properties with unbound rt-computation for full local environments *******)
23 (* Basic_2A1: uses: lsx_intro_alt *)
24 lemma rdsx_intro_lpxs (h) (G):
25 ∀L1,T. (∀L2. ⦃G,L1⦄ ⊢ ⬈*[h] L2 → (L1 ≛[T] L2 → ⊥) → G ⊢ ⬈*[h,T] 𝐒⦃L2⦄) →
27 /4 width=1 by lpx_lpxs, rdsx_intro/ qed-.
29 (* Basic_2A1: uses: lsx_lpxs_trans *)
30 lemma rdsx_lpxs_trans (h) (G):
31 ∀L1,T. G ⊢ ⬈*[h,T] 𝐒⦃L1⦄ →
32 ∀L2. ⦃G,L1⦄ ⊢ ⬈*[h] L2 → G ⊢ ⬈*[h,T] 𝐒⦃L2⦄.
33 #h #G #L1 #T #HL1 #L2 #H @(lpxs_ind_dx … H) -L2
34 /2 width=3 by rdsx_lpx_trans/
37 (* Eliminators with unbound rt-computation for full local environments ******)
39 lemma rdsx_ind_lpxs_rdeq (h) (G):
40 ∀T. ∀Q:predicate lenv.
41 (∀L1. G ⊢ ⬈*[h,T] 𝐒⦃L1⦄ →
42 (∀L2. ⦃G,L1⦄ ⊢ ⬈*[h] L2 → (L1 ≛[T] L2 → ⊥) → Q L2) →
45 ∀L1. G ⊢ ⬈*[h,T] 𝐒⦃L1⦄ →
46 ∀L0. ⦃G,L1⦄ ⊢ ⬈*[h] L0 → ∀L2. L0 ≛[T] L2 → Q L2.
47 #h #G #T #Q #IH #L1 #H @(rdsx_ind … H) -L1
48 #L1 #HL1 #IH1 #L0 #HL10 #L2 #HL02
49 @IH -IH /3 width=3 by rdsx_lpxs_trans, rdsx_rdeq_trans/ -HL1 #K2 #HLK2 #HnLK2
50 lapply (rdeq_rdneq_trans … HL02 … HnLK2) -HnLK2 #H
51 elim (rdeq_lpxs_trans … HLK2 … HL02) -L2 #K0 #HLK0 #HK02
52 lapply (rdneq_rdeq_canc_dx … H … HK02) -H #HnLK0
53 elim (rdeq_dec L1 L0 T) #H
54 [ lapply (rdeq_rdneq_trans … H … HnLK0) -H -HnLK0 #Hn10
55 lapply (lpxs_trans … HL10 … HLK0) -L0 #H10
56 elim (lpxs_rdneq_inv_step_sn … H10 … Hn10) -H10 -Hn10
57 /3 width=8 by rdeq_trans/
58 | elim (lpxs_rdneq_inv_step_sn … HL10 … H) -HL10 -H #L #K #HL1 #HnL1 #HLK #HKL0
59 elim (rdeq_lpxs_trans … HLK0 … HKL0) -L0
60 /3 width=8 by lpxs_trans, rdeq_trans/
64 (* Basic_2A1: uses: lsx_ind_alt *)
65 lemma rdsx_ind_lpxs (h) (G):
66 ∀T. ∀Q:predicate lenv.
67 (∀L1. G ⊢ ⬈*[h,T] 𝐒⦃L1⦄ →
68 (∀L2. ⦃G,L1⦄ ⊢ ⬈*[h] L2 → (L1 ≛[T] L2 → ⊥) → Q L2) →
71 ∀L. G ⊢ ⬈*[h,T] 𝐒⦃L⦄ → Q L.
72 #h #G #T #Q #IH #L #HL
73 @(rdsx_ind_lpxs_rdeq … IH … HL) -IH -HL // (**) (* full auto fails *)
76 (* Advanced properties ******************************************************)
78 fact rdsx_bind_lpxs_aux (h) (G):
79 ∀p,I,L1,V. G ⊢ ⬈*[h,V] 𝐒⦃L1⦄ →
80 ∀Y,T. G ⊢ ⬈*[h,T] 𝐒⦃Y⦄ →
81 ∀L2. Y = L2.ⓑ{I}V → ⦃G,L1⦄ ⊢ ⬈*[h] L2 →
82 G ⊢ ⬈*[h,ⓑ{p,I}V.T] 𝐒⦃L2⦄.
83 #h #G #p #I #L1 #V #H @(rdsx_ind_lpxs … H) -L1
84 #L1 #_ #IHL1 #Y #T #H @(rdsx_ind_lpxs … H) -Y
85 #Y #HY #IHY #L2 #H #HL12 destruct
86 @rdsx_intro_lpxs #L0 #HL20
87 lapply (lpxs_trans … HL12 … HL20) #HL10 #H
88 elim (rdneq_inv_bind … H) -H [ -IHY | -HY -IHL1 -HL12 ]
89 [ #HnV elim (rdeq_dec L1 L2 V)
90 [ #HV @(IHL1 … HL10) -IHL1 -HL12 -HL10
91 /3 width=4 by rdsx_lpxs_trans, lpxs_bind_refl_dx, rdeq_canc_sn/ (**) (* full auto too slow *)
92 | -HnV -HL10 /4 width=4 by rdsx_lpxs_trans, lpxs_bind_refl_dx/
94 | /3 width=4 by lpxs_bind_refl_dx/
98 (* Basic_2A1: uses: lsx_bind *)
99 lemma rdsx_bind (h) (G):
100 ∀p,I,L,V. G ⊢ ⬈*[h,V] 𝐒⦃L⦄ →
101 ∀T. G ⊢ ⬈*[h,T] 𝐒⦃L.ⓑ{I}V⦄ →
102 G ⊢ ⬈*[h,ⓑ{p,I}V.T] 𝐒⦃L⦄.
103 /2 width=3 by rdsx_bind_lpxs_aux/ qed.
105 (* Basic_2A1: uses: lsx_flat_lpxs *)
106 lemma rdsx_flat_lpxs (h) (G):
107 ∀I,L1,V. G ⊢ ⬈*[h,V] 𝐒⦃L1⦄ →
108 ∀L2,T. G ⊢ ⬈*[h,T] 𝐒⦃L2⦄ → ⦃G,L1⦄ ⊢ ⬈*[h] L2 →
109 G ⊢ ⬈*[h,ⓕ{I}V.T] 𝐒⦃L2⦄.
110 #h #G #I #L1 #V #H @(rdsx_ind_lpxs … H) -L1
111 #L1 #HL1 #IHL1 #L2 #T #H @(rdsx_ind_lpxs … H) -L2
112 #L2 #HL2 #IHL2 #HL12 @rdsx_intro_lpxs
113 #L0 #HL20 lapply (lpxs_trans … HL12 … HL20)
114 #HL10 #H elim (rdneq_inv_flat … H) -H [ -HL1 -IHL2 | -HL2 -IHL1 ]
115 [ #HnV elim (rdeq_dec L1 L2 V)
116 [ #HV @(IHL1 … HL10) -IHL1 -HL12 -HL10
117 /3 width=5 by rdsx_lpxs_trans, rdeq_canc_sn/ (**) (* full auto too slow: 47s *)
118 | -HnV -HL10 /3 width=4 by rdsx_lpxs_trans/
124 (* Basic_2A1: uses: lsx_flat *)
125 lemma rdsx_flat (h) (G):
126 ∀I,L,V. G ⊢ ⬈*[h,V] 𝐒⦃L⦄ →
127 ∀T. G ⊢ ⬈*[h,T] 𝐒⦃L⦄ → G ⊢ ⬈*[h,ⓕ{I}V.T] 𝐒⦃L⦄.
128 /2 width=3 by rdsx_flat_lpxs/ qed.
130 fact rdsx_bind_lpxs_void_aux (h) (G):
131 ∀p,I,L1,V. G ⊢ ⬈*[h,V] 𝐒⦃L1⦄ →
132 ∀Y,T. G ⊢ ⬈*[h,T] 𝐒⦃Y⦄ →
133 ∀L2. Y = L2.ⓧ → ⦃G,L1⦄ ⊢ ⬈*[h] L2 →
134 G ⊢ ⬈*[h,ⓑ{p,I}V.T] 𝐒⦃L2⦄.
135 #h #G #p #I #L1 #V #H @(rdsx_ind_lpxs … H) -L1
136 #L1 #_ #IHL1 #Y #T #H @(rdsx_ind_lpxs … H) -Y
137 #Y #HY #IHY #L2 #H #HL12 destruct
138 @rdsx_intro_lpxs #L0 #HL20
139 lapply (lpxs_trans … HL12 … HL20) #HL10 #H
140 elim (rdneq_inv_bind_void … H) -H [ -IHY | -HY -IHL1 -HL12 ]
141 [ #HnV elim (rdeq_dec L1 L2 V)
142 [ #HV @(IHL1 … HL10) -IHL1 -HL12 -HL10
143 /3 width=6 by rdsx_lpxs_trans, lpxs_bind_refl_dx, rdeq_canc_sn/ (**) (* full auto too slow *)
144 | -HnV -HL10 /4 width=4 by rdsx_lpxs_trans, lpxs_bind_refl_dx/
146 | /3 width=4 by lpxs_bind_refl_dx/
150 lemma rdsx_bind_void (h) (G):
151 ∀p,I,L,V. G ⊢ ⬈*[h,V] 𝐒⦃L⦄ →
152 ∀T. G ⊢ ⬈*[h,T] 𝐒⦃L.ⓧ⦄ →
153 G ⊢ ⬈*[h,ⓑ{p,I}V.T] 𝐒⦃L⦄.
154 /2 width=3 by rdsx_bind_lpxs_void_aux/ qed.