]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambda_delta/Basic_2/grammar/lsubs.ma
refactoring completed!
[helm.git] / matita / matita / contribs / lambda_delta / Basic_2 / grammar / lsubs.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/grammar/lenv_length.ma".
16
17 (* LOCAL ENVIRONMENT REFINEMENT FOR SUBSTITUTION ****************************)
18
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)
28 .
29
30 interpretation "local environment refinement (substitution)" 'SubEq L1 d e L2 = (lsubs d e L1 L2).
31
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.
35
36 (* Basic properties *********************************************************)
37
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
40 [ /3 width=5/
41 | #s #s2 #_ #Hs2 #IHs1 #L2 #d #e #HL12
42   lapply (HR … Hs2 … HL12) -HR Hs2 HL12 /3/
43 ]
44 qed.
45
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/
49 qed.
50
51 lemma lsubs_refl: ∀d,e,L. L [d, e] ≼ L.
52 #d elim d -d
53 [ #e elim e -e // #e #IHe #L elim L -L /2/
54 | #d #IHd #e #L elim L -L /2/
55 ]
56 qed.
57
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.
60
61 #L1 #L2 #d #e #HL12 #Hd >(plus_minus_m_m d 1) /2/
62 qed.
63
64 (* Basic inversion lemmas ***************************************************)