src/HOL/Lattices.thy
author haftmann
Mon, 02 Aug 2021 10:01:06 +0000
changeset 74101 d804e93ae9ff
parent 73869 7181130f5872
child 74123 7c5842b06114
permissions -rw-r--r--
moved theory Bit_Operations into Main corpus
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
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 59545
diff changeset
     5
section \<open>Abstract lattices\<close>
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
54555
e8c5e95d338b rationalize imports
blanchet
parents: 52729
diff changeset
     8
imports 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
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 59545
diff changeset
    11
subsection \<open>Abstract semilattice\<close>
35301
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    12
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 59545
diff changeset
    13
text \<open>
51487
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
    14
  These locales provide a basic structure for interpretation into
35301
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.
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 59545
diff changeset
    17
\<close>
35301
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 +
63290
9ac558ab0906 boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
haftmann
parents: 61799
diff changeset
    20
  assumes idem [simp]: "a \<^bold>* a = a"
35301
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
63290
9ac558ab0906 boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
haftmann
parents: 61799
diff changeset
    23
lemma left_idem [simp]: "a \<^bold>* (a \<^bold>* b) = a \<^bold>* b"
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
    24
  by (simp add: assoc [symmetric])
50615
965d4c108584 added simp rule
nipkow
parents: 49769
diff changeset
    25
63290
9ac558ab0906 boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
haftmann
parents: 61799
diff changeset
    26
lemma right_idem [simp]: "(a \<^bold>* b) \<^bold>* b = a \<^bold>* b"
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
    27
  by (simp add: assoc)
35301
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
end
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    30
51487
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
    31
locale semilattice_neutr = semilattice + comm_monoid
35301
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    32
51487
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
    33
locale semilattice_order = semilattice +
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
    34
  fixes less_eq :: "'a \<Rightarrow> 'a \<Rightarrow> bool"  (infix "\<^bold>\<le>" 50)
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
    35
    and less :: "'a \<Rightarrow> 'a \<Rightarrow> bool"  (infix "\<^bold><" 50)
63290
9ac558ab0906 boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
haftmann
parents: 61799
diff changeset
    36
  assumes order_iff: "a \<^bold>\<le> b \<longleftrightarrow> a = a \<^bold>* b"
9ac558ab0906 boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
haftmann
parents: 61799
diff changeset
    37
    and strict_order_iff: "a \<^bold>< b \<longleftrightarrow> a = a \<^bold>* b \<and> a \<noteq> b"
51487
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
    38
begin
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
    39
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
    40
lemma orderI: "a = a \<^bold>* b \<Longrightarrow> a \<^bold>\<le> b"
51487
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
    41
  by (simp add: order_iff)
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
    42
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
    43
lemma orderE:
63290
9ac558ab0906 boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
haftmann
parents: 61799
diff changeset
    44
  assumes "a \<^bold>\<le> b"
9ac558ab0906 boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
haftmann
parents: 61799
diff changeset
    45
  obtains "a = a \<^bold>* b"
51487
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
    46
  using assms by (unfold order_iff)
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
    47
52152
b561cdce6c4c examples for interpretation into target
haftmann
parents: 51593
diff changeset
    48
sublocale ordering less_eq less
51487
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
    49
proof
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
    50
  show "a \<^bold>< b \<longleftrightarrow> a \<^bold>\<le> b \<and> a \<noteq> b" for a b
59545
12a6088ed195 explicit equivalence for strict order on lattices
haftmann
parents: 58889
diff changeset
    51
    by (simp add: order_iff strict_order_iff)
51487
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
    52
next
63588
d0e2bad67bd4 misc tuning and modernization;
wenzelm
parents: 63322
diff changeset
    53
  show "a \<^bold>\<le> a" for a
51487
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
    54
    by (simp add: order_iff)
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
    55
next
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
    56
  fix a b
63290
9ac558ab0906 boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
haftmann
parents: 61799
diff changeset
    57
  assume "a \<^bold>\<le> b" "b \<^bold>\<le> a"
9ac558ab0906 boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
haftmann
parents: 61799
diff changeset
    58
  then have "a = a \<^bold>* b" "a \<^bold>* b = b"
51487
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
    59
    by (simp_all add: order_iff commute)
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
    60
  then show "a = b" by simp
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
    61
next
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
    62
  fix a b c
63290
9ac558ab0906 boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
haftmann
parents: 61799
diff changeset
    63
  assume "a \<^bold>\<le> b" "b \<^bold>\<le> c"
9ac558ab0906 boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
haftmann
parents: 61799
diff changeset
    64
  then have "a = a \<^bold>* b" "b = b \<^bold>* c"
51487
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
    65
    by (simp_all add: order_iff commute)
63290
9ac558ab0906 boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
haftmann
parents: 61799
diff changeset
    66
  then have "a = a \<^bold>* (b \<^bold>* c)"
51487
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
    67
    by simp
63290
9ac558ab0906 boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
haftmann
parents: 61799
diff changeset
    68
  then have "a = (a \<^bold>* b) \<^bold>* c"
51487
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
    69
    by (simp add: assoc)
63290
9ac558ab0906 boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
haftmann
parents: 61799
diff changeset
    70
  with \<open>a = a \<^bold>* b\<close> [symmetric] have "a = a \<^bold>* c" by simp
9ac558ab0906 boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
haftmann
parents: 61799
diff changeset
    71
  then show "a \<^bold>\<le> c" by (rule orderI)
51487
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
    72
qed
35301
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
    73
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
    74
lemma cobounded1 [simp]: "a \<^bold>* b \<^bold>\<le> a"
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
    75
  by (simp add: order_iff commute)
51487
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
    76
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
    77
lemma cobounded2 [simp]: "a \<^bold>* b \<^bold>\<le> b"
51487
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
    78
  by (simp add: order_iff)
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
    79
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
    80
lemma boundedI:
63290
9ac558ab0906 boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
haftmann
parents: 61799
diff changeset
    81
  assumes "a \<^bold>\<le> b" and "a \<^bold>\<le> c"
9ac558ab0906 boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
haftmann
parents: 61799
diff changeset
    82
  shows "a \<^bold>\<le> b \<^bold>* c"
51487
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
    83
proof (rule orderI)
63588
d0e2bad67bd4 misc tuning and modernization;
wenzelm
parents: 63322
diff changeset
    84
  from assms obtain "a \<^bold>* b = a" and "a \<^bold>* c = a"
d0e2bad67bd4 misc tuning and modernization;
wenzelm
parents: 63322
diff changeset
    85
    by (auto elim!: orderE)
d0e2bad67bd4 misc tuning and modernization;
wenzelm
parents: 63322
diff changeset
    86
  then show "a = a \<^bold>* (b \<^bold>* c)"
d0e2bad67bd4 misc tuning and modernization;
wenzelm
parents: 63322
diff changeset
    87
    by (simp add: assoc [symmetric])
51487
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
    88
qed
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
    89
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
    90
lemma boundedE:
63290
9ac558ab0906 boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
haftmann
parents: 61799
diff changeset
    91
  assumes "a \<^bold>\<le> b \<^bold>* c"
9ac558ab0906 boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
haftmann
parents: 61799
diff changeset
    92
  obtains "a \<^bold>\<le> b" and "a \<^bold>\<le> c"
51487
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
    93
  using assms by (blast intro: trans cobounded1 cobounded2)
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
    94
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
    95
lemma bounded_iff [simp]: "a \<^bold>\<le> b \<^bold>* c \<longleftrightarrow> a \<^bold>\<le> b \<and> a \<^bold>\<le> c"
51487
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
    96
  by (blast intro: boundedI elim: boundedE)
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
    97
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
    98
lemma strict_boundedE:
63290
9ac558ab0906 boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
haftmann
parents: 61799
diff changeset
    99
  assumes "a \<^bold>< b \<^bold>* c"
9ac558ab0906 boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
haftmann
parents: 61799
diff changeset
   100
  obtains "a \<^bold>< b" and "a \<^bold>< c"
54859
64ff7f16d5b7 prefer abstract simp rule
haftmann
parents: 54858
diff changeset
   101
  using assms by (auto simp add: commute strict_iff_order elim: orderE intro!: that)+
51487
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
   102
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   103
lemma coboundedI1: "a \<^bold>\<le> c \<Longrightarrow> a \<^bold>* b \<^bold>\<le> c"
51487
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
   104
  by (rule trans) auto
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
   105
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   106
lemma coboundedI2: "b \<^bold>\<le> c \<Longrightarrow> a \<^bold>* b \<^bold>\<le> c"
51487
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
   107
  by (rule trans) auto
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
   108
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   109
lemma strict_coboundedI1: "a \<^bold>< c \<Longrightarrow> a \<^bold>* b \<^bold>< c"
54858
c1c334198504 more lemmas on abstract lattices
haftmann
parents: 54857
diff changeset
   110
  using irrefl
63588
d0e2bad67bd4 misc tuning and modernization;
wenzelm
parents: 63322
diff changeset
   111
  by (auto intro: not_eq_order_implies_strict coboundedI1 strict_implies_order
d0e2bad67bd4 misc tuning and modernization;
wenzelm
parents: 63322
diff changeset
   112
      elim: strict_boundedE)
54858
c1c334198504 more lemmas on abstract lattices
haftmann
parents: 54857
diff changeset
   113
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   114
lemma strict_coboundedI2: "b \<^bold>< c \<Longrightarrow> a \<^bold>* b \<^bold>< c"
54858
c1c334198504 more lemmas on abstract lattices
haftmann
parents: 54857
diff changeset
   115
  using strict_coboundedI1 [of b c a] by (simp add: commute)
c1c334198504 more lemmas on abstract lattices
haftmann
parents: 54857
diff changeset
   116
63290
9ac558ab0906 boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
haftmann
parents: 61799
diff changeset
   117
lemma mono: "a \<^bold>\<le> c \<Longrightarrow> b \<^bold>\<le> d \<Longrightarrow> a \<^bold>* b \<^bold>\<le> c \<^bold>* d"
51487
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
   118
  by (blast intro: boundedI coboundedI1 coboundedI2)
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
   119
63290
9ac558ab0906 boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
haftmann
parents: 61799
diff changeset
   120
lemma absorb1: "a \<^bold>\<le> b \<Longrightarrow> a \<^bold>* b = a"
63588
d0e2bad67bd4 misc tuning and modernization;
wenzelm
parents: 63322
diff changeset
   121
  by (rule antisym) (auto simp: refl)
51487
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
   122
63290
9ac558ab0906 boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
haftmann
parents: 61799
diff changeset
   123
lemma absorb2: "b \<^bold>\<le> a \<Longrightarrow> a \<^bold>* b = b"
63588
d0e2bad67bd4 misc tuning and modernization;
wenzelm
parents: 63322
diff changeset
   124
  by (rule antisym) (auto simp: refl)
54858
c1c334198504 more lemmas on abstract lattices
haftmann
parents: 54857
diff changeset
   125
73869
7181130f5872 more default simp rules
haftmann
parents: 73411
diff changeset
   126
lemma absorb3: "a \<^bold>< b \<Longrightarrow> a \<^bold>* b = a"
7181130f5872 more default simp rules
haftmann
parents: 73411
diff changeset
   127
  by (rule absorb1) (rule strict_implies_order)
7181130f5872 more default simp rules
haftmann
parents: 73411
diff changeset
   128
7181130f5872 more default simp rules
haftmann
parents: 73411
diff changeset
   129
lemma absorb4: "b \<^bold>< a \<Longrightarrow> a \<^bold>* b = b"
7181130f5872 more default simp rules
haftmann
parents: 73411
diff changeset
   130
  by (rule absorb2) (rule strict_implies_order)
7181130f5872 more default simp rules
haftmann
parents: 73411
diff changeset
   131
63290
9ac558ab0906 boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
haftmann
parents: 61799
diff changeset
   132
