src/HOL/Lattices.thy
author huffman
Tue, 13 Sep 2011 17:07:33 -0700
changeset 44921 58eef4843641
parent 44919 482f1807976e
child 46553 50a7e97fe653
permissions -rw-r--r--
tuned proofs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
     1
(*  Title:      HOL/Lattices.thy
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
     2
    Author:     Tobias Nipkow
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
     3
*)
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
     4
22454
c3654ba76a09 integrated with LOrder.thy
haftmann
parents: 22422
diff changeset
     5
header {* Abstract lattices *}
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
     6
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
     7
theory Lattices
35121
36c0a6dd8c6f tuned import order
haftmann
parents: 35028
diff changeset
     8
imports Orderings Groups
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
     9
begin
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
    10
35301
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    11
subsection {* Abstract semilattice *}
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    12
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    13
text {*
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    14
  This locales provide a basic structure for interpretation into
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    15
  bigger structures;  extensions require careful thinking, otherwise
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    16
  undesired effects may occur due to interpretation.
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    17
*}
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    18
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    19
locale semilattice = abel_semigroup +
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    20
  assumes idem [simp]: "f a a = a"
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    21
begin
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    22
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    23
lemma left_idem [simp]:
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    24
  "f a (f a b) = f a b"
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    25
  by (simp add: assoc [symmetric])
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    26
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    27
end
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    28
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    29
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    30
subsection {* Idempotent semigroup *}
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    31
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    32
class ab_semigroup_idem_mult = ab_semigroup_mult +
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    33
  assumes mult_idem: "x * x = x"
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    34
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    35
sublocale ab_semigroup_idem_mult < times!: semilattice times proof
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    36
qed (fact mult_idem)
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    37
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    38
context ab_semigroup_idem_mult
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    39
begin
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    40
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    41
lemmas mult_left_idem = times.left_idem
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    42
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    43
end
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    44
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    45
35724
178ad68f93ed fixed typo
haftmann
parents: 35301
diff changeset
    46
subsection {* Concrete lattices *}
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
    47
25206
9c84ec7217a9 localized monotonicity; tuned syntax
haftmann
parents: 25102
diff changeset
    48
notation
25382
72cfe89f7b21 tuned specifications of 'notation';
wenzelm
parents: 25206
diff changeset
    49
  less_eq  (infix "\<sqsubseteq>" 50) and
32568
89518a3074e1 some lemmas about strict order in lattices
haftmann
parents: 32512
diff changeset
    50
  less  (infix "\<sqsubset>" 50) and
41082
9ff94e7cc3b3 bot comes before top, inf before sup etc.
haftmann
parents: 41080
diff changeset
    51
  bot ("\<bottom>") and
9ff94e7cc3b3 bot comes before top, inf before sup etc.
haftmann
parents: 41080
diff changeset
    52
  top ("\<top>")
9ff94e7cc3b3 bot comes before top, inf before sup etc.
haftmann
parents: 41080
diff changeset
    53
44845
5e51075cbd97 added syntactic classes for "inf" and "sup"
krauss
parents: 44085
diff changeset
    54
class inf =
5e51075cbd97 added syntactic classes for "inf" and "sup"
krauss
parents: 44085
diff changeset
    55
  fixes inf :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixl "\<sqinter>" 70)
25206
9c84ec7217a9 localized monotonicity; tuned syntax
haftmann
parents: 25102
diff changeset
    56
44845
5e51075cbd97 added syntactic classes for "inf" and "sup"
krauss
parents: 44085
diff changeset
    57
class sup = 
5e51075cbd97 added syntactic classes for "inf" and "sup"
krauss
parents: 44085
diff changeset
    58
  fixes sup :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixl "\<squnion>" 65)
5e51075cbd97 added syntactic classes for "inf" and "sup"
krauss
parents: 44085
diff changeset
    59
5e51075cbd97 added syntactic classes for "inf" and "sup"
krauss
parents: 44085
diff changeset
    60
class semilattice_inf =  order + inf +
22737
haftmann
parents: 22548
diff changeset
    61
  assumes inf_le1 [simp]: "x \<sqinter> y \<sqsubseteq> x"
haftmann
parents: 22548
diff changeset
    62
  and inf_le2 [simp]: "x \<sqinter> y \<sqsubseteq> y"
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
    63
  and inf_greatest: "x \<sqsubseteq> y \<Longrightarrow> x \<sqsubseteq> z \<Longrightarrow> x \<sqsubseteq> y \<sqinter> z"
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
    64
44845
5e51075cbd97 added syntactic classes for "inf" and "sup"
krauss
parents: 44085
diff changeset
    65
class semilattice_sup = order + sup +
22737
haftmann
parents: 22548
diff changeset
    66
  assumes sup_ge1 [simp]: "x \<sqsubseteq> x \<squnion> y"
haftmann
parents: 22548
diff changeset
    67
  and sup_ge2 [simp]: "y \<sqsubseteq> x \<squnion> y"
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
    68
  and sup_least: "y \<sqsubseteq> x \<Longrightarrow> z \<sqsubseteq> x \<Longrightarrow> y \<squnion> z \<sqsubseteq> x"
26014
00c2c3525bef dual orders and dual lattices
haftmann
parents: 25510
diff changeset
    69
begin
00c2c3525bef dual orders and dual lattices
haftmann
parents: 25510
diff changeset
    70
00c2c3525bef dual orders and dual lattices
haftmann
parents: 25510
diff changeset
    71
text {* Dual lattice *}
00c2c3525bef dual orders and dual lattices
haftmann
parents: 25510
diff changeset
    72
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
    73
lemma dual_semilattice:
44845
5e51075cbd97 added syntactic classes for "inf" and "sup"
krauss
parents: 44085
diff changeset
    74
  "class.semilattice_inf sup greater_eq greater"
36635
080b755377c0 locale predicates of classes carry a mandatory "class" prefix
haftmann
parents: 36352
diff changeset
    75
by (rule class.semilattice_inf.intro, rule dual_order)
27682
25aceefd4786 added class preorder
haftmann
parents: 26794
diff changeset
    76
  (unfold_locales, simp_all add: sup_least)
26014
00c2c3525bef dual orders and dual lattices
haftmann
parents: 25510
diff changeset
    77
00c2c3525bef dual orders and dual lattices
haftmann
parents: 25510
diff changeset
    78
end
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
    79
35028
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 34973
diff changeset
    80
class lattice = semilattice_inf + semilattice_sup
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
    81
25382
72cfe89f7b21 tuned specifications of 'notation';
wenzelm
parents: 25206
diff changeset
    82
28562
4e74209f113e `code func` now just `code`
haftmann
parents: 27682
diff changeset
    83
subsubsection {* Intro and elim rules*}
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
    84
35028
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 34973
diff changeset
    85
context semilattice_inf
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
    86
begin
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
    87
32064
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
    88
lemma le_infI1:
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
    89
  "a \<sqsubseteq> x \<Longrightarrow> a \<sqinter> b \<sqsubseteq> x"
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
    90
  by (rule order_trans) auto
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
    91
32064
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
    92
lemma le_infI2:
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
    93
  "b \<sqsubseteq> x \<Longrightarrow> a \<sqinter> b \<sqsubseteq> x"
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
    94
  by (rule order_trans) auto
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
    95
32064
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
    96
lemma le_infI: "x \<sqsubseteq> a \<Longrightarrow> x \<sqsubseteq> b \<Longrightarrow> x \<sqsubseteq> a \<sqinter> b"
36008
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
    97
  by (rule inf_greatest) (* FIXME: duplicate lemma *)
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
    98
