src/HOL/Algebra/Lattice.thy
author ballarin
Thu, 31 Jul 2008 09:49:21 +0200
changeset 27714 27b4d7c01f8b
parent 27713 95b36bfe7fc4
child 27717 21bbd410ba04
permissions -rw-r--r--
Tuned (for the sake of a meaningless log entry).
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
     1
(*
27714
27b4d7c01f8b Tuned (for the sake of a meaningless log entry).
ballarin
parents: 27713
diff changeset
     2
  Title:     HOL/Algebra/Lattice.thy
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
     3
  Id:        $Id$
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
     4
  Author:    Clemens Ballarin, started 7 November 2003
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
     5
  Copyright: Clemens Ballarin
27714
27b4d7c01f8b Tuned (for the sake of a meaningless log entry).
ballarin
parents: 27713
diff changeset
     6
27b4d7c01f8b Tuned (for the sake of a meaningless log entry).
ballarin
parents: 27713
diff changeset
     7
Most congruence rules by Stefan Hohe.
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
     8
*)
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
     9
27700
ef4b26efa8b6 Renamed theorems;
ballarin
parents: 26805
diff changeset
    10
theory Lattice imports Congruence begin
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
    11
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents: 19984
diff changeset
    12
section {* Orders and Lattices *}
14751
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
    13
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
    14
subsection {* Partial Orders *}
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
    15
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    16
record 'a gorder = "'a eq_object" +
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
    17
  le :: "['a, 'a] => bool" (infixl "\<sqsubseteq>\<index>" 50)
21041
60e418260b4d Order and lattice structures no longer based on records.
ballarin
parents: 20318
diff changeset
    18
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    19
locale weak_partial_order = equivalence L +
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    20
  assumes le_refl [intro, simp]:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    21
      "x \<in> carrier L ==> x \<sqsubseteq> x"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    22
    and weak_le_anti_sym [intro]:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    23
      "[| x \<sqsubseteq> y; y \<sqsubseteq> x; x \<in> carrier L; y \<in> carrier L |] ==> x .= y"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    24
    and le_trans [trans]:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    25
      "[| x \<sqsubseteq> y; y \<sqsubseteq> z; x \<in> carrier L; y \<in> carrier L; z \<in> carrier L |] ==> x \<sqsubseteq> z"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    26
    and le_cong:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    27
      "\<lbrakk> x .= y; z .= w; x \<in> carrier L; y \<in> carrier L; z \<in> carrier L; w \<in> carrier L \<rbrakk> \<Longrightarrow> x \<sqsubseteq> z \<longleftrightarrow> y \<sqsubseteq> w"
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
    28
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
    29
constdefs (structure L)
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
    30
  lless :: "[_, 'a, 'a] => bool" (infixl "\<sqsubset>\<index>" 50)
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    31
  "x \<sqsubset> y == x \<sqsubseteq> y & x .\<noteq> y"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    32
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    33
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    34
subsubsection {* The order relation *}
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    35
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    36
context weak_partial_order begin
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    37
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    38
lemma le_cong_l [intro, trans]:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    39
  "\<lbrakk> x .= y; y \<sqsubseteq> z; x \<in> carrier L; y \<in> carrier L; z \<in> carrier L \<rbrakk> \<Longrightarrow> x \<sqsubseteq> z"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    40
  by (auto intro: le_cong [THEN iffD2])
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    41
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    42
lemma le_cong_r [intro, trans]:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    43
  "\<lbrakk> x \<sqsubseteq> y; y .= z; x \<in> carrier L; y \<in> carrier L; z \<in> carrier L \<rbrakk> \<Longrightarrow> x \<sqsubseteq> z"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    44
  by (auto intro: le_cong [THEN iffD1])
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    45
27714
27b4d7c01f8b Tuned (for the sake of a meaningless log entry).
ballarin
parents: 27713
diff changeset
    46
lemma weak_refl [intro, simp]: "\<lbrakk> x .= y; x \<in> carrier L; y \<in> carrier L \<rbrakk> \<Longrightarrow> x \<sqsubseteq> y"
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    47
  by (simp add: le_cong_l)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    48
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    49
end
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    50
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    51
lemma weak_llessI:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    52
  fixes R (structure)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    53
  assumes "x \<sqsubseteq> y" and "~(x .= y)"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    54
  shows "x \<sqsubset> y"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    55
  using assms unfolding lless_def by simp
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    56
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    57
lemma lless_imp_le:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    58
  fixes R (structure)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    59
  assumes "x \<sqsubset> y"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    60
  shows "x \<sqsubseteq> y"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    61
  using assms unfolding lless_def by simp
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    62
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    63
lemma weak_lless_imp_not_eq:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    64
  fixes R (structure)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    65
  assumes "x \<sqsubset> y"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    66
  shows "\<not> (x .= y)"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    67
  using assms unfolding lless_def by simp
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
    68
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    69
lemma weak_llessE:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    70
  fixes R (structure)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    71
  assumes p: "x \<sqsubset> y" and e: "\<lbrakk>x \<sqsubseteq> y; \<not> (x .= y)\<rbrakk> \<Longrightarrow> P"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    72
  shows "P"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    73
  using p by (blast dest: lless_imp_le weak_lless_imp_not_eq e)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    74
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    75
lemma (in weak_partial_order) lless_cong_l [trans]:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    76
  assumes xx': "x .= x'"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    77
    and xy: "x' \<sqsubset> y"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    78
    and carr: "x \<in> carrier L" "x' \<in> carrier L" "y \<in> carrier L"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    79
  shows "x \<sqsubset> y"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    80
  using assms unfolding lless_def by (auto intro: trans sym)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    81
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    82
lemma (in weak_partial_order) lless_cong_r [trans]:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    83
  assumes xy: "x \<sqsubset> y"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    84
    and  yy': "y .= y'"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    85
    and carr: "x \<in> carrier L" "y \<in> carrier L" "y' \<in> carrier L"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    86
  shows "x \<sqsubset> y'"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    87
  using assms unfolding lless_def by (auto intro: trans sym)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    88
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    89
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    90
lemma (in weak_partial_order) lless_antisym:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    91
  assumes "a \<in> carrier L" "b \<in> carrier L"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    92
    and "a \<sqsubset> b" "b \<sqsubset> a"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    93
  shows "P"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    94
  using assms
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    95
  by (elim weak_llessE) auto
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    96
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    97
lemma (in weak_partial_order) lless_trans [trans]:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    98
  assumes "a \<sqsubset> b" "b \<sqsubset> c"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
    99
    and carr[simp]: "a \<in> carrier L" "b \<in> carrier L" "c \<in> carrier L"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   100
  shows "a \<sqsubset> c"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   101
  using assms unfolding lless_def by (blast dest: le_trans intro: sym)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   102
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   103
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   104
subsubsection {* Upper and lower bounds of a set *}
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   105
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   106
constdefs (structure L)
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   107
  Upper :: "[_, 'a set] => 'a set"
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   108
  "Upper L A == {u. (ALL x. x \<in> A \<inter> carrier L --> x \<sqsubseteq> u)} \<inter> carrier L"
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   109
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   110
  Lower :: "[_, 'a set] => 'a set"
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   111
  "Lower L A == {l. (ALL x. x \<in> A \<inter> carrier L --> l \<sqsubseteq> x)} \<inter> carrier L"
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   112
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   113
lemma Upper_closed [intro!, simp]:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   114
  "Upper L A \<subseteq> carrier L"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   115
  by (unfold Upper_def) clarify
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   116
27700
ef4b26efa8b6 Renamed theorems;
ballarin
parents: 26805
diff changeset
   117
lemma Upper_memD [dest]:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   118
  fixes L (structure)
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   119
  shows "[| u \<in> Upper L A; x \<in> A; A \<subseteq> carrier L |] ==> x \<sqsubseteq> u \<and> u \<in> carrier L"
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   120
  by (unfold Upper_def) blast
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   121
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   122
lemma (in weak_partial_order) Upper_elemD [dest]:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   123
  "[| u .\<in> Upper L A; u \<in> carrier L; x \<in> A; A \<subseteq> carrier L |] ==> x \<sqsubseteq> u"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   124
  unfolding Upper_def elem_def
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   125
  by (blast dest: sym)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   126
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   127
lemma Upper_memI:
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   128
  fixes L (structure)
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   129
  shows "[| !! y. y \<in> A ==> y \<sqsubseteq> x; x \<in> carrier L |] ==> x \<in> Upper L A"
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   130
  by (unfold Upper_def) blast
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   131
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   132
lemma (in weak_partial_order) Upper_elemI:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   133
  "[| !! y. y \<in> A ==> y \<sqsubseteq> x; x \<in> carrier L |] ==> x .\<in> Upper L A"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   134
  unfolding Upper_def by blast
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   135
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   136
lemma Upper_antimono:
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   137
  "A \<subseteq> B ==> Upper L B \<subseteq> Upper L A"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   138
  by (unfold Upper_def) blast
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   139
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   140
lemma (in weak_partial_order) Upper_is_closed [simp]:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   141
  "A \<subseteq> carrier L ==> is_closed (Upper L A)"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   142
  by (rule is_closedI) (blast intro: Upper_memI)+
14651
02b8f3bcf7fe improved notation;
wenzelm
parents: 14577
diff changeset
   143
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   144
lemma (in weak_partial_order) Upper_mem_cong:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   145
  assumes a'carr: "a' \<in> carrier L" and Acarr: "A \<subseteq> carrier L"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   146
    and aa': "a .= a'"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   147
    and aelem: "a \<in> Upper L A"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   148
  shows "a' \<in> Upper L A"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   149
