]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/ground/lib/list_eq.ma
6f89d187f16bc09ec3f438eac960a7b9bb885dba
[helm.git] / matita / matita / contribs / lambdadelta / ground / lib / list_eq.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/relations/ringeq_3.ma".
16 include "ground/lib/list.ma".
17
18 (* EXTENSIONAL EQUIVALENCE OF LISTS *****************************************)
19
20 rec definition eq_list A (l1,l2:list A) on l1 ≝
21 match l1 with
22 [ nil        ⇒
23   match l2 with
24   [ nil      ⇒ ⊤
25   | cons _ _ ⇒ ⊥
26   ]
27 | cons a1 l1 ⇒
28   match l2 with
29   [ nil        ⇒ ⊥
30   | cons a2 l2 ⇒ a1 = a2 ∧ eq_list A l1 l2
31   ]
32 ].
33
34 interpretation "extensional equivalence (list)"
35    'RingEq A l1 l2 = (eq_list A l1 l2).
36
37 (* Basic properties *********************************************************)
38
39 lemma eq_list_refl (A): reflexive … (eq_list A).
40 #A #l elim l -l /2 width=1 by conj/
41 qed.
42
43 (* Main properties **********************************************************)
44
45 theorem eq_eq_list (A,l1,l2): l1 = l2 → l1 ≗{A} l2.
46 // qed.
47
48 (* Main inversion propertiess ***********************************************)
49
50 theorem eq_list_inv_eq (A,l1,l2): l1 ≗{A} l2 → l1 = l2.
51 #A #l1 elim l1 -l1 [| #a1 #l1 #IH ] *
52 [ //
53 | #a2 #l2 #H elim H
54 | #H elim H
55 | #a2 #l2 * #Ha #Hl /3 width=1 by eq_f2/
56 ]
57 qed-.