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