lemma absorb_iff1: "a \<^bold>\<le> b \<longleftrightarrow> a \<^bold>* b = a"
54858
c1c334198504 more lemmas on abstract lattices
haftmann
parents: 54857
diff changeset
   133
  using order_iff by auto
c1c334198504 more lemmas on abstract lattices
haftmann
parents: 54857
diff changeset
   134
63290
9ac558ab0906 boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
haftmann
parents: 61799
diff changeset
   135
lemma absorb_iff2: "b \<^bold>\<le> a \<longleftrightarrow> a \<^bold>* b = b"
54858
c1c334198504 more lemmas on abstract lattices
haftmann
parents: 54857
diff changeset
   136
  using order_iff by (auto simp add: commute)
35301
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
   137
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
   138
end
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
   139
51487
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
   140
locale semilattice_neutr_order = semilattice_neutr + semilattice_order
52152
b561cdce6c4c examples for interpretation into target
haftmann
parents: 51593
diff changeset
   141
begin
51487
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
   142
63290
9ac558ab0906 boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
haftmann
parents: 61799
diff changeset
   143
sublocale ordering_top less_eq less "\<^bold>1"
61169
4de9ff3ea29a tuned proofs -- less legacy;
wenzelm
parents: 61076
diff changeset
   144
  by standard (simp add: order_iff)
51487
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
   145
71851
34ecb540a079 generalized and augmented
haftmann
parents: 71138
diff changeset
   146
lemma eq_neutr_iff [simp]: \<open>a \<^bold>* b = \<^bold>1 \<longleftrightarrow> a = \<^bold>1 \<and> b = \<^bold>1\<close>
34ecb540a079 generalized and augmented
haftmann
parents: 71138
diff changeset
   147
  by (simp add: eq_iff)
34ecb540a079 generalized and augmented
haftmann
parents: 71138
diff changeset
   148
34ecb540a079 generalized and augmented
haftmann
parents: 71138
diff changeset
   149
lemma neutr_eq_iff [simp]: \<open>\<^bold>1 = a \<^bold>* b \<longleftrightarrow> a = \<^bold>1 \<and> b = \<^bold>1\<close>
34ecb540a079 generalized and augmented
haftmann
parents: 71138
diff changeset
   150
  by (simp add: eq_iff)
34ecb540a079 generalized and augmented
haftmann
parents: 71138
diff changeset
   151
52152
b561cdce6c4c examples for interpretation into target
haftmann
parents: 51593
diff changeset
   152
end
b561cdce6c4c examples for interpretation into target
haftmann
parents: 51593
diff changeset
   153
71938
e1b262e7480c interpretations for boolean operators
haftmann
parents: 71851
diff changeset
   154
text \<open>Interpretations for boolean operators\<close>
63661
92e037803666 formal passive interpretation proofs for conj and disj
haftmann
parents: 63588
diff changeset
   155
71938
e1b262e7480c interpretations for boolean operators
haftmann
parents: 71851
diff changeset
   156
interpretation conj: semilattice_neutr \<open>(\<and>)\<close> True
63661
92e037803666 formal passive interpretation proofs for conj and disj
haftmann
parents: 63588
diff changeset
   157
  by standard auto
92e037803666 formal passive interpretation proofs for conj and disj
haftmann
parents: 63588
diff changeset
   158
71938
e1b262e7480c interpretations for boolean operators
haftmann
parents: 71851
diff changeset
   159
interpretation disj: semilattice_neutr \<open>(\<or>)\<close> False
63661
92e037803666 formal passive interpretation proofs for conj and disj
haftmann
parents: 63588
diff changeset
   160
  by standard auto
92e037803666 formal passive interpretation proofs for conj and disj
haftmann
parents: 63588
diff changeset
   161
71938
e1b262e7480c interpretations for boolean operators
haftmann
parents: 71851
diff changeset
   162
declare conj_assoc [ac_simps del] disj_assoc [ac_simps del] \<comment> \<open>already simp by default\<close>
e1b262e7480c interpretations for boolean operators
haftmann
parents: 71851
diff changeset
   163
35301
90e42f9ba4d1 distributed theory Algebras to theories Groups and Lattices
haftmann
parents: 35121
diff changeset
   164
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 59545
diff changeset
   165
subsection \<open>Syntactic infimum and supremum operations\<close>
41082
9ff94e7cc3b3 bot comes before top, inf before sup etc.
haftmann
parents: 41080
diff changeset
   166
44845
5e51075cbd97 added syntactic classes for "inf" and "sup"
krauss
parents: 44085
diff changeset
   167
class inf =
5e51075cbd97 added syntactic classes for "inf" and "sup"
krauss
parents: 44085
diff changeset
   168
  fixes inf :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixl "\<sqinter>" 70)
25206
9c84ec7217a9 localized monotonicity; tuned syntax
haftmann
parents: 25102
diff changeset
   169
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   170
class sup =
44845
5e51075cbd97 added syntactic classes for "inf" and "sup"
krauss
parents: 44085
diff changeset
   171
  fixes sup :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixl "\<squnion>" 65)
5e51075cbd97 added syntactic classes for "inf" and "sup"
krauss
parents: 44085
diff changeset
   172
46691
72d81e789106 tuned syntax declarations; tuned structure
haftmann
parents: 46689
diff changeset
   173
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 59545
diff changeset
   174
subsection \<open>Concrete lattices\<close>
46691
72d81e789106 tuned syntax declarations; tuned structure
haftmann
parents: 46689
diff changeset
   175
71013
bfa1017b4553 tuned whitespace;
wenzelm
parents: 70490
diff changeset
   176
class semilattice_inf = order + inf +
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   177
  assumes inf_le1 [simp]: "x \<sqinter> y \<le> x"
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   178
  and inf_le2 [simp]: "x \<sqinter> y \<le> y"
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   179
  and inf_greatest: "x \<le> y \<Longrightarrow> x \<le> z \<Longrightarrow> x \<le> y \<sqinter> z"
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   180
44845
5e51075cbd97 added syntactic classes for "inf" and "sup"
krauss
parents: 44085
diff changeset
   181
class semilattice_sup = order + sup +
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   182
  assumes sup_ge1 [simp]: "x \<le> x \<squnion> y"
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   183
  and sup_ge2 [simp]: "y \<le> x \<squnion> y"
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   184
  and sup_least: "y \<le> x \<Longrightarrow> z \<le> x \<Longrightarrow> y \<squnion> z \<le> x"
26014
00c2c3525bef dual orders and dual lattices
haftmann
parents: 25510
diff changeset
   185
begin
00c2c3525bef dual orders and dual lattices
haftmann
parents: 25510
diff changeset
   186
63588
d0e2bad67bd4 misc tuning and modernization;
wenzelm
parents: 63322
diff changeset
   187
text \<open>Dual lattice.\<close>
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   188
lemma dual_semilattice: "class.semilattice_inf sup greater_eq greater"
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   189
  by (rule class.semilattice_inf.intro, rule dual_order)
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   190
    (unfold_locales, simp_all add: sup_least)
26014
00c2c3525bef dual orders and dual lattices
haftmann
parents: 25510
diff changeset
   191
00c2c3525bef dual orders and dual lattices
haftmann
parents: 25510
diff changeset
   192
end
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   193
35028
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 34973
diff changeset
   194
class lattice = semilattice_inf + semilattice_sup
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   195
25382
72cfe89f7b21 tuned specifications of 'notation';
wenzelm
parents: 25206
diff changeset
   196
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 59545
diff changeset
   197
subsubsection \<open>Intro and elim rules\<close>
21733
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
context semilattice_inf
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   200
begin
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   201
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   202
lemma le_infI1: "a \<le> x \<Longrightarrow> a \<sqinter> b \<le> x"
32064
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
   203
  by (rule order_trans) auto
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   204
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   205
lemma le_infI2: "b \<le> x \<Longrightarrow> a \<sqinter> b \<le> x"
32064
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
   206
  by (rule order_trans) auto
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   207
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   208
lemma le_infI: "x \<le> a \<Longrightarrow> x \<le> b \<Longrightarrow> x \<le> a \<sqinter> b"
54857
5c05f7c5f8ae tuning and augmentation of min/max lemmas;
haftmann
parents: 54555
diff changeset
   209
  by (fact inf_greatest) (* FIXME: duplicate lemma *)
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   210
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   211
lemma le_infE: "x \<le> a \<sqinter> b \<Longrightarrow> (x \<le> a \<Longrightarrow> x \<le> b \<Longrightarrow> P) \<Longrightarrow> P"
36008
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   212
  by (blast intro: order_trans inf_le1 inf_le2)
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   213
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   214
lemma le_inf_iff: "x \<le> y \<sqinter> z \<longleftrightarrow> x \<le> y \<and> x \<le> z"
32064
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
   215
  by (blast intro: le_infI elim: le_infE)
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   216
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   217
lemma le_iff_inf: "x \<le> y \<longleftrightarrow> x \<sqinter> y = x"
73411
1f1366966296 avoid name clash
haftmann
parents: 71938
diff changeset
   218
  by (auto intro: le_infI1 order.antisym dest: order.eq_iff [THEN iffD1] simp add: le_inf_iff)
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   219
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   220
lemma inf_mono: "a \<le> c \<Longrightarrow> b \<le> d \<Longrightarrow> a \<sqinter> b \<le> c \<sqinter> d"
36008
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   221
  by (fast intro: inf_greatest le_infI1 le_infI2)
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   222
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   223
lemma mono_inf: "mono f \<Longrightarrow> f (A \<sqinter> B) \<le> f A \<sqinter> f B" for f :: "'a \<Rightarrow> 'b::semilattice_inf"
25206
9c84ec7217a9 localized monotonicity; tuned syntax
haftmann
parents: 25102
diff changeset
   224
  by (auto simp add: mono_def intro: Lattices.inf_greatest)
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   225
25206
9c84ec7217a9 localized monotonicity; tuned syntax
haftmann
parents: 25102
diff changeset
   226
end
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   227
35028
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 34973
diff changeset
   228
context semilattice_sup
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   229
begin
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   230
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   231
lemma le_supI1: "x \<le> a \<Longrightarrow> x \<le> a \<squnion> b"
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   232
  by (rule order_trans) auto
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   233
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   234
lemma le_supI2: "x \<le> b \<Longrightarrow> x \<le> a \<squnion> b"
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24749
diff changeset
   235
  by (rule order_trans) auto
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   236
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   237
lemma le_supI: "a \<le> x \<Longrightarrow> b \<le> x \<Longrightarrow> a \<squnion> b \<le> x"
54857
5c05f7c5f8ae tuning and augmentation of min/max lemmas;
haftmann
parents: 54555
diff changeset
   238
  by (fact sup_least) (* FIXME: duplicate lemma *)
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   239
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   240
lemma le_supE: "a \<squnion> b \<le> x \<Longrightarrow> (a \<le> x \<Longrightarrow> b \<le> x \<Longrightarrow> P) \<Longrightarrow> P"
36008
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   241
  by (blast intro: order_trans sup_ge1 sup_ge2)
22422
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22384
diff changeset
   242
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   243
lemma le_sup_iff: "x \<squnion> y \<le> z \<longleftrightarrow> x \<le> z \<and> y \<le> z"
32064
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
   244
  by (blast intro: le_supI elim: le_supE)
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   245
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   246
lemma le_iff_sup: "x \<le> y \<longleftrightarrow> x \<squnion> y = y"
73411
1f1366966296 avoid name clash
haftmann
parents: 71938
diff changeset
   247
  by (auto intro: le_supI2 order.antisym dest: order.eq_iff [THEN iffD1] simp add: le_sup_iff)