32064
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
    99
lemma le_infE: "x \<sqsubseteq> a \<sqinter> b \<Longrightarrow> (x \<sqsubseteq> a \<Longrightarrow> x \<sqsubseteq> b \<Longrightarrow> P) \<Longrightarrow> P"
36008
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   100
  by (blast intro: order_trans inf_le1 inf_le2)
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   101
21734
283461c15fa7 renaming
nipkow
parents: 21733
diff changeset
   102
lemma le_inf_iff [simp]:
32064
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
   103
  "x \<sqsubseteq> y \<sqinter> z \<longleftrightarrow> x \<sqsubseteq> y \<and> x \<sqsubseteq> z"
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
   104
  by (blast intro: le_infI elim: le_infE)
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   105
32064
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
   106
lemma le_iff_inf:
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
   107
  "x \<sqsubseteq> y \<longleftrightarrow> x \<sqinter> y = x"
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
   108
  by (auto intro: le_infI1 antisym dest: eq_iff [THEN iffD1])
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   109
43753
fe5e846c0839 tuned notation
haftmann
parents: 41082
diff changeset
   110
lemma inf_mono: "a \<sqsubseteq> c \<Longrightarrow> b \<sqsubseteq> d \<Longrightarrow> a \<sqinter> b \<sqsubseteq> c \<sqinter> d"
36008
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   111
  by (fast intro: inf_greatest le_infI1 le_infI2)
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   112
25206
9c84ec7217a9 localized monotonicity; tuned syntax
haftmann
parents: 25102
diff changeset
   113
lemma mono_inf:
35028
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 34973
diff changeset
   114
  fixes f :: "'a \<Rightarrow> 'b\<Colon>semilattice_inf"
34007
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   115
  shows "mono f \<Longrightarrow> f (A \<sqinter> B) \<sqsubseteq> f A \<sqinter> f B"
25206
9c84ec7217a9 localized monotonicity; tuned syntax
haftmann
parents: 25102
diff changeset
   116
  by (auto simp add: mono_def intro: Lattices.inf_greatest)
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   117
25206
9c84ec7217a9 localized monotonicity; tuned syntax
haftmann
parents: 25102
diff changeset
   118
end
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   119
35028
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 34973
diff changeset
   120
context semilattice_sup
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   121
begin
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   122
32064
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
   123
lemma le_supI1:
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
   124
  "x \<sqsubseteq> a \<Longrightarrow> x \<sqsubseteq> a \<squnion> b"
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24749
diff changeset
   125
  by (rule order_trans) auto
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   126
32064
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
   127
lemma le_supI2:
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
   128
  "x \<sqsubseteq> b \<Longrightarrow> x \<sqsubseteq> a \<squnion> b"
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24749
diff changeset
   129
  by (rule order_trans) auto 
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   130
32064
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
   131
lemma le_supI:
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
   132
  "a \<sqsubseteq> x \<Longrightarrow> b \<sqsubseteq> x \<Longrightarrow> a \<squnion> b \<sqsubseteq> x"
36008
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   133
  by (rule sup_least) (* FIXME: duplicate lemma *)
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   134
32064
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
   135
lemma le_supE:
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
   136
  "a \<squnion> b \<sqsubseteq> x \<Longrightarrow> (a \<sqsubseteq> x \<Longrightarrow> b \<sqsubseteq> x \<Longrightarrow> P) \<Longrightarrow> P"
36008
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   137
  by (blast intro: order_trans sup_ge1 sup_ge2)
22422
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22384
diff changeset
   138
32064
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
   139
lemma le_sup_iff [simp]:
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
   140
  "x \<squnion> y \<sqsubseteq> z \<longleftrightarrow> x \<sqsubseteq> z \<and> y \<sqsubseteq> z"
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
   141
  by (blast intro: le_supI elim: le_supE)
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   142
32064
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
   143
lemma le_iff_sup:
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
   144
  "x \<sqsubseteq> y \<longleftrightarrow> x \<squnion> y = y"
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
   145
  by (auto intro: le_supI2 antisym dest: eq_iff [THEN iffD1])
21734
283461c15fa7 renaming
nipkow
parents: 21733
diff changeset
   146
43753
fe5e846c0839 tuned notation
haftmann
parents: 41082
diff changeset
   147
lemma sup_mono: "a \<sqsubseteq> c \<Longrightarrow> b \<sqsubseteq> d \<Longrightarrow> a \<squnion> b \<sqsubseteq> c \<squnion> d"
36008
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   148
  by (fast intro: sup_least le_supI1 le_supI2)
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   149
25206
9c84ec7217a9 localized monotonicity; tuned syntax
haftmann
parents: 25102
diff changeset
   150
lemma mono_sup:
35028
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 34973
diff changeset
   151
  fixes f :: "'a \<Rightarrow> 'b\<Colon>semilattice_sup"
34007
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   152
  shows "mono f \<Longrightarrow> f A \<squnion> f B \<sqsubseteq> f (A \<squnion> B)"
25206
9c84ec7217a9 localized monotonicity; tuned syntax
haftmann
parents: 25102
diff changeset
   153
  by (auto simp add: mono_def intro: Lattices.sup_least)
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   154
25206
9c84ec7217a9 localized monotonicity; tuned syntax
haftmann
parents: 25102
diff changeset
   155
end
23878
bd651ecd4b8a simplified HOL bootstrap
haftmann
parents: 23389
diff changeset
   156
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   157
32064
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
   158
subsubsection {* Equational laws *}
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   159
35028
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 34973
diff changeset
   160
sublocale semilattice_inf < inf!: semilattice inf
34973
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   161
proof
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   162
  fix a b c
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   163
  show "(a \<sqinter> b) \<sqinter> c = a \<sqinter> (b \<sqinter> c)"
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   164
    by (rule antisym) (auto intro: le_infI1 le_infI2)
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   165
  show "a \<sqinter> b = b \<sqinter> a"
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   166
    by (rule antisym) auto
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   167
  show "a \<sqinter> a = a"
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   168
    by (rule antisym) auto
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   169
qed
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   170
35028
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 34973
diff changeset
   171
context semilattice_inf
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   172
begin
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   173
34973
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   174
lemma inf_assoc: "(x \<sqinter> y) \<sqinter> z = x \<sqinter> (y \<sqinter> z)"
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   175
  by (fact inf.assoc)
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   176
34973
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   177
lemma inf_commute: "(x \<sqinter> y) = (y \<sqinter> x)"
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   178
  by (fact inf.commute)
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   179
34973
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   180
lemma inf_left_commute: "x \<sqinter> (y \<sqinter> z) = y \<sqinter> (x \<sqinter> z)"
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   181
  by (fact inf.left_commute)
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   182
44921
58eef4843641 tuned proofs
huffman
parents: 44919
diff changeset
   183
lemma inf_idem: "x \<sqinter> x = x"
58eef4843641 tuned proofs
huffman
parents: 44919
diff changeset
   184
  by (fact inf.idem) (* already simp *)
34973
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   185
44918
6a80fbc4e72c tune simpset for Complete_Lattices
noschinl
parents: 44845
diff changeset
   186
lemma inf_left_idem [simp]: "x \<sqinter> (x \<sqinter> y) = x \<sqinter> y"
34973
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   187
  by (fact inf.left_idem)
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   188
32642
026e7c6a6d08 be more cautious wrt. simp rules: inf_absorb1, inf_absorb2, sup_absorb1, sup_absorb2 are no simp rules by default any longer
haftmann
parents: 32568
diff changeset
   189
