]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/syntax/lenv.ma
- degree-based equivalene for terms
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / syntax / lenv.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/notation/constructors/star_0.ma".
16 include "basic_2/notation/constructors/dxbind2_3.ma".
17 include "basic_2/notation/constructors/dxabbr_2.ma".
18 include "basic_2/notation/constructors/dxabst_2.ma".
19 include "basic_2/syntax/term.ma".
20
21 (* LOCAL ENVIRONMENTS *******************************************************)
22
23 (* local environments *)
24 inductive lenv: Type[0] ≝
25 | LAtom: lenv                       (* empty *)
26 | LPair: lenv → bind2 → term → lenv (* binary binding construction *)
27 .
28
29 interpretation "sort (local environment)"
30    'Star = LAtom.
31
32 interpretation "local environment binding construction (binary)"
33    'DxBind2 L I T = (LPair L I T).
34
35 interpretation "abbreviation (local environment)"
36    'DxAbbr L T = (LPair L Abbr T).
37
38 interpretation "abstraction (local environment)"
39    'DxAbst L T = (LPair L Abst T).
40
41 definition ceq: relation3 lenv term term ≝ λL,T1,T2. T1 = T2.
42
43 definition cfull: relation3 lenv term term ≝ λL,T1,T2. ⊤.
44
45 (* Basic properties *********************************************************)
46
47 lemma eq_lenv_dec: ∀L1,L2:lenv. Decidable (L1 = L2).
48 #L1 elim L1 -L1 [| #L1 #I1 #V1 #IHL1 ] * [2,4: #L2 #I2 #V2 ]
49 [1,4: @or_intror #H destruct
50 | elim (eq_bind2_dec I1 I2) #HI
51   [ elim (eq_term_dec V1 V2) #HV
52     [ elim (IHL1 L2) -IHL1 /2 width=1 by or_introl/ #HL ]
53   ]
54   @or_intror #H destruct /2 width=1 by/
55 | /2 width=1 by or_introl/
56 ]
57 qed-.
58
59 (* Basic inversion lemmas ***************************************************)
60
61 fact destruct_lpair_lpair_aux: ∀I1,I2,L1,L2,V1,V2. L1.ⓑ{I1}V1 = L2.ⓑ{I2}V2 →
62                                ∧∧L1 = L2 & I1 = I2 & V1 = V2.
63 #I1 #I2 #L1 #L2 #V1 #V2 #H destruct /2 width=1 by and3_intro/
64 qed-.
65
66 lemma discr_lpair_x_xy: ∀I,V,L. L = L.ⓑ{I}V → ⊥.
67 #I #V #L elim L -L
68 [ #H destruct
69 | #L #J #W #IHL #H
70   elim (destruct_lpair_lpair_aux … H) -H #H1 #H2 #H3 destruct /2 width=1 by/ (**) (* destruct lemma needed *)
71 ]
72 qed-.
73
74 lemma discr_lpair_xy_x: ∀I,V,L. L.ⓑ{I}V = L→ ⊥.
75 /2 width=4 by discr_lpair_x_xy/ qed-.