]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/syntax/lenv_length.ma
- degree-based equivalene for terms
[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 | LPair 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 lemma length_pair: ∀I,L,V. |L.ⓑ{I}V| = ⫯|L|.
32 // qed.
33
34 (* Basic inversion lemmas ***************************************************)
35
36 lemma length_inv_zero_dx: ∀L. |L| = 0 → L = ⋆.
37 * // #L #I #V >length_pair
38 #H destruct
39 qed-.
40
41 lemma length_inv_zero_sn: ∀L. 0 = |L| → L = ⋆.
42 /2 width=1 by length_inv_zero_dx/ qed-.
43
44 (* Basic_2A1: was: length_inv_pos_dx *)
45 lemma length_inv_succ_dx: ∀n,L. |L| = ⫯n →
46                           ∃∃I,K,V. |K| = n & L = K. ⓑ{I}V.
47 #n * [ >length_atom #H destruct ]
48 #L #I #V >length_pair /3 width=5 by ex2_3_intro, injective_S/
49 qed-.
50
51 (* Basic_2A1: was: length_inv_pos_sn *)
52 lemma length_inv_succ_sn: ∀n,L. ⫯n = |L| →
53                           ∃∃I,K,V. n = |K| & L = K. ⓑ{I}V.
54 #l #L #H lapply (sym_eq ??? H) -H 
55 #H elim (length_inv_succ_dx … H) -H /2 width=5 by ex2_3_intro/
56 qed-.
57
58 (* Basic_2A1: removed theorems 1: length_inj *)