| author | wenzelm | 
| Fri, 05 Nov 2021 22:43:29 +0100 | |
| changeset 74709 | d73a7e3c618c | 
| parent 69700 | 7a92cbec7030 | 
| child 77362 | 1a6103f6ab0b | 
| permissions | -rw-r--r-- | 
| 35849 | 1  | 
(* Title: HOL/Algebra/Lattice.thy  | 
2  | 
Author: Clemens Ballarin, started 7 November 2003  | 
|
3  | 
Copyright: Clemens Ballarin  | 
|
| 
27714
 
27b4d7c01f8b
Tuned (for the sake of a meaningless log entry).
 
ballarin 
parents: 
27713 
diff
changeset
 | 
4  | 
|
| 
27717
 
21bbd410ba04
Generalised polynomial lemmas from cring to ring.
 
ballarin 
parents: 
27714 
diff
changeset
 | 
5  | 
Most congruence rules by Stephan Hohe.  | 
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
6  | 
With additional contributions from Alasdair Armstrong and Simon Foster.  | 
| 14551 | 7  | 
*)  | 
8  | 
||
| 35849 | 9  | 
theory Lattice  | 
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
10  | 
imports Order  | 
| 44472 | 11  | 
begin  | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
12  | 
|
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
13  | 
section \<open>Lattices\<close>  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
14  | 
|
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
15  | 
subsection \<open>Supremum and infimum\<close>  | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
16  | 
|
| 35847 | 17  | 
definition  | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
18  | 
  sup :: "[_, 'a set] => 'a" ("\<Squnion>\<index>_" [90] 90)
 | 
| 
35848
 
5443079512ea
slightly more uniform definitions -- eliminated old-style meta-equality;
 
wenzelm 
parents: 
35847 
diff
changeset
 | 
19  | 
where "\<Squnion>\<^bsub>L\<^esub>A = (SOME x. least L x (Upper L A))"  | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
20  | 
|
| 35847 | 21  | 
definition  | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
22  | 
  inf :: "[_, 'a set] => 'a" ("\<Sqinter>\<index>_" [90] 90)
 | 
| 
35848
 
5443079512ea
slightly more uniform definitions -- eliminated old-style meta-equality;
 
wenzelm 
parents: 
35847 
diff
changeset
 | 
23  | 
where "\<Sqinter>\<^bsub>L\<^esub>A = (SOME x. greatest L x (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
 | 
24  | 
|
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
25  | 
definition supr ::  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
26  | 
  "('a, 'b) gorder_scheme \<Rightarrow> 'c set \<Rightarrow> ('c \<Rightarrow> 'a) \<Rightarrow> 'a "
 | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
27  | 
where "supr L A f = \<Squnion>\<^bsub>L\<^esub>(f ` A)"  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
28  | 
|
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
29  | 
definition infi ::  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
30  | 
  "('a, 'b) gorder_scheme \<Rightarrow> 'c set \<Rightarrow> ('c \<Rightarrow> 'a) \<Rightarrow> 'a "
 | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
31  | 
where "infi L A f = \<Sqinter>\<^bsub>L\<^esub>(f ` A)"  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
32  | 
|
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
33  | 
syntax  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
34  | 
  "_inf1"     :: "('a, 'b) gorder_scheme \<Rightarrow> pttrns \<Rightarrow> 'a \<Rightarrow> 'a" ("(3IINF\<index> _./ _)" [0, 10] 10)
 | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
35  | 
  "_inf"      :: "('a, 'b) gorder_scheme \<Rightarrow> pttrn \<Rightarrow> 'c set \<Rightarrow> 'a \<Rightarrow> 'a"  ("(3IINF\<index> _:_./ _)" [0, 0, 10] 10)
 | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
36  | 
  "_sup1"     :: "('a, 'b) gorder_scheme \<Rightarrow> pttrns \<Rightarrow> 'a \<Rightarrow> 'a" ("(3SSUP\<index> _./ _)" [0, 10] 10)
 | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
37  | 
  "_sup"      :: "('a, 'b) gorder_scheme \<Rightarrow> pttrn \<Rightarrow> 'c set \<Rightarrow> 'a \<Rightarrow> 'a"  ("(3SSUP\<index> _:_./ _)" [0, 0, 10] 10)
 | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
38  | 
|
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
39  | 
translations  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
40  | 
"IINF\<^bsub>L\<^esub> x. B" == "CONST infi L CONST UNIV (%x. B)"  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
41  | 
"IINF\<^bsub>L\<^esub> x:A. B" == "CONST infi L A (%x. B)"  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
42  | 
"SSUP\<^bsub>L\<^esub> x. B" == "CONST supr L CONST UNIV (%x. B)"  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
43  | 
"SSUP\<^bsub>L\<^esub> x:A. B" == "CONST supr L A (%x. B)"  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
44  | 
|
| 35847 | 45  | 
definition  | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
46  | 
join :: "[_, 'a, 'a] => 'a" (infixl "\<squnion>\<index>" 65)  | 
| 
35848
 
5443079512ea
slightly more uniform definitions -- eliminated old-style meta-equality;
 
wenzelm 
parents: 
35847 
diff
changeset
 | 
47  | 
  where "x \<squnion>\<^bsub>L\<^esub> y = \<Squnion>\<^bsub>L\<^esub>{x, y}"
 | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
48  | 
|
| 35847 | 49  | 
definition  | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
50  | 
meet :: "[_, 'a, 'a] => 'a" (infixl "\<sqinter>\<index>" 70)  | 
| 
35848
 
5443079512ea
slightly more uniform definitions -- eliminated old-style meta-equality;
 
wenzelm 
parents: 
35847 
diff
changeset
 | 
51  | 
  where "x \<sqinter>\<^bsub>L\<^esub> y = \<Sqinter>\<^bsub>L\<^esub>{x, y}"
 | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
52  | 
|
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
53  | 
definition  | 
| 
66580
 
e5b1d4d55bf6
Avoid \mu and \nu as constant syntax, use LFP and GFP instead.
 
ballarin 
parents: 
65099 
diff
changeset
 | 
54  | 
  LEAST_FP :: "('a, 'b) gorder_scheme \<Rightarrow> ('a \<Rightarrow> 'a) \<Rightarrow> 'a" ("LFP\<index>") where
 | 
| 
67443
 
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
 
wenzelm 
parents: 
67226 
diff
changeset
 | 
55  | 
  "LEAST_FP L f = \<Sqinter>\<^bsub>L\<^esub> {u \<in> carrier L. f u \<sqsubseteq>\<^bsub>L\<^esub> u}"    \<comment> \<open>least fixed point\<close>
 | 
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
56  | 
|
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
57  | 
definition  | 
| 
66580
 
e5b1d4d55bf6
Avoid \mu and \nu as constant syntax, use LFP and GFP instead.
 
ballarin 
parents: 
65099 
diff
changeset
 | 
58  | 
  GREATEST_FP:: "('a, 'b) gorder_scheme \<Rightarrow> ('a \<Rightarrow> 'a) \<Rightarrow> 'a" ("GFP\<index>") where
 | 
| 
67443
 
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
 
wenzelm 
parents: 
67226 
diff
changeset
 | 