lemma inf_absorb1: "x \<sqsubseteq> y \<Longrightarrow> x \<sqinter> y = x"
32064
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
   190
  by (rule antisym) auto
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   191
32642
026e7c6a6d08 be more cautious wrt. simp rules: inf_absorb1, inf_absorb2, sup_absorb1, sup_absorb2 are no simp rules by default any longer
haftmann
parents: 32568
diff changeset
   192
lemma inf_absorb2: "y \<sqsubseteq> x \<Longrightarrow> x \<sqinter> y = y"
32064
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
   193
  by (rule antisym) auto
34973
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   194
 
32064
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
   195
lemmas inf_aci = inf_commute inf_assoc inf_left_commute inf_left_idem
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   196
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   197
end
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   198
35028
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 34973
diff changeset
   199
sublocale semilattice_sup < sup!: semilattice sup
34973
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   200
proof
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   201
  fix a b c
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   202
  show "(a \<squnion> b) \<squnion> c = a \<squnion> (b \<squnion> c)"
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   203
    by (rule antisym) (auto intro: le_supI1 le_supI2)
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   204
  show "a \<squnion> b = b \<squnion> a"
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   205
    by (rule antisym) auto
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   206
  show "a \<squnion> a = a"
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   207
    by (rule antisym) auto
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   208
qed
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   209
35028
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 34973
diff changeset
   210
context semilattice_sup
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   211
begin
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   212
34973
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   213
lemma sup_assoc: "(x \<squnion> y) \<squnion> z = x \<squnion> (y \<squnion> z)"
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   214
  by (fact sup.assoc)
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   215
34973
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   216
lemma sup_commute: "(x \<squnion> y) = (y \<squnion> x)"
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   217
  by (fact sup.commute)
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   218
34973
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   219
lemma sup_left_commute: "x \<squnion> (y \<squnion> z) = y \<squnion> (x \<squnion> z)"
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   220
  by (fact sup.left_commute)
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   221
44921
58eef4843641 tuned proofs
huffman
parents: 44919
diff changeset
   222
lemma sup_idem: "x \<squnion> x = x"
58eef4843641 tuned proofs
huffman
parents: 44919
diff changeset
   223
  by (fact sup.idem) (* already simp *)
34973
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   224
44918
6a80fbc4e72c tune simpset for Complete_Lattices
noschinl
parents: 44845
diff changeset
   225
lemma sup_left_idem [simp]: "x \<squnion> (x \<squnion> y) = x \<squnion> y"
34973
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   226
  by (fact sup.left_idem)
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   227
32642
026e7c6a6d08 be more cautious wrt. simp rules: inf_absorb1, inf_absorb2, sup_absorb1, sup_absorb2 are no simp rules by default any longer
haftmann
parents: 32568
diff changeset
   228
lemma sup_absorb1: "y \<sqsubseteq> x \<Longrightarrow> x \<squnion> y = x"
32064
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
   229
  by (rule antisym) auto
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   230
32642
026e7c6a6d08 be more cautious wrt. simp rules: inf_absorb1, inf_absorb2, sup_absorb1, sup_absorb2 are no simp rules by default any longer
haftmann
parents: 32568
diff changeset
   231
lemma sup_absorb2: "x \<sqsubseteq> y \<Longrightarrow> x \<squnion> y = y"
32064
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
   232
  by (rule antisym) auto
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   233
32064
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
   234
lemmas sup_aci = sup_commute sup_assoc sup_left_commute sup_left_idem
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   235
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   236
end
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   237
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   238
context lattice
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   239
begin
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   240
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   241
lemma dual_lattice:
44845
5e51075cbd97 added syntactic classes for "inf" and "sup"
krauss
parents: 44085
diff changeset
   242
  "class.lattice sup (op \<ge>) (op >) inf"
36635
080b755377c0 locale predicates of classes carry a mandatory "class" prefix
haftmann
parents: 36352
diff changeset
   243
  by (rule class.lattice.intro, rule dual_semilattice, rule class.semilattice_sup.intro, rule dual_order)
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   244
    (unfold_locales, auto)
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   245
44918
6a80fbc4e72c tune simpset for Complete_Lattices
noschinl
parents: 44845
diff changeset
   246
lemma inf_sup_absorb [simp]: "x \<sqinter> (x \<squnion> y) = x"
25102
db3e412c4cb1 antisymmetry not a default intro rule any longer
haftmann
parents: 25062
diff changeset
   247
  by (blast intro: antisym inf_le1 inf_greatest sup_ge1)
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   248
44918
6a80fbc4e72c tune simpset for Complete_Lattices
noschinl
parents: 44845
diff changeset
   249
lemma sup_inf_absorb [simp]: "x \<squnion> (x \<sqinter> y) = x"
25102
db3e412c4cb1 antisymmetry not a default intro rule any longer
haftmann
parents: 25062
diff changeset
   250
  by (blast intro: antisym sup_ge1 sup_least inf_le1)
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   251
32064
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
   252
lemmas inf_sup_aci = inf_aci sup_aci
21734
283461c15fa7 renaming
nipkow
parents: 21733
diff changeset
   253
22454
c3654ba76a09 integrated with LOrder.thy
haftmann
parents: 22422
diff changeset
   254
lemmas inf_sup_ord = inf_le1 inf_le2 sup_ge1 sup_ge2
c3654ba76a09 integrated with LOrder.thy
haftmann
parents: 22422
diff changeset
   255
21734
283461c15fa7 renaming
nipkow
parents: 21733
diff changeset
   256
text{* Towards distributivity *}
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   257
21734
283461c15fa7 renaming
nipkow
parents: 21733
diff changeset
   258
lemma distrib_sup_le: "x \<squnion> (y \<sqinter> z) \<sqsubseteq> (x \<squnion> y) \<sqinter> (x \<squnion> z)"
32064
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
   259
  by (auto intro: le_infI1 le_infI2 le_supI1 le_supI2)
21734
283461c15fa7 renaming
nipkow
parents: 21733
diff changeset
   260
283461c15fa7 renaming
nipkow
parents: 21733
diff changeset
   261
lemma distrib_inf_le: "(x \<sqinter> y) \<squnion> (x \<sqinter> z) \<sqsubseteq> x \<sqinter> (y \<squnion> z)"
32064
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
   262
  by (auto intro: le_infI1 le_infI2 le_supI1 le_supI2)
21734
283461c15fa7 renaming
nipkow
parents: 21733
diff changeset
   263
283461c15fa7 renaming
nipkow
parents: 21733
diff changeset
   264
text{* If you have one of them, you have them all. *}
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   265
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   266
lemma distrib_imp1:
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   267
assumes D: "!!x y z. x \<sqinter> (y \<squnion> z) = (x \<sqinter> y) \<squnion> (x \<sqinter> z)"
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   268
shows "x \<squnion> (y \<sqinter> z) = (x \<squnion> y) \<sqinter> (x \<squnion> z)"
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   269
proof-
44918
6a80fbc4e72c tune simpset for Complete_Lattices
noschinl
parents: 44845
diff changeset
   270
  have "x \<squnion> (y \<sqinter> z) = (x \<squnion> (x \<sqinter> z)) \<squnion> (y \<sqinter> z)" by simp
6a80fbc4e72c tune simpset for Complete_Lattices
noschinl
parents: 44845
diff changeset
   271
  also have "\<dots> = x \<squnion> (z \<sqinter> (x \<squnion> y))"
