diff -r 04f4b6e55620 -r 8281047b896d src/HOL/Analysis/Measurable.thy --- a/src/HOL/Analysis/Measurable.thy Mon Apr 14 20:42:03 2025 +0200 +++ b/src/HOL/Analysis/Measurable.thy Tue Apr 15 15:30:21 2025 +0100 @@ -278,21 +278,12 @@ unfolding measurable_count_space_eq2_countable proof safe fix n - - { fix x assume "\i. \n\i. P n x" - then have "infinite {i. P i x}" - unfolding infinite_nat_iff_unbounded_le by auto - then have "Max {i. P i x} = the None" - by (rule Max.infinite) } - note 1 = this - - { fix x i j assume "P i x" "\n\j. \ P n x" - then have "finite {i. P i x}" - by (auto simp: subset_eq not_le[symmetric] finite_nat_iff_bounded) - with \P i x\ have "P (Max {i. P i x}) x" "i \ Max {i. P i x}" "finite {i. P i x}" - using Max_in[of "{i. P i x}"] by auto } - note 2 = this - + have 1: "Max {i. P i x} = the None" if "\i. \n\i. P n x" for x + by (simp add: Max.infinite infinite_nat_iff_unbounded_le that) + have 2: "finite {i. P i x}" if "\n\j. \ P n x" for j x + by (metis bounded_nat_set_is_finite leI mem_Collect_eq that) + have 3: "P (Max {i. P i x}) x" "i \ Max {i. P i x}" if "P i x" "\n\j. \ P n x" for x i j + using that 2 Max_in[of "{i. P i x}"] by auto have "(\x. Max {i. P i x}) -` {n} \ space M = {x\space M. Max {i. P i x} = n}" by auto also have "\ = @@ -300,7 +291,7 @@ if (\i. P i x) then P n x \ (\i>n. \ P i x) else Max {} = n}" by (intro arg_cong[where f=Collect] ext conj_cong) - (auto simp add: 1 2 not_le[symmetric] intro!: Max_eqI) + (auto simp add: 1 2 3 not_le[symmetric] intro!: Max_eqI) also have "\ \ sets M" by measurable finally show "(\x. Max {i. P i x}) -` {n} \ space M \ sets M" . @@ -313,20 +304,12 @@ unfolding measurable_count_space_eq2_countable proof safe fix n - - { fix x assume "\i. \n\i. P n x" - then have "infinite {i. P i x}" - unfolding infinite_nat_iff_unbounded_le by auto - then have "Min {i. P i x} = the None" - by (rule Min.infinite) } - note 1 = this - - { fix x i j assume "P i x" "\n\j. \ P n x" - then have "finite {i. P i x}" - by (auto simp: subset_eq not_le[symmetric] finite_nat_iff_bounded) - with \P i x\ have "P (Min {i. P i x}) x" "Min {i. P i x} \ i" "finite {i. P i x}" - using Min_in[of "{i. P i x}"] by auto } - note 2 = this + have 1: "Min {i. P i x} = the None" if "\i. \n\i. P n x" for x + by (simp add: Min.infinite infinite_nat_iff_unbounded_le that) + have 2: "finite {i. P i x}" if "\n\j. \ P n x" for j x + by (metis bounded_nat_set_is_finite leI mem_Collect_eq that) + have 3: "P (Min {i. P i x}) x" "i \ Min {i. P i x}" if "P i x" "\n\j. \ P n x" for x i j + using that 2 Min_in[of "{i. P i x}"] by auto have "(\x. Min {i. P i x}) -` {n} \ space M = {x\space M. Min {i. P i x} = n}" by auto @@ -335,7 +318,7 @@ if (\i. P i x) then P n x \ (\i P i x) else Min {} = n}" by (intro arg_cong[where f=Collect] ext conj_cong) - (auto simp add: 1 2 not_le[symmetric] intro!: Min_eqI) + (auto simp add: 1 2 3 not_le[symmetric] intro!: Min_eqI) also have "\ \ sets M" by measurable finally show "(\x. Min {i. P i x}) -` {n} \ space M \ sets M" . @@ -365,7 +348,7 @@ next case (Suc i) then have "(\x. card (S x)) -` {n} \ space M = - (\F\{A\{A. finite A}. card A = n}. {x\space M. (\i. i \ S x \ i \ F)})" + (\F\{A\{A. finite A}. card A = n}. {x\space M. (\i. i \ S x \ i \ F)})" unfolding set_eq_iff[symmetric] Collect_bex_eq[symmetric] by (auto intro: card_ge_0_finite) also have "\ \ sets M" by (intro sets.countable_UN' countable_Collect countable_Collect_finite) auto @@ -398,7 +381,7 @@ proof (safe intro!: UNIV_I) fix a have "(\x. SUP i\I. F i x) -` {a} \ space M = - {x\space M. (\i\I. F i x \ a) \ (\b. (\i\I. F i x \ b) \ a \ b)}" + {x\space M. (\i\I. F i x \ a) \ (\b. (\i\I. F i x \ b) \ a \ b)}" unfolding SUP_le_iff[symmetric] by auto also have "\ \ sets M" by measurable @@ -414,7 +397,7 @@ proof (safe intro!: UNIV_I) fix a have "(\x. INF i\I. F i x) -` {a} \ space M = - {x\space M. (\i\I. a \ F i x) \ (\b. (\i\I. b \ F i x) \ b \ a)}" + {x\space M. (\i\I. a \ F i x) \ (\b. (\i\I. b \ F i x) \ b \ a)}" unfolding le_INF_iff[symmetric] by auto also have "\ \ sets M" by measurable @@ -428,8 +411,8 @@ assumes *: "\M A. P M \ (\N. P N \ A \ measurable N (count_space UNIV)) \ F A \ measurable M (count_space UNIV)" shows "lfp F \ measurable M (count_space UNIV)" proof - - { fix i from \P M\ have "((F ^^ i) bot) \ measurable M (count_space UNIV)" - by (induct i arbitrary: M) (auto intro!: *) } + have "((F ^^ i) bot) \ measurable M (count_space UNIV)" for i + using \P M\ by (induct i arbitrary: M) (auto intro!: *) then have "(\x. SUP i. (F ^^ i) bot x) \ measurable M (count_space UNIV)" by measurable also have "(\x. SUP i. (F ^^ i) bot x) = lfp F" @@ -451,8 +434,8 @@ assumes *: "\M A. P M \ (\N. P N \ A \ measurable N (count_space UNIV)) \ F A \ measurable M (count_space UNIV)" shows "gfp F \ measurable M (count_space UNIV)" proof - - { fix i from \P M\ have "((F ^^ i) top) \ measurable M (count_space UNIV)" - by (induct i arbitrary: M) (auto intro!: *) } + have "((F ^^ i) top) \ measurable M (count_space UNIV)" for i + using \P M\ by (induct i arbitrary: M) (auto intro!: *) then have "(\x. INF i. (F ^^ i) top x) \ measurable M (count_space UNIV)" by measurable also have "(\x. INF i. (F ^^ i) top x) = gfp F" @@ -474,8 +457,8 @@ assumes *: "\M A s. P M s \ (\N t. P N t \ A t \ measurable N (count_space UNIV)) \ F A s \ measurable M (count_space UNIV)" shows "lfp F s \ measurable M (count_space UNIV)" proof - - { fix i from \P M s\ have "(\x. (F ^^ i) bot s x) \ measurable M (count_space UNIV)" - by (induct i arbitrary: M s) (auto intro!: *) } + have "(\x. (F ^^ i) bot s x) \ measurable M (count_space UNIV)" for i + using \P M s\ by (induct i arbitrary: M s) (auto intro!: *) then have "(\x. SUP i. (F ^^ i) bot s x) \ measurable M (count_space UNIV)" by measurable also have "(\x. SUP i. (F ^^ i) bot s x) = lfp F s" @@ -490,8 +473,8 @@ assumes *: "\M A s. P M s \ (\N t. P N t \ A t \ measurable N (count_space UNIV)) \ F A s \ measurable M (count_space UNIV)" shows "gfp F s \ measurable M (count_space UNIV)" proof - - { fix i from \P M s\ have "(\x. (F ^^ i) top s x) \ measurable M (count_space UNIV)" - by (induct i arbitrary: M s) (auto intro!: *) } + have "(\x. (F ^^ i) top s x) \ measurable M (count_space UNIV)" for i + using \P M s\ by (induct i arbitrary: M s) (auto intro!: *) then have "(\x. INF i. (F ^^ i) top s x) \ measurable M (count_space UNIV)" by measurable also have "(\x. INF i. (F ^^ i) top s x) = gfp F s" @@ -511,35 +494,34 @@ fix a :: enat have "f -` {a} \ space M = {x\space M. f x = a}" by auto - { fix i :: nat - from \R f\ have "Measurable.pred M (\x. f x = enat i)" - proof (induction i arbitrary: f) - case 0 - from *[OF this] obtain g h i P - where f: "f = (\x. if P x then h x else eSuc (g (i x)))" and - [measurable]: "Measurable.pred M P" "i \ measurable M M" "h \ measurable M (count_space UNIV)" - by auto - have "Measurable.pred M (\x. P x \ h x = 0)" - by measurable - also have "(\x. P x \ h x = 0) = (\x. f x = enat 0)" - by (auto simp: f zero_enat_def[symmetric]) - finally show ?case . - next - case (Suc n) - from *[OF Suc.prems] obtain g h i P - where f: "f = (\x. if P x then h x else eSuc (g (i x)))" and "R g" and - M[measurable]: "Measurable.pred M P" "i \ measurable M M" "h \ measurable M (count_space UNIV)" - by auto - have "(\x. f x = enat (Suc n)) = + have "Measurable.pred M (\x. f x = enat i)" for i + using \R f\ + proof (induction i arbitrary: f) + case 0 + from *[OF this] obtain g h i P + where f: "f = (\x. if P x then h x else eSuc (g (i x)))" and + [measurable]: "Measurable.pred M P" "i \ measurable M M" "h \ measurable M (count_space UNIV)" + by auto + have "Measurable.pred M (\x. P x \ h x = 0)" + by measurable + also have "(\x. P x \ h x = 0) = (\x. f x = enat 0)" + by (auto simp: f zero_enat_def[symmetric]) + finally show ?case . + next + case (Suc n) + from *[OF Suc.prems] obtain g h i P + where f: "f = (\x. if P x then h x else eSuc (g (i x)))" and "R g" and + M[measurable]: "Measurable.pred M P" "i \ measurable M M" "h \ measurable M (count_space UNIV)" + by auto + have "(\x. f x = enat (Suc n)) = (\x. (P x \ h x = enat (Suc n)) \ (\ P x \ g (i x) = enat n))" - by (auto simp: f zero_enat_def[symmetric] eSuc_enat[symmetric]) - also have "Measurable.pred M \" - by (intro pred_intros_logic measurable_compose[OF M(2)] Suc \R g\) measurable - finally show ?case . - qed - then have "f -` {enat i} \ space M \ sets M" - by (simp add: pred_def Int_def conj_commute) } - note fin = this + by (auto simp: f zero_enat_def[symmetric] eSuc_enat[symmetric]) + also have "Measurable.pred M \" + by (intro pred_intros_logic measurable_compose[OF M(2)] Suc \R g\) measurable + finally show ?case . + qed + then have fin: "f -` {enat i} \ space M \ sets M" for i + by (simp add: pred_def Int_def conj_commute) show "f -` {a} \ space M \ sets M" proof (cases a) case infinity @@ -562,16 +544,12 @@ fix X define f where "f x = (THE i. P i x)" for x define undef where "undef = (THE i::'a. False)" - { fix i x assume "x \ space M" "P i x" then have "f x = i" - unfolding f_def using unique by auto } - note f_eq = this - { fix x assume "x \ space M" "\i\I. \ P i x" - then have "\i. \ P i x" - using I(2)[of x] by auto - then have "f x = undef" - by (auto simp: undef_def f_def) } - then have "f -` X \ space M = (\i\I \ X. {x\space M. P i x}) \ - (if undef \ X then space M - (\i\I. {x\space M. P i x}) else {})" + have f_eq: "f x = i" if "x \ space M" "P i x" for i x + unfolding f_def using unique that by auto + have "f x = undef" if "x \ space M" "\i\I. \ P i x" for x + using that I f_def undef_def by moura + then have "f -` X \ space M = + (\i\I \ X. {x\space M. P i x}) \ (if undef \ X then space M - (\i\I. {x\space M. P i x}) else {})" by (auto dest: f_eq) also have "\ \ sets M" by (auto intro!: sets.Diff sets.countable_UN') @@ -628,7 +606,7 @@ have P_f: "{x \ space M. P (f x)} \ sets M" unfolding pred_def[symmetric] by (rule measurable_compose[OF f]) simp have "pred (restrict_space M {x\space M. P (f x)}) (\x. Q (f x) x)" - proof (rule measurable_compose_countable'[where g=f, OF _ _ P]) + proof (rule measurable_compose_countable'[OF _ _ P]) show "f \ restrict_space M {x\space M. P (f x)} \\<^sub>M count_space {i. P i}" by (rule measurable_count_space_extend[OF subset_UNIV]) (auto simp: space_restrict_space intro!: measurable_restrict_space1 f)