59  | 
  "GREATEST_FP L f = \<Squnion>\<^bsub>L\<^esub> {u \<in> carrier L. u \<sqsubseteq>\<^bsub>L\<^esub> f u}"    \<comment> \<open>greatest fixed point\<close>
 | 
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
60  | 
|
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
61  | 
|
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
62  | 
subsection \<open>Dual operators\<close>  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
63  | 
|
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
64  | 
lemma sup_dual [simp]:  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
65  | 
"\<Squnion>\<^bsub>inv_gorder L\<^esub>A = \<Sqinter>\<^bsub>L\<^esub>A"  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
66  | 
by (simp add: sup_def inf_def)  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
67  | 
|
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
68  | 
lemma inf_dual [simp]:  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
69  | 
"\<Sqinter>\<^bsub>inv_gorder L\<^esub>A = \<Squnion>\<^bsub>L\<^esub>A"  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
70  | 
by (simp add: sup_def inf_def)  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
71  | 
|
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
72  | 
lemma join_dual [simp]:  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
73  | 
"p \<squnion>\<^bsub>inv_gorder L\<^esub> q = p \<sqinter>\<^bsub>L\<^esub> q"  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
74  | 
by (simp add:join_def meet_def)  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
75  | 
|
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
76  | 
lemma meet_dual [simp]:  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
77  | 
"p \<sqinter>\<^bsub>inv_gorder L\<^esub> q = p \<squnion>\<^bsub>L\<^esub> q"  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
78  | 
by (simp add:join_def meet_def)  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
79  | 
|
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
80  | 
lemma top_dual [simp]:  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
81  | 
"\<top>\<^bsub>inv_gorder L\<^esub> = \<bottom>\<^bsub>L\<^esub>"  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
82  | 
by (simp add: top_def bottom_def)  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
83  | 
|
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
84  | 
lemma bottom_dual [simp]:  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
85  | 
"\<bottom>\<^bsub>inv_gorder L\<^esub> = \<top>\<^bsub>L\<^esub>"  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
86  | 
by (simp add: top_def bottom_def)  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
87  | 
|
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
88  | 
lemma LFP_dual [simp]:  | 
| 
66580
 
e5b1d4d55bf6
Avoid \mu and \nu as constant syntax, use LFP and GFP instead.
 
ballarin 
parents: 
65099 
diff
changeset
 | 
89  | 
"LEAST_FP (inv_gorder L) f = GREATEST_FP L f"  | 
| 
 
e5b1d4d55bf6
Avoid \mu and \nu as constant syntax, use LFP and GFP instead.
 
ballarin 
parents: 
65099 
diff
changeset
 | 
90  | 
by (simp add:LEAST_FP_def GREATEST_FP_def)  | 
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
91  | 
|
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
92  | 
lemma GFP_dual [simp]:  | 
| 
66580
 
e5b1d4d55bf6
Avoid \mu and \nu as constant syntax, use LFP and GFP instead.
 
ballarin 
parents: 
65099 
diff
changeset
 | 
93  | 
"GREATEST_FP (inv_gorder L) f = LEAST_FP L f"  | 
| 
 
e5b1d4d55bf6
Avoid \mu and \nu as constant syntax, use LFP and GFP instead.
 
ballarin 
parents: 
65099 
diff
changeset
 | 
94  | 
by (simp add:LEAST_FP_def GREATEST_FP_def)  | 
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
95  | 
|
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
96  | 
|
| 61382 | 97  | 
subsection \<open>Lattices\<close>  | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
98  | 
|
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
99  | 
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
 | 
100  | 
assumes sup_of_two_exists:  | 
| 67091 | 101  | 
    "[| x \<in> carrier L; y \<in> carrier L |] ==> \<exists>s. least L s (Upper L {x, y})"
 | 
| 
27713
 
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  | 
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
 | 
104  | 
assumes inf_of_two_exists:  | 
| 67091 | 105  | 
    "[| x \<in> carrier L; y \<in> carrier L |] ==> \<exists>s. greatest L s (Lower L {x, y})"
 | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
106  | 
|
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
107  | 
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
 | 
108  | 
|
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
109  | 
lemma (in weak_lattice) dual_weak_lattice:  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
110  | 
"weak_lattice (inv_gorder L)"  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
111  | 
proof -  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
112  | 
interpret dual: weak_partial_order "inv_gorder L"  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
113  | 
by (metis dual_weak_order)  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
114  | 
|
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
115  | 
show ?thesis  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
116  | 
apply (unfold_locales)  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
117  | 
apply (simp_all add: inf_of_two_exists sup_of_two_exists)  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
118  | 
done  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
119  | 
qed  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
120  | 
|
| 14666 | 121  | 
|
| 61382 | 122  | 
subsubsection \<open>Supremum\<close>  | 
| 14551 | 123  | 
|
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
124  | 
lemma (in weak_upper_semilattice) joinI:  | 
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
125  | 
  "[| !!l. least L l (Upper L {x, y}) ==> P l; x \<in> carrier L; y \<in> carrier L |]
 | 
| 14551 | 126  | 
==> P (x \<squnion> y)"  | 
127  | 
proof (unfold join_def sup_def)  | 
|
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
128  | 
assume L: "x \<in> carrier L" "y \<in> carrier L"  | 
| 
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
129  | 
    and P: "!!l. least L l (Upper L {x, y}) ==> P l"
 | 
| 
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
130  | 
  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
 | 
131  | 
  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
 | 
132  | 
by (fast intro: someI2 P)  | 
| 14551 | 133  | 
qed  | 
134  | 
||
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
135  | 
lemma (in weak_upper_semilattice) join_closed [simp]:  | 
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
136  | 
"[| x \<in> carrier L; y \<in> carrier L |] ==> x \<squnion> y \<in> carrier L"  | 
| 27700 | 137  | 
by (rule joinI) (rule least_closed)  | 
| 14551 | 138  | 
|
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
139  | 
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
 | 
140  | 
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
 | 
141  | 
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
 | 
142  | 
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
 | 
143  | 
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
 | 
144  | 
fix a b  | 
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
145  | 
from xx' carr  | 
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
146  | 
      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
 | 
147  | 
|
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
148  | 
  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
 | 
149  | 
  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
 | 
150  | 
with carr  | 
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
151  | 
      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
 | 
152  | 
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
 | 
153  | 
|
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
154  | 
from leasta leastb  | 
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
155  | 
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
 | 
156  | 
qed (rule carr)+  | 
| 14551 | 157  | 
|
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
158  | 
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
 | 
159  | 
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
 | 
160  | 
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
 | 
161  | 
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
 | 
162  | 
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
 | 
163  | 
fix a b  | 
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
164  | 
  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
 | 
165  | 
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
 | 
166  | 
      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
 | 
167  | 
  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
 | 
168  | 
finally  | 
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
169  | 
      have seq: "{x, y} {.=} {x, y'}" .
 | 
| 14551 | 170  | 
|
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
171  | 
  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
 | 
172  | 
  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
 | 
173  | 
with carr  | 
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
174  | 
      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
 | 
175  | 
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
 | 
176  | 
|
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
177  | 
from leasta leastb  | 
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
178  | 
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
 | 
179  | 
qed (rule carr)+  | 
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
180  | 
|
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
181  | 
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
 | 
182  | 
  "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
 | 
183  | 
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
 | 
184  | 
|
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
185  | 
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
 | 
186  | 
  "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
 | 
187  | 
unfolding sup_def  | 
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
188  | 
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
 | 
189  | 
|
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
190  | 
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
 | 
191  | 
  "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
 | 
