# HG changeset patch # User paulson # Date 1426614303 0 # Node ID f41a2f77ab1b84b1827d6f62d2dcc581bbe85a3b # Parent cd945dc13becbb37f6477d43d2296ac3dbefcaec Inserted real_of_nat to fix factorial-related problem diff -r cd945dc13bec -r f41a2f77ab1b src/HOL/Probability/Distributions.thy --- a/src/HOL/Probability/Distributions.thy Tue Mar 17 15:11:25 2015 +0000 +++ b/src/HOL/Probability/Distributions.thy Tue Mar 17 17:45:03 2015 +0000 @@ -78,9 +78,8 @@ proof - let ?f = "\k x. x^k * exp (-x) / fact k" let ?F = "\k x. - (\n\k. (x^n * exp (-x)) / fact n)" - - have "?I * (inverse (fact k)) = - (\\<^sup>+x. ereal (x^k * exp (-x)) * indicator {0 .. a} x * (inverse (fact k)) \lborel)" + have "?I * (inverse (real_of_nat (fact k))) = + (\\<^sup>+x. ereal (x^k * exp (-x)) * indicator {0 .. a} x * (inverse (real_of_nat (fact k))) \lborel)" by (intro nn_integral_multc[symmetric]) auto also have "\ = (\\<^sup>+x. ereal (?f k x) * indicator {0 .. a} x \lborel)" apply (intro nn_integral_cong) @@ -114,7 +113,7 @@ qed lemma nn_intergal_power_times_exp_Ici: - shows "(\\<^sup>+x. ereal (x^k * exp (-x)) * indicator {0 ..} x \lborel) = fact k" + shows "(\\<^sup>+x. ereal (x^k * exp (-x)) * indicator {0 ..} x \lborel) = real_of_nat (fact k)" proof (rule LIMSEQ_unique) let ?X = "\n. \\<^sup>+ x. ereal (x^k * exp (-x)) * indicator {0 .. real n} x \lborel" show "?X ----> (\\<^sup>+x. ereal (x^k * exp (-x)) * indicator {0 ..} x \lborel)" @@ -127,7 +126,7 @@ have "((\x::real. (1 - (\n\k. (x ^ n / exp x) / (fact n))) * fact k) ---> (1 - (\n\k. 0 / (fact n))) * fact k) at_top" by (intro tendsto_intros tendsto_power_div_exp_0) simp - then show "?X ----> fact k" + then show "?X ----> real_of_nat (fact k)" by (subst nn_intergal_power_times_exp_Icc) (auto simp: exp_minus field_simps intro!: filterlim_compose[OF _ filterlim_real_sequentially]) qed