# HG changeset patch # User huffman # Date 1198001731 -3600 # Node ID 7025a263aa490cd282c0819e4eee14fb9580d1ba # Parent cbb59ba6bf0c1f2cc70cd76d7e081c1eabfb6eac rearrange into subsections diff -r cbb59ba6bf0c -r 7025a263aa49 src/HOLCF/Porder.thy --- a/src/HOLCF/Porder.thy Tue Dec 18 18:39:00 2007 +0100 +++ b/src/HOLCF/Porder.thy Tue Dec 18 19:15:31 2007 +0100 @@ -56,9 +56,7 @@ sq_ord_less_eq_trans sq_ord_eq_less_trans -subsection {* Chains and least upper bounds *} - -text {* class definitions *} +subsection {* Least upper bounds *} definition is_ub :: "['a set, 'a::po] \ bool" (infixl "<|" 55) where @@ -69,25 +67,6 @@ "(S <<| x) = (S <| x \ (\u. S <| u \ x \ u))" definition - -- {* Arbitrary chains are total orders *} - tord :: "'a::po set \ bool" where - "tord S = (\x y. x \ S \ y \ S \ (x \ y \ y \ x))" - -definition - -- {* Here we use countable chains and I prefer to code them as functions! *} - chain :: "(nat \ 'a::po) \ bool" where - "chain F = (\i. F i \ F (Suc i))" - -definition - -- {* finite chains, needed for monotony of continuous functions *} - max_in_chain :: "[nat, nat \ 'a::po] \ bool" where - "max_in_chain i C = (\j. i \ j \ C i = C j)" - -definition - finite_chain :: "(nat \ 'a::po) \ bool" where - "finite_chain C = (chain C \ (\i. max_in_chain i C))" - -definition lub :: "'a set \ 'a::po" where "lub S = (THE x. S <<| x)" @@ -106,28 +85,6 @@ apply (blast intro: antisym_less) done -text {* chains are monotone functions *} - -lemma chain_mono [rule_format]: "chain F \ x < y \ F x \ F y" -apply (unfold chain_def) -apply (induct_tac y) -apply simp -apply (blast elim: less_SucE intro: trans_less) -done - -lemma chain_mono3: "\chain F; x \ y\ \ F x \ F y" -apply (drule le_imp_less_or_eq) -apply (blast intro: chain_mono) -done - -text {* The range of a chain is a totally ordered *} - -lemma chain_tord: "chain F \ tord (range F)" -apply (unfold tord_def, clarify) -apply (rule nat_less_cases) -apply (fast intro: chain_mono)+ -done - text {* technical lemmas about @{term lub} and @{term is_lub} *} lemma lubI: "M <<| x \ M <<| lub M" @@ -154,6 +111,27 @@ lemma is_lubI: "\S <| x; \u. S <| u \ x \ u\ \ S <<| x" by (unfold is_lub_def, fast) +subsection {* Countable chains *} + +definition + -- {* Here we use countable chains and I prefer to code them as functions! *} + chain :: "(nat \ 'a::po) \ bool" where + "chain F = (\i. F i \ F (Suc i))" + +text {* chains are monotone functions *} + +lemma chain_mono [rule_format]: "chain F \ x < y \ F x \ F y" +apply (unfold chain_def) +apply (induct_tac y) +apply simp +apply (blast elim: less_SucE intro: trans_less) +done + +lemma chain_mono3: "\chain F; x \ y\ \ F x \ F y" +apply (drule le_imp_less_or_eq) +apply (blast intro: chain_mono) +done + lemma chainE: "chain F \ F i \ F (Suc i)" by (unfold chain_def, simp) @@ -193,6 +171,60 @@ "chain S \ range (\i. S (i + j)) <<| x = range S <<| x" by (simp add: is_lub_def is_ub_range_shift) +text {* the lub of a constant chain is the constant *} + +lemma chain_const [simp]: "chain (\i. c)" +by (simp add: chainI) + +lemma lub_const: "range (\x. c) <<| c" +by (blast dest: ub_rangeD intro: is_lubI ub_rangeI) + +lemma thelub_const [simp]: "(\i. c) = c" +by (rule lub_const [THEN thelubI]) + +subsection {* Totally ordered sets *} + +definition + -- {* Arbitrary chains are total orders *} + tord :: "'a::po set \ bool" where + "tord S = (\x y. x \ S \ y \ S \ (x \ y \ y \ x))" + +text {* The range of a chain is a totally ordered *} + +lemma chain_tord: "chain F \ tord (range F)" +apply (unfold tord_def, clarify) +apply (rule nat_less_cases) +apply (fast intro: chain_mono)+ +done + +lemma finite_tord_has_max [rule_format]: + "finite S \ S \ {} \ tord S \ (\y\S. \x\S. x \ y)" + apply (erule finite_induct, simp) + apply (rename_tac a S, clarify) + apply (case_tac "S = {}", simp) + apply (drule (1) mp) + apply (drule mp, simp add: tord_def) + apply (erule bexE, rename_tac z) + apply (subgoal_tac "a \ z \ z \ a") + apply (erule disjE) + apply (rule_tac x="z" in bexI, simp, simp) + apply (rule_tac x="a" in bexI) + apply (clarsimp elim!: rev_trans_less) + apply simp + apply (simp add: tord_def) +done + +subsection {* Finite chains *} + +definition + -- {* finite chains, needed for monotony of continuous functions *} + max_in_chain :: "[nat, nat \ 'a::po] \ bool" where + "max_in_chain i C = (\j. i \ j \ C i = C j)" + +definition + finite_chain :: "(nat \ 'a::po) \ bool" where + "finite_chain C = (chain C \ (\i. max_in_chain i C))" + text {* results about finite chains *} lemma lub_finch1: "\chain C; max_in_chain i C\ \ range C <<| C i" @@ -226,23 +258,6 @@ apply fast done -lemma finite_tord_has_max [rule_format]: - "finite S \ S \ {} \ tord S \ (\y\S. \x\S. x \ y)" - apply (erule finite_induct, simp) - apply (rename_tac a S, clarify) - apply (case_tac "S = {}", simp) - apply (drule (1) mp) - apply (drule mp, simp add: tord_def) - apply (erule bexE, rename_tac z) - apply (subgoal_tac "a \ z \ z \ a") - apply (erule disjE) - apply (rule_tac x="z" in bexI, simp, simp) - apply (rule_tac x="a" in bexI) - apply (clarsimp elim!: rev_trans_less) - apply simp - apply (simp add: tord_def) -done - lemma finite_range_imp_finch: "\chain Y; finite (range Y)\ \ finite_chain Y" apply (subgoal_tac "\y\range Y. \x\range Y. x \ y") @@ -274,15 +289,4 @@ 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) -text {* the lub of a constant chain is the constant *} - -lemma chain_const [simp]: "chain (\i. c)" -by (simp add: chainI) - -lemma lub_const: "range (\x. c) <<| c" -by (blast dest: ub_rangeD intro: is_lubI ub_rangeI) - -lemma thelub_const [simp]: "(\i. c) = c" -by (rule lub_const [THEN thelubI]) - end