| author | wenzelm | 
| Tue, 07 Oct 2014 23:12:08 +0200 | |
| changeset 58622 | aa99568f56de | 
| parent 58614 | 7338eb25226c | 
| child 58882 | 6e2010ab8bd9 | 
| permissions | -rw-r--r-- | 
| 33026 | 1 | (* Title: HOL/Isar_Examples/Knaster_Tarski.thy | 
| 6882 | 2 | Author: Markus Wenzel, TU Muenchen | 
| 3 | ||
| 4 | Typical textbook proof example. | |
| 5 | *) | |
| 6 | ||
| 58614 | 7 | header \<open>Textbook-style reasoning: the Knaster-Tarski Theorem\<close> | 
| 6882 | 8 | |
| 31758 | 9 | theory Knaster_Tarski | 
| 41413 
64cd30d6b0b8
explicit file specifications -- avoid secondary load path;
 wenzelm parents: 
37671diff
changeset | 10 | imports Main "~~/src/HOL/Library/Lattice_Syntax" | 
| 30816 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 11 | begin | 
| 6882 | 12 | |
| 7761 | 13 | |
| 58614 | 14 | subsection \<open>Prose version\<close> | 
| 7761 | 15 | |
| 58614 | 16 | text \<open>According to the textbook @{cite \<open>pages 93--94\<close> "davey-priestley"},
 | 
| 17 | the Knaster-Tarski fixpoint theorem is as | |
| 37671 | 18 |   follows.\footnote{We have dualized the argument, and tuned the
 | 
| 19 | notation a little bit.} | |
| 7153 | 20 | |
| 30816 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 21 |   \textbf{The Knaster-Tarski Fixpoint Theorem.}  Let @{text L} be a
 | 
| 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 22 |   complete lattice and @{text "f: L \<rightarrow> L"} an order-preserving map.
 | 
| 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 23 |   Then @{text "\<Sqinter>{x \<in> L | f(x) \<le> x}"} is a fixpoint of @{text f}.
 | 
| 7153 | 24 | |
| 30816 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 25 |   \textbf{Proof.} Let @{text "H = {x \<in> L | f(x) \<le> x}"} and @{text "a =
 | 
| 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 26 |   \<Sqinter>H"}.  For all @{text "x \<in> H"} we have @{text "a \<le> x"}, so @{text
 | 
| 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 27 |   "f(a) \<le> f(x) \<le> x"}.  Thus @{text "f(a)"} is a lower bound of @{text
 | 
| 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 28 |   H}, whence @{text "f(a) \<le> a"}.  We now use this inequality to prove
 | 
| 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 29 |   the reverse one (!) and thereby complete the proof that @{text a} is
 | 