192  | 
unfolding sup_def  | 
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
193  | 
by (rule someI2) (auto intro: sup_of_singletonI)  | 
| 14666 | 194  | 
|
| 63167 | 195  | 
text \<open>Condition on \<open>A\<close>: supremum exists.\<close>  | 
| 14551 | 196  | 
|
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
197  | 
lemma (in weak_upper_semilattice) sup_insertI:  | 
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
198  | 
"[| !!s. least L s (Upper L (insert x A)) ==> P s;  | 
| 
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
199  | 
least L a (Upper L A); x \<in> carrier L; A \<subseteq> carrier L |]  | 
| 14693 | 200  | 
==> P (\<Squnion>(insert x A))"  | 
| 14551 | 201  | 
proof (unfold sup_def)  | 
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
202  | 
assume L: "x \<in> carrier L" "A \<subseteq> carrier L"  | 
| 
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
203  | 
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
 | 
204  | 
and least_a: "least L a (Upper L A)"  | 
| 
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
205  | 
from L least_a have La: "a \<in> carrier L" by simp  | 
| 14551 | 206  | 
from L sup_of_two_exists least_a  | 
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
207  | 
  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
 | 
208  | 
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
 | 
209  | 
proof (rule someI2)  | 
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
210  | 
show "least L s (Upper L (insert x A))"  | 
| 14551 | 211  | 
proof (rule least_UpperI)  | 
212  | 
fix z  | 
|
| 14693 | 213  | 
assume "z \<in> insert x A"  | 
214  | 
then show "z \<sqsubseteq> s"  | 
|
215  | 
proof  | 
|
216  | 
assume "z = x" then show ?thesis  | 
|
217  | 
by (simp add: least_Upper_above [OF least_s] L La)  | 
|
218  | 
next  | 
|
219  | 
assume "z \<in> A"  | 
|
220  | 
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
 | 
221  | 
by (rule_tac le_trans [where y = a]) (auto dest: least_Upper_above)  | 
| 14693 | 222  | 
qed  | 
223  | 
next  | 
|
224  | 
fix y  | 
|
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
225  | 
assume y: "y \<in> Upper L (insert x A)"  | 
| 14693 | 226  | 
show "s \<sqsubseteq> y"  | 
227  | 
proof (rule least_le [OF least_s], rule Upper_memI)  | 
|
| 
32960
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
30363 
diff
changeset
 | 
228  | 
fix z  | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
30363 
diff
changeset
 | 
229  | 
        assume z: "z \<in> {a, x}"
 | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
30363 
diff
changeset
 | 
230  | 
then show "z \<sqsubseteq> y"  | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
30363 
diff
changeset
 | 
231  | 
proof  | 
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
232  | 
have y': "y \<in> Upper L A"  | 
| 
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
233  | 
apply (rule subsetD [where A = "Upper L (insert x A)"])  | 
| 23463 | 234  | 
apply (rule Upper_antimono)  | 
| 
32960
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
30363 
diff
changeset
 | 
235  | 
apply blast  | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
30363 
diff
changeset
 | 
236  | 
apply (rule y)  | 
| 14693 | 237  | 
done  | 
238  | 
assume "z = a"  | 
|
239  | 
with y' least_a show ?thesis by (fast dest: least_le)  | 
|
| 
32960
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
30363 
diff
changeset
 | 
240  | 
next  | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
30363 
diff
changeset
 | 
241  | 
          assume "z \<in> {x}"  (* FIXME "z = x"; declare specific elim rule for "insert x {}" (!?) *)
 | 
| 14693 | 242  | 
with y L show ?thesis by blast  | 
| 
32960
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
30363 
diff
changeset
 | 
243  | 
qed  | 
| 23350 | 244  | 
qed (rule Upper_closed [THEN subsetD, OF y])  | 
| 14693 | 245  | 
next  | 
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
246  | 
from L show "insert x A \<subseteq> carrier L" by simp  | 
| 
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
247  | 
from least_s show "s \<in> carrier L" by simp  | 
| 14551 | 248  | 
qed  | 
| 23350 | 249  | 
qed (rule P)  | 
| 14551 | 250  | 
qed  | 
251  | 
||
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
252  | 
lemma (in weak_upper_semilattice) finite_sup_least:  | 
| 67091 | 253  | 
  "[| finite A; A \<subseteq> carrier L; A \<noteq> {} |] ==> least L (\<Squnion>A) (Upper L A)"
 | 
| 22265 | 254  | 
proof (induct set: finite)  | 
| 14693 | 255  | 
case empty  | 
256  | 
then show ?case by simp  | 
|
| 14551 | 257  | 
next  | 
| 15328 | 258  | 
case (insert x A)  | 
| 14551 | 259  | 
show ?case  | 
260  | 
  proof (cases "A = {}")
 | 
|
261  | 
case True  | 
|
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
262  | 
with insert show ?thesis  | 
| 44472 | 263  | 
by simp (simp add: least_cong [OF weak_sup_of_singleton] sup_of_singletonI)  | 
| 
32960
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
30363 
diff
changeset
 | 
264  | 
(* The above step is hairy; least_cong can make simp loop.  | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
30363 
diff
changeset
 | 
265  | 
Would want special version of simp to apply least_cong. *)  | 
| 14551 | 266  | 
next  | 
267  | 
case False  | 
|
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
268  | 
with insert have "least L (\<Squnion>A) (Upper L A)" by simp  | 
| 14693 | 269  | 
with _ show ?thesis  | 
270  | 
by (rule sup_insertI) (simp_all add: insert [simplified])  | 
|
| 14551 | 271  | 
qed  | 
272  | 
qed  | 
|
273  | 
||
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
274  | 
lemma (in weak_upper_semilattice) finite_sup_insertI:  | 
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
275  | 
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
 | 
276  | 
and xA: "finite A" "x \<in> carrier L" "A \<subseteq> carrier L"  | 
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
277  | 
shows "P (\<Squnion> (insert x A))"  | 
| 14551 | 278  | 
proof (cases "A = {}")
 | 
279  | 
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
 | 
280  | 
by (simp add: finite_sup_least)  | 
| 14551 | 281  | 
next  | 
282  | 
case False with P and xA show ?thesis  | 
|
283  | 
by (simp add: sup_insertI finite_sup_least)  | 
|
284  | 
qed  | 
|
285  | 
||
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
286  | 
lemma (in weak_upper_semilattice) finite_sup_closed [simp]:  | 
| 67091 | 287  | 
  "[| finite A; A \<subseteq> carrier L; A \<noteq> {} |] ==> \<Squnion>A \<in> carrier L"
 | 
| 22265 | 288  | 
proof (induct set: finite)  | 
| 14551 | 289  | 
case empty then show ?case by simp  | 
290  | 
next  | 
|
| 15328 | 291  | 
case insert then show ?case  | 
| 14693 | 292  | 
by - (rule finite_sup_insertI, simp_all)  | 
| 14551 | 293  | 
qed  | 
294  | 
||
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
295  | 
lemma (in weak_upper_semilattice) join_left:  | 
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
296  | 
"[| x \<in> carrier L; y \<in> carrier L |] ==> x \<sqsubseteq> x \<squnion> y"  | 
| 14693 | 297  | 
by (rule joinI [folded join_def]) (blast dest: least_mem)  | 
| 14551 | 298  | 
|
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
299  | 
lemma (in weak_upper_semilattice) join_right:  | 
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
300  | 
"[| x \<in> carrier L; y \<in> carrier L |] ==> y \<sqsubseteq> x \<squnion> y"  | 
| 14693 | 301  | 
by (rule joinI [folded join_def]) (blast dest: least_mem)  | 
| 14551 | 302  | 
|
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
303  | 
lemma (in weak_upper_semilattice) sup_of_two_least:  | 
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
304  | 
  "[| x \<in> carrier L; y \<in> carrier L |] ==> least L (\<Squnion>{x, y}) (Upper L {x, y})"
 | 