21734
283461c15fa7 renaming
nipkow
parents: 21733
diff changeset
   248
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   249
lemma sup_mono: "a \<le> c \<Longrightarrow> b \<le> d \<Longrightarrow> a \<squnion> b \<le> c \<squnion> d"
36008
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   250
  by (fast intro: sup_least le_supI1 le_supI2)
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   251
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   252
lemma mono_sup: "mono f \<Longrightarrow> f A \<squnion> f B \<le> f (A \<squnion> B)" for f :: "'a \<Rightarrow> 'b::semilattice_sup"
25206
9c84ec7217a9 localized monotonicity; tuned syntax
haftmann
parents: 25102
diff changeset
   253
  by (auto simp add: mono_def intro: Lattices.sup_least)
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   254
25206
9c84ec7217a9 localized monotonicity; tuned syntax
haftmann
parents: 25102
diff changeset
   255
end
23878
bd651ecd4b8a simplified HOL bootstrap
haftmann
parents: 23389
diff changeset
   256
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   257
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 59545
diff changeset
   258
subsubsection \<open>Equational laws\<close>
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   259
52152
b561cdce6c4c examples for interpretation into target
haftmann
parents: 51593
diff changeset
   260
context semilattice_inf
b561cdce6c4c examples for interpretation into target
haftmann
parents: 51593
diff changeset
   261
begin
b561cdce6c4c examples for interpretation into target
haftmann
parents: 51593
diff changeset
   262
61605
1bf7b186542e qualifier is mandatory by default;
wenzelm
parents: 61169
diff changeset
   263
sublocale inf: semilattice inf
34973
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   264
proof
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   265
  fix a b c
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   266
  show "(a \<sqinter> b) \<sqinter> c = a \<sqinter> (b \<sqinter> c)"
73411
1f1366966296 avoid name clash
haftmann
parents: 71938
diff changeset
   267
    by (rule order.antisym) (auto intro: le_infI1 le_infI2 simp add: le_inf_iff)
34973
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   268
  show "a \<sqinter> b = b \<sqinter> a"
73411
1f1366966296 avoid name clash
haftmann
parents: 71938
diff changeset
   269
    by (rule order.antisym) (auto simp add: le_inf_iff)
34973
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   270
  show "a \<sqinter> a = a"
73411
1f1366966296 avoid name clash
haftmann
parents: 71938
diff changeset
   271
    by (rule order.antisym) (auto simp add: le_inf_iff)
34973
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   272
qed
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   273
61605
1bf7b186542e qualifier is mandatory by default;
wenzelm
parents: 61169
diff changeset
   274
sublocale inf: semilattice_order inf less_eq less
61169
4de9ff3ea29a tuned proofs -- less legacy;
wenzelm
parents: 61076
diff changeset
   275
  by standard (auto simp add: le_iff_inf less_le)
51487
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
   276
34973
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   277
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
   278
  by (fact inf.assoc)
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   279
34973
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   280
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
   281
  by (fact inf.commute)
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   282
34973
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   283
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
   284
  by (fact inf.left_commute)
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   285
44921
58eef4843641 tuned proofs
huffman
parents: 44919
diff changeset
   286
lemma inf_idem: "x \<sqinter> x = x"
58eef4843641 tuned proofs
huffman
parents: 44919
diff changeset
   287
  by (fact inf.idem) (* already simp *)
34973
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   288
50615
965d4c108584 added simp rule
nipkow
parents: 49769
diff changeset
   289
lemma inf_left_idem: "x \<sqinter> (x \<sqinter> y) = x \<sqinter> y"
965d4c108584 added simp rule
nipkow
parents: 49769
diff changeset
   290
  by (fact inf.left_idem) (* already simp *)
965d4c108584 added simp rule
nipkow
parents: 49769
diff changeset
   291
965d4c108584 added simp rule
nipkow
parents: 49769
diff changeset
   292
lemma inf_right_idem: "(x \<sqinter> y) \<sqinter> y = x \<sqinter> y"
965d4c108584 added simp rule
nipkow
parents: 49769
diff changeset
   293
  by (fact inf.right_idem) (* already simp *)
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   294
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   295
lemma inf_absorb1: "x \<le> y \<Longrightarrow> x \<sqinter> y = x"
73411
1f1366966296 avoid name clash
haftmann
parents: 71938
diff changeset
   296
  by (rule order.antisym) auto
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   297
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   298
lemma inf_absorb2: "y \<le> x \<Longrightarrow> x \<sqinter> y = y"
73411
1f1366966296 avoid name clash
haftmann
parents: 71938
diff changeset
   299
  by (rule order.antisym) auto
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   300
32064
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
   301
lemmas inf_aci = inf_commute inf_assoc inf_left_commute inf_left_idem
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   302
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   303
end
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   304
35028
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 34973
diff changeset
   305
context semilattice_sup
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   306
begin
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   307
61605
1bf7b186542e qualifier is mandatory by default;
wenzelm
parents: 61169
diff changeset
   308
sublocale sup: semilattice sup
52152
b561cdce6c4c examples for interpretation into target
haftmann
parents: 51593
diff changeset
   309
proof
b561cdce6c4c examples for interpretation into target
haftmann
parents: 51593
diff changeset
   310
  fix a b c
b561cdce6c4c examples for interpretation into target
haftmann
parents: 51593
diff changeset
   311
  show "(a \<squnion> b) \<squnion> c = a \<squnion> (b \<squnion> c)"
73411
1f1366966296 avoid name clash
haftmann
parents: 71938
diff changeset
   312
    by (rule order.antisym) (auto intro: le_supI1 le_supI2 simp add: le_sup_iff)
52152
b561cdce6c4c examples for interpretation into target
haftmann
parents: 51593
diff changeset
   313
  show "a \<squnion> b = b \<squnion> a"
73411
1f1366966296 avoid name clash
haftmann
parents: 71938
diff changeset
   314
    by (rule order.antisym) (auto simp add: le_sup_iff)
52152
b561cdce6c4c examples for interpretation into target
haftmann
parents: 51593
diff changeset
   315
  show "a \<squnion> a = a"
73411
1f1366966296 avoid name clash
haftmann
parents: 71938
diff changeset
   316
    by (rule order.antisym) (auto simp add: le_sup_iff)
52152
b561cdce6c4c examples for interpretation into target
haftmann
parents: 51593
diff changeset
   317
qed
b561cdce6c4c examples for interpretation into target
haftmann
parents: 51593
diff changeset
   318
61605
1bf7b186542e qualifier is mandatory by default;
wenzelm
parents: 61169
diff changeset
   319
sublocale sup: semilattice_order sup greater_eq greater
61169
4de9ff3ea29a tuned proofs -- less legacy;
wenzelm
parents: 61076
diff changeset
   320
  by standard (auto simp add: le_iff_sup sup.commute less_le)
52152
b561cdce6c4c examples for interpretation into target
haftmann
parents: 51593
diff changeset
   321
34973
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   322
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
   323
  by (fact sup.assoc)
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   324
34973
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   325
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
   326
  by (fact sup.commute)
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   327
34973
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   328
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
   329
  by (fact sup.left_commute)
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   330
44921
58eef4843641 tuned proofs
huffman
parents: 44919
diff changeset
   331
lemma sup_idem: "x \<squnion> x = x"
58eef4843641 tuned proofs
huffman
parents: 44919
diff changeset
   332
  by (fact sup.idem) (* already simp *)
34973
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 34209
diff changeset
   333
44918
6a80fbc4e72c tune simpset for Complete_Lattices
noschinl
parents: 44845
diff changeset
   334
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
   335
  by (fact sup.left_idem)
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   336
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   337
lemma sup_absorb1: "y \<le> x \<Longrightarrow> x \<squnion> y = x"
73411
1f1366966296 avoid name clash
haftmann
parents: 71938
diff changeset
   338
  by (rule order.antisym) auto
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   339
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   340
lemma sup_absorb2: "x \<le> y \<Longrightarrow> x \<squnion> y = y"
73411
1f1366966296 avoid name clash
haftmann
parents: 71938
diff changeset
   341
  by (rule order.antisym) auto
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   342
32064
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
   343
lemmas sup_aci = sup_commute sup_assoc sup_left_commute sup_left_idem
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   344
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   345
end
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   346
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   347
context lattice
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   348
begin
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   349
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 63820
diff changeset
   350
lemma dual_lattice: "class.lattice sup (\<ge>) (>) inf"
63588
d0e2bad67bd4 misc tuning and modernization;
wenzelm
parents: 63322
diff changeset
   351
  by (rule class.lattice.intro,
d0e2bad67bd4 misc tuning and modernization;
wenzelm
parents: 63322
diff changeset
   352
      rule dual_semilattice,
d0e2bad67bd4 misc tuning and modernization;
wenzelm
parents: 63322
diff changeset
   353
      rule class.semilattice_sup.intro,
d0e2bad67bd4 misc tuning and modernization;
wenzelm
parents: 63322
diff changeset
   354
      rule dual_order)
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   355
    (unfold_locales, auto)
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   356
44918
6a80fbc4e72c tune simpset for Complete_Lattices
noschinl
parents: 44845
diff changeset
   357
lemma inf_sup_absorb [simp]: "x \<sqinter> (x \<squnion> y) = x"
73411
1f1366966296 avoid name clash
haftmann
parents: 71938
diff changeset
   358
  by (blast intro: order.antisym inf_le1 inf_greatest sup_ge1)
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   359
44918
6a80fbc4e72c tune simpset for Complete_Lattices
noschinl
parents: 44845
diff changeset
   360
lemma sup_inf_absorb [simp]: "x \<squnion> (x \<sqinter> y) = x"
73411
1f1366966296 avoid name clash
haftmann
parents: 71938
diff changeset
   361
  by (blast intro: order.antisym sup_ge1 sup_least inf_le1)
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   362
32064
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
   363
lemmas inf_sup_aci = inf_aci sup_aci
21734
283461c15fa7 renaming
nipkow
parents: 21733
diff changeset
   364
22454
c3654ba76a09 integrated with LOrder.thy
haftmann
parents: 22422
diff changeset
   365
lemmas inf_sup_ord = inf_le1 inf_le2 sup_ge1 sup_ge2
c3654ba76a09 integrated with LOrder.thy
haftmann
parents: 22422
diff changeset
   366
63588
d0e2bad67bd4 misc tuning and modernization;
wenzelm
parents: 63322
diff changeset
   367
text \<open>Towards distributivity.\<close>
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   368
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   369
lemma distrib_sup_le: "x \<squnion> (y \<sqinter> z) \<le> (x \<squnion> y) \<sqinter> (x \<squnion> z)"
32064
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
   370
  by (auto intro: le_infI1 le_infI2 le_supI1 le_supI2)
21734
283461c15fa7 renaming
nipkow
parents: 21733
diff changeset
   371
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   372
lemma distrib_inf_le: "(x \<sqinter> y) \<squnion> (x \<sqinter> z) \<le> x \<sqinter> (y \<squnion> z)"
32064
53ca12ff305d refinement of lattice classes
haftmann
parents: 32063
diff changeset
   373
  by (auto intro: le_infI1 le_infI2 le_supI1 le_supI2)
21734
283461c15fa7 renaming
nipkow
parents: 21733
diff changeset
   374
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   375
text \<open>If you have one of them, you have them all.\<close>
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   376
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   377
lemma distrib_imp1:
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   378
  assumes distrib: "\<And>x y z. x \<sqinter> (y \<squnion> z) = (x \<sqinter> y) \<squnion> (x \<sqinter> z)"
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   379
  shows "x \<squnion> (y \<sqinter> z) = (x \<squnion> y) \<sqinter> (x \<squnion> z)"
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   380
proof-
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   381
  have "x \<squnion> (y \<sqinter> z) = (x \<squnion> (x \<sqinter> z)) \<squnion> (y \<sqinter> z)"
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   382
    by simp
