# HG changeset patch # User immler # Date 1387210102 -3600 # Node ID fe462aa28c3d2f95d228371ed89fcc0a5f1c76d1 # Parent 6fae499e08272d4eeb98a32a3f8bd0d1c5d9243a additional lemmas diff -r 6fae499e0827 -r fe462aa28c3d src/HOL/Multivariate_Analysis/Euclidean_Space.thy --- a/src/HOL/Multivariate_Analysis/Euclidean_Space.thy Mon Dec 16 17:08:22 2013 +0100 +++ b/src/HOL/Multivariate_Analysis/Euclidean_Space.thy Mon Dec 16 17:08:22 2013 +0100 @@ -158,6 +158,17 @@ definition "Basis = (\u. (u, 0)) ` Basis \ (\v. (0, v)) ` Basis" +lemma setsum_Basis_prod_eq: + fixes f::"('a*'b)\('a*'b)" + shows "setsum f Basis = setsum (\i. f (i, 0)) Basis + setsum (\i. f (0, i)) Basis" +proof - + have "inj_on (\u. (u::'a, 0::'b)) Basis" "inj_on (\u. (0::'a, u::'b)) Basis" + by (auto intro!: inj_onI Pair_inject) + thus ?thesis + unfolding Basis_prod_def + by (subst setsum_Un_disjoint) (auto simp: Basis_prod_def setsum_reindex) +qed + instance proof show "(Basis :: ('a \ 'b) set) \ {}" unfolding Basis_prod_def by simp diff -r 6fae499e0827 -r fe462aa28c3d src/HOL/Multivariate_Analysis/Integration.thy --- a/src/HOL/Multivariate_Analysis/Integration.thy Mon Dec 16 17:08:22 2013 +0100 +++ b/src/HOL/Multivariate_Analysis/Integration.thy Mon Dec 16 17:08:22 2013 +0100 @@ -222,6 +222,9 @@ lemma empty_as_interval: "{} = {One..(0::'a::ordered_euclidean_space)}" by (auto simp: eucl_le[where 'a='a]) +lemma One_nonneg: "0 \ (One::'a::ordered_euclidean_space)" + by (auto intro: setsum_nonneg) + lemma interior_subset_union_intervals: assumes "i = {a..b::'a::ordered_euclidean_space}" and "j = {c..d}" diff -r 6fae499e0827 -r fe462aa28c3d src/HOL/Multivariate_Analysis/Ordered_Euclidean_Space.thy --- a/src/HOL/Multivariate_Analysis/Ordered_Euclidean_Space.thy Mon Dec 16 17:08:22 2013 +0100 +++ b/src/HOL/Multivariate_Analysis/Ordered_Euclidean_Space.thy Mon Dec 16 17:08:22 2013 +0100 @@ -79,8 +79,71 @@ lemma Basis_nonneg[intro, simp]: "i \ Basis \ 0 \ i" by (auto simp: eucl_le inner_Basis) +lemma Sup_eq_maximum_componentwise: + fixes s::"'a set" + assumes i: "\b. b \ Basis \ X \ b = i b \ b" + assumes sup: "\b x. b \ Basis \ x \ s \ x \ b \ X \ b" + assumes i_s: "\b. b \ Basis \ (i b \ b) \ (\x. x \ b) ` s" + shows "Sup s = X" + using assms + unfolding eucl_Sup euclidean_representation_setsum + by (auto simp: Sup_class.SUP_def intro!: conditionally_complete_lattice_class.cSup_eq_maximum) + +lemma Inf_eq_minimum_componentwise: + assumes i: "\b. b \ Basis \ X \ b = i b \ b" + assumes sup: "\b x. b \ Basis \ x \ s \ X \ b \ x \ b" + assumes i_s: "\b. b \ Basis \ (i b \ b) \ (\x. x \ b) ` s" + shows "Inf s = X" + using assms + unfolding eucl_Inf euclidean_representation_setsum + by (auto simp: Inf_class.INF_def intro!: conditionally_complete_lattice_class.cInf_eq_minimum) + end +lemma + compact_attains_Inf_componentwise: + fixes b::"'a::ordered_euclidean_space" + assumes "b \ Basis" assumes "X \ {}" "compact X" + obtains x where "x \ X" "x \ b = Inf X \ b" "\y. y \ X \ x \ b \ y \ b" +proof atomize_elim + let ?proj = "(\x. x \ b) ` X" + from assms have "compact ?proj" "?proj \ {}" + by (auto intro!: compact_continuous_image continuous_on_intros) + from compact_attains_inf[OF this] + obtain s x + where s: "s\(\x. x \ b) ` X" "\t. t\(\x. x \ b) ` X \ s \ t" + and x: "x \ X" "s = x \ b" "\y. y \ X \ x \ b \ y \ b" + by auto + hence "Inf ?proj = x \ b" + by (auto intro!: conditionally_complete_lattice_class.cInf_eq_minimum) + hence "x \ b = Inf X \ b" + by (auto simp: eucl_Inf Inf_class.INF_def inner_setsum_left inner_Basis if_distrib `b \ Basis` + setsum_delta cong: if_cong) + with x show "\x. x \ X \ x \ b = Inf X \ b \ (\y. y \ X \ x \ b \ y \ b)" by blast +qed + +lemma + compact_attains_Sup_componentwise: + fixes b::"'a::ordered_euclidean_space" + assumes "b \ Basis" assumes "X \ {}" "compact X" + obtains x where "x \ X" "x \ b = Sup X \ b" "\y. y \ X \ y \ b \ x \ b" +proof atomize_elim + let ?proj = "(\x. x \ b) ` X" + from assms have "compact ?proj" "?proj \ {}" + by (auto intro!: compact_continuous_image continuous_on_intros) + from compact_attains_sup[OF this] + obtain s x + where s: "s\(\x. x \ b) ` X" "\t. t\(\x. x \ b) ` X \ t \ s" + and x: "x \ X" "s = x \ b" "\y. y \ X \ y \ b \ x \ b" + by auto + hence "Sup ?proj = x \ b" + by (auto intro!: cSup_eq_maximum) + hence "x \ b = Sup X \ b" + by (auto simp: eucl_Sup[where 'a='a] SUP_def inner_setsum_left inner_Basis if_distrib `b \ Basis` + setsum_delta cong: if_cong) + with x show "\x. x \ X \ x \ b = Sup X \ b \ (\y. y \ X \ y \ b \ x \ b)" by blast +qed + lemma (in order) atLeastatMost_empty'[simp]: "(~ a <= b) \ {a..b} = {}" by (auto) @@ -649,6 +712,12 @@ unfolding closure_open_interval[OF assms, symmetric] unfolding open_inter_closure_eq_empty[OF open_interval] .. +lemma diameter_closed_interval: + fixes a b::"'a::ordered_euclidean_space" + shows "a \ b \ diameter {a..b} = dist a b" + by (force simp add: diameter_def SUP_def intro!: cSup_eq_maximum setL2_mono + simp: euclidean_dist_l2[where 'a='a] eucl_le[where 'a='a] dist_norm) + text {* Intervals in general, including infinite and mixtures of open and closed. *} definition "is_interval (s::('a::euclidean_space) set) \ @@ -669,6 +738,52 @@ unfolding is_interval_def by simp +lemma mem_is_intervalI: + assumes "is_interval s" + assumes "a \ s" "b \ s" + assumes "\i. i \ Basis \ a \ i \ x \ i \ x \ i \ b \ i \ b \ i \ x \ i \ x \ i \ a \ i" + shows "x \ s" + by (rule assms(1)[simplified is_interval_def, rule_format, OF assms(2,3,4)]) + +lemma interval_subst: + fixes S::"'a::ordered_euclidean_space set" + assumes "is_interval S" + assumes "x \ S" "y j \ S" + assumes "j \ Basis" + shows "(\i\Basis. (if i = j then y i \ i else x \ i) *\<^sub>R i) \ S" + by (rule mem_is_intervalI[OF assms(1,2)]) (auto simp: assms) + +lemma mem_interval_componentwiseI: + fixes S::"'a::ordered_euclidean_space set" + assumes "is_interval S" + assumes "\i. i \ Basis \ x \ i \ ((\x. x \ i) ` S)" + shows "x \ S" +proof - + from assms have "\i \ Basis. \s \ S. x \ i = s \ i" + by auto + with finite_Basis obtain s and bs::"'a list" where + s: "\i. i \ Basis \ x \ i = s i \ i" "\i. i \ Basis \ s i \ S" and + bs: "set bs = Basis" "distinct bs" + by (metis finite_distinct_list) + from nonempty_Basis s obtain j where j: "j \ Basis" "s j \ S" by blast + def y \ "list_rec + (s j) + (\j _ Y. (\i\Basis. (if i = j then s i \ i else Y \ i) *\<^sub>R i))" + have "x = (\i\Basis. (if i \ set bs then s i \ i else s j \ i) *\<^sub>R i)" + using bs by (auto simp add: s(1)[symmetric] euclidean_representation) + also have [symmetric]: "y bs = \" + using bs(2) bs(1)[THEN equalityD1] + by (induct bs) (auto simp: y_def euclidean_representation intro!: euclidean_eqI[where 'a='a]) + also have "y bs \ S" + using bs(1)[THEN equalityD1] + apply (induct bs) + apply (auto simp: y_def j) + apply (rule interval_subst[OF assms(1)]) + apply (auto simp: s) + done + finally show ?thesis . +qed + text{* Instantiation for intervals on @{text ordered_euclidean_space} *} lemma eucl_lessThan_eq_halfspaces: