]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/syntax/lenv_length.ma
renaming in basic_2
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / syntax / lenv_length.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/syntax/lenv.ma".
16
17 (* LENGTH OF A LOCAL ENVIRONMENT ********************************************)
18
19 rec definition length L ≝ match L with
20 [ LAtom     ⇒ 0
21 | LBind L _ ⇒ ↑(length L)
22 ].
23
24 interpretation "length (local environment)" 'card L = (length L).
25
26 (* Basic properties *********************************************************)
27
28 lemma length_atom: |⋆| = 0.
29 // qed.
30
31 (* Basic_2A1: uses: length_pair *)
32 lemma length_bind: ∀I,L. |L.ⓘ{I}| = ↑|L|.
33 // qed.
34
35 (* Basic inversion lemmas ***************************************************)
36
37 lemma length_inv_zero_dx: ∀L. |L| = 0 → L = ⋆.
38 * // #L #I >length_bind
39 #H destruct
40 qed-.
41
42 lemma length_inv_zero_sn: ∀L. 0 = |L| → L = ⋆.
43 /2 width=1 by length_inv_zero_dx/ qed-.
44
45 (* Basic_2A1: was: length_inv_pos_dx *)
46 lemma length_inv_succ_dx: ∀n,L. |L| = ↑n →
47                           ∃∃I,K. |K| = n & L = K. ⓘ{I}.
48 #n *
49 [ >length_atom #H destruct
50 | #L #I >length_bind /3 width=4 by ex2_2_intro, injective_S/
51 ]
52 qed-.
53
54 (* Basic_2A1: was: length_inv_pos_sn *)
55 lemma length_inv_succ_sn: ∀n,L. ↑n = |L| →
56                           ∃∃I,K. n = |K| & L = K. ⓘ{I}.
57 #n #L #H lapply (sym_eq ??? H) -H 
58 #H elim (length_inv_succ_dx … H) -H /2 width=4 by ex2_2_intro/
59 qed-.
60
61 (* Basic_2A1: removed theorems 1: length_inj *)