6a80fbc4e72c tune simpset for Complete_Lattices
noschinl
parents: 44845
diff changeset
   272
    by (simp add: D inf_commute sup_assoc del: sup_inf_absorb)
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   273
  also have "\<dots> = ((x \<squnion> y) \<sqinter> x) \<squnion> ((x \<squnion> y) \<sqinter> z)"
44919
482f1807976e tune proofs
noschinl
parents: 44918
diff changeset
   274
    by(simp add: inf_commute)
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   275
  also have "\<dots> = (x \<squnion> y) \<sqinter> (x \<squnion> z)" by(simp add:D)
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   276
  finally show ?thesis .
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   277
qed
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   278
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   279
lemma distrib_imp2:
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   280
assumes D: "!!x y z. x \<squnion> (y \<sqinter> z) = (x \<squnion> y) \<sqinter> (x \<squnion> z)"
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   281
shows "x \<sqinter> (y \<squnion> z) = (x \<sqinter> y) \<squnion> (x \<sqinter> z)"
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   282
proof-
44918
6a80fbc4e72c tune simpset for Complete_Lattices
noschinl
parents: 44845
diff changeset
   283
  have "x \<sqinter> (y \<squnion> z) = (x \<sqinter> (x \<squnion> z)) \<sqinter> (y \<squnion> z)" by simp
6a80fbc4e72c tune simpset for Complete_Lattices
noschinl
parents: 44845
diff changeset
   284
  also have "\<dots> = x \<sqinter> (z \<squnion> (x \<sqinter> y))"
6a80fbc4e72c tune simpset for Complete_Lattices
noschinl
parents: 44845
diff changeset
   285
    by (simp add: D sup_commute inf_assoc del: inf_sup_absorb)
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   286
  also have "\<dots> = ((x \<sqinter> y) \<squnion> x) \<sqinter> ((x \<sqinter> y) \<squnion> z)"
44919
482f1807976e tune proofs
noschinl
parents: 44918
diff changeset
   287
    by(simp add: sup_commute)
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   288
  also have "\<dots> = (x \<sqinter> y) \<squnion> (x \<sqinter> z)" by(simp add:D)
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   289
  finally show ?thesis .
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   290
qed
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   291
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   292
end
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   293
32568
89518a3074e1 some lemmas about strict order in lattices
haftmann
parents: 32512
diff changeset
   294
subsubsection {* Strict order *}
89518a3074e1 some lemmas about strict order in lattices
haftmann
parents: 32512
diff changeset
   295
35028
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 34973
diff changeset
   296
context semilattice_inf
32568
89518a3074e1 some lemmas about strict order in lattices
haftmann
parents: 32512
diff changeset
   297
begin
89518a3074e1 some lemmas about strict order in lattices
haftmann
parents: 32512
diff changeset
   298
89518a3074e1 some lemmas about strict order in lattices
haftmann
parents: 32512
diff changeset
   299
lemma less_infI1:
89518a3074e1 some lemmas about strict order in lattices
haftmann
parents: 32512
diff changeset
   300
  "a \<sqsubset> x \<Longrightarrow> a \<sqinter> b \<sqsubset> x"
32642
026e7c6a6d08 be more cautious wrt. simp rules: inf_absorb1, inf_absorb2, sup_absorb1, sup_absorb2 are no simp rules by default any longer
haftmann
parents: 32568
diff changeset
   301
  by (auto simp add: less_le inf_absorb1 intro: le_infI1)
32568
89518a3074e1 some lemmas about strict order in lattices
haftmann
parents: 32512
diff changeset
   302
89518a3074e1 some lemmas about strict order in lattices
haftmann
parents: 32512
diff changeset
   303
lemma less_infI2:
89518a3074e1 some lemmas about strict order in lattices
haftmann
parents: 32512
diff changeset
   304
  "b \<sqsubset> x \<Longrightarrow> a \<sqinter> b \<sqsubset> x"
32642
026e7c6a6d08 be more cautious wrt. simp rules: inf_absorb1, inf_absorb2, sup_absorb1, sup_absorb2 are no simp rules by default any longer
haftmann
parents: 32568
diff changeset
   305
  by (auto simp add: less_le inf_absorb2 intro: le_infI2)
32568
89518a3074e1 some lemmas about strict order in lattices
haftmann
parents: 32512
diff changeset
   306
89518a3074e1 some lemmas about strict order in lattices
haftmann
parents: 32512
diff changeset
   307
end
89518a3074e1 some lemmas about strict order in lattices
haftmann
parents: 32512
diff changeset
   308
35028
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 34973
diff changeset
   309
context semilattice_sup
32568
89518a3074e1 some lemmas about strict order in lattices
haftmann
parents: 32512
diff changeset
   310
begin
89518a3074e1 some lemmas about strict order in lattices
haftmann
parents: 32512
diff changeset
   311
89518a3074e1 some lemmas about strict order in lattices
haftmann
parents: 32512
diff changeset
   312
lemma less_supI1:
34007
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   313
  "x \<sqsubset> a \<Longrightarrow> x \<sqsubset> a \<squnion> b"
44921
58eef4843641 tuned proofs
huffman
parents: 44919
diff changeset
   314
  using dual_semilattice
58eef4843641 tuned proofs
huffman
parents: 44919
diff changeset
   315
  by (rule semilattice_inf.less_infI1)
32568
89518a3074e1 some lemmas about strict order in lattices
haftmann
parents: 32512
diff changeset
   316
89518a3074e1 some lemmas about strict order in lattices
haftmann
parents: 32512
diff changeset
   317
lemma less_supI2:
34007
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   318
  "x \<sqsubset> b \<Longrightarrow> x \<sqsubset> a \<squnion> b"
44921
58eef4843641 tuned proofs
huffman
parents: 44919
diff changeset
   319
  using dual_semilattice
58eef4843641 tuned proofs
huffman
parents: 44919
diff changeset
   320
  by (rule semilattice_inf.less_infI2)
32568
89518a3074e1 some lemmas about strict order in lattices
haftmann
parents: 32512
diff changeset
   321
89518a3074e1 some lemmas about strict order in lattices
haftmann
parents: 32512
diff changeset
   322
end
89518a3074e1 some lemmas about strict order in lattices
haftmann
parents: 32512
diff changeset
   323
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   324
24164
haftmann
parents: 23948
diff changeset
   325
subsection {* Distributive lattices *}
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   326
22454
c3654ba76a09 integrated with LOrder.thy
haftmann
parents: 22422
diff changeset
   327
class distrib_lattice = lattice +
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   328
  assumes sup_inf_distrib1: "x \<squnion> (y \<sqinter> z) = (x \<squnion> y) \<sqinter> (x \<squnion> z)"
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   329
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   330
context distrib_lattice
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   331
begin
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   332
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   333
lemma sup_inf_distrib2:
44921
58eef4843641 tuned proofs
huffman
parents: 44919
diff changeset
   334
  "(y \<sqinter> z) \<squnion> x = (y \<squnion> x) \<sqinter> (z \<squnion> x)"
58eef4843641 tuned proofs
huffman
parents: 44919
diff changeset
   335
  by (simp add: sup_commute sup_inf_distrib1)
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   336
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   337
lemma inf_sup_distrib1:
44921
58eef4843641 tuned proofs
huffman
parents: 44919
diff changeset
   338
  "x \<sqinter> (y \<squnion> z) = (x \<sqinter> y) \<squnion> (x \<sqinter> z)"
