src/HOL/Analysis/Henstock_Kurzweil_Integration.thy
changeset 67399 eab6ce8368fa
parent 67371 2d9cf74943e1
child 67683 817944aeac3f
child 67685 bdff8bf0a75b
equal deleted inserted replaced
67398:5eb932e604a2 67399:eab6ce8368fa
  1394     by (simp add: interval_split[OF k] integrable_Cauchy)
  1394     by (simp add: interval_split[OF k] integrable_Cauchy)
  1395 qed
  1395 qed
  1396 
  1396 
  1397 lemma operative_integralI:
  1397 lemma operative_integralI:
  1398   fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach"
  1398   fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach"
  1399   shows "operative (lift_option op +) (Some 0)
  1399   shows "operative (lift_option (+)) (Some 0)
  1400     (\<lambda>i. if f integrable_on i then Some (integral i f) else None)"
  1400     (\<lambda>i. if f integrable_on i then Some (integral i f) else None)"
  1401 proof -
  1401 proof -
  1402   interpret comm_monoid "lift_option plus" "Some (0::'b)"
  1402   interpret comm_monoid "lift_option plus" "Some (0::'b)"
  1403     by (rule comm_monoid_lift_option)
  1403     by (rule comm_monoid_lift_option)
  1404       (rule add.comm_monoid_axioms)
  1404       (rule add.comm_monoid_axioms)
  1406   proof
  1406   proof
  1407     fix a b c
  1407     fix a b c
  1408     fix k :: 'a
  1408     fix k :: 'a
  1409     assume k: "k \<in> Basis"
  1409     assume k: "k \<in> Basis"
  1410     show "(if f integrable_on cbox a b then Some (integral (cbox a b) f) else None) =
  1410     show "(if f integrable_on cbox a b then Some (integral (cbox a b) f) else None) =
  1411           lift_option 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)
  1411           lift_option (+) (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)
  1412           (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)"
  1412           (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)"
  1413     proof (cases "f integrable_on cbox a b")
  1413     proof (cases "f integrable_on cbox a b")
  1414       case True
  1414       case True
  1415       with k show ?thesis
  1415       with k show ?thesis
  1416         apply (simp add: integrable_split)
  1416         apply (simp add: integrable_split)
  2174       qed
  2174       qed
  2175       also have "... = e/2 * (\<Sum>i\<le>N + 1. (1/2) ^ i)"
  2175       also have "... = e/2 * (\<Sum>i\<le>N + 1. (1/2) ^ i)"
  2176         unfolding sum_distrib_left by (metis divide_inverse inverse_eq_divide power_one_over)
  2176         unfolding sum_distrib_left by (metis divide_inverse inverse_eq_divide power_one_over)
  2177       also have "\<dots> < e/2 * 2"
  2177       also have "\<dots> < e/2 * 2"
  2178       proof (rule mult_strict_left_mono)
  2178       proof (rule mult_strict_left_mono)
  2179         have "sum (op ^ (1/2)) {..N + 1} = sum (op ^ (1/2::real)) {..<N + 2}"
  2179         have "sum ((^) (1/2)) {..N + 1} = sum ((^) (1/2::real)) {..<N + 2}"
  2180           using lessThan_Suc_atMost by auto
  2180           using lessThan_Suc_atMost by auto
  2181         also have "... < 2"
  2181         also have "... < 2"
  2182           by (auto simp: geometric_sum)
  2182           by (auto simp: geometric_sum)
  2183         finally show "sum (op ^ (1/2::real)) {..N + 1} < 2" .
  2183         finally show "sum ((^) (1/2::real)) {..N + 1} < 2" .
  2184       qed (use \<open>0 < e\<close> in auto)
  2184       qed (use \<open>0 < e\<close> in auto)
  2185       finally  show ?thesis by auto
  2185       finally  show ?thesis by auto
  2186     qed
  2186     qed
  2187   qed
  2187   qed
  2188 qed
  2188 qed
  2477       qed
  2477       qed
  2478     qed
  2478     qed
  2479   qed
  2479   qed
  2480 qed
  2480 qed
  2481 
  2481 
  2482 lemma comm_monoid_set_F_and: "comm_monoid_set.F op \<and> True f s \<longleftrightarrow> (finite s \<longrightarrow> (\<forall>x\<in>s. f x))"
  2482 lemma comm_monoid_set_F_and: "comm_monoid_set.F (\<and>) True f s \<longleftrightarrow> (finite s \<longrightarrow> (\<forall>x\<in>s. f x))"
  2483 proof -
  2483 proof -
  2484   interpret bool: comm_monoid_set "op \<and>" True
  2484   interpret bool: comm_monoid_set "(\<and>)" True
  2485     proof qed auto
  2485     proof qed auto
  2486   show ?thesis
  2486   show ?thesis
  2487     by (induction s rule: infinite_finite_induct) auto
  2487     by (induction s rule: infinite_finite_induct) auto
  2488 qed
  2488 qed
  2489 
  2489 
  2585     apply (subst has_integral)
  2585     apply (subst has_integral)
  2586   proof safe
  2586   proof safe
  2587     fix e :: real
  2587     fix e :: real
  2588     assume e: "e > 0"
  2588     assume e: "e > 0"
  2589     {
  2589     {
  2590       assume "\<forall>e>0. ?P e op <"
  2590       assume "\<forall>e>0. ?P e (<)"
  2591       then show "?P (e * content (cbox a b)) op \<le>"
  2591       then show "?P (e * content (cbox a b)) (\<le>)"
  2592         apply (erule_tac x="e * content (cbox a b)" in allE)
  2592         apply (erule_tac x="e * content (cbox a b)" in allE)
  2593         apply (erule impE)
  2593         apply (erule impE)
  2594         defer
  2594         defer
  2595         apply (erule exE,rule_tac x=d in exI)
  2595         apply (erule exE,rule_tac x=d in exI)
  2596         using F e
  2596         using F e
  2597         apply (auto simp add:field_simps)
  2597         apply (auto simp add:field_simps)
  2598         done
  2598         done
  2599     }
  2599     }
  2600     {
  2600     {
  2601       assume "\<forall>e>0. ?P (e * content (cbox a b)) op \<le>"
  2601       assume "\<forall>e>0. ?P (e * content (cbox a b)) (\<le>)"
  2602       then show "?P e op <"
  2602       then show "?P e (<)"
  2603         apply (erule_tac x="e/2 / content (cbox a b)" in allE)
  2603         apply (erule_tac x="e/2 / content (cbox a b)" in allE)
  2604         apply (erule impE)
  2604         apply (erule impE)
  2605         defer
  2605         defer
  2606         apply (erule exE,rule_tac x=d in exI)
  2606         apply (erule exE,rule_tac x=d in exI)
  2607         using F e
  2607         using F e
  2981 proof -
  2981 proof -
  2982   interpret operative_real "lift_option plus" "Some 0"
  2982   interpret operative_real "lift_option plus" "Some 0"
  2983     "\<lambda>i. if f integrable_on i then Some (integral i f) else None"
  2983     "\<lambda>i. if f integrable_on i then Some (integral i f) else None"
  2984     using operative_integralI by (rule operative_realI)
  2984     using operative_integralI by (rule operative_realI)
  2985   from \<open>a \<le> c\<close> \<open>c \<le> b\<close> ac cb coalesce_less_eq
  2985   from \<open>a \<le> c\<close> \<open>c \<le> b\<close> ac cb coalesce_less_eq
  2986   have *: "lift_option op +
  2986   have *: "lift_option (+)
  2987              (if f integrable_on {a..c} then Some (integral {a..c} f) else None)
  2987              (if f integrable_on {a..c} then Some (integral {a..c} f) else None)
  2988              (if f integrable_on {c..b} then Some (integral {c..b} f) else None) =
  2988              (if f integrable_on {c..b} then Some (integral {c..b} f) else None) =
  2989             (if f integrable_on {a..b} then Some (integral {a..b} f) else None)"
  2989             (if f integrable_on {a..b} then Some (integral {a..b} f) else None)"
  2990     by (auto simp: split: if_split_asm)
  2990     by (auto simp: split: if_split_asm)
  2991   then have "f integrable_on cbox a b"
  2991   then have "f integrable_on cbox a b"
  4607   qed
  4607   qed
  4608 qed (simp add: negligible_Int)
  4608 qed (simp add: negligible_Int)
  4609 
  4609 
  4610 lemma negligible_translation:
  4610 lemma negligible_translation:
  4611   assumes "negligible S"
  4611   assumes "negligible S"
  4612     shows "negligible (op + c ` S)"
  4612     shows "negligible ((+) c ` S)"
  4613 proof -
  4613 proof -
  4614   have inj: "inj (op + c)"
  4614   have inj: "inj ((+) c)"
  4615     by simp
  4615     by simp
  4616   show ?thesis
  4616   show ?thesis
  4617   using assms
  4617   using assms
  4618   proof (clarsimp simp: negligible_def)
  4618   proof (clarsimp simp: negligible_def)
  4619     fix a b
  4619     fix a b
  4620     assume "\<forall>x y. (indicator S has_integral 0) (cbox x y)"
  4620     assume "\<forall>x y. (indicator S has_integral 0) (cbox x y)"
  4621     then have *: "(indicator S has_integral 0) (cbox (a-c) (b-c))"
  4621     then have *: "(indicator S has_integral 0) (cbox (a-c) (b-c))"
  4622       by (meson Diff_iff assms has_integral_negligible indicator_simps(2))
  4622       by (meson Diff_iff assms has_integral_negligible indicator_simps(2))
  4623     have eq: "indicator (op + c ` S) = (\<lambda>x. indicator S (x - c))"
  4623     have eq: "indicator ((+) c ` S) = (\<lambda>x. indicator S (x - c))"
  4624       by (force simp add: indicator_def)
  4624       by (force simp add: indicator_def)
  4625     show "(indicator (op + c ` S) has_integral 0) (cbox a b)"
  4625     show "(indicator ((+) c ` S) has_integral 0) (cbox a b)"
  4626       using has_integral_affinity [OF *, of 1 "-c"]
  4626       using has_integral_affinity [OF *, of 1 "-c"]
  4627             cbox_translation [of "c" "-c+a" "-c+b"]
  4627             cbox_translation [of "c" "-c+a" "-c+b"]
  4628       by (simp add: eq add.commute)
  4628       by (simp add: eq add.commute)
  4629   qed
  4629   qed
  4630 qed
  4630 qed
  4631 
  4631 
  4632 lemma negligible_translation_rev:
  4632 lemma negligible_translation_rev:
  4633   assumes "negligible (op + c ` S)"
  4633   assumes "negligible ((+) c ` S)"
  4634     shows "negligible S"
  4634     shows "negligible S"
  4635 by (metis negligible_translation [OF assms, of "-c"] translation_galois)
  4635 by (metis negligible_translation [OF assms, of "-c"] translation_galois)
  4636 
  4636 
  4637 lemma has_integral_spike_set_eq:
  4637 lemma has_integral_spike_set_eq:
  4638   fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
  4638   fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
  4836       by blast
  4836       by blast
  4837     obtain N where N: "B \<le> real N"
  4837     obtain N where N: "B \<le> real N"
  4838       using real_arch_simple by blast
  4838       using real_arch_simple by blast
  4839     have "ball 0 B \<subseteq> ?cube n" if n: "n \<ge> N" for n
  4839     have "ball 0 B \<subseteq> ?cube n" if n: "n \<ge> N" for n
  4840     proof -
  4840     proof -
  4841       have "sum (op *\<^sub>R (- real n)) Basis \<bullet> i \<le> x \<bullet> i \<and>
  4841       have "sum (( *\<^sub>R) (- real n)) Basis \<bullet> i \<le> x \<bullet> i \<and>
  4842             x \<bullet> i \<le> sum (op *\<^sub>R (real n)) Basis \<bullet> i"
  4842             x \<bullet> i \<le> sum (( *\<^sub>R) (real n)) Basis \<bullet> i"
  4843         if "norm x < B" "i \<in> Basis" for x i::'n
  4843         if "norm x < B" "i \<in> Basis" for x i::'n
  4844           using Basis_le_norm[of i x] n N that by (auto simp add: field_simps sum_negf)
  4844           using Basis_le_norm[of i x] n N that by (auto simp add: field_simps sum_negf)
  4845       then show ?thesis
  4845       then show ?thesis
  4846         by (auto simp: mem_box dist_norm)
  4846         by (auto simp: mem_box dist_norm)
  4847     qed
  4847     qed
  4872       moreover have "ball 0 B \<subseteq> ?cube n"
  4872       moreover have "ball 0 B \<subseteq> ?cube n"
  4873       proof 
  4873       proof 
  4874         fix x :: 'n
  4874         fix x :: 'n
  4875         assume x: "x \<in> ball 0 B"
  4875         assume x: "x \<in> ball 0 B"
  4876         have "\<lbrakk>norm (0 - x) < B; i \<in> Basis\<rbrakk>
  4876         have "\<lbrakk>norm (0 - x) < B; i \<in> Basis\<rbrakk>
  4877               \<Longrightarrow> sum (op *\<^sub>R (-n)) Basis \<bullet> i\<le> x \<bullet> i \<and> x \<bullet> i \<le> sum (op *\<^sub>R n) Basis \<bullet> i" for i
  4877               \<Longrightarrow> sum (( *\<^sub>R) (-n)) Basis \<bullet> i\<le> x \<bullet> i \<and> x \<bullet> i \<le> sum (( *\<^sub>R) n) Basis \<bullet> i" for i
  4878           using Basis_le_norm[of i x] n by (auto simp add: field_simps sum_negf)
  4878           using Basis_le_norm[of i x] n by (auto simp add: field_simps sum_negf)
  4879         then show "x \<in> ?cube n"
  4879         then show "x \<in> ?cube n"
  4880           using x by (auto simp: mem_box dist_norm)
  4880           using x by (auto simp: mem_box dist_norm)
  4881       qed 
  4881       qed 
  4882       ultimately show "norm (integral (cbox a b) ?F - i) < e"
  4882       ultimately show "norm (integral (cbox a b) ?F - i) < e"
  5923     and le: "\<And>k x. x \<in> S \<Longrightarrow> f (Suc k) x \<le> f k x"
  5923     and le: "\<And>k x. x \<in> S \<Longrightarrow> f (Suc k) x \<le> f k x"
  5924     and fg: "\<And>x. x \<in> S \<Longrightarrow> ((\<lambda>k. f k x) \<longlongrightarrow> g x) sequentially"
  5924     and fg: "\<And>x. x \<in> S \<Longrightarrow> ((\<lambda>k. f k x) \<longlongrightarrow> g x) sequentially"
  5925     and bou: "bounded (range(\<lambda>k. integral S (f k)))"
  5925     and bou: "bounded (range(\<lambda>k. integral S (f k)))"
  5926   shows "g integrable_on S \<and> (\<lambda>k. integral S (f k)) \<longlonglongrightarrow> integral S g"
  5926   shows "g integrable_on S \<and> (\<lambda>k. integral S (f k)) \<longlonglongrightarrow> integral S g"
  5927 proof -
  5927 proof -
  5928   have *: "range(\<lambda>k. integral S (\<lambda>x. - f k x)) = op *\<^sub>R (- 1) ` (range(\<lambda>k. integral S (f k)))"
  5928   have *: "range(\<lambda>k. integral S (\<lambda>x. - f k x)) = ( *\<^sub>R) (- 1) ` (range(\<lambda>k. integral S (f k)))"
  5929     by force
  5929     by force
  5930   have "(\<lambda>x. - g x) integrable_on S \<and> (\<lambda>k. integral S (\<lambda>x. - f k x)) \<longlonglongrightarrow> integral S (\<lambda>x. - g x)"
  5930   have "(\<lambda>x. - g x) integrable_on S \<and> (\<lambda>k. integral S (\<lambda>x. - f k x)) \<longlonglongrightarrow> integral S (\<lambda>x. - g x)"
  5931   proof (rule monotone_convergence_increasing)
  5931   proof (rule monotone_convergence_increasing)
  5932     show "\<And>k. (\<lambda>x. - f k x) integrable_on S"
  5932     show "\<And>k. (\<lambda>x. - f k x) integrable_on S"
  5933       by (blast intro: integrable_neg intf)
  5933       by (blast intro: integrable_neg intf)