| 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 30 |   a fixpoint.  Since @{text f} is order-preserving, @{text "f(f(a)) \<le>
 | 
| 58614 | 31 |   f(a)"}.  This says @{text "f(a) \<in> H"}, so @{text "a \<le> f(a)"}.\<close>
 | 
| 6883 | 32 | |
| 7761 | 33 | |
| 58614 | 34 | subsection \<open>Formal versions\<close> | 
| 7761 | 35 | |
| 58614 | 36 | text \<open>The Isar proof below closely follows the original | 
| 37671 | 37 | presentation. Virtually all of the prose narration has been | 
| 38 | rephrased in terms of formal Isar language elements. Just as many | |
| 39 | textbook-style proofs, there is a strong bias towards forward proof, | |
| 58614 | 40 | and several bends in the course of reasoning.\<close> | 
| 6882 | 41 | |
| 30816 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 42 | theorem Knaster_Tarski: | 
| 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 43 | fixes f :: "'a::complete_lattice \<Rightarrow> 'a" | 
| 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 44 | assumes "mono f" | 
| 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 45 | shows "\<exists>a. f a = a" | 
| 10007 | 46 | proof | 
| 30816 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 47 |   let ?H = "{u. f u \<le> u}"
 | 
| 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 48 | let ?a = "\<Sqinter>?H" | 
| 10007 | 49 | show "f ?a = ?a" | 
| 50 | proof - | |
| 51 |     {
 | |
| 52 | fix x | |
| 30816 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 53 | assume "x \<in> ?H" | 
| 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 54 | then have "?a \<le> x" by (rule Inf_lower) | 
| 58614 | 55 | with \<open>mono f\<close> have "f ?a \<le> f x" .. | 
| 56 | also from \<open>x \<in> ?H\<close> have "\<dots> \<le> x" .. | |
| 30816 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 57 | finally have "f ?a \<le> x" . | 
| 10007 | 58 | } | 
| 30816 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 59 | then have "f ?a \<le> ?a" by (rule Inf_greatest) | 
| 10007 | 60 |     {
 | 
| 30816 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 61 | also presume "\<dots> \<le> f ?a" | 
| 10007 | 62 | finally (order_antisym) show ?thesis . | 
| 63 | } | |
| 58614 | 64 | from \<open>mono f\<close> and \<open>f ?a \<le> ?a\<close> have "f (f ?a) \<le> f ?a" .. | 
| 30816 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 65 | then have "f ?a \<in> ?H" .. | 
| 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 66 | then show "?a \<le> f ?a" by (rule Inf_lower) | 
| 10007 | 67 | qed | 
| 68 | qed | |
| 6898 | 69 | |
| 58614 | 70 | text \<open>Above we have used several advanced Isar language elements, | 
| 37671 | 71 | such as explicit block structure and weak assumptions. Thus we have | 
| 30816 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 72 | mimicked the particular way of reasoning of the original text. | 
| 7818 | 73 | |
| 30816 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 74 | In the subsequent version the order of reasoning is changed to | 
| 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 75 | achieve structured top-down decomposition of the problem at the | 
| 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 76 | outer level, while only the inner steps of reasoning are done in a | 
| 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 77 | forward manner. We are certainly more at ease here, requiring only | 
| 58614 | 78 | the most basic features of the Isar language.\<close> | 
| 7818 | 79 | |
| 30816 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 80 | theorem Knaster_Tarski': | 
| 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 81 | fixes f :: "'a::complete_lattice \<Rightarrow> 'a" | 
| 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 82 | assumes "mono f" | 
| 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 83 | shows "\<exists>a. f a = a" | 
| 10007 | 84 | proof | 
| 30816 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 85 |   let ?H = "{u. f u \<le> u}"
 | 
| 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 86 | let ?a = "\<Sqinter>?H" | 
| 10007 | 87 | show "f ?a = ?a" | 
| 88 | proof (rule order_antisym) | |
| 30816 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 89 | show "f ?a \<le> ?a" | 
| 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 90 | proof (rule Inf_greatest) | 
| 10007 | 91 | fix x | 
| 30816 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 92 | assume "x \<in> ?H" | 
| 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 93 | then have "?a \<le> x" by (rule Inf_lower) | 
| 58614 | 94 | with \<open>mono f\<close> have "f ?a \<le> f x" .. | 
| 95 | also from \<open>x \<in> ?H\<close> have "\<dots> \<le> x" .. | |
| 30816 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 96 | finally show "f ?a \<le> x" . | 
| 10007 | 97 | qed | 
| 30816 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 98 | show "?a \<le> f ?a" | 
| 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 99 | proof (rule Inf_lower) | 
| 58614 | 100 | from \<open>mono f\<close> and \<open>f ?a \<le> ?a\<close> have "f (f ?a) \<le> f ?a" .. | 
| 30816 
4de62c902f9a
replaced 'a set by abstract 'a::complete_lattice, and recover plain reasoning instead of adhoc automation (by simp);
 wenzelm parents: 
26812diff
changeset | 101 | then show "f ?a \<in> ?H" .. | 
| 10007 | 102 | qed | 
| 103 | qed | |
| 104 | qed | |
| 7818 | 105 | |
| 10007 | 106 | end |