]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2A/grammar/lenv_length.ma
milestone update in ground_2 and basic_2A
[helm.git] / matita / matita / contribs / lambdadelta / basic_2A / grammar / 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 "ground_2/xoa/ex_2_3.ma".
16 include "basic_2A/grammar/lenv.ma".
17
18 (* LENGTH OF A LOCAL ENVIRONMENT ********************************************)
19
20 let rec length L ≝ match L with
21 [ LAtom       ⇒ 0
22 | LPair L _ _ ⇒ length L + 1
23 ].
24
25 interpretation "length (local environment)" 'card L = (length L).
26
27 (* Basic inversion lemmas ***************************************************)
28
29 lemma length_inv_zero_dx: ∀L. |L| = 0 → L = ⋆.
30 * // #L #I #V normalize <plus_n_Sm #H destruct
31 qed-.
32
33 lemma length_inv_zero_sn: ∀L. 0 = |L| → L = ⋆.
34 * // #L #I #V normalize <plus_n_Sm #H destruct
35 qed-.
36
37 lemma length_inv_pos_dx: ∀l,L. |L| = l + 1 →
38                          ∃∃I,K,V. |K| = l & L = K. ⓑ{I}V.
39 #l *
40 [ normalize <plus_n_Sm #H destruct
41 | #K #I #V #H
42   lapply (injective_plus_l … H) -H /2 width=5 by ex2_3_intro/
43 ]
44 qed-.
45
46 lemma length_inv_pos_sn: ∀l,L. l + 1 = |L| →
47                          ∃∃I,K,V. l = |K| & L = K. ⓑ{I}V.
48 #l *
49 [ normalize <plus_n_Sm #H destruct
50 | #K #I #V #H
51   lapply (injective_plus_l … H) -H /2 width=5 by ex2_3_intro/
52 ]
53 qed-.