58eef4843641 tuned proofs
huffman
parents: 44919
diff changeset
   339
  by (rule distrib_imp2 [OF sup_inf_distrib1])
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   340
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   341
lemma inf_sup_distrib2:
44921
58eef4843641 tuned proofs
huffman
parents: 44919
diff changeset
   342
  "(y \<squnion> z) \<sqinter> x = (y \<sqinter> x) \<squnion> (z \<sqinter> x)"
58eef4843641 tuned proofs
huffman
parents: 44919
diff changeset
   343
  by (simp add: inf_commute inf_sup_distrib1)
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   344
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   345
lemma dual_distrib_lattice:
44845
5e51075cbd97 added syntactic classes for "inf" and "sup"
krauss
parents: 44085
diff changeset
   346
  "class.distrib_lattice sup (op \<ge>) (op >) inf"
36635
080b755377c0 locale predicates of classes carry a mandatory "class" prefix
haftmann
parents: 36352
diff changeset
   347
  by (rule class.distrib_lattice.intro, rule dual_lattice)
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   348
    (unfold_locales, fact inf_sup_distrib1)
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   349
36008
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   350
lemmas sup_inf_distrib =
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   351
  sup_inf_distrib1 sup_inf_distrib2
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   352
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   353
lemmas inf_sup_distrib =
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   354
  inf_sup_distrib1 inf_sup_distrib2
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   355
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   356
lemmas distrib =
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   357
  sup_inf_distrib1 sup_inf_distrib2 inf_sup_distrib1 inf_sup_distrib2
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   358
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   359
end
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   360
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   361
34007
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   362
subsection {* Bounded lattices and boolean algebras *}
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   363
36352
f71978e47cd5 add bounded_lattice_bot and bounded_lattice_top type classes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 36096
diff changeset
   364
class bounded_lattice_bot = lattice + bot
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   365
begin
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   366
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   367
lemma inf_bot_left [simp]:
34007
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   368
  "\<bottom> \<sqinter> x = \<bottom>"
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   369
  by (rule inf_absorb1) simp
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   370
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   371
lemma inf_bot_right [simp]:
34007
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   372
  "x \<sqinter> \<bottom> = \<bottom>"
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   373
  by (rule inf_absorb2) simp
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   374
36352
f71978e47cd5 add bounded_lattice_bot and bounded_lattice_top type classes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 36096
diff changeset
   375
lemma sup_bot_left [simp]:
f71978e47cd5 add bounded_lattice_bot and bounded_lattice_top type classes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 36096
diff changeset
   376
  "\<bottom> \<squnion> x = x"
f71978e47cd5 add bounded_lattice_bot and bounded_lattice_top type classes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 36096
diff changeset
   377
  by (rule sup_absorb2) simp
f71978e47cd5 add bounded_lattice_bot and bounded_lattice_top type classes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 36096
diff changeset
   378
f71978e47cd5 add bounded_lattice_bot and bounded_lattice_top type classes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 36096
diff changeset
   379
lemma sup_bot_right [simp]:
f71978e47cd5 add bounded_lattice_bot and bounded_lattice_top type classes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 36096
diff changeset
   380
  "x \<squnion> \<bottom> = x"
f71978e47cd5 add bounded_lattice_bot and bounded_lattice_top type classes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 36096
diff changeset
   381
  by (rule sup_absorb1) simp
f71978e47cd5 add bounded_lattice_bot and bounded_lattice_top type classes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 36096
diff changeset
   382
f71978e47cd5 add bounded_lattice_bot and bounded_lattice_top type classes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 36096
diff changeset
   383
lemma sup_eq_bot_iff [simp]:
f71978e47cd5 add bounded_lattice_bot and bounded_lattice_top type classes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 36096
diff changeset
   384
  "x \<squnion> y = \<bottom> \<longleftrightarrow> x = \<bottom> \<and> y = \<bottom>"
f71978e47cd5 add bounded_lattice_bot and bounded_lattice_top type classes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 36096
diff changeset
   385
  by (simp add: eq_iff)
f71978e47cd5 add bounded_lattice_bot and bounded_lattice_top type classes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 36096
diff changeset
   386
f71978e47cd5 add bounded_lattice_bot and bounded_lattice_top type classes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 36096
diff changeset
   387
end
f71978e47cd5 add bounded_lattice_bot and bounded_lattice_top type classes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 36096
diff changeset
   388
f71978e47cd5 add bounded_lattice_bot and bounded_lattice_top type classes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 36096
diff changeset
   389
class bounded_lattice_top = lattice + top
f71978e47cd5 add bounded_lattice_bot and bounded_lattice_top type classes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 36096
diff changeset
   390
begin
f71978e47cd5 add bounded_lattice_bot and bounded_lattice_top type classes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 36096
diff changeset
   391
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   392
lemma sup_top_left [simp]:
34007
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   393
  "\<top> \<squnion> x = \<top>"
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   394
  by (rule sup_absorb1) simp
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   395
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   396
lemma sup_top_right [simp]:
34007
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   397
  "x \<squnion> \<top> = \<top>"
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   398
  by (rule sup_absorb2) simp
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   399
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   400
lemma inf_top_left [simp]:
34007
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   401
  "\<top> \<sqinter> x = x"
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   402
  by (rule inf_absorb2) simp
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   403
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   404
lemma inf_top_right [simp]:
34007
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   405
  "x \<sqinter> \<top> = x"
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   406
  by (rule inf_absorb1) simp
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   407
36008
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   408
lemma inf_eq_top_iff [simp]:
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   409
  "x \<sqinter> y = \<top> \<longleftrightarrow> x = \<top> \<and> y = \<top>"
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   410
  by (simp add: eq_iff)
32568
89518a3074e1 some lemmas about strict order in lattices
haftmann
parents: 32512
diff changeset
   411
36352
f71978e47cd5 add bounded_lattice_bot and bounded_lattice_top type classes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 36096
diff changeset
   412
end
f71978e47cd5 add bounded_lattice_bot and bounded_lattice_top type classes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 36096
diff changeset
   413
f71978e47cd5 add bounded_lattice_bot and bounded_lattice_top type classes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 36096
diff changeset
   414
class bounded_lattice = bounded_lattice_bot + bounded_lattice_top
f71978e47cd5 add bounded_lattice_bot and bounded_lattice_top type classes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 36096
diff changeset
   415
begin
f71978e47cd5 add bounded_lattice_bot and bounded_lattice_top type classes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 36096
diff changeset
   416
f71978e47cd5 add bounded_lattice_bot and bounded_lattice_top type classes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 36096
diff changeset
   417
lemma dual_bounded_lattice:
44845
5e51075cbd97 added syntactic classes for "inf" and "sup"
krauss
parents: 44085
diff changeset
   418
  "class.bounded_lattice sup greater_eq greater inf \<top> \<bottom>"
36352
f71978e47cd5 add bounded_lattice_bot and bounded_lattice_top type classes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 36096
diff changeset
   419
  by unfold_locales (auto simp add: less_le_not_le)
32568
89518a3074e1 some lemmas about strict order in lattices
haftmann
parents: 32512
diff changeset
   420
34007
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   421
end
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   422
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   423
class boolean_algebra = distrib_lattice + bounded_lattice + minus + uminus +
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   424
  assumes inf_compl_bot: "x \<sqinter> - x = \<bottom>"
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   425
    and sup_compl_top: "x \<squnion> - x = \<top>"
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   426
  assumes diff_eq: "x - y = x \<sqinter> - y"
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   427
begin
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   428
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   429
lemma dual_boolean_algebra:
44845
5e51075cbd97 added syntactic classes for "inf" and "sup"
krauss
parents: 44085
diff changeset
   430
  "class.boolean_algebra (\<lambda>x y. x \<squnion> - y) uminus sup greater_eq greater inf \<top> \<bottom>"
