src/HOL/Lattices.thy
author nipkow
Sat Dec 22 00:04:50 2012 +0100 (2012-12-22)
changeset 50615 965d4c108584
parent 49769 c7c2152322f2
child 51387 dbc4a77488b2
permissions -rw-r--r--
added simp rule
haftmann@21249
     1
(*  Title:      HOL/Lattices.thy
haftmann@21249
     2
    Author:     Tobias Nipkow
haftmann@21249
     3
*)
haftmann@21249
     4
haftmann@22454
     5
header {* Abstract lattices *}
haftmann@21249
     6
haftmann@21249
     7
theory Lattices
haftmann@35121
     8
imports Orderings Groups
haftmann@21249
     9
begin
haftmann@21249
    10
haftmann@35301
    11
subsection {* Abstract semilattice *}
haftmann@35301
    12
haftmann@35301
    13
text {*
haftmann@35301
    14
  This locales provide a basic structure for interpretation into
haftmann@35301
    15
  bigger structures;  extensions require careful thinking, otherwise
haftmann@35301
    16
  undesired effects may occur due to interpretation.
haftmann@35301
    17
*}
haftmann@35301
    18
haftmann@35301
    19
locale semilattice = abel_semigroup +
haftmann@35301
    20
  assumes idem [simp]: "f a a = a"
haftmann@35301
    21
begin
haftmann@35301
    22
nipkow@50615
    23
lemma left_idem [simp]: "f a (f a b) = f a b"
nipkow@50615
    24
by (simp add: assoc [symmetric])
nipkow@50615
    25
nipkow@50615
    26
lemma right_idem [simp]: "f (f a b) b = f a b"
nipkow@50615
    27
by (simp add: assoc)
haftmann@35301
    28
haftmann@35301
    29
end
haftmann@35301
    30
haftmann@35301
    31
haftmann@35301
    32
subsection {* Idempotent semigroup *}
haftmann@35301
    33
haftmann@35301
    34
class ab_semigroup_idem_mult = ab_semigroup_mult +
haftmann@35301
    35
  assumes mult_idem: "x * x = x"
haftmann@35301
    36
haftmann@35301
    37
sublocale ab_semigroup_idem_mult < times!: semilattice times proof
haftmann@35301
    38
qed (fact mult_idem)
haftmann@35301
    39
haftmann@35301
    40
context ab_semigroup_idem_mult
haftmann@35301
    41
begin
haftmann@35301
    42
haftmann@35301
    43
lemmas mult_left_idem = times.left_idem
haftmann@35301
    44
haftmann@35301
    45
end
haftmann@35301
    46
haftmann@35301
    47
haftmann@46691
    48
subsection {* Syntactic infimum and supremum operations *}
haftmann@41082
    49
krauss@44845
    50
class inf =
krauss@44845
    51
  fixes inf :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixl "\<sqinter>" 70)
haftmann@25206
    52
krauss@44845
    53
class sup = 
krauss@44845
    54
  fixes sup :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixl "\<squnion>" 65)
krauss@44845
    55
haftmann@46691
    56
haftmann@46691
    57
subsection {* Concrete lattices *}
haftmann@46691
    58
haftmann@46691
    59
notation
haftmann@46691
    60
  less_eq  (infix "\<sqsubseteq>" 50) and
haftmann@46691
    61
  less  (infix "\<sqsubset>" 50)
haftmann@46691
    62
krauss@44845
    63
class semilattice_inf =  order + inf +
haftmann@22737
    64
  assumes inf_le1 [simp]: "x \<sqinter> y \<sqsubseteq> x"
haftmann@22737
    65
  and inf_le2 [simp]: "x \<sqinter> y \<sqsubseteq> y"
nipkow@21733
    66
  and inf_greatest: "x \<sqsubseteq> y \<Longrightarrow> x \<sqsubseteq> z \<Longrightarrow> x \<sqsubseteq> y \<sqinter> z"
haftmann@21249
    67
krauss@44845
    68
class semilattice_sup = order + sup +
haftmann@22737
    69
  assumes sup_ge1 [simp]: "x \<sqsubseteq> x \<squnion> y"
haftmann@22737
    70
  and sup_ge2 [simp]: "y \<sqsubseteq> x \<squnion> y"
nipkow@21733
    71
  and sup_least: "y \<sqsubseteq> x \<Longrightarrow> z \<sqsubseteq> x \<Longrightarrow> y \<squnion> z \<sqsubseteq> x"
haftmann@26014
    72
begin
haftmann@26014
    73
haftmann@26014
    74
text {* Dual lattice *}
haftmann@26014
    75
haftmann@31991
    76
lemma dual_semilattice:
krauss@44845
    77
  "class.semilattice_inf sup greater_eq greater"
haftmann@36635
    78
by (rule class.semilattice_inf.intro, rule dual_order)
haftmann@27682
    79
  (unfold_locales, simp_all add: sup_least)
haftmann@26014
    80
haftmann@26014
    81
end
haftmann@21249
    82
haftmann@35028
    83
class lattice = semilattice_inf + semilattice_sup
haftmann@21249
    84
wenzelm@25382
    85
haftmann@28562
    86
subsubsection {* Intro and elim rules*}
nipkow@21733
    87
haftmann@35028
    88
context semilattice_inf
nipkow@21733
    89
begin
haftmann@21249
    90
haftmann@32064
    91
lemma le_infI1:
haftmann@32064
    92
  "a \<sqsubseteq> x \<Longrightarrow> a \<sqinter> b \<sqsubseteq> x"
haftmann@32064
    93
  by (rule order_trans) auto
haftmann@21249
    94
haftmann@32064
    95
lemma le_infI2:
haftmann@32064
    96
  "b \<sqsubseteq> x \<Longrightarrow> a \<sqinter> b \<sqsubseteq> x"
haftmann@32064
    97
  by (rule order_trans) auto
nipkow@21733
    98
haftmann@32064
    99
lemma le_infI: "x \<sqsubseteq> a \<Longrightarrow> x \<sqsubseteq> b \<Longrightarrow> x \<sqsubseteq> a \<sqinter> b"
huffman@36008
   100
  by (rule inf_greatest) (* FIXME: duplicate lemma *)
haftmann@21249
   101
haftmann@32064
   102
lemma le_infE: "x \<sqsubseteq> a \<sqinter> b \<Longrightarrow> (x \<sqsubseteq> a \<Longrightarrow> x \<sqsubseteq> b \<Longrightarrow> P) \<Longrightarrow> P"
huffman@36008
   103
  by (blast intro: order_trans inf_le1 inf_le2)
haftmann@21249
   104
nipkow@21734
   105