| 14551 | 305  | 
proof (unfold sup_def)  | 
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
306  | 
assume L: "x \<in> carrier L" "y \<in> carrier L"  | 
| 
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
307  | 
  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
 | 
308  | 
  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
 | 
309  | 
by (fast intro: someI2 weak_least_unique) (* blast fails *)  | 
| 14551 | 310  | 
qed  | 
311  | 
||
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
312  | 
lemma (in weak_upper_semilattice) join_le:  | 
| 14693 | 313  | 
assumes sub: "x \<sqsubseteq> z" "y \<sqsubseteq> z"  | 
| 23350 | 314  | 
and x: "x \<in> carrier L" and y: "y \<in> carrier L" and z: "z \<in> carrier L"  | 
| 14551 | 315  | 
shows "x \<squnion> y \<sqsubseteq> z"  | 
| 23350 | 316  | 
proof (rule joinI [OF _ x y])  | 
| 14551 | 317  | 
fix s  | 
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
318  | 
  assume "least L s (Upper L {x, y})"
 | 
| 23350 | 319  | 
with sub z show "s \<sqsubseteq> z" by (fast elim: least_le intro: Upper_memI)  | 
| 14551 | 320  | 
qed  | 
| 14693 | 321  | 
|
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
322  | 
lemma (in weak_lattice) weak_le_iff_meet:  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
323  | 
assumes "x \<in> carrier L" "y \<in> carrier L"  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
324  | 
shows "x \<sqsubseteq> y \<longleftrightarrow> (x \<squnion> y) .= y"  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
325  | 
by (meson assms(1) assms(2) join_closed join_le join_left join_right le_cong_r local.le_refl weak_le_antisym)  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
326  | 
|
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
327  | 
lemma (in weak_upper_semilattice) weak_join_assoc_lemma:  | 
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
328  | 
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
 | 
329  | 
  shows "x \<squnion> (y \<squnion> z) .= \<Squnion>{x, y, z}"
 | 
| 14551 | 330  | 
proof (rule finite_sup_insertI)  | 
| 63167 | 331  | 
\<comment> \<open>The textbook argument in Jacobson I, p 457\<close>  | 
| 14551 | 332  | 
fix s  | 
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
333  | 
  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
 | 
334  | 
show "x \<squnion> (y \<squnion> z) .= s"  | 
| 33657 | 335  | 
proof (rule weak_le_antisym)  | 
| 14551 | 336  | 
from sup L show "x \<squnion> (y \<squnion> z) \<sqsubseteq> s"  | 
| 
44890
 
22f665a2e91c
new fastforce replacing fastsimp - less confusing name
 
nipkow 
parents: 
44655 
diff
changeset
 | 
337  | 
by (fastforce intro!: join_le elim: least_Upper_above)  | 
| 14551 | 338  | 
next  | 
339  | 
from sup L show "s \<sqsubseteq> x \<squnion> (y \<squnion> z)"  | 
|
340  | 
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
 | 
341  | 
(blast intro!: Upper_memI intro: le_trans join_left join_right join_closed)  | 
| 27700 | 342  | 
qed (simp_all add: L least_closed [OF sup])  | 
| 14551 | 343  | 
qed (simp_all add: L)  | 
344  | 
||
| 63167 | 345  | 
text \<open>Commutativity holds for \<open>=\<close>.\<close>  | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
346  | 
|
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
347  | 
lemma join_comm:  | 
| 
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
348  | 
fixes L (structure)  | 
| 
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
349  | 
shows "x \<squnion> y = y \<squnion> x"  | 
| 14551 | 350  | 
by (unfold join_def) (simp add: insert_commute)  | 
351  | 
||
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
352  | 
lemma (in weak_upper_semilattice) weak_join_assoc:  | 
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
353  | 
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
 | 
354  | 
shows "(x \<squnion> y) \<squnion> z .= x \<squnion> (y \<squnion> z)"  | 
| 14551 | 355  | 
proof -  | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
356  | 
(* 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
 | 
357  | 
omit [symmetric] in last step. *)  | 
| 14551 | 358  | 
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
 | 
359  | 
  also from L have "... .= \<Squnion>{z, x, y}" by (simp add: weak_join_assoc_lemma)
 | 
| 14693 | 360  | 
  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
 | 
361  | 
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
 | 
362  | 
finally show ?thesis by (simp add: L)  | 
| 14551 | 363  | 
qed  | 
364  | 
||
| 14693 | 365  | 
|
| 61382 | 366  | 
subsubsection \<open>Infimum\<close>  | 
| 14551 | 367  | 
|
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
368  | 
lemma (in weak_lower_semilattice) meetI:  | 
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
369  | 
  "[| !!i. greatest L i (Lower L {x, y}) ==> P i;
 | 
| 
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
370  | 
x \<in> carrier L; y \<in> carrier L |]  | 
| 14551 | 371  | 
==> P (x \<sqinter> y)"  | 
372  | 
proof (unfold meet_def inf_def)  | 
|
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
373  | 
assume L: "x \<in> carrier L" "y \<in> carrier L"  | 
| 
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
374  | 
    and P: "!!g. greatest L g (Lower L {x, y}) ==> P g"
 | 
| 
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
375  | 
  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
 | 
376  | 
  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
 | 
377  | 
by (fast intro: someI2 weak_greatest_unique P)  | 
| 14551 | 378  | 
qed  | 
379  | 
||
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
380  | 
lemma (in weak_lower_semilattice) meet_closed [simp]:  | 
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
381  | 
"[| x \<in> carrier L; y \<in> carrier L |] ==> x \<sqinter> y \<in> carrier L"  | 
| 27700 | 382  | 
by (rule meetI) (rule greatest_closed)  | 
| 14551 | 383  | 
|
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
384  | 
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
 | 
385  | 
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
 | 
386  | 
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
 | 
387  | 
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
 | 
388  | 
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
 | 
389  | 
fix a b  | 
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
390  | 
from xx' carr  | 
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
391  | 
      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
 | 
392  | 
|
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
393  | 
  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
 | 
394  | 
  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
 | 
395  | 
with carr  | 
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
396  | 
      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
 | 
397  | 
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
 | 
398  | 
|
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
399  | 
from greatesta greatestb  | 
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
400  | 
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
 | 
401  | 
qed (rule carr)+  | 
| 14551 | 402  | 
|
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
403  | 
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
 | 
404  | 
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
 | 
405  | 
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
 | 
406  | 
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
 | 
407  | 
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
 | 
408  | 
fix a b  | 
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
409  | 
  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
 | 
410  | 
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
 | 
411  | 
      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
 | 
412  | 
  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
 | 
413  | 
finally  | 
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
414  | 
      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
 | 
415  | 
|
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
416  | 
  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
 | 
417  | 
  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
 | 
418  | 
with carr  | 
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
419  | 
      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
 | 
420  | 
by (simp add: greatest_Lower_cong_r[OF _ _ seq])  | 
| 14551 | 421  | 
|
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
422  | 
from greatesta greatestb  | 
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
423  | 
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
 | 
424  | 
qed (rule carr)+  | 
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
425  | 
|
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
426  | 
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
 | 
427  | 
  "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
 | 
428  | 
by (rule greatest_LowerI) auto  | 
| 14551 | 429  | 
|
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
430  | 
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
 | 
431  | 
  "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
 | 
432  | 
unfolding inf_def  | 
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
433  | 
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
 | 
434  | 
|
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
435  | 
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
 | 
436  | 
  "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
 | 
