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