lemma le_inf_iff [simp]:
haftmann@32064
   106
  "x \<sqsubseteq> y \<sqinter> z \<longleftrightarrow> x \<sqsubseteq> y \<and> x \<sqsubseteq> z"
haftmann@32064
   107
  by (blast intro: le_infI elim: le_infE)
nipkow@21733
   108
haftmann@32064
   109
lemma le_iff_inf:
haftmann@32064
   110
  "x \<sqsubseteq> y \<longleftrightarrow> x \<sqinter> y = x"
haftmann@32064
   111
  by (auto intro: le_infI1 antisym dest: eq_iff [THEN iffD1])
haftmann@21249
   112
haftmann@43753
   113
lemma inf_mono: "a \<sqsubseteq> c \<Longrightarrow> b \<sqsubseteq> d \<Longrightarrow> a \<sqinter> b \<sqsubseteq> c \<sqinter> d"
huffman@36008
   114
  by (fast intro: inf_greatest le_infI1 le_infI2)
huffman@36008
   115
haftmann@25206
   116
lemma mono_inf:
haftmann@35028
   117
  fixes f :: "'a \<Rightarrow> 'b\<Colon>semilattice_inf"
haftmann@34007
   118
  shows "mono f \<Longrightarrow> f (A \<sqinter> B) \<sqsubseteq> f A \<sqinter> f B"
haftmann@25206
   119
  by (auto simp add: mono_def intro: Lattices.inf_greatest)
nipkow@21733
   120
haftmann@25206
   121
end
nipkow@21733
   122
haftmann@35028
   123
context semilattice_sup
nipkow@21733
   124
begin
haftmann@21249
   125
haftmann@32064
   126
lemma le_supI1:
haftmann@32064
   127
  "x \<sqsubseteq> a \<Longrightarrow> x \<sqsubseteq> a \<squnion> b"
haftmann@25062
   128
  by (rule order_trans) auto
haftmann@21249
   129
haftmann@32064
   130
lemma le_supI2:
haftmann@32064
   131
  "x \<sqsubseteq> b \<Longrightarrow> x \<sqsubseteq> a \<squnion> b"
haftmann@25062
   132
  by (rule order_trans) auto 
nipkow@21733
   133
haftmann@32064
   134
lemma le_supI:
haftmann@32064
   135
  "a \<sqsubseteq> x \<Longrightarrow> b \<sqsubseteq> x \<Longrightarrow> a \<squnion> b \<sqsubseteq> x"
huffman@36008
   136
  by (rule sup_least) (* FIXME: duplicate lemma *)
haftmann@21249
   137
haftmann@32064
   138
lemma le_supE:
haftmann@32064
   139
  "a \<squnion> b \<sqsubseteq> x \<Longrightarrow> (a \<sqsubseteq> x \<Longrightarrow> b \<sqsubseteq> x \<Longrightarrow> P) \<Longrightarrow> P"
huffman@36008
   140
  by (blast intro: order_trans sup_ge1 sup_ge2)
haftmann@22422
   141
haftmann@32064
   142
lemma le_sup_iff [simp]:
haftmann@32064
   143
  "x \<squnion> y \<sqsubseteq> z \<longleftrightarrow> x \<sqsubseteq> z \<and> y \<sqsubseteq> z"
haftmann@32064
   144
  by (blast intro: le_supI elim: le_supE)
nipkow@21733
   145
haftmann@32064
   146
lemma le_iff_sup:
haftmann@32064
   147
  "x \<sqsubseteq> y \<longleftrightarrow> x \<squnion> y = y"
haftmann@32064
   148
  by (auto intro: le_supI2 antisym dest: eq_iff [THEN iffD1])
nipkow@21734
   149
haftmann@43753
   150
lemma sup_mono: "a \<sqsubseteq> c \<Longrightarrow> b \<sqsubseteq> d \<Longrightarrow> a \<squnion> b \<sqsubseteq> c \<squnion> d"
huffman@36008
   151
  by (fast intro: sup_least le_supI1 le_supI2)
huffman@36008
   152
haftmann@25206
   153
lemma mono_sup:
haftmann@35028
   154
  fixes f :: "'a \<Rightarrow> 'b\<Colon>semilattice_sup"
haftmann@34007
   155
  shows "mono f \<Longrightarrow> f A \<squnion> f B \<sqsubseteq> f (A \<squnion> B)"
haftmann@25206
   156
  by (auto simp add: mono_def intro: Lattices.sup_least)
nipkow@21733
   157
haftmann@25206
   158
end
haftmann@23878
   159
nipkow@21733
   160
haftmann@32064
   161
subsubsection {* Equational laws *}
haftmann@21249
   162
haftmann@35028
   163
sublocale semilattice_inf < inf!: semilattice inf
haftmann@34973
   164
proof
haftmann@34973
   165
  fix a b c
haftmann@34973
   166
  show "(a \<sqinter> b) \<sqinter> c = a \<sqinter> (b \<sqinter> c)"
haftmann@34973
   167
    by (rule antisym) (auto intro: le_infI1 le_infI2)
haftmann@34973
   168
  show "a \<sqinter> b = b \<sqinter> a"
haftmann@34973
   169
    by (rule antisym) auto
haftmann@34973
   170
  show "a \<sqinter> a = a"
haftmann@34973
   171
    by (rule antisym) auto
haftmann@34973
   172
qed
haftmann@34973
   173
haftmann@35028
   174
context semilattice_inf
nipkow@21733
   175
begin
nipkow@21733
   176
haftmann@34973
   177
lemma inf_assoc: "(x \<sqinter> y) \<sqinter> z = x \<sqinter> (y \<sqinter> z)"
haftmann@34973
   178
  by (fact inf.assoc)
nipkow@21733
   179
haftmann@34973
   180
lemma inf_commute: "(x \<sqinter> y) = (y \<sqinter> x)"
haftmann@34973
   181
  by (fact inf.commute)
nipkow@21733
   182
haftmann@34973
   183
lemma inf_left_commute: "x \<sqinter> (y \<sqinter> z) = y \<sqinter> (x \<sqinter> z)"
haftmann@34973
   184
  by (fact inf.left_commute)
nipkow@21733
   185
huffman@44921
   186
lemma inf_idem: "x \<sqinter> x = x"
huffman@44921
   187
  by (fact inf.idem) (* already simp *)
haftmann@34973
   188
nipkow@50615
   189
lemma inf_left_idem: "x \<sqinter> (x \<sqinter> y) = x \<sqinter> y"
nipkow@50615
   190
  by (fact inf.left_idem) (* already simp *)
nipkow@50615
   191
nipkow@50615
   192
lemma inf_right_idem: "(x \<sqinter> y) \<sqinter> y = x \<sqinter> y"
nipkow@50615
   193
  by (fact inf.right_idem) (* already simp *)
