| author | wenzelm | 
| Sun, 07 Feb 2016 19:43:40 +0100 | |
| changeset 62271 | 4cfe65cfd369 | 
| parent 62093 | bd73a2279fcd | 
| child 63612 | 7195acc2fe93 | 
| permissions | -rw-r--r-- | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 1 | (* Title: HOL/Complete_Partial_Order.thy | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 2 | Author: Brian Huffman, Portland State University | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 3 | Author: Alexander Krauss, TU Muenchen | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 4 | *) | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 5 | |
| 60758 | 6 | section \<open>Chain-complete partial orders and their fixpoints\<close> | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 7 | |
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 8 | theory Complete_Partial_Order | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 9 | imports Product_Type | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 10 | begin | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 11 | |
| 60758 | 12 | subsection \<open>Monotone functions\<close> | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 13 | |
| 60758 | 14 | text \<open>Dictionary-passing version of @{const Orderings.mono}.\<close>
 | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 15 | |
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 16 | definition monotone :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> ('b \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> bool"
 | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 17 | where "monotone orda ordb f \<longleftrightarrow> (\<forall>x y. orda x y \<longrightarrow> ordb (f x) (f y))" | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 18 | |
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 19 | lemma monotoneI[intro?]: "(\<And>x y. orda x y \<Longrightarrow> ordb (f x) (f y)) | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 20 | \<Longrightarrow> monotone orda ordb f" | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 21 | unfolding monotone_def by iprover | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 22 | |
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 23 | lemma monotoneD[dest?]: "monotone orda ordb f \<Longrightarrow> orda x y \<Longrightarrow> ordb (f x) (f y)" | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 24 | unfolding monotone_def by iprover | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 25 | |
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 26 | |
| 60758 | 27 | subsection \<open>Chains\<close> | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 28 | |
| 60758 | 29 | text \<open>A chain is a totally-ordered set. Chains are parameterized over | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 30 | the order for maximal flexibility, since type classes are not enough. | 
| 60758 | 31 | \<close> | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 32 | |
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 33 | definition | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 34 |   chain :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> 'a set \<Rightarrow> bool"
 | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 35 | where | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 36 | "chain ord S \<longleftrightarrow> (\<forall>x\<in>S. \<forall>y\<in>S. ord x y \<or> ord y x)" | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 37 | |
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 38 | lemma chainI: | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 39 | assumes "\<And>x y. x \<in> S \<Longrightarrow> y \<in> S \<Longrightarrow> ord x y \<or> ord y x" | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 40 | shows "chain ord S" | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 41 | using assms unfolding chain_def by fast | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 42 | |
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 43 | lemma chainD: | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 44 | assumes "chain ord S" and "x \<in> S" and "y \<in> S" | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 45 | shows "ord x y \<or> ord y x" | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 46 | using assms unfolding chain_def by fast | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 47 | |
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 48 | lemma chainE: | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 49 | assumes "chain ord S" and "x \<in> S" and "y \<in> S" | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 50 | obtains "ord x y" | "ord y x" | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 51 | using assms unfolding chain_def by fast | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 52 | |
| 54630 
9061af4d5ebc
restrict admissibility to non-empty chains to allow more syntax-directed proof rules
 Andreas Lochbihler parents: 
53361diff
changeset | 53 | lemma chain_empty: "chain ord {}"
 | 
| 
9061af4d5ebc
restrict admissibility to non-empty chains to allow more syntax-directed proof rules
 Andreas Lochbihler parents: 
53361diff
changeset | 54 | by(simp add: chain_def) | 
| 
9061af4d5ebc
restrict admissibility to non-empty chains to allow more syntax-directed proof rules
 Andreas Lochbihler parents: 
53361diff
changeset | 55 | |
| 60057 | 56 | lemma chain_equality: "chain op = A \<longleftrightarrow> (\<forall>x\<in>A. \<forall>y\<in>A. x = y)" | 
| 57 | by(auto simp add: chain_def) | |
| 58 | ||
| 60061 | 59 | lemma chain_subset: | 
| 60 | "\<lbrakk> chain ord A; B \<subseteq> A \<rbrakk> | |
| 61 | \<Longrightarrow> chain ord B" | |
| 62 | by(rule chainI)(blast dest: chainD) | |
| 63 | ||
| 64 | lemma chain_imageI: | |
| 65 | assumes chain: "chain le_a Y" | |
| 66 | and mono: "\<And>x y. \<lbrakk> x \<in> Y; y \<in> Y; le_a x y \<rbrakk> \<Longrightarrow> le_b (f x) (f y)" | |
| 67 | shows "chain le_b (f ` Y)" | |
| 68 | by(blast intro: chainI dest: chainD[OF chain] mono) | |
| 69 | ||
| 60758 | 70 | subsection \<open>Chain-complete partial orders\<close> | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 71 | |
| 60758 | 72 | text \<open> | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 73 | A ccpo has a least upper bound for any chain. In particular, the | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 74 | empty set is a chain, so every ccpo must have a bottom element. | 
| 60758 | 75 | \<close> | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 76 | |
| 46041 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 77 | class ccpo = order + Sup + | 
| 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 78 | assumes ccpo_Sup_upper: "\<lbrakk>chain (op \<le>) A; x \<in> A\<rbrakk> \<Longrightarrow> x \<le> Sup A" | 
| 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 79 | assumes ccpo_Sup_least: "\<lbrakk>chain (op \<le>) A; \<And>x. x \<in> A \<Longrightarrow> x \<le> z\<rbrakk> \<Longrightarrow> Sup A \<le> z" | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 80 | begin | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 81 | |
| 60061 | 82 | lemma chain_singleton: "Complete_Partial_Order.chain op \<le> {x}"
 | 
| 83 | by(rule chainI) simp | |
| 84 | ||
| 85 | lemma ccpo_Sup_singleton [simp]: "\<Squnion>{x} = x"
 | |
| 86 | by(rule antisym)(auto intro: ccpo_Sup_least ccpo_Sup_upper simp add: chain_singleton) | |
| 87 | ||
| 60758 | 88 | subsection \<open>Transfinite iteration of a function\<close> | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 89 | |
| 62093 | 90 | context notes [[inductive_internals]] begin | 
| 61689 | 91 | |
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 92 | inductive_set iterates :: "('a \<Rightarrow> 'a) \<Rightarrow> 'a set"
 | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 93 | for f :: "'a \<Rightarrow> 'a" | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 94 | where | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 95 | step: "x \<in> iterates f \<Longrightarrow> f x \<in> iterates f" | 
| 46041 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 96 | | Sup: "chain (op \<le>) M \<Longrightarrow> \<forall>x\<in>M. x \<in> iterates f \<Longrightarrow> Sup M \<in> iterates f" | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 97 | |
| 61689 | 98 | end | 
| 99 | ||
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 100 | lemma iterates_le_f: | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 101 | "x \<in> iterates f \<Longrightarrow> monotone (op \<le>) (op \<le>) f \<Longrightarrow> x \<le> f x" | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 102 | by (induct x rule: iterates.induct) | 
| 46041 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 103 | (force dest: monotoneD intro!: ccpo_Sup_upper ccpo_Sup_least)+ | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 104 | |
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 105 | lemma chain_iterates: | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 106 | assumes f: "monotone (op \<le>) (op \<le>) f" | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 107 | shows "chain (op \<le>) (iterates f)" (is "chain _ ?C") | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 108 | proof (rule chainI) | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 109 | fix x y assume "x \<in> ?C" "y \<in> ?C" | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 110 | then show "x \<le> y \<or> y \<le> x" | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 111 | proof (induct x arbitrary: y rule: iterates.induct) | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 112 | fix x y assume y: "y \<in> ?C" | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 113 | and IH: "\<And>z. z \<in> ?C \<Longrightarrow> x \<le> z \<or> z \<le> x" | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 114 | from y show "f x \<le> y \<or> y \<le> f x" | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 115 | proof (induct y rule: iterates.induct) | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 116 | case (step y) with IH f show ?case by (auto dest: monotoneD) | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 117 | next | 
| 46041 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 118 | case (Sup M) | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 119 | then have chM: "chain (op \<le>) M" | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 120 | and IH': "\<And>z. z \<in> M \<Longrightarrow> f x \<le> z \<or> z \<le> f x" by auto | 
| 46041 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 121 | show "f x \<le> Sup M \<or> Sup M \<le> f x" | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 122 | proof (cases "\<exists>z\<in>M. f x \<le> z") | 
| 46041 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 123 | case True then have "f x \<le> Sup M" | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 124 | apply rule | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 125 | apply (erule order_trans) | 
| 46041 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 126 | by (rule ccpo_Sup_upper[OF chM]) | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 127 | thus ?thesis .. | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 128 | next | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 129 | case False with IH' | 
| 46041 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 130 | show ?thesis by (auto intro: ccpo_Sup_least[OF chM]) | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 131 | qed | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 132 | qed | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 133 | next | 
| 46041 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 134 | case (Sup M y) | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 135 | show ?case | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 136 | proof (cases "\<exists>x\<in>M. y \<le> x") | 
| 46041 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 137 | case True then have "y \<le> Sup M" | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 138 | apply rule | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 139 | apply (erule order_trans) | 
| 46041 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 140 | by (rule ccpo_Sup_upper[OF Sup(1)]) | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 141 | thus ?thesis .. | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 142 | next | 
| 46041 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 143 | case False with Sup | 
| 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 144 | show ?thesis by (auto intro: ccpo_Sup_least) | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 145 | qed | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 146 | qed | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 147 | qed | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 148 | |
| 54630 
9061af4d5ebc
restrict admissibility to non-empty chains to allow more syntax-directed proof rules
 Andreas Lochbihler parents: 
53361diff
changeset | 149 | lemma bot_in_iterates: "Sup {} \<in> iterates f"
 | 
| 
9061af4d5ebc
restrict admissibility to non-empty chains to allow more syntax-directed proof rules
 Andreas Lochbihler parents: 
53361diff
changeset | 150 | by(auto intro: iterates.Sup simp add: chain_empty) | 
| 
9061af4d5ebc
restrict admissibility to non-empty chains to allow more syntax-directed proof rules
 Andreas Lochbihler parents: 
53361diff
changeset | 151 | |
| 60758 | 152 | subsection \<open>Fixpoint combinator\<close> | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 153 | |
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 154 | definition | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 155 |   fixp :: "('a \<Rightarrow> 'a) \<Rightarrow> 'a"
 | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 156 | where | 
| 46041 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 157 | "fixp f = Sup (iterates f)" | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 158 | |
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 159 | lemma iterates_fixp: | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 160 | assumes f: "monotone (op \<le>) (op \<le>) f" shows "fixp f \<in> iterates f" | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 161 | unfolding fixp_def | 
| 46041 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 162 | by (simp add: iterates.Sup chain_iterates f) | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 163 | |
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 164 | lemma fixp_unfold: | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 165 | assumes f: "monotone (op \<le>) (op \<le>) f" | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 166 | shows "fixp f = f (fixp f)" | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 167 | proof (rule antisym) | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 168 | show "fixp f \<le> f (fixp f)" | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 169 | by (intro iterates_le_f iterates_fixp f) | 
| 46041 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 170 | have "f (fixp f) \<le> Sup (iterates f)" | 
| 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 171 | by (intro ccpo_Sup_upper chain_iterates f iterates.step iterates_fixp) | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 172 | thus "f (fixp f) \<le> fixp f" | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 173 | unfolding fixp_def . | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 174 | qed | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 175 | |
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 176 | lemma fixp_lowerbound: | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 177 | assumes f: "monotone (op \<le>) (op \<le>) f" and z: "f z \<le> z" shows "fixp f \<le> z" | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 178 | unfolding fixp_def | 
| 46041 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 179 | proof (rule ccpo_Sup_least[OF chain_iterates[OF f]]) | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 180 | fix x assume "x \<in> iterates f" | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 181 | thus "x \<le> z" | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 182 | proof (induct x rule: iterates.induct) | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 183 | fix x assume "x \<le> z" with f have "f x \<le> f z" by (rule monotoneD) | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 184 | also note z finally show "f x \<le> z" . | 
| 46041 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 185 | qed (auto intro: ccpo_Sup_least) | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 186 | qed | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 187 | |
| 53361 
1cb7d3c0cf31
move admissible out of class ccpo to avoid unnecessary class predicate in foundational theorems
 Andreas Lochbihler parents: 
46041diff
changeset | 188 | end | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 189 | |
| 60758 | 190 | subsection \<open>Fixpoint induction\<close> | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 191 | |
| 60758 | 192 | setup \<open>Sign.map_naming (Name_Space.mandatory_path "ccpo")\<close> | 
| 53361 
1cb7d3c0cf31
move admissible out of class ccpo to avoid unnecessary class predicate in foundational theorems
 Andreas Lochbihler parents: 
46041diff
changeset | 193 | |
| 
1cb7d3c0cf31
move admissible out of class ccpo to avoid unnecessary class predicate in foundational theorems
 Andreas Lochbihler parents: 
46041diff
changeset | 194 | definition admissible :: "('a set \<Rightarrow> 'a) \<Rightarrow> ('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> bool) \<Rightarrow> bool"
 | 
| 54630 
9061af4d5ebc
restrict admissibility to non-empty chains to allow more syntax-directed proof rules
 Andreas Lochbihler parents: 
53361diff
changeset | 195 | where "admissible lub ord P = (\<forall>A. chain ord A \<longrightarrow> (A \<noteq> {}) \<longrightarrow> (\<forall>x\<in>A. P x) \<longrightarrow> P (lub A))"
 | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 196 | |
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 197 | lemma admissibleI: | 
| 54630 
9061af4d5ebc
restrict admissibility to non-empty chains to allow more syntax-directed proof rules
 Andreas Lochbihler parents: 
53361diff
changeset | 198 |   assumes "\<And>A. chain ord A \<Longrightarrow> A \<noteq> {} \<Longrightarrow> \<forall>x\<in>A. P x \<Longrightarrow> P (lub A)"
 | 
| 53361 
1cb7d3c0cf31
move admissible out of class ccpo to avoid unnecessary class predicate in foundational theorems
 Andreas Lochbihler parents: 
46041diff
changeset | 199 | shows "ccpo.admissible lub ord P" | 
| 
1cb7d3c0cf31
move admissible out of class ccpo to avoid unnecessary class predicate in foundational theorems
 Andreas Lochbihler parents: 
46041diff
changeset | 200 | using assms unfolding ccpo.admissible_def by fast | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 201 | |
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 202 | lemma admissibleD: | 
| 53361 
1cb7d3c0cf31
move admissible out of class ccpo to avoid unnecessary class predicate in foundational theorems
 Andreas Lochbihler parents: 
46041diff
changeset | 203 | assumes "ccpo.admissible lub ord P" | 
| 
1cb7d3c0cf31
move admissible out of class ccpo to avoid unnecessary class predicate in foundational theorems
 Andreas Lochbihler parents: 
46041diff
changeset | 204 | assumes "chain ord A" | 
| 54630 
9061af4d5ebc
restrict admissibility to non-empty chains to allow more syntax-directed proof rules
 Andreas Lochbihler parents: 
53361diff
changeset | 205 |   assumes "A \<noteq> {}"
 | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 206 | assumes "\<And>x. x \<in> A \<Longrightarrow> P x" | 
| 53361 
1cb7d3c0cf31
move admissible out of class ccpo to avoid unnecessary class predicate in foundational theorems
 Andreas Lochbihler parents: 
46041diff
changeset | 207 | shows "P (lub A)" | 
| 
1cb7d3c0cf31
move admissible out of class ccpo to avoid unnecessary class predicate in foundational theorems
 Andreas Lochbihler parents: 
46041diff
changeset | 208 | using assms by (auto simp: ccpo.admissible_def) | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 209 | |
| 60758 | 210 | setup \<open>Sign.map_naming Name_Space.parent_path\<close> | 
| 53361 
1cb7d3c0cf31
move admissible out of class ccpo to avoid unnecessary class predicate in foundational theorems
 Andreas Lochbihler parents: 
46041diff
changeset | 211 | |
| 
1cb7d3c0cf31
move admissible out of class ccpo to avoid unnecessary class predicate in foundational theorems
 Andreas Lochbihler parents: 
46041diff
changeset | 212 | lemma (in ccpo) fixp_induct: | 
| 
1cb7d3c0cf31
move admissible out of class ccpo to avoid unnecessary class predicate in foundational theorems
 Andreas Lochbihler parents: 
46041diff
changeset | 213 | assumes adm: "ccpo.admissible Sup (op \<le>) P" | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 214 | assumes mono: "monotone (op \<le>) (op \<le>) f" | 
| 54630 
9061af4d5ebc
restrict admissibility to non-empty chains to allow more syntax-directed proof rules
 Andreas Lochbihler parents: 
53361diff
changeset | 215 |   assumes bot: "P (Sup {})"
 | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 216 | assumes step: "\<And>x. P x \<Longrightarrow> P (f x)" | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 217 | shows "P (fixp f)" | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 218 | unfolding fixp_def using adm chain_iterates[OF mono] | 
| 53361 
1cb7d3c0cf31
move admissible out of class ccpo to avoid unnecessary class predicate in foundational theorems
 Andreas Lochbihler parents: 
46041diff
changeset | 219 | proof (rule ccpo.admissibleD) | 
| 54630 
9061af4d5ebc
restrict admissibility to non-empty chains to allow more syntax-directed proof rules
 Andreas Lochbihler parents: 
53361diff
changeset | 220 |   show "iterates f \<noteq> {}" using bot_in_iterates by auto
 | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 221 | fix x assume "x \<in> iterates f" | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 222 | thus "P x" | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 223 | by (induct rule: iterates.induct) | 
| 54630 
9061af4d5ebc
restrict admissibility to non-empty chains to allow more syntax-directed proof rules
 Andreas Lochbihler parents: 
53361diff
changeset | 224 |       (case_tac "M = {}", auto intro: step bot ccpo.admissibleD adm)
 | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 225 | qed | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 226 | |
| 53361 
1cb7d3c0cf31
move admissible out of class ccpo to avoid unnecessary class predicate in foundational theorems
 Andreas Lochbihler parents: 
46041diff
changeset | 227 | lemma admissible_True: "ccpo.admissible lub ord (\<lambda>x. True)" | 
| 
1cb7d3c0cf31
move admissible out of class ccpo to avoid unnecessary class predicate in foundational theorems
 Andreas Lochbihler parents: 
46041diff
changeset | 228 | unfolding ccpo.admissible_def by simp | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 229 | |
| 54630 
9061af4d5ebc
restrict admissibility to non-empty chains to allow more syntax-directed proof rules
 Andreas Lochbihler parents: 
53361diff
changeset | 230 | (*lemma admissible_False: "\<not> ccpo.admissible lub ord (\<lambda>x. False)" | 
| 53361 
1cb7d3c0cf31
move admissible out of class ccpo to avoid unnecessary class predicate in foundational theorems
 Andreas Lochbihler parents: 
46041diff
changeset | 231 | unfolding ccpo.admissible_def chain_def by simp | 
| 54630 
9061af4d5ebc
restrict admissibility to non-empty chains to allow more syntax-directed proof rules
 Andreas Lochbihler parents: 
53361diff
changeset | 232 | *) | 
| 
9061af4d5ebc
restrict admissibility to non-empty chains to allow more syntax-directed proof rules
 Andreas Lochbihler parents: 
53361diff
changeset | 233 | lemma admissible_const: "ccpo.admissible lub ord (\<lambda>x. t)" | 
| 
9061af4d5ebc
restrict admissibility to non-empty chains to allow more syntax-directed proof rules
 Andreas Lochbihler parents: 
53361diff
changeset | 234 | by(auto intro: ccpo.admissibleI) | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 235 | |
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 236 | lemma admissible_conj: | 
| 53361 
1cb7d3c0cf31
move admissible out of class ccpo to avoid unnecessary class predicate in foundational theorems
 Andreas Lochbihler parents: 
46041diff
changeset | 237 | assumes "ccpo.admissible lub ord (\<lambda>x. P x)" | 
| 
1cb7d3c0cf31
move admissible out of class ccpo to avoid unnecessary class predicate in foundational theorems
 Andreas Lochbihler parents: 
46041diff
changeset | 238 | assumes "ccpo.admissible lub ord (\<lambda>x. Q x)" | 
| 
1cb7d3c0cf31
move admissible out of class ccpo to avoid unnecessary class predicate in foundational theorems
 Andreas Lochbihler parents: 
46041diff
changeset | 239 | shows "ccpo.admissible lub ord (\<lambda>x. P x \<and> Q x)" | 
| 
1cb7d3c0cf31
move admissible out of class ccpo to avoid unnecessary class predicate in foundational theorems
 Andreas Lochbihler parents: 
46041diff
changeset | 240 | using assms unfolding ccpo.admissible_def by simp | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 241 | |
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 242 | lemma admissible_all: | 
| 53361 
1cb7d3c0cf31
move admissible out of class ccpo to avoid unnecessary class predicate in foundational theorems
 Andreas Lochbihler parents: 
46041diff
changeset | 243 | assumes "\<And>y. ccpo.admissible lub ord (\<lambda>x. P x y)" | 
| 
1cb7d3c0cf31
move admissible out of class ccpo to avoid unnecessary class predicate in foundational theorems
 Andreas Lochbihler parents: 
46041diff
changeset | 244 | shows "ccpo.admissible lub ord (\<lambda>x. \<forall>y. P x y)" | 
| 
1cb7d3c0cf31
move admissible out of class ccpo to avoid unnecessary class predicate in foundational theorems
 Andreas Lochbihler parents: 
46041diff
changeset | 245 | using assms unfolding ccpo.admissible_def by fast | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 246 | |
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 247 | lemma admissible_ball: | 
| 53361 
1cb7d3c0cf31
move admissible out of class ccpo to avoid unnecessary class predicate in foundational theorems
 Andreas Lochbihler parents: 
46041diff
changeset | 248 | assumes "\<And>y. y \<in> A \<Longrightarrow> ccpo.admissible lub ord (\<lambda>x. P x y)" | 
| 
1cb7d3c0cf31
move admissible out of class ccpo to avoid unnecessary class predicate in foundational theorems
 Andreas Lochbihler parents: 
46041diff
changeset | 249 | shows "ccpo.admissible lub ord (\<lambda>x. \<forall>y\<in>A. P x y)" | 
| 
1cb7d3c0cf31
move admissible out of class ccpo to avoid unnecessary class predicate in foundational theorems
 Andreas Lochbihler parents: 
46041diff
changeset | 250 | using assms unfolding ccpo.admissible_def by fast | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 251 | |
| 53361 
1cb7d3c0cf31
move admissible out of class ccpo to avoid unnecessary class predicate in foundational theorems
 Andreas Lochbihler parents: 
46041diff
changeset | 252 | lemma chain_compr: "chain ord A \<Longrightarrow> chain ord {x \<in> A. P x}"
 | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 253 | unfolding chain_def by fast | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 254 | |
| 53361 
1cb7d3c0cf31
move admissible out of class ccpo to avoid unnecessary class predicate in foundational theorems
 Andreas Lochbihler parents: 
46041diff
changeset | 255 | context ccpo begin | 
| 
1cb7d3c0cf31
move admissible out of class ccpo to avoid unnecessary class predicate in foundational theorems
 Andreas Lochbihler parents: 
46041diff
changeset | 256 | |
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 257 | lemma admissible_disj_lemma: | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 258 | assumes A: "chain (op \<le>)A" | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 259 | assumes P: "\<forall>x\<in>A. \<exists>y\<in>A. x \<le> y \<and> P y" | 
| 46041 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 260 |   shows "Sup A = Sup {x \<in> A. P x}"
 | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 261 | proof (rule antisym) | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 262 |   have *: "chain (op \<le>) {x \<in> A. P x}"
 | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 263 | by (rule chain_compr [OF A]) | 
| 46041 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 264 |   show "Sup A \<le> Sup {x \<in> A. P x}"
 | 
| 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 265 | apply (rule ccpo_Sup_least [OF A]) | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 266 | apply (drule P [rule_format], clarify) | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 267 | apply (erule order_trans) | 
| 46041 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 268 | apply (simp add: ccpo_Sup_upper [OF *]) | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 269 | done | 
| 46041 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 270 |   show "Sup {x \<in> A. P x} \<le> Sup A"
 | 
| 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 271 | apply (rule ccpo_Sup_least [OF *]) | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 272 | apply clarify | 
| 46041 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 273 | apply (simp add: ccpo_Sup_upper [OF A]) | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 274 | done | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 275 | qed | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 276 | |
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 277 | lemma admissible_disj: | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 278 | fixes P Q :: "'a \<Rightarrow> bool" | 
| 53361 
1cb7d3c0cf31
move admissible out of class ccpo to avoid unnecessary class predicate in foundational theorems
 Andreas Lochbihler parents: 
46041diff
changeset | 279 | assumes P: "ccpo.admissible Sup (op \<le>) (\<lambda>x. P x)" | 
| 
1cb7d3c0cf31
move admissible out of class ccpo to avoid unnecessary class predicate in foundational theorems
 Andreas Lochbihler parents: 
46041diff
changeset | 280 | assumes Q: "ccpo.admissible Sup (op \<le>) (\<lambda>x. Q x)" | 
| 
1cb7d3c0cf31
move admissible out of class ccpo to avoid unnecessary class predicate in foundational theorems
 Andreas Lochbihler parents: 
46041diff
changeset | 281 | shows "ccpo.admissible Sup (op \<le>) (\<lambda>x. P x \<or> Q x)" | 
| 
1cb7d3c0cf31
move admissible out of class ccpo to avoid unnecessary class predicate in foundational theorems
 Andreas Lochbihler parents: 
46041diff
changeset | 282 | proof (rule ccpo.admissibleI) | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 283 | fix A :: "'a set" assume A: "chain (op \<le>) A" | 
| 54630 
9061af4d5ebc
restrict admissibility to non-empty chains to allow more syntax-directed proof rules
 Andreas Lochbihler parents: 
53361diff
changeset | 284 |   assume "A \<noteq> {}"
 | 
| 
9061af4d5ebc
restrict admissibility to non-empty chains to allow more syntax-directed proof rules
 Andreas Lochbihler parents: 
53361diff
changeset | 285 | and "\<forall>x\<in>A. P x \<or> Q x" | 
| 
9061af4d5ebc
restrict admissibility to non-empty chains to allow more syntax-directed proof rules
 Andreas Lochbihler parents: 
53361diff
changeset | 286 | hence "(\<exists>x\<in>A. P x) \<and> (\<forall>x\<in>A. \<exists>y\<in>A. x \<le> y \<and> P y) \<or> (\<exists>x\<in>A. Q x) \<and> (\<forall>x\<in>A. \<exists>y\<in>A. x \<le> y \<and> Q y)" | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 287 | using chainD[OF A] by blast | 
| 54630 
9061af4d5ebc
restrict admissibility to non-empty chains to allow more syntax-directed proof rules
 Andreas Lochbihler parents: 
53361diff
changeset | 288 |   hence "(\<exists>x. x \<in> A \<and> P x) \<and> Sup A = Sup {x \<in> A. P x} \<or> (\<exists>x. x \<in> A \<and> Q x) \<and> Sup A = Sup {x \<in> A. Q x}"
 | 
| 
9061af4d5ebc
restrict admissibility to non-empty chains to allow more syntax-directed proof rules
 Andreas Lochbihler parents: 
53361diff
changeset | 289 | using admissible_disj_lemma [OF A] by blast | 
| 46041 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 290 | thus "P (Sup A) \<or> Q (Sup A)" | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 291 | apply (rule disjE, simp_all) | 
| 54630 
9061af4d5ebc
restrict admissibility to non-empty chains to allow more syntax-directed proof rules
 Andreas Lochbihler parents: 
53361diff
changeset | 292 | apply (rule disjI1, rule ccpo.admissibleD [OF P chain_compr [OF A]], simp, simp) | 
| 
9061af4d5ebc
restrict admissibility to non-empty chains to allow more syntax-directed proof rules
 Andreas Lochbihler parents: 
53361diff
changeset | 293 | apply (rule disjI2, rule ccpo.admissibleD [OF Q chain_compr [OF A]], simp, simp) | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 294 | done | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 295 | qed | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 296 | |
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 297 | end | 
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 298 | |
| 46041 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 299 | instance complete_lattice \<subseteq> ccpo | 
| 61169 | 300 | by standard (fast intro: Sup_upper Sup_least)+ | 
| 46041 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 301 | |
| 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 302 | lemma lfp_eq_fixp: | 
| 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 303 | assumes f: "mono f" shows "lfp f = fixp f" | 
| 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 304 | proof (rule antisym) | 
| 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 305 | from f have f': "monotone (op \<le>) (op \<le>) f" | 
| 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 306 | unfolding mono_def monotone_def . | 
| 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 307 | show "lfp f \<le> fixp f" | 
| 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 308 | by (rule lfp_lowerbound, subst fixp_unfold [OF f'], rule order_refl) | 
| 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 309 | show "fixp f \<le> lfp f" | 
| 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 310 | by (rule fixp_lowerbound [OF f'], subst lfp_unfold [OF f], rule order_refl) | 
| 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 311 | qed | 
| 
1e3ff542e83e
remove constant 'ccpo.lub', re-use constant 'Sup' instead
 huffman parents: 
40252diff
changeset | 312 | |
| 53361 
1cb7d3c0cf31
move admissible out of class ccpo to avoid unnecessary class predicate in foundational theorems
 Andreas Lochbihler parents: 
46041diff
changeset | 313 | hide_const (open) iterates fixp | 
| 40106 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 314 | |
| 
c58951943cba
Complete_Partial_Order.thy: complete partial orders over arbitrary chains, with fixpoint theorem
 krauss parents: diff
changeset | 315 | end |