437  | 
unfolding inf_def  | 
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
438  | 
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
 | 
439  | 
|
| 63167 | 440  | 
text \<open>Condition on \<open>A\<close>: infimum exists.\<close>  | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
441  | 
|
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
442  | 
lemma (in weak_lower_semilattice) inf_insertI:  | 
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
443  | 
"[| !!i. greatest L i (Lower L (insert x A)) ==> P i;  | 
| 
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
444  | 
greatest L a (Lower L A); x \<in> carrier L; A \<subseteq> carrier L |]  | 
| 14693 | 445  | 
==> P (\<Sqinter>(insert x A))"  | 
| 14551 | 446  | 
proof (unfold inf_def)  | 
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
447  | 
assume L: "x \<in> carrier L" "A \<subseteq> carrier L"  | 
| 
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
448  | 
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
 | 
449  | 
and greatest_a: "greatest L a (Lower L A)"  | 
| 
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
450  | 
from L greatest_a have La: "a \<in> carrier L" by simp  | 
| 14551 | 451  | 
from L inf_of_two_exists greatest_a  | 
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
452  | 
  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
 | 
453  | 
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
 | 
454  | 
proof (rule someI2)  | 
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
455  | 
show "greatest L i (Lower L (insert x A))"  | 
| 14551 | 456  | 
proof (rule greatest_LowerI)  | 
457  | 
fix z  | 
|
| 14693 | 458  | 
assume "z \<in> insert x A"  | 
459  | 
then show "i \<sqsubseteq> z"  | 
|
460  | 
proof  | 
|
461  | 
assume "z = x" then show ?thesis  | 
|
| 27700 | 462  | 
by (simp add: greatest_Lower_below [OF greatest_i] L La)  | 
| 14693 | 463  | 
next  | 
464  | 
assume "z \<in> A"  | 
|
465  | 
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
 | 
466  | 
by (rule_tac le_trans [where y = a]) (auto dest: greatest_Lower_below)  | 
| 14693 | 467  | 
qed  | 
468  | 
next  | 
|
469  | 
fix y  | 
|
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
470  | 
assume y: "y \<in> Lower L (insert x A)"  | 
| 14693 | 471  | 
show "y \<sqsubseteq> i"  | 
472  | 
proof (rule greatest_le [OF greatest_i], rule Lower_memI)  | 
|
| 
32960
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
30363 
diff
changeset
 | 
473  | 
fix z  | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
30363 
diff
changeset
 | 
474  | 
        assume z: "z \<in> {a, x}"
 | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
30363 
diff
changeset
 | 
475  | 
then show "y \<sqsubseteq> z"  | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
30363 
diff
changeset
 | 
476  | 
proof  | 
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
477  | 
have y': "y \<in> Lower L A"  | 
| 
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
478  | 
apply (rule subsetD [where A = "Lower L (insert x A)"])  | 
| 23463 | 479  | 
apply (rule Lower_antimono)  | 
| 
32960
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
30363 
diff
changeset
 | 
480  | 
apply blast  | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
30363 
diff
changeset
 | 
481  | 
apply (rule y)  | 
| 14693 | 482  | 
done  | 
483  | 
assume "z = a"  | 
|
484  | 
with y' greatest_a show ?thesis by (fast dest: greatest_le)  | 
|
| 
32960
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
30363 
diff
changeset
 | 
485  | 
next  | 
| 14693 | 486  | 
          assume "z \<in> {x}"
 | 
487  | 
with y L show ?thesis by blast  | 
|
| 
32960
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
30363 
diff
changeset
 | 
488  | 
qed  | 
| 23350 | 489  | 
qed (rule Lower_closed [THEN subsetD, OF y])  | 
| 14693 | 490  | 
next  | 
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
491  | 
from L show "insert x A \<subseteq> carrier L" by simp  | 
| 
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
492  | 
from greatest_i show "i \<in> carrier L" by simp  | 
| 14551 | 493  | 
qed  | 
| 23350 | 494  | 
qed (rule P)  | 
| 14551 | 495  | 
qed  | 
496  | 
||
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
497  | 
lemma (in weak_lower_semilattice) finite_inf_greatest:  | 
| 67091 | 498  | 
  "[| finite A; A \<subseteq> carrier L; A \<noteq> {} |] ==> greatest L (\<Sqinter>A) (Lower L A)"
 | 
| 22265 | 499  | 
proof (induct set: finite)  | 
| 14551 | 500  | 
case empty then show ?case by simp  | 
501  | 
next  | 
|
| 15328 | 502  | 
case (insert x A)  | 
| 14551 | 503  | 
show ?case  | 
504  | 
  proof (cases "A = {}")
 | 
|
505  | 
case True  | 
|
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
506  | 
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
 | 
507  | 
by simp (simp add: greatest_cong [OF weak_inf_of_singleton]  | 
| 
32960
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
30363 
diff
changeset
 | 
508  | 
inf_of_singleton_closed inf_of_singletonI)  | 
| 14551 | 509  | 
next  | 
510  | 
case False  | 
|
511  | 
from insert show ?thesis  | 
|
512  | 
proof (rule_tac inf_insertI)  | 
|
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
513  | 
from False insert show "greatest L (\<Sqinter>A) (Lower L A)" by simp  | 
| 14551 | 514  | 
qed simp_all  | 
515  | 
qed  | 
|
516  | 
qed  | 
|
517  | 
||
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
518  | 
lemma (in weak_lower_semilattice) finite_inf_insertI:  | 
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
519  | 
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
 | 
520  | 
and xA: "finite A" "x \<in> carrier L" "A \<subseteq> carrier L"  | 
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
521  | 
shows "P (\<Sqinter> (insert x A))"  | 
| 14551 | 522  | 
proof (cases "A = {}")
 | 
523  | 
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
 | 
524  | 
by (simp add: finite_inf_greatest)  | 
| 14551 | 525  | 
next  | 
526  | 
case False with P and xA show ?thesis  | 
|
527  | 
by (simp add: inf_insertI finite_inf_greatest)  | 
|
528  | 
qed  | 
|
529  | 
||
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
530  | 
lemma (in weak_lower_semilattice) finite_inf_closed [simp]:  | 
| 67091 | 531  | 
  "[| finite A; A \<subseteq> carrier L; A \<noteq> {} |] ==> \<Sqinter>A \<in> carrier L"
 | 
| 22265 | 532  | 
proof (induct set: finite)  | 
| 14551 | 533  | 
case empty then show ?case by simp  | 
534  | 
next  | 
|
| 15328 | 535  | 
case insert then show ?case  | 
| 14551 | 536  | 
by (rule_tac finite_inf_insertI) (simp_all)  | 
537  | 
qed  | 
|
538  | 
||
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
539  | 
lemma (in weak_lower_semilattice) meet_left:  | 
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
540  | 
"[| x \<in> carrier L; y \<in> carrier L |] ==> x \<sqinter> y \<sqsubseteq> x"  | 
| 14693 | 541  | 
by (rule meetI [folded meet_def]) (blast dest: greatest_mem)  | 
| 14551 | 542  | 
|
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
543  | 
lemma (in weak_lower_semilattice) meet_right:  | 
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
544  | 
"[| x \<in> carrier L; y \<in> carrier L |] ==> x \<sqinter> y \<sqsubseteq> y"  | 
| 14693 | 545  | 
by (rule meetI [folded meet_def]) (blast dest: greatest_mem)  | 
| 14551 | 546  | 
|
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
547  | 
lemma (in weak_lower_semilattice) inf_of_two_greatest:  | 
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
548  | 
"[| x \<in> carrier L; y \<in> carrier L |] ==>  | 
| 60585 | 549  | 
  greatest L (\<Sqinter>{x, y}) (Lower L {x, y})"
 | 
