3059 d2 fine p\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, k) \<in> p. content k *\<^sub>R f x) - j) < e / 2" |
3059 d2 fine p\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, k) \<in> p. content k *\<^sub>R f x) - j) < e / 2" |
3060 apply (rule has_integralD[OF fj[unfolded interval_split[OF k]] e]) |
3060 apply (rule has_integralD[OF fj[unfolded interval_split[OF k]] e]) |
3061 apply (simp add: interval_split[symmetric] k) |
3061 apply (simp add: interval_split[symmetric] k) |
3062 done |
3062 done |
3063 let ?d = "\<lambda>x. if x\<bullet>k = c then (d1 x \<inter> d2 x) else ball x (abs(x\<bullet>k - c)) \<inter> d1 x \<inter> d2 x" |
3063 let ?d = "\<lambda>x. if x\<bullet>k = c then (d1 x \<inter> d2 x) else ball x (abs(x\<bullet>k - c)) \<inter> d1 x \<inter> d2 x" |
3064 show ?case |
3064 have "gauge ?d" |
3065 apply (rule_tac x="?d" in exI) |
3065 using d1 d2 unfolding gauge_def by auto |
3066 apply rule |
3066 then show ?case |
3067 defer |
3067 proof (rule_tac x="?d" in exI, safe) |
3068 apply rule |
|
3069 apply rule |
|
3070 apply (elim conjE) |
|
3071 proof - |
|
3072 show "gauge ?d" |
|
3073 using d1(1) d2(1) unfolding gauge_def by auto |
|
3074 fix p |
3068 fix p |
3075 assume "p tagged_division_of (cbox a b)" "?d fine p" |
3069 assume "p tagged_division_of (cbox a b)" "?d fine p" |
3076 note p = this tagged_division_ofD[OF this(1)] |
3070 note p = this tagged_division_ofD[OF this(1)] |
3077 have xk_le_c: "\<And>x kk. (x, kk) \<in> p \<Longrightarrow> kk \<inter> {x. x\<bullet>k \<le> c} \<noteq> {} \<Longrightarrow> x\<bullet>k \<le> c" |
3071 have xk_le_c: "\<And>x kk. (x, kk) \<in> p \<Longrightarrow> kk \<inter> {x. x\<bullet>k \<le> c} \<noteq> {} \<Longrightarrow> x\<bullet>k \<le> c" |
3078 proof - |
3072 proof - |
3079 fix x kk |
3073 fix x kk |
3080 assume as: "(x, kk) \<in> p" and *: "kk \<inter> {x. x\<bullet>k \<le> c} \<noteq> {}" |
3074 assume as: "(x, kk) \<in> p" and kk: "kk \<inter> {x. x\<bullet>k \<le> c} \<noteq> {}" |
3081 show "x\<bullet>k \<le> c" |
3075 show "x\<bullet>k \<le> c" |
3082 proof (rule ccontr) |
3076 proof (rule ccontr) |
3083 assume **: "\<not> ?thesis" |
3077 assume **: "\<not> ?thesis" |
3084 from this[unfolded not_le] |
3078 from this[unfolded not_le] |
3085 have "kk \<subseteq> ball x \<bar>x \<bullet> k - c\<bar>" |
3079 have "kk \<subseteq> ball x \<bar>x \<bullet> k - c\<bar>" |
3086 using p(2)[unfolded fine_def, rule_format,OF as,unfolded split_conv] by auto |
3080 using p(2)[unfolded fine_def, rule_format,OF as] by auto |
3087 with * have "\<exists>y. y \<in> ball x \<bar>x \<bullet> k - c\<bar> \<inter> {x. x \<bullet> k \<le> c}" |
3081 with kk obtain y where y: "y \<in> ball x \<bar>x \<bullet> k - c\<bar>" "y\<bullet>k \<le> c" |
3088 by blast |
3082 by blast |
3089 then guess y .. |
3083 then have "\<bar>x \<bullet> k - y \<bullet> k\<bar> < \<bar>x \<bullet> k - c\<bar>" |
3090 then have "\<bar>x \<bullet> k - y \<bullet> k\<bar> < \<bar>x \<bullet> k - c\<bar>" "y\<bullet>k \<le> c" |
|
3091 apply - |
|
3092 apply (rule le_less_trans) |
|
3093 using Basis_le_norm[OF k, of "x - y"] |
3084 using Basis_le_norm[OF k, of "x - y"] |
3094 apply (auto simp add: dist_norm inner_diff_left) |
3085 by (auto simp add: dist_norm inner_diff_left intro: le_less_trans) |
3095 done |
3086 with y show False |
3096 then show False |
3087 using ** by (auto simp add: field_simps) |
3097 using **[unfolded not_le] by (auto simp add: field_simps) |
|
3098 qed |
3088 qed |
3099 qed |
3089 qed |
3100 have xk_ge_c: |
3090 have xk_ge_c: "\<And>x kk. (x, kk) \<in> p \<Longrightarrow> kk \<inter> {x. x\<bullet>k \<ge> c} \<noteq> {} \<Longrightarrow> x\<bullet>k \<ge> c" |
3101 "\<And>x kk. (x, kk) \<in> p \<Longrightarrow> kk \<inter> {x. x\<bullet>k \<ge> c} \<noteq> {} \<Longrightarrow> x\<bullet>k \<ge> c" |
|
3102 proof - |
3091 proof - |
3103 fix x kk |
3092 fix x kk |
3104 assume as: "(x, kk) \<in> p" and *: "kk \<inter> {x. x\<bullet>k \<ge> c} \<noteq> {}" |
3093 assume as: "(x, kk) \<in> p" and kk: "kk \<inter> {x. x\<bullet>k \<ge> c} \<noteq> {}" |
3105 show "x\<bullet>k \<ge> c" |
3094 show "x\<bullet>k \<ge> c" |
3106 proof (rule ccontr) |
3095 proof (rule ccontr) |
3107 assume **: "\<not> ?thesis" |
3096 assume **: "\<not> ?thesis" |
3108 from this[unfolded not_le] have "kk \<subseteq> ball x \<bar>x \<bullet> k - c\<bar>" |
3097 from this[unfolded not_le] have "kk \<subseteq> ball x \<bar>x \<bullet> k - c\<bar>" |
3109 using p(2)[unfolded fine_def,rule_format,OF as,unfolded split_conv] by auto |
3098 using p(2)[unfolded fine_def,rule_format,OF as,unfolded split_conv] by auto |
3110 with * have "\<exists>y. y \<in> ball x \<bar>x \<bullet> k - c\<bar> \<inter> {x. x \<bullet> k \<ge> c}" |
3099 with kk obtain y where y: "y \<in> ball x \<bar>x \<bullet> k - c\<bar>" "y\<bullet>k \<ge> c" |
3111 by blast |
3100 by blast |
3112 then guess y .. |
3101 then have "\<bar>x \<bullet> k - y \<bullet> k\<bar> < \<bar>x \<bullet> k - c\<bar>" |
3113 then have "\<bar>x \<bullet> k - y \<bullet> k\<bar> < \<bar>x \<bullet> k - c\<bar>" "y\<bullet>k \<ge> c" |
|
3114 apply - |
|
3115 apply (rule le_less_trans) |
|
3116 using Basis_le_norm[OF k, of "x - y"] |
3102 using Basis_le_norm[OF k, of "x - y"] |
3117 apply (auto simp add: dist_norm inner_diff_left) |
3103 by (auto simp add: dist_norm inner_diff_left intro: le_less_trans) |
3118 done |
3104 with y show False |
3119 then show False |
3105 using ** by (auto simp add: field_simps) |
3120 using **[unfolded not_le] by (auto simp add: field_simps) |
|
3121 qed |
3106 qed |
3122 qed |
3107 qed |
3123 |
3108 |
3124 have lem1: "\<And>f P Q. (\<forall>x k. (x, k) \<in> {(x, f k) | x k. P x k} \<longrightarrow> Q x k) \<longleftrightarrow> |
3109 have lem1: "\<And>f P Q. (\<forall>x k. (x, k) \<in> {(x, f k) | x k. P x k} \<longrightarrow> Q x k) \<longleftrightarrow> |
3125 (\<forall>x k. P x k \<longrightarrow> Q x (f k))" by auto |
3110 (\<forall>x k. P x k \<longrightarrow> Q x (f k))" |
|
3111 by auto |
3126 have fin_finite: "\<And>f s P f. finite s \<Longrightarrow> finite {(x,f k) | x k. (x,k) \<in> s \<and> P x k}" |
3112 have fin_finite: "\<And>f s P f. finite s \<Longrightarrow> finite {(x,f k) | x k. (x,k) \<in> s \<and> P x k}" |
3127 proof - |
3113 proof - |
3128 case goal1 |
3114 case goal1 |
3129 then have "finite ((\<lambda>(x, k). (x, f k)) ` s)" |
3115 then have "finite ((\<lambda>(x, k). (x, f k)) ` s)" |
3130 by auto |
3116 by auto |
3473 and "opp a b = opp b a" |
3459 and "opp a b = opp b a" |
3474 and "opp (opp a b) c = opp a (opp b c)" |
3460 and "opp (opp a b) c = opp a (opp b c)" |
3475 and "opp a (opp b c) = opp b (opp a c)" |
3461 and "opp a (opp b c) = opp b (opp a c)" |
3476 using assms unfolding monoidal_def by metis+ |
3462 using assms unfolding monoidal_def by metis+ |
3477 |
3463 |
3478 lemma neutral_lifted[cong]: |
3464 lemma neutral_lifted [cong]: |
3479 assumes "monoidal opp" |
3465 assumes "monoidal opp" |
3480 shows "neutral (lifted opp) = Some (neutral opp)" |
3466 shows "neutral (lifted opp) = Some (neutral opp)" |
3481 apply (subst neutral_def) |
|
3482 apply (rule some_equality) |
|
3483 apply rule |
|
3484 apply (induct_tac y) |
|
3485 prefer 3 |
|
3486 proof - |
3467 proof - |
3487 fix x |
3468 { fix x |
3488 assume "\<forall>y. lifted opp x y = y \<and> lifted opp y x = y" |
3469 assume "\<forall>y. lifted opp x y = y \<and> lifted opp y x = y" |
3489 then show "x = Some (neutral opp)" |
3470 then have "Some (neutral opp) = x" |
3490 apply (induct x) |
3471 apply (induct x) |
3491 defer |
3472 apply force |
3492 apply rule |
3473 by (metis assms lifted.simps(1) monoidal_ac(2) option.inject) } |
|
3474 note [simp] = this |
|
3475 show ?thesis |
3493 apply (subst neutral_def) |
3476 apply (subst neutral_def) |
3494 apply (subst eq_commute) |
3477 apply (intro some_equality allI) |
3495 apply(rule some_equality) |
3478 apply (induct_tac y) |
3496 apply rule |
3479 apply (auto simp add:monoidal_ac[OF assms]) |
3497 apply (erule_tac x="Some y" in allE) |
|
3498 defer |
|
3499 apply (rename_tac x) |
|
3500 apply (erule_tac x="Some x" in allE) |
|
3501 apply auto |
|
3502 done |
3480 done |
3503 qed (auto simp add:monoidal_ac[OF assms]) |
3481 qed |
3504 |
3482 |
3505 lemma monoidal_lifted[intro]: |
3483 lemma monoidal_lifted[intro]: |
3506 assumes "monoidal opp" |
3484 assumes "monoidal opp" |
3507 shows "monoidal (lifted opp)" |
3485 shows "monoidal (lifted opp)" |
3508 unfolding monoidal_def split_option_all neutral_lifted[OF assms] |
3486 unfolding monoidal_def split_option_all neutral_lifted[OF assms] |
3545 |
3523 |
3546 lemma iterate_insert[simp]: |
3524 lemma iterate_insert[simp]: |
3547 assumes "monoidal opp" |
3525 assumes "monoidal opp" |
3548 and "finite s" |
3526 and "finite s" |
3549 shows "iterate opp (insert x s) f = |
3527 shows "iterate opp (insert x s) f = |
3550 (if x \<in> s then iterate opp s f else opp (f x) (iterate opp s f))" |
3528 (if x \<in> s then iterate opp s f else opp (f x) (iterate opp s f))" |
3551 proof (cases "x \<in> s") |
3529 proof (cases "x \<in> s") |
3552 case True |
3530 case True |
3553 then have *: "insert x s = s" |
3531 then show ?thesis by (auto simp: insert_absorb iterate_def) |
3554 by auto |
|
3555 show ?thesis unfolding iterate_def if_P[OF True] * by auto |
|
3556 next |
3532 next |
3557 case False |
3533 case False |
3558 note x = this |
|
3559 note * = comp_fun_commute.comp_comp_fun_commute [OF comp_fun_commute_monoidal[OF assms(1)]] |
3534 note * = comp_fun_commute.comp_comp_fun_commute [OF comp_fun_commute_monoidal[OF assms(1)]] |
3560 show ?thesis |
3535 show ?thesis |
3561 proof (cases "f x = neutral opp") |
3536 proof (cases "f x = neutral opp") |
3562 case True |
3537 case True |
3563 show ?thesis |
3538 then show ?thesis |
3564 unfolding iterate_def if_not_P[OF x] support_clauses if_P[OF True] |
3539 using assms `x \<notin> s` |
3565 unfolding True |
3540 by (auto simp: iterate_def support_clauses) |
3566 using assms |
|
3567 by auto |
|
3568 next |
3541 next |
3569 case False |
3542 case False |
3570 show ?thesis |
3543 with `x \<notin> s` \<open>finite s\<close> support_subset show ?thesis |
3571 unfolding iterate_def fold'_def if_not_P[OF x] support_clauses if_not_P[OF False] |
3544 apply (simp add: iterate_def fold'_def support_clauses) |
3572 apply (subst comp_fun_commute.fold_insert[OF * finite_support, simplified comp_def]) |
3545 apply (subst comp_fun_commute.fold_insert[OF * finite_support, simplified comp_def]) |
3573 using \<open>finite s\<close> |
3546 apply (force simp add: )+ |
3574 unfolding support_def |
|
3575 using False x |
|
3576 apply auto |
|
3577 done |
3547 done |
3578 qed |
3548 qed |
3579 qed |
3549 qed |
3580 |
3550 |
3581 lemma iterate_some: |
3551 lemma iterate_some: |
3582 assumes "monoidal opp" |
3552 "\<lbrakk>monoidal opp; finite s\<rbrakk> \<Longrightarrow> iterate (lifted opp) s (\<lambda>x. Some(f x)) = Some (iterate opp s f)" |
3583 and "finite s" |
3553 by (erule finite_induct) (auto simp: monoidal_lifted) |
3584 shows "iterate (lifted opp) s (\<lambda>x. Some(f x)) = Some (iterate opp s f)" |
|
3585 using assms(2) |
|
3586 proof (induct s) |
|
3587 case empty |
|
3588 then show ?case |
|
3589 using assms by auto |
|
3590 next |
|
3591 case (insert x F) |
|
3592 show ?case |
|
3593 apply (subst iterate_insert) |
|
3594 prefer 3 |
|
3595 apply (subst if_not_P) |
|
3596 defer |
|
3597 unfolding insert(3) lifted.simps |
|
3598 apply rule |
|
3599 using assms insert |
|
3600 apply auto |
|
3601 done |
|
3602 qed |
|
3603 |
3554 |
3604 |
3555 |
3605 subsection \<open>Two key instances of additivity.\<close> |
3556 subsection \<open>Two key instances of additivity.\<close> |
3606 |
3557 |
3607 lemma neutral_add[simp]: "neutral op + = (0::'a::comm_monoid_add)" |
3558 lemma neutral_add[simp]: "neutral op + = (0::'a::comm_monoid_add)" |
3608 unfolding neutral_def |
3559 unfolding neutral_def |
3609 apply (rule some_equality) |
3560 by (force elim: allE [where x=0]) |
3610 defer |
|
3611 apply (erule_tac x=0 in allE) |
|
3612 apply auto |
|
3613 done |
|
3614 |
3561 |
3615 lemma operative_content[intro]: "operative (op +) content" |
3562 lemma operative_content[intro]: "operative (op +) content" |
3616 unfolding operative_def neutral_add |
3563 by (force simp add: operative_def content_split[symmetric]) |
3617 apply safe |
|
3618 unfolding content_split[symmetric] |
|
3619 apply rule |
|
3620 done |
|
3621 |
3564 |
3622 lemma monoidal_monoid[intro]: "monoidal ((op +)::('a::comm_monoid_add) \<Rightarrow> 'a \<Rightarrow> 'a)" |
3565 lemma monoidal_monoid[intro]: "monoidal ((op +)::('a::comm_monoid_add) \<Rightarrow> 'a \<Rightarrow> 'a)" |
3623 unfolding monoidal_def neutral_add |
3566 unfolding monoidal_def neutral_add |
3624 by (auto simp add: algebra_simps) |
3567 by (auto simp add: algebra_simps) |
3625 |
3568 |
3626 lemma operative_integral: |
3569 lemma operative_integral: |
3627 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach" |
3570 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach" |
3628 shows "operative (lifted(op +)) (\<lambda>i. if f integrable_on i then Some(integral i f) else None)" |
3571 shows "operative (lifted(op +)) (\<lambda>i. if f integrable_on i then Some(integral i f) else None)" |
3629 unfolding operative_def |
3572 unfolding operative_def neutral_lifted[OF monoidal_monoid] neutral_add |
3630 unfolding neutral_lifted[OF monoidal_monoid] neutral_add |
3573 proof safe |
3631 apply rule |
|
3632 apply rule |
|
3633 apply rule |
|
3634 apply rule |
|
3635 defer |
|
3636 apply (rule allI ballI)+ |
|
3637 proof - |
|
3638 fix a b c |
3574 fix a b c |
3639 fix k :: 'a |
3575 fix k :: 'a |
3640 assume k: "k \<in> Basis" |
3576 assume k: "k \<in> Basis" |
3641 show "(if f integrable_on cbox a b then Some (integral (cbox a b) f) else None) = |
3577 show "(if f integrable_on cbox a b then Some (integral (cbox a b) f) else None) = |
3642 lifted op + (if f integrable_on cbox a b \<inter> {x. x \<bullet> k \<le> c} then Some (integral (cbox a b \<inter> {x. x \<bullet> k \<le> c}) f) else None) |
3578 lifted op + (if f integrable_on cbox a b \<inter> {x. x \<bullet> k \<le> c} then Some (integral (cbox a b \<inter> {x. x \<bullet> k \<le> c}) f) else None) |
3643 (if f integrable_on cbox a b \<inter> {x. c \<le> x \<bullet> k} then Some (integral (cbox a b \<inter> {x. c \<le> x \<bullet> k}) f) else None)" |
3579 (if f integrable_on cbox a b \<inter> {x. c \<le> x \<bullet> k} then Some (integral (cbox a b \<inter> {x. c \<le> x \<bullet> k}) f) else None)" |
3644 proof (cases "f integrable_on cbox a b") |
3580 proof (cases "f integrable_on cbox a b") |
3645 case True |
3581 case True |
3646 show ?thesis |
3582 with k show ?thesis |
3647 unfolding if_P[OF True] |
3583 apply (simp add: integrable_split) |
3648 using k |
3584 apply (rule integral_unique [OF has_integral_split[OF _ _ k]]) |
3649 apply - |
3585 apply (auto intro: integrable_integral) |
3650 unfolding if_P[OF integrable_split(1)[OF True]] |
|
3651 unfolding if_P[OF integrable_split(2)[OF True]] |
|
3652 unfolding lifted.simps option.inject |
|
3653 apply (rule integral_unique) |
|
3654 apply (rule has_integral_split[OF _ _ k]) |
|
3655 apply (rule_tac[!] integrable_integral integrable_split)+ |
|
3656 using True k |
|
3657 apply auto |
|
3658 done |
3586 done |
3659 next |
3587 next |
3660 case False |
3588 case False |
3661 have "\<not> (f integrable_on cbox a b \<inter> {x. x \<bullet> k \<le> c}) \<or> \<not> ( f integrable_on cbox a b \<inter> {x. c \<le> x \<bullet> k})" |
3589 have "\<not> (f integrable_on cbox a b \<inter> {x. x \<bullet> k \<le> c}) \<or> \<not> ( f integrable_on cbox a b \<inter> {x. c \<le> x \<bullet> k})" |
3662 proof (rule ccontr) |
3590 proof (rule ccontr) |
3663 assume "\<not> ?thesis" |
3591 assume "\<not> ?thesis" |
3664 then have "f integrable_on cbox a b" |
3592 then have "f integrable_on cbox a b" |
3665 apply - |
|
3666 unfolding integrable_on_def |
3593 unfolding integrable_on_def |
3667 apply (rule_tac x="integral (cbox a b \<inter> {x. x \<bullet> k \<le> c}) f + integral (cbox a b \<inter> {x. x \<bullet> k \<ge> c}) f" in exI) |
3594 apply (rule_tac x="integral (cbox a b \<inter> {x. x \<bullet> k \<le> c}) f + integral (cbox a b \<inter> {x. x \<bullet> k \<ge> c}) f" in exI) |
3668 apply (rule has_integral_split[OF _ _ k]) |
3595 apply (rule has_integral_split[OF _ _ k]) |
3669 apply (rule_tac[!] integrable_integral) |
3596 apply (auto intro: integrable_integral) |
3670 apply auto |
|
3671 done |
3597 done |
3672 then show False |
3598 then show False |
3673 using False by auto |
3599 using False by auto |
3674 qed |
3600 qed |
3675 then show ?thesis |
3601 then show ?thesis |
3676 using False by auto |
3602 using False by auto |
3677 qed |
3603 qed |
3678 next |
3604 next |
3679 fix a b :: 'a |
3605 fix a b :: 'a |
3680 assume as: "content (cbox a b) = 0" |
3606 assume "content (cbox a b) = 0" |
3681 then show "(if f integrable_on cbox a b then Some (integral (cbox a b) f) else None) = Some 0" |
3607 then show "(if f integrable_on cbox a b then Some (integral (cbox a b) f) else None) = Some 0" |
3682 unfolding if_P[OF integrable_on_null[OF as]] |
3608 using has_integral_null_eq |
3683 using has_integral_null_eq[OF as] |
3609 by (auto simp: integrable_on_null) |
3684 by auto |
|
3685 qed |
3610 qed |
3686 |
3611 |
3687 |
3612 |
3688 subsection \<open>Points of division of a partition.\<close> |
3613 subsection \<open>Points of division of a partition.\<close> |
3689 |
3614 |