36635
080b755377c0 locale predicates of classes carry a mandatory "class" prefix
haftmann
parents: 36352
diff changeset
   431
  by (rule class.boolean_algebra.intro, rule dual_bounded_lattice, rule dual_distrib_lattice)
34007
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   432
    (unfold_locales, auto simp add: inf_compl_bot sup_compl_top diff_eq)
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   433
44918
6a80fbc4e72c tune simpset for Complete_Lattices
noschinl
parents: 44845
diff changeset
   434
lemma compl_inf_bot [simp]:
34007
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   435
  "- x \<sqinter> x = \<bottom>"
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   436
  by (simp add: inf_commute inf_compl_bot)
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   437
44918
6a80fbc4e72c tune simpset for Complete_Lattices
noschinl
parents: 44845
diff changeset
   438
lemma compl_sup_top [simp]:
34007
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   439
  "- x \<squnion> x = \<top>"
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   440
  by (simp add: sup_commute sup_compl_top)
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   441
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   442
lemma compl_unique:
34007
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   443
  assumes "x \<sqinter> y = \<bottom>"
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   444
    and "x \<squnion> y = \<top>"
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   445
  shows "- x = y"
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   446
proof -
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   447
  have "(x \<sqinter> - x) \<squnion> (- x \<sqinter> y) = (x \<sqinter> y) \<squnion> (- x \<sqinter> y)"
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   448
    using inf_compl_bot assms(1) by simp
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   449
  then have "(- x \<sqinter> x) \<squnion> (- x \<sqinter> y) = (y \<sqinter> x) \<squnion> (y \<sqinter> - x)"
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   450
    by (simp add: inf_commute)
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   451
  then have "- x \<sqinter> (x \<squnion> y) = y \<sqinter> (x \<squnion> - x)"
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   452
    by (simp add: inf_sup_distrib1)
34007
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   453
  then have "- x \<sqinter> \<top> = y \<sqinter> \<top>"
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   454
    using sup_compl_top assms(2) by simp
34209
c7f621786035 killed a few warnings
krauss
parents: 34007
diff changeset
   455
  then show "- x = y" by simp
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   456
qed
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   457
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   458
lemma double_compl [simp]:
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   459
  "- (- x) = x"
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   460
  using compl_inf_bot compl_sup_top by (rule compl_unique)
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   461
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   462
lemma compl_eq_compl_iff [simp]:
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   463
  "- x = - y \<longleftrightarrow> x = y"
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   464
proof
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   465
  assume "- x = - y"
36008
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   466
  then have "- (- x) = - (- y)" by (rule arg_cong)
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   467
  then show "x = y" by simp
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   468
next
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   469
  assume "x = y"
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   470
  then show "- x = - y" by simp
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   471
qed
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   472
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   473
lemma compl_bot_eq [simp]:
34007
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   474
  "- \<bottom> = \<top>"
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   475
proof -
34007
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   476
  from sup_compl_top have "\<bottom> \<squnion> - \<bottom> = \<top>" .
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   477
  then show ?thesis by simp
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   478
qed
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   479
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   480
lemma compl_top_eq [simp]:
34007
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   481
  "- \<top> = \<bottom>"
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   482
proof -
34007
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   483
  from inf_compl_bot have "\<top> \<sqinter> - \<top> = \<bottom>" .
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   484
  then show ?thesis by simp
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   485
qed
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   486
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   487
lemma compl_inf [simp]:
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   488
  "- (x \<sqinter> y) = - x \<squnion> - y"
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   489
proof (rule compl_unique)
36008
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   490
  have "(x \<sqinter> y) \<sqinter> (- x \<squnion> - y) = (y \<sqinter> (x \<sqinter> - x)) \<squnion> (x \<sqinter> (y \<sqinter> - y))"
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   491
    by (simp only: inf_sup_distrib inf_aci)
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   492
  then show "(x \<sqinter> y) \<sqinter> (- x \<squnion> - y) = \<bottom>"
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   493
    by (simp add: inf_compl_bot)
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   494
next
36008
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   495
  have "(x \<sqinter> y) \<squnion> (- x \<squnion> - y) = (- y \<squnion> (x \<squnion> - x)) \<sqinter> (- x \<squnion> (y \<squnion> - y))"
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   496
    by (simp only: sup_inf_distrib sup_aci)
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   497
  then show "(x \<sqinter> y) \<squnion> (- x \<squnion> - y) = \<top>"
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   498
    by (simp add: sup_compl_top)
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   499
qed
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   500
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   501
lemma compl_sup [simp]:
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   502
  "- (x \<squnion> y) = - x \<sqinter> - y"
44921
58eef4843641 tuned proofs
huffman
parents: 44919
diff changeset
   503
  using dual_boolean_algebra
58eef4843641 tuned proofs
huffman
parents: 44919
diff changeset
   504
  by (rule boolean_algebra.compl_inf)
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   505
36008
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   506
lemma compl_mono:
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   507
  "x \<sqsubseteq> y \<Longrightarrow> - y \<sqsubseteq> - x"
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   508
proof -
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   509
  assume "x \<sqsubseteq> y"
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   510
  then have "x \<squnion> y = y" by (simp only: le_iff_sup)
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   511
  then have "- (x \<squnion> y) = - y" by simp
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   512
  then have "- x \<sqinter> - y = - y" by simp
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   513
  then have "- y \<sqinter> - x = - y" by (simp only: inf_commute)
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   514
  then show "- y \<sqsubseteq> - x" by (simp only: le_iff_inf)
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   515
qed
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   516
44918
6a80fbc4e72c tune simpset for Complete_Lattices
noschinl
parents: 44845
diff changeset
   517
lemma compl_le_compl_iff [simp]:
43753
fe5e846c0839 tuned notation
haftmann
parents: 41082
diff changeset
   518
  "- x \<sqsubseteq> - y \<longleftrightarrow> y \<sqsubseteq> x"
43873
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   519
  by (auto dest: compl_mono)
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   520
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   521
lemma compl_le_swap1:
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   522
  assumes "y \<sqsubseteq> - x" shows "x \<sqsubseteq> -y"
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   523
proof -
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   524
  from assms have "- (- x) \<sqsubseteq> - y" by (simp only: compl_le_compl_iff)
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   525
  then show ?thesis by simp
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   526
qed
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   527
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   528
lemma compl_le_swap2:
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   529
  assumes "- y \<sqsubseteq> x" shows "- x \<sqsubseteq> y"
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   530
proof -
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   531
  from assms have "- x \<sqsubseteq> - (- y)" by (simp only: compl_le_compl_iff)
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   532
  then show ?thesis by simp
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   533
qed
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   534
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   535
lemma compl_less_compl_iff: (* TODO: declare [simp] ? *)
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   536
  "- x \<sqsubset> - y \<longleftrightarrow> y \<sqsubset> x"
44919
482f1807976e tune proofs
noschinl
parents: 44918
diff changeset
   537
  by (auto simp add: less_le)