proof (rule Upper_memI[OF _ a'carr])
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   150
  fix y
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   151
  assume yA: "y \<in> A"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   152
  hence "y \<sqsubseteq> a" by (intro Upper_memD[OF aelem, THEN conjunct1] Acarr)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   153
  also note aa'
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   154
  finally
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   155
      show "y \<sqsubseteq> a'"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   156
      by (simp add: a'carr subsetD[OF Acarr yA] subsetD[OF Upper_closed aelem])
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   157
qed
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   158
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   159
lemma (in weak_partial_order) Upper_cong:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   160
  assumes Acarr: "A \<subseteq> carrier L" and A'carr: "A' \<subseteq> carrier L"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   161
    and AA': "A {.=} A'"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   162
  shows "Upper L A = Upper L A'"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   163
unfolding Upper_def
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   164
apply rule
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   165
 apply (rule, clarsimp) defer 1
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   166
 apply (rule, clarsimp) defer 1
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   167
proof -
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   168
  fix x a'
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   169
  assume carr: "x \<in> carrier L" "a' \<in> carrier L"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   170
    and a'A': "a' \<in> A'"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   171
  assume aLxCond[rule_format]: "\<forall>a. a \<in> A \<and> a \<in> carrier L \<longrightarrow> a \<sqsubseteq> x"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   172
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   173
  from AA' and a'A' have "\<exists>a\<in>A. a' .= a" by (rule set_eqD2)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   174
  from this obtain a
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   175
      where aA: "a \<in> A"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   176
      and a'a: "a' .= a"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   177
      by auto
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   178
  note [simp] = subsetD[OF Acarr aA] carr
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   179
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   180
  note a'a
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   181
  also have "a \<sqsubseteq> x" by (simp add: aLxCond aA)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   182
  finally show "a' \<sqsubseteq> x" by simp
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   183
next
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   184
  fix x a
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   185
  assume carr: "x \<in> carrier L" "a \<in> carrier L"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   186
    and aA: "a \<in> A"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   187
  assume a'LxCond[rule_format]: "\<forall>a'. a' \<in> A' \<and> a' \<in> carrier L \<longrightarrow> a' \<sqsubseteq> x"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   188
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   189
  from AA' and aA have "\<exists>a'\<in>A'. a .= a'" by (rule set_eqD1)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   190
  from this obtain a'
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   191
      where a'A': "a' \<in> A'"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   192
      and aa': "a .= a'"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   193
      by auto
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   194
  note [simp] = subsetD[OF A'carr a'A'] carr
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   195
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   196
  note aa'
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   197
  also have "a' \<sqsubseteq> x" by (simp add: a'LxCond a'A')
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   198
  finally show "a \<sqsubseteq> x" by simp
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   199
qed
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   200
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   201
lemma Lower_closed [intro!, simp]:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   202
  "Lower L A \<subseteq> carrier L"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   203
  by (unfold Lower_def) clarify
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   204
27700
ef4b26efa8b6 Renamed theorems;
ballarin
parents: 26805
diff changeset
   205
lemma Lower_memD [dest]:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   206
  fixes L (structure)
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   207
  shows "[| l \<in> Lower L A; x \<in> A; A \<subseteq> carrier L |] ==> l \<sqsubseteq> x \<and> l \<in> carrier L"
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   208
  by (unfold Lower_def) blast
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   209
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   210
lemma Lower_memI:
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   211
  fixes L (structure)
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   212
  shows "[| !! y. y \<in> A ==> x \<sqsubseteq> y; x \<in> carrier L |] ==> x \<in> Lower L A"
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   213
  by (unfold Lower_def) blast
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   214
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   215
lemma Lower_antimono:
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   216
  "A \<subseteq> B ==> Lower L B \<subseteq> Lower L A"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   217
  by (unfold Lower_def) blast
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   218
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   219
lemma (in weak_partial_order) Lower_is_closed [simp]:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   220
  "A \<subseteq> carrier L \<Longrightarrow> is_closed (Lower L A)"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   221
  by (rule is_closedI) (blast intro: Lower_memI dest: sym)+
14651
02b8f3bcf7fe improved notation;
wenzelm
parents: 14577
diff changeset
   222
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   223
lemma (in weak_partial_order) Lower_mem_cong:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   224
  assumes a'carr: "a' \<in> carrier L" and Acarr: "A \<subseteq> carrier L"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   225
    and aa': "a .= a'"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   226
    and aelem: "a \<in> Lower L A"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   227
  shows "a' \<in> Lower L A"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   228
using assms Lower_closed[of L A]
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   229
by (intro Lower_memI) (blast intro: le_cong_l[OF aa'[symmetric]])
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   230
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   231
lemma (in weak_partial_order) Lower_cong:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   232
  assumes Acarr: "A \<subseteq> carrier L" and A'carr: "A' \<subseteq> carrier L"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   233
    and AA': "A {.=} A'"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   234
  shows "Lower L A = Lower L A'"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   235
using Lower_memD[of y]
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   236
unfolding Lower_def
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   237
apply safe
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   238
 apply clarsimp defer 1
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   239
 apply clarsimp defer 1
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   240
proof -
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   241
  fix x a'
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   242
  assume carr: "x \<in> carrier L" "a' \<in> carrier L"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   243
    and a'A': "a' \<in> A'"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   244
  assume "\<forall>a. a \<in> A \<and> a \<in> carrier L \<longrightarrow> x \<sqsubseteq> a"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   245
  hence aLxCond: "\<And>a. \<lbrakk>a \<in> A; a \<in> carrier L\<rbrakk> \<Longrightarrow> x \<sqsubseteq> a" by fast
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   246
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   247
  from AA' and a'A' have "\<exists>a\<in>A. a' .= a" by (rule set_eqD2)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   248
  from this obtain a
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   249
      where aA: "a \<in> A"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   250
      and a'a: "a' .= a"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   251
      by auto
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   252
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   253
  from aA and subsetD[OF Acarr aA]
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   254
      have "x \<sqsubseteq> a" by (rule aLxCond)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   255
  also note a'a[symmetric]
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   256
  finally
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   257
      show "x \<sqsubseteq> a'" by (simp add: carr subsetD[OF Acarr aA])
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   258
next
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   259
  fix x a
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   260
  assume carr: "x \<in> carrier L" "a \<in> carrier L"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   261
    and aA: "a \<in> A"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   262
  assume "\<forall>a'. a' \<in> A' \<and> a' \<in> carrier L \<longrightarrow> x \<sqsubseteq> a'"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   263
  hence a'LxCond: "\<And>a'. \<lbrakk>a' \<in> A'; a' \<in> carrier L\<rbrakk> \<Longrightarrow> x \<sqsubseteq> a'" by fast+
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   264
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   265
  from AA' and aA have "\<exists>a'\<in>A'. a .= a'" by (rule set_eqD1)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   266
  from this obtain a'
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   267
      where a'A': "a' \<in> A'"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   268
      and aa': "a .= a'"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   269
      by auto
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   270
  from a'A' and subsetD[OF A'carr a'A']
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   271
      have "x \<sqsubseteq> a'" by (rule a'LxCond)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   272
  also note aa'[symmetric]
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   273
  finally show "x \<sqsubseteq> a" by (simp add: carr subsetD[OF A'carr a'A'])
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   274
qed
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   275
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   276
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   277
subsubsection {* Least and greatest, as predicate *}
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   278
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   279
constdefs (structure L)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   280
  least :: "[_, 'a, 'a set] => bool"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   281
  "least L l A == A \<subseteq> carrier L & l \<in> A & (ALL x : A. l \<sqsubseteq> x)"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   282
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   283
  greatest :: "[_, 'a, 'a set] => bool"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   284
  "greatest L g A == A \<subseteq> carrier L & g \<in> A & (ALL x : A. x \<sqsubseteq> g)"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   285
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   286
text {* Could weaken these to @{term [locale=weak_partial_order] "l \<in> carrier L \<and> l
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   287
  .\<in> A"} and @{term [locale=weak_partial_order] "g \<in> carrier L \<and> g .\<in> A"}. *}
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   288
27700
ef4b26efa8b6 Renamed theorems;
ballarin
parents: 26805
diff changeset
   289
lemma least_closed [intro, simp]:
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   290
  "least L l A ==> l \<in> carrier L"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   291
  by (unfold least_def) fast
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   292
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   293
lemma least_mem:
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   294
  "least L l A ==> l \<in> A"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   295
  by (unfold least_def) fast
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   296
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   297
lemma (in weak_partial_order) weak_least_unique:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   298
  "[| least L x A; least L y A |] ==> x .= y"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   299
  by (unfold least_def) blast
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   300
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   301
lemma least_le:
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   302
  fixes L (structure)
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   303
  shows "[| least L x A; a \<in> A |] ==> x \<sqsubseteq> a"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   304
  by (unfold least_def) fast
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   305
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   306
lemma (in weak_partial_order) least_cong:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   307
  "[| x .= x'; x \<in> carrier L; x' \<in> carrier L; is_closed A |] ==> least L x A = least L x' A"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   308
  by (unfold least_def) (auto dest: sym)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   309
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   310
text {* @{const least} is not congruent in the second parameter for 
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   311
  @{term [locale=weak_partial_order] "A {.=} A'"} *}
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   312
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   313
lemma (in weak_partial_order) least_Upper_cong_l:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   314
  assumes "x .= x'"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   315
    and "x \<in> carrier L" "x' \<in> carrier L"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   316
    and "A \<subseteq> carrier L"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   317
  shows "least L x (Upper L A) = least L x' (Upper L A)"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   318
  apply (rule least_cong) using assms by auto
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   319
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   320
lemma (in weak_partial_order) least_Upper_cong_r:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   321
  assumes Acarrs: "A \<subseteq> carrier L" "A' \<subseteq> carrier L" (* unneccessary with current Upper? *)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   322
    and AA': "A {.=} A'"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   323
  shows "least L x (Upper L A) = least L x (Upper L A')"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   324
apply (subgoal_tac "Upper L A = Upper L A'", simp)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   325
by (rule Upper_cong) fact+
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   326
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   327
lemma least_UpperI:
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   328
  fixes L (structure)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   329
  assumes above: "!! x. x \<in> A ==> x \<sqsubseteq> s"
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   330
    and below: "!! y. y \<in> Upper L A ==> s \<sqsubseteq> y"
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   331
    and L: "A \<subseteq> carrier L"  "s \<in> carrier L"
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   332
  shows "least L s (Upper L A)"
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   333
proof -
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   334
  have "Upper L A \<subseteq> carrier L" by simp
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   335
  moreover from above L have "s \<in> Upper L A" by (simp add: Upper_def)
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   336
  moreover from below have "ALL x : Upper L A. s \<sqsubseteq> x" by fast
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   337
  ultimately show ?thesis by (simp add: least_def)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   338
qed
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   339
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   340
lemma least_Upper_above:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   341
  fixes L (structure)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   342
  shows "[| least L s (Upper L A); x \<in> A; A \<subseteq> carrier L |] ==> x \<sqsubseteq> s"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   343
  by (unfold least_def) blast
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   344
27700
ef4b26efa8b6 Renamed theorems;
ballarin
parents: 26805
diff changeset
   345
lemma greatest_closed [intro, simp]:
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   346
  "greatest L l A ==> l \<in> carrier L"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   347
  by (unfold greatest_def) fast
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   348
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   349
lemma greatest_mem:
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   350
  "greatest L l A ==> l \<in> A"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   351
  by (unfold greatest_def) fast
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   352
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   353
lemma (in weak_partial_order) weak_greatest_unique:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   354
  "[| greatest L x A; greatest L y A |] ==> x .= y"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   355
  by (unfold greatest_def) blast
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   356
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   357
lemma greatest_le:
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   358
  fixes L (structure)
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   359
  shows "[| greatest L x A; a \<in> A |] ==> a \<sqsubseteq> x"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   360
  by (unfold greatest_def) fast
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   361
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   362
lemma (in weak_partial_order) greatest_cong:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   363
  "[| x .= x'; x \<in> carrier L; x' \<in> carrier L; is_closed A |] ==>
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   364
  greatest L x A = greatest L x' A"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   365
  by (unfold greatest_def) (auto dest: sym)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   366
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   367
text {* @{const greatest} is not congruent in the second parameter for 
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   368
  @{term [locale=weak_partial_order] "A {.=} A'"} *}
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   369
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   370
lemma (in weak_partial_order) greatest_Lower_cong_l:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   371
  assumes "x .= x'"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   372
    and "x \<in> carrier L" "x' \<in> carrier L"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   373
    and "A \<subseteq> carrier L" (* unneccessary with current Lower *)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   374
  shows "greatest L x (Lower L A) = greatest L x' (Lower L A)"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   375
  apply (rule greatest_cong) using assms by auto
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   376
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   377
lemma (in weak_partial_order) greatest_Lower_cong_r:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   378
  assumes Acarrs: "A \<subseteq> carrier L" "A' \<subseteq> carrier L"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   379
    and AA': "A {.=} A'"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   380
  shows "greatest L x (Lower L A) = greatest L x (Lower L A')"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   381
apply (subgoal_tac "Lower L A = Lower L A'", simp)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   382
by (rule Lower_cong) fact+
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   383
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   384
lemma greatest_LowerI:
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   385
  fixes L (structure)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   386
  assumes below: "!! x. x \<in> A ==> i \<sqsubseteq> x"
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   387
    and above: "!! y. y \<in> Lower L A ==> y \<sqsubseteq> i"
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   388
    and L: "A \<subseteq> carrier L"  "i \<in> carrier L"
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   389
  shows "greatest L i (Lower L A)"
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   390
proof -
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   391
  have "Lower L A \<subseteq> carrier L" by simp
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   392
  moreover from below L have "i \<in> Lower L A" by (simp add: Lower_def)
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   393
  moreover from above have "ALL x : Lower L A. x \<sqsubseteq> i" by fast
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   394
  ultimately show ?thesis by (simp add: greatest_def)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   395
qed
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   396
27700
ef4b26efa8b6 Renamed theorems;
ballarin
parents: 26805
diff changeset
   397
lemma greatest_Lower_below:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   398
  fixes L (structure)
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   399
  shows "[| greatest L i (Lower L A); x \<in> A; A \<subseteq> carrier L |] ==> i \<sqsubseteq> x"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   400
  by (unfold greatest_def) blast
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   401
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   402
text {* Supremum and infimum *}
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   403
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   404
constdefs (structure L)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   405
  sup :: "[_, 'a set] => 'a" ("\<Squnion>\<index>_" [90] 90)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   406
  "\<Squnion>A == SOME x. least L x (Upper L A)"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   407
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   408
  inf :: "[_, 'a set] => 'a" ("\<Sqinter>\<index>_" [90] 90)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   409
  "\<Sqinter>A == SOME x. greatest L x (Lower L A)"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   410
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   411
  join :: "[_, 'a, 'a] => 'a" (infixl "\<squnion>\<index>" 65)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   412
  "x \<squnion> y == \<Squnion> {x, y}"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   413
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   414
  meet :: "[_, 'a, 'a] => 'a" (infixl "\<sqinter>\<index>" 70)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   415
  "x \<sqinter> y == \<Sqinter> {x, y}"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   416
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   417
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   418
subsection {* Lattices *}
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   419
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   420
locale weak_upper_semilattice = weak_partial_order +
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   421
  assumes sup_of_two_exists:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   422
    "[| x \<in> carrier L; y \<in> carrier L |] ==> EX s. least L s (Upper L {x, y})"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   423
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   424
locale weak_lower_semilattice = weak_partial_order +
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   425
  assumes inf_of_two_exists:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   426
    "[| x \<in> carrier L; y \<in> carrier L |] ==> EX s. greatest L s (Lower L {x, y})"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   427
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   428
locale weak_lattice = weak_upper_semilattice + weak_lower_semilattice
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   429
14666
65f8680c3f16 improved notation;
wenzelm
parents: 14651
diff changeset
   430
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   431
subsubsection {* Supremum *}
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   432
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   433
lemma (in weak_upper_semilattice) joinI:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   434
  "[| !!l. least L l (Upper L {x, y}) ==> P l; x \<in> carrier L; y \<in> carrier L |]
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   435
  ==> P (x \<squnion> y)"
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   436
proof (unfold join_def sup_def)
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   437
  assume L: "x \<in> carrier L"  "y \<in> carrier L"
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   438
    and P: "!!l. least L l (Upper L {x, y}) ==> P l"
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   439
  with sup_of_two_exists obtain s where "least L s (Upper L {x, y})" by fast
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   440
  with L show "P (SOME l. least L l (Upper L {x, y}))"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   441
    by (fast intro: someI2 P)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   442
qed
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   443
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   444
lemma (in weak_upper_semilattice) join_closed [simp]:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   445
  "[| x \<in> carrier L; y \<in> carrier L |] ==> x \<squnion> y \<in> carrier L"
27700
ef4b26efa8b6 Renamed theorems;
ballarin
parents: 26805
diff changeset
   446
  by (rule joinI) (rule least_closed)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   447
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   448
lemma (in weak_upper_semilattice) join_cong_l:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   449
  assumes carr: "x \<in> carrier L" "x' \<in> carrier L" "y \<in> carrier L"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   450
    and xx': "x .= x'"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   451
  shows "x \<squnion> y .= x' \<squnion> y"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   452
proof (rule joinI, rule joinI)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   453
  fix a b
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   454
  from xx' carr
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   455
      have seq: "{x, y} {.=} {x', y}" by (rule set_eq_pairI)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   456
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   457
  assume leasta: "least L a (Upper L {x, y})"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   458
  assume "least L b (Upper L {x', y})"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   459
  with carr
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   460
      have leastb: "least L b (Upper L {x, y})"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   461
      by (simp add: least_Upper_cong_r[OF _ _ seq])
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   462
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   463
  from leasta leastb
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   464
      show "a .= b" by (rule weak_least_unique)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   465
qed (rule carr)+
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   466
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   467
lemma (in weak_upper_semilattice) join_cong_r:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   468
  assumes carr: "x \<in> carrier L" "y \<in> carrier L" "y' \<in> carrier L"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   469
    and yy': "y .= y'"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   470
  shows "x \<squnion> y .= x \<squnion> y'"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   471
proof (rule joinI, rule joinI)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   472
  fix a b
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   473
  have "{x, y} = {y, x}" by fast
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   474
  also from carr yy'
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   475
      have "{y, x} {.=} {y', x}" by (intro set_eq_pairI)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   476
  also have "{y', x} = {x, y'}" by fast
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   477
  finally
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   478
      have seq: "{x, y} {.=} {x, y'}" .
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   479
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   480
  assume leasta: "least L a (Upper L {x, y})"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   481
  assume "least L b (Upper L {x, y'})"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   482
  with carr
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   483
      have leastb: "least L b (Upper L {x, y})"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   484
      by (simp add: least_Upper_cong_r[OF _ _ seq])
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   485
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   486
  from leasta leastb
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   487
      show "a .= b" by (rule weak_least_unique)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   488
qed (rule carr)+
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   489
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   490
lemma (in weak_partial_order) sup_of_singletonI:      (* only reflexivity needed ? *)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   491
  "x \<in> carrier L ==> least L x (Upper L {x})"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   492
  by (rule least_UpperI) auto
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   493
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   494
lemma (in weak_partial_order) weak_sup_of_singleton [simp]:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   495
  "x \<in> carrier L ==> \<Squnion>{x} .= x"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   496
  unfolding sup_def
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   497
  by (rule someI2) (auto intro: weak_least_unique sup_of_singletonI)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   498
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   499
lemma (in weak_partial_order) sup_of_singleton_closed [simp]:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   500
  "x \<in> carrier L \<Longrightarrow> \<Squnion>{x} \<in> carrier L"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   501
  unfolding sup_def
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   502
  by (rule someI2) (auto intro: sup_of_singletonI)
14666
65f8680c3f16 improved notation;
wenzelm
parents: 14651
diff changeset
   503
65f8680c3f16 improved notation;
wenzelm
parents: 14651
diff changeset
   504
text {* Condition on @{text A}: supremum exists. *}
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   505
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   506
lemma (in weak_upper_semilattice) sup_insertI:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   507
  "[| !!s. least L s (Upper L (insert x A)) ==> P s;
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   508
  least L a (Upper L A); x \<in> carrier L; A \<subseteq> carrier L |]
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   509
  ==> P (\<Squnion>(insert x A))"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   510
proof (unfold sup_def)
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   511
  assume L: "x \<in> carrier L"  "A \<subseteq> carrier L"
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   512
    and P: "!!l. least L l (Upper L (insert x A)) ==> P l"
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   513
    and least_a: "least L a (Upper L A)"
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   514
  from L least_a have La: "a \<in> carrier L" by simp
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   515
  from L sup_of_two_exists least_a
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   516
  obtain s where least_s: "least L s (Upper L {a, x})" by blast
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   517
  show "P (SOME l. least L l (Upper L (insert x A)))"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   518
  proof (rule someI2)
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   519
    show "least L s (Upper L (insert x A))"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   520
    proof (rule least_UpperI)
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   521
      fix z
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   522
      assume "z \<in> insert x A"
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   523
      then show "z \<sqsubseteq> s"
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   524
      proof
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   525
        assume "z = x" then show ?thesis
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   526
          by (simp add: least_Upper_above [OF least_s] L La)
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   527
      next
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   528
        assume "z \<in> A"
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   529
        with L least_s least_a show ?thesis
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   530
          by (rule_tac le_trans [where y = a]) (auto dest: least_Upper_above)
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   531
      qed
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   532
    next
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   533
      fix y
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   534
      assume y: "y \<in> Upper L (insert x A)"
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   535
      show "s \<sqsubseteq> y"
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   536
      proof (rule least_le [OF least_s], rule Upper_memI)
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   537
	fix z
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   538
	assume z: "z \<in> {a, x}"
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   539
	then show "z \<sqsubseteq> y"
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   540
	proof
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   541
          have y': "y \<in> Upper L A"
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   542
            apply (rule subsetD [where A = "Upper L (insert x A)"])
23463
9953ff53cc64 tuned proofs -- avoid implicit prems;
wenzelm
parents: 23350
diff changeset
   543
             apply (rule Upper_antimono)
9953ff53cc64 tuned proofs -- avoid implicit prems;
wenzelm
parents: 23350
diff changeset
   544
	     apply blast
9953ff53cc64 tuned proofs -- avoid implicit prems;
wenzelm
parents: 23350
diff changeset
   545
	    apply (rule y)
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   546
            done
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   547
          assume "z = a"
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   548
          with y' least_a show ?thesis by (fast dest: least_le)
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   549
	next
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   550
	  assume "z \<in> {x}"  (* FIXME "z = x"; declare specific elim rule for "insert x {}" (!?) *)
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   551
          with y L show ?thesis by blast
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   552
	qed
23350
50c5b0912a0c tuned proofs: avoid implicit prems;
wenzelm
parents: 22265
diff changeset
   553
      qed (rule Upper_closed [THEN subsetD, OF y])
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   554
    next
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   555
      from L show "insert x A \<subseteq> carrier L" by simp
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   556
      from least_s show "s \<in> carrier L" by simp
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   557
    qed
23350
50c5b0912a0c tuned proofs: avoid implicit prems;
wenzelm
parents: 22265
diff changeset
   558
  qed (rule P)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   559
qed
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   560
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   561
lemma (in weak_upper_semilattice) finite_sup_least:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   562
  "[| finite A; A \<subseteq> carrier L; A ~= {} |] ==> least L (\<Squnion>A) (Upper L A)"
22265
3c5c6bdf61de Adapted to changes in Finite_Set theory.
berghofe
parents: 22063
diff changeset
   563
proof (induct set: finite)
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   564
  case empty
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   565
  then show ?case by simp
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   566
next
15328
35951e6a7855 mod because of change in finite set induction
nipkow
parents: 14751
diff changeset
   567
  case (insert x A)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   568
  show ?case
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   569
  proof (cases "A = {}")
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   570
    case True
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   571
    with insert show ?thesis
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   572
      by simp (simp add: least_cong [OF weak_sup_of_singleton]
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   573
	sup_of_singleton_closed sup_of_singletonI)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   574
	(* The above step is hairy; least_cong can make simp loop.
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   575
	Would want special version of simp to apply least_cong. *)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   576
  next
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   577
    case False
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   578
    with insert have "least L (\<Squnion>A) (Upper L A)" by simp
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   579
    with _ show ?thesis
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   580
      by (rule sup_insertI) (simp_all add: insert [simplified])
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   581
  qed
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   582
qed
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   583
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   584
lemma (in weak_upper_semilattice) finite_sup_insertI:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   585
  assumes P: "!!l. least L l (Upper L (insert x A)) ==> P l"
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   586
    and xA: "finite A"  "x \<in> carrier L"  "A \<subseteq> carrier L"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   587
  shows "P (\<Squnion> (insert x A))"
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   588
proof (cases "A = {}")
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   589
  case True with P and xA show ?thesis
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   590
    by (simp add: finite_sup_least)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   591
next
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   592
  case False with P and xA show ?thesis
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   593
    by (simp add: sup_insertI finite_sup_least)
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   594
qed
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   595
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   596
lemma (in weak_upper_semilattice) finite_sup_closed [simp]:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   597
  "[| finite A; A \<subseteq> carrier L; A ~= {} |] ==> \<Squnion>A \<in> carrier L"
22265
3c5c6bdf61de Adapted to changes in Finite_Set theory.
berghofe
parents: 22063
diff changeset
   598
proof (induct set: finite)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   599
  case empty then show ?case by simp
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   600
next
15328
35951e6a7855 mod because of change in finite set induction
nipkow
parents: 14751
diff changeset
   601
  case insert then show ?case
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   602
    by - (rule finite_sup_insertI, simp_all)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   603
qed
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   604
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   605
lemma (in weak_upper_semilattice) join_left:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   606
  "[| x \<in> carrier L; y \<in> carrier L |] ==> x \<sqsubseteq> x \<squnion> y"
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   607
  by (rule joinI [folded join_def]) (blast dest: least_mem)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   608
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   609
lemma (in weak_upper_semilattice) join_right:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   610
  "[| x \<in> carrier L; y \<in> carrier L |] ==> y \<sqsubseteq> x \<squnion> y"
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   611
  by (rule joinI [folded join_def]) (blast dest: least_mem)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   612
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   613
lemma (in weak_upper_semilattice) sup_of_two_least:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   614
  "[| x \<in> carrier L; y \<in> carrier L |] ==> least L (\<Squnion>{x, y}) (Upper L {x, y})"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   615
proof (unfold sup_def)
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   616
  assume L: "x \<in> carrier L"  "y \<in> carrier L"
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   617
  with sup_of_two_exists obtain s where "least L s (Upper L {x, y})" by fast
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   618
  with L show "least L (SOME z. least L z (Upper L {x, y})) (Upper L {x, y})"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   619
  by (fast intro: someI2 weak_least_unique)  (* blast fails *)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   620
qed
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   621
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   622
lemma (in weak_upper_semilattice) join_le:
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   623
  assumes sub: "x \<sqsubseteq> z"  "y \<sqsubseteq> z"
23350
50c5b0912a0c tuned proofs: avoid implicit prems;
wenzelm
parents: 22265
diff changeset
   624
    and x: "x \<in> carrier L" and y: "y \<in> carrier L" and z: "z \<in> carrier L"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   625
  shows "x \<squnion> y \<sqsubseteq> z"
23350
50c5b0912a0c tuned proofs: avoid implicit prems;
wenzelm
parents: 22265
diff changeset
   626
proof (rule joinI [OF _ x y])
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   627
  fix s
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   628
  assume "least L s (Upper L {x, y})"
23350
50c5b0912a0c tuned proofs: avoid implicit prems;
wenzelm
parents: 22265
diff changeset
   629
  with sub z show "s \<sqsubseteq> z" by (fast elim: least_le intro: Upper_memI)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   630
qed
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   631
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   632
lemma (in weak_upper_semilattice) weak_join_assoc_lemma:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   633
  assumes L: "x \<in> carrier L"  "y \<in> carrier L"  "z \<in> carrier L"
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   634
  shows "x \<squnion> (y \<squnion> z) .= \<Squnion>{x, y, z}"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   635
proof (rule finite_sup_insertI)
14651
02b8f3bcf7fe improved notation;
wenzelm
parents: 14577
diff changeset
   636
  -- {* The textbook argument in Jacobson I, p 457 *}
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   637
  fix s
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   638
  assume sup: "least L s (Upper L {x, y, z})"
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   639
  show "x \<squnion> (y \<squnion> z) .= s"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   640
  proof (rule weak_le_anti_sym)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   641
    from sup L show "x \<squnion> (y \<squnion> z) \<sqsubseteq> s"
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   642
      by (fastsimp intro!: join_le elim: least_Upper_above)
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   643
  next
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   644
    from sup L show "s \<sqsubseteq> x \<squnion> (y \<squnion> z)"
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   645
    by (erule_tac least_le)
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   646
      (blast intro!: Upper_memI intro: le_trans join_left join_right join_closed)
27700
ef4b26efa8b6 Renamed theorems;
ballarin
parents: 26805
diff changeset
   647
  qed (simp_all add: L least_closed [OF sup])
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   648
qed (simp_all add: L)
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   649
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   650
text {* Commutativity holds for @{text "="}. *}
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   651
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   652
lemma join_comm:
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   653
  fixes L (structure)
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   654
  shows "x \<squnion> y = y \<squnion> x"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   655
  by (unfold join_def) (simp add: insert_commute)
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   656
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   657
lemma (in weak_upper_semilattice) weak_join_assoc:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   658
  assumes L: "x \<in> carrier L"  "y \<in> carrier L"  "z \<in> carrier L"
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   659
  shows "(x \<squnion> y) \<squnion> z .= x \<squnion> (y \<squnion> z)"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   660
proof -
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   661
  (* FIXME: could be simplified by improved simp: uniform use of .=,
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   662
     omit [symmetric] in last step. *)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   663
  have "(x \<squnion> y) \<squnion> z = z \<squnion> (x \<squnion> y)" by (simp only: join_comm)
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   664
  also from L have "... .= \<Squnion>{z, x, y}" by (simp add: weak_join_assoc_lemma)
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   665
  also from L have "... = \<Squnion>{x, y, z}" by (simp add: insert_commute)
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   666
  also from L have "... .= x \<squnion> (y \<squnion> z)" by (simp add: weak_join_assoc_lemma [symmetric])
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   667
  finally show ?thesis by (simp add: L)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   668
qed
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   669
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   670
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   671
subsubsection {* Infimum *}
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   672
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   673
lemma (in weak_lower_semilattice) meetI:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   674
  "[| !!i. greatest L i (Lower L {x, y}) ==> P i;
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   675
  x \<in> carrier L; y \<in> carrier L |]
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   676
  ==> P (x \<sqinter> y)"
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   677
proof (unfold meet_def inf_def)
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   678
  assume L: "x \<in> carrier L"  "y \<in> carrier L"
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   679
    and P: "!!g. greatest L g (Lower L {x, y}) ==> P g"
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   680
  with inf_of_two_exists obtain i where "greatest L i (Lower L {x, y})" by fast
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   681
  with L show "P (SOME g. greatest L g (Lower L {x, y}))"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   682
  by (fast intro: someI2 weak_greatest_unique P)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   683
qed
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   684
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   685
lemma (in weak_lower_semilattice) meet_closed [simp]:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   686
  "[| x \<in> carrier L; y \<in> carrier L |] ==> x \<sqinter> y \<in> carrier L"
27700
ef4b26efa8b6 Renamed theorems;
ballarin
parents: 26805
diff changeset
   687
  by (rule meetI) (rule greatest_closed)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   688
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   689
lemma (in weak_lower_semilattice) meet_cong_l:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   690
  assumes carr: "x \<in> carrier L" "x' \<in> carrier L" "y \<in> carrier L"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   691
    and xx': "x .= x'"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   692
  shows "x \<sqinter> y .= x' \<sqinter> y"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   693
proof (rule meetI, rule meetI)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   694
  fix a b
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   695
  from xx' carr
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   696
      have seq: "{x, y} {.=} {x', y}" by (rule set_eq_pairI)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   697
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   698
  assume greatesta: "greatest L a (Lower L {x, y})"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   699
  assume "greatest L b (Lower L {x', y})"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   700
  with carr
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   701
      have greatestb: "greatest L b (Lower L {x, y})"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   702
      by (simp add: greatest_Lower_cong_r[OF _ _ seq])
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   703
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   704
  from greatesta greatestb
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   705
      show "a .= b" by (rule weak_greatest_unique)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   706
qed (rule carr)+
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   707
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   708
lemma (in weak_lower_semilattice) meet_cong_r:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   709
  assumes carr: "x \<in> carrier L" "y \<in> carrier L" "y' \<in> carrier L"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   710
    and yy': "y .= y'"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   711
  shows "x \<sqinter> y .= x \<sqinter> y'"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   712
proof (rule meetI, rule meetI)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   713
  fix a b
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   714
  have "{x, y} = {y, x}" by fast
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   715
  also from carr yy'
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   716
      have "{y, x} {.=} {y', x}" by (intro set_eq_pairI)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   717
  also have "{y', x} = {x, y'}" by fast
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   718
  finally
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   719
      have seq: "{x, y} {.=} {x, y'}" .
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   720
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   721
  assume greatesta: "greatest L a (Lower L {x, y})"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   722
  assume "greatest L b (Lower L {x, y'})"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   723
  with carr
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   724
      have greatestb: "greatest L b (Lower L {x, y})"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   725
      by (simp add: greatest_Lower_cong_r[OF _ _ seq])
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   726
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   727
  from greatesta greatestb
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   728
      show "a .= b" by (rule weak_greatest_unique)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   729
qed (rule carr)+
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   730
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   731
lemma (in weak_partial_order) inf_of_singletonI:      (* only reflexivity needed ? *)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   732
  "x \<in> carrier L ==> greatest L x (Lower L {x})"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   733
  by (rule greatest_LowerI) auto
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   734
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   735
lemma (in weak_partial_order) weak_inf_of_singleton [simp]:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   736
  "x \<in> carrier L ==> \<Sqinter>{x} .= x"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   737
  unfolding inf_def
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   738
  by (rule someI2) (auto intro: weak_greatest_unique inf_of_singletonI)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   739
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   740
lemma (in weak_partial_order) inf_of_singleton_closed:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   741
  "x \<in> carrier L ==> \<Sqinter>{x} \<in> carrier L"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   742
  unfolding inf_def
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   743
  by (rule someI2) (auto intro: inf_of_singletonI)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   744
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   745
text {* Condition on @{text A}: infimum exists. *}
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   746
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   747
lemma (in weak_lower_semilattice) inf_insertI:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   748
  "[| !!i. greatest L i (Lower L (insert x A)) ==> P i;
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   749
  greatest L a (Lower L A); x \<in> carrier L; A \<subseteq> carrier L |]
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   750
  ==> P (\<Sqinter>(insert x A))"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   751
proof (unfold inf_def)
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   752
  assume L: "x \<in> carrier L"  "A \<subseteq> carrier L"
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   753
    and P: "!!g. greatest L g (Lower L (insert x A)) ==> P g"
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   754
    and greatest_a: "greatest L a (Lower L A)"
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   755
  from L greatest_a have La: "a \<in> carrier L" by simp
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   756
  from L inf_of_two_exists greatest_a
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   757
  obtain i where greatest_i: "greatest L i (Lower L {a, x})" by blast
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   758
  show "P (SOME g. greatest L g (Lower L (insert x A)))"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   759
  proof (rule someI2)
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   760
    show "greatest L i (Lower L (insert x A))"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   761
    proof (rule greatest_LowerI)
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   762
      fix z
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   763
      assume "z \<in> insert x A"
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   764
      then show "i \<sqsubseteq> z"
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   765
      proof
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   766
        assume "z = x" then show ?thesis
27700
ef4b26efa8b6 Renamed theorems;
ballarin
parents: 26805
diff changeset
   767
          by (simp add: greatest_Lower_below [OF greatest_i] L La)
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   768
      next
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   769
        assume "z \<in> A"
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   770
        with L greatest_i greatest_a show ?thesis
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   771
          by (rule_tac le_trans [where y = a]) (auto dest: greatest_Lower_below)
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   772
      qed
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   773
    next
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   774
      fix y
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   775
      assume y: "y \<in> Lower L (insert x A)"
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   776
      show "y \<sqsubseteq> i"
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   777
      proof (rule greatest_le [OF greatest_i], rule Lower_memI)
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   778
	fix z
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   779
	assume z: "z \<in> {a, x}"
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   780
	then show "y \<sqsubseteq> z"
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   781
	proof
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   782
          have y': "y \<in> Lower L A"
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   783
            apply (rule subsetD [where A = "Lower L (insert x A)"])
23463
9953ff53cc64 tuned proofs -- avoid implicit prems;
wenzelm
parents: 23350
diff changeset
   784
            apply (rule Lower_antimono)
9953ff53cc64 tuned proofs -- avoid implicit prems;
wenzelm
parents: 23350
diff changeset
   785
	     apply blast
9953ff53cc64 tuned proofs -- avoid implicit prems;
wenzelm
parents: 23350
diff changeset
   786
	    apply (rule y)
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   787
            done
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   788
          assume "z = a"
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   789
          with y' greatest_a show ?thesis by (fast dest: greatest_le)
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   790
	next
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   791
          assume "z \<in> {x}"
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   792
          with y L show ?thesis by blast
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   793
	qed
23350
50c5b0912a0c tuned proofs: avoid implicit prems;
wenzelm
parents: 22265
diff changeset
   794
      qed (rule Lower_closed [THEN subsetD, OF y])
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   795
    next
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   796
      from L show "insert x A \<subseteq> carrier L" by simp
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   797
      from greatest_i show "i \<in> carrier L" by simp
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   798
    qed
23350
50c5b0912a0c tuned proofs: avoid implicit prems;
wenzelm
parents: 22265
diff changeset
   799
  qed (rule P)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   800
qed
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   801
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   802
lemma (in weak_lower_semilattice) finite_inf_greatest:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   803
  "[| finite A; A \<subseteq> carrier L; A ~= {} |] ==> greatest L (\<Sqinter>A) (Lower L A)"
22265
3c5c6bdf61de Adapted to changes in Finite_Set theory.
berghofe
parents: 22063
diff changeset
   804
proof (induct set: finite)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   805
  case empty then show ?case by simp
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   806
next
15328
35951e6a7855 mod because of change in finite set induction
nipkow
parents: 14751
diff changeset
   807
  case (insert x A)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   808
  show ?case
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   809
  proof (cases "A = {}")
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   810
    case True
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   811
    with insert show ?thesis
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   812
      by simp (simp add: greatest_cong [OF weak_inf_of_singleton]
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   813
	inf_of_singleton_closed inf_of_singletonI)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   814
  next
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   815
    case False
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   816
    from insert show ?thesis
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   817
    proof (rule_tac inf_insertI)
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   818
      from False insert show "greatest L (\<Sqinter>A) (Lower L A)" by simp
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   819
    qed simp_all
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   820
  qed
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   821
qed
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   822
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   823
lemma (in weak_lower_semilattice) finite_inf_insertI:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   824
  assumes P: "!!i. greatest L i (Lower L (insert x A)) ==> P i"
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   825
    and xA: "finite A"  "x \<in> carrier L"  "A \<subseteq> carrier L"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   826
  shows "P (\<Sqinter> (insert x A))"
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   827
proof (cases "A = {}")
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   828
  case True with P and xA show ?thesis
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   829
    by (simp add: finite_inf_greatest)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   830
next
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   831
  case False with P and xA show ?thesis
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   832
    by (simp add: inf_insertI finite_inf_greatest)
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   833
qed
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   834
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   835
lemma (in weak_lower_semilattice) finite_inf_closed [simp]:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   836
  "[| finite A; A \<subseteq> carrier L; A ~= {} |] ==> \<Sqinter>A \<in> carrier L"
22265
3c5c6bdf61de Adapted to changes in Finite_Set theory.
berghofe
parents: 22063
diff changeset
   837
proof (induct set: finite)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   838
  case empty then show ?case by simp
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   839
next
15328
35951e6a7855 mod because of change in finite set induction
nipkow
parents: 14751
diff changeset
   840
  case insert then show ?case
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   841
    by (rule_tac finite_inf_insertI) (simp_all)
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   842
qed
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   843
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   844
lemma (in weak_lower_semilattice) meet_left:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   845
  "[| x \<in> carrier L; y \<in> carrier L |] ==> x \<sqinter> y \<sqsubseteq> x"
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   846
  by (rule meetI [folded meet_def]) (blast dest: greatest_mem)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   847
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   848
lemma (in weak_lower_semilattice) meet_right:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   849
  "[| x \<in> carrier L; y \<in> carrier L |] ==> x \<sqinter> y \<sqsubseteq> y"
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   850
  by (rule meetI [folded meet_def]) (blast dest: greatest_mem)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   851
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   852
lemma (in weak_lower_semilattice) inf_of_two_greatest:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   853
  "[| x \<in> carrier L; y \<in> carrier L |] ==>
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   854
  greatest L (\<Sqinter> {x, y}) (Lower L {x, y})"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   855
proof (unfold inf_def)
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   856
  assume L: "x \<in> carrier L"  "y \<in> carrier L"
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   857
  with inf_of_two_exists obtain s where "greatest L s (Lower L {x, y})" by fast
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   858
  with L
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   859
  show "greatest L (SOME z. greatest L z (Lower L {x, y})) (Lower L {x, y})"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   860
  by (fast intro: someI2 weak_greatest_unique)  (* blast fails *)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   861
qed
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   862
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   863
lemma (in weak_lower_semilattice) meet_le:
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   864
  assumes sub: "z \<sqsubseteq> x"  "z \<sqsubseteq> y"
23350
50c5b0912a0c tuned proofs: avoid implicit prems;
wenzelm
parents: 22265
diff changeset
   865
    and x: "x \<in> carrier L" and y: "y \<in> carrier L" and z: "z \<in> carrier L"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   866
  shows "z \<sqsubseteq> x \<sqinter> y"
23350
50c5b0912a0c tuned proofs: avoid implicit prems;
wenzelm
parents: 22265
diff changeset
   867
proof (rule meetI [OF _ x y])
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   868
  fix i
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   869
  assume "greatest L i (Lower L {x, y})"
23350
50c5b0912a0c tuned proofs: avoid implicit prems;
wenzelm
parents: 22265
diff changeset
   870
  with sub z show "z \<sqsubseteq> i" by (fast elim: greatest_le intro: Lower_memI)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   871
qed
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   872
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   873
lemma (in weak_lower_semilattice) weak_meet_assoc_lemma:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   874
  assumes L: "x \<in> carrier L"  "y \<in> carrier L"  "z \<in> carrier L"
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   875
  shows "x \<sqinter> (y \<sqinter> z) .= \<Sqinter>{x, y, z}"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   876
proof (rule finite_inf_insertI)
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   877
  txt {* The textbook argument in Jacobson I, p 457 *}
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   878
  fix i
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   879
  assume inf: "greatest L i (Lower L {x, y, z})"
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   880
  show "x \<sqinter> (y \<sqinter> z) .= i"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   881
  proof (rule weak_le_anti_sym)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   882
    from inf L show "i \<sqsubseteq> x \<sqinter> (y \<sqinter> z)"
27700
ef4b26efa8b6 Renamed theorems;
ballarin
parents: 26805
diff changeset
   883
      by (fastsimp intro!: meet_le elim: greatest_Lower_below)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   884
  next
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   885
    from inf L show "x \<sqinter> (y \<sqinter> z) \<sqsubseteq> i"
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   886
    by (erule_tac greatest_le)
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   887
      (blast intro!: Lower_memI intro: le_trans meet_left meet_right meet_closed)
27700
ef4b26efa8b6 Renamed theorems;
ballarin
parents: 26805
diff changeset
   888
  qed (simp_all add: L greatest_closed [OF inf])
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   889
qed (simp_all add: L)
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   890
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   891
lemma meet_comm:
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   892
  fixes L (structure)
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   893
  shows "x \<sqinter> y = y \<sqinter> x"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   894
  by (unfold meet_def) (simp add: insert_commute)
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   895
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   896
lemma (in weak_lower_semilattice) weak_meet_assoc:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   897
  assumes L: "x \<in> carrier L"  "y \<in> carrier L"  "z \<in> carrier L"
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   898
  shows "(x \<sqinter> y) \<sqinter> z .= x \<sqinter> (y \<sqinter> z)"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   899
proof -
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   900
  (* FIXME: improved simp, see weak_join_assoc above *)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   901
  have "(x \<sqinter> y) \<sqinter> z = z \<sqinter> (x \<sqinter> y)" by (simp only: meet_comm)
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   902
  also from L have "... .= \<Sqinter> {z, x, y}" by (simp add: weak_meet_assoc_lemma)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   903
  also from L have "... = \<Sqinter> {x, y, z}" by (simp add: insert_commute)
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   904
  also from L have "... .= x \<sqinter> (y \<sqinter> z)" by (simp add: weak_meet_assoc_lemma [symmetric])
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   905
  finally show ?thesis by (simp add: L)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   906
qed
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   907
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   908
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   909
subsection {* Total Orders *}
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   910
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   911
locale weak_total_order = weak_partial_order +
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   912
  assumes total: "[| x \<in> carrier L; y \<in> carrier L |] ==> x \<sqsubseteq> y | y \<sqsubseteq> x"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   913
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   914
text {* Introduction rule: the usual definition of total order *}
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   915
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   916
lemma (in weak_partial_order) weak_total_orderI:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   917
  assumes total: "!!x y. [| x \<in> carrier L; y \<in> carrier L |] ==> x \<sqsubseteq> y | y \<sqsubseteq> x"
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   918
  shows "weak_total_order L"
24087
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   919
  by unfold_locales (rule total)
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   920
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   921
text {* Total orders are lattices. *}
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   922
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   923
interpretation weak_total_order < weak_lattice
24087
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   924
proof unfold_locales
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   925
  fix x y
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   926
  assume L: "x \<in> carrier L"  "y \<in> carrier L"
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   927
  show "EX s. least L s (Upper L {x, y})"
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   928
  proof -
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   929
    note total L
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   930
    moreover
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   931
    {
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   932
      assume "x \<sqsubseteq> y"
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   933
      with L have "least L y (Upper L {x, y})"
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   934
        by (rule_tac least_UpperI) auto
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   935
    }
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   936
    moreover
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   937
    {
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   938
      assume "y \<sqsubseteq> x"
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   939
      with L have "least L x (Upper L {x, y})"
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   940
        by (rule_tac least_UpperI) auto
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   941
    }
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   942
    ultimately show ?thesis by blast
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   943
  qed
24087
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   944
next
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   945
  fix x y
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   946
  assume L: "x \<in> carrier L"  "y \<in> carrier L"
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   947
  show "EX i. greatest L i (Lower L {x, y})"
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   948
  proof -
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   949
    note total L
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   950
    moreover
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   951
    {
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   952
      assume "y \<sqsubseteq> x"
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   953
      with L have "greatest L y (Lower L {x, y})"
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   954
        by (rule_tac greatest_LowerI) auto
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   955
    }
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   956
    moreover
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   957
    {
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   958
      assume "x \<sqsubseteq> y"
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   959
      with L have "greatest L x (Lower L {x, y})"
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   960
        by (rule_tac greatest_LowerI) auto
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   961
    }
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   962
    ultimately show ?thesis by blast
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   963
  qed
eb025d149a34 Proper interpretation of total orders in lattices.
ballarin
parents: 23463
diff changeset
   964
qed
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   965
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
   966
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   967
subsection {* Complete lattices *}
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   968
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   969
locale weak_complete_lattice = weak_lattice +
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   970
  assumes sup_exists:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   971
    "[| A \<subseteq> carrier L |] ==> EX s. least L s (Upper L A)"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   972
    and inf_exists:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   973
    "[| A \<subseteq> carrier L |] ==> EX i. greatest L i (Lower L A)"
21041
60e418260b4d Order and lattice structures no longer based on records.
ballarin
parents: 20318
diff changeset
   974
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   975
text {* Introduction rule: the usual definition of complete lattice *}
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   976
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   977
lemma (in weak_partial_order) weak_complete_latticeI:
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   978
  assumes sup_exists:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   979
    "!!A. [| A \<subseteq> carrier L |] ==> EX s. least L s (Upper L A)"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   980
    and inf_exists:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   981
    "!!A. [| A \<subseteq> carrier L |] ==> EX i. greatest L i (Lower L A)"
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   982
  shows "weak_complete_lattice L"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   983
  by unfold_locales (auto intro: sup_exists inf_exists)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   984
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   985
constdefs (structure L)
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   986
  top :: "_ => 'a" ("\<top>\<index>")
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   987
  "\<top> == sup L (carrier L)"
21041
60e418260b4d Order and lattice structures no longer based on records.
ballarin
parents: 20318
diff changeset
   988
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   989
  bottom :: "_ => 'a" ("\<bottom>\<index>")
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   990
  "\<bottom> == inf L (carrier L)"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   991
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   992
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
   993
lemma (in weak_complete_lattice) supI:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   994
  "[| !!l. least L l (Upper L A) ==> P l; A \<subseteq> carrier L |]
14651
02b8f3bcf7fe improved notation;
wenzelm
parents: 14577
diff changeset
   995
  ==> P (\<Squnion>A)"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
   996
proof (unfold sup_def)
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   997
  assume L: "A \<subseteq> carrier L"
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   998
    and P: "!!l. least L l (Upper L A) ==> P l"
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
   999
  with sup_exists obtain s where "least L s (Upper L A)" by blast
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1000
  with L show "P (SOME l. least L l (Upper L A))"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1001
  by (fast intro: someI2 weak_least_unique P)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1002
qed
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1003
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1004
lemma (in weak_complete_lattice) sup_closed [simp]:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
  1005
  "A \<subseteq> carrier L ==> \<Squnion>A \<in> carrier L"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1006
  by (rule supI) simp_all
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1007
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1008
lemma (in weak_complete_lattice) top_closed [simp, intro]:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
  1009
  "\<top> \<in> carrier L"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1010
  by (unfold top_def) simp
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1011
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1012
lemma (in weak_complete_lattice) infI:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
  1013
  "[| !!i. greatest L i (Lower L A) ==> P i; A \<subseteq> carrier L |]
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
  1014
  ==> P (\<Sqinter>A)"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1015
proof (unfold inf_def)
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
  1016
  assume L: "A \<subseteq> carrier L"
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
  1017
    and P: "!!l. greatest L l (Lower L A) ==> P l"
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
  1018
  with inf_exists obtain s where "greatest L s (Lower L A)" by blast
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1019
  with L show "P (SOME l. greatest L l (Lower L A))"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1020
  by (fast intro: someI2 weak_greatest_unique P)
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1021
qed
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1022
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1023
lemma (in weak_complete_lattice) inf_closed [simp]:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
  1024
  "A \<subseteq> carrier L ==> \<Sqinter>A \<in> carrier L"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1025
  by (rule infI) simp_all
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1026
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1027
lemma (in weak_complete_lattice) bottom_closed [simp, intro]:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
  1028
  "\<bottom> \<in> carrier L"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1029
  by (unfold bottom_def) simp
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1030
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1031
text {* Jacobson: Theorem 8.1 *}
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1032
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
  1033
lemma Lower_empty [simp]:
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
  1034
  "Lower L {} = carrier L"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1035
  by (unfold Lower_def) simp
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1036
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
  1037
lemma Upper_empty [simp]:
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
  1038
  "Upper L {} = carrier L"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1039
  by (unfold Upper_def) simp
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1040
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1041
theorem (in weak_partial_order) weak_complete_lattice_criterion1:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1042
  assumes top_exists: "EX g. greatest L g (carrier L)"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1043
    and inf_exists:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1044
      "!!A. [| A \<subseteq> carrier L; A ~= {} |] ==> EX i. greatest L i (Lower L A)"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1045
  shows "weak_complete_lattice L"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1046
proof (rule weak_complete_latticeI)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1047
  from top_exists obtain top where top: "greatest L top (carrier L)" ..
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1048
  fix A
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1049
  assume L: "A \<subseteq> carrier L"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1050
  let ?B = "Upper L A"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1051
  from L top have "top \<in> ?B" by (fast intro!: Upper_memI intro: greatest_le)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1052
  then have B_non_empty: "?B ~= {}" by fast
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1053
  have B_L: "?B \<subseteq> carrier L" by simp
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1054
  from inf_exists [OF B_L B_non_empty]
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1055
  obtain b where b_inf_B: "greatest L b (Lower L ?B)" ..
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1056
  have "least L b (Upper L A)"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1057
apply (rule least_UpperI)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1058
   apply (rule greatest_le [where A = "Lower L ?B"])
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1059
    apply (rule b_inf_B)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1060
   apply (rule Lower_memI)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1061
    apply (erule Upper_memD [THEN conjunct1])
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1062
     apply assumption
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1063
    apply (rule L)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1064
   apply (fast intro: L [THEN subsetD])
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1065
  apply (erule greatest_Lower_below [OF b_inf_B])
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1066
  apply simp
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1067
 apply (rule L)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1068
apply (rule greatest_closed [OF b_inf_B])
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1069
done
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1070
  then show "EX s. least L s (Upper L A)" ..
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1071
next
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1072
  fix A
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1073
  assume L: "A \<subseteq> carrier L"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1074
  show "EX i. greatest L i (Lower L A)"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1075
  proof (cases "A = {}")
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1076
    case True then show ?thesis
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1077
      by (simp add: top_exists)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1078
  next
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1079
    case False with L show ?thesis
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1080
      by (rule inf_exists)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1081
  qed
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1082
qed
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1083
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1084
(* TODO: prove dual version *)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1085
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1086
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1087
subsection {* Orders and Lattices where @{text eq} is the Equality *}
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1088
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1089
locale partial_order = weak_partial_order +
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1090
  assumes eq_is_equal: "op .= = op ="
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1091
begin
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1092
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1093
declare weak_le_anti_sym [rule del]
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1094
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1095
lemma le_anti_sym [intro]:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1096
  "[| x \<sqsubseteq> y; y \<sqsubseteq> x; x \<in> carrier L; y \<in> carrier L |] ==> x = y"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1097
  using weak_le_anti_sym unfolding eq_is_equal .
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1098
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1099
lemma lless_eq:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1100
  "x \<sqsubset> y \<longleftrightarrow> x \<sqsubseteq> y & x \<noteq> y"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1101
  unfolding lless_def by (simp add: eq_is_equal)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1102
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1103
lemma lless_asym:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1104
  assumes "a \<in> carrier L" "b \<in> carrier L"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1105
    and "a \<sqsubset> b" "b \<sqsubset> a"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1106
  shows "P"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1107
  using assms unfolding lless_eq by auto
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1108
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1109
lemma lless_trans [trans]:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1110
  assumes "a \<sqsubset> b" "b \<sqsubset> c"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1111
    and carr[simp]: "a \<in> carrier L" "b \<in> carrier L" "c \<in> carrier L"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1112
  shows "a \<sqsubset> c"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1113
  using assms unfolding lless_eq by (blast dest: le_trans intro: sym)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1114
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1115
end
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1116
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1117
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1118
subsubsection {* Upper and lower bounds of a set *}
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1119
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1120
(* all relevant lemmas are global and already proved above *)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1121
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1122
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1123
subsubsection {* Least and greatest, as predicate *}
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1124
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1125
lemma (in partial_order) least_unique:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1126
  "[| least L x A; least L y A |] ==> x = y"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1127
  using weak_least_unique unfolding eq_is_equal .
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1128
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1129
lemma (in partial_order) greatest_unique:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1130
  "[| greatest L x A; greatest L y A |] ==> x = y"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1131
  using weak_greatest_unique unfolding eq_is_equal .
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1132
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1133
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1134
subsection {* Lattices *}
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1135
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1136
locale upper_semilattice = partial_order +
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1137
  assumes sup_of_two_exists:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1138
    "[| x \<in> carrier L; y \<in> carrier L |] ==> EX s. least L s (Upper L {x, y})"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1139
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1140
interpretation upper_semilattice < weak_upper_semilattice
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1141
  by unfold_locales (rule sup_of_two_exists)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1142
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1143
locale lower_semilattice = partial_order +
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1144
  assumes inf_of_two_exists:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1145
    "[| x \<in> carrier L; y \<in> carrier L |] ==> EX s. greatest L s (Lower L {x, y})"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1146
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1147
interpretation lower_semilattice < weak_lower_semilattice
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1148
  by unfold_locales (rule inf_of_two_exists)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1149
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1150
locale lattice = upper_semilattice + lower_semilattice
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1151
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1152
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1153
subsubsection {* Supremum *}
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1154
27714
27b4d7c01f8b Tuned (for the sake of a meaningless log entry).
ballarin
parents: 27713
diff changeset
  1155
declare (in partial_order) weak_sup_of_singleton [simp del]
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1156
27714
27b4d7c01f8b Tuned (for the sake of a meaningless log entry).
ballarin
parents: 27713
diff changeset
  1157
lemma (in partial_order) sup_of_singleton [simp]:
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1158
  "x \<in> carrier L ==> \<Squnion>{x} = x"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1159
  using weak_sup_of_singleton unfolding eq_is_equal .
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1160
27714
27b4d7c01f8b Tuned (for the sake of a meaningless log entry).
ballarin
parents: 27713
diff changeset
  1161
lemma (in upper_semilattice) join_assoc_lemma:
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1162
  assumes L: "x \<in> carrier L"  "y \<in> carrier L"  "z \<in> carrier L"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1163
  shows "x \<squnion> (y \<squnion> z) = \<Squnion>{x, y, z}"
27714
27b4d7c01f8b Tuned (for the sake of a meaningless log entry).
ballarin
parents: 27713
diff changeset
  1164
  using weak_join_assoc_lemma L unfolding eq_is_equal .
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1165
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1166
lemma (in upper_semilattice) join_assoc:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1167
  assumes L: "x \<in> carrier L"  "y \<in> carrier L"  "z \<in> carrier L"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1168
  shows "(x \<squnion> y) \<squnion> z = x \<squnion> (y \<squnion> z)"
27714
27b4d7c01f8b Tuned (for the sake of a meaningless log entry).
ballarin
parents: 27713
diff changeset
  1169
  using weak_join_assoc L unfolding eq_is_equal .
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1170
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1171
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1172
subsubsection {* Infimum *}
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1173
27714
27b4d7c01f8b Tuned (for the sake of a meaningless log entry).
ballarin
parents: 27713
diff changeset
  1174
declare (in partial_order) weak_inf_of_singleton [simp del]
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1175
27714
27b4d7c01f8b Tuned (for the sake of a meaningless log entry).
ballarin
parents: 27713
diff changeset
  1176
lemma (in partial_order) inf_of_singleton [simp]:
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1177
  "x \<in> carrier L ==> \<Sqinter>{x} = x"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1178
  using weak_inf_of_singleton unfolding eq_is_equal .
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1179
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1180
text {* Condition on @{text A}: infimum exists. *}
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1181
27714
27b4d7c01f8b Tuned (for the sake of a meaningless log entry).
ballarin
parents: 27713
diff changeset
  1182
lemma (in lower_semilattice) meet_assoc_lemma:
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1183
  assumes L: "x \<in> carrier L"  "y \<in> carrier L"  "z \<in> carrier L"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1184
  shows "x \<sqinter> (y \<sqinter> z) = \<Sqinter>{x, y, z}"
27714
27b4d7c01f8b Tuned (for the sake of a meaningless log entry).
ballarin
parents: 27713
diff changeset
  1185
  using weak_meet_assoc_lemma L unfolding eq_is_equal .
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1186
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1187
lemma (in lower_semilattice) meet_assoc:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1188
  assumes L: "x \<in> carrier L"  "y \<in> carrier L"  "z \<in> carrier L"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1189
  shows "(x \<sqinter> y) \<sqinter> z = x \<sqinter> (y \<sqinter> z)"
27714
27b4d7c01f8b Tuned (for the sake of a meaningless log entry).
ballarin
parents: 27713
diff changeset
  1190
  using weak_meet_assoc L unfolding eq_is_equal .
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1191
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1192
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1193
subsection {* Total Orders *}
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1194
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1195
locale total_order = partial_order +
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1196
  assumes total: "[| x \<in> carrier L; y \<in> carrier L |] ==> x \<sqsubseteq> y | y \<sqsubseteq> x"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1197
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1198
interpretation total_order < weak_total_order
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1199
  by unfold_locales (rule total)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1200
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1201
text {* Introduction rule: the usual definition of total order *}
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1202
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1203
lemma (in partial_order) total_orderI:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1204
  assumes total: "!!x y. [| x \<in> carrier L; y \<in> carrier L |] ==> x \<sqsubseteq> y | y \<sqsubseteq> x"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1205
  shows "total_order L"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1206
  by unfold_locales (rule total)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1207
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1208
text {* Total orders are lattices. *}
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1209
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1210
interpretation total_order < lattice
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1211
  by unfold_locales (auto intro: sup_of_two_exists inf_of_two_exists)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1212
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1213
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1214
subsection {* Complete lattices *}
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1215
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1216
locale complete_lattice = lattice +
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1217
  assumes sup_exists:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1218
    "[| A \<subseteq> carrier L |] ==> EX s. least L s (Upper L A)"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1219
    and inf_exists:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1220
    "[| A \<subseteq> carrier L |] ==> EX i. greatest L i (Lower L A)"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1221
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1222
interpretation complete_lattice < weak_complete_lattice
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1223
  by unfold_locales (auto intro: sup_exists inf_exists)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1224
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1225
text {* Introduction rule: the usual definition of complete lattice *}
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1226
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1227
lemma (in partial_order) complete_latticeI:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1228
  assumes sup_exists:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1229
    "!!A. [| A \<subseteq> carrier L |] ==> EX s. least L s (Upper L A)"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1230
    and inf_exists:
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1231
    "!!A. [| A \<subseteq> carrier L |] ==> EX i. greatest L i (Lower L A)"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1232
  shows "complete_lattice L"
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1233
  by unfold_locales (auto intro: sup_exists inf_exists)
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1234
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1235
theorem (in partial_order) complete_lattice_criterion1:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
  1236
  assumes top_exists: "EX g. greatest L g (carrier L)"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1237
    and inf_exists:
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
  1238
      "!!A. [| A \<subseteq> carrier L; A ~= {} |] ==> EX i. greatest L i (Lower L A)"
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
  1239
  shows "complete_lattice L"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1240
proof (rule complete_latticeI)
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
  1241
  from top_exists obtain top where top: "greatest L top (carrier L)" ..
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1242
  fix A
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
  1243
  assume L: "A \<subseteq> carrier L"
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
  1244
  let ?B = "Upper L A"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1245
  from L top have "top \<in> ?B" by (fast intro!: Upper_memI intro: greatest_le)
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1246
  then have B_non_empty: "?B ~= {}" by fast
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
  1247
  have B_L: "?B \<subseteq> carrier L" by simp
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1248
  from inf_exists [OF B_L B_non_empty]
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
  1249
  obtain b where b_inf_B: "greatest L b (Lower L ?B)" ..
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
  1250
  have "least L b (Upper L A)"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1251
apply (rule least_UpperI)
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
  1252
   apply (rule greatest_le [where A = "Lower L ?B"])
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1253
    apply (rule b_inf_B)
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1254
   apply (rule Lower_memI)
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1255
    apply (erule Upper_memD [THEN conjunct1])
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1256
     apply assumption
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1257
    apply (rule L)
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1258
   apply (fast intro: L [THEN subsetD])
27700
ef4b26efa8b6 Renamed theorems;
ballarin
parents: 26805
diff changeset
  1259
  apply (erule greatest_Lower_below [OF b_inf_B])
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1260
  apply simp
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1261
 apply (rule L)
27700
ef4b26efa8b6 Renamed theorems;
ballarin
parents: 26805
diff changeset
  1262
apply (rule greatest_closed [OF b_inf_B])
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1263
done
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
  1264
  then show "EX s. least L s (Upper L A)" ..
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1265
next
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1266
  fix A
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
  1267
  assume L: "A \<subseteq> carrier L"
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
  1268
  show "EX i. greatest L i (Lower L A)"
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1269
  proof (cases "A = {}")
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1270
    case True then show ?thesis
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1271
      by (simp add: top_exists)
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1272
  next
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1273
    case False with L show ?thesis
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1274
      by (rule inf_exists)
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1275
  qed
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1276
qed
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1277
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1278
(* TODO: prove dual version *)
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1279
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents: 19984
diff changeset
  1280
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1281
subsection {* Examples *}
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1282
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents: 19984
diff changeset
  1283
subsubsection {* Powerset of a Set is a Complete Lattice *}
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1284
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1285
theorem powerset_is_complete_lattice:
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1286
  "complete_lattice (| carrier = Pow A, eq = op =, le = op \<subseteq> |)"
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
  1287
  (is "complete_lattice ?L")
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1288
proof (rule partial_order.complete_latticeI)
22063
717425609192 Reverted to structure representation with records.
ballarin
parents: 21896
diff changeset
  1289
  show "partial_order ?L"
27713
95b36bfe7fc4 New locales for orders and lattices where the equivalence relation is not restricted to equality.
ballarin
parents: 27700
diff changeset
  1290
    by unfold_locales auto
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1291
next
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1292
  fix B
26805
27941d7d9a11 Replaced forward proofs of existential statements by backward proofs
berghofe
parents: 24087
diff changeset
  1293
  assume B: "B \<subseteq> carrier ?L"
27941d7d9a11 Replaced forward proofs of existential statements by backward proofs
berghofe
parents: 24087
diff changeset
  1294
  show "EX s. least ?L s (Upper ?L B)"
27941d7d9a11 Replaced forward proofs of existential statements by backward proofs
berghofe
parents: 24087
diff changeset
  1295
  proof
27941d7d9a11 Replaced forward proofs of existential statements by backward proofs
berghofe
parents: 24087
diff changeset
  1296
    from B show "least ?L (\<Union> B) (Upper ?L B)"
27941d7d9a11 Replaced forward proofs of existential statements by backward proofs
berghofe
parents: 24087
diff changeset
  1297
      by (fastsimp intro!: least_UpperI simp: Upper_def)
27941d7d9a11 Replaced forward proofs of existential statements by backward proofs
berghofe
parents: 24087
diff changeset
  1298
  qed
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1299
next
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1300
  fix B
26805
27941d7d9a11 Replaced forward proofs of existential statements by backward proofs
berghofe
parents: 24087
diff changeset
  1301
  assume B: "B \<subseteq> carrier ?L"
27941d7d9a11 Replaced forward proofs of existential statements by backward proofs
berghofe
parents: 24087
diff changeset
  1302
  show "EX i. greatest ?L i (Lower ?L B)"
27941d7d9a11 Replaced forward proofs of existential statements by backward proofs
berghofe
parents: 24087
diff changeset
  1303
  proof
27941d7d9a11 Replaced forward proofs of existential statements by backward proofs
berghofe
parents: 24087
diff changeset
  1304
    from B show "greatest ?L (\<Inter> B \<inter> A) (Lower ?L B)"
27941d7d9a11 Replaced forward proofs of existential statements by backward proofs
berghofe
parents: 24087
diff changeset
  1305
      txt {* @{term "\<Inter> B"} is not the infimum of @{term B}:
27941d7d9a11 Replaced forward proofs of existential statements by backward proofs
berghofe
parents: 24087
diff changeset
  1306
	@{term "\<Inter> {} = UNIV"} which is in general bigger than @{term "A"}! *}
27941d7d9a11 Replaced forward proofs of existential statements by backward proofs
berghofe
parents: 24087
diff changeset
  1307
      by (fastsimp intro!: greatest_LowerI simp: Lower_def)
27941d7d9a11 Replaced forward proofs of existential statements by backward proofs
berghofe
parents: 24087
diff changeset
  1308
  qed
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1309
qed
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1310
14751
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
  1311
text {* An other example, that of the lattice of subgroups of a group,
0d7850e27fed Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents: 14706
diff changeset
  1312
  can be found in Group theory (Section~\ref{sec:subgroup-lattice}). *}
14551
2cb6ff394bfb Various changes to HOL-Algebra;
ballarin
parents:
diff changeset
  1313
14693
4deda204e1d8 improved syntax;
wenzelm
parents: 14666
diff changeset
  1314
end