nipkow@21733
   194
haftmann@32642
   195
lemma inf_absorb1: "x \<sqsubseteq> y \<Longrightarrow> x \<sqinter> y = x"
haftmann@32064
   196
  by (rule antisym) auto
nipkow@21733
   197
haftmann@32642
   198
lemma inf_absorb2: "y \<sqsubseteq> x \<Longrightarrow> x \<sqinter> y = y"
haftmann@32064
   199
  by (rule antisym) auto
haftmann@34973
   200
 
haftmann@32064
   201
lemmas inf_aci = inf_commute inf_assoc inf_left_commute inf_left_idem
nipkow@21733
   202
nipkow@21733
   203
end
nipkow@21733
   204
haftmann@35028
   205
sublocale semilattice_sup < sup!: semilattice sup
haftmann@34973
   206
proof
haftmann@34973
   207
  fix a b c
haftmann@34973
   208
  show "(a \<squnion> b) \<squnion> c = a \<squnion> (b \<squnion> c)"
haftmann@34973
   209
    by (rule antisym) (auto intro: le_supI1 le_supI2)
haftmann@34973
   210
  show "a \<squnion> b = b \<squnion> a"
haftmann@34973
   211
    by (rule antisym) auto
haftmann@34973
   212
  show "a \<squnion> a = a"
haftmann@34973
   213
    by (rule antisym) auto
haftmann@34973
   214
qed
haftmann@34973
   215
haftmann@35028
   216
context semilattice_sup
nipkow@21733
   217
begin
haftmann@21249
   218
haftmann@34973
   219
lemma sup_assoc: "(x \<squnion> y) \<squnion> z = x \<squnion> (y \<squnion> z)"
haftmann@34973
   220
  by (fact sup.assoc)
nipkow@21733
   221
haftmann@34973
   222
lemma sup_commute: "(x \<squnion> y) = (y \<squnion> x)"
haftmann@34973
   223
  by (fact sup.commute)
nipkow@21733
   224
haftmann@34973
   225
lemma sup_left_commute: "x \<squnion> (y \<squnion> z) = y \<squnion> (x \<squnion> z)"
haftmann@34973
   226
  by (fact sup.left_commute)
nipkow@21733
   227
huffman@44921
   228
lemma sup_idem: "x \<squnion> x = x"
huffman@44921
   229
  by (fact sup.idem) (* already simp *)
haftmann@34973
   230
noschinl@44918
   231
lemma sup_left_idem [simp]: "x \<squnion> (x \<squnion> y) = x \<squnion> y"
haftmann@34973
   232
  by (fact sup.left_idem)
nipkow@21733
   233
haftmann@32642
   234
lemma sup_absorb1: "y \<sqsubseteq> x \<Longrightarrow> x \<squnion> y = x"
haftmann@32064
   235
  by (rule antisym) auto
nipkow@21733
   236
haftmann@32642
   237
lemma sup_absorb2: "x \<sqsubseteq> y \<Longrightarrow> x \<squnion> y = y"
haftmann@32064
   238
  by (rule antisym) auto
haftmann@21249
   239
haftmann@32064
   240
lemmas sup_aci = sup_commute sup_assoc sup_left_commute sup_left_idem
nipkow@21733
   241
nipkow@21733
   242
end
haftmann@21249
   243
nipkow@21733
   244
context lattice
nipkow@21733
   245
begin
nipkow@21733
   246
haftmann@31991
   247
lemma dual_lattice:
krauss@44845
   248
  "class.lattice sup (op \<ge>) (op >) inf"
haftmann@36635
   249
  by (rule class.lattice.intro, rule dual_semilattice, rule class.semilattice_sup.intro, rule dual_order)
haftmann@31991
   250
    (unfold_locales, auto)
haftmann@31991
   251
noschinl@44918
   252
lemma inf_sup_absorb [simp]: "x \<sqinter> (x \<squnion> y) = x"
haftmann@25102
   253
  by (blast intro: antisym inf_le1 inf_greatest sup_ge1)
nipkow@21733
   254
noschinl@44918
   255
lemma sup_inf_absorb [simp]: "x \<squnion> (x \<sqinter> y) = x"
haftmann@25102
   256
  by (blast intro: antisym sup_ge1 sup_least inf_le1)
nipkow@21733
   257
haftmann@32064
   258
lemmas inf_sup_aci = inf_aci sup_aci
nipkow@21734
   259
haftmann@22454
   260
lemmas inf_sup_ord = inf_le1 inf_le2 sup_ge1 sup_ge2
haftmann@22454
   261
nipkow@21734
   262
text{* Towards distributivity *}
haftmann@21249
   263
nipkow@21734
   264
lemma distrib_sup_le: "x \<squnion> (y \<sqinter> z) \<sqsubseteq> (x \<squnion> y) \<sqinter> (x \<squnion> z)"
haftmann@32064
   265
  by (auto intro: le_infI1 le_infI2 le_supI1 le_supI2)
nipkow@21734
   266
nipkow@21734
   267
lemma distrib_inf_le: "(x \<sqinter> y) \<squnion> (x \<sqinter> z) \<sqsubseteq> x \<sqinter> (y \<squnion> z)"
haftmann@32064
   268
  by (auto intro: le_infI1 le_infI2 le_supI1 le_supI2)
nipkow@21734
   269
nipkow@21734
   270
text{* If you have one of them, you have them all. *}
haftmann@21249
   271
nipkow@21733
   272
lemma distrib_imp1:
haftmann@21249
   273
assumes D: "!!x y z. x \<sqinter> (y \<squnion> z) = (x \<sqinter> y) \<squnion> (x \<sqinter> z)"
haftmann@21249
   274
shows "x \<squnion> (y \<sqinter> z) = (x \<squnion> y) \<sqinter> (x \<squnion> z)"
haftmann@21249
   275
proof-
noschinl@44918
   276
  have "x \<squnion> (y \<sqinter> z) = (x \<squnion> (x \<sqinter> z)) \<squnion> (y \<sqinter> z)" by simp
noschinl@44918
   277
  also have "\<dots> = x \<squnion> (z \<sqinter> (x \<squnion> y))"
noschinl@44918
   278
    by (simp add: D inf_commute sup_assoc del: sup_inf_absorb)
haftmann@21249
   279
  also have "\<dots> = ((x \<squnion> y) \<sqinter> x) \<squnion> ((x \<squnion> y) \<sqinter> z)"
noschinl@44919
   280
    by(simp add: inf_commute)
haftmann@21249
   281
  also have "\<dots> = (x \<squnion> y) \<sqinter> (x \<squnion> z)" by(simp add:D)
haftmann@21249
   282
  finally show ?thesis .
