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/rsx_rsx.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 rsx_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, rsx_intro/ qed-.
29 (* Basic_2A1: uses: lsx_lpxs_trans *)
30 lemma rsx_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 rsx_lpx_trans/
37 (* Eliminators with unbound rt-computation for full local environments ******)
39 lemma rsx_ind_lpxs_rdeq (h) (G) (T) (Q:predicate lenv):
40 (∀L1. G ⊢ ⬈*[h,T] 𝐒⦃L1⦄ →
41 (∀L2. ⦃G,L1⦄ ⊢ ⬈*[h] L2 → (L1 ≛[T] L2 → ⊥) → Q L2) →
44 ∀L1. G ⊢ ⬈*[h,T] 𝐒⦃L1⦄ →
45 ∀L0. ⦃G,L1⦄ ⊢ ⬈*[h] L0 → ∀L2. L0 ≛[T] L2 → Q L2.
46 #h #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_rdeq_trans/ -HL1 #K2 #HLK2 #HnLK2
49 lapply (rdeq_rdneq_trans … HL02 … HnLK2) -HnLK2 #H
50 elim (rdeq_lpxs_trans … HLK2 … HL02) -L2 #K0 #HLK0 #HK02
51 lapply (rdneq_rdeq_canc_dx … H … HK02) -H #HnLK0
52 elim (rdeq_dec L1 L0 T) #H
53 [ lapply (rdeq_rdneq_trans … H … HnLK0) -H -HnLK0 #Hn10
54 lapply (lpxs_trans … HL10 … HLK0) -L0 #H10
55 elim (lpxs_rdneq_inv_step_sn … H10 … Hn10) -H10 -Hn10
56 /3 width=8 by rdeq_trans/
57 | elim (lpxs_rdneq_inv_step_sn … HL10 … H) -HL10 -H #L #K #HL1 #HnL1 #HLK #HKL0
58 elim (rdeq_lpxs_trans … HLK0 … HKL0) -L0
59 /3 width=8 by lpxs_trans, rdeq_trans/
63 (* Basic_2A1: uses: lsx_ind_alt *)
64 lemma rsx_ind_lpxs (h) (G) (T) (Q:predicate lenv):
65 (∀L1. G ⊢ ⬈*[h,T] 𝐒⦃L1⦄ →
66 (∀L2. ⦃G,L1⦄ ⊢ ⬈*[h] L2 → (L1 ≛[T] L2 → ⊥) → Q L2) →
69 ∀L. G ⊢ ⬈*[h,T] 𝐒⦃L⦄ → Q L.
70 #h #G #T #Q #IH #L #HL
71 @(rsx_ind_lpxs_rdeq … IH … HL) -IH -HL // (**) (* full auto fails *)
74 (* Advanced properties ******************************************************)
76 fact rsx_bind_lpxs_aux (h) (G):
77 ∀p,I,L1,V. G ⊢ ⬈*[h,V] 𝐒⦃L1⦄ →
78 ∀Y,T. G ⊢ ⬈*[h,T] 𝐒⦃Y⦄ →
79 ∀L2. Y = L2.ⓑ{I}V → ⦃G,L1⦄ ⊢ ⬈*[h] L2 →
80 G ⊢ ⬈*[h,ⓑ{p,I}V.T] 𝐒⦃L2⦄.
81 #h #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 (rdneq_inv_bind … H) -H [ -IHY | -HY -IHL1 -HL12 ]
87 [ #HnV elim (rdeq_dec L1 L2 V)
88 [ #HV @(IHL1 … HL10) -IHL1 -HL12 -HL10
89 /3 width=4 by rsx_lpxs_trans, lpxs_bind_refl_dx, rdeq_canc_sn/ (**) (* full auto too slow *)
90 | -HnV -HL10 /4 width=4 by rsx_lpxs_trans, lpxs_bind_refl_dx/
92 | /3 width=4 by lpxs_bind_refl_dx/
96 (* Basic_2A1: uses: lsx_bind *)
97 lemma rsx_bind (h) (G):
98 ∀p,I,L,V. G ⊢ ⬈*[h,V] 𝐒⦃L⦄ →
99 ∀T. G ⊢ ⬈*[h,T] 𝐒⦃L.ⓑ{I}V⦄ →
100 G ⊢ ⬈*[h,ⓑ{p,I}V.T] 𝐒⦃L⦄.
101 /2 width=3 by rsx_bind_lpxs_aux/ qed.
103 (* Basic_2A1: uses: lsx_flat_lpxs *)
104 lemma rsx_flat_lpxs (h) (G):
105 ∀I,L1,V. G ⊢ ⬈*[h,V] 𝐒⦃L1⦄ →
106 ∀L2,T. G ⊢ ⬈*[h,T] 𝐒⦃L2⦄ → ⦃G,L1⦄ ⊢ ⬈*[h] L2 →
107 G ⊢ ⬈*[h,ⓕ{I}V.T] 𝐒⦃L2⦄.
108 #h #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 (rdneq_inv_flat … H) -H [ -HL1 -IHL2 | -HL2 -IHL1 ]
113 [ #HnV elim (rdeq_dec L1 L2 V)
114 [ #HV @(IHL1 … HL10) -IHL1 -HL12 -HL10
115 /3 width=5 by rsx_lpxs_trans, rdeq_canc_sn/ (**) (* full auto too slow: 47s *)
116 | -HnV -HL10 /3 width=4 by rsx_lpxs_trans/
122 (* Basic_2A1: uses: lsx_flat *)
123 lemma rsx_flat (h) (G):
124 ∀I,L,V. G ⊢ ⬈*[h,V] 𝐒⦃L⦄ →
125 ∀T. G ⊢ ⬈*[h,T] 𝐒⦃L⦄ → G ⊢ ⬈*[h,ⓕ{I}V.T] 𝐒⦃L⦄.
126 /2 width=3 by rsx_flat_lpxs/ qed.
128 fact rsx_bind_lpxs_void_aux (h) (G):
129 ∀p,I,L1,V. G ⊢ ⬈*[h,V] 𝐒⦃L1⦄ →
130 ∀Y,T. G ⊢ ⬈*[h,T] 𝐒⦃Y⦄ →
131 ∀L2. Y = L2.ⓧ → ⦃G,L1⦄ ⊢ ⬈*[h] L2 →
132 G ⊢ ⬈*[h,ⓑ{p,I}V.T] 𝐒⦃L2⦄.
133 #h #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 (rdneq_inv_bind_void … H) -H [ -IHY | -HY -IHL1 -HL12 ]
139 [ #HnV elim (rdeq_dec L1 L2 V)
140 [ #HV @(IHL1 … HL10) -IHL1 -HL12 -HL10
141 /3 width=6 by rsx_lpxs_trans, lpxs_bind_refl_dx, rdeq_canc_sn/ (**) (* full auto too slow *)
142 | -HnV -HL10 /4 width=4 by rsx_lpxs_trans, lpxs_bind_refl_dx/
144 | /3 width=4 by lpxs_bind_refl_dx/
148 lemma rsx_bind_void (h) (G):
149 ∀p,I,L,V. G ⊢ ⬈*[h,V] 𝐒⦃L⦄ →
150 ∀T. G ⊢ ⬈*[h,T] 𝐒⦃L.ⓧ⦄ →
151 G ⊢ ⬈*[h,ⓑ{p,I}V.T] 𝐒⦃L⦄.
152 /2 width=3 by rsx_bind_lpxs_void_aux/ qed.