]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/etc/leq/leq.etc
- extended multiple substitutions now uses bounds in ynat (ie. they
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / etc / leq / leq.etc
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 notation "hvbox( T1 break [ d , break e ] ≈ break T2 )"
20    non associative with precedence 45
21    for @{ 'Eq $T1 $d $e $T2 }.
22
23 inductive leq: nat → nat → relation lenv ≝
24 | leq_sort: ∀d,e. leq d e (⋆) (⋆)
25 | leq_OO:   ∀L1,L2. leq 0 0 L1 L2
26 | leq_eq:   ∀L1,L2,I,V,e. leq 0 e L1 L2 →
27             leq 0 (e + 1) (L1. 𝕓{I} V) (L2.𝕓{I} V)
28 | leq_skip: ∀L1,L2,I1,I2,V1,V2,d,e.
29             leq d e L1 L2 → leq (d + 1) e (L1. 𝕓{I1} V1) (L2. 𝕓{I2} V2)
30 .
31
32 interpretation "local environment equality" 'Eq L1 d e L2 = (leq d e L1 L2).
33
34 definition leq_repl_dx: ∀S. (lenv → relation S) → Prop ≝ λS,R.
35                         ∀L1,s1,s2. R L1 s1 s2 →
36                         ∀L2,d,e. L1 [d, e]≈ L2 → R L2 s1 s2.
37
38 (* Basic properties *********************************************************)
39
40 lemma TC_leq_repl_dx: ∀S,R. leq_repl_dx S R → leq_repl_dx S (λL. (TC … (R L))).
41 #S #R #HR #L1 #s1 #s2 #H elim H -H s2
42 [ /3 width=5/
43 | #s #s2 #_ #Hs2 #IHs1 #L2 #d #e #HL12
44   lapply (HR … Hs2 … HL12) -HR Hs2 HL12 /3/
45 ]
46 qed.
47
48 lemma leq_refl: ∀d,e,L. L [d, e] ≈ L.
49 #d elim d -d
50 [ #e elim e -e // #e #IHe #L elim L -L /2/
51 | #d #IHd #e #L elim L -L /2/
52 ]
53 qed.
54
55 lemma leq_sym: ∀L1,L2,d,e. L1 [d, e] ≈ L2 → L2 [d, e] ≈ L1.
56 #L1 #L2 #d #e #H elim H -H L1 L2 d e /2/
57 qed.
58
59 lemma leq_skip_lt: ∀L1,L2,d,e. L1 [d - 1, e] ≈ L2 → 0 < d →
60                    ∀I1,I2,V1,V2. L1. 𝕓{I1} V1 [d, e] ≈ L2. 𝕓{I2} V2.
61
62 #L1 #L2 #d #e #HL12 #Hd >(plus_minus_m_m d 1) /2/
63 qed.
64
65 (* Basic inversion lemmas ***************************************************)