haftmann@21249
   283
qed
haftmann@21249
   284
nipkow@21733
   285
lemma distrib_imp2:
haftmann@21249
   286
assumes D: "!!x y z. x \<squnion> (y \<sqinter> z) = (x \<squnion> y) \<sqinter> (x \<squnion> z)"
haftmann@21249
   287
shows "x \<sqinter> (y \<squnion> z) = (x \<sqinter> y) \<squnion> (x \<sqinter> z)"
haftmann@21249
   288
proof-
noschinl@44918
   289
  have "x \<sqinter> (y \<squnion> z) = (x \<sqinter> (x \<squnion> z)) \<sqinter> (y \<squnion> z)" by simp
noschinl@44918
   290
  also have "\<dots> = x \<sqinter> (z \<squnion> (x \<sqinter> y))"
noschinl@44918
   291
    by (simp add: D sup_commute inf_assoc del: inf_sup_absorb)
haftmann@21249
   292
  also have "\<dots> = ((x \<sqinter> y) \<squnion> x) \<sqinter> ((x \<sqinter> y) \<squnion> z)"
noschinl@44919
   293
    by(simp add: sup_commute)
haftmann@21249
   294
  also have "\<dots> = (x \<sqinter> y) \<squnion> (x \<sqinter> z)" by(simp add:D)
haftmann@21249
   295
  finally show ?thesis .
haftmann@21249
   296
qed
haftmann@21249
   297
nipkow@21733
   298
end
haftmann@21249
   299
haftmann@32568
   300
subsubsection {* Strict order *}
haftmann@32568
   301
haftmann@35028
   302
context semilattice_inf
haftmann@32568
   303
begin
haftmann@32568
   304
haftmann@32568
   305
lemma less_infI1:
haftmann@32568
   306
  "a \<sqsubset> x \<Longrightarrow> a \<sqinter> b \<sqsubset> x"
haftmann@32642
   307
  by (auto simp add: less_le inf_absorb1 intro: le_infI1)
haftmann@32568
   308
haftmann@32568
   309
lemma less_infI2:
haftmann@32568
   310
  "b \<sqsubset> x \<Longrightarrow> a \<sqinter> b \<sqsubset> x"
haftmann@32642
   311
  by (auto simp add: less_le inf_absorb2 intro: le_infI2)
haftmann@32568
   312
haftmann@32568
   313
end
haftmann@32568
   314
haftmann@35028
   315
context semilattice_sup
haftmann@32568
   316
begin
haftmann@32568
   317
haftmann@32568
   318
lemma less_supI1:
haftmann@34007
   319
  "x \<sqsubset> a \<Longrightarrow> x \<sqsubset> a \<squnion> b"
huffman@44921
   320
  using dual_semilattice
huffman@44921
   321
  by (rule semilattice_inf.less_infI1)
haftmann@32568
   322
haftmann@32568
   323
lemma less_supI2:
haftmann@34007
   324
  "x \<sqsubset> b \<Longrightarrow> x \<sqsubset> a \<squnion> b"
huffman@44921
   325
  using dual_semilattice
huffman@44921
   326
  by (rule semilattice_inf.less_infI2)
haftmann@32568
   327
haftmann@32568
   328
end
haftmann@32568
   329
haftmann@21249
   330
haftmann@24164
   331
subsection {* Distributive lattices *}
haftmann@21249
   332
haftmann@22454
   333
class distrib_lattice = lattice +
haftmann@21249
   334
  assumes sup_inf_distrib1: "x \<squnion> (y \<sqinter> z) = (x \<squnion> y) \<sqinter> (x \<squnion> z)"
haftmann@21249
   335
nipkow@21733
   336
context distrib_lattice
nipkow@21733
   337
begin
nipkow@21733
   338
nipkow@21733
   339
lemma sup_inf_distrib2:
huffman@44921
   340
  "(y \<sqinter> z) \<squnion> x = (y \<squnion> x) \<sqinter> (z \<squnion> x)"
huffman@44921
   341
  by (simp add: sup_commute sup_inf_distrib1)
haftmann@21249
   342
nipkow@21733
   343
lemma inf_sup_distrib1:
huffman@44921
   344
  "x \<sqinter> (y \<squnion> z) = (x \<sqinter> y) \<squnion> (x \<sqinter> z)"
huffman@44921
   345
  by (rule distrib_imp2 [OF sup_inf_distrib1])
haftmann@21249
   346
nipkow@21733
   347
lemma inf_sup_distrib2:
huffman@44921
   348
  "(y \<squnion> z) \<sqinter> x = (y \<sqinter> x) \<squnion> (z \<sqinter> x)"
huffman@44921
   349
  by (simp add: inf_commute inf_sup_distrib1)
haftmann@21249
   350
haftmann@31991
   351
lemma dual_distrib_lattice:
krauss@44845
   352
  "class.distrib_lattice sup (op \<ge>) (op >) inf"
haftmann@36635
   353
  by (rule class.distrib_lattice.intro, rule dual_lattice)
haftmann@31991
   354
    (unfold_locales, fact inf_sup_distrib1)
haftmann@31991
   355
huffman@36008
   356
lemmas sup_inf_distrib =
huffman@36008
   357
  sup_inf_distrib1 sup_inf_distrib2
huffman@36008
   358
huffman@36008
   359
lemmas inf_sup_distrib =
huffman@36008
   360
  inf_sup_distrib1 inf_sup_distrib2
huffman@36008
   361
nipkow@21733
   362
lemmas distrib =
haftmann@21249
   363
  sup_inf_distrib1 sup_inf_distrib2 inf_sup_distrib1 inf_sup_distrib2
haftmann@21249
   364
nipkow@21733
   365
end
nipkow@21733
   366
haftmann@21249
   367
haftmann@34007
   368
subsection {* Bounded lattices and boolean algebras *}
haftmann@31991
   369
kaliszyk@36352
   370
class bounded_lattice_bot = lattice + bot
haftmann@31991
   371
begin
haftmann@31991
   372
haftmann@31991
   373
lemma inf_bot_left [simp]:
haftmann@34007
   374
  "\<bottom> \<sqinter> x = \<bottom>"
haftmann@31991
   375
  by (rule inf_absorb1) simp
haftmann@31991
   376
haftmann@31991
   377
lemma inf_bot_right [simp]:
haftmann@34007
   378
  "x \<sqinter> \<bottom> = \<bottom>"
haftmann@31991
   379
  by (rule inf_absorb2) simp
haftmann@31991
   380
kaliszyk@36352
   381
lemma sup_bot_left [simp]:
kaliszyk@36352
   382
  "\<bottom> \<squnion> x = x"
kaliszyk@36352
   383
  by (rule sup_absorb2) simp
