(* Title: HOL/Analysis/Measurable.thy
Author: Johannes Hölzl
*)
theory Measurable
imports
Sigma_Algebra
"~~/src/HOL/Library/Order_Continuity"
begin
subsection \Measurability prover\
lemma (in algebra) sets_Collect_finite_All:
assumes "\i. i \ S \ {x\\. P i x} \ M" "finite S"
shows "{x\\. \i\S. P i x} \ M"
proof -
have "{x\\. \i\S. P i x} = (if S = {} then \ else \i\S. {x\\. P i x})"
by auto
with assms show ?thesis by (auto intro!: sets_Collect_finite_All')
qed
abbreviation "pred M P \ P \ measurable M (count_space (UNIV::bool set))"
lemma pred_def: "pred M P \ {x\space M. P x} \ sets M"
proof
assume "pred M P"
then have "P -` {True} \ space M \ sets M"
by (auto simp: measurable_count_space_eq2)
also have "P -` {True} \ space M = {x\space M. P x}" by auto
finally show "{x\space M. P x} \ sets M" .
next
assume P: "{x\space M. P x} \ sets M"
moreover
{ fix X
have "X \ Pow (UNIV :: bool set)" by simp
then have "P -` X \ space M = {x\space M. ((X = {True} \ P x) \ (X = {False} \ \ P x) \ X \ {})}"
unfolding UNIV_bool Pow_insert Pow_empty by auto
then have "P -` X \ space M \ sets M"
by (auto intro!: sets.sets_Collect_neg sets.sets_Collect_imp sets.sets_Collect_conj sets.sets_Collect_const P) }
then show "pred M P"
by (auto simp: measurable_def)
qed
lemma pred_sets1: "{x\space M. P x} \ sets M \ f \ measurable N M \ pred N (\x. P (f x))"
by (rule measurable_compose[where f=f and N=M]) (auto simp: pred_def)
lemma pred_sets2: "A \ sets N \ f \ measurable M N \ pred M (\x. f x \ A)"
by (rule measurable_compose[where f=f and N=N]) (auto simp: pred_def Int_def[symmetric])
ML_file "measurable.ML"
attribute_setup measurable = \
Scan.lift (
(Args.add >> K true || Args.del >> K false || Scan.succeed true) --
Scan.optional (Args.parens (
Scan.optional (Args.$$$ "raw" >> K true) false --
Scan.optional (Args.$$$ "generic" >> K Measurable.Generic) Measurable.Concrete))
(false, Measurable.Concrete) >>
Measurable.measurable_thm_attr)
\ "declaration of measurability theorems"
attribute_setup measurable_dest = Measurable.dest_thm_attr
"add dest rule to measurability prover"
attribute_setup measurable_cong = Measurable.cong_thm_attr
"add congurence rules to measurability prover"
method_setup measurable = \ Scan.lift (Scan.succeed (METHOD o Measurable.measurable_tac)) \
"measurability prover"
simproc_setup measurable ("A \ sets M" | "f \ measurable M N") = \K Measurable.simproc\
setup \
Global_Theory.add_thms_dynamic (@{binding measurable}, Measurable.get_all)
\
declare
pred_sets1[measurable_dest]
pred_sets2[measurable_dest]
sets.sets_into_space[measurable_dest]
declare
sets.top[measurable]
sets.empty_sets[measurable (raw)]
sets.Un[measurable (raw)]
sets.Diff[measurable (raw)]
declare
measurable_count_space[measurable (raw)]
measurable_ident[measurable (raw)]
measurable_id[measurable (raw)]
measurable_const[measurable (raw)]
measurable_If[measurable (raw)]
measurable_comp[measurable (raw)]
measurable_sets[measurable (raw)]
declare measurable_cong_sets[measurable_cong]
declare sets_restrict_space_cong[measurable_cong]
declare sets_restrict_UNIV[measurable_cong]
lemma predE[measurable (raw)]:
"pred M P \ {x\space M. P x} \ sets M"
unfolding pred_def .
lemma pred_intros_imp'[measurable (raw)]:
"(K \ pred M (\x. P x)) \ pred M (\x. K \ P x)"
by (cases K) auto
lemma pred_intros_conj1'[measurable (raw)]:
"(K \ pred M (\x. P x)) \ pred M (\x. K \ P x)"
by (cases K) auto
lemma pred_intros_conj2'[measurable (raw)]:
"(K \ pred M (\x. P x)) \ pred M (\x. P x \ K)"
by (cases K) auto
lemma pred_intros_disj1'[measurable (raw)]:
"(\ K \ pred M (\x. P x)) \ pred M (\x. K \ P x)"
by (cases K) auto
lemma pred_intros_disj2'[measurable (raw)]:
"(\ K \ pred M (\x. P x)) \ pred M (\x. P x \ K)"
by (cases K) auto
lemma pred_intros_logic[measurable (raw)]:
"pred M (\x. x \ space M)"
"pred M (\x. P x) \ pred M (\x. \ P x)"
"pred M (\x. Q x) \ pred M (\x. P x) \ pred M (\x. Q x \ P x)"
"pred M (\x. Q x) \ pred M (\x. P x) \ pred M (\x. Q x \ P x)"
"pred M (\x. Q x) \ pred M (\x. P x) \ pred M (\x. Q x \ P x)"
"pred M (\x. Q x) \ pred M (\x. P x) \ pred M (\x. Q x = P x)"
"pred M (\x. f x \ UNIV)"
"pred M (\x. f x \ {})"
"pred M (\x. P' (f x) x) \ pred M (\x. f x \ {y. P' y x})"
"pred M (\x. f x \ (B x)) \ pred M (\x. f x \ - (B x))"
"pred M (\x. f x \ (A x)) \ pred M (\x. f x \ (B x)) \ pred M (\x. f x \ (A x) - (B x))"
"pred M (\x. f x \ (A x)) \ pred M (\x. f x \ (B x)) \ pred M (\x. f x \ (A x) \ (B x))"
"pred M (\x. f x \ (A x)) \ pred M (\x. f x \ (B x)) \ pred M (\x. f x \ (A x) \ (B x))"
"pred M (\x. g x (f x) \ (X x)) \ pred M (\x. f x \ (g x) -` (X x))"
by (auto simp: iff_conv_conj_imp pred_def)
lemma pred_intros_countable[measurable (raw)]:
fixes P :: "'a \ 'i :: countable \ bool"
shows
"(\i. pred M (\x. P x i)) \ pred M (\x. \i. P x i)"
"(\i. pred M (\x. P x i)) \ pred M (\x. \i. P x i)"
by (auto intro!: sets.sets_Collect_countable_All sets.sets_Collect_countable_Ex simp: pred_def)
lemma pred_intros_countable_bounded[measurable (raw)]:
fixes X :: "'i :: countable set"
shows
"(\i. i \ X \ pred M (\x. x \ N x i)) \ pred M (\x. x \ (\i\X. N x i))"
"(\i. i \ X \ pred M (\x. x \ N x i)) \ pred M (\x. x \ (\i\X. N x i))"
"(\i. i \ X \ pred M (\x. P x i)) \ pred M (\x. \i\X. P x i)"
"(\i. i \ X \ pred M (\x. P x i)) \ pred M (\x. \i\X. P x i)"
by simp_all (auto simp: Bex_def Ball_def)
lemma pred_intros_finite[measurable (raw)]:
"finite I \ (\i. i \ I \ pred M (\x. x \ N x i)) \ pred M (\x. x \ (\i\I. N x i))"
"finite I \ (\i. i \ I \ pred M (\x. x \ N x i)) \ pred M (\x. x \ (\i\I. N x i))"
"finite I \ (\i. i \ I \ pred M (\x. P x i)) \ pred M (\x. \i\I. P x i)"
"finite I \ (\i. i \ I \ pred M (\