src/HOL/Algebra/Order.thy
author immler
Wed, 02 May 2018 13:49:38 +0200
changeset 68072 493b818e8e10
parent 67613 ce654b0e6d69
child 68073 fad29d2a17a5
permissions -rw-r--r--
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
65099
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
     1
(*  Title:      HOL/Algebra/Order.thy
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
     2
    Author:     Clemens Ballarin, started 7 November 2003
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
     3
    Copyright:  Clemens Ballarin
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
     4
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
     5
Most congruence rules by Stephan Hohe.
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
     6
With additional contributions from Alasdair Armstrong and Simon Foster.
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
     7
*)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
     8
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
     9
theory Order
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67613
diff changeset
    10
  imports
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67613
diff changeset
    11
    Congruence
65099
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    12
begin
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    13
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    14
section \<open>Orders\<close>
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    15
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    16
subsection \<open>Partial Orders\<close>
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    17
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    18
record 'a gorder = "'a eq_object" +
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    19
  le :: "['a, 'a] => bool" (infixl "\<sqsubseteq>\<index>" 50)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    20
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    21
abbreviation inv_gorder :: "_ \<Rightarrow> 'a gorder" where
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    22
  "inv_gorder L \<equiv>
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    23
   \<lparr> carrier = carrier L,
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 67091
diff changeset
    24
     eq = (.=\<^bsub>L\<^esub>),
65099
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    25
     le = (\<lambda> x y. y \<sqsubseteq>\<^bsub>L \<^esub>x) \<rparr>"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    26
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    27
lemma inv_gorder_inv:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    28
  "inv_gorder (inv_gorder L) = L"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    29
  by simp
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    30
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    31
locale weak_partial_order = equivalence L for L (structure) +
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    32
  assumes le_refl [intro, simp]:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    33
      "x \<in> carrier L ==> x \<sqsubseteq> x"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    34
    and weak_le_antisym [intro]:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    35
      "[| x \<sqsubseteq> y; y \<sqsubseteq> x; x \<in> carrier L; y \<in> carrier L |] ==> x .= y"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    36
    and le_trans [trans]:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    37
      "[| x \<sqsubseteq> y; y \<sqsubseteq> z; x \<in> carrier L; y \<in> carrier L; z \<in> carrier L |] ==> x \<sqsubseteq> z"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    38
    and le_cong:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    39
      "\<lbrakk> x .= y; z .= w; x \<in> carrier L; y \<in> carrier L; z \<in> carrier L; w \<in> carrier L \<rbrakk> \<Longrightarrow>
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    40
      x \<sqsubseteq> z \<longleftrightarrow> y \<sqsubseteq> w"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    41
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    42
definition
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    43
  lless :: "[_, 'a, 'a] => bool" (infixl "\<sqsubset>\<index>" 50)
67091
1393c2340eec more symbols;
wenzelm
parents: 66453
diff changeset
    44
  where "x \<sqsubset>\<^bsub>L\<^esub> y \<longleftrightarrow> x \<sqsubseteq>\<^bsub>L\<^esub> y \<and> x .\<noteq>\<^bsub>L\<^esub> y"
65099
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    45
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    46
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    47
subsubsection \<open>The order relation\<close>
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    48
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    49
context weak_partial_order
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    50
begin
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    51
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    52
lemma le_cong_l [intro, trans]:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    53
  "\<lbrakk> x .= y; y \<sqsubseteq> z; x \<in> carrier L; y \<in> carrier L; z \<in> carrier L \<rbrakk> \<Longrightarrow> x \<sqsubseteq> z"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    54
  by (auto intro: le_cong [THEN iffD2])
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    55
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    56
lemma le_cong_r [intro, trans]:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    57
  "\<lbrakk> x \<sqsubseteq> y; y .= z; x \<in> carrier L; y \<in> carrier L; z \<in> carrier L \<rbrakk> \<Longrightarrow> x \<sqsubseteq> z"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    58
  by (auto intro: le_cong [THEN iffD1])
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    59
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    60
lemma weak_refl [intro, simp]: "\<lbrakk> x .= y; x \<in> carrier L; y \<in> carrier L \<rbrakk> \<Longrightarrow> x \<sqsubseteq> y"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    61
  by (simp add: le_cong_l)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    62
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    63
end
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    64
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    65
lemma weak_llessI:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    66
  fixes R (structure)
67091
1393c2340eec more symbols;
wenzelm
parents: 66453
diff changeset
    67
  assumes "x \<sqsubseteq> y" and "\<not>(x .= y)"