kaliszyk@36352
   384
kaliszyk@36352
   385
lemma sup_bot_right [simp]:
kaliszyk@36352
   386
  "x \<squnion> \<bottom> = x"
kaliszyk@36352
   387
  by (rule sup_absorb1) simp
kaliszyk@36352
   388
kaliszyk@36352
   389
lemma sup_eq_bot_iff [simp]:
kaliszyk@36352
   390
  "x \<squnion> y = \<bottom> \<longleftrightarrow> x = \<bottom> \<and> y = \<bottom>"
kaliszyk@36352
   391
  by (simp add: eq_iff)
kaliszyk@36352
   392
kaliszyk@36352
   393
end
kaliszyk@36352
   394
kaliszyk@36352
   395
class bounded_lattice_top = lattice + top
kaliszyk@36352
   396
begin
kaliszyk@36352
   397
haftmann@31991
   398
lemma sup_top_left [simp]:
haftmann@34007
   399
  "\<top> \<squnion> x = \<top>"
haftmann@31991
   400
  by (rule sup_absorb1) simp
haftmann@31991
   401
haftmann@31991
   402
lemma sup_top_right [simp]:
haftmann@34007
   403
  "x \<squnion> \<top> = \<top>"
haftmann@31991
   404
  by (rule sup_absorb2) simp
haftmann@31991
   405
haftmann@31991
   406
lemma inf_top_left [simp]:
haftmann@34007
   407
  "\<top> \<sqinter> x = x"
haftmann@31991
   408
  by (rule inf_absorb2) simp
haftmann@31991
   409
haftmann@31991
   410
lemma inf_top_right [simp]:
haftmann@34007
   411
  "x \<sqinter> \<top> = x"
haftmann@31991
   412
  by (rule inf_absorb1) simp
haftmann@31991
   413
huffman@36008
   414
lemma inf_eq_top_iff [simp]:
huffman@36008
   415
  "x \<sqinter> y = \<top> \<longleftrightarrow> x = \<top> \<and> y = \<top>"
huffman@36008
   416
  by (simp add: eq_iff)
haftmann@32568
   417
kaliszyk@36352
   418
end
kaliszyk@36352
   419
kaliszyk@36352
   420
class bounded_lattice = bounded_lattice_bot + bounded_lattice_top
kaliszyk@36352
   421
begin
kaliszyk@36352
   422
kaliszyk@36352
   423
lemma dual_bounded_lattice:
krauss@44845
   424
  "class.bounded_lattice sup greater_eq greater inf \<top> \<bottom>"
kaliszyk@36352
   425
  by unfold_locales (auto simp add: less_le_not_le)
haftmann@32568
   426
haftmann@34007
   427
end
haftmann@34007
   428
haftmann@34007
   429
class boolean_algebra = distrib_lattice + bounded_lattice + minus + uminus +
haftmann@34007
   430
  assumes inf_compl_bot: "x \<sqinter> - x = \<bottom>"
haftmann@34007
   431
    and sup_compl_top: "x \<squnion> - x = \<top>"
haftmann@34007
   432
  assumes diff_eq: "x - y = x \<sqinter> - y"
haftmann@34007
   433
begin
haftmann@34007
   434
haftmann@34007
   435
lemma dual_boolean_algebra:
krauss@44845
   436
  "class.boolean_algebra (\<lambda>x y. x \<squnion> - y) uminus sup greater_eq greater inf \<top> \<bottom>"
haftmann@36635
   437
  by (rule class.boolean_algebra.intro, rule dual_bounded_lattice, rule dual_distrib_lattice)
haftmann@34007
   438
    (unfold_locales, auto simp add: inf_compl_bot sup_compl_top diff_eq)
haftmann@34007
   439
noschinl@44918
   440
lemma compl_inf_bot [simp]:
haftmann@34007
   441
  "- x \<sqinter> x = \<bottom>"
haftmann@34007
   442
  by (simp add: inf_commute inf_compl_bot)
haftmann@34007
   443
noschinl@44918
   444
lemma compl_sup_top [simp]:
haftmann@34007
   445
  "- x \<squnion> x = \<top>"
haftmann@34007
   446
  by (simp add: sup_commute sup_compl_top)
haftmann@34007
   447
haftmann@31991
   448
lemma compl_unique:
haftmann@34007
   449
  assumes "x \<sqinter> y = \<bottom>"
haftmann@34007
   450
    and "x \<squnion> y = \<top>"
haftmann@31991
   451
  shows "- x = y"
haftmann@31991
   452
proof -
haftmann@31991
   453
  have "(x \<sqinter> - x) \<squnion> (- x \<sqinter> y) = (x \<sqinter> y) \<squnion> (- x \<sqinter> y)"
haftmann@31991
   454
    using inf_compl_bot assms(1) by simp
haftmann@31991
   455
  then have "(- x \<sqinter> x) \<squnion> (- x \<sqinter> y) = (y \<sqinter> x) \<squnion> (y \<sqinter> - x)"
haftmann@31991
   456
    by (simp add: inf_commute)
haftmann@31991
   457
  then have "- x \<sqinter> (x \<squnion> y) = y \<sqinter> (x \<squnion> - x)"
haftmann@31991
   458
    by (simp add: inf_sup_distrib1)
haftmann@34007
   459
  then have "- x \<sqinter> \<top> = y \<sqinter> \<top>"
haftmann@31991
   460
    using sup_compl_top assms(2) by simp
krauss@34209
   461
  then show "- x = y" by simp
haftmann@31991
   462
qed
haftmann@31991
   463
haftmann@31991
   464
lemma double_compl [simp]:
haftmann@31991
   465
  "- (- x) = x"
haftmann@31991
   466
  using compl_inf_bot compl_sup_top by (rule compl_unique)
haftmann@31991
   467
haftmann@31991
   468
lemma compl_eq_compl_iff [simp]:
haftmann@31991
   469
  "- x = - y \<longleftrightarrow> x = y"
haftmann@31991
   470
proof
haftmann@31991
   471
  assume "- x = - y"
huffman@36008
   472
  then have "- (- x) = - (- y)" by (rule arg_cong)
haftmann@31991
   473
  then show "x = y" by simp
haftmann@31991
   474
next
haftmann@31991
   475
  assume "x = y"
haftmann@31991
   476
  then show "- x = - y" by simp
haftmann@31991
   477
qed
haftmann@31991
   478
haftmann@31991
   479
lemma compl_bot_eq [simp]:
haftmann@34007
   480
  "- \<bottom> = \<top>"
haftmann@31991
   481
proof -
haftmann@34007
   482
  from sup_compl_top have "\<bottom> \<squnion> - \<bottom> = \<top>" .