| 14551 | 550  | 
proof (unfold inf_def)  | 
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
551  | 
assume L: "x \<in> carrier L" "y \<in> carrier L"  | 
| 
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
552  | 
  with inf_of_two_exists obtain s where "greatest L s (Lower L {x, y})" by fast
 | 
| 14551 | 553  | 
with L  | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
554  | 
  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
 | 
555  | 
by (fast intro: someI2 weak_greatest_unique) (* blast fails *)  | 
| 14551 | 556  | 
qed  | 
557  | 
||
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
558  | 
lemma (in weak_lower_semilattice) meet_le:  | 
| 14693 | 559  | 
assumes sub: "z \<sqsubseteq> x" "z \<sqsubseteq> y"  | 
| 23350 | 560  | 
and x: "x \<in> carrier L" and y: "y \<in> carrier L" and z: "z \<in> carrier L"  | 
| 14551 | 561  | 
shows "z \<sqsubseteq> x \<sqinter> y"  | 
| 23350 | 562  | 
proof (rule meetI [OF _ x y])  | 
| 14551 | 563  | 
fix i  | 
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
564  | 
  assume "greatest L i (Lower L {x, y})"
 | 
| 23350 | 565  | 
with sub z show "z \<sqsubseteq> i" by (fast elim: greatest_le intro: Lower_memI)  | 
| 14551 | 566  | 
qed  | 
| 14693 | 567  | 
|
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
568  | 
lemma (in weak_lattice) weak_le_iff_join:  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
569  | 
assumes "x \<in> carrier L" "y \<in> carrier L"  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
570  | 
shows "x \<sqsubseteq> y \<longleftrightarrow> x .= (x \<sqinter> y)"  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
571  | 
by (meson assms(1) assms(2) local.le_refl local.le_trans meet_closed meet_le meet_left meet_right weak_le_antisym weak_refl)  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
572  | 
|
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
573  | 
lemma (in weak_lower_semilattice) weak_meet_assoc_lemma:  | 
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
574  | 
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
 | 
575  | 
  shows "x \<sqinter> (y \<sqinter> z) .= \<Sqinter>{x, y, z}"
 | 
| 14551 | 576  | 
proof (rule finite_inf_insertI)  | 
| 61382 | 577  | 
txt \<open>The textbook argument in Jacobson I, p 457\<close>  | 
| 14551 | 578  | 
fix i  | 
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
579  | 
  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
 | 
580  | 
show "x \<sqinter> (y \<sqinter> z) .= i"  | 
| 33657 | 581  | 
proof (rule weak_le_antisym)  | 
| 14551 | 582  | 
from inf L show "i \<sqsubseteq> x \<sqinter> (y \<sqinter> z)"  | 
| 
44890
 
22f665a2e91c
new fastforce replacing fastsimp - less confusing name
 
nipkow 
parents: 
44655 
diff
changeset
 | 
583  | 
by (fastforce intro!: meet_le elim: greatest_Lower_below)  | 
| 14551 | 584  | 
next  | 
585  | 
from inf L show "x \<sqinter> (y \<sqinter> z) \<sqsubseteq> i"  | 
|
586  | 
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
 | 
587  | 
(blast intro!: Lower_memI intro: le_trans meet_left meet_right meet_closed)  | 
| 27700 | 588  | 
qed (simp_all add: L greatest_closed [OF inf])  | 
| 14551 | 589  | 
qed (simp_all add: L)  | 
590  | 
||
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
591  | 
lemma meet_comm:  | 
| 
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
592  | 
fixes L (structure)  | 
| 
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
593  | 
shows "x \<sqinter> y = y \<sqinter> x"  | 
| 14551 | 594  | 
by (unfold meet_def) (simp add: insert_commute)  | 
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_lower_semilattice) weak_meet_assoc:  | 
| 
22063
 
717425609192
Reverted to structure representation with records.
 
ballarin 
parents: 
21896 
diff
changeset
 | 
597  | 
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
 | 
598  | 
shows "(x \<sqinter> y) \<sqinter> z .= x \<sqinter> (y \<sqinter> z)"  | 
| 14551 | 599  | 
proof -  | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
600  | 
(* FIXME: improved simp, see weak_join_assoc above *)  | 
| 14551 | 601  | 
have "(x \<sqinter> y) \<sqinter> z = z \<sqinter> (x \<sqinter> y)" by (simp only: meet_comm)  | 
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
602  | 
  also from L have "... .= \<Sqinter> {z, x, y}" by (simp add: weak_meet_assoc_lemma)
 | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
603  | 
  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
 | 
604  | 
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
 | 
605  | 
finally show ?thesis by (simp add: L)  | 
| 14551 | 606  | 
qed  | 
607  | 
||
| 61382 | 608  | 
text \<open>Total orders are lattices.\<close>  | 
| 
24087
 
eb025d149a34
Proper interpretation of total orders in lattices.
 
ballarin 
parents: 
23463 
diff
changeset
 | 
609  | 
|
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
610  | 
sublocale weak_total_order \<subseteq> weak?: weak_lattice  | 
| 28823 | 611  | 
proof  | 
| 
24087
 
eb025d149a34
Proper interpretation of total orders in lattices.
 
ballarin 
parents: 
23463 
diff
changeset
 | 
612  | 
fix x y  | 
| 
 
eb025d149a34
Proper interpretation of total orders in lattices.
 
ballarin 
parents: 
23463 
diff
changeset
 | 
613  | 
assume L: "x \<in> carrier L" "y \<in> carrier L"  | 
| 67091 | 614  | 
  show "\<exists>s. least L s (Upper L {x, y})"
 | 
| 
24087
 
eb025d149a34
Proper interpretation of total orders in lattices.
 
ballarin 
parents: 
23463 
diff
changeset
 | 
615  | 
proof -  | 
| 
 
eb025d149a34
Proper interpretation of total orders in lattices.
 
ballarin 
parents: 
23463 
diff
changeset
 | 
616  | 
note total L  | 
| 
 
eb025d149a34
Proper interpretation of total orders in lattices.
 
ballarin 
parents: 
23463 
diff
changeset
 | 
617  | 
moreover  | 
| 
 
eb025d149a34
Proper interpretation of total orders in lattices.
 
ballarin 
parents: 
23463 
diff
changeset
 | 
618  | 
    {
 | 
| 
 
eb025d149a34
Proper interpretation of total orders in lattices.
 
ballarin 
parents: 
23463 
diff
changeset
 | 
619  | 
assume "x \<sqsubseteq> y"  | 
| 
 
eb025d149a34
Proper interpretation of total orders in lattices.
 
ballarin 
parents: 
23463 
diff
changeset
 | 
620  | 
      with L have "least L y (Upper L {x, y})"
 | 
| 
 
eb025d149a34
Proper interpretation of total orders in lattices.
 
ballarin 
parents: 
23463 
diff
changeset
 | 
621  | 
by (rule_tac least_UpperI) auto  | 
| 
 
eb025d149a34
Proper interpretation of total orders in lattices.
 
ballarin 
parents: 
23463 
diff
changeset
 | 
622  | 
}  | 
| 
 
eb025d149a34
Proper interpretation of total orders in lattices.
 
ballarin 
parents: 
23463 
diff
changeset
 | 
623  | 
moreover  | 
| 
 