65099
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    68
  shows "x \<sqsubset> y"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    69
  using assms unfolding lless_def by simp
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    70
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    71
lemma lless_imp_le:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    72
  fixes R (structure)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    73
  assumes "x \<sqsubset> y"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    74
  shows "x \<sqsubseteq> y"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    75
  using assms unfolding lless_def by simp
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    76
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    77
lemma weak_lless_imp_not_eq:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    78
  fixes R (structure)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    79
  assumes "x \<sqsubset> y"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    80
  shows "\<not> (x .= y)"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    81
  using assms unfolding lless_def by simp
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    82
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    83
lemma weak_llessE:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    84
  fixes R (structure)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    85
  assumes p: "x \<sqsubset> y" and e: "\<lbrakk>x \<sqsubseteq> y; \<not> (x .= y)\<rbrakk> \<Longrightarrow> P"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    86
  shows "P"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    87
  using p by (blast dest: lless_imp_le weak_lless_imp_not_eq e)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    88
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    89
lemma (in weak_partial_order) lless_cong_l [trans]:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    90
  assumes xx': "x .= x'"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    91
    and xy: "x' \<sqsubset> y"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    92
    and carr: "x \<in> carrier L" "x' \<in> carrier L" "y \<in> carrier L"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    93
  shows "x \<sqsubset> y"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    94
  using assms unfolding lless_def by (auto intro: trans sym)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    95
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    96
lemma (in weak_partial_order) lless_cong_r [trans]:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    97
  assumes xy: "x \<sqsubset> y"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    98
    and  yy': "y .= y'"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
    99
    and carr: "x \<in> carrier L" "y \<in> carrier L" "y' \<in> carrier L"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   100
  shows "x \<sqsubset> y'"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   101
  using assms unfolding lless_def by (auto intro: trans sym)  (*slow*)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   102
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   103
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   104
lemma (in weak_partial_order) lless_antisym:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   105
  assumes "a \<in> carrier L" "b \<in> carrier L"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   106
    and "a \<sqsubset> b" "b \<sqsubset> a"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   107
  shows "P"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   108
  using assms
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   109
  by (elim weak_llessE) auto
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   110
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   111
lemma (in weak_partial_order) lless_trans [trans]:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   112
  assumes "a \<sqsubset> b" "b \<sqsubset> c"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   113
    and carr[simp]: "a \<in> carrier L" "b \<in> carrier L" "c \<in> carrier L"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   114
  shows "a \<sqsubset> c"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   115
  using assms unfolding lless_def by (blast dest: le_trans intro: sym)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   116
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   117
lemma weak_partial_order_subset:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   118
  assumes "weak_partial_order L" "A \<subseteq> carrier L"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   119
  shows "weak_partial_order (L\<lparr> carrier := A \<rparr>)"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   120
proof -
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   121
  interpret L: weak_partial_order L
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   122
    by (simp add: assms)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   123
  interpret equivalence "(L\<lparr> carrier := A \<rparr>)"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   124
    by (simp add: L.equivalence_axioms assms(2) equivalence_subset)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   125
  show ?thesis
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   126
    apply (unfold_locales, simp_all)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   127
    using assms(2) apply auto[1]
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   128
    using assms(2) apply auto[1]
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   129
    apply (meson L.le_trans assms(2) contra_subsetD)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   130
    apply (meson L.le_cong assms(2) subsetCE)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   131
  done
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   132
qed
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   133
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   134
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   135
subsubsection \<open>Upper and lower bounds of a set\<close>
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   136
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   137
definition
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   138
  Upper :: "[_, 'a set] => 'a set"
67091
1393c2340eec more symbols;
wenzelm
parents: 66453
diff changeset
   139
  where "Upper L A = {u. (\<forall>x. x \<in> A \<inter> carrier L \<longrightarrow> x \<sqsubseteq>\<^bsub>L\<^esub> u)} \<inter> carrier L"
65099
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   140
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   141
definition
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   142
  Lower :: "[_, 'a set] => 'a set"
67091
1393c2340eec more symbols;
wenzelm
parents: 66453
diff changeset
   143
  where "Lower L A = {l. (\<forall>x. x \<in> A \<inter> carrier L \<longrightarrow> l \<sqsubseteq>\<^bsub>L\<^esub> x)} \<inter> carrier L"
65099
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   144
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   145
lemma Upper_closed [intro!, simp]:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   146
  "Upper L A \<subseteq> carrier L"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   147
  by (unfold Upper_def) clarify
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   148
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   149
lemma Upper_memD [dest]:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   150
  fixes L (structure)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   151
  shows "[| u \<in> Upper L A; x \<in> A; A \<subseteq> carrier L |] ==> x \<sqsubseteq> u \<and> u \<in> carrier L"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   152
  by (unfold Upper_def) blast
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   153
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   154
lemma (in weak_partial_order) Upper_elemD [dest]:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   155
  "[| u .\<in> Upper L A; u \<in> carrier L; x \<in> A; A \<subseteq> carrier L |] ==> x \<sqsubseteq> u"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   156
  unfolding Upper_def elem_def
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   157
  by (blast dest: sym)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   158
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   159
lemma Upper_memI:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   160
  fixes L (structure)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   161
  shows "[| !! y. y \<in> A ==> y \<sqsubseteq> x; x \<in> carrier L |] ==> x \<in> Upper L A"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   162
  by (unfold Upper_def) blast
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   163
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   164
lemma (in weak_partial_order) Upper_elemI:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   165
  "[| !! y. y \<in> A ==> y \<sqsubseteq> x; x \<in> carrier L |] ==> x .\<in> Upper L A"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   166
  unfolding Upper_def by blast
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   167
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   168
lemma Upper_antimono:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   169
  "A \<subseteq> B ==> Upper L B \<subseteq> Upper L A"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   170
  by (unfold Upper_def) blast
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   171
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   172
lemma (in weak_partial_order) Upper_is_closed [simp]:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   173
  "A \<subseteq> carrier L ==> is_closed (Upper L A)"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   174
  by (rule is_closedI) (blast intro: Upper_memI)+
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   175
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   176
lemma (in weak_partial_order) Upper_mem_cong:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   177
  assumes a'carr: "a' \<in> carrier L" and Acarr: "A \<subseteq> carrier L"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   178
    and aa': "a .= a'"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   179
    and aelem: "a \<in> Upper L A"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   180
  shows "a' \<in> Upper L A"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   181
