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