src/HOL/Library/Complemented_Lattices.thy
author haftmann
Thu, 07 Apr 2022 05:55:48 +0000
changeset 75411 3f24cc294d74
permissions -rw-r--r--
moved from AFP to distribution
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
75411
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
     1
(*  Title:      HOL/Library/Complemented_Lattices.thy
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
     2
    Authors:    Jose Manuel Rodriguez Caballero, Dominique Unruh
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
     3
*)
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
     4
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
     5
section \<open>Complemented Lattices\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
     6
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
     7
theory Complemented_Lattices
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
     8
  imports Main
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
     9
begin
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    10
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    11
text \<open>The following class \<open>complemented_lattice\<close> describes complemented lattices (with
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    12
  \<^const>\<open>uminus\<close> for the complement). The definition follows
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    13
  \<^url>\<open>https://en.wikipedia.org/wiki/Complemented_lattice#Definition_and_basic_properties\<close>.
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    14
  Additionally, it adopts the convention from \<^class>\<open>boolean_algebra\<close> of defining
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    15
  \<^const>\<open>minus\<close> in terms of the complement.\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    16
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    17
class complemented_lattice = bounded_lattice + uminus + minus
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    18
  opening lattice_syntax +
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    19
  assumes inf_compl_bot [simp]: \<open>x \<sqinter> - x = \<bottom>\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    20
    and sup_compl_top [simp]: \<open>x \<squnion> - x = \<top>\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    21
    and diff_eq: \<open>x - y = x \<sqinter> - y\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    22
begin
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    23
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    24
lemma dual_complemented_lattice:
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    25
  "class.complemented_lattice (\<lambda>x y. x \<squnion> (- y)) uminus (\<squnion>) (\<lambda>x y. y \<le> x) (\<lambda>x y. y < x) (\<sqinter>) \<top> \<bottom>"
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    26
proof (rule class.complemented_lattice.intro)
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    27
  show "class.bounded_lattice (\<squnion>) (\<lambda>x y. y \<le> x) (\<lambda>x y. y < x) (\<sqinter>) \<top> \<bottom>"
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    28
    by (rule dual_bounded_lattice)
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    29
  show "class.complemented_lattice_axioms (\<lambda>x y. x \<squnion> - y) uminus (\<squnion>) (\<sqinter>) \<top> \<bottom>"
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    30
    by (unfold_locales, auto simp add: diff_eq)
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    31
qed
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    32
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    33
lemma compl_inf_bot [simp]: \<open>- x \<sqinter> x = \<bottom>\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    34
  by (simp add: inf_commute)
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    35
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    36
lemma compl_sup_top [simp]: \<open>- x \<squnion> x = \<top>\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    37
  by (simp add: sup_commute)
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    38
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    39
end
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    40
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    41
class complete_complemented_lattice = complemented_lattice + complete_lattice
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    42
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    43
text \<open>The following class \<open>complemented_lattice\<close> describes orthocomplemented lattices,
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    44
  following   \<^url>\<open>https://en.wikipedia.org/wiki/Complemented_lattice#Orthocomplementation\<close>.\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    45
