src/HOLCF/Cprod.thy
changeset 29530 9905b660612b
parent 29138 661a8db7e647
child 29535 08824fad8879
     1.1 --- a/src/HOLCF/Cprod.thy	Wed Jan 14 13:47:14 2009 -0800
     1.2 +++ b/src/HOLCF/Cprod.thy	Wed Jan 14 17:11:29 2009 -0800
     1.3 @@ -12,23 +12,6 @@
     1.4  
     1.5  subsection {* Type @{typ unit} is a pcpo *}
     1.6  
     1.7 -instantiation unit :: sq_ord
     1.8 -begin
     1.9 -
    1.10 -definition
    1.11 -  less_unit_def [simp]: "x \<sqsubseteq> (y::unit) \<equiv> True"
    1.12 -
    1.13 -instance ..
    1.14 -end
    1.15 -
    1.16 -instance unit :: discrete_cpo
    1.17 -by intro_classes simp
    1.18 -
    1.19 -instance unit :: finite_po ..
    1.20 -
    1.21 -instance unit :: pcpo
    1.22 -by intro_classes simp
    1.23 -
    1.24  definition
    1.25    unit_when :: "'a \<rightarrow> unit \<rightarrow> 'a" where
    1.26    "unit_when = (\<Lambda> a _. a)"
    1.27 @@ -39,165 +22,6 @@
    1.28  lemma unit_when [simp]: "unit_when\<cdot>a\<cdot>u = a"
    1.29  by (simp add: unit_when_def)
    1.30  
    1.31 -
    1.32 -subsection {* Product type is a partial order *}
    1.33 -
    1.34 -instantiation "*" :: (sq_ord, sq_ord) sq_ord
    1.35 -begin
    1.36 -
    1.37 -definition
    1.38 -  less_cprod_def: "(op \<sqsubseteq>) \<equiv> \<lambda>p1 p2. (fst p1 \<sqsubseteq> fst p2 \<and> snd p1 \<sqsubseteq> snd p2)"
    1.39 -
    1.40 -instance ..
    1.41 -end
    1.42 -
    1.43 -instance "*" :: (po, po) po
    1.44 -proof
    1.45 -  fix x :: "'a \<times> 'b"
    1.46 -  show "x \<sqsubseteq> x"
    1.47 -    unfolding less_cprod_def by simp
    1.48 -next
    1.49 -  fix x y :: "'a \<times> 'b"
    1.50 -  assume "x \<sqsubseteq> y" "y \<sqsubseteq> x" thus "x = y"
    1.51 -    unfolding less_cprod_def Pair_fst_snd_eq
    1.52 -    by (fast intro: antisym_less)
    1.53 -next
    1.54 -  fix x y z :: "'a \<times> 'b"
    1.55 -  assume "x \<sqsubseteq> y" "y \<sqsubseteq> z" thus "x \<sqsubseteq> z"
    1.56 -    unfolding less_cprod_def
    1.57 -    by (fast intro: trans_less)
    1.58 -qed
    1.59 -
    1.60 -subsection {* Monotonicity of @{text "(_,_)"}, @{term fst}, @{term snd} *}
    1.61 -
    1.62 -lemma prod_lessI: "\<lbrakk>fst p \<sqsubseteq> fst q; snd p \<sqsubseteq> snd q\<rbrakk> \<Longrightarrow> p \<sqsubseteq> q"
    1.63 -unfolding less_cprod_def by simp
    1.64 -
    1.65 -lemma Pair_less_iff [simp]: "(a, b) \<sqsubseteq> (c, d) = (a \<sqsubseteq> c \<and> b \<sqsubseteq> d)"
    1.66 -unfolding less_cprod_def by simp
    1.67 -
    1.68 -text {* Pair @{text "(_,_)"}  is monotone in both arguments *}
    1.69 -
    1.70 -lemma monofun_pair1: "monofun (\<lambda>x. (x, y))"
    1.71 -by (simp add: monofun_def)
    1.72 -
    1.73 -lemma monofun_pair2: "monofun (\<lambda>y. (x, y))"
    1.74 -by (simp add: monofun_def)
    1.75 -
    1.76 -lemma monofun_pair:
    1.77 -  "\<lbrakk>x1 \<sqsubseteq> x2; y1 \<sqsubseteq> y2\<rbrakk> \<Longrightarrow> (x1, y1) \<sqsubseteq> (x2, y2)"
    1.78 -by simp
    1.79 -
    1.80 -text {* @{term fst} and @{term snd} are monotone *}
    1.81 -
    1.82 -lemma monofun_fst: "monofun fst"
    1.83 -by (simp add: monofun_def less_cprod_def)
    1.84 -
    1.85 -lemma monofun_snd: "monofun snd"
    1.86 -by (simp add: monofun_def less_cprod_def)
    1.87 -
    1.88 -subsection {* Product type is a cpo *}
    1.89 -
    1.90 -lemma is_lub_Pair:
    1.91 -  "\<lbrakk>range X <<| x; range Y <<| y\<rbrakk> \<Longrightarrow> range (\<lambda>i. (X i, Y i)) <<| (x, y)"
    1.92 -apply (rule is_lubI [OF ub_rangeI])
    1.93 -apply (simp add: less_cprod_def is_ub_lub)
    1.94 -apply (frule ub2ub_monofun [OF monofun_fst])
    1.95 -apply (drule ub2ub_monofun [OF monofun_snd])
    1.96 -apply (simp add: less_cprod_def is_lub_lub)
    1.97 -done
    1.98 -
    1.99 -lemma lub_cprod:
   1.100 -  fixes S :: "nat \<Rightarrow> ('a::cpo \<times> 'b::cpo)"
   1.101 -  assumes S: "chain S"
   1.102 -  shows "range S <<| (\<Squnion>i. fst (S i), \<Squnion>i. snd (S i))"
   1.103 -proof -
   1.104 -  have "chain (\<lambda>i. fst (S i))"
   1.105 -    using monofun_fst S by (rule ch2ch_monofun)
   1.106 -  hence 1: "range (\<lambda>i. fst (S i)) <<| (\<Squnion>i. fst (S i))"
   1.107 -    by (rule cpo_lubI)
   1.108 -  have "chain (\<lambda>i. snd (S i))"
   1.109 -    using monofun_snd S by (rule ch2ch_monofun)
   1.110 -  hence 2: "range (\<lambda>i. snd (S i)) <<| (\<Squnion>i. snd (S i))"
   1.111 -    by (rule cpo_lubI)
   1.112 -  show "range S <<| (\<Squnion>i. fst (S i), \<Squnion>i. snd (S i))"
   1.113 -    using is_lub_Pair [OF 1 2] by simp
   1.114 -qed
   1.115 -
   1.116 -lemma thelub_cprod:
   1.117 -  "chain (S::nat \<Rightarrow> 'a::cpo \<times> 'b::cpo)
   1.118 -    \<Longrightarrow> (\<Squnion>i. S i) = (\<Squnion>i. fst (S i), \<Squnion>i. snd (S i))"
   1.119 -by (rule lub_cprod [THEN thelubI])
   1.120 -
   1.121 -instance "*" :: (cpo, cpo) cpo
   1.122 -proof
   1.123 -  fix S :: "nat \<Rightarrow> ('a \<times> 'b)"
   1.124 -  assume "chain S"
   1.125 -  hence "range S <<| (\<Squnion>i. fst (S i), \<Squnion>i. snd (S i))"
   1.126 -    by (rule lub_cprod)
   1.127 -  thus "\<exists>x. range S <<| x" ..
   1.128 -qed
   1.129 -
   1.130 -instance "*" :: (finite_po, finite_po) finite_po ..
   1.131 -
   1.132 -instance "*" :: (discrete_cpo, discrete_cpo) discrete_cpo
   1.133 -proof
   1.134 -  fix x y :: "'a \<times> 'b"
   1.135 -  show "x \<sqsubseteq> y \<longleftrightarrow> x = y"
   1.136 -    unfolding less_cprod_def Pair_fst_snd_eq
   1.137 -    by simp
   1.138 -qed
   1.139 -
   1.140 -subsection {* Product type is pointed *}
   1.141 -
   1.142 -lemma minimal_cprod: "(\<bottom>, \<bottom>) \<sqsubseteq> p"
   1.143 -by (simp add: less_cprod_def)
   1.144 -
   1.145 -instance "*" :: (pcpo, pcpo) pcpo
   1.146 -by intro_classes (fast intro: minimal_cprod)
   1.147 -
   1.148 -lemma inst_cprod_pcpo: "\<bottom> = (\<bottom>, \<bottom>)"
   1.149 -by (rule minimal_cprod [THEN UU_I, symmetric])
   1.150 -
   1.151 -
   1.152 -subsection {* Continuity of @{text "(_,_)"}, @{term fst}, @{term snd} *}
   1.153 -
   1.154 -lemma cont_pair1: "cont (\<lambda>x. (x, y))"
   1.155 -apply (rule contI)
   1.156 -apply (rule is_lub_Pair)
   1.157 -apply (erule cpo_lubI)
   1.158 -apply (rule lub_const)
   1.159 -done
   1.160 -
   1.161 -lemma cont_pair2: "cont (\<lambda>y. (x, y))"
   1.162 -apply (rule contI)
   1.163 -apply (rule is_lub_Pair)
   1.164 -apply (rule lub_const)
   1.165 -apply (erule cpo_lubI)
   1.166 -done
   1.167 -
   1.168 -lemma contlub_fst: "contlub fst"
   1.169 -apply (rule contlubI)
   1.170 -apply (simp add: thelub_cprod)
   1.171 -done
   1.172 -
   1.173 -lemma contlub_snd: "contlub snd"
   1.174 -apply (rule contlubI)
   1.175 -apply (simp add: thelub_cprod)
   1.176 -done
   1.177 -
   1.178 -lemma cont_fst: "cont fst"
   1.179 -apply (rule monocontlub2cont)
   1.180 -apply (rule monofun_fst)
   1.181 -apply (rule contlub_fst)
   1.182 -done
   1.183 -
   1.184 -lemma cont_snd: "cont snd"
   1.185 -apply (rule monocontlub2cont)
   1.186 -apply (rule monofun_snd)
   1.187 -apply (rule contlub_snd)
   1.188 -done
   1.189 -
   1.190  subsection {* Continuous versions of constants *}
   1.191  
   1.192  definition