479 assumes "cbox a b \<noteq> {}" |
479 assumes "cbox a b \<noteq> {}" |
480 shows "interval_upperbound (cbox a b) = b" |
480 shows "interval_upperbound (cbox a b) = b" |
481 and "interval_lowerbound (cbox a b) = a" |
481 and "interval_lowerbound (cbox a b) = a" |
482 using assms unfolding box_ne_empty by auto |
482 using assms unfolding box_ne_empty by auto |
483 |
483 |
|
484 |
|
485 lemma interval_upperbound_Times: |
|
486 assumes "A \<noteq> {}" and "B \<noteq> {}" |
|
487 shows "interval_upperbound (A \<times> B) = (interval_upperbound A, interval_upperbound B)" |
|
488 proof- |
|
489 from assms have fst_image_times': "A = fst ` (A \<times> B)" by simp |
|
490 have "(\<Sum>i\<in>Basis. (SUP x:A \<times> B. x \<bullet> (i, 0)) *\<^sub>R i) = (\<Sum>i\<in>Basis. (SUP x:A. x \<bullet> i) *\<^sub>R i)" |
|
491 by (subst (2) fst_image_times') (simp del: fst_image_times add: o_def inner_Pair_0) |
|
492 moreover from assms have snd_image_times': "B = snd ` (A \<times> B)" by simp |
|
493 have "(\<Sum>i\<in>Basis. (SUP x:A \<times> B. x \<bullet> (0, i)) *\<^sub>R i) = (\<Sum>i\<in>Basis. (SUP x:B. x \<bullet> i) *\<^sub>R i)" |
|
494 by (subst (2) snd_image_times') (simp del: snd_image_times add: o_def inner_Pair_0) |
|
495 ultimately show ?thesis unfolding interval_upperbound_def |
|
496 by (subst setsum_Basis_prod_eq) (auto simp add: setsum_prod) |
|
497 qed |
|
498 |
|
499 lemma interval_lowerbound_Times: |
|
500 assumes "A \<noteq> {}" and "B \<noteq> {}" |
|
501 shows "interval_lowerbound (A \<times> B) = (interval_lowerbound A, interval_lowerbound B)" |
|
502 proof- |
|
503 from assms have fst_image_times': "A = fst ` (A \<times> B)" by simp |
|
504 have "(\<Sum>i\<in>Basis. (INF x:A \<times> B. x \<bullet> (i, 0)) *\<^sub>R i) = (\<Sum>i\<in>Basis. (INF x:A. x \<bullet> i) *\<^sub>R i)" |
|
505 by (subst (2) fst_image_times') (simp del: fst_image_times add: o_def inner_Pair_0) |
|
506 moreover from assms have snd_image_times': "B = snd ` (A \<times> B)" by simp |
|
507 have "(\<Sum>i\<in>Basis. (INF x:A \<times> B. x \<bullet> (0, i)) *\<^sub>R i) = (\<Sum>i\<in>Basis. (INF x:B. x \<bullet> i) *\<^sub>R i)" |
|
508 by (subst (2) snd_image_times') (simp del: snd_image_times add: o_def inner_Pair_0) |
|
509 ultimately show ?thesis unfolding interval_lowerbound_def |
|
510 by (subst setsum_Basis_prod_eq) (auto simp add: setsum_prod) |
|
511 qed |
|
512 |
484 subsection {* Content (length, area, volume...) of an interval. *} |
513 subsection {* Content (length, area, volume...) of an interval. *} |
485 |
514 |
486 definition "content (s::('a::euclidean_space) set) = |
515 definition "content (s::('a::euclidean_space) set) = |
487 (if s = {} then 0 else (\<Prod>i\<in>Basis. (interval_upperbound s)\<bullet>i - (interval_lowerbound s)\<bullet>i))" |
516 (if s = {} then 0 else (\<Prod>i\<in>Basis. (interval_upperbound s)\<bullet>i - (interval_lowerbound s)\<bullet>i))" |
488 |
517 |
616 qed |
645 qed |
617 qed |
646 qed |
618 |
647 |
619 lemma content_lt_nz: "0 < content (cbox a b) \<longleftrightarrow> content (cbox a b) \<noteq> 0" |
648 lemma content_lt_nz: "0 < content (cbox a b) \<longleftrightarrow> content (cbox a b) \<noteq> 0" |
620 unfolding content_pos_lt_eq content_eq_0 unfolding not_ex not_le by fastforce |
649 unfolding content_pos_lt_eq content_eq_0 unfolding not_ex not_le by fastforce |
|
650 |
|
651 lemma content_times[simp]: "content (A \<times> B) = content A * content B" |
|
652 proof (cases "A \<times> B = {}") |
|
653 let ?ub1 = "interval_upperbound" and ?lb1 = "interval_lowerbound" |
|
654 let ?ub2 = "interval_upperbound" and ?lb2 = "interval_lowerbound" |
|
655 assume nonempty: "A \<times> B \<noteq> {}" |
|
656 hence "content (A \<times> B) = (\<Prod>i\<in>Basis. (?ub1 A, ?ub2 B) \<bullet> i - (?lb1 A, ?lb2 B) \<bullet> i)" |
|
657 unfolding content_def by (simp add: interval_upperbound_Times interval_lowerbound_Times) |
|
658 also have "... = content A * content B" unfolding content_def using nonempty |
|
659 apply (subst Basis_prod_def, subst setprod.union_disjoint, force, force, force, simp) |
|
660 apply (subst (1 2) setprod.reindex, auto intro: inj_onI) |
|
661 done |
|
662 finally show ?thesis . |
|
663 qed (auto simp: content_def) |
621 |
664 |
622 |
665 |
623 subsection {* The notion of a gauge --- simply an open set containing the point. *} |
666 subsection {* The notion of a gauge --- simply an open set containing the point. *} |
624 |
667 |
625 definition "gauge d \<longleftrightarrow> (\<forall>x. x \<in> d x \<and> open (d x))" |
668 definition "gauge d \<longleftrightarrow> (\<forall>x. x \<in> d x \<and> open (d x))" |