proof (rule Upper_memI[OF _ a'carr])
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   182
  fix y
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   183
  assume yA: "y \<in> A"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   184
  hence "y \<sqsubseteq> a" by (intro Upper_memD[OF aelem, THEN conjunct1] Acarr)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   185
  also note aa'
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   186
  finally
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   187
      show "y \<sqsubseteq> a'"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   188
      by (simp add: a'carr subsetD[OF Acarr yA] subsetD[OF Upper_closed aelem])
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   189
qed
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   190
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   191
lemma (in weak_partial_order) Upper_cong:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   192
  assumes Acarr: "A \<subseteq> carrier L" and A'carr: "A' \<subseteq> carrier L"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   193
    and AA': "A {.=} A'"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   194
  shows "Upper L A = Upper L A'"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   195
unfolding Upper_def
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   196
apply rule
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   197
 apply (rule, clarsimp) defer 1
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   198
 apply (rule, clarsimp) defer 1
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   199
proof -
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   200
  fix x a'
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   201
  assume carr: "x \<in> carrier L" "a' \<in> carrier L"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   202
    and a'A': "a' \<in> A'"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   203
  assume aLxCond[rule_format]: "\<forall>a. a \<in> A \<and> a \<in> carrier L \<longrightarrow> a \<sqsubseteq> x"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   204
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   205
  from AA' and a'A' have "\<exists>a\<in>A. a' .= a" by (rule set_eqD2)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   206
  from this obtain a
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   207
      where aA: "a \<in> A"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   208
      and a'a: "a' .= a"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   209
      by auto
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   210
  note [simp] = subsetD[OF Acarr aA] carr
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   211
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   212
  note a'a
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   213
  also have "a \<sqsubseteq> x" by (simp add: aLxCond aA)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   214
  finally show "a' \<sqsubseteq> x" by simp
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   215
next
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   216
  fix x a
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   217
  assume carr: "x \<in> carrier L" "a \<in> carrier L"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   218
    and aA: "a \<in> A"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   219
  assume a'LxCond[rule_format]: "\<forall>a'. a' \<in> A' \<and> a' \<in> carrier L \<longrightarrow> a' \<sqsubseteq> x"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   220
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   221
  from AA' and aA have "\<exists>a'\<in>A'. a .= a'" by (rule set_eqD1)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   222
  from this obtain a'
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   223
      where a'A': "a' \<in> A'"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   224
      and aa': "a .= a'"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   225
      by auto
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   226
  note [simp] = subsetD[OF A'carr a'A'] carr
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   227
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   228
  note aa'
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   229
  also have "a' \<sqsubseteq> x" by (simp add: a'LxCond a'A')
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   230
  finally show "a \<sqsubseteq> x" by simp
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   231
qed
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   232
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   233
lemma Lower_closed [intro!, simp]:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   234
  "Lower L A \<subseteq> carrier L"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   235
  by (unfold Lower_def) clarify
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   236
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   237
lemma Lower_memD [dest]:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   238
  fixes L (structure)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   239
  shows "[| l \<in> Lower L A; x \<in> A; A \<subseteq> carrier L |] ==> l \<sqsubseteq> x \<and> l \<in> carrier L"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   240
  by (unfold Lower_def) blast
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   241
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   242
lemma Lower_memI:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   243
  fixes L (structure)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   244
  shows "[| !! y. y \<in> A ==> x \<sqsubseteq> y; x \<in> carrier L |] ==> x \<in> Lower L A"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   245
  by (unfold Lower_def) blast
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   246
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   247
lemma Lower_antimono:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   248
  "A \<subseteq> B ==> Lower L B \<subseteq> Lower L A"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   249
  by (unfold Lower_def) blast
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   250
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   251
lemma (in weak_partial_order) Lower_is_closed [simp]:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   252
  "A \<subseteq> carrier L \<Longrightarrow> is_closed (Lower L A)"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   253
  by (rule is_closedI) (blast intro: Lower_memI dest: sym)+
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   254
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   255
lemma (in weak_partial_order) Lower_mem_cong:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   256
  assumes a'carr: "a' \<in> carrier L" and Acarr: "A \<subseteq> carrier L"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   257
    and aa': "a .= a'"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   258
    and aelem: "a \<in> Lower L A"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   259
  shows "a' \<in> Lower L A"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   260
using assms Lower_closed[of L A]
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   261
by (intro Lower_memI) (blast intro: le_cong_l[OF aa'[symmetric]])
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   262
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   263
lemma (in weak_partial_order) Lower_cong:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   264
  assumes Acarr: "A \<subseteq> carrier L" and A'carr: "A' \<subseteq> carrier L"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   265
    and AA': "A {.=} A'"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   266
  shows "Lower L A = Lower L A'"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   267
unfolding Lower_def
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   268
apply rule
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   269
 apply clarsimp defer 1
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   270
 apply clarsimp defer 1
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   271
proof -
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   272
  fix x a'
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   273
  assume carr: "x \<in> carrier L" "a' \<in> carrier L"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   274
    and a'A': "a' \<in> A'"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   275
  assume "\<forall>a. a \<in> A \<and> a \<in> carrier L \<longrightarrow> x \<sqsubseteq> a"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   276
  hence aLxCond: "\<And>a. \<lbrakk>a \<in> A; a \<in> carrier L\<rbrakk> \<Longrightarrow> x \<sqsubseteq> a" by fast
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   277
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   278
  from AA' and a'A' have "\<exists>a\<in>A. a' .= a" by (rule set_eqD2)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   279
  from this obtain a
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   280
      where aA: "a \<in> A"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   281
      and a'a: "a' .= a"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   282
      by auto
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   283
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   284
  from aA and subsetD[OF Acarr aA]
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   285
      have "x \<sqsubseteq> a" by (rule aLxCond)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   286
  also note a'a[symmetric]
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   287
  finally
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   288
      show "x \<sqsubseteq> a'" by (simp add: carr subsetD[OF Acarr aA])
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   289
next
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   290
  fix x a
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   291
  assume carr: "x \<in> carrier L" "a \<in> carrier L"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   292
    and aA: "a \<in> A"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   293
  assume "\<forall>a'. a' \<in> A' \<and> a' \<in> carrier L \<longrightarrow> x \<sqsubseteq> a'"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   294
  hence a'LxCond: "\<And>a'. \<lbrakk>a' \<in> A'; a' \<in> carrier L\<rbrakk> \<Longrightarrow> x \<sqsubseteq> a'" by fast+
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   295
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   296
  from AA' and aA have "\<exists>a'\<in>A'. a .= a'" by (rule set_eqD1)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   297
  from this obtain a'
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   298
      where a'A': "a' \<in> A'"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   299
      and aa': "a .= a'"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   300
      by auto
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   301
  from a'A' and subsetD[OF A'carr a'A']
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   302
      have "x \<sqsubseteq> a'" by (rule a'LxCond)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   303
  also note aa'[symmetric]
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   304
  finally show "x \<sqsubseteq> a" by (simp add: carr subsetD[OF A'carr a'A'])
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   305
qed
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   306
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   307
text \<open>Jacobson: Theorem 8.1\<close>
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   308
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   309
lemma Lower_empty [simp]:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   310
  "Lower L {} = carrier L"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   311
  by (unfold Lower_def) simp
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   312
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   313
lemma Upper_empty [simp]:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   314
  "Upper L {} = carrier L"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   315
  by (unfold Upper_def) simp
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   316
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   317
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   318
subsubsection \<open>Least and greatest, as predicate\<close>
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   319
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   320
definition
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   321
  least :: "[_, 'a, 'a set] => bool"
67091
1393c2340eec more symbols;
wenzelm
parents: 66453
diff changeset
   322
  where "least L l A \<longleftrightarrow> A \<subseteq> carrier L \<and> l \<in> A \<and> (\<forall>x\<in>A. l \<sqsubseteq>\<^bsub>L\<^esub> x)"
65099
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   323
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   324
definition
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   325
  greatest :: "[_, 'a, 'a set] => bool"
67091
1393c2340eec more symbols;
wenzelm
parents: 66453
diff changeset
   326
  where "greatest L g A \<longleftrightarrow> A \<subseteq> carrier L \<and> g \<in> A \<and> (\<forall>x\<in>A. x \<sqsubseteq>\<^bsub>L\<^esub> g)"
65099
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   327
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   328
text (in weak_partial_order) \<open>Could weaken these to @{term "l \<in> carrier L \<and> l
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   329
  .\<in> A"} and @{term "g \<in> carrier L \<and> g .\<in> A"}.\<close>
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   330
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   331
lemma least_closed [intro, simp]:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   332
  "least L l A ==> l \<in> carrier L"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   333
  by (unfold least_def) fast
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   334
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   335
lemma least_mem:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   336
  "least L l A ==> l \<in> A"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   337
  by (unfold least_def) fast
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   338
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   339
lemma (in weak_partial_order) weak_least_unique:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   340
  "[| least L x A; least L y A |] ==> x .= y"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   341
  by (unfold least_def) blast
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   342
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   343
lemma least_le:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   344
  fixes L (structure)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   345
  shows "[| least L x A; a \<in> A |] ==> x \<sqsubseteq> a"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   346
  by (unfold least_def) fast
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   347
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   348
lemma (in weak_partial_order) least_cong:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   349
  "[| x .= x'; x \<in> carrier L; x' \<in> carrier L; is_closed A |] ==> least L x A = least L x' A"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   350
  by (unfold least_def) (auto dest: sym)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   351
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   352
abbreviation is_lub :: "[_, 'a, 'a set] => bool"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   353
where "is_lub L x A \<equiv> least L x (Upper L A)"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   354
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   355
text (in weak_partial_order) \<open>@{const least} is not congruent in the second parameter for
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   356
  @{term "A {.=} A'"}\<close>
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   357
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   358
lemma (in weak_partial_order) least_Upper_cong_l:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   359
  assumes "x .= x'"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   360
    and "x \<in> carrier L" "x' \<in> carrier L"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   361
    and "A \<subseteq> carrier L"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   362
  shows "least L x (Upper L A) = least L x' (Upper L A)"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   363
  apply (rule least_cong) using assms by auto
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   364
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   365
lemma (in weak_partial_order) least_Upper_cong_r:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   366
  assumes Acarrs: "A \<subseteq> carrier L" "A' \<subseteq> carrier L" (* unneccessary with current Upper? *)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   367
    and AA': "A {.=} A'"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   368
  shows "least L x (Upper L A) = least L x (Upper L A')"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   369
apply (subgoal_tac "Upper L A = Upper L A'", simp)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   370
by (rule Upper_cong) fact+
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   371
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   372
lemma least_UpperI:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   373
  fixes L (structure)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   374
  assumes above: "!! x. x \<in> A ==> x \<sqsubseteq> s"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   375
    and below: "!! y. y \<in> Upper L A ==> s \<sqsubseteq> y"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   376
    and L: "A \<subseteq> carrier L"  "s \<in> carrier L"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   377
  shows "least L s (Upper L A)"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   378
proof -
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   379
  have "Upper L A \<subseteq> carrier L" by simp
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   380
  moreover from above L have "s \<in> Upper L A" by (simp add: Upper_def)
67613
ce654b0e6d69 more symbols;
wenzelm
parents: 67399
diff changeset
   381
  moreover from below have "\<forall>x \<in> Upper L A. s \<sqsubseteq> x" by fast
65099
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   382
  ultimately show ?thesis by (simp add: least_def)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   383
qed
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   384
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   385
lemma least_Upper_above:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   386
  fixes L (structure)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   387
  shows "[| least L s (Upper L A); x \<in> A; A \<subseteq> carrier L |] ==> x \<sqsubseteq> s"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   388
  by (unfold least_def) blast
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   389
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   390
lemma greatest_closed [intro, simp]:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   391
  "greatest L l A ==> l \<in> carrier L"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   392
  by (unfold greatest_def) fast
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   393
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   394
lemma greatest_mem:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   395
  "greatest L l A ==> l \<in> A"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   396
  by (unfold greatest_def) fast
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   397
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   398
lemma (in weak_partial_order) weak_greatest_unique:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   399
  "[| greatest L x A; greatest L y A |] ==> x .= y"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   400
  by (unfold greatest_def) blast
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   401
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   402
lemma greatest_le:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   403
  fixes L (structure)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   404
  shows "[| greatest L x A; a \<in> A |] ==> a \<sqsubseteq> x"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   405
  by (unfold greatest_def) fast
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   406
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   407
lemma (in weak_partial_order) greatest_cong:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   408
  "[| x .= x'; x \<in> carrier L; x' \<in> carrier L; is_closed A |] ==>
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   409
  greatest L x A = greatest L x' A"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   410
  by (unfold greatest_def) (auto dest: sym)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   411
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   412
abbreviation is_glb :: "[_, 'a, 'a set] => bool"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   413
where "is_glb L x A \<equiv> greatest L x (Lower L A)"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   414
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   415
text (in weak_partial_order) \<open>@{const greatest} is not congruent in the second parameter for
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   416
  @{term "A {.=} A'"} \<close>
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   417
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   418
lemma (in weak_partial_order) greatest_Lower_cong_l:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   419
  assumes "x .= x'"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   420
    and "x \<in> carrier L" "x' \<in> carrier L"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   421
    and "A \<subseteq> carrier L" (* unneccessary with current Lower *)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   422
  shows "greatest L x (Lower L A) = greatest L x' (Lower L A)"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   423
  apply (rule greatest_cong) using assms by auto
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   424
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   425
lemma (in weak_partial_order) greatest_Lower_cong_r:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   426
  assumes Acarrs: "A \<subseteq> carrier L" "A' \<subseteq> carrier L"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   427
    and AA': "A {.=} A'"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   428
  shows "greatest L x (Lower L A) = greatest L x (Lower L A')"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   429
apply (subgoal_tac "Lower L A = Lower L A'", simp)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   430
by (rule Lower_cong) fact+
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   431
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   432
lemma greatest_LowerI:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   433
  fixes L (structure)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   434
  assumes below: "!! x. x \<in> A ==> i \<sqsubseteq> x"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   435
    and above: "!! y. y \<in> Lower L A ==> y \<sqsubseteq> i"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   436
    and L: "A \<subseteq> carrier L"  "i \<in> carrier L"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   437
  shows "greatest L i (Lower L A)"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   438
proof -
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   439
  have "Lower L A \<subseteq> carrier L" by simp
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   440
  moreover from below L have "i \<in> Lower L A" by (simp add: Lower_def)
67613
ce654b0e6d69 more symbols;
wenzelm
parents: 67399
diff changeset
   441
  moreover from above have "\<forall>x \<in> Lower L A. x \<sqsubseteq> i" by fast
65099
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   442
  ultimately show ?thesis by (simp add: greatest_def)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   443
qed
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   444
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   445
lemma greatest_Lower_below:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   446
  fixes L (structure)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   447
  shows "[| greatest L i (Lower L A); x \<in> A; A \<subseteq> carrier L |] ==> i \<sqsubseteq> x"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   448
  by (unfold greatest_def) blast
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   449
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   450
lemma Lower_dual [simp]:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   451
  "Lower (inv_gorder L) A = Upper L A"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   452
  by (simp add:Upper_def Lower_def)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   453
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   454
lemma Upper_dual [simp]:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   455
  "Upper (inv_gorder L) A = Lower L A"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   456
  by (simp add:Upper_def Lower_def)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   457
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   458
lemma least_dual [simp]:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   459
  "least (inv_gorder L) x A = greatest L x A"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   460
  by (simp add:least_def greatest_def)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   461
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   462
lemma greatest_dual [simp]:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   463
  "greatest (inv_gorder L) x A = least L x A"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   464
  by (simp add:least_def greatest_def)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   465
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   466
lemma (in weak_partial_order) dual_weak_order:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   467
  "weak_partial_order (inv_gorder L)"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   468
  apply (unfold_locales)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   469
  apply (simp_all)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   470
  apply (metis sym)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   471
  apply (metis trans)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   472
  apply (metis weak_le_antisym)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   473
  apply (metis le_trans)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   474
  apply (metis le_cong_l le_cong_r sym)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   475
done
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   476
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   477
lemma dual_weak_order_iff:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   478
  "weak_partial_order (inv_gorder A) \<longleftrightarrow> weak_partial_order A"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   479
proof
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   480
  assume "weak_partial_order (inv_gorder A)"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   481
  then interpret dpo: weak_partial_order "inv_gorder A"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   482
  rewrites "carrier (inv_gorder A) = carrier A"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   483
  and   "le (inv_gorder A)      = (\<lambda> x y. le A y x)"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   484
  and   "eq (inv_gorder A)      = eq A"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   485
    by (simp_all)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   486
  show "weak_partial_order A"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   487
    by (unfold_locales, auto intro: dpo.sym dpo.trans dpo.le_trans)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   488
next
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   489
  assume "weak_partial_order A"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   490
  thus "weak_partial_order (inv_gorder A)"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   491
    by (metis weak_partial_order.dual_weak_order)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   492
qed
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   493
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   494
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   495
subsubsection \<open>Intervals\<close>
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   496
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   497
definition
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   498
  at_least_at_most :: "('a, 'c) gorder_scheme \<Rightarrow> 'a => 'a => 'a set" ("(1\<lbrace>_.._\<rbrace>\<index>)")
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   499
  where "\<lbrace>l..u\<rbrace>\<^bsub>A\<^esub> = {x \<in> carrier A. l \<sqsubseteq>\<^bsub>A\<^esub> x \<and> x \<sqsubseteq>\<^bsub>A\<^esub> u}"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   500
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   501
context weak_partial_order
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   502
begin
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   503
  
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   504
  lemma at_least_at_most_upper [dest]:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   505
    "x \<in> \<lbrace>a..b\<rbrace> \<Longrightarrow> x \<sqsubseteq> b"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   506
    by (simp add: at_least_at_most_def)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   507
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   508
  lemma at_least_at_most_lower [dest]:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   509
    "x \<in> \<lbrace>a..b\<rbrace> \<Longrightarrow> a \<sqsubseteq> x"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   510
    by (simp add: at_least_at_most_def)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   511
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   512
  lemma at_least_at_most_closed: "\<lbrace>a..b\<rbrace> \<subseteq> carrier L"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   513
    by (auto simp add: at_least_at_most_def)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   514
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   515
  lemma at_least_at_most_member [intro]: 
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   516
    "\<lbrakk> x \<in> carrier L; a \<sqsubseteq> x; x \<sqsubseteq> b \<rbrakk> \<Longrightarrow> x \<in> \<lbrace>a..b\<rbrace>"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   517
    by (simp add: at_least_at_most_def)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   518
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   519
end
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   520
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   521
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   522
subsubsection \<open>Isotone functions\<close>
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   523
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   524
definition isotone :: "('a, 'c) gorder_scheme \<Rightarrow> ('b, 'd) gorder_scheme \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> bool"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   525
  where
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   526
  "isotone A B f \<equiv>
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   527
   weak_partial_order A \<and> weak_partial_order B \<and>
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   528
   (\<forall>x\<in>carrier A. \<forall>y\<in>carrier A. x \<sqsubseteq>\<^bsub>A\<^esub> y \<longrightarrow> f x \<sqsubseteq>\<^bsub>B\<^esub> f y)"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   529
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   530
lemma isotoneI [intro?]:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   531
  fixes f :: "'a \<Rightarrow> 'b"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   532
  assumes "weak_partial_order L1"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   533
          "weak_partial_order L2"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   534
          "(\<And>x y. \<lbrakk> x \<in> carrier L1; y \<in> carrier L1; x \<sqsubseteq>\<^bsub>L1\<^esub> y \<rbrakk> 
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   535
                   \<Longrightarrow> f x \<sqsubseteq>\<^bsub>L2\<^esub> f y)"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   536
  shows "isotone L1 L2 f"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   537
  using assms by (auto simp add:isotone_def)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   538
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   539
abbreviation Monotone :: "('a, 'b) gorder_scheme \<Rightarrow> ('a \<Rightarrow> 'a) \<Rightarrow> bool" ("Mono\<index>")
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   540
  where "Monotone L f \<equiv> isotone L L f"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   541
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   542
lemma use_iso1:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   543
  "\<lbrakk>isotone A A f; x \<in> carrier A; y \<in> carrier A; x \<sqsubseteq>\<^bsub>A\<^esub> y\<rbrakk> \<Longrightarrow>
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   544
   f x \<sqsubseteq>\<^bsub>A\<^esub> f y"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   545
  by (simp add: isotone_def)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   546
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   547
lemma use_iso2:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   548
  "\<lbrakk>isotone A B f; x \<in> carrier A; y \<in> carrier A; x \<sqsubseteq>\<^bsub>A\<^esub> y\<rbrakk> \<Longrightarrow>
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   549
   f x \<sqsubseteq>\<^bsub>B\<^esub> f y"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   550
  by (simp add: isotone_def)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   551
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   552
lemma iso_compose:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   553
  "\<lbrakk>f \<in> carrier A \<rightarrow> carrier B; isotone A B f; g \<in> carrier B \<rightarrow> carrier C; isotone B C g\<rbrakk> \<Longrightarrow>
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   554
   isotone A C (g \<circ> f)"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   555
  by (simp add: isotone_def, safe, metis Pi_iff)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   556
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   557
lemma (in weak_partial_order) inv_isotone [simp]: 
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   558
  "isotone (inv_gorder A) (inv_gorder B) f = isotone A B f"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   559
  by (auto simp add:isotone_def dual_weak_order dual_weak_order_iff)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   560
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   561
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   562
subsubsection \<open>Idempotent functions\<close>
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   563
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   564
definition idempotent :: 
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   565
  "('a, 'b) gorder_scheme \<Rightarrow> ('a \<Rightarrow> 'a) \<Rightarrow> bool" ("Idem\<index>") where
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   566
  "idempotent L f \<equiv> \<forall>x\<in>carrier L. f (f x) .=\<^bsub>L\<^esub> f x"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   567
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   568
lemma (in weak_partial_order) idempotent:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   569
  "\<lbrakk> Idem f; x \<in> carrier L \<rbrakk> \<Longrightarrow> f (f x) .= f x"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   570
  by (auto simp add: idempotent_def)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   571
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   572
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   573
subsubsection \<open>Order embeddings\<close>
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   574
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   575
definition order_emb :: "('a, 'c) gorder_scheme \<Rightarrow> ('b, 'd) gorder_scheme \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> bool"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   576
  where
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   577
  "order_emb A B f \<equiv> weak_partial_order A 
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   578
                   \<and> weak_partial_order B 
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   579
                   \<and> (\<forall>x\<in>carrier A. \<forall>y\<in>carrier A. f x \<sqsubseteq>\<^bsub>B\<^esub> f y \<longleftrightarrow> x \<sqsubseteq>\<^bsub>A\<^esub> y )"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   580
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   581
lemma order_emb_isotone: "order_emb A B f \<Longrightarrow> isotone A B f"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   582
  by (auto simp add: isotone_def order_emb_def)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   583
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   584
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   585
subsubsection \<open>Commuting functions\<close>
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   586
    
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   587
definition commuting :: "('a, 'c) gorder_scheme \<Rightarrow> ('a \<Rightarrow> 'a) \<Rightarrow> ('a \<Rightarrow> 'a) \<Rightarrow> bool" where
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   588
"commuting A f g = (\<forall>x\<in>carrier A. (f \<circ> g) x .=\<^bsub>A\<^esub> (g \<circ> f) x)"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   589
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   590
subsection \<open>Partial orders where \<open>eq\<close> is the Equality\<close>
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   591
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   592
locale partial_order = weak_partial_order +
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 67091
diff changeset
   593
  assumes eq_is_equal: "(.=) = (=)"
65099
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   594
begin
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   595
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   596
declare weak_le_antisym [rule del]
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   597
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   598
lemma le_antisym [intro]:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   599
  "[| x \<sqsubseteq> y; y \<sqsubseteq> x; x \<in> carrier L; y \<in> carrier L |] ==> x = y"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   600
  using weak_le_antisym unfolding eq_is_equal .
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   601
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   602
lemma lless_eq:
67091
1393c2340eec more symbols;
wenzelm
parents: 66453
diff changeset
   603
  "x \<sqsubset> y \<longleftrightarrow> x \<sqsubseteq> y \<and> x \<noteq> y"
65099
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   604
  unfolding lless_def by (simp add: eq_is_equal)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   605
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   606
lemma set_eq_is_eq: "A {.=} B \<longleftrightarrow> A = B"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   607
  by (auto simp add: set_eq_def elem_def eq_is_equal)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   608
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   609
end
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   610
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   611
lemma (in partial_order) dual_order:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   612
  "partial_order (inv_gorder L)"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   613
proof -
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   614
  interpret dwo: weak_partial_order "inv_gorder L"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   615
    by (metis dual_weak_order)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   616
  show ?thesis
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   617
    by (unfold_locales, simp add:eq_is_equal)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   618
qed
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   619
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   620
lemma dual_order_iff:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   621
  "partial_order (inv_gorder A) \<longleftrightarrow> partial_order A"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   622
proof
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   623
  assume assm:"partial_order (inv_gorder A)"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   624
  then interpret po: partial_order "inv_gorder A"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   625
  rewrites "carrier (inv_gorder A) = carrier A"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   626
  and   "le (inv_gorder A)      = (\<lambda> x y. le A y x)"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   627
  and   "eq (inv_gorder A)      = eq A"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   628
    by (simp_all)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   629
  show "partial_order A"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   630
    apply (unfold_locales, simp_all)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   631
    apply (metis po.sym, metis po.trans)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   632
    apply (metis po.weak_le_antisym, metis po.le_trans)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   633
    apply (metis (full_types) po.eq_is_equal, metis po.eq_is_equal)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   634
  done
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   635
next
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   636
  assume "partial_order A"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   637
  thus "partial_order (inv_gorder A)"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   638
    by (metis partial_order.dual_order)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   639
qed
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   640
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   641
text \<open>Least and greatest, as predicate\<close>
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   642
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   643
lemma (in partial_order) least_unique:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   644
  "[| least L x A; least L y A |] ==> x = y"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   645
  using weak_least_unique unfolding eq_is_equal .
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   646
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   647
lemma (in partial_order) greatest_unique:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   648
  "[| greatest L x A; greatest L y A |] ==> x = y"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   649
  using weak_greatest_unique unfolding eq_is_equal .
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   650
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   651
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   652
subsection \<open>Bounded Orders\<close>
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   653
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   654
definition
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   655
  top :: "_ => 'a" ("\<top>\<index>") where
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   656
  "\<top>\<^bsub>L\<^esub> = (SOME x. greatest L x (carrier L))"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   657
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   658
definition
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   659
  bottom :: "_ => 'a" ("\<bottom>\<index>") where
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   660
  "\<bottom>\<^bsub>L\<^esub> = (SOME x. least L x (carrier L))"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   661
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   662
locale weak_partial_order_bottom = weak_partial_order L for L (structure) +
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   663
  assumes bottom_exists: "\<exists> x. least L x (carrier L)"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   664
begin
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   665
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   666
lemma bottom_least: "least L \<bottom> (carrier L)"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   667
proof -
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   668
  obtain x where "least L x (carrier L)"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   669
    by (metis bottom_exists)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   670
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   671
  thus ?thesis
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   672
    by (auto intro:someI2 simp add: bottom_def)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   673
qed
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   674
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   675
lemma bottom_closed [simp, intro]:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   676
  "\<bottom> \<in> carrier L"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   677
  by (metis bottom_least least_mem)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   678
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   679
lemma bottom_lower [simp, intro]:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   680
  "x \<in> carrier L \<Longrightarrow> \<bottom> \<sqsubseteq> x"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   681
  by (metis bottom_least least_le)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   682
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   683
end
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   684
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   685
locale weak_partial_order_top = weak_partial_order L for L (structure) +
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   686
  assumes top_exists: "\<exists> x. greatest L x (carrier L)"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   687
begin
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   688
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   689
lemma top_greatest: "greatest L \<top> (carrier L)"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   690
proof -
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   691
  obtain x where "greatest L x (carrier L)"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   692
    by (metis top_exists)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   693
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   694
  thus ?thesis
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   695
    by (auto intro:someI2 simp add: top_def)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   696
qed
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   697
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   698
lemma top_closed [simp, intro]:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   699
  "\<top> \<in> carrier L"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   700
  by (metis greatest_mem top_greatest)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   701
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   702
lemma top_higher [simp, intro]:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   703
  "x \<in> carrier L \<Longrightarrow> x \<sqsubseteq> \<top>"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   704
  by (metis greatest_le top_greatest)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   705
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   706
end
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   707
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   708
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   709
subsection \<open>Total Orders\<close>
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   710
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   711
locale weak_total_order = weak_partial_order +
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   712
  assumes total: "\<lbrakk> x \<in> carrier L; y \<in> carrier L \<rbrakk> \<Longrightarrow> x \<sqsubseteq> y \<or> y \<sqsubseteq> x"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   713
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   714
text \<open>Introduction rule: the usual definition of total order\<close>
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   715
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   716
lemma (in weak_partial_order) weak_total_orderI:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   717
  assumes total: "!!x y. \<lbrakk> x \<in> carrier L; y \<in> carrier L \<rbrakk> \<Longrightarrow> x \<sqsubseteq> y \<or> y \<sqsubseteq> x"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   718
  shows "weak_total_order L"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   719
  by unfold_locales (rule total)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   720
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   721
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   722
subsection \<open>Total orders where \<open>eq\<close> is the Equality\<close>
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   723
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   724
locale total_order = partial_order +
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   725
  assumes total_order_total: "\<lbrakk> x \<in> carrier L; y \<in> carrier L \<rbrakk> \<Longrightarrow> x \<sqsubseteq> y \<or> y \<sqsubseteq> x"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   726
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   727
sublocale total_order < weak?: weak_total_order
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   728
  by unfold_locales (rule total_order_total)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   729
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   730
text \<open>Introduction rule: the usual definition of total order\<close>
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   731
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   732
lemma (in partial_order) total_orderI:
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   733
  assumes total: "!!x y. \<lbrakk> x \<in> carrier L; y \<in> carrier L \<rbrakk> \<Longrightarrow> x \<sqsubseteq> y \<or> y \<sqsubseteq> x"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   734
  shows "total_order L"
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   735
  by unfold_locales (rule total)
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   736
30d0b2f1df76 Knaster-Tarski fixed point theorem and Galois Connections.
ballarin
parents:
diff changeset
   737
end