# HG changeset patch # User wenzelm # Date 1358432268 -3600 # Node ID 917e76c53f827eca3249cf8843dc051a96bc7eae # Parent a076e01b803f7cc84d9468a030c877e9ae44f127 tuned proofs; diff -r a076e01b803f -r 917e76c53f82 src/HOL/Multivariate_Analysis/Integration.thy --- a/src/HOL/Multivariate_Analysis/Integration.thy Thu Jan 17 14:15:10 2013 +0100 +++ b/src/HOL/Multivariate_Analysis/Integration.thy Thu Jan 17 15:17:48 2013 +0100 @@ -89,7 +89,8 @@ case True show ?thesis apply (rule assms[OF Suc(1)[OF True]]) - using `?r` apply auto + using `?r` + apply auto done next case False @@ -241,7 +242,8 @@ thus ?thesis apply (rule_tac x=i in bexI, rule_tac x=x in exI, rule_tac x="min d e" in exI) unfolding ab - using interval_open_subset_closed[of a b] and e apply fastforce+ + using interval_open_subset_closed[of a b] and e + apply fastforce+ done next case False @@ -285,8 +287,10 @@ done also have "\ < \e\ / 2 + \e\ / 2" apply (rule add_strict_left_mono) - using as unfolding mem_ball dist_norm - using e apply (auto simp add: field_simps) + using as + unfolding mem_ball dist_norm + using e + apply (auto simp add: field_simps) done finally show "y\ball x e" unfolding mem_ball dist_norm using e by (auto simp add:field_simps) @@ -415,7 +419,8 @@ assumes "{a..b}\{}" shows "content {a..b} = (\i\Basis. b\i - a\i)" apply (rule content_closed_interval) - using assms unfolding interval_ne_empty + using assms + unfolding interval_ne_empty apply assumption done @@ -533,10 +538,10 @@ unfolding content_def unfolding interval_bounds[OF ab_ne] interval_bounds[OF cd_ne] unfolding if_not_P[OF False] if_not_P[OF `{c..d} \ {}`] - apply(rule setprod_mono,rule) + apply (rule setprod_mono, rule) proof fix i :: 'a - assume i:"i\Basis" + assume i: "i\Basis" show "0 \ b \ i - a \ i" using ab_ne[THEN bspec, OF i] i by auto show "b \ i - a \ i \ d \ i - c \ i" using assms[unfolded subset_eq mem_interval,rule_format,OF ab_ab(2),of i] @@ -620,7 +625,10 @@ assume "s = {{a}}" moreover fix k assume "k\s" ultimately have"\x y. k = {x..y}" - apply (rule_tac x=a in exI)+ unfolding interval_sing by auto + apply (rule_tac x=a in exI)+ + unfolding interval_sing + apply auto + done } ultimately show ?l unfolding division_of_def interval_sing by auto next @@ -671,9 +679,9 @@ assumes "content {a..b} = 0" "d division_of {a..b}" shows "\k\d. content k = 0" unfolding forall_in_division[OF assms(2)] - apply(rule,rule,rule) - apply(drule division_ofD(2)[OF assms(2)]) - apply(drule content_subset) unfolding assms(1) + apply (rule,rule,rule) + apply (drule division_ofD(2)[OF assms(2)]) + apply (drule content_subset) unfolding assms(1) proof - case goal1 thus ?case using content_pos_le[of a b] by auto @@ -748,7 +756,9 @@ lemma elementary_inter: assumes "p1 division_of s" "p2 division_of (t::('a::ordered_euclidean_space) set)" shows "\p. p division_of (s \ t)" - by (rule, rule division_inter[OF assms]) + apply rule + apply (rule division_inter[OF assms]) + done lemma elementary_inters: assumes "finite f" "f\{}" "\s\f. \p. p division_of (s::('a::ordered_euclidean_space) set)" @@ -775,21 +785,41 @@ lemma division_disjoint_union: assumes "p1 division_of s1" "p2 division_of s2" "interior s1 \ interior s2 = {}" - shows "(p1 \ p2) division_of (s1 \ s2)" proof(rule division_ofI) + shows "(p1 \ p2) division_of (s1 \ s2)" +proof (rule division_ofI) note d1 = division_ofD[OF assms(1)] and d2 = division_ofD[OF assms(2)] show "finite (p1 \ p2)" using d1(1) d2(1) by auto show "\(p1 \ p2) = s1 \ s2" using d1(6) d2(6) by auto - { fix k1 k2 assume as:"k1 \ p1 \ p2" "k2 \ p1 \ p2" "k1 \ k2" moreover let ?g="interior k1 \ interior k2 = {}" - { assume as:"k1\p1" "k2\p2" have ?g using interior_mono[OF d1(2)[OF as(1)]] interior_mono[OF d2(2)[OF as(2)]] - using assms(3) by blast } moreover - { assume as:"k1\p2" "k2\p1" have ?g using interior_mono[OF d1(2)[OF as(2)]] interior_mono[OF d2(2)[OF as(1)]] - using assms(3) by blast} ultimately - show ?g using d1(5)[OF _ _ as(3)] and d2(5)[OF _ _ as(3)] by auto } - fix k assume k:"k \ p1 \ p2" show "k \ s1 \ s2" using k d1(2) d2(2) by auto - show "k \ {}" using k d1(3) d2(3) by auto show "\a b. k = {a..b}" using k d1(4) d2(4) by auto qed + { + fix k1 k2 + assume as: "k1 \ p1 \ p2" "k2 \ p1 \ p2" "k1 \ k2" + moreover + let ?g="interior k1 \ interior k2 = {}" + { + assume as: "k1\p1" "k2\p2" + have ?g + using interior_mono[OF d1(2)[OF as(1)]] interior_mono[OF d2(2)[OF as(2)]] + using assms(3) by blast + } + moreover + { + assume as: "k1\p2" "k2\p1" + have ?g + using interior_mono[OF d1(2)[OF as(2)]] interior_mono[OF d2(2)[OF as(1)]] + using assms(3) by blast + } + ultimately show ?g using d1(5)[OF _ _ as(3)] and d2(5)[OF _ _ as(3)] by auto + } + fix k + assume k: "k \ p1 \ p2" + show "k \ s1 \ s2" using k d1(2) d2(2) by auto + show "k \ {}" using k d1(3) d2(3) by auto + show "\a b. k = {a..b}" using k d1(4) d2(4) by auto +qed lemma partial_division_extend_1: - assumes incl: "{c..d} \ {a..b::'a::ordered_euclidean_space}" and nonempty: "{c..d} \ {}" + assumes incl: "{c..d} \ {a..b::'a::ordered_euclidean_space}" + and nonempty: "{c..d} \ {}" obtains p where "p division_of {a..b}" "{c..d} \ p" proof let ?B = "\f::'a\'a \ 'a. {(\i\Basis. (fst (f i) \ i) *\<^sub>R i) .. (\i\Basis. (snd (f i) \ i) *\<^sub>R i)}" @@ -800,52 +830,61 @@ by (auto simp add: interval_eq_empty eucl_le[where 'a='a] intro!: image_eqI[where x="\(i::'a)\Basis. (c, d)"]) - { fix i :: 'a assume "i \ Basis" + { + fix i :: 'a + assume "i \ Basis" with incl nonempty have "a \ i \ c \ i" "c \ i \ d \ i" "d \ i \ b \ i" - unfolding interval_eq_empty subset_interval by (auto simp: not_le) } + unfolding interval_eq_empty subset_interval by (auto simp: not_le) + } note ord = this show "p division_of {a..b}" proof (rule division_ofI) - show "finite p" - unfolding p_def by (auto intro!: finite_PiE) - { fix k assume "k \ p" + show "finite p" unfolding p_def by (auto intro!: finite_PiE) + { + fix k + assume "k \ p" then obtain f where f: "f \ Basis \\<^isub>E {(a, c), (c, d), (d, b)}" and k: "k = ?B f" by (auto simp: p_def) then show "\a b. k = {a..b}" by auto have "k \ {a..b} \ k \ {}" proof (simp add: k interval_eq_empty subset_interval not_less, safe) fix i :: 'a assume i: "i \ Basis" - moreover with f have "f i = (a, c) \ f i = (c, d) \ f i = (d, b)" + moreover + with f have "f i = (a, c) \ f i = (c, d) \ f i = (d, b)" by (auto simp: PiE_iff) moreover note ord[of i] - ultimately show "a \ i \ fst (f i) \ i" "snd (f i) \ i \ b \ i" "fst (f i) \ i \ snd (f i) \ i" + ultimately + show "a \ i \ fst (f i) \ i" "snd (f i) \ i \ b \ i" "fst (f i) \ i \ snd (f i) \ i" by (auto simp: subset_iff eucl_le[where 'a='a]) qed then show "k \ {}" "k \ {a .. b}" by auto - { - fix l assume "l \ p" - then obtain g where g: "g \ Basis \\<^isub>E {(a, c), (c, d), (d, b)}" and l: "l = ?B g" - by (auto simp: p_def) - assume "l \ k" - have "\i\Basis. f i \ g i" - proof (rule ccontr) - assume "\ (\i\Basis. f i \ g i)" - with f g have "f = g" - by (auto simp: PiE_iff extensional_def intro!: ext) - with `l \ k` show False - by (simp add: l k) - qed - then guess i .. - moreover then have "f i = (a, c) \ f i = (c, d) \ f i = (d, b)" - "g i = (a, c) \ g i = (c, d) \ g i = (d, b)" - using f g by (auto simp: PiE_iff) - moreover note ord[of i] - ultimately show "interior l \ interior k = {}" - by (auto simp add: l k interior_closed_interval disjoint_interval intro!: bexI[of _ i]) } - note `k \ { a.. b}` } + { + fix l assume "l \ p" + then obtain g where g: "g \ Basis \\<^isub>E {(a, c), (c, d), (d, b)}" and l: "l = ?B g" + by (auto simp: p_def) + assume "l \ k" + have "\i\Basis. f i \ g i" + proof (rule ccontr) + assume "\ (\i\Basis. f i \ g i)" + with f g have "f = g" + by (auto simp: PiE_iff extensional_def intro!: ext) + with `l \ k` show False + by (simp add: l k) + qed + then guess i .. note * = this + moreover from * have "f i = (a, c) \ f i = (c, d) \ f i = (d, b)" + "g i = (a, c) \ g i = (c, d) \ g i = (d, b)" + using f g by (auto simp: PiE_iff) + moreover note ord[of i] + ultimately show "interior l \ interior k = {}" + by (auto simp add: l k interior_closed_interval disjoint_interval intro!: bexI[of _ i]) + } + note `k \ { a.. b}` + } moreover - { fix x assume x: "x \ {a .. b}" + { + fix x assume x: "x \ {a .. b}" have "\i\Basis. \l. x \ i \ {fst l \ i .. snd l \ i} \ l \ {(a, c), (c, d), (d, b)}" proof fix i :: 'a assume "i \ Basis" @@ -868,61 +907,164 @@ qed qed -lemma partial_division_extend_interval: assumes "p division_of (\p)" "(\p) \ {a..b}" - obtains q where "p \ q" "q division_of {a..b::'a::ordered_euclidean_space}" proof(cases "p = {}") - case True guess q apply(rule elementary_interval[of a b]) . - thus ?thesis apply- apply(rule that[of q]) unfolding True by auto next - case False note p = division_ofD[OF assms(1)] - have *:"\k\p. \q. q division_of {a..b} \ k\q" proof case goal1 - guess c using p(4)[OF goal1] .. then guess d .. note "cd" = this - have *:"{c..d} \ {a..b}" "{c..d} \ {}" using p(2,3)[OF goal1, unfolded "cd"] using assms(2) by auto - guess q apply(rule partial_division_extend_1[OF *]) . thus ?case unfolding "cd" by auto qed +lemma partial_division_extend_interval: + assumes "p division_of (\p)" "(\p) \ {a..b}" + obtains q where "p \ q" "q division_of {a..b::'a::ordered_euclidean_space}" +proof (cases "p = {}") + case True + guess q apply (rule elementary_interval[of a b]) . + thus ?thesis + apply - + apply (rule that[of q]) + unfolding True + apply auto + done +next + case False + note p = division_ofD[OF assms(1)] + have *: "\k\p. \q. q division_of {a..b} \ k\q" + proof + case goal1 + guess c using p(4)[OF goal1] .. + then guess d .. note "cd" = this + have *: "{c..d} \ {a..b}" "{c..d} \ {}" + using p(2,3)[OF goal1, unfolded "cd"] using assms(2) by auto + guess q apply(rule partial_division_extend_1[OF *]) . + thus ?case unfolding "cd" by auto + qed guess q using bchoice[OF *] .. note q = conjunctD2[OF this[rule_format]] - have "\x. x\p \ \d. d division_of \(q x - {x})" apply(rule,rule_tac p="q x" in division_of_subset) proof- - fix x assume x:"x\p" show "q x division_of \q x" apply-apply(rule division_ofI) - using division_ofD[OF q(1)[OF x]] by auto show "q x - {x} \ q x" by auto qed - hence "\d. d division_of \ ((\i. \(q i - {i})) ` p)" apply- apply(rule elementary_inters) - apply(rule finite_imageI[OF p(1)]) unfolding image_is_empty apply(rule False) by auto + have "\x. x\p \ \d. d division_of \(q x - {x})" + apply (rule, rule_tac p="q x" in division_of_subset) + proof - + fix x + assume x: "x\p" + show "q x division_of \q x" + apply - + apply (rule division_ofI) + using division_ofD[OF q(1)[OF x]] + apply auto + done + show "q x - {x} \ q x" by auto + qed + hence "\d. d division_of \ ((\i. \(q i - {i})) ` p)" + apply - + apply (rule elementary_inters) + apply (rule finite_imageI[OF p(1)]) + unfolding image_is_empty + apply (rule False) + apply auto + done then guess d .. note d = this - show ?thesis apply(rule that[of "d \ p"]) proof- - have *:"\s f t. s \ {} \ (\i\s. f i \ i = t) \ t = \ (f ` s) \ (\s)" by auto - have *:"{a..b} = \ (\i. \(q i - {i})) ` p \ \p" apply(rule *[OF False]) proof fix i assume i:"i\p" - show "\(q i - {i}) \ i = {a..b}" using division_ofD(6)[OF q(1)[OF i]] using q(2)[OF i] by auto qed - show "d \ p division_of {a..b}" unfolding * apply(rule division_disjoint_union[OF d assms(1)]) - apply(rule inter_interior_unions_intervals) apply(rule p open_interior ballI)+ proof(assumption,rule) - fix k assume k:"k\p" have *:"\u t s. u \ s \ s \ t = {} \ u \ t = {}" by auto - show "interior (\(\i. \(q i - {i})) ` p) \ interior k = {}" apply(rule *[of _ "interior (\(q k - {k}))"]) - defer apply(subst Int_commute) apply(rule inter_interior_unions_intervals) proof- note qk=division_ofD[OF q(1)[OF k]] - show "finite (q k - {k})" "open (interior k)" "\t\q k - {k}. \a b. t = {a..b}" using qk by auto - show "\t\q k - {k}. interior k \ interior t = {}" using qk(5) using q(2)[OF k] by auto - have *:"\x s. x \ s \ \s \ x" by auto show "interior (\(\i. \(q i - {i})) ` p) \ interior (\(q k - {k}))" - apply(rule interior_mono *)+ using k by auto qed qed qed auto qed + show ?thesis + apply (rule that[of "d \ p"]) + proof - + have *: "\s f t. s \ {} \ (\i\s. f i \ i = t) \ t = \ (f ` s) \ (\s)" by auto + have *: "{a..b} = \ (\i. \(q i - {i})) ` p \ \p" + apply (rule *[OF False]) + proof + fix i + assume i: "i\p" + show "\(q i - {i}) \ i = {a..b}" + using division_ofD(6)[OF q(1)[OF i]] using q(2)[OF i] by auto + qed + show "d \ p division_of {a..b}" + unfolding * + apply (rule division_disjoint_union[OF d assms(1)]) + apply (rule inter_interior_unions_intervals) + apply (rule p open_interior ballI)+ + proof (assumption, rule) + fix k + assume k: "k\p" + have *: "\u t s. u \ s \ s \ t = {} \ u \ t = {}" by auto + show "interior (\(\i. \(q i - {i})) ` p) \ interior k = {}" + apply (rule *[of _ "interior (\(q k - {k}))"]) + defer + apply (subst Int_commute) + apply (rule inter_interior_unions_intervals) + proof - + note qk=division_ofD[OF q(1)[OF k]] + show "finite (q k - {k})" "open (interior k)" + "\t\q k - {k}. \a b. t = {a..b}" using qk by auto + show "\t\q k - {k}. interior k \ interior t = {}" + using qk(5) using q(2)[OF k] by auto + have *: "\x s. x \ s \ \s \ x" by auto + show "interior (\(\i. \(q i - {i})) ` p) \ interior (\(q k - {k}))" + apply (rule interior_mono *)+ + using k by auto + qed + qed + qed auto +qed lemma elementary_bounded[dest]: "p division_of s \ bounded (s::('a::ordered_euclidean_space) set)" unfolding division_of_def by(metis bounded_Union bounded_interval) lemma elementary_subset_interval: "p division_of s \ \a b. s \ {a..b::'a::ordered_euclidean_space}" - by(meson elementary_bounded bounded_subset_closed_interval) - -lemma division_union_intervals_exists: assumes "{a..b::'a::ordered_euclidean_space} \ {}" - obtains p where "(insert {a..b} p) division_of ({a..b} \ {c..d})" proof(cases "{c..d} = {}") - case True show ?thesis apply(rule that[of "{}"]) unfolding True using assms by auto next - case False note false=this show ?thesis proof(cases "{a..b} \ {c..d} = {}") - have *:"\a b. {a,b} = {a} \ {b}" by auto - case True show ?thesis apply(rule that[of "{{c..d}}"]) unfolding * apply(rule division_disjoint_union) - using false True assms using interior_subset by auto next - case False obtain u v where uv:"{a..b} \ {c..d} = {u..v}" unfolding inter_interval by auto - have *:"{u..v} \ {c..d}" using uv by auto - guess p apply(rule partial_division_extend_1[OF * False[unfolded uv]]) . note p=this division_ofD[OF this(1)] - have *:"{a..b} \ {c..d} = {a..b} \ \(p - {{u..v}})" "\x s. insert x s = {x} \ s" using p(8) unfolding uv[THEN sym] by auto - show thesis apply(rule that[of "p - {{u..v}}"]) unfolding *(1) apply(subst *(2)) apply(rule division_disjoint_union) - apply(rule,rule assms) apply(rule division_of_subset[of p]) apply(rule division_of_union_self[OF p(1)]) defer - unfolding interior_inter[THEN sym] proof- - have *:"\cd p uv ab. p \ cd \ ab \ cd = uv \ ab \ p = uv \ p" by auto - have "interior ({a..b} \ \(p - {{u..v}})) = interior({u..v} \ \(p - {{u..v}}))" - apply(rule arg_cong[of _ _ interior]) apply(rule *[OF _ uv]) using p(8) by auto - also have "\ = {}" unfolding interior_inter apply(rule inter_interior_unions_intervals) using p(6) p(7)[OF p(2)] p(3) by auto - finally show "interior ({a..b} \ \(p - {{u..v}})) = {}" by assumption qed auto qed qed + by (meson elementary_bounded bounded_subset_closed_interval) + +lemma division_union_intervals_exists: + assumes "{a..b::'a::ordered_euclidean_space} \ {}" + obtains p where "(insert {a..b} p) division_of ({a..b} \ {c..d})" +proof (cases "{c..d} = {}") + case True + show ?thesis + apply (rule that[of "{}"]) + unfolding True + using assms + apply auto + done +next + case False + note false=this + show ?thesis + proof (cases "{a..b} \ {c..d} = {}") + case True + have *:"\a b. {a,b} = {a} \ {b}" by auto + show ?thesis + apply (rule that[of "{{c..d}}"]) + unfolding * + apply (rule division_disjoint_union) + using false True assms + using interior_subset + apply auto + done + next + case False + obtain u v where uv: "{a..b} \ {c..d} = {u..v}" + unfolding inter_interval by auto + have *: "{u..v} \ {c..d}" using uv by auto + guess p apply (rule partial_division_extend_1[OF * False[unfolded uv]]) . + note p=this division_ofD[OF this(1)] + have *: "{a..b} \ {c..d} = {a..b} \ \(p - {{u..v}})" "\x s. insert x s = {x} \ s" + using p(8) unfolding uv[THEN sym] by auto + show ?thesis + apply (rule that[of "p - {{u..v}}"]) + unfolding *(1) + apply (subst *(2)) + apply (rule division_disjoint_union) + apply (rule, rule assms) + apply (rule division_of_subset[of p]) + apply (rule division_of_union_self[OF p(1)]) + defer + unfolding interior_inter[THEN sym] + proof - + have *: "\cd p uv ab. p \ cd \ ab \ cd = uv \ ab \ p = uv \ p" by auto + have "interior ({a..b} \ \(p - {{u..v}})) = interior({u..v} \ \(p - {{u..v}}))" + apply (rule arg_cong[of _ _ interior]) + apply (rule *[OF _ uv]) + using p(8) + apply auto + done + also have "\ = {}" + unfolding interior_inter + apply (rule inter_interior_unions_intervals) + using p(6) p(7)[OF p(2)] p(3) + apply auto + done + finally show "interior ({a..b} \ \(p - {{u..v}})) = {}" . + qed auto + qed +qed lemma division_of_unions: assumes "finite f" "\p. p\f \ p division_of (\p)" "\k1 k2. \k1 \ \f; k2 \ \f; k1 \ k2\ \ interior k1 \ interior k2 = {}"