haftmann@31991
   483
  then show ?thesis by simp
haftmann@31991
   484
qed
haftmann@31991
   485
haftmann@31991
   486
lemma compl_top_eq [simp]:
haftmann@34007
   487
  "- \<top> = \<bottom>"
haftmann@31991
   488
proof -
haftmann@34007
   489
  from inf_compl_bot have "\<top> \<sqinter> - \<top> = \<bottom>" .
haftmann@31991
   490
  then show ?thesis by simp
haftmann@31991
   491
qed
haftmann@31991
   492
haftmann@31991
   493
lemma compl_inf [simp]:
haftmann@31991
   494
  "- (x \<sqinter> y) = - x \<squnion> - y"
haftmann@31991
   495
proof (rule compl_unique)
huffman@36008
   496
  have "(x \<sqinter> y) \<sqinter> (- x \<squnion> - y) = (y \<sqinter> (x \<sqinter> - x)) \<squnion> (x \<sqinter> (y \<sqinter> - y))"
huffman@36008
   497
    by (simp only: inf_sup_distrib inf_aci)
huffman@36008
   498
  then show "(x \<sqinter> y) \<sqinter> (- x \<squnion> - y) = \<bottom>"
haftmann@31991
   499
    by (simp add: inf_compl_bot)
haftmann@31991
   500
next
huffman@36008
   501
  have "(x \<sqinter> y) \<squnion> (- x \<squnion> - y) = (- y \<squnion> (x \<squnion> - x)) \<sqinter> (- x \<squnion> (y \<squnion> - y))"
huffman@36008
   502
    by (simp only: sup_inf_distrib sup_aci)
huffman@36008
   503
  then show "(x \<sqinter> y) \<squnion> (- x \<squnion> - y) = \<top>"
haftmann@31991
   504
    by (simp add: sup_compl_top)
haftmann@31991
   505
qed
haftmann@31991
   506
haftmann@31991
   507
lemma compl_sup [simp]:
haftmann@31991
   508
  "- (x \<squnion> y) = - x \<sqinter> - y"
huffman@44921
   509
  using dual_boolean_algebra
huffman@44921
   510
  by (rule boolean_algebra.compl_inf)
haftmann@31991
   511
huffman@36008
   512
lemma compl_mono:
huffman@36008
   513
  "x \<sqsubseteq> y \<Longrightarrow> - y \<sqsubseteq> - x"
huffman@36008
   514
proof -
huffman@36008
   515
  assume "x \<sqsubseteq> y"
huffman@36008
   516
  then have "x \<squnion> y = y" by (simp only: le_iff_sup)
huffman@36008
   517
  then have "- (x \<squnion> y) = - y" by simp
huffman@36008
   518
  then have "- x \<sqinter> - y = - y" by simp
huffman@36008
   519
  then have "- y \<sqinter> - x = - y" by (simp only: inf_commute)
huffman@36008
   520
  then show "- y \<sqsubseteq> - x" by (simp only: le_iff_inf)
huffman@36008
   521
qed
huffman@36008
   522
noschinl@44918
   523
lemma compl_le_compl_iff [simp]:
haftmann@43753
   524
  "- x \<sqsubseteq> - y \<longleftrightarrow> y \<sqsubseteq> x"
haftmann@43873
   525
  by (auto dest: compl_mono)
haftmann@43873
   526
haftmann@43873
   527
lemma compl_le_swap1:
haftmann@43873
   528
  assumes "y \<sqsubseteq> - x" shows "x \<sqsubseteq> -y"
haftmann@43873
   529
proof -
haftmann@43873
   530
  from assms have "- (- x) \<sqsubseteq> - y" by (simp only: compl_le_compl_iff)
haftmann@43873
   531
  then show ?thesis by simp
haftmann@43873
   532
qed
haftmann@43873
   533
haftmann@43873
   534
lemma compl_le_swap2:
haftmann@43873
   535
  assumes "- y \<sqsubseteq> x" shows "- x \<sqsubseteq> y"
haftmann@43873
   536
proof -
haftmann@43873
   537
  from assms have "- x \<sqsubseteq> - (- y)" by (simp only: compl_le_compl_iff)
haftmann@43873
   538
  then show ?thesis by simp
haftmann@43873
   539
qed
haftmann@43873
   540
haftmann@43873
   541
lemma compl_less_compl_iff: (* TODO: declare [simp] ? *)
haftmann@43873
   542
  "- x \<sqsubset> - y \<longleftrightarrow> y \<sqsubset> x"
noschinl@44919
   543
  by (auto simp add: less_le)
haftmann@43873
   544
haftmann@43873
   545
lemma compl_less_swap1:
haftmann@43873
   546
  assumes "y \<sqsubset> - x" shows "x \<sqsubset> - y"
haftmann@43873
   547
proof -
haftmann@43873
   548
  from assms have "- (- x) \<sqsubset> - y" by (simp only: compl_less_compl_iff)
haftmann@43873
   549
  then show ?thesis by simp
haftmann@43873
   550
qed
haftmann@43873
   551
haftmann@43873
   552
lemma compl_less_swap2:
haftmann@43873
   553
  assumes "- y \<sqsubset> x" shows "- x \<sqsubset> y"
haftmann@43873
   554
proof -
haftmann@43873
   555
  from assms have "- x \<sqsubset> - (- y)" by (simp only: compl_less_compl_iff)
haftmann@43873
   556
  then show ?thesis by simp
haftmann@43873
   557
qed
huffman@36008
   558
haftmann@31991
   559
end
haftmann@31991
   560
haftmann@31991
   561
haftmann@22454
   562
subsection {* Uniqueness of inf and sup *}
haftmann@22454
   563
haftmann@35028
   564
lemma (in semilattice_inf) inf_unique:
haftmann@22454
   565
  fixes f (infixl "\<triangle>" 70)
haftmann@34007
   566
  assumes le1: "\<And>x y. x \<triangle> y \<sqsubseteq> x" and le2: "\<And>x y. x \<triangle> y \<sqsubseteq> y"
haftmann@34007
   567
  and greatest: "\<And>x y z. x \<sqsubseteq> y \<Longrightarrow> x \<sqsubseteq> z \<Longrightarrow> x \<sqsubseteq> y \<triangle> z"
haftmann@22737
   568
  shows "x \<sqinter> y = x \<triangle> y"
haftmann@22454
   569
proof (rule antisym)
haftmann@34007
   570
  show "x \<triangle> y \<sqsubseteq> x \<sqinter> y" by (rule le_infI) (rule le1, rule le2)
haftmann@22454
   571
next
haftmann@34007
   572
  have leI: "\<And>x y z. x \<sqsubseteq> y \<Longrightarrow> x \<sqsubseteq> z \<Longrightarrow> x \<sqsubseteq> y \<triangle> z" by (blast intro: greatest)