44918
6a80fbc4e72c tune simpset for Complete_Lattices
noschinl
parents: 44845
diff changeset
   383
  also have "\<dots> = x \<squnion> (z \<sqinter> (x \<squnion> y))"
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   384
    by (simp add: distrib inf_commute sup_assoc del: sup_inf_absorb)
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   385
  also have "\<dots> = ((x \<squnion> y) \<sqinter> x) \<squnion> ((x \<squnion> y) \<sqinter> z)"
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   386
    by (simp add: inf_commute)
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   387
  also have "\<dots> = (x \<squnion> y) \<sqinter> (x \<squnion> z)" by(simp add:distrib)
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   388
  finally show ?thesis .
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   389
qed
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   390
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   391
lemma distrib_imp2:
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   392
  assumes distrib: "\<And>x y z. x \<squnion> (y \<sqinter> z) = (x \<squnion> y) \<sqinter> (x \<squnion> z)"
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   393
  shows "x \<sqinter> (y \<squnion> z) = (x \<sqinter> y) \<squnion> (x \<sqinter> z)"
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   394
proof-
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   395
  have "x \<sqinter> (y \<squnion> z) = (x \<sqinter> (x \<squnion> z)) \<sqinter> (y \<squnion> z)"
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   396
    by simp
44918
6a80fbc4e72c tune simpset for Complete_Lattices
noschinl
parents: 44845
diff changeset
   397
  also have "\<dots> = x \<sqinter> (z \<squnion> (x \<sqinter> y))"
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   398
    by (simp add: distrib sup_commute inf_assoc del: inf_sup_absorb)
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   399
  also have "\<dots> = ((x \<sqinter> y) \<squnion> x) \<sqinter> ((x \<sqinter> y) \<squnion> z)"
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   400
    by (simp add: sup_commute)
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   401
  also have "\<dots> = (x \<sqinter> y) \<squnion> (x \<sqinter> z)" by (simp add:distrib)
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   402
  finally show ?thesis .
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   403
qed
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   404
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   405
end
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   406
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   407
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 59545
diff changeset
   408
subsubsection \<open>Strict order\<close>
32568
89518a3074e1 some lemmas about strict order in lattices
haftmann
parents: 32512
diff changeset
   409
35028
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 34973
diff changeset
   410
context semilattice_inf
32568
89518a3074e1 some lemmas about strict order in lattices
haftmann
parents: 32512
diff changeset
   411
begin
89518a3074e1 some lemmas about strict order in lattices
haftmann
parents: 32512
diff changeset
   412
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   413
lemma less_infI1: "a < x \<Longrightarrow> a \<sqinter> b < 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
   414
  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
   415
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   416
lemma less_infI2: "b < x \<Longrightarrow> a \<sqinter> b < 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
   417
  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
   418
89518a3074e1 some lemmas about strict order in lattices
haftmann
parents: 32512
diff changeset
   419
end
89518a3074e1 some lemmas about strict order in lattices
haftmann
parents: 32512
diff changeset
   420
35028
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 34973
diff changeset
   421
context semilattice_sup
32568
89518a3074e1 some lemmas about strict order in lattices
haftmann
parents: 32512
diff changeset
   422
begin
89518a3074e1 some lemmas about strict order in lattices
haftmann
parents: 32512
diff changeset
   423
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   424
lemma less_supI1: "x < a \<Longrightarrow> x < a \<squnion> b"
44921
58eef4843641 tuned proofs
huffman
parents: 44919
diff changeset
   425
  using dual_semilattice
58eef4843641 tuned proofs
huffman
parents: 44919
diff changeset
   426
  by (rule semilattice_inf.less_infI1)
32568
89518a3074e1 some lemmas about strict order in lattices
haftmann
parents: 32512
diff changeset
   427
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   428
lemma less_supI2: "x < b \<Longrightarrow> x < a \<squnion> b"
44921
58eef4843641 tuned proofs
huffman
parents: 44919
diff changeset
   429
  using dual_semilattice
58eef4843641 tuned proofs
huffman
parents: 44919
diff changeset
   430
  by (rule semilattice_inf.less_infI2)
32568
89518a3074e1 some lemmas about strict order in lattices
haftmann
parents: 32512
diff changeset
   431
89518a3074e1 some lemmas about strict order in lattices
haftmann
parents: 32512
diff changeset
   432
end
89518a3074e1 some lemmas about strict order in lattices
haftmann
parents: 32512
diff changeset
   433
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   434
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 59545
diff changeset
   435
subsection \<open>Distributive lattices\<close>
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   436
22454
c3654ba76a09 integrated with LOrder.thy
haftmann
parents: 22422
diff changeset
   437
class distrib_lattice = lattice +
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   438
  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
   439
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   440
context distrib_lattice
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   441
begin
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   442
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   443
lemma sup_inf_distrib2: "(y \<sqinter> z) \<squnion> x = (y \<squnion> x) \<sqinter> (z \<squnion> x)"
44921
58eef4843641 tuned proofs
huffman
parents: 44919
diff changeset
   444
  by (simp add: sup_commute sup_inf_distrib1)
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   445
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   446
lemma inf_sup_distrib1: "x \<sqinter> (y \<squnion> z) = (x \<sqinter> y) \<squnion> (x \<sqinter> z)"
44921
58eef4843641 tuned proofs
huffman
parents: 44919
diff changeset
   447
  by (rule distrib_imp2 [OF sup_inf_distrib1])
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   448
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   449
lemma inf_sup_distrib2: "(y \<squnion> z) \<sqinter> x = (y \<sqinter> x) \<squnion> (z \<sqinter> x)"
44921
58eef4843641 tuned proofs
huffman
parents: 44919
diff changeset
   450
  by (simp add: inf_commute inf_sup_distrib1)
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   451
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 63820
diff changeset
   452
lemma dual_distrib_lattice: "class.distrib_lattice sup (\<ge>) (>) inf"
36635
080b755377c0 locale predicates of classes carry a mandatory "class" prefix
haftmann
parents: 36352
diff changeset
   453
  by (rule class.distrib_lattice.intro, rule dual_lattice)
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   454
    (unfold_locales, fact inf_sup_distrib1)
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   455
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   456
lemmas sup_inf_distrib = sup_inf_distrib1 sup_inf_distrib2
36008
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   457
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   458
lemmas inf_sup_distrib = inf_sup_distrib1 inf_sup_distrib2
36008
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   459
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   460
lemmas distrib = sup_inf_distrib1 sup_inf_distrib2 inf_sup_distrib1 inf_sup_distrib2
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   461
21733
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   462
end
131dd2a27137 Modified lattice locale
nipkow
parents: 21619
diff changeset
   463
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   464
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 59545
diff changeset
   465
subsection \<open>Bounded lattices and boolean algebras\<close>
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   466
52729
412c9e0381a1 factored syntactic type classes for bot and top (by Alessandro Coglio)
haftmann
parents: 52152
diff changeset
   467
class bounded_semilattice_inf_top = semilattice_inf + order_top
52152
b561cdce6c4c examples for interpretation into target
haftmann
parents: 51593
diff changeset
   468
begin
51487
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
   469
61605
1bf7b186542e qualifier is mandatory by default;
wenzelm
parents: 61169
diff changeset
   470
sublocale inf_top: semilattice_neutr inf top
1bf7b186542e qualifier is mandatory by default;
wenzelm
parents: 61169
diff changeset
   471
  + inf_top: semilattice_neutr_order inf top less_eq less
51487
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
   472
proof
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   473
  show "x \<sqinter> \<top> = x" for x
51487
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
   474
    by (rule inf_absorb1) simp
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
   475
qed
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
   476
71851
34ecb540a079 generalized and augmented
haftmann
parents: 71138
diff changeset
   477
lemma inf_top_left: "\<top> \<sqinter> x = x"
34ecb540a079 generalized and augmented
haftmann
parents: 71138
diff changeset
   478
  by (fact inf_top.left_neutral)
34ecb540a079 generalized and augmented
haftmann
parents: 71138
diff changeset
   479
34ecb540a079 generalized and augmented
haftmann
parents: 71138
diff changeset
   480
lemma inf_top_right: "x \<sqinter> \<top> = x"
34ecb540a079 generalized and augmented
haftmann
parents: 71138
diff changeset
   481
  by (fact inf_top.right_neutral)
34ecb540a079 generalized and augmented
haftmann
parents: 71138
diff changeset
   482
34ecb540a079 generalized and augmented
haftmann
parents: 71138
diff changeset
   483
lemma inf_eq_top_iff: "x \<sqinter> y = \<top> \<longleftrightarrow> x = \<top> \<and> y = \<top>"
34ecb540a079 generalized and augmented
haftmann
parents: 71138
diff changeset
   484
  by (fact inf_top.eq_neutr_iff)
34ecb540a079 generalized and augmented
haftmann
parents: 71138
diff changeset
   485
34ecb540a079 generalized and augmented
haftmann
parents: 71138
diff changeset
   486
lemma top_eq_inf_iff: "\<top> = x \<sqinter> y \<longleftrightarrow> x = \<top> \<and> y = \<top>"
34ecb540a079 generalized and augmented
haftmann
parents: 71138
diff changeset
   487
  by (fact inf_top.neutr_eq_iff)
34ecb540a079 generalized and augmented
haftmann
parents: 71138
diff changeset
   488
52152
b561cdce6c4c examples for interpretation into target
haftmann
parents: 51593
diff changeset
   489
end
51487
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
   490
52729
412c9e0381a1 factored syntactic type classes for bot and top (by Alessandro Coglio)
haftmann
parents: 52152
diff changeset
   491
class bounded_semilattice_sup_bot = semilattice_sup + order_bot
52152
b561cdce6c4c examples for interpretation into target
haftmann
parents: 51593
diff changeset
   492
begin
b561cdce6c4c examples for interpretation into target
haftmann
parents: 51593
diff changeset
   493
61605
1bf7b186542e qualifier is mandatory by default;
wenzelm
parents: 61169
diff changeset
   494
sublocale sup_bot: semilattice_neutr sup bot
1bf7b186542e qualifier is mandatory by default;
wenzelm
parents: 61169
diff changeset
   495
  + sup_bot: semilattice_neutr_order sup bot greater_eq greater
51487
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
   496
proof
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   497
  show "x \<squnion> \<bottom> = x" for x
51487
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
   498
    by (rule sup_absorb1) simp
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
   499
qed
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
   500
71851
34ecb540a079 generalized and augmented
haftmann
parents: 71138
diff changeset
   501
lemma sup_bot_left: "\<bottom> \<squnion> x = x"
34ecb540a079 generalized and augmented
haftmann
parents: 71138
diff changeset
   502
  by (fact sup_bot.left_neutral)
34ecb540a079 generalized and augmented
haftmann
parents: 71138
diff changeset
   503
34ecb540a079 generalized and augmented
haftmann
parents: 71138
diff changeset
   504
lemma sup_bot_right: "x \<squnion> \<bottom> = x"
34ecb540a079 generalized and augmented
haftmann
parents: 71138
diff changeset
   505
  by (fact sup_bot.right_neutral)
34ecb540a079 generalized and augmented
haftmann
parents: 71138
diff changeset
   506
34ecb540a079 generalized and augmented
haftmann
parents: 71138
diff changeset
   507
lemma sup_eq_bot_iff: "x \<squnion> y = \<bottom> \<longleftrightarrow> x = \<bottom> \<and> y = \<bottom>"
34ecb540a079 generalized and augmented
haftmann
parents: 71138
diff changeset
   508
  by (fact sup_bot.eq_neutr_iff)
34ecb540a079 generalized and augmented
haftmann
parents: 71138
diff changeset
   509
34ecb540a079 generalized and augmented
haftmann
parents: 71138
diff changeset
   510
lemma bot_eq_sup_iff: "\<bottom> = x \<squnion> y \<longleftrightarrow> x = \<bottom> \<and> y = \<bottom>"
34ecb540a079 generalized and augmented
haftmann
parents: 71138
diff changeset
   511
  by (fact sup_bot.neutr_eq_iff)
