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/grammar/lenv_length.ma".
17 (* LOCAL ENVIRONMENT REFINEMENT FOR SUBSTITUTION ****************************)
19 inductive lsubs: nat → nat → relation lenv ≝
20 | lsubs_sort: ∀d,e. lsubs d e (⋆) (⋆)
21 | lsubs_OO: ∀L1,L2. lsubs 0 0 L1 L2
22 | lsubs_abbr: ∀L1,L2,V,e. lsubs 0 e L1 L2 →
23 lsubs 0 (e + 1) (L1. 𝕓{Abbr} V) (L2.𝕓{Abbr} V)
24 | lsubs_abst: ∀L1,L2,I,V1,V2,e. lsubs 0 e L1 L2 →
25 lsubs 0 (e + 1) (L1. 𝕓{Abst} V1) (L2.𝕓{I} V2)
26 | lsubs_skip: ∀L1,L2,I1,I2,V1,V2,d,e.
27 lsubs d e L1 L2 → lsubs (d + 1) e (L1. 𝕓{I1} V1) (L2. 𝕓{I2} V2)
30 interpretation "local environment refinement (substitution)" 'SubEq L1 d e L2 = (lsubs d e L1 L2).
32 definition lsubs_conf: ∀S. (lenv → relation S) → Prop ≝ λS,R.
33 ∀L1,s1,s2. R L1 s1 s2 →
34 ∀L2,d,e. L1 [d, e] ≼ L2 → R L2 s1 s2.
36 (* Basic properties *********************************************************)
38 lemma TC_lsubs_conf: ∀S,R. lsubs_conf S R → lsubs_conf S (λL. (TC … (R L))).
39 #S #R #HR #L1 #s1 #s2 #H elim H -H s2
41 | #s #s2 #_ #Hs2 #IHs1 #L2 #d #e #HL12
42 lapply (HR … Hs2 … HL12) -HR Hs2 HL12 /3/
46 lemma lsubs_eq: ∀L1,L2,e. L1 [0, e] ≼ L2 → ∀I,V.
47 L1. 𝕓{I} V [0, e + 1] ≼ L2.𝕓{I} V.
48 #L1 #L2 #e #HL12 #I #V elim I -I /2/
51 lemma lsubs_refl: ∀d,e,L. L [d, e] ≼ L.
53 [ #e elim e -e // #e #IHe #L elim L -L /2/
54 | #d #IHd #e #L elim L -L /2/
58 lemma lsubs_skip_lt: ∀L1,L2,d,e. L1 [d - 1, e] ≼ L2 → 0 < d →
59 ∀I1,I2,V1,V2. L1. 𝕓{I1} V1 [d, e] ≼ L2. 𝕓{I2} V2.
61 #L1 #L2 #d #e #HL12 #Hd >(plus_minus_m_m d 1) /2/
64 (* Basic inversion lemmas ***************************************************)