src/HOL/Analysis/Henstock_Kurzweil_Integration.thy
changeset 65578 e4997c181cce
parent 65204 d23eded35a33
child 65587 16a8991ab398
equal deleted inserted replaced
65577:32d4117ad6e8 65578:e4997c181cce
  2576   assumes "continuous_on (cbox a b) f"
  2576   assumes "continuous_on (cbox a b) f"
  2577   shows "f integrable_on cbox a b"
  2577   shows "f integrable_on cbox a b"
  2578 proof (rule integrable_uniform_limit, safe)
  2578 proof (rule integrable_uniform_limit, safe)
  2579   fix e :: real
  2579   fix e :: real
  2580   assume e: "e > 0"
  2580   assume e: "e > 0"
  2581   from compact_uniformly_continuous[OF assms compact_cbox,unfolded uniformly_continuous_on_def,rule_format,OF e] guess d ..
  2581   then obtain d where "0 < d" and d: "\<And>x x'. \<lbrakk>x \<in> cbox a b; x' \<in> cbox a b; dist x' x < d\<rbrakk> \<Longrightarrow> dist (f x') (f x) < e"
  2582   note d=conjunctD2[OF this,rule_format]
  2582     using compact_uniformly_continuous[OF assms compact_cbox] unfolding uniformly_continuous_on_def by metis
  2583   from fine_division_exists[OF gauge_ball[OF d(1)], of a b] guess p . note p=this
  2583   obtain p where ptag: "p tagged_division_of cbox a b" and finep: "(\<lambda>x. ball x d) fine p"
  2584   note p' = tagged_division_ofD[OF p(1)]
  2584     using fine_division_exists[OF gauge_ball[OF \<open>0 < d\<close>], of a b] .
  2585   have *: "\<forall>i\<in>snd ` p. \<exists>g. (\<forall>x\<in>i. norm (f x - g x) \<le> e) \<and> g integrable_on i"
  2585   have *: "\<forall>i\<in>snd ` p. \<exists>g. (\<forall>x\<in>i. norm (f x - g x) \<le> e) \<and> g integrable_on i"
  2586   proof (safe, unfold snd_conv)
  2586   proof (safe, unfold snd_conv)
  2587     fix x l
  2587     fix x l
  2588     assume as: "(x, l) \<in> p"
  2588     assume as: "(x, l) \<in> p"
  2589     from p'(4)[OF this] guess a b by (elim exE) note l=this
  2589     obtain a b where l: "l = cbox a b"
       
  2590       using as ptag by blast
       
  2591     then have x: "x \<in> cbox a b"
       
  2592       using as ptag by auto
  2590     show "\<exists>g. (\<forall>x\<in>l. norm (f x - g x) \<le> e) \<and> g integrable_on l"
  2593     show "\<exists>g. (\<forall>x\<in>l. norm (f x - g x) \<le> e) \<and> g integrable_on l"
  2591       apply (rule_tac x="\<lambda>y. f x" in exI)
  2594       apply (rule_tac x="\<lambda>y. f x" in exI)
  2592     proof safe
  2595     proof safe
  2593       show "(\<lambda>y. f x) integrable_on l"
  2596       show "(\<lambda>y. f x) integrable_on l"
  2594         unfolding integrable_on_def l
  2597         unfolding integrable_on_def l by blast
  2595         apply rule
  2598     next
  2596         apply (rule has_integral_const)
       
  2597         done
       
  2598       fix y
  2599       fix y
  2599       assume y: "y \<in> l"
  2600       assume y: "y \<in> l"
  2600       note fineD[OF p(2) as,unfolded subset_eq,rule_format,OF this]
  2601       then have "y \<in> ball x d"
  2601       note d(2)[OF _ _ this[unfolded mem_ball]]
  2602         using as finep by fastforce
  2602       then show "norm (f y - f x) \<le> e"
  2603       then show "norm (f y - f x) \<le> e"
  2603         using y p'(2-3)[OF as] unfolding dist_norm l norm_minus_commute by fastforce
  2604         using d x y as l
       
  2605         by (metis dist_commute dist_norm less_imp_le mem_ball ptag subsetCE tagged_division_ofD(3))
  2604     qed
  2606     qed
  2605   qed
  2607   qed
  2606   from e have "e \<ge> 0"
  2608   from e have "e \<ge> 0"
  2607     by auto
  2609     by auto
  2608   from approximable_on_division[OF this division_of_tagged_division[OF p(1)] *] guess g .
  2610   from approximable_on_division[OF this division_of_tagged_division[OF ptag] *]
  2609   then show "\<exists>g. (\<forall>x\<in>cbox a b. norm (f x - g x) \<le> e) \<and> g integrable_on cbox a b"
  2611   show "\<exists>g. (\<forall>x\<in>cbox a b. norm (f x - g x) \<le> e) \<and> g integrable_on cbox a b"
  2610     by auto
  2612     by metis
  2611 qed
  2613 qed
  2612 
  2614 
  2613 lemma integrable_continuous_interval:
  2615 lemma integrable_continuous_interval:
  2614   fixes f :: "'b::ordered_euclidean_space \<Rightarrow> 'a::banach"
  2616   fixes f :: "'b::ordered_euclidean_space \<Rightarrow> 'a::banach"
  2615   assumes "continuous_on {a .. b} f"
  2617   assumes "continuous_on {a .. b} f"
  6276       done
  6278       done
  6277   qed
  6279   qed
  6278 qed
  6280 qed
  6279 
  6281 
  6280 
  6282 
  6281 subsection \<open>Geometric progression\<close>
       
  6282 
       
  6283 text \<open>FIXME: Should one or more of these theorems be moved to
       
  6284   \<^file>\<open>~~/src/HOL/Set_Interval.thy\<close>, alongside \<open>geometric_sum\<close>?\<close>
       
  6285 
       
  6286 lemma sum_gp_basic:
       
  6287   fixes x :: "'a::ring_1"
       
  6288   shows "(1 - x) * sum (\<lambda>i. x^i) {0 .. n} = (1 - x^(Suc n))"
       
  6289 proof -
       
  6290   define y where "y = 1 - x"
       
  6291   have "y * (\<Sum>i=0..n. (1 - y) ^ i) = 1 - (1 - y) ^ Suc n"
       
  6292     by (induct n) (simp_all add: algebra_simps)
       
  6293   then show ?thesis
       
  6294     unfolding y_def by simp
       
  6295 qed
       
  6296 
       
  6297 lemma sum_gp_multiplied:
       
  6298   assumes mn: "m \<le> n"
       
  6299   shows "((1::'a::{field}) - x) * sum (op ^ x) {m..n} = x^m - x^ Suc n"
       
  6300   (is "?lhs = ?rhs")
       
  6301 proof -
       
  6302   let ?S = "{0..(n - m)}"
       
  6303   from mn have mn': "n - m \<ge> 0"
       
  6304     by arith
       
  6305   let ?f = "op + m"
       
  6306   have i: "inj_on ?f ?S"
       
  6307     unfolding inj_on_def by auto
       
  6308   have f: "?f ` ?S = {m..n}"
       
  6309     using mn
       
  6310     apply (auto simp add: image_iff Bex_def)
       
  6311     apply presburger
       
  6312     done
       
  6313   have th: "op ^ x \<circ> op + m = (\<lambda>i. x^m * x^i)"
       
  6314     by (rule ext) (simp add: power_add power_mult)
       
  6315   from sum.reindex[OF i, of "op ^ x", unfolded f th sum_distrib_left[symmetric]]
       
  6316   have "?lhs = x^m * ((1 - x) * sum (op ^ x) {0..n - m})"
       
  6317     by simp
       
  6318   then show ?thesis
       
  6319     unfolding sum_gp_basic
       
  6320     using mn
       
  6321     by (simp add: field_simps power_add[symmetric])
       
  6322 qed
       
  6323 
       
  6324 lemma sum_gp:
       
  6325   "sum (op ^ (x::'a::{field})) {m .. n} =
       
  6326     (if n < m then 0
       
  6327      else if x = 1 then of_nat ((n + 1) - m)
       
  6328      else (x^ m - x^ (Suc n)) / (1 - x))"
       
  6329 proof -
       
  6330   {
       
  6331     assume nm: "n < m"
       
  6332     then have ?thesis by simp
       
  6333   }
       
  6334   moreover
       
  6335   {
       
  6336     assume "\<not> n < m"
       
  6337     then have nm: "m \<le> n"
       
  6338       by arith
       
  6339     {
       
  6340       assume x: "x = 1"
       
  6341       then have ?thesis
       
  6342         by simp
       
  6343     }
       
  6344     moreover
       
  6345     {
       
  6346       assume x: "x \<noteq> 1"
       
  6347       then have nz: "1 - x \<noteq> 0"
       
  6348         by simp
       
  6349       from sum_gp_multiplied[OF nm, of x] nz have ?thesis
       
  6350         by (simp add: field_simps)
       
  6351     }
       
  6352     ultimately have ?thesis by blast
       
  6353   }
       
  6354   ultimately show ?thesis by blast
       
  6355 qed
       
  6356 
       
  6357 lemma sum_gp_offset:
       
  6358   "sum (op ^ (x::'a::{field})) {m .. m+n} =
       
  6359     (if x = 1 then of_nat n + 1 else x^m * (1 - x^Suc n) / (1 - x))"
       
  6360   unfolding sum_gp[of x m "m + n"] power_Suc
       
  6361   by (simp add: field_simps power_add)
       
  6362 
       
  6363 
       
  6364 subsection \<open>Monotone convergence (bounded interval first)\<close>
  6283 subsection \<open>Monotone convergence (bounded interval first)\<close>
  6365 
  6284 
  6366 lemma monotone_convergence_interval:
  6285 lemma monotone_convergence_interval:
  6367   fixes f :: "nat \<Rightarrow> 'n::euclidean_space \<Rightarrow> real"
  6286   fixes f :: "nat \<Rightarrow> 'n::euclidean_space \<Rightarrow> real"
  6368   assumes "\<forall>k. (f k) integrable_on cbox a b"
  6287   assumes "\<forall>k. (f k) integrable_on cbox a b"