SSL Distribution_Functions.thy
Interaktion und PortierbarkeitIsabelle
(* Title: HOL/Probability/Distribution_Functions.thy Authors: Jeremy Avigad (CMU) and Luke Serafin (CMU)
*)
section \<open>Distribution Functions\<close>
text\<open> Shows that the cumulative distribution function (cdf) of a distribution (a measure on the reals) is
nondecreasing and right continuous, which tends to 0 and 1 in either direction.
Conversely, every such functionis the cdf of a unique distribution. This direction defines the
measure in the obvious way on half-open intervals, andthen applies the Caratheodory extension theorem. \<close>
(* TODO: the locales "finite_borel_measure" and "real_distribution" are defined here, but maybe they
should be somewhere else. *)
theory Distribution_Functions imports Probability_Measure begin
lemma UN_Ioc_eq_UNIV: "(\n. { -real n <.. real n}) = UNIV" by auto
(metis le_less_trans minus_minus neg_less_iff_less not_le real_arch_simple
of_nat_0_le_iff reals_Archimedean2)
subsection \<open>Properties of cdf's\<close>
definition
cdf :: "real measure \ real \ real" where "cdf M \ \x. measure M {..x}"
lemma cdf_def2: "cdf M x = measure M {..x}" by (simp add: cdf_def)
locale finite_borel_measure = finite_measure M for M :: "real measure" + assumes M_is_borel: "sets M = sets borel" begin
lemma sets_M[intro]: "a \ sets borel \ a \ sets M" using M_is_borel by auto
lemma cdf_diff_eq: assumes"x < y" shows"cdf M y - cdf M x = measure M {x<..y}" proof - from assms have *: "{..x} \ {x<..y} = {..y}" by auto have"measure M {..y} = measure M {..x} + measure M {x<..y}" by (subst finite_measure_Union [symmetric], auto simp add: *) thus ?thesis unfolding cdf_def by auto qed
lemma cdf_nondecreasing: "x \ y \ cdf M x \ cdf M y" unfolding cdf_def by (auto intro!: finite_measure_mono)
lemma borel_UNIV: "space M = UNIV" by (metis in_mono sets.sets_into_space space_in_borel top_le M_is_borel)
lemma cdf_nonneg: "cdf M x \ 0" unfolding cdf_def by (rule measure_nonneg)
lemma cdf_bounded: "cdf M x \ measure M (space M)" unfolding cdf_def by (intro bounded_measure)
lemma cdf_lim_infty: "((\i. cdf M (real i)) \ measure M (space M))" proof - have"(\i. cdf M (real i)) \ measure M (\ i::nat. {..real i})" unfolding cdf_def by (rule finite_Lim_measure_incseq) (auto simp: incseq_def) alsohave"(\ i::nat. {..real i}) = space M" by (auto simp: borel_UNIV intro: real_arch_simple) finallyshow ?thesis . qed
lemma cdf_lim_at_top: "(cdf M \ measure M (space M)) at_top" by (rule tendsto_at_topI_sequentially_real)
(simp_all add: mono_def cdf_nondecreasing cdf_lim_infty)
lemma cdf_lim_neg_infty: "((\i. cdf M (- real i)) \ 0)" proof - have"(\i. cdf M (- real i)) \ measure M (\ i::nat. {.. - real i })" unfolding cdf_def by (rule finite_Lim_measure_decseq) (auto simp: decseq_def) alsohave"(\ i::nat. {..- real i}) = {}" by auto (metis leD le_minus_iff reals_Archimedean2) finallyshow ?thesis by simp qed
lemma cdf_lim_at_bot: "(cdf M \ 0) at_bot" proof - have *: "((\x :: real. - cdf M (- x)) \ 0) at_top" by (intro tendsto_at_topI_sequentially_real monoI)
(auto simp: cdf_nondecreasing cdf_lim_neg_infty tendsto_minus_cancel_left[symmetric]) from filterlim_compose [OF *, OF filterlim_uminus_at_top_at_bot] show ?thesis unfolding tendsto_minus_cancel_left[symmetric] by simp qed
lemma cdf_is_right_cont: "continuous (at_right a) (cdf M)" unfolding continuous_within proof (rule tendsto_at_right_sequentially[where b="a + 1"]) fix f :: "nat \ real" and x assume f: "decseq f" "f \ a" thenhave"(\n. cdf M (f n)) \ measure M (\i. {.. f i})" using\<open>decseq f\<close> unfolding cdf_def by (intro finite_Lim_measure_decseq) (auto simp: decseq_def) alsohave"(\i. {.. f i}) = {.. a}" using decseq_ge[OF f] by (auto intro: order_trans LIMSEQ_le_const[OF f(2)]) finallyshow"(\n. cdf M (f n)) \ cdf M a" by (simp add: cdf_def) qed simp