]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/grammar/lenv.ma
80738ebbde5c366fa3ec33662696af5898d44aa0
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / grammar / 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/grammar/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 (* Basic properties *********************************************************)
42
43 lemma eq_lenv_dec: ∀L1,L2:lenv. Decidable (L1 = L2).
44 #L1 elim L1 -L1 [| #L1 #I1 #V1 #IHL1 ] * [2,4: #L2 #I2 #V2 ]
45 [1,4: @or_intror #H destruct
46 | elim (eq_bind2_dec I1 I2) #HI
47   [ elim (eq_term_dec V1 V2) #HV
48     [ elim (IHL1 L2) -IHL1 /2 width=1 by or_introl/ #HL ]
49   ]
50   @or_intror #H destruct /2 width=1 by/
51 | /2 width=1 by or_introl/
52 ]
53 qed-.
54
55 (* Basic inversion lemmas ***************************************************)
56
57 fact destruct_lpair_lpair_aux: ∀I1,I2,L1,L2,V1,V2. L1.ⓑ{I1}V1 = L2.ⓑ{I2}V2 →
58                                ∧∧L1 = L2 & I1 = I2 & V1 = V2.
59 #I1 #I2 #L1 #L2 #V1 #V2 #H destruct /2 width=1 by and3_intro/
60 qed-.
61
62 lemma discr_lpair_x_xy: ∀I,V,L. L = L.ⓑ{I}V → ⊥.
63 #I #V #L elim L -L
64 [ #H destruct
65 | #L #J #W #IHL #H
66   elim (destruct_lpair_lpair_aux … H) -H #H1 #H2 #H3 destruct /2 width=1 by/ (**) (* destruct lemma needed *)
67 ]
68 qed-.
69
70 lemma discr_lpair_xy_x: ∀I,V,L. L.ⓑ{I}V = L→ ⊥.
71 /2 width=4 by discr_lpair_x_xy/ qed-.