class orthocomplemented_lattice = complemented_lattice
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    46
  opening lattice_syntax +
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    47
  assumes ortho_involution [simp]: "- (- x) = x"
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    48
    and ortho_antimono: "x \<le> y \<Longrightarrow> - x \<ge> - y" begin
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    49
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    50
lemma dual_orthocomplemented_lattice:
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    51
  "class.orthocomplemented_lattice (\<lambda>x y. x \<squnion> - y) uminus (\<squnion>) (\<lambda>x y. y \<le> x) (\<lambda>x y. y < x) (\<sqinter>) \<top> \<bottom>"
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    52
proof (rule class.orthocomplemented_lattice.intro)
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    53
  show "class.complemented_lattice (\<lambda>x y. x \<squnion> - y) uminus (\<squnion>) (\<lambda>x y. y \<le> x) (\<lambda>x y. y < x) (\<sqinter>) \<top> \<bottom>"
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    54
    by (rule dual_complemented_lattice)
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    55
  show "class.orthocomplemented_lattice_axioms uminus (\<lambda>x y. y \<le> x)"
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    56
    by (unfold_locales, auto simp add: diff_eq intro: ortho_antimono)
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    57
qed
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    58
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    59
lemma compl_eq_compl_iff [simp]: \<open>- x = - y \<longleftrightarrow> x = y\<close> (is \<open>?P \<longleftrightarrow> ?Q\<close>)
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    60
proof
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    61
  assume ?P
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    62
  then have \<open>- (- x) = - (- y)\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    63
    by simp
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    64
  then show ?Q
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    65
    by simp
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    66
next
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    67
  assume ?Q
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    68
  then show ?P
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    69
    by simp
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    70
qed
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    71
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    72
lemma compl_bot_eq [simp]: \<open>- \<bottom> = \<top>\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    73
proof -
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    74
  have \<open>- \<bottom> = - (\<top> \<sqinter> - \<top>)\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    75
    by simp
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    76
  also have \<open>\<dots> = \<top>\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    77
    by (simp only: inf_top_left) simp
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    78
  finally show ?thesis .
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    79
qed
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    80
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    81
lemma compl_top_eq [simp]: "- \<top> = \<bottom>"
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    82
  using compl_bot_eq ortho_involution by blast
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    83
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    84
text \<open>De Morgan's law\<close> \<comment> \<open>Proof from \<^url>\<open>https://planetmath.org/orthocomplementedlattice\<close>\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    85
lemma compl_sup [simp]: "- (x \<squnion> y) = - x \<sqinter> - y"
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    86
proof -
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    87
  have "- (x \<squnion> y) \<le> - x"
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    88
    by (simp add: ortho_antimono)
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    89
  moreover have "- (x \<squnion> y) \<le> - y"
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    90
    by (simp add: ortho_antimono)
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    91
  ultimately have 1: "- (x \<squnion> y) \<le> - x \<sqinter> - y"
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    92
    by (simp add: sup.coboundedI1)
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    93
  have \<open>x \<le> - (-x \<sqinter> -y)\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    94
    by (metis inf.cobounded1 ortho_antimono ortho_involution)
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    95
  moreover have \<open>y \<le> - (-x \<sqinter> -y)\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    96
    by (metis inf.cobounded2 ortho_antimono ortho_involution)
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    97
  ultimately have \<open>x \<squnion> y \<le> - (-x \<sqinter> -y)\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    98
    by auto
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
    99
  hence 2: \<open>-x \<sqinter> -y \<le> - (x \<squnion> y)\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   100
    using ortho_antimono by fastforce
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   101
  from 1 2 show ?thesis
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   102
    using dual_order.antisym by blast
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   103
qed
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   104
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   105
text \<open>De Morgan's law\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   106
lemma compl_inf [simp]: "- (x \<sqinter> y) = - x \<squnion> - y"
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   107
  using compl_sup
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   108
  by (metis ortho_involution)
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   109
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   110
lemma compl_mono:
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   111
  assumes "x \<le> y"
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   112
  shows "- y \<le> - x"
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   113
  by (simp add: assms local.ortho_antimono)
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   114
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   115
lemma compl_le_compl_iff [simp]: "- x \<le> - y \<longleftrightarrow> y \<le> x"
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   116
  by (auto dest: compl_mono)
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   117
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   118
lemma compl_le_swap1:
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   119
  assumes "y \<le> - x"
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   120
  shows "x \<le> -y"
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   121
  using assms ortho_antimono by fastforce
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   122
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   123
lemma compl_le_swap2:
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   124
  assumes "- y \<le> x"
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   125
  shows "- x \<le> y"
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   126
  using assms local.ortho_antimono by fastforce
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   127
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   128
lemma compl_less_compl_iff[simp]: "- x < - y \<longleftrightarrow> y < x"
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   129
  by (auto simp add: less_le)
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   130
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   131
lemma compl_less_swap1:
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   132
  assumes "y < - x"
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   133
  shows "x < - y"
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   134
  using assms compl_less_compl_iff by fastforce
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   135
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   136
lemma compl_less_swap2:
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   137
  assumes "- y < x"
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   138
  shows "- x < y"
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   139
  using assms compl_le_swap1 compl_le_swap2 less_le_not_le by auto
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   140
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   141
lemma sup_cancel_left1: \<open>x \<squnion> a \<squnion> (- x \<squnion> b) = \<top>\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   142
  by (simp add: sup_commute sup_left_commute)
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   143
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   144
lemma sup_cancel_left2: \<open>- x \<squnion> a \<squnion> (x \<squnion> b) = \<top>\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   145
  by (simp add: sup.commute sup_left_commute)
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   146
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   147
lemma inf_cancel_left1: \<open>x \<sqinter> a \<sqinter> (- x \<sqinter> b) = \<bottom>\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   148
  by (simp add: inf.left_commute inf_commute)
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   149
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   150
lemma inf_cancel_left2: \<open>- x \<sqinter> a \<sqinter> (x \<sqinter> b) = \<bottom>\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   151
  using inf.left_commute inf_commute by auto
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   152
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   153
lemma sup_compl_top_left1 [simp]: \<open>- x \<squnion> (x \<squnion> y) = \<top>\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   154
  by (simp add: sup_assoc[symmetric])
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   155
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   156
lemma sup_compl_top_left2 [simp]: \<open>x \<squnion> (- x \<squnion> y) = \<top>\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   157
  using sup_compl_top_left1[of "- x" y] by simp
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   158
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   159
lemma inf_compl_bot_left1 [simp]: \<open>- x \<sqinter> (x \<sqinter> y) = \<bottom>\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   160
  by (simp add: inf_assoc[symmetric])
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   161
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   162
lemma inf_compl_bot_left2 [simp]: \<open>x \<sqinter> (- x \<sqinter> y) = \<bottom>\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   163
  using inf_compl_bot_left1[of "- x" y] by simp
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   164
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   165
lemma inf_compl_bot_right [simp]: \<open>x \<sqinter> (y \<sqinter> - x) = \<bottom>\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   166
  by (subst inf_left_commute) simp
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   167
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   168
end
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   169
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   170
class complete_orthocomplemented_lattice = orthocomplemented_lattice + complete_lattice
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   171
begin
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   172
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   173
subclass complete_complemented_lattice ..
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   174
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   175
end
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   176
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   177
text \<open>The following class \<open>orthomodular_lattice\<close> describes orthomodular lattices,
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   178
following   \<^url>\<open>https://en.wikipedia.org/wiki/Complemented_lattice#Orthomodular_lattices\<close>.\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   179
class orthomodular_lattice = orthocomplemented_lattice
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   180
  opening lattice_syntax +
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   181
  assumes orthomodular: "x \<le> y \<Longrightarrow> x \<squnion> (- x) \<sqinter> y = y" begin
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   182
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   183
lemma dual_orthomodular_lattice:
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   184
  "class.orthomodular_lattice (\<lambda>x y. x \<squnion> - y) uminus (\<squnion>) (\<lambda>x y. y \<le> x) (\<lambda>x y. y < x) (\<sqinter>)  \<top> \<bottom>"
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   185
proof (rule class.orthomodular_lattice.intro)
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   186
  show "class.orthocomplemented_lattice (\<lambda>x y. x \<squnion> - y) uminus (\<squnion>) (\<lambda>x y. y \<le> x) (\<lambda>x y. y < x) (\<sqinter>) \<top> \<bottom>"
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   187
    by (rule dual_orthocomplemented_lattice)
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   188
  show "class.orthomodular_lattice_axioms uminus (\<squnion>) (\<lambda>x y. y \<le> x) (\<sqinter>)"
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   189
  proof (unfold_locales)
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   190
    show "(x::'a) \<sqinter> (- x \<squnion> y) = y"
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   191
      if "(y::'a) \<le> x"
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   192
      for x :: 'a
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   193
        and y :: 'a
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   194
      using that local.compl_eq_compl_iff local.ortho_antimono local.orthomodular by fastforce
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   195
  qed
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   196
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   197
qed
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   198
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   199
end
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   200
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   201
class complete_orthomodular_lattice = orthomodular_lattice + complete_lattice
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   202
begin
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   203
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   204
subclass complete_orthocomplemented_lattice ..
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   205
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   206
end
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   207
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   208
context boolean_algebra
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   209
  opening lattice_syntax
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   210
begin
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   211
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   212
subclass orthomodular_lattice
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   213
proof
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   214
  fix x y
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   215
  show \<open>x \<squnion> - x \<sqinter> y = y\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   216
    if \<open>x \<le> y\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   217
    using that
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   218
    by (simp add: sup.absorb_iff2 sup_inf_distrib1)
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   219
  show \<open>x - y = x \<sqinter> - y\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   220
    by (simp add: diff_eq)
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   221
qed auto
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   222
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   223
end
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   224
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   225
context complete_boolean_algebra
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   226
begin
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   227
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   228
subclass complete_orthomodular_lattice ..
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   229
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   230
end
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   231
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   232
lemma image_of_maximum:
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   233
  fixes f::"'a::order \<Rightarrow> 'b::conditionally_complete_lattice"
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   234
  assumes "mono f"
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   235
    and "\<And>x. x:M \<Longrightarrow> x\<le>m"
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   236
    and "m:M"
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   237
  shows "(SUP x\<in>M. f x) = f m"
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   238
  by (smt (verit, ccfv_threshold) assms(1) assms(2) assms(3) cSup_eq_maximum imageE imageI monoD)
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   239
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   240
lemma cSup_eq_cSup:
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   241
  fixes A B :: \<open>'a::conditionally_complete_lattice set\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   242
  assumes bdd: \<open>bdd_above A\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   243
  assumes B: \<open>\<And>a. a\<in>A \<Longrightarrow> \<exists>b\<in>B. b \<ge> a\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   244
  assumes A: \<open>\<And>b. b\<in>B \<Longrightarrow> \<exists>a\<in>A. a \<ge> b\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   245
  shows \<open>Sup A = Sup B\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   246
