src/HOL/Probability/Borel.thy
changeset 35704 5007843dae33
parent 35692 f1315bbf1bc9
child 35748 5f35613d9a65
equal deleted inserted replaced
35703:29cb504abbb5 35704:5007843dae33
   184       by (simp add: borel_measurable_le_iff 0 1) 
   184       by (simp add: borel_measurable_le_iff 0 1) 
   185 qed
   185 qed
   186 
   186 
   187 definition
   187 definition
   188   nat_to_rat_surj :: "nat \<Rightarrow> rat" where
   188   nat_to_rat_surj :: "nat \<Rightarrow> rat" where
   189  "nat_to_rat_surj n = (let (i,j) = nat_to_nat2 n
   189  "nat_to_rat_surj n = (let (i,j) = prod_decode n
   190                        in Fract (nat_to_int_bij i) (nat_to_int_bij j))"
   190                        in Fract (int_decode i) (int_decode j))"
   191 
   191 
   192 lemma nat_to_rat_surj: "surj nat_to_rat_surj"
   192 lemma nat_to_rat_surj: "surj nat_to_rat_surj"
   193 proof (auto simp add: surj_def nat_to_rat_surj_def) 
   193 proof (auto simp add: surj_def nat_to_rat_surj_def) 
   194   fix y
   194   fix y
   195   show "\<exists>x. y = (\<lambda>(i, j). Fract (nat_to_int_bij i) (nat_to_int_bij j)) (nat_to_nat2 x)"
   195   show "\<exists>x. y = (\<lambda>(i, j). Fract (int_decode i) (int_decode j)) (prod_decode x)"
   196   proof (cases y)
   196   proof (cases y)
   197     case (Fract a b)
   197     case (Fract a b)
   198       obtain i where i: "nat_to_int_bij i = a" using surj_nat_to_int_bij
   198       obtain i where i: "int_decode i = a" using surj_int_decode
   199         by (metis surj_def) 
   199         by (metis surj_def) 
   200       obtain j where j: "nat_to_int_bij j = b" using surj_nat_to_int_bij
   200       obtain j where j: "int_decode j = b" using surj_int_decode
   201         by (metis surj_def)
   201         by (metis surj_def)
   202       obtain n where n: "nat_to_nat2 n = (i,j)" using nat_to_nat2_surj
   202       obtain n where n: "prod_decode n = (i,j)" using surj_prod_decode
   203         by (metis surj_def)
   203         by (metis surj_def)
   204 
   204 
   205       from Fract i j n show ?thesis
   205       from Fract i j n show ?thesis
   206         by (metis prod.cases prod_case_split)
   206         by (metis prod.cases prod_case_split)
   207   qed
   207   qed