haftmann@34007
   573
  show "x \<sqinter> y \<sqsubseteq> x \<triangle> y" by (rule leI) simp_all
haftmann@22454
   574
qed
haftmann@22454
   575
haftmann@35028
   576
lemma (in semilattice_sup) sup_unique:
haftmann@22454
   577
  fixes f (infixl "\<nabla>" 70)
haftmann@34007
   578
  assumes ge1 [simp]: "\<And>x y. x \<sqsubseteq> x \<nabla> y" and ge2: "\<And>x y. y \<sqsubseteq> x \<nabla> y"
haftmann@34007
   579
  and least: "\<And>x y z. y \<sqsubseteq> x \<Longrightarrow> z \<sqsubseteq> x \<Longrightarrow> y \<nabla> z \<sqsubseteq> x"
haftmann@22737
   580
  shows "x \<squnion> y = x \<nabla> y"
haftmann@22454
   581
proof (rule antisym)
haftmann@34007
   582
  show "x \<squnion> y \<sqsubseteq> x \<nabla> y" by (rule le_supI) (rule ge1, rule ge2)
haftmann@22454
   583
next
haftmann@34007
   584
  have leI: "\<And>x y z. x \<sqsubseteq> z \<Longrightarrow> y \<sqsubseteq> z \<Longrightarrow> x \<nabla> y \<sqsubseteq> z" by (blast intro: least)
haftmann@34007
   585
  show "x \<nabla> y \<sqsubseteq> x \<squnion> y" by (rule leI) simp_all
haftmann@22454
   586
qed
huffman@36008
   587
haftmann@22454
   588
haftmann@22916
   589
subsection {* @{const min}/@{const max} on linear orders as
haftmann@22916
   590
  special case of @{const inf}/@{const sup} *}
haftmann@22916
   591
krauss@44845
   592
sublocale linorder < min_max!: distrib_lattice min less_eq less max
haftmann@28823
   593
proof
haftmann@22916
   594
  fix x y z
haftmann@32512
   595
  show "max x (min y z) = min (max x y) (max x z)"
haftmann@32512
   596
    by (auto simp add: min_def max_def)
haftmann@22916
   597
qed (auto simp add: min_def max_def not_le less_imp_le)
haftmann@21249
   598
haftmann@35028
   599
lemma inf_min: "inf = (min \<Colon> 'a\<Colon>{semilattice_inf, linorder} \<Rightarrow> 'a \<Rightarrow> 'a)"
haftmann@25102
   600
  by (rule ext)+ (auto intro: antisym)
nipkow@21733
   601
haftmann@35028
   602
lemma sup_max: "sup = (max \<Colon> 'a\<Colon>{semilattice_sup, linorder} \<Rightarrow> 'a \<Rightarrow> 'a)"
haftmann@25102
   603
  by (rule ext)+ (auto intro: antisym)
nipkow@21733
   604
haftmann@21249
   605
lemmas le_maxI1 = min_max.sup_ge1
haftmann@21249
   606
lemmas le_maxI2 = min_max.sup_ge2
haftmann@21381
   607
 
haftmann@34973
   608
lemmas min_ac = min_max.inf_assoc min_max.inf_commute
haftmann@34973
   609
  min_max.inf.left_commute
haftmann@21249
   610
haftmann@34973
   611
lemmas max_ac = min_max.sup_assoc min_max.sup_commute
haftmann@34973
   612
  min_max.sup.left_commute
haftmann@34973
   613
haftmann@21249
   614
haftmann@46631
   615
subsection {* Lattice on @{typ bool} *}
haftmann@22454
   616
haftmann@31991
   617
instantiation bool :: boolean_algebra
haftmann@25510
   618
begin
haftmann@25510
   619
haftmann@25510
   620
definition
haftmann@41080
   621
  bool_Compl_def [simp]: "uminus = Not"
haftmann@31991
   622
haftmann@31991
   623
definition
haftmann@41080
   624
  bool_diff_def [simp]: "A - B \<longleftrightarrow> A \<and> \<not> B"
haftmann@31991
   625
haftmann@31991
   626
definition
haftmann@41080
   627
  [simp]: "P \<sqinter> Q \<longleftrightarrow> P \<and> Q"
haftmann@25510
   628
haftmann@25510
   629
definition
haftmann@41080
   630
  [simp]: "P \<squnion> Q \<longleftrightarrow> P \<or> Q"
haftmann@25510
   631
haftmann@31991
   632
instance proof
haftmann@41080
   633
qed auto
haftmann@22454
   634
haftmann@25510
   635
end
haftmann@25510
   636
haftmann@32781
   637
lemma sup_boolI1:
haftmann@32781
   638
  "P \<Longrightarrow> P \<squnion> Q"
haftmann@41080
   639
  by simp
haftmann@32781
   640
haftmann@32781
   641
lemma sup_boolI2:
haftmann@32781
   642
  "Q \<Longrightarrow> P \<squnion> Q"
haftmann@41080
   643
  by simp
haftmann@32781
   644
haftmann@32781
   645
lemma sup_boolE:
haftmann@32781
   646
  "P \<squnion> Q \<Longrightarrow> (P \<Longrightarrow> R) \<Longrightarrow> (Q \<Longrightarrow> R) \<Longrightarrow> R"
haftmann@41080
   647
  by auto
haftmann@32781
   648
haftmann@23878
   649
haftmann@46631
   650
subsection {* Lattice on @{typ "_ \<Rightarrow> _"} *}
haftmann@23878
   651
haftmann@25510
   652
instantiation "fun" :: (type, lattice) lattice
haftmann@25510
   653
begin
haftmann@25510
   654
haftmann@25510
   655
definition
haftmann@41080
   656
  "f \<sqinter> g = (\<lambda>x. f x \<sqinter> g x)"
haftmann@41080
   657
haftmann@49769
   658
lemma inf_apply [simp, code]:
haftmann@41080
   659
  "(f \<sqinter> g) x = f x \<sqinter> g x"
haftmann@41080
   660
  by (simp add: inf_fun_def)
haftmann@25510
   661
haftmann@25510
   662
definition
haftmann@41080
   663
  "f \<squnion> g = (\<lambda>x. f x \<squnion> g x)"
haftmann@41080
   664
haftmann@49769
   665
lemma sup_apply [simp, code]:
haftmann@41080
   666
  "(f \<squnion> g) x = f x \<squnion> g x"
haftmann@41080
   667
  by (simp add: sup_fun_def)
haftmann@25510
   668
haftmann@32780
   669
instance proof
noschinl@46884
   670
qed (simp_all add: le_fun_def)
haftmann@23878
   671