eb025d149a34
Proper interpretation of total orders in lattices.
 
ballarin 
parents: 
23463 
diff
changeset
 | 
624  | 
    {
 | 
| 
 
eb025d149a34
Proper interpretation of total orders in lattices.
 
ballarin 
parents: 
23463 
diff
changeset
 | 
625  | 
assume "y \<sqsubseteq> x"  | 
| 
 
eb025d149a34
Proper interpretation of total orders in lattices.
 
ballarin 
parents: 
23463 
diff
changeset
 | 
626  | 
      with L have "least L x (Upper L {x, y})"
 | 
| 
 
eb025d149a34
Proper interpretation of total orders in lattices.
 
ballarin 
parents: 
23463 
diff
changeset
 | 
627  | 
by (rule_tac least_UpperI) auto  | 
| 
 
eb025d149a34
Proper interpretation of total orders in lattices.
 
ballarin 
parents: 
23463 
diff
changeset
 | 
628  | 
}  | 
| 
 
eb025d149a34
Proper interpretation of total orders in lattices.
 
ballarin 
parents: 
23463 
diff
changeset
 | 
629  | 
ultimately show ?thesis by blast  | 
| 14551 | 630  | 
qed  | 
| 
24087
 
eb025d149a34
Proper interpretation of total orders in lattices.
 
ballarin 
parents: 
23463 
diff
changeset
 | 
631  | 
next  | 
| 
 
eb025d149a34
Proper interpretation of total orders in lattices.
 
ballarin 
parents: 
23463 
diff
changeset
 | 
632  | 
fix x y  | 
| 
 
eb025d149a34
Proper interpretation of total orders in lattices.
 
ballarin 
parents: 
23463 
diff
changeset
 | 
633  | 
assume L: "x \<in> carrier L" "y \<in> carrier L"  | 
| 67091 | 634  | 
  show "\<exists>i. greatest L i (Lower L {x, y})"
 | 
| 
24087
 
eb025d149a34
Proper interpretation of total orders in lattices.
 
ballarin 
parents: 
23463 
diff
changeset
 | 
635  | 
proof -  | 
| 
 
eb025d149a34
Proper interpretation of total orders in lattices.
 
ballarin 
parents: 
23463 
diff
changeset
 | 
636  | 
note total L  | 
| 
 
eb025d149a34
Proper interpretation of total orders in lattices.
 
ballarin 
parents: 
23463 
diff
changeset
 | 
637  | 
moreover  | 
| 
 
eb025d149a34
Proper interpretation of total orders in lattices.
 
ballarin 
parents: 
23463 
diff
changeset
 | 
638  | 
    {
 | 
| 
 
eb025d149a34
Proper interpretation of total orders in lattices.
 
ballarin 
parents: 
23463 
diff
changeset
 | 
639  | 
assume "y \<sqsubseteq> x"  | 
| 
 
eb025d149a34
Proper interpretation of total orders in lattices.
 
ballarin 
parents: 
23463 
diff
changeset
 | 
640  | 
      with L have "greatest L y (Lower L {x, y})"
 | 
| 
 
eb025d149a34
Proper interpretation of total orders in lattices.
 
ballarin 
parents: 
23463 
diff
changeset
 | 
641  | 
by (rule_tac greatest_LowerI) auto  | 
| 
 
eb025d149a34
Proper interpretation of total orders in lattices.
 
ballarin 
parents: 
23463 
diff
changeset
 | 
642  | 
}  | 
| 
 
eb025d149a34
Proper interpretation of total orders in lattices.
 
ballarin 
parents: 
23463 
diff
changeset
 | 
643  | 
moreover  | 
| 
 
eb025d149a34
Proper interpretation of total orders in lattices.
 
ballarin 
parents: 
23463 
diff
changeset
 | 
644  | 
    {
 | 
| 
 
eb025d149a34
Proper interpretation of total orders in lattices.
 
ballarin 
parents: 
23463 
diff
changeset
 | 
645  | 
assume "x \<sqsubseteq> y"  | 
| 
 
eb025d149a34
Proper interpretation of total orders in lattices.
 
ballarin 
parents: 
23463 
diff
changeset
 | 
646  | 
      with L have "greatest L x (Lower L {x, y})"
 | 
| 
 
eb025d149a34
Proper interpretation of total orders in lattices.
 
ballarin 
parents: 
23463 
diff
changeset
 | 
647  | 
by (rule_tac greatest_LowerI) auto  | 
| 
 
eb025d149a34
Proper interpretation of total orders in lattices.
 
ballarin 
parents: 
23463 
diff
changeset
 | 
648  | 
}  | 
| 
 
eb025d149a34
Proper interpretation of total orders in lattices.
 
ballarin 
parents: 
23463 
diff
changeset
 | 
649  | 
ultimately show ?thesis by blast  | 
| 
 
eb025d149a34
Proper interpretation of total orders in lattices.
 
ballarin 
parents: 
23463 
diff
changeset
 | 
650  | 
qed  | 
| 
 
eb025d149a34
Proper interpretation of total orders in lattices.
 
ballarin 
parents: 
23463 
diff
changeset
 | 
651  | 
qed  | 
| 14551 | 652  | 
|
| 14693 | 653  | 
|
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
654  | 
subsection \<open>Weak Bounded Lattices\<close>  | 
| 14551 | 655  | 
|
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
656  | 
locale weak_bounded_lattice =  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
657  | 
weak_lattice +  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
658  | 
weak_partial_order_bottom +  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
659  | 
weak_partial_order_top  | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
660  | 
begin  | 
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
661  | 
|
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
662  | 
lemma bottom_meet: "x \<in> carrier L \<Longrightarrow> \<bottom> \<sqinter> x .= \<bottom>"  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
663  | 
by (metis bottom_least least_def meet_closed meet_left weak_le_antisym)  | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
664  | 
|
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
665  | 
lemma bottom_join: "x \<in> carrier L \<Longrightarrow> \<bottom> \<squnion> x .= x"  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
666  | 
by (metis bottom_least join_closed join_le join_right le_refl least_def weak_le_antisym)  | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
667  | 
|
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
668  | 
lemma bottom_weak_eq:  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
669  | 
"\<lbrakk> b \<in> carrier L; \<And> x. x \<in> carrier L \<Longrightarrow> b \<sqsubseteq> x \<rbrakk> \<Longrightarrow> b .= \<bottom>"  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
670  | 
by (metis bottom_closed bottom_lower weak_le_antisym)  | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
671  | 
|
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
672  | 
lemma top_join: "x \<in> carrier L \<Longrightarrow> \<top> \<squnion> x .= \<top>"  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
673  | 
by (metis join_closed join_left top_closed top_higher weak_le_antisym)  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
674  | 
|
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
675  | 
lemma top_meet: "x \<in> carrier L \<Longrightarrow> \<top> \<sqinter> x .= x"  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
676  | 
by (metis le_refl meet_closed meet_le meet_right top_closed top_higher weak_le_antisym)  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
677  | 
|
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
678  | 
lemma top_weak_eq: "\<lbrakk> t \<in> carrier L; \<And> x. x \<in> carrier L \<Longrightarrow> x \<sqsubseteq> t \<rbrakk> \<Longrightarrow> t .= \<top>"  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
679  | 
by (metis top_closed top_higher weak_le_antisym)  | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
680  | 
|
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
681  | 
end  | 
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
682  | 
|
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
683  | 
sublocale weak_bounded_lattice \<subseteq> weak_partial_order ..  | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
684  | 
|
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
685  | 
|
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
686  | 
subsection \<open>Lattices where \<open>eq\<close> is the Equality\<close>  | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
687  | 
|
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
688  | 
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
 | 
