]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambda-delta/Basic-2/grammar/leq.ma
refactoring ...
[helm.git] / matita / matita / contribs / lambda-delta / Basic-2 / grammar / leq.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 EQUALITY ***********************************************)
18
19 inductive leq: nat → nat → relation lenv ≝
20 | leq_sort: ∀d,e. leq d e (⋆) (⋆)
21 | leq_OO:   ∀L1,L2. leq 0 0 L1 L2
22 | leq_eq:   ∀L1,L2,I,V,e. leq 0 e L1 L2 →
23             leq 0 (e + 1) (L1. 𝕓{I} V) (L2.𝕓{I} V)
24 | leq_skip: ∀L1,L2,I1,I2,V1,V2,d,e.
25             leq d e L1 L2 → leq (d + 1) e (L1. 𝕓{I1} V1) (L2. 𝕓{I2} V2)
26 .
27
28 interpretation "local environment equality" 'Eq L1 d e L2 = (leq d e L1 L2).
29
30 definition leq_repl_dx: ∀S. (lenv → relation S) → Prop ≝ λS,R.
31                         ∀L1,s1,s2. R L1 s1 s2 →
32                         ∀L2,d,e. L1 [d, e]≈ L2 → R L2 s1 s2.
33
34 (* Basic properties *********************************************************)
35
36 lemma TC_leq_repl_dx: ∀S,R. leq_repl_dx S R → leq_repl_dx S (λL. (TC … (R L))).
37 #S #R #HR #L1 #s1 #s2 #H elim H -H s2
38 [ /3 width=5/
39 | #s #s2 #_ #Hs2 #IHs1 #L2 #d #e #HL12
40   lapply (HR … Hs2 … HL12) -HR Hs2 HL12 /3/
41 ]
42 qed.
43
44 lemma leq_refl: ∀d,e,L. L [d, e] ≈ L.
45 #d elim d -d
46 [ #e elim e -e // #e #IHe #L elim L -L /2/
47 | #d #IHd #e #L elim L -L /2/
48 ]
49 qed.
50
51 lemma leq_sym: ∀L1,L2,d,e. L1 [d, e] ≈ L2 → L2 [d, e] ≈ L1.
52 #L1 #L2 #d #e #H elim H -H L1 L2 d e /2/
53 qed.
54
55 lemma leq_skip_lt: ∀L1,L2,d,e. L1 [d - 1, e] ≈ L2 → 0 < d →
56                    ∀I1,I2,V1,V2. L1. 𝕓{I1} V1 [d, e] ≈ L2. 𝕓{I2} V2.
57
58 #L1 #L2 #d #e #HL12 #Hd >(plus_minus_m_m d 1) /2/
59 qed.
60
61 (* Basic inversion lemmas ***************************************************)