]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/ground/lib/list_rcons.ma
update in ground
[helm.git] / matita / matita / contribs / lambdadelta / ground / lib / list_rcons.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/notation/functions/oplusleft_3.ma".
16 include "ground/lib/list_append.ma".
17 include "ground/generated/pull_2.ma". 
18
19 (* RIGHT CONS FOR LISTS *****************************************************)
20
21 interpretation
22   "right cons (lists)"
23   'OPlusLeft A hd tl = (list_append A hd (list_lcons A tl (list_empty A))).
24
25 (* Basic constructions ******************************************************)
26
27 lemma list_cons_comm (A):
28       ∀a. a ⨮ ⓔ = ⓔ ⨭{A} a.
29 // qed.
30
31 lemma list_cons_shift (A):
32       ∀a1,l,a2. a1 ⨮{A} l ⨭ a2 = (a1 ⨮ l) ⨭ a2.
33 // qed.
34
35 (* Advanced constructions ***************************************************)
36
37 (* Note: this is list_append_lcons_dx *)
38 lemma list_append_rcons_sn (A):
39       ∀l1,l2,a. l1 ⨁ (a ⨮ l2) = (l1 ⨭ a) ⨁{A} l2.
40 // qed.
41
42 lemma list_append_rcons_dx (A):
43       ∀l1,l2,a. l1 ⨁ l2 ⨭ a = l1 ⨁{A} (l2 ⨭ a).
44 // qed.
45
46 (* Basic inversions *********************************************************)
47
48 lemma eq_inv_list_empty_rcons (A):
49       ∀l,a. ⓔ = l⨭{A}a → ⊥.
50 #A #l #a #H
51 elim (eq_inv_list_empty_append … H) -H #_ #H destruct
52 qed-.
53
54 (* Advanced eliminations ****************************************************)
55
56 lemma list_ind_rcons (A) (Q:predicate …):
57       Q (ⓔ{A}) →
58       (∀l,a. Q l -> Q (l⨭a)) →
59       ∀l. Q l.
60 #A #Q #IH1 #IH2 #l
61 @(list_ind_append_dx … l) -l //
62 @pull_2 #l2 elim l2 -l2 //
63 #a2 #l2 #IH0 #l1 #IH /3 width=1 by/
64 qed-.