34ecb540a079 generalized and augmented
haftmann
parents: 71138
diff changeset
   512
52152
b561cdce6c4c examples for interpretation into target
haftmann
parents: 51593
diff changeset
   513
end
b561cdce6c4c examples for interpretation into target
haftmann
parents: 51593
diff changeset
   514
52729
412c9e0381a1 factored syntactic type classes for bot and top (by Alessandro Coglio)
haftmann
parents: 52152
diff changeset
   515
class bounded_lattice_bot = lattice + order_bot
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   516
begin
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   517
51487
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
   518
subclass bounded_semilattice_sup_bot ..
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
   519
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   520
lemma inf_bot_left [simp]: "\<bottom> \<sqinter> x = \<bottom>"
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   521
  by (rule inf_absorb1) simp
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   522
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   523
lemma inf_bot_right [simp]: "x \<sqinter> \<bottom> = \<bottom>"
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   524
  by (rule inf_absorb2) simp
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   525
36352
f71978e47cd5 add bounded_lattice_bot and bounded_lattice_top type classes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 36096
diff changeset
   526
end
f71978e47cd5 add bounded_lattice_bot and bounded_lattice_top type classes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 36096
diff changeset
   527
52729
412c9e0381a1 factored syntactic type classes for bot and top (by Alessandro Coglio)
haftmann
parents: 52152
diff changeset
   528
class bounded_lattice_top = lattice + order_top
36352
f71978e47cd5 add bounded_lattice_bot and bounded_lattice_top type classes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 36096
diff changeset
   529
begin
f71978e47cd5 add bounded_lattice_bot and bounded_lattice_top type classes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 36096
diff changeset
   530
51487
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
   531
subclass bounded_semilattice_inf_top ..
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
   532
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   533
lemma sup_top_left [simp]: "\<top> \<squnion> x = \<top>"
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   534
  by (rule sup_absorb1) simp
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   535
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   536
lemma sup_top_right [simp]: "x \<squnion> \<top> = \<top>"
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   537
  by (rule sup_absorb2) simp
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   538
36352
f71978e47cd5 add bounded_lattice_bot and bounded_lattice_top type classes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 36096
diff changeset
   539
end
f71978e47cd5 add bounded_lattice_bot and bounded_lattice_top type classes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 36096
diff changeset
   540
52729
412c9e0381a1 factored syntactic type classes for bot and top (by Alessandro Coglio)
haftmann
parents: 52152
diff changeset
   541
class bounded_lattice = lattice + order_bot + order_top
36352
f71978e47cd5 add bounded_lattice_bot and bounded_lattice_top type classes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 36096
diff changeset
   542
begin
f71978e47cd5 add bounded_lattice_bot and bounded_lattice_top type classes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 36096
diff changeset
   543
51487
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
   544
subclass bounded_lattice_bot ..
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
   545
subclass bounded_lattice_top ..
f4bfdee99304 locales for abstract orders
haftmann
parents: 51387
diff changeset
   546
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   547
lemma dual_bounded_lattice: "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
   548
  by unfold_locales (auto simp add: less_le_not_le)
32568
89518a3074e1 some lemmas about strict order in lattices
haftmann
parents: 32512
diff changeset
   549
34007
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   550
end
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   551
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   552
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
   553
  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
   554
    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
   555
  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
   556
begin
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   557
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   558
lemma dual_boolean_algebra:
44845
5e51075cbd97 added syntactic classes for "inf" and "sup"
krauss
parents: 44085
diff changeset
   559
  "class.boolean_algebra (\<lambda>x y. x \<squnion> - y) uminus sup greater_eq greater inf \<top> \<bottom>"
63588
d0e2bad67bd4 misc tuning and modernization;
wenzelm
parents: 63322
diff changeset
   560
  by (rule class.boolean_algebra.intro,
d0e2bad67bd4 misc tuning and modernization;
wenzelm
parents: 63322
diff changeset
   561
      rule dual_bounded_lattice,
d0e2bad67bd4 misc tuning and modernization;
wenzelm
parents: 63322
diff changeset
   562
      rule dual_distrib_lattice)
