src/HOLCF/Porder.thy
changeset 25131 2c8caac48ade
parent 24728 e2b3a1065676
child 25695 7025a263aa49
equal deleted inserted replaced
25130:d91391a8705b 25131:2c8caac48ade
    20 notation (xsymbols)
    20 notation (xsymbols)
    21   sq_le (infixl "\<sqsubseteq>" 55)
    21   sq_le (infixl "\<sqsubseteq>" 55)
    22 
    22 
    23 axclass po < sq_ord
    23 axclass po < sq_ord
    24   refl_less [iff]: "x \<sqsubseteq> x"
    24   refl_less [iff]: "x \<sqsubseteq> x"
    25   antisym_less:    "\<lbrakk>x \<sqsubseteq> y; y \<sqsubseteq> x\<rbrakk> \<Longrightarrow> x = y"    
    25   antisym_less:    "\<lbrakk>x \<sqsubseteq> y; y \<sqsubseteq> x\<rbrakk> \<Longrightarrow> x = y"
    26   trans_less:      "\<lbrakk>x \<sqsubseteq> y; y \<sqsubseteq> z\<rbrakk> \<Longrightarrow> x \<sqsubseteq> z"
    26   trans_less:      "\<lbrakk>x \<sqsubseteq> y; y \<sqsubseteq> z\<rbrakk> \<Longrightarrow> x \<sqsubseteq> z"
    27 
    27 
    28 text {* minimal fixes least element *}
    28 text {* minimal fixes least element *}
    29 
    29 
    30 lemma minimal2UU[OF allI] : "\<forall>x::'a::po. uu \<sqsubseteq> x \<Longrightarrow> uu = (THE u. \<forall>y. u \<sqsubseteq> y)"
    30 lemma minimal2UU[OF allI] : "\<forall>x::'a::po. uu \<sqsubseteq> x \<Longrightarrow> uu = (THE u. \<forall>y. u \<sqsubseteq> y)"
    56   sq_ord_less_eq_trans
    56   sq_ord_less_eq_trans
    57   sq_ord_eq_less_trans
    57   sq_ord_eq_less_trans
    58 
    58 
    59 subsection {* Chains and least upper bounds *}
    59 subsection {* Chains and least upper bounds *}
    60 
    60 
    61 constdefs  
    61 text {* class definitions *}
    62 
    62 
    63   -- {* class definitions *}
    63 definition
    64   is_ub :: "['a set, 'a::po] \<Rightarrow> bool"       (infixl "<|" 55)
    64   is_ub :: "['a set, 'a::po] \<Rightarrow> bool"  (infixl "<|" 55)  where
    65   "S <| x \<equiv> \<forall>y. y \<in> S \<longrightarrow> y \<sqsubseteq> x"
    65   "(S <| x) = (\<forall>y. y \<in> S \<longrightarrow> y \<sqsubseteq> x)"
    66 
    66 
    67   is_lub :: "['a set, 'a::po] \<Rightarrow> bool"       (infixl "<<|" 55)
    67 definition
    68   "S <<| x \<equiv> S <| x \<and> (\<forall>u. S <| u \<longrightarrow> x \<sqsubseteq> u)"
    68   is_lub :: "['a set, 'a::po] \<Rightarrow> bool"  (infixl "<<|" 55)  where
    69 
    69   "(S <<| x) = (S <| x \<and> (\<forall>u. S <| u \<longrightarrow> x \<sqsubseteq> u))"
       
    70 
       
    71 definition
    70   -- {* Arbitrary chains are total orders *}
    72   -- {* Arbitrary chains are total orders *}
    71   tord :: "'a::po set \<Rightarrow> bool"
    73   tord :: "'a::po set \<Rightarrow> bool" where
    72   "tord S \<equiv> \<forall>x y. x \<in> S \<and> y \<in> S \<longrightarrow> (x \<sqsubseteq> y \<or> y \<sqsubseteq> x)"
    74   "tord S = (\<forall>x y. x \<in> S \<and> y \<in> S \<longrightarrow> (x \<sqsubseteq> y \<or> y \<sqsubseteq> x))"
    73 
    75 
       
    76 definition
    74   -- {* Here we use countable chains and I prefer to code them as functions! *}
    77   -- {* Here we use countable chains and I prefer to code them as functions! *}
    75   chain :: "(nat \<Rightarrow> 'a::po) \<Rightarrow> bool"
    78   chain :: "(nat \<Rightarrow> 'a::po) \<Rightarrow> bool" where
    76   "chain F \<equiv> \<forall>i. F i \<sqsubseteq> F (Suc i)"
    79   "chain F = (\<forall>i. F i \<sqsubseteq> F (Suc i))"
    77 
    80 
       
    81 definition
    78   -- {* finite chains, needed for monotony of continuous functions *}
    82   -- {* finite chains, needed for monotony of continuous functions *}
    79   max_in_chain :: "[nat, nat \<Rightarrow> 'a::po] \<Rightarrow> bool"
    83   max_in_chain :: "[nat, nat \<Rightarrow> 'a::po] \<Rightarrow> bool" where
    80   "max_in_chain i C \<equiv> \<forall>j. i \<le> j \<longrightarrow> C i = C j" 
    84   "max_in_chain i C = (\<forall>j. i \<le> j \<longrightarrow> C i = C j)"
    81 
    85 
    82   finite_chain :: "(nat \<Rightarrow> 'a::po) \<Rightarrow> bool"
    86 definition
    83   "finite_chain C \<equiv> chain(C) \<and> (\<exists>i. max_in_chain i C)"
    87   finite_chain :: "(nat \<Rightarrow> 'a::po) \<Rightarrow> bool" where
    84 
    88   "finite_chain C = (chain C \<and> (\<exists>i. max_in_chain i C))"
    85   lub :: "'a set \<Rightarrow> 'a::po"
    89 
    86   "lub S \<equiv> THE x. S <<| x"
    90 definition
       
    91   lub :: "'a set \<Rightarrow> 'a::po" where
       
    92   "lub S = (THE x. S <<| x)"
    87 
    93 
    88 abbreviation
    94 abbreviation
    89   Lub  (binder "LUB " 10) where
    95   Lub  (binder "LUB " 10) where
    90   "LUB n. t n == lub (range t)"
    96   "LUB n. t n == lub (range t)"
    91 
    97 
   121 apply (rule nat_less_cases)
   127 apply (rule nat_less_cases)
   122 apply (fast intro: chain_mono)+
   128 apply (fast intro: chain_mono)+
   123 done
   129 done
   124 
   130 
   125 text {* technical lemmas about @{term lub} and @{term is_lub} *}
   131 text {* technical lemmas about @{term lub} and @{term is_lub} *}
   126 
       
   127 lemmas lub = lub_def [THEN meta_eq_to_obj_eq, standard]
       
   128 
   132 
   129 lemma lubI: "M <<| x \<Longrightarrow> M <<| lub M"
   133 lemma lubI: "M <<| x \<Longrightarrow> M <<| lub M"
   130 apply (unfold lub_def)
   134 apply (unfold lub_def)
   131 apply (rule theI)
   135 apply (rule theI)
   132 apply assumption
   136 apply assumption
   199 apply simp
   203 apply simp
   200 apply (erule (1) chain_mono3)
   204 apply (erule (1) chain_mono3)
   201 apply (erule ub_rangeD)
   205 apply (erule ub_rangeD)
   202 done
   206 done
   203 
   207 
   204 lemma lub_finch2: 
   208 lemma lub_finch2:
   205         "finite_chain C \<Longrightarrow> range C <<| C (LEAST i. max_in_chain i C)"
   209         "finite_chain C \<Longrightarrow> range C <<| C (LEAST i. max_in_chain i C)"
   206 apply (unfold finite_chain_def)
   210 apply (unfold finite_chain_def)
   207 apply (erule conjE)
   211 apply (erule conjE)
   208 apply (erule LeastI2_ex)
   212 apply (erule LeastI2_ex)
   209 apply (erule (1) lub_finch1)
   213 apply (erule (1) lub_finch1)