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 "static_2/syntax/lenv.ma".
17 (* LENGTH OF A LOCAL ENVIRONMENT ********************************************)
19 rec definition length L ≝ match L with
21 | LBind L _ ⇒ ↑(length L)
24 interpretation "length (local environment)" 'card L = (length L).
26 (* Basic properties *********************************************************)
28 lemma length_atom: |⋆| = 0.
31 (* Basic_2A1: uses: length_pair *)
32 lemma length_bind: ∀I,L. |L.ⓘ{I}| = ↑|L|.
35 (* Basic inversion lemmas ***************************************************)
37 lemma length_inv_zero_dx: ∀L. |L| = 0 → L = ⋆.
38 * // #L #I >length_bind
42 lemma length_inv_zero_sn: ∀L. 0 = |L| → L = ⋆.
43 /2 width=1 by length_inv_zero_dx/ qed-.
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}.
49 [ >length_atom #H destruct
50 | #L #I >length_bind /3 width=4 by ex2_2_intro, injective_S/
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/
61 (* Basic_2A1: removed theorems 1: length_inj *)