]> matita.cs.unibo.it Git - helm.git/blob - matita/dama/lattices.ma
fix dependences for matita
[helm.git] / matita / dama / lattices.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 set "baseuri" "cic:/matita/lattices/".
16
17 include "ordered_sets.ma".
18
19 record is_lattice (C:Type) (join,meet:C→C→C) : Prop \def
20  { (* abelian semigroup properties *)
21    l_comm_j: symmetric ? join;
22    l_associative_j: associative ? join;
23    l_comm_m: symmetric ? meet;
24    l_associative_m: associative ? meet;
25    (* other properties *)
26    l_adsorb_j_m: ∀f,g:C. join f (meet f g) = f;
27    l_adsorb_m_j: ∀f,g:C. meet f (join f g) = f
28  }.
29
30 record lattice : Type \def
31  { l_carrier:> Type;
32    l_join: l_carrier→l_carrier→l_carrier;
33    l_meet: l_carrier→l_carrier→l_carrier;
34    l_lattice_properties:> is_lattice ? l_join l_meet
35  }.
36
37 interpretation "Lattice meet" 'and a b =
38  (cic:/matita/lattices/l_meet.con _ a b).
39
40 interpretation "Lattice join" 'or a b =
41  (cic:/matita/lattices/l_join.con _ a b).
42
43 definition le \def λL:lattice.λf,g:L. (f ∧ g) = f.
44
45 definition ordered_set_of_lattice: lattice → ordered_set.
46  intros (L);
47  apply mk_ordered_set;
48   [2: apply (le L)
49   | skip
50   | apply mk_is_order_relation;
51      [ unfold reflexive;
52        intros;
53        unfold;
54        rewrite < (l_adsorb_j_m ? ? ? L ? x) in ⊢ (? ? (? ? ? %) ?);
55        rewrite > l_adsorb_m_j;
56         [ reflexivity
57         | apply (l_lattice_properties L)
58         ]
59      | intros;
60        unfold transitive;
61        unfold le;
62        intros;
63        rewrite < H;
64        rewrite > (l_associative_m ? ? ? L);
65        rewrite > H1;
66        reflexivity
67      | unfold antisimmetric;
68        unfold le;
69        intros;
70        rewrite < H;
71        rewrite > (l_comm_m ? ? ? L);
72        assumption
73      ]
74   ]
75 qed.
76
77 coercion cic:/matita/lattices/ordered_set_of_lattice.con.