proof (cases \<open>B = {}\<close>)
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   247
  case True
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   248
  with A B have \<open>A = {}\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   249
    by auto
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   250
  with True show ?thesis by simp
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   251
next
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   252
  case False
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   253
  have \<open>bdd_above B\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   254
    by (meson A bdd bdd_above_def order_trans)
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   255
  have \<open>A \<noteq> {}\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   256
    using A False by blast
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   257
  moreover have \<open>a \<le> Sup B\<close> if \<open>a \<in> A\<close> for a
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   258
  proof -
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   259
    obtain b where \<open>b \<in> B\<close> and \<open>b \<ge> a\<close>
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   260
      using B \<open>a \<in> A\<close> by auto
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   261
    then show ?thesis
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   262
      apply (rule cSup_upper2)
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   263
      using \<open>bdd_above B\<close> by simp
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   264
  qed
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   265
  moreover have \<open>Sup B \<le> c\<close> if \<open>\<And>a. a \<in> A \<Longrightarrow> a \<le> c\<close> for c
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   266
    using False apply (rule cSup_least)
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   267
    using A that by fastforce
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   268
  ultimately show ?thesis
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   269
    by (rule cSup_eq_non_empty)
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   270
qed
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   271
3f24cc294d74 moved from AFP to distribution
haftmann
parents:
diff changeset
   272
end