src/HOL/Multivariate_Analysis/Integration.thy
changeset 57129 7edb7550663e
parent 56544 b60d5d119489
child 57418 6ab1c7cb0b8d
equal deleted inserted replaced
57128:4874411752fe 57129:7edb7550663e
  1670   unfolding tagged_partial_division_of_def
  1670   unfolding tagged_partial_division_of_def
  1671   using finite_subset[OF assms(2)]
  1671   using finite_subset[OF assms(2)]
  1672   by blast
  1672   by blast
  1673 
  1673 
  1674 lemma setsum_over_tagged_division_lemma:
  1674 lemma setsum_over_tagged_division_lemma:
  1675   fixes d :: "'m::euclidean_space set \<Rightarrow> 'a::real_normed_vector"
       
  1676   assumes "p tagged_division_of i"
  1675   assumes "p tagged_division_of i"
  1677     and "\<And>u v. cbox u v \<noteq> {} \<Longrightarrow> content (cbox u v) = 0 \<Longrightarrow> d (cbox u v) = 0"
  1676     and "\<And>u v. cbox u v \<noteq> {} \<Longrightarrow> content (cbox u v) = 0 \<Longrightarrow> d (cbox u v) = 0"
  1678   shows "setsum (\<lambda>(x,k). d k) p = setsum d (snd ` p)"
  1677   shows "setsum (\<lambda>(x,k). d k) p = setsum d (snd ` p)"
  1679 proof -
  1678 proof -
  1680   note assm = tagged_division_ofD[OF assms(1)]
       
  1681   have *: "(\<lambda>(x,k). d k) = d \<circ> snd"
  1679   have *: "(\<lambda>(x,k). d k) = d \<circ> snd"
  1682     unfolding o_def by (rule ext) auto
  1680     unfolding o_def by (rule ext) auto
       
  1681   note assm = tagged_division_ofD[OF assms(1)]
  1683   show ?thesis
  1682   show ?thesis
  1684     unfolding *
  1683     unfolding *
  1685     apply (subst eq_commute)
  1684   proof (rule setsum_reindex_nonzero[symmetric])
  1686   proof (rule setsum_reindex_nonzero)
       
  1687     show "finite p"
  1685     show "finite p"
  1688       using assm by auto
  1686       using assm by auto
  1689     fix x y
  1687     fix x y
  1690     assume as: "x\<in>p" "y\<in>p" "x\<noteq>y" "snd x = snd y"
  1688     assume "x\<in>p" "y\<in>p" "x\<noteq>y" "snd x = snd y"
  1691     obtain a b where ab: "snd x = cbox a b"
  1689     obtain a b where ab: "snd x = cbox a b"
  1692       using assm(4)[of "fst x" "snd x"] as(1) by auto
  1690       using assm(4)[of "fst x" "snd x"] `x\<in>p` by auto
  1693     have "(fst x, snd y) \<in> p" "(fst x, snd y) \<noteq> y"
  1691     have "(fst x, snd y) \<in> p" "(fst x, snd y) \<noteq> y"
  1694       unfolding as(4)[symmetric] using as(1-3) by auto
  1692       by (metis pair_collapse `x\<in>p` `snd x = snd y` `x \<noteq> y`)+
  1695     then have "interior (snd x) \<inter> interior (snd y) = {}"
  1693     with `x\<in>p` `y\<in>p` have "interior (snd x) \<inter> interior (snd y) = {}"
  1696       apply -
  1694       by (intro assm(5)[of "fst x" _ "fst y"]) auto
  1697       apply (rule assm(5)[of "fst x" _ "fst y"])
       
  1698       using as
       
  1699       apply auto
       
  1700       done
       
  1701     then have "content (cbox a b) = 0"
  1695     then have "content (cbox a b) = 0"
  1702       unfolding as(4)[symmetric] ab content_eq_0_interior by auto
  1696       unfolding `snd x = snd y`[symmetric] ab content_eq_0_interior by auto
  1703     then have "d (cbox a b) = 0"
  1697     then have "d (cbox a b) = 0"
  1704       apply -
  1698       using assm(2)[of "fst x" "snd x"] `x\<in>p` ab[symmetric] by (intro assms(2)) auto
  1705       apply (rule assms(2))
       
  1706       using assm(2)[of "fst x" "snd x"] as(1)
       
  1707       unfolding ab[symmetric]
       
  1708       apply auto
       
  1709       done
       
  1710     then show "d (snd x) = 0"
  1699     then show "d (snd x) = 0"
  1711       unfolding ab by auto
  1700       unfolding ab by auto
  1712   qed
  1701   qed
  1713 qed
  1702 qed
  1714 
  1703 
  7431       qed
  7420       qed
  7432         note ** = d(2)[OF this]
  7421         note ** = d(2)[OF this]
  7433         have *: "inj_on (\<lambda>(x, k). (g x, g ` k)) p"
  7422         have *: "inj_on (\<lambda>(x, k). (g x, g ` k)) p"
  7434           using inj(1) unfolding inj_on_def by fastforce
  7423           using inj(1) unfolding inj_on_def by fastforce
  7435         have "(\<Sum>(x, k)\<in>(\<lambda>(x, k). (g x, g ` k)) ` p. content k *\<^sub>R f x) - i = r *\<^sub>R (\<Sum>(x, k)\<in>p. content k *\<^sub>R f (g x)) - i" (is "?l = _")
  7424         have "(\<Sum>(x, k)\<in>(\<lambda>(x, k). (g x, g ` k)) ` p. content k *\<^sub>R f x) - i = r *\<^sub>R (\<Sum>(x, k)\<in>p. content k *\<^sub>R f (g x)) - i" (is "?l = _")
  7436           unfolding algebra_simps add_left_cancel
  7425           using assms(7)
  7437           unfolding setsum_reindex[OF *]
  7426           unfolding algebra_simps add_left_cancel scaleR_right.setsum
  7438           apply (subst scaleR_right.setsum)
  7427           by (subst setsum.reindex_bij_betw[symmetric, where h="\<lambda>(x, k). (g x, g ` k)" and S=p])
  7439           defer
  7428              (auto intro!: * setsum_cong simp: bij_betw_def dest!: p(4))
  7440           apply (rule setsum_cong2)
       
  7441           unfolding o_def split_paired_all split_conv
       
  7442           apply (drule p(4))
       
  7443           apply safe
       
  7444           unfolding assms(7)[rule_format]
       
  7445           using p
       
  7446           apply auto
       
  7447           done
       
  7448       also have "\<dots> = r *\<^sub>R ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f (g x)) - (1 / r) *\<^sub>R i)" (is "_ = ?r")
  7429       also have "\<dots> = r *\<^sub>R ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f (g x)) - (1 / r) *\<^sub>R i)" (is "_ = ?r")
  7449         unfolding scaleR_diff_right scaleR_scaleR
  7430         unfolding scaleR_diff_right scaleR_scaleR
  7450         using assms(1)
  7431         using assms(1)
  7451         by auto
  7432         by auto
  7452       finally have *: "?l = ?r" .
  7433       finally have *: "?l = ?r" .