43873
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   538
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   539
lemma compl_less_swap1:
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   540
  assumes "y \<sqsubset> - x" shows "x \<sqsubset> - y"
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   541
proof -
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   542
  from assms have "- (- x) \<sqsubset> - y" by (simp only: compl_less_compl_iff)
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   543
  then show ?thesis by simp
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   544
qed
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   545
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   546
lemma compl_less_swap2:
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   547
  assumes "- y \<sqsubset> x" shows "- x \<sqsubset> y"
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   548
proof -
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   549
  from assms have "- x \<sqsubset> - (- y)" by (simp only: compl_less_compl_iff)
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   550
  then show ?thesis by simp
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   551
qed
36008
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   552
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   553
end
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   554
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   555
22454
c3654ba76a09 integrated with LOrder.thy
haftmann
parents: 22422
diff changeset
   556
subsection {* Uniqueness of inf and sup *}
c3654ba76a09 integrated with LOrder.thy
haftmann
parents: 22422
diff changeset
   557
35028
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 34973
diff changeset
   558
lemma (in semilattice_inf) inf_unique:
22454
c3654ba76a09 integrated with LOrder.thy
haftmann
parents: 22422
diff changeset
   559
  fixes f (infixl "\<triangle>" 70)
34007
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   560
  assumes le1: "\<And>x y. x \<triangle> y \<sqsubseteq> x" and le2: "\<And>x y. x \<triangle> y \<sqsubseteq> y"
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   561
  and greatest: "\<And>x y z. x \<sqsubseteq> y \<Longrightarrow> x \<sqsubseteq> z \<Longrightarrow> x \<sqsubseteq> y \<triangle> z"
22737
haftmann
parents: 22548
diff changeset
   562
  shows "x \<sqinter> y = x \<triangle> y"
22454
c3654ba76a09 integrated with LOrder.thy
haftmann
parents: 22422
diff changeset
   563
proof (rule antisym)
34007
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   564
  show "x \<triangle> y \<sqsubseteq> x \<sqinter> y" by (rule le_infI) (rule le1, rule le2)
22454
c3654ba76a09 integrated with LOrder.thy
haftmann
parents: 22422
diff changeset
   565
next
34007
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   566
  have leI: "\<And>x y z. x \<sqsubseteq> y \<Longrightarrow> x \<sqsubseteq> z \<Longrightarrow> x \<sqsubseteq> y \<triangle> z" by (blast intro: greatest)
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   567
  show "x \<sqinter> y \<sqsubseteq> x \<triangle> y" by (rule leI) simp_all
22454
c3654ba76a09 integrated with LOrder.thy
haftmann
parents: 22422
diff changeset
   568
qed
c3654ba76a09 integrated with LOrder.thy
haftmann
parents: 22422
diff changeset
   569
35028
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 34973
diff changeset
   570
lemma (in semilattice_sup) sup_unique:
22454
c3654ba76a09 integrated with LOrder.thy
haftmann
parents: 22422
diff changeset
   571
  fixes f (infixl "\<nabla>" 70)
34007
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   572
  assumes ge1 [simp]: "\<And>x y. x \<sqsubseteq> x \<nabla> y" and ge2: "\<And>x y. y \<sqsubseteq> x \<nabla> y"
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   573
  and least: "\<And>x y z. y \<sqsubseteq> x \<Longrightarrow> z \<sqsubseteq> x \<Longrightarrow> y \<nabla> z \<sqsubseteq> x"
22737
haftmann
parents: 22548
diff changeset
   574
  shows "x \<squnion> y = x \<nabla> y"
22454
c3654ba76a09 integrated with LOrder.thy
haftmann
parents: 22422
diff changeset
   575
proof (rule antisym)
34007
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   576
  show "x \<squnion> y \<sqsubseteq> x \<nabla> y" by (rule le_supI) (rule ge1, rule ge2)
22454
c3654ba76a09 integrated with LOrder.thy
haftmann
parents: 22422
diff changeset
   577
next
34007
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   578
  have leI: "\<And>x y z. x \<sqsubseteq> z \<Longrightarrow> y \<sqsubseteq> z \<Longrightarrow> x \<nabla> y \<sqsubseteq> z" by (blast intro: least)
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   579
  show "x \<nabla> y \<sqsubseteq> x \<squnion> y" by (rule leI) simp_all
22454
c3654ba76a09 integrated with LOrder.thy
haftmann
parents: 22422
diff changeset
   580
qed
36008
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   581
22454
c3654ba76a09 integrated with LOrder.thy
haftmann
parents: 22422
diff changeset
   582
22916
haftmann
parents: 22737
diff changeset
   583
subsection {* @{const min}/@{const max} on linear orders as
haftmann
parents: 22737
diff changeset
   584
  special case of @{const inf}/@{const sup} *}
haftmann
parents: 22737
diff changeset
   585
44845
5e51075cbd97 added syntactic classes for "inf" and "sup"
krauss
parents: 44085
diff changeset
   586
sublocale linorder < min_max!: distrib_lattice min less_eq less max
28823
dcbef866c9e2 tuned unfold_locales invocation
haftmann
parents: 28692
diff changeset
   587
proof
22916
haftmann
parents: 22737
diff changeset
   588
  fix x y z
32512
d14762642cdd proper class syntax for sublocale class < expr
haftmann
parents: 32436
diff changeset
   589
  show "max x (min y z) = min (max x y) (max x z)"
d14762642cdd proper class syntax for sublocale class < expr
haftmann
parents: 32436
diff changeset
   590
    by (auto simp add: min_def max_def)
22916
haftmann
parents: 22737
diff changeset
   591
qed (auto simp add: min_def max_def not_le less_imp_le)
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   592
35028
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 34973
diff changeset
   593
lemma inf_min: "inf = (min \<Colon> 'a\<Colon>{semilattice_inf, linorder} \<Rightarrow> 'a \<Rightarrow> 'a)"
25102
db3e412c4cb1 antisymmetry not a default intro rule any longer
haftmann
parents: 25062
diff changeset
   594
  by (rule ext)+ (auto intro: antisym)
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   595
35028
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 34973
diff changeset
   596
lemma sup_max: "sup = (max \<Colon> 'a\<Colon>{semilattice_sup, linorder} \<Rightarrow> 'a \<Rightarrow> 'a)"
25102
db3e412c4cb1 antisymmetry not a default intro rule any longer
haftmann
parents: 25062
diff changeset
   597
  by (rule ext)+ (auto intro: antisym)
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   598
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   599
lemmas le_maxI1 = min_max.sup_ge1
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   600
lemmas le_maxI2 = min_max.sup_ge2
21381
79e065f2be95 reworking of min/max lemmas
haftmann
parents: 21312
diff changeset
   601
 
34973
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   602
lemmas min_ac = min_max.inf_assoc min_max.inf_commute
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   603
  min_max.inf.left_commute
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   604
34973
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   605
lemmas max_ac = min_max.sup_assoc min_max.sup_commute
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   606
  min_max.sup.left_commute
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   607
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   608
22454
c3654ba76a09 integrated with LOrder.thy
haftmann
parents: 22422
diff changeset
   609
subsection {* Bool as lattice *}
c3654ba76a09 integrated with LOrder.thy
haftmann
parents: 22422
diff changeset
   610
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   611
instantiation bool :: boolean_algebra
25510
38c15efe603b adjustions to due to instance target
haftmann
parents: 25482
diff changeset
   612
begin
38c15efe603b adjustions to due to instance target
haftmann
parents: 25482
diff changeset
   613
38c15efe603b adjustions to due to instance target
haftmann
parents: 25482
diff changeset
   614
