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