]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/ground/lib/list_eq.ma
propagating the arithmetics library, partial commit
[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 list_eq A (l1,l2:list A) on l1 ≝
21 match l1 with
22 [ list_nil        ⇒
23   match l2 with
24   [ list_nil      ⇒ ⊤
25   | list_cons _ _ ⇒ ⊥
26   ]
27 | list_cons a1 l1 ⇒
28   match l2 with
29   [ list_nil        ⇒ ⊥
30   | list_cons a2 l2 ⇒ a1 = a2 ∧ list_eq A l1 l2
31   ]
32 ].
33
34 interpretation
35   "extensional equivalence (lists)"
36   'RingEq A l1 l2 = (list_eq A l1 l2).
37
38 (* Basic constructions ******************************************************)
39
40 lemma list_eq_refl (A): reflexive … (list_eq A).
41 #A #l elim l -l /2 width=1 by conj/
42 qed.
43
44 (* Main constructions *******************************************************)
45
46 theorem eq_list_eq (A,l1,l2): l1 = l2 → l1 ≗{A} l2.
47 // qed.
48
49 (* Main inversions **********************************************************)
50
51 theorem list_eq_inv_eq (A,l1,l2): l1 ≗{A} l2 → l1 = l2.
52 #A #l1 elim l1 -l1 [| #a1 #l1 #IH ] *
53 [ //
54 | #a2 #l2 #H elim H
55 | #H elim H
56 | #a2 #l2 * #Ha #Hl /3 width=1 by eq_f2/
57 ]
58 qed-.