definition
41080
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   615
  bool_Compl_def [simp]: "uminus = Not"
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   616
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   617
definition
41080
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   618
  bool_diff_def [simp]: "A - B \<longleftrightarrow> A \<and> \<not> B"
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   619
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   620
definition
41080
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   621
  [simp]: "P \<sqinter> Q \<longleftrightarrow> P \<and> Q"
25510
38c15efe603b adjustions to due to instance target
haftmann
parents: 25482
diff changeset
   622
38c15efe603b adjustions to due to instance target
haftmann
parents: 25482
diff changeset
   623
definition
41080
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   624
  [simp]: "P \<squnion> Q \<longleftrightarrow> P \<or> Q"
25510
38c15efe603b adjustions to due to instance target
haftmann
parents: 25482
diff changeset
   625
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   626
instance proof
41080
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   627
qed auto
22454
c3654ba76a09 integrated with LOrder.thy
haftmann
parents: 22422
diff changeset
   628
25510
38c15efe603b adjustions to due to instance target
haftmann
parents: 25482
diff changeset
   629
end
38c15efe603b adjustions to due to instance target
haftmann
parents: 25482
diff changeset
   630
32781
19c01bd7f6ae moved lemmas about sup on bool to Lattices.thy
haftmann
parents: 32780
diff changeset
   631
lemma sup_boolI1:
19c01bd7f6ae moved lemmas about sup on bool to Lattices.thy
haftmann
parents: 32780
diff changeset
   632
  "P \<Longrightarrow> P \<squnion> Q"
41080
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   633
  by simp
32781
19c01bd7f6ae moved lemmas about sup on bool to Lattices.thy
haftmann
parents: 32780
diff changeset
   634
19c01bd7f6ae moved lemmas about sup on bool to Lattices.thy
haftmann
parents: 32780
diff changeset
   635
lemma sup_boolI2:
19c01bd7f6ae moved lemmas about sup on bool to Lattices.thy
haftmann
parents: 32780
diff changeset
   636
  "Q \<Longrightarrow> P \<squnion> Q"
41080
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   637
  by simp
32781
19c01bd7f6ae moved lemmas about sup on bool to Lattices.thy
haftmann
parents: 32780
diff changeset
   638
19c01bd7f6ae moved lemmas about sup on bool to Lattices.thy
haftmann
parents: 32780
diff changeset
   639
lemma sup_boolE:
19c01bd7f6ae moved lemmas about sup on bool to Lattices.thy
haftmann
parents: 32780
diff changeset
   640
  "P \<squnion> Q \<Longrightarrow> (P \<Longrightarrow> R) \<Longrightarrow> (Q \<Longrightarrow> R) \<Longrightarrow> R"
41080
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   641
  by auto
32781
19c01bd7f6ae moved lemmas about sup on bool to Lattices.thy
haftmann
parents: 32780
diff changeset
   642
23878
bd651ecd4b8a simplified HOL bootstrap
haftmann
parents: 23389
diff changeset
   643
bd651ecd4b8a simplified HOL bootstrap
haftmann
parents: 23389
diff changeset
   644
subsection {* Fun as lattice *}
bd651ecd4b8a simplified HOL bootstrap
haftmann
parents: 23389
diff changeset
   645
25510
38c15efe603b adjustions to due to instance target
haftmann
parents: 25482
diff changeset
   646
instantiation "fun" :: (type, lattice) lattice
38c15efe603b adjustions to due to instance target
haftmann
parents: 25482
diff changeset
   647
begin
38c15efe603b adjustions to due to instance target
haftmann
parents: 25482
diff changeset
   648
38c15efe603b adjustions to due to instance target
haftmann
parents: 25482
diff changeset
   649
definition
41080
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   650
  "f \<sqinter> g = (\<lambda>x. f x \<sqinter> g x)"
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   651
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   652
lemma inf_apply:
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   653
  "(f \<sqinter> g) x = f x \<sqinter> g x"
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   654
  by (simp add: inf_fun_def)
25510
38c15efe603b adjustions to due to instance target
haftmann
parents: 25482
diff changeset
   655
38c15efe603b adjustions to due to instance target
haftmann
parents: 25482
diff changeset
   656
definition
41080
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   657
  "f \<squnion> g = (\<lambda>x. f x \<squnion> g x)"
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   658
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   659
lemma sup_apply:
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   660
  "(f \<squnion> g) x = f x \<squnion> g x"
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   661
  by (simp add: sup_fun_def)
25510
38c15efe603b adjustions to due to instance target
haftmann
parents: 25482
diff changeset
   662
32780
be337ec31268 tuned proofs
haftmann
parents: 32642
diff changeset
   663
instance proof
41080
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   664
qed (simp_all add: le_fun_def inf_apply sup_apply)
23878
bd651ecd4b8a simplified HOL bootstrap
haftmann
parents: 23389
diff changeset
   665
25510
38c15efe603b adjustions to due to instance target
haftmann
parents: 25482
diff changeset
   666
end
23878
bd651ecd4b8a simplified HOL bootstrap
haftmann
parents: 23389
diff changeset
   667
41080
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   668
instance "fun" :: (type, distrib_lattice) distrib_lattice proof
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   669
qed (rule ext, simp add: sup_inf_distrib1 inf_apply sup_apply)
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   670
34007
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   671
instance "fun" :: (type, bounded_lattice) bounded_lattice ..
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   672
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   673
instantiation "fun" :: (type, uminus) uminus
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   674
begin
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   675
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   676
definition
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   677
  fun_Compl_def: "- A = (\<lambda>x. - A x)"
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   678
41080
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   679
lemma uminus_apply:
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   680
  "(- A) x = - (A x)"
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   681
  by (simp add: fun_Compl_def)
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   682
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   683
instance ..
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   684
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   685
end
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   686
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   687
instantiation "fun" :: (type, minus) minus
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   688
begin
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   689
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   690
definition
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   691
  fun_diff_def: "A - B = (\<lambda>x. A x - B x)"
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   692
41080
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   693
lemma minus_apply:
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   694
  "(A - B) x = A x - B x"
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   695
  by (simp add: fun_diff_def)
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   696
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   697
instance ..
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   698
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   699
end
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   700
41080
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   701
instance "fun" :: (type, boolean_algebra) boolean_algebra proof
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   702
qed (rule ext, simp_all add: inf_apply sup_apply bot_apply top_apply uminus_apply minus_apply inf_compl_bot sup_compl_top diff_eq)+
26794
354c3844dfde - Now imports Fun rather than Orderings
berghofe
parents: 26233
diff changeset
   703
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24749
diff changeset
   704
no_notation
25382
72cfe89f7b21 tuned specifications of 'notation';
wenzelm
parents: 25206
diff changeset
   705
  less_eq  (infix "\<sqsubseteq>" 50) and
72cfe89f7b21 tuned specifications of 'notation';
wenzelm
parents: 25206
diff changeset
   706
  less (infix "\<sqsubset>" 50) and
72cfe89f7b21 tuned specifications of 'notation';
wenzelm
parents: 25206
diff changeset
   707
  inf  (infixl "\<sqinter>" 70) and
32568
89518a3074e1 some lemmas about strict order in lattices
haftmann
parents: 32512
diff changeset
   708
  sup  (infixl "\<squnion>" 65) and
89518a3074e1 some lemmas about strict order in lattices
haftmann
parents: 32512
diff changeset
   709
  top ("\<top>") and
89518a3074e1 some lemmas about strict order in lattices
haftmann
parents: 32512
diff changeset
   710
  bot ("\<bottom>")
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24749
diff changeset
   711
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   712
end