689  | 
assumes sup_of_two_exists:  | 
| 67091 | 690  | 
    "[| x \<in> carrier L; y \<in> carrier L |] ==> \<exists>s. least L s (Upper L {x, y})"
 | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
691  | 
|
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
692  | 
sublocale upper_semilattice \<subseteq> weak?: weak_upper_semilattice  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
693  | 
by unfold_locales (rule sup_of_two_exists)  | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
694  | 
|
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
695  | 
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
 | 
696  | 
assumes inf_of_two_exists:  | 
| 67091 | 697  | 
    "[| x \<in> carrier L; y \<in> carrier L |] ==> \<exists>s. greatest L s (Lower L {x, y})"
 | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
698  | 
|
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
699  | 
sublocale lower_semilattice \<subseteq> weak?: weak_lower_semilattice  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
700  | 
by unfold_locales (rule inf_of_two_exists)  | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
701  | 
|
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
702  | 
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
 | 
703  | 
|
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
704  | 
sublocale lattice \<subseteq> weak_lattice ..  | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
705  | 
|
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
706  | 
lemma (in lattice) dual_lattice:  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
707  | 
"lattice (inv_gorder L)"  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
708  | 
proof -  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
709  | 
interpret dual: weak_lattice "inv_gorder L"  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
710  | 
by (metis dual_weak_lattice)  | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
711  | 
|
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
712  | 
show ?thesis  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
713  | 
apply (unfold_locales)  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
714  | 
apply (simp_all add: inf_of_two_exists sup_of_two_exists)  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
715  | 
apply (simp add:eq_is_equal)  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
716  | 
done  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
717  | 
qed  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
718  | 
|
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
719  | 
lemma (in lattice) le_iff_join:  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
720  | 
assumes "x \<in> carrier L" "y \<in> carrier L"  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
721  | 
shows "x \<sqsubseteq> y \<longleftrightarrow> x = (x \<sqinter> y)"  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
722  | 
by (simp add: assms(1) assms(2) eq_is_equal weak_le_iff_join)  | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
723  | 
|
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
724  | 
lemma (in lattice) le_iff_meet:  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
725  | 
assumes "x \<in> carrier L" "y \<in> carrier L"  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
726  | 
shows "x \<sqsubseteq> y \<longleftrightarrow> (x \<squnion> y) = y"  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
727  | 
by (simp add: assms(1) assms(2) eq_is_equal weak_le_iff_meet)  | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
728  | 
|
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
729  | 
text \<open> Total orders are lattices. \<close>  | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
730  | 
|
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
731  | 
sublocale total_order \<subseteq> weak?: lattice  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
732  | 
by standard (auto intro: weak.weak.sup_of_two_exists weak.weak.inf_of_two_exists)  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
733  | 
|
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
734  | 
text \<open>Functions that preserve joins and meets\<close>  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
735  | 
|
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
736  | 
definition join_pres :: "('a, 'c) gorder_scheme \<Rightarrow> ('b, 'd) gorder_scheme \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> bool" where
 | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
737  | 
"join_pres X Y f \<equiv> lattice X \<and> lattice Y \<and> (\<forall> x \<in> carrier X. \<forall> y \<in> carrier X. f (x \<squnion>\<^bsub>X\<^esub> y) = f x \<squnion>\<^bsub>Y\<^esub> f y)"  | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
738  | 
|
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
739  | 
definition meet_pres :: "('a, 'c) gorder_scheme \<Rightarrow> ('b, 'd) gorder_scheme \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> bool" where
 | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
740  | 
"meet_pres X Y f \<equiv> lattice X \<and> lattice Y \<and> (\<forall> x \<in> carrier X. \<forall> y \<in> carrier X. f (x \<sqinter>\<^bsub>X\<^esub> y) = f x \<sqinter>\<^bsub>Y\<^esub> f y)"  | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
741  | 
|
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
742  | 
lemma join_pres_isotone:  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
743  | 
assumes "f \<in> carrier X \<rightarrow> carrier Y" "join_pres X Y f"  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
744  | 
shows "isotone X Y f"  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
745  | 
using assms  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
746  | 
apply (rule_tac isotoneI)  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
747  | 
apply (auto simp add: join_pres_def lattice.le_iff_meet funcset_carrier)  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
748  | 
using lattice_def partial_order_def upper_semilattice_def apply blast  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
749  | 
using lattice_def partial_order_def upper_semilattice_def apply blast  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
750  | 
apply fastforce  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
751  | 
done  | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
752  | 
|
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
753  | 
lemma meet_pres_isotone:  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
754  | 
assumes "f \<in> carrier X \<rightarrow> carrier Y" "meet_pres X Y f"  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
755  | 
shows "isotone X Y f"  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
756  | 
using assms  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
757  | 
apply (rule_tac isotoneI)  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
758  | 
apply (auto simp add: meet_pres_def lattice.le_iff_join funcset_carrier)  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
759  | 
using lattice_def partial_order_def upper_semilattice_def apply blast  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
760  | 
using lattice_def partial_order_def upper_semilattice_def apply blast  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
761  | 
apply fastforce  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
762  | 
done  | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
763  | 
|
| 
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
764  | 
|
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
765  | 
subsection \<open>Bounded Lattices\<close>  | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
766  | 
|
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
767  | 
locale bounded_lattice =  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
768  | 
lattice +  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
769  | 
weak_partial_order_bottom +  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
770  | 
weak_partial_order_top  | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
771  | 
|
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
772  | 
sublocale bounded_lattice \<subseteq> weak_bounded_lattice ..  | 
| 
27713
 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 
ballarin 
parents: 
27700 
diff
changeset
 | 
773  | 
|
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
774  | 
context bounded_lattice  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
775  | 
begin  | 
| 14551 | 776  | 
|
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
777  | 
lemma bottom_eq:  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
778  | 
"\<lbrakk> b \<in> carrier L; \<And> x. x \<in> carrier L \<Longrightarrow> b \<sqsubseteq> x \<rbrakk> \<Longrightarrow> b = \<bottom>"  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
779  | 
by (metis bottom_closed bottom_lower le_antisym)  | 
| 14551 | 780  | 
|
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
781  | 
lemma top_eq: "\<lbrakk> t \<in> carrier L; \<And> x. x \<in> carrier L \<Longrightarrow> x \<sqsubseteq> t \<rbrakk> \<Longrightarrow> t = \<top>"  | 
| 
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
782  | 
by (metis le_antisym top_closed top_higher)  | 
| 14551 | 783  | 
|
| 14693 | 784  | 
end  | 
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
785  | 
|
| 
69700
 
7a92cbec7030
new material about summations and powers, along with some tweaks
 
paulson <lp15@cam.ac.uk> 
parents: 
67443 
diff
changeset
 | 
786  | 
hide_const (open) Lattice.inf  | 
| 
 
7a92cbec7030
new material about summations and powers, along with some tweaks
 
paulson <lp15@cam.ac.uk> 
parents: 
67443 
diff
changeset
 | 
787  | 
hide_const (open) Lattice.sup  | 
| 
 
7a92cbec7030
new material about summations and powers, along with some tweaks
 
paulson <lp15@cam.ac.uk> 
parents: 
67443 
diff
changeset
 | 
788  | 
|
| 
65099
 
30d0b2f1df76
Knaster-Tarski fixed point theorem and Galois Connections.
 
ballarin 
parents: 
63167 
diff
changeset
 | 
789  | 
end  |