34007
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   563
    (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
   564
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   565
lemma compl_inf_bot [simp]: "- x \<sqinter> x = \<bottom>"
34007
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   566
  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
   567
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   568
lemma compl_sup_top [simp]: "- x \<squnion> x = \<top>"
34007
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   569
  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
   570
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   571
lemma compl_unique:
34007
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   572
  assumes "x \<sqinter> y = \<bottom>"
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   573
    and "x \<squnion> y = \<top>"
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   574
  shows "- x = y"
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   575
proof -
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   576
  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
   577
    using inf_compl_bot assms(1) by simp
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   578
  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
   579
    by (simp add: inf_commute)
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   580
  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
   581
    by (simp add: inf_sup_distrib1)
34007
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   582
  then have "- x \<sqinter> \<top> = y \<sqinter> \<top>"
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   583
    using sup_compl_top assms(2) by simp
34209
c7f621786035 killed a few warnings
krauss
parents: 34007
diff changeset
   584
  then show "- x = y" by simp
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   585
qed
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   586
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   587
lemma double_compl [simp]: "- (- x) = x"
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   588
  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
   589
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   590
lemma compl_eq_compl_iff [simp]: "- x = - y \<longleftrightarrow> x = y"
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   591
proof
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   592
  assume "- x = - y"
36008
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   593
  then have "- (- x) = - (- y)" by (rule arg_cong)
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   594
  then show "x = y" by simp
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   595
next
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   596
  assume "x = y"
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   597
  then show "- x = - y" by simp
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   598
qed
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   599
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   600
lemma compl_bot_eq [simp]: "- \<bottom> = \<top>"
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   601
proof -
34007
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   602
  from sup_compl_top have "\<bottom> \<squnion> - \<bottom> = \<top>" .
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   603
  then show ?thesis by simp
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   604
qed
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   605
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   606
lemma compl_top_eq [simp]: "- \<top> = \<bottom>"
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   607
proof -
34007
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   608
  from inf_compl_bot have "\<top> \<sqinter> - \<top> = \<bottom>" .
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   609
  then show ?thesis by simp
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   610
qed
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   611
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   612
lemma compl_inf [simp]: "- (x \<sqinter> y) = - x \<squnion> - y"
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   613
proof (rule compl_unique)
36008
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   614
  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
   615
    by (simp only: inf_sup_distrib inf_aci)
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   616
  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
   617
    by (simp add: inf_compl_bot)
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   618
next
36008
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   619
  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
   620
    by (simp only: sup_inf_distrib sup_aci)
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   621
  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
   622
    by (simp add: sup_compl_top)
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   623
qed
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   624
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   625
lemma compl_sup [simp]: "- (x \<squnion> y) = - x \<sqinter> - y"
44921
58eef4843641 tuned proofs
huffman
parents: 44919
diff changeset
   626
  using dual_boolean_algebra
58eef4843641 tuned proofs
huffman
parents: 44919
diff changeset
   627
  by (rule boolean_algebra.compl_inf)
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   628
36008
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   629
lemma compl_mono:
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   630
  assumes "x \<le> y"
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   631
  shows "- y \<le> - x"
36008
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   632
proof -
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   633
  from assms have "x \<squnion> y = y" by (simp only: le_iff_sup)
36008
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   634
  then have "- (x \<squnion> y) = - y" by simp
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   635
  then have "- x \<sqinter> - y = - y" by simp
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   636
  then have "- y \<sqinter> - x = - y" by (simp only: inf_commute)
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   637
  then show ?thesis by (simp only: le_iff_inf)
36008
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   638
qed
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   639
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   640
lemma compl_le_compl_iff [simp]: "- x \<le> - y \<longleftrightarrow> y \<le> x"
43873
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   641
  by (auto dest: compl_mono)
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   642
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   643
lemma compl_le_swap1:
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   644
  assumes "y \<le> - x"
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   645
  shows "x \<le> -y"
43873
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   646
proof -
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   647
  from assms have "- (- x) \<le> - y" by (simp only: compl_le_compl_iff)
43873
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   648
  then show ?thesis by simp
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   649
qed
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   650
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   651
lemma compl_le_swap2:
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   652
  assumes "- y \<le> x"
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   653
  shows "- x \<le> y"
43873
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   654
proof -
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   655
  from assms have "- x \<le> - (- y)" by (simp only: compl_le_compl_iff)
43873
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   656
  then show ?thesis by simp
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   657
qed
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   658
73869
7181130f5872 more default simp rules
haftmann
parents: 73411
diff changeset
   659
lemma compl_less_compl_iff [simp]: "- x < - y \<longleftrightarrow> y < x"
44919
482f1807976e tune proofs
noschinl
parents: 44918
diff changeset
   660
  by (auto simp add: less_le)
43873
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   661
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   662
lemma compl_less_swap1:
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   663
  assumes "y < - x"
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   664
  shows "x < - y"
43873
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   665
proof -
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   666
  from assms have "- (- x) < - y" by (simp only: compl_less_compl_iff)
43873
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   667
  then show ?thesis by simp
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   668
qed
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   669
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   670
lemma compl_less_swap2:
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   671
  assumes "- y < x"
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   672
  shows "- x < y"
43873
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   673
proof -
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   674
  from assms have "- x < - (- y)"
63588
d0e2bad67bd4 misc tuning and modernization;
wenzelm
parents: 63322
diff changeset
   675
    by (simp only: compl_less_compl_iff)
43873
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   676
  then show ?thesis by simp
8a2f339641c1 more on complement
haftmann
parents: 43753
diff changeset
   677
qed
36008
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   678
61629
90f54d9e63f2 cancel complementary terms as arguments to sup/inf in boolean algebras
Andreas Lochbihler
parents: 61605
diff changeset
   679
lemma sup_cancel_left1: "sup (sup x a) (sup (- x) b) = top"
73869
7181130f5872 more default simp rules
haftmann
parents: 73411
diff changeset
   680
  by (simp add: ac_simps sup_compl_top)
61629
90f54d9e63f2 cancel complementary terms as arguments to sup/inf in boolean algebras
Andreas Lochbihler
parents: 61605
diff changeset
   681
90f54d9e63f2 cancel complementary terms as arguments to sup/inf in boolean algebras
Andreas Lochbihler
parents: 61605
diff changeset
   682
lemma sup_cancel_left2: "sup (sup (- x) a) (sup x b) = top"
73869
7181130f5872 more default simp rules
haftmann
parents: 73411
diff changeset
   683
  by (simp add: ac_simps sup_compl_top)
61629
90f54d9e63f2 cancel complementary terms as arguments to sup/inf in boolean algebras
Andreas Lochbihler
parents: 61605
diff changeset
   684
90f54d9e63f2 cancel complementary terms as arguments to sup/inf in boolean algebras
Andreas Lochbihler
parents: 61605
diff changeset
   685
lemma inf_cancel_left1: "inf (inf x a) (inf (- x) b) = bot"
73869
7181130f5872 more default simp rules
haftmann
parents: 73411
diff changeset
   686
  by (simp add: ac_simps inf_compl_bot)
61629
90f54d9e63f2 cancel complementary terms as arguments to sup/inf in boolean algebras
Andreas Lochbihler
parents: 61605
diff changeset
   687
90f54d9e63f2 cancel complementary terms as arguments to sup/inf in boolean algebras
Andreas Lochbihler
parents: 61605
diff changeset
   688
lemma inf_cancel_left2: "inf (inf (- x) a) (inf x b) = bot"
73869
7181130f5872 more default simp rules
haftmann
parents: 73411
diff changeset
   689
  by (simp add: ac_simps inf_compl_bot)
61629
90f54d9e63f2 cancel complementary terms as arguments to sup/inf in boolean algebras
Andreas Lochbihler
parents: 61605
diff changeset
   690
63588
d0e2bad67bd4 misc tuning and modernization;
wenzelm
parents: 63322
diff changeset
   691
declare inf_compl_bot [simp]
d0e2bad67bd4 misc tuning and modernization;
wenzelm
parents: 63322
diff changeset
   692
  and sup_compl_top [simp]
61629
90f54d9e63f2 cancel complementary terms as arguments to sup/inf in boolean algebras
Andreas Lochbihler
parents: 61605
diff changeset
   693
90f54d9e63f2 cancel complementary terms as arguments to sup/inf in boolean algebras
Andreas Lochbihler
parents: 61605
diff changeset
   694
lemma sup_compl_top_left1 [simp]: "sup (- x) (sup x y) = top"
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   695
  by (simp add: sup_assoc[symmetric])
61629
90f54d9e63f2 cancel complementary terms as arguments to sup/inf in boolean algebras
Andreas Lochbihler
parents: 61605
diff changeset
   696
90f54d9e63f2 cancel complementary terms as arguments to sup/inf in boolean algebras
Andreas Lochbihler
parents: 61605
diff changeset
   697
lemma sup_compl_top_left2 [simp]: "sup x (sup (- x) y) = top"
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   698
  using sup_compl_top_left1[of "- x" y] by simp
61629
90f54d9e63f2 cancel complementary terms as arguments to sup/inf in boolean algebras
Andreas Lochbihler
parents: 61605
diff changeset
   699
90f54d9e63f2 cancel complementary terms as arguments to sup/inf in boolean algebras
Andreas Lochbihler
parents: 61605
diff changeset
   700
lemma inf_compl_bot_left1 [simp]: "inf (- x) (inf x y) = bot"
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   701
  by (simp add: inf_assoc[symmetric])
61629
90f54d9e63f2 cancel complementary terms as arguments to sup/inf in boolean algebras
Andreas Lochbihler
parents: 61605
diff changeset
   702
90f54d9e63f2 cancel complementary terms as arguments to sup/inf in boolean algebras
Andreas Lochbihler
parents: 61605
diff changeset
   703
lemma inf_compl_bot_left2 [simp]: "inf x (inf (- x) y) = bot"
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   704
  using inf_compl_bot_left1[of "- x" y] by simp
61629
90f54d9e63f2 cancel complementary terms as arguments to sup/inf in boolean algebras
Andreas Lochbihler
parents: 61605
diff changeset
   705
90f54d9e63f2 cancel complementary terms as arguments to sup/inf in boolean algebras
Andreas Lochbihler
parents: 61605
diff changeset
   706
lemma inf_compl_bot_right [simp]: "inf x (inf y (- x)) = bot"
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   707
  by (subst inf_left_commute) simp
61629
90f54d9e63f2 cancel complementary terms as arguments to sup/inf in boolean algebras
Andreas Lochbihler
parents: 61605
diff changeset
   708
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   709
end
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   710
70490
c42a0a0a9a8d prefer named lemmas -- more compact proofterms;
wenzelm
parents: 69605
diff changeset
   711
locale boolean_algebra_cancel
c42a0a0a9a8d prefer named lemmas -- more compact proofterms;
wenzelm
parents: 69605
diff changeset
   712
begin
c42a0a0a9a8d prefer named lemmas -- more compact proofterms;
wenzelm
parents: 69605
diff changeset
   713
c42a0a0a9a8d prefer named lemmas -- more compact proofterms;
wenzelm
parents: 69605
diff changeset
   714
lemma sup1: "(A::'a::semilattice_sup) \<equiv> sup k a \<Longrightarrow> sup A b \<equiv> sup k (sup a b)"
c42a0a0a9a8d prefer named lemmas -- more compact proofterms;
wenzelm
parents: 69605
diff changeset
   715
  by (simp only: ac_simps)
c42a0a0a9a8d prefer named lemmas -- more compact proofterms;
wenzelm
parents: 69605
diff changeset
   716
c42a0a0a9a8d prefer named lemmas -- more compact proofterms;
wenzelm
parents: 69605
diff changeset
   717
lemma sup2: "(B::'a::semilattice_sup) \<equiv> sup k b \<Longrightarrow> sup a B \<equiv> sup k (sup a b)"
c42a0a0a9a8d prefer named lemmas -- more compact proofterms;
wenzelm
parents: 69605
diff changeset
   718
  by (simp only: ac_simps)
c42a0a0a9a8d prefer named lemmas -- more compact proofterms;
wenzelm
parents: 69605
diff changeset
   719
c42a0a0a9a8d prefer named lemmas -- more compact proofterms;
wenzelm
parents: 69605
diff changeset
   720
lemma sup0: "(a::'a::bounded_semilattice_sup_bot) \<equiv> sup a bot"
c42a0a0a9a8d prefer named lemmas -- more compact proofterms;
wenzelm
parents: 69605
diff changeset
   721
  by simp
c42a0a0a9a8d prefer named lemmas -- more compact proofterms;
wenzelm
parents: 69605
diff changeset
   722
c42a0a0a9a8d prefer named lemmas -- more compact proofterms;
wenzelm
parents: 69605
diff changeset
   723
lemma inf1: "(A::'a::semilattice_inf) \<equiv> inf k a \<Longrightarrow> inf A b \<equiv> inf k (inf a b)"
c42a0a0a9a8d prefer named lemmas -- more compact proofterms;
wenzelm
parents: 69605
diff changeset
   724
  by (simp only: ac_simps)
c42a0a0a9a8d prefer named lemmas -- more compact proofterms;
wenzelm
parents: 69605
diff changeset
   725
c42a0a0a9a8d prefer named lemmas -- more compact proofterms;
wenzelm
parents: 69605
diff changeset
   726
lemma inf2: "(B::'a::semilattice_inf) \<equiv> inf k b \<Longrightarrow> inf a B \<equiv> inf k (inf a b)"
c42a0a0a9a8d prefer named lemmas -- more compact proofterms;
wenzelm
parents: 69605
diff changeset
   727
  by (simp only: ac_simps)
c42a0a0a9a8d prefer named lemmas -- more compact proofterms;
wenzelm
parents: 69605
diff changeset
   728
c42a0a0a9a8d prefer named lemmas -- more compact proofterms;
wenzelm
parents: 69605
diff changeset
   729
lemma inf0: "(a::'a::bounded_semilattice_inf_top) \<equiv> inf a top"
c42a0a0a9a8d prefer named lemmas -- more compact proofterms;
wenzelm
parents: 69605
diff changeset
   730
  by simp
c42a0a0a9a8d prefer named lemmas -- more compact proofterms;
wenzelm
parents: 69605
diff changeset
   731
c42a0a0a9a8d prefer named lemmas -- more compact proofterms;
wenzelm
parents: 69605
diff changeset
   732
end
c42a0a0a9a8d prefer named lemmas -- more compact proofterms;
wenzelm
parents: 69605
diff changeset
   733
69605
a96320074298 isabelle update -u path_cartouches;
wenzelm
parents: 69593
diff changeset
   734
ML_file \<open>Tools/boolean_algebra_cancel.ML\<close>
61629
90f54d9e63f2 cancel complementary terms as arguments to sup/inf in boolean algebras
Andreas Lochbihler
parents: 61605
diff changeset
   735
90f54d9e63f2 cancel complementary terms as arguments to sup/inf in boolean algebras
Andreas Lochbihler
parents: 61605
diff changeset
   736
simproc_setup boolean_algebra_cancel_sup ("sup a b::'a::boolean_algebra") =
61799
4cf66f21b764 isabelle update_cartouches -c -t;
wenzelm
parents: 61629
diff changeset
   737
  \<open>fn phi => fn ss => try Boolean_Algebra_Cancel.cancel_sup_conv\<close>
61629
90f54d9e63f2 cancel complementary terms as arguments to sup/inf in boolean algebras
Andreas Lochbihler
parents: 61605
diff changeset
   738
90f54d9e63f2 cancel complementary terms as arguments to sup/inf in boolean algebras
Andreas Lochbihler
parents: 61605
diff changeset
   739
simproc_setup boolean_algebra_cancel_inf ("inf a b::'a::boolean_algebra") =
61799
4cf66f21b764 isabelle update_cartouches -c -t;
wenzelm
parents: 61629
diff changeset
   740
  \<open>fn phi => fn ss => try Boolean_Algebra_Cancel.cancel_inf_conv\<close>
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   741
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   742
61799
4cf66f21b764 isabelle update_cartouches -c -t;
wenzelm
parents: 61629
diff changeset
   743
subsection \<open>\<open>min/max\<close> as special case of lattice\<close>
51540
eea5c4ca4a0e explicit sublocale dependency for Min/Max yields more appropriate Min/Max prefix for a couple of facts
haftmann
parents: 51489
diff changeset
   744
54861
00d551179872 postponed min/max lemmas until abstract lattice is available
haftmann
parents: 54859
diff changeset
   745
context linorder
00d551179872 postponed min/max lemmas until abstract lattice is available
haftmann
parents: 54859
diff changeset
   746
begin
00d551179872 postponed min/max lemmas until abstract lattice is available
haftmann
parents: 54859
diff changeset
   747
61605
1bf7b186542e qualifier is mandatory by default;
wenzelm
parents: 61169
diff changeset
   748
sublocale min: semilattice_order min less_eq less
1bf7b186542e qualifier is mandatory by default;
wenzelm
parents: 61169
diff changeset
   749
  + max: semilattice_order max greater_eq greater
61169
4de9ff3ea29a tuned proofs -- less legacy;
wenzelm
parents: 61076
diff changeset
   750
  by standard (auto simp add: min_def max_def)
51540
eea5c4ca4a0e explicit sublocale dependency for Min/Max yields more appropriate Min/Max prefix for a couple of facts
haftmann
parents: 51489
diff changeset
   751
73869
7181130f5872 more default simp rules
haftmann
parents: 73411
diff changeset
   752
declare min.absorb1 [simp] min.absorb2 [simp]
7181130f5872 more default simp rules
haftmann
parents: 73411
diff changeset
   753
  min.absorb3 [simp] min.absorb4 [simp]
7181130f5872 more default simp rules
haftmann
parents: 73411
diff changeset
   754
  max.absorb1 [simp] max.absorb2 [simp]
7181130f5872 more default simp rules
haftmann
parents: 73411
diff changeset
   755
  max.absorb3 [simp] max.absorb4 [simp]
7181130f5872 more default simp rules
haftmann
parents: 73411
diff changeset
   756
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   757
lemma min_le_iff_disj: "min x y \<le> z \<longleftrightarrow> x \<le> z \<or> y \<le> z"
54861
00d551179872 postponed min/max lemmas until abstract lattice is available
haftmann
parents: 54859
diff changeset
   758
  unfolding min_def using linear by (auto intro: order_trans)
00d551179872 postponed min/max lemmas until abstract lattice is available
haftmann
parents: 54859
diff changeset
   759
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   760
lemma le_max_iff_disj: "z \<le> max x y \<longleftrightarrow> z \<le> x \<or> z \<le> y"
54861
00d551179872 postponed min/max lemmas until abstract lattice is available
haftmann
parents: 54859
diff changeset
   761
  unfolding max_def using linear by (auto intro: order_trans)
00d551179872 postponed min/max lemmas until abstract lattice is available
haftmann
parents: 54859
diff changeset
   762
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   763
lemma min_less_iff_disj: "min x y < z \<longleftrightarrow> x < z \<or> y < z"
54861
00d551179872 postponed min/max lemmas until abstract lattice is available
haftmann
parents: 54859
diff changeset
   764
  unfolding min_def le_less using less_linear by (auto intro: less_trans)
00d551179872 postponed min/max lemmas until abstract lattice is available
haftmann
parents: 54859
diff changeset
   765
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   766
lemma less_max_iff_disj: "z < max x y \<longleftrightarrow> z < x \<or> z < y"
54861
00d551179872 postponed min/max lemmas until abstract lattice is available
haftmann
parents: 54859
diff changeset
   767
  unfolding max_def le_less using less_linear by (auto intro: less_trans)
00d551179872 postponed min/max lemmas until abstract lattice is available
haftmann
parents: 54859
diff changeset
   768
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   769
lemma min_less_iff_conj [simp]: "z < min x y \<longleftrightarrow> z < x \<and> z < y"
54861
00d551179872 postponed min/max lemmas until abstract lattice is available
haftmann
parents: 54859
diff changeset
   770
  unfolding min_def le_less using less_linear by (auto intro: less_trans)
00d551179872 postponed min/max lemmas until abstract lattice is available
haftmann
parents: 54859
diff changeset
   771
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   772
lemma max_less_iff_conj [simp]: "max x y < z \<longleftrightarrow> x < z \<and> y < z"
54861
00d551179872 postponed min/max lemmas until abstract lattice is available
haftmann
parents: 54859
diff changeset
   773
  unfolding max_def le_less using less_linear by (auto intro: less_trans)
00d551179872 postponed min/max lemmas until abstract lattice is available
haftmann
parents: 54859
diff changeset
   774
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   775
lemma min_max_distrib1: "min (max b c) a = max (min b a) (min c a)"
54862
c65e5cbdbc97 explicit distributivity facts on min/max
haftmann
parents: 54861
diff changeset
   776
  by (auto simp add: min_def max_def not_le dest: le_less_trans less_trans intro: antisym)
c65e5cbdbc97 explicit distributivity facts on min/max
haftmann
parents: 54861
diff changeset
   777
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   778
lemma min_max_distrib2: "min a (max b c) = max (min a b) (min a c)"
54862
c65e5cbdbc97 explicit distributivity facts on min/max
haftmann
parents: 54861
diff changeset
   779
  by (auto simp add: min_def max_def not_le dest: le_less_trans less_trans intro: antisym)
c65e5cbdbc97 explicit distributivity facts on min/max
haftmann
parents: 54861
diff changeset
   780
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   781
lemma max_min_distrib1: "max (min b c) a = min (max b a) (max c a)"
54862
c65e5cbdbc97 explicit distributivity facts on min/max
haftmann
parents: 54861
diff changeset
   782
  by (auto simp add: min_def max_def not_le dest: le_less_trans less_trans intro: antisym)
c65e5cbdbc97 explicit distributivity facts on min/max
haftmann
parents: 54861
diff changeset
   783
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   784
lemma max_min_distrib2: "max a (min b c) = min (max a b) (max a c)"
54862
c65e5cbdbc97 explicit distributivity facts on min/max
haftmann
parents: 54861
diff changeset
   785
  by (auto simp add: min_def max_def not_le dest: le_less_trans less_trans intro: antisym)
c65e5cbdbc97 explicit distributivity facts on min/max
haftmann
parents: 54861
diff changeset
   786
c65e5cbdbc97 explicit distributivity facts on min/max
haftmann
parents: 54861
diff changeset
   787
lemmas min_max_distribs = min_max_distrib1 min_max_distrib2 max_min_distrib1 max_min_distrib2
c65e5cbdbc97 explicit distributivity facts on min/max
haftmann
parents: 54861
diff changeset
   788
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   789
lemma split_min [no_atp]: "P (min i j) \<longleftrightarrow> (i \<le> j \<longrightarrow> P i) \<and> (\<not> i \<le> j \<longrightarrow> P j)"
54861
00d551179872 postponed min/max lemmas until abstract lattice is available
haftmann
parents: 54859
diff changeset
   790
  by (simp add: min_def)
00d551179872 postponed min/max lemmas until abstract lattice is available
haftmann
parents: 54859
diff changeset
   791
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   792
lemma split_max [no_atp]: "P (max i j) \<longleftrightarrow> (i \<le> j \<longrightarrow> P j) \<and> (\<not> i \<le> j \<longrightarrow> P i)"
54861
00d551179872 postponed min/max lemmas until abstract lattice is available
haftmann
parents: 54859
diff changeset
   793
  by (simp add: max_def)
00d551179872 postponed min/max lemmas until abstract lattice is available
haftmann
parents: 54859
diff changeset
   794
71138
9de7f1067520 strengthened type class for bit operations
haftmann
parents: 71013
diff changeset
   795
lemma split_min_lin [no_atp]:
9de7f1067520 strengthened type class for bit operations
haftmann
parents: 71013
diff changeset
   796
  \<open>P (min a b) \<longleftrightarrow> (b = a \<longrightarrow> P a) \<and> (a < b \<longrightarrow> P a) \<and> (b < a \<longrightarrow> P b)\<close>
73869
7181130f5872 more default simp rules
haftmann
parents: 73411
diff changeset
   797
  by (cases a b rule: linorder_cases) auto
71138
9de7f1067520 strengthened type class for bit operations
haftmann
parents: 71013
diff changeset
   798
9de7f1067520 strengthened type class for bit operations
haftmann
parents: 71013
diff changeset
   799
lemma split_max_lin [no_atp]:
9de7f1067520 strengthened type class for bit operations
haftmann
parents: 71013
diff changeset
   800
  \<open>P (max a b) \<longleftrightarrow> (b = a \<longrightarrow> P a) \<and> (a < b \<longrightarrow> P b) \<and> (b < a \<longrightarrow> P a)\<close>
73869
7181130f5872 more default simp rules
haftmann
parents: 73411
diff changeset
   801
  by (cases a b rule: linorder_cases) auto
71138
9de7f1067520 strengthened type class for bit operations
haftmann
parents: 71013
diff changeset
   802
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   803
lemma min_of_mono: "mono f \<Longrightarrow> min (f m) (f n) = f (min m n)" for f :: "'a \<Rightarrow> 'b::linorder"
54861
00d551179872 postponed min/max lemmas until abstract lattice is available
haftmann
parents: 54859
diff changeset
   804
  by (auto simp: mono_def Orderings.min_def min_def intro: Orderings.antisym)
00d551179872 postponed min/max lemmas until abstract lattice is available
haftmann
parents: 54859
diff changeset
   805
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   806
lemma max_of_mono: "mono f \<Longrightarrow> max (f m) (f n) = f (max m n)" for f :: "'a \<Rightarrow> 'b::linorder"
54861
00d551179872 postponed min/max lemmas until abstract lattice is available
haftmann
parents: 54859
diff changeset
   807
  by (auto simp: mono_def Orderings.max_def max_def intro: Orderings.antisym)
00d551179872 postponed min/max lemmas until abstract lattice is available
haftmann
parents: 54859
diff changeset
   808
00d551179872 postponed min/max lemmas until abstract lattice is available
haftmann
parents: 54859
diff changeset
   809
end
00d551179872 postponed min/max lemmas until abstract lattice is available
haftmann
parents: 54859
diff changeset
   810
67727
ce3e87a51488 moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
immler
parents: 67399
diff changeset
   811
lemma max_of_antimono: "antimono f \<Longrightarrow> max (f x) (f y) = f (min x y)"
ce3e87a51488 moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
immler
parents: 67399
diff changeset
   812
  and min_of_antimono: "antimono f \<Longrightarrow> min (f x) (f y) = f (max x y)"
ce3e87a51488 moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
immler
parents: 67399
diff changeset
   813
  for f::"'a::linorder \<Rightarrow> 'b::linorder"
ce3e87a51488 moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
immler
parents: 67399
diff changeset
   814
  by (auto simp: antimono_def Orderings.max_def min_def intro!: antisym)
ce3e87a51488 moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
immler
parents: 67399
diff changeset
   815
61076
bdc1e2f0a86a eliminated \<Colon>;
wenzelm
parents: 60758
diff changeset
   816
lemma inf_min: "inf = (min :: 'a::{semilattice_inf,linorder} \<Rightarrow> 'a \<Rightarrow> 'a)"
51540
eea5c4ca4a0e explicit sublocale dependency for Min/Max yields more appropriate Min/Max prefix for a couple of facts
haftmann
parents: 51489
diff changeset
   817
  by (auto intro: antisym simp add: min_def fun_eq_iff)
eea5c4ca4a0e explicit sublocale dependency for Min/Max yields more appropriate Min/Max prefix for a couple of facts
haftmann
parents: 51489
diff changeset
   818
61076
bdc1e2f0a86a eliminated \<Colon>;
wenzelm
parents: 60758
diff changeset
   819
lemma sup_max: "sup = (max :: 'a::{semilattice_sup,linorder} \<Rightarrow> 'a \<Rightarrow> 'a)"
51540
eea5c4ca4a0e explicit sublocale dependency for Min/Max yields more appropriate Min/Max prefix for a couple of facts
haftmann
parents: 51489
diff changeset
   820
  by (auto intro: antisym simp add: max_def fun_eq_iff)
eea5c4ca4a0e explicit sublocale dependency for Min/Max yields more appropriate Min/Max prefix for a couple of facts
haftmann
parents: 51489
diff changeset
   821
eea5c4ca4a0e explicit sublocale dependency for Min/Max yields more appropriate Min/Max prefix for a couple of facts
haftmann
parents: 51489
diff changeset
   822
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 59545
diff changeset
   823
subsection \<open>Uniqueness of inf and sup\<close>
22454
c3654ba76a09 integrated with LOrder.thy
haftmann
parents: 22422
diff changeset
   824
35028
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 34973
diff changeset
   825
lemma (in semilattice_inf) inf_unique:
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   826
  fixes f  (infixl "\<triangle>" 70)
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   827
  assumes le1: "\<And>x y. x \<triangle> y \<le> x"
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   828
    and le2: "\<And>x y. x \<triangle> y \<le> y"
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   829
    and greatest: "\<And>x y z. x \<le> y \<Longrightarrow> x \<le> z \<Longrightarrow> x \<le> y \<triangle> z"
22737
haftmann
parents: 22548
diff changeset
   830
  shows "x \<sqinter> y = x \<triangle> y"
73411
1f1366966296 avoid name clash
haftmann
parents: 71938
diff changeset
   831
proof (rule order.antisym)
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   832
  show "x \<triangle> y \<le> x \<sqinter> y"
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   833
    by (rule le_infI) (rule le1, rule le2)
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   834
  have leI: "\<And>x y z. x \<le> y \<Longrightarrow> x \<le> z \<Longrightarrow> x \<le> y \<triangle> z"
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   835
    by (blast intro: greatest)
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   836
  show "x \<sqinter> y \<le> x \<triangle> y"
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   837
    by (rule leI) simp_all
22454
c3654ba76a09 integrated with LOrder.thy
haftmann
parents: 22422
diff changeset
   838
qed
c3654ba76a09 integrated with LOrder.thy
haftmann
parents: 22422
diff changeset
   839
35028
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 34973
diff changeset
   840
lemma (in semilattice_sup) sup_unique:
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   841
  fixes f  (infixl "\<nabla>" 70)
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   842
  assumes ge1 [simp]: "\<And>x y. x \<le> x \<nabla> y"
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   843
    and ge2: "\<And>x y. y \<le> x \<nabla> y"
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   844
    and least: "\<And>x y z. y \<le> x \<Longrightarrow> z \<le> x \<Longrightarrow> y \<nabla> z \<le> x"
22737
haftmann
parents: 22548
diff changeset
   845
  shows "x \<squnion> y = x \<nabla> y"
73411
1f1366966296 avoid name clash
haftmann
parents: 71938
diff changeset
   846
proof (rule order.antisym)
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   847
  show "x \<squnion> y \<le> x \<nabla> y"
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   848
    by (rule le_supI) (rule ge1, rule ge2)
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   849
  have leI: "\<And>x y z. x \<le> z \<Longrightarrow> y \<le> z \<Longrightarrow> x \<nabla> y \<le> z"
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   850
    by (blast intro: least)
63820
9f004fbf9d5c discontinued theory-local special syntax for lattice orderings
haftmann
parents: 63661
diff changeset
   851
  show "x \<nabla> y \<le> x \<squnion> y"
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   852
    by (rule leI) simp_all
22454
c3654ba76a09 integrated with LOrder.thy
haftmann
parents: 22422
diff changeset
   853
qed
36008
23dfa8678c7c add/change some lemmas about lattices
huffman
parents: 35724
diff changeset
   854
22454
c3654ba76a09 integrated with LOrder.thy
haftmann
parents: 22422
diff changeset
   855
69593
3dda49e08b9d isabelle update -u control_cartouches;
wenzelm
parents: 67727
diff changeset
   856
subsection \<open>Lattice on \<^typ>\<open>bool\<close>\<close>
22454
c3654ba76a09 integrated with LOrder.thy
haftmann
parents: 22422
diff changeset
   857
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   858
instantiation bool :: boolean_algebra
25510
38c15efe603b adjustions to due to instance target
haftmann
parents: 25482
diff changeset
   859
begin
38c15efe603b adjustions to due to instance target
haftmann
parents: 25482
diff changeset
   860
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   861
definition bool_Compl_def [simp]: "uminus = Not"
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   862
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   863
definition 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
   864
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   865
definition [simp]: "P \<sqinter> Q \<longleftrightarrow> P \<and> Q"
25510
38c15efe603b adjustions to due to instance target
haftmann
parents: 25482
diff changeset
   866
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   867
definition [simp]: "P \<squnion> Q \<longleftrightarrow> P \<or> Q"
25510
38c15efe603b adjustions to due to instance target
haftmann
parents: 25482
diff changeset
   868
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   869
instance by standard auto
22454
c3654ba76a09 integrated with LOrder.thy
haftmann
parents: 22422
diff changeset
   870
25510
38c15efe603b adjustions to due to instance target
haftmann
parents: 25482
diff changeset
   871
end
38c15efe603b adjustions to due to instance target
haftmann
parents: 25482
diff changeset
   872
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   873
lemma sup_boolI1: "P \<Longrightarrow> P \<squnion> Q"
41080
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   874
  by simp
32781
19c01bd7f6ae moved lemmas about sup on bool to Lattices.thy
haftmann
parents: 32780
diff changeset
   875
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   876
lemma sup_boolI2: "Q \<Longrightarrow> P \<squnion> Q"
41080
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   877
  by simp
32781
19c01bd7f6ae moved lemmas about sup on bool to Lattices.thy
haftmann
parents: 32780
diff changeset
   878
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   879
lemma sup_boolE: "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
   880
  by auto
32781
19c01bd7f6ae moved lemmas about sup on bool to Lattices.thy
haftmann
parents: 32780
diff changeset
   881
23878
bd651ecd4b8a simplified HOL bootstrap
haftmann
parents: 23389
diff changeset
   882
69593
3dda49e08b9d isabelle update -u control_cartouches;
wenzelm
parents: 67727
diff changeset
   883
subsection \<open>Lattice on \<^typ>\<open>_ \<Rightarrow> _\<close>\<close>
23878
bd651ecd4b8a simplified HOL bootstrap
haftmann
parents: 23389
diff changeset
   884
51387
dbc4a77488b2 stepwise instantiation is more modular
nipkow
parents: 50615
diff changeset
   885
instantiation "fun" :: (type, semilattice_sup) semilattice_sup
25510
38c15efe603b adjustions to due to instance target
haftmann
parents: 25482
diff changeset
   886
begin
38c15efe603b adjustions to due to instance target
haftmann
parents: 25482
diff changeset
   887
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   888
definition "f \<squnion> g = (\<lambda>x. f x \<squnion> g x)"
41080
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   889
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   890
lemma sup_apply [simp, code]: "(f \<squnion> g) x = f x \<squnion> g x"
41080
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   891
  by (simp add: sup_fun_def)
25510
38c15efe603b adjustions to due to instance target
haftmann
parents: 25482
diff changeset
   892
63588
d0e2bad67bd4 misc tuning and modernization;
wenzelm
parents: 63322
diff changeset
   893
instance
d0e2bad67bd4 misc tuning and modernization;
wenzelm
parents: 63322
diff changeset
   894
  by standard (simp_all add: le_fun_def)
23878
bd651ecd4b8a simplified HOL bootstrap
haftmann
parents: 23389
diff changeset
   895
25510
38c15efe603b adjustions to due to instance target
haftmann
parents: 25482
diff changeset
   896
end
23878
bd651ecd4b8a simplified HOL bootstrap
haftmann
parents: 23389
diff changeset
   897
51387
dbc4a77488b2 stepwise instantiation is more modular
nipkow
parents: 50615
diff changeset
   898
instantiation "fun" :: (type, semilattice_inf) semilattice_inf
dbc4a77488b2 stepwise instantiation is more modular
nipkow
parents: 50615
diff changeset
   899
begin
dbc4a77488b2 stepwise instantiation is more modular
nipkow
parents: 50615
diff changeset
   900
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   901
definition "f \<sqinter> g = (\<lambda>x. f x \<sqinter> g x)"
51387
dbc4a77488b2 stepwise instantiation is more modular
nipkow
parents: 50615
diff changeset
   902
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   903
lemma inf_apply [simp, code]: "(f \<sqinter> g) x = f x \<sqinter> g x"
51387
dbc4a77488b2 stepwise instantiation is more modular
nipkow
parents: 50615
diff changeset
   904
  by (simp add: inf_fun_def)
dbc4a77488b2 stepwise instantiation is more modular
nipkow
parents: 50615
diff changeset
   905
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   906
instance by standard (simp_all add: le_fun_def)
51387
dbc4a77488b2 stepwise instantiation is more modular
nipkow
parents: 50615
diff changeset
   907
dbc4a77488b2 stepwise instantiation is more modular
nipkow
parents: 50615
diff changeset
   908
end
dbc4a77488b2 stepwise instantiation is more modular
nipkow
parents: 50615
diff changeset
   909
dbc4a77488b2 stepwise instantiation is more modular
nipkow
parents: 50615
diff changeset
   910
instance "fun" :: (type, lattice) lattice ..
dbc4a77488b2 stepwise instantiation is more modular
nipkow
parents: 50615
diff changeset
   911
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   912
instance "fun" :: (type, distrib_lattice) distrib_lattice
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   913
  by standard (rule ext, simp add: sup_inf_distrib1)
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   914
34007
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   915
instance "fun" :: (type, bounded_lattice) bounded_lattice ..
aea892559fc5 tuned lattices theory fragements; generlized some lemmas from sets to lattices
haftmann
parents: 32781
diff changeset
   916
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   917
instantiation "fun" :: (type, uminus) uminus
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   918
begin
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   919
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   920
definition fun_Compl_def: "- A = (\<lambda>x. - A x)"
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   921
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   922
lemma uminus_apply [simp, code]: "(- A) x = - (A x)"
41080
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   923
  by (simp add: fun_Compl_def)
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   924
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   925
instance ..
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   926
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   927
end
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   928
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   929
instantiation "fun" :: (type, minus) minus
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   930
begin
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   931
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   932
definition fun_diff_def: "A - B = (\<lambda>x. A x - B x)"
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   933
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   934
lemma minus_apply [simp, code]: "(A - B) x = A x - B x"
41080
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   935
  by (simp add: fun_diff_def)
294956ff285b nice syntax for lattice INFI, SUPR;
haftmann
parents: 41075
diff changeset
   936
31991
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   937
instance ..
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   938
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   939
end
37390299214a added boolean_algebra type class; tuned lattice duals
haftmann
parents: 30729
diff changeset
   940
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   941
instance "fun" :: (type, boolean_algebra) boolean_algebra
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   942
  by standard (rule ext, simp_all add: inf_compl_bot sup_compl_top diff_eq)+
26794
354c3844dfde - Now imports Fun rather than Orderings
berghofe
parents: 26233
diff changeset
   943
46631
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   944
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 59545
diff changeset
   945
subsection \<open>Lattice on unary and binary predicates\<close>
46631
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   946
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   947
lemma inf1I: "A x \<Longrightarrow> B x \<Longrightarrow> (A \<sqinter> B) x"
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   948
  by (simp add: inf_fun_def)
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   949
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   950
lemma inf2I: "A x y \<Longrightarrow> B x y \<Longrightarrow> (A \<sqinter> B) x y"
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   951
  by (simp add: inf_fun_def)
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   952
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   953
lemma inf1E: "(A \<sqinter> B) x \<Longrightarrow> (A x \<Longrightarrow> B x \<Longrightarrow> P) \<Longrightarrow> P"
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   954
  by (simp add: inf_fun_def)
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   955
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   956
lemma inf2E: "(A \<sqinter> B) x y \<Longrightarrow> (A x y \<Longrightarrow> B x y \<Longrightarrow> P) \<Longrightarrow> P"
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   957
  by (simp add: inf_fun_def)
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   958
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   959
lemma inf1D1: "(A \<sqinter> B) x \<Longrightarrow> A x"
54857
5c05f7c5f8ae tuning and augmentation of min/max lemmas;
haftmann
parents: 54555
diff changeset
   960
  by (rule inf1E)
46631
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   961
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   962
lemma inf2D1: "(A \<sqinter> B) x y \<Longrightarrow> A x y"
54857
5c05f7c5f8ae tuning and augmentation of min/max lemmas;
haftmann
parents: 54555
diff changeset
   963
  by (rule inf2E)
46631
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   964
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   965
lemma inf1D2: "(A \<sqinter> B) x \<Longrightarrow> B x"
54857
5c05f7c5f8ae tuning and augmentation of min/max lemmas;
haftmann
parents: 54555
diff changeset
   966
  by (rule inf1E)
46631
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   967
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   968
lemma inf2D2: "(A \<sqinter> B) x y \<Longrightarrow> B x y"
54857
5c05f7c5f8ae tuning and augmentation of min/max lemmas;
haftmann
parents: 54555
diff changeset
   969
  by (rule inf2E)
46631
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   970
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   971
lemma sup1I1: "A x \<Longrightarrow> (A \<squnion> B) x"
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   972
  by (simp add: sup_fun_def)
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   973
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   974
lemma sup2I1: "A x y \<Longrightarrow> (A \<squnion> B) x y"
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   975
  by (simp add: sup_fun_def)
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   976
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   977
lemma sup1I2: "B x \<Longrightarrow> (A \<squnion> B) x"
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   978
  by (simp add: sup_fun_def)
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   979
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   980
lemma sup2I2: "B x y \<Longrightarrow> (A \<squnion> B) x y"
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   981
  by (simp add: sup_fun_def)
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   982
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   983
lemma sup1E: "(A \<squnion> B) x \<Longrightarrow> (A x \<Longrightarrow> P) \<Longrightarrow> (B x \<Longrightarrow> P) \<Longrightarrow> P"
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   984
  by (simp add: sup_fun_def) iprover
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   985
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   986
lemma sup2E: "(A \<squnion> B) x y \<Longrightarrow> (A x y \<Longrightarrow> P) \<Longrightarrow> (B x y \<Longrightarrow> P) \<Longrightarrow> P"
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   987
  by (simp add: sup_fun_def) iprover
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   988
63322
bc1f17d45e91 misc tuning and modernization;
wenzelm
parents: 63290
diff changeset
   989
text \<open> \<^medskip> Classical introduction rule: no commitment to \<open>A\<close> vs \<open>B\<close>.\<close>
46631
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   990
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   991
lemma sup1CI: "(\<not> B x \<Longrightarrow> A x) \<Longrightarrow> (A \<squnion> B) x"
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   992
  by (auto simp add: sup_fun_def)
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   993
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   994
lemma sup2CI: "(\<not> B x y \<Longrightarrow> A x y) \<Longrightarrow> (A \<squnion> B) x y"
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   995
  by (auto simp add: sup_fun_def)
2c5c003cee35 moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
haftmann
parents: 46557
diff changeset
   996
21249
d594c58e24ed renamed Lattice_Locales to Lattices
haftmann
parents:
diff changeset
   997
end