haftmann@25510
   672
end
haftmann@23878
   673
haftmann@41080
   674
instance "fun" :: (type, distrib_lattice) distrib_lattice proof
noschinl@46884
   675
qed (rule ext, simp add: sup_inf_distrib1)
haftmann@31991
   676
haftmann@34007
   677
instance "fun" :: (type, bounded_lattice) bounded_lattice ..
haftmann@34007
   678
haftmann@31991
   679
instantiation "fun" :: (type, uminus) uminus
haftmann@31991
   680
begin
haftmann@31991
   681
haftmann@31991
   682
definition
haftmann@31991
   683
  fun_Compl_def: "- A = (\<lambda>x. - A x)"
haftmann@31991
   684
haftmann@49769
   685
lemma uminus_apply [simp, code]:
haftmann@41080
   686
  "(- A) x = - (A x)"
haftmann@41080
   687
  by (simp add: fun_Compl_def)
haftmann@41080
   688
haftmann@31991
   689
instance ..
haftmann@31991
   690
haftmann@31991
   691
end
haftmann@31991
   692
haftmann@31991
   693
instantiation "fun" :: (type, minus) minus
haftmann@31991
   694
begin
haftmann@31991
   695
haftmann@31991
   696
definition
haftmann@31991
   697
  fun_diff_def: "A - B = (\<lambda>x. A x - B x)"
haftmann@31991
   698
haftmann@49769
   699
lemma minus_apply [simp, code]:
haftmann@41080
   700
  "(A - B) x = A x - B x"
haftmann@41080
   701
  by (simp add: fun_diff_def)
haftmann@41080
   702
haftmann@31991
   703
instance ..
haftmann@31991
   704
haftmann@31991
   705
end
haftmann@31991
   706
haftmann@41080
   707
instance "fun" :: (type, boolean_algebra) boolean_algebra proof
noschinl@46884
   708
qed (rule ext, simp_all add: inf_compl_bot sup_compl_top diff_eq)+
berghofe@26794
   709
haftmann@46631
   710
haftmann@46631
   711
subsection {* Lattice on unary and binary predicates *}
haftmann@46631
   712
haftmann@46631
   713
lemma inf1I: "A x \<Longrightarrow> B x \<Longrightarrow> (A \<sqinter> B) x"
haftmann@46631
   714
  by (simp add: inf_fun_def)
haftmann@46631
   715
haftmann@46631
   716
lemma inf2I: "A x y \<Longrightarrow> B x y \<Longrightarrow> (A \<sqinter> B) x y"
haftmann@46631
   717
  by (simp add: inf_fun_def)
haftmann@46631
   718
haftmann@46631
   719
lemma inf1E: "(A \<sqinter> B) x \<Longrightarrow> (A x \<Longrightarrow> B x \<Longrightarrow> P) \<Longrightarrow> P"
haftmann@46631
   720
  by (simp add: inf_fun_def)
haftmann@46631
   721
haftmann@46631
   722
lemma inf2E: "(A \<sqinter> B) x y \<Longrightarrow> (A x y \<Longrightarrow> B x y \<Longrightarrow> P) \<Longrightarrow> P"
haftmann@46631
   723
  by (simp add: inf_fun_def)
haftmann@46631
   724
haftmann@46631
   725
lemma inf1D1: "(A \<sqinter> B) x \<Longrightarrow> A x"
haftmann@46631
   726
  by (simp add: inf_fun_def)
haftmann@46631
   727
haftmann@46631
   728
lemma inf2D1: "(A \<sqinter> B) x y \<Longrightarrow> A x y"
haftmann@46631
   729
  by (simp add: inf_fun_def)
haftmann@46631
   730
haftmann@46631
   731
lemma inf1D2: "(A \<sqinter> B) x \<Longrightarrow> B x"
haftmann@46631
   732
  by (simp add: inf_fun_def)
haftmann@46631
   733
haftmann@46631
   734
lemma inf2D2: "(A \<sqinter> B) x y \<Longrightarrow> B x y"
haftmann@46631
   735
  by (simp add: inf_fun_def)
haftmann@46631
   736
haftmann@46631
   737
lemma sup1I1: "A x \<Longrightarrow> (A \<squnion> B) x"
haftmann@46631
   738
  by (simp add: sup_fun_def)
haftmann@46631
   739
haftmann@46631
   740
lemma sup2I1: "A x y \<Longrightarrow> (A \<squnion> B) x y"
haftmann@46631
   741
  by (simp add: sup_fun_def)
haftmann@46631
   742
haftmann@46631
   743
lemma sup1I2: "B x \<Longrightarrow> (A \<squnion> B) x"
haftmann@46631
   744
  by (simp add: sup_fun_def)
haftmann@46631
   745
haftmann@46631
   746
lemma sup2I2: "B x y \<Longrightarrow> (A \<squnion> B) x y"
haftmann@46631
   747
  by (simp add: sup_fun_def)
haftmann@46631
   748
haftmann@46631
   749
lemma sup1E: "(A \<squnion> B) x \<Longrightarrow> (A x \<Longrightarrow> P) \<Longrightarrow> (B x \<Longrightarrow> P) \<Longrightarrow> P"
haftmann@46631
   750
  by (simp add: sup_fun_def) iprover
haftmann@46631
   751
haftmann@46631
   752
lemma sup2E: "(A \<squnion> B) x y \<Longrightarrow> (A x y \<Longrightarrow> P) \<Longrightarrow> (B x y \<Longrightarrow> P) \<Longrightarrow> P"
haftmann@46631
   753
  by (simp add: sup_fun_def) iprover
haftmann@46631
   754
haftmann@46631
   755
text {*
haftmann@46631
   756
  \medskip Classical introduction rule: no commitment to @{text A} vs
haftmann@46631
   757
  @{text B}.
haftmann@46631
   758
*}
haftmann@46631
   759
haftmann@46631
   760
lemma sup1CI: "(\<not> B x \<Longrightarrow> A x) \<Longrightarrow> (A \<squnion> B) x"
haftmann@46631
   761
  by (auto simp add: sup_fun_def)
haftmann@46631
   762
haftmann@46631
   763
lemma sup2CI: "(\<not> B x y \<Longrightarrow> A x y) \<Longrightarrow> (A \<squnion> B) x y"
haftmann@46631
   764
  by (auto simp add: sup_fun_def)
haftmann@46631
   765
haftmann@46631
   766
haftmann@25062
   767
no_notation
haftmann@46691
   768
  less_eq (infix "\<sqsubseteq>" 50) and
haftmann@46691
   769
  less (infix "\<sqsubset>" 50)
haftmann@25062
   770
haftmann@21249
   771
end
haftmann@46631
   772