1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 include "basic_2/grammar/lenv.ma".
17 (* LENGTH OF A LOCAL ENVIRONMENT ********************************************)
19 rec definition length L ≝ match L with
21 | LPair L _ _ ⇒ ⫯(length L)
24 interpretation "length (local environment)" 'card L = (length L).
26 (* Basic properties *********************************************************)
28 lemma length_atom: |⋆| = 0.
31 lemma length_pair: ∀I,L,V. |L.ⓑ{I}V| = ⫯|L|.
34 (* Basic inversion lemmas ***************************************************)
36 lemma length_inv_zero_dx: ∀L. |L| = 0 → L = ⋆.
37 * // #L #I #V >length_pair
41 lemma length_inv_zero_sn: ∀L. 0 = |L| → L = ⋆.
42 /2 width=1 by length_inv_zero_dx/ qed-.
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 * /3 width=5 by injective_S, ex2_3_intro/
48 >length_atom #H destruct
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/
58 (* Basic_2A1: removed theorems 1: length_inj *)