# HG changeset patch # User huffman # Date 1199287069 -3600 # Node ID 0d585d7567452c579d15cfbddb58a80b16a0eacc # Parent 940429bb074315ecb4af898865bb79b80e3f06d2 new section for directed sets diff -r 940429bb0743 -r 0d585d756745 src/HOLCF/Porder.thy --- a/src/HOLCF/Porder.thy Wed Jan 02 15:39:42 2008 +0100 +++ b/src/HOLCF/Porder.thy Wed Jan 02 16:17:49 2008 +0100 @@ -1,6 +1,6 @@ (* Title: HOLCF/Porder.thy ID: $Id$ - Author: Franz Regensburger + Author: Franz Regensburger and Brian Huffman *) header {* Partial orders *} @@ -289,4 +289,81 @@ lemma lub_chain_maxelem: "\Y i = c; \i. Y i \ c\ \ lub (range Y) = c" by (blast dest: ub_rangeD intro: thelubI is_lubI ub_rangeI) +subsection {* Directed sets *} + +definition + directed :: "'a::po set \ bool" where + "directed S = ((\x. x \ S) \ (\x\S. \y\S. \z\S. x \ z \ y \ z))" + +lemma directedI: + assumes 1: "\z. z \ S" + assumes 2: "\x y. \x \ S; y \ S\ \ \z\S. x \ z \ y \ z" + shows "directed S" +unfolding directed_def using prems by fast + +lemma directedD1: "directed S \ \z. z \ S" +unfolding directed_def by fast + +lemma directedD2: "\directed S; x \ S; y \ S\ \ \z\S. x \ z \ y \ z" +unfolding directed_def by fast + +lemma directed_finiteI: + assumes U: "\U. \finite U; U \ S\ \ \z\S. \x\U. x \ z" + shows "directed S" +proof (rule directedI) + have "finite {}" and "{} \ S" by simp_all + hence "\z\S. \x\{}. x \ z" by (rule U) + thus "\z. z \ S" by simp +next + fix x y + assume "x \ S" and "y \ S" + hence "finite {x, y}" and "{x, y} \ S" by simp_all + hence "\z\S. \x\{x, y}. x \ z" by (rule U) + thus "\z\S. x \ z \ y \ z" by simp +qed + +lemma directed_finiteD: + assumes S: "directed S" + assumes U: "finite U" + assumes "U \ S" + shows "\z\S. \x\U. x \ z" +proof - + from U have "U \ S \ \z\S. \x\U. x \ z" + proof (induct set: finite) + case empty + from S have "\z. z \ S" by (rule directedD1) + thus "\z\S. \x\{}. x \ z" by simp + next + case (insert x F) + from `insert x F \ S` + have xS: "x \ S" and FS: "F \ S" by simp_all + from FS have "\y\S. \a\F. a \ y" by fact + then obtain y where yS: "y \ S" and Fy: "\a\F. a \ y" .. + from directedD2 [OF S xS yS] + obtain z where zS: "z \ S" and xz: "x \ z" and yz: "y \ z" by fast + from Fy yz have "\a\F. a \ z" by (fast elim: trans_less) + with xz have "\a\insert x F. a \ z" by simp + with zS show "\z\S. \a\insert x F. a \ z" .. + qed + thus ?thesis using prems by fast +qed + +lemma not_directed_empty: "\ directed {}" +by (rule notI, drule directedD1, simp) + +lemma directed_singleton: "directed {x}" +by (rule directedI, auto) + +lemma directed_bin: "x \ y \ directed {x, y}" +by (rule directedI, auto) + +lemma directed_chain: "chain S \ directed (range S)" +apply (rule directedI) +apply (rule_tac x="S 0" in exI, simp) +apply (clarify, rename_tac m n) +apply (rule_tac x="S (max m n)" in bexI) +apply (simp add: chain_mono3) +apply simp +done + end