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 "ground/arith/nat_succ.ma".
16 include "static_2/syntax/lenv.ma".
18 (* LENGTH OF A LOCAL ENVIRONMENT ********************************************)
20 rec definition length L ≝ match L with
22 | LBind L _ ⇒ ↑(length L)
25 interpretation "length (local environment)" 'card L = (length L).
27 (* Basic properties *********************************************************)
29 lemma length_atom: |⋆| = 𝟎.
32 (* Basic_2A1: uses: length_pair *)
33 lemma length_bind: ∀I,L. |L.ⓘ[I]| = ↑|L|.
36 (* Basic inversion lemmas ***************************************************)
38 lemma length_inv_zero_dx: ∀L. |L| = 𝟎 → L = ⋆.
41 elim (eq_inv_nsucc_zero … H)
44 lemma length_inv_zero_sn: ∀L. 𝟎 = |L| → L = ⋆.
45 /2 width=1 by length_inv_zero_dx/ qed-.
47 (* Basic_2A1: was: length_inv_pos_dx *)
48 lemma length_inv_succ_dx: ∀n,L. |L| = ↑n →
49 ∃∃I,K. |K| = n & L = K. ⓘ[I].
52 elim (eq_inv_zero_nsucc … H)
54 /3 width=4 by ex2_2_intro, eq_inv_nsucc_bi/
58 (* Basic_2A1: was: length_inv_pos_sn *)
59 lemma length_inv_succ_sn: ∀n,L. ↑n = |L| →
60 ∃∃I,K. n = |K| & L = K. ⓘ[I].
61 #n #L #H lapply (sym_eq ??? H) -H
62 #H elim (length_inv_succ_dx … H) -H /2 width=4 by ex2_2_intro/
65 (* Basic_2A1: removed theorems 1: length_inj *)