# HG changeset patch # User paulson # Date 1523733592 -3600 # Node ID 349c639e593cd24d1d3b3c17c8808a1fc18708b4 # Parent a8177d098b74a3bc709945ad9dd48d1f4429dac6 more new theorems on real^1, matrices, etc. diff -r a8177d098b74 -r 349c639e593c src/HOL/Analysis/Cartesian_Euclidean_Space.thy --- a/src/HOL/Analysis/Cartesian_Euclidean_Space.thy Sat Apr 14 15:36:49 2018 +0100 +++ b/src/HOL/Analysis/Cartesian_Euclidean_Space.thy Sat Apr 14 20:19:52 2018 +0100 @@ -741,6 +741,12 @@ apply rule done +lemma inj_matrix_vector_mult: + fixes A::"'a::field^'n^'m" + assumes "invertible A" + shows "inj (( *v) A)" + by (metis assms inj_on_inverseI invertible_def matrix_vector_mul_assoc matrix_vector_mul_lid) + subsection\Some bounds on components etc. relative to operator norm\ @@ -1555,6 +1561,41 @@ lemma dist_real: "dist(x::real ^ 1) y = \(x$1) - (y$1)\" by (auto simp add: norm_real dist_norm) +subsection\Routine results connecting the types @{typ "real^1"} and @{typ real}\ + +lemma vector_one_nth [simp]: + fixes x :: "'a^1" shows "vec (x $ 1) = x" + by (metis vec_def vector_one) + +lemma vec_cbox_1_eq [simp]: + shows "vec ` cbox u v = cbox (vec u) (vec v ::real^1)" + by (force simp: Basis_vec_def cart_eq_inner_axis [symmetric] mem_box) + +lemma vec_nth_cbox_1_eq [simp]: + fixes u v :: "'a::euclidean_space^1" + shows "(\x. x $ 1) ` cbox u v = cbox (u$1) (v$1)" + by (auto simp: Basis_vec_def cart_eq_inner_axis [symmetric] mem_box image_iff Bex_def inner_axis) (metis vec_component) + +lemma vec_nth_1_iff_cbox [simp]: + fixes a b :: "'a::euclidean_space" + shows "(\x::'a^1. x $ 1) ` S = cbox a b \ S = cbox (vec a) (vec b)" + (is "?lhs = ?rhs") +proof + assume L: ?lhs show ?rhs + proof (intro equalityI subsetI) + fix x + assume "x \ S" + then have "x $ 1 \ (\v. v $ (1::1)) ` cbox (vec a) (vec b)" + using L by auto + then show "x \ cbox (vec a) (vec b)" + by (metis (no_types, lifting) imageE vector_one_nth) + next + fix x :: "'a^1" + assume "x \ cbox (vec a) (vec b)" + then show "x \ S" + by (metis (no_types, lifting) L imageE imageI vec_component vec_nth_cbox_1_eq vector_one_nth) + qed +qed simp lemma tendsto_at_within_vector_1: fixes S :: "'a :: metric_space set" diff -r a8177d098b74 -r 349c639e593c src/HOL/Analysis/Determinants.thy --- a/src/HOL/Analysis/Determinants.thy Sat Apr 14 15:36:49 2018 +0100 +++ b/src/HOL/Analysis/Determinants.thy Sat Apr 14 20:19:52 2018 +0100 @@ -773,7 +773,7 @@ finally show ?thesis unfolding th2 . qed -text \Relation to invertibility.\ +subsection \Relation to invertibility.\ lemma invertible_left_inverse: fixes A :: "real^'n^'n" @@ -838,7 +838,75 @@ by blast qed -text \Cramer's rule.\ +subsubsection\Invertibility of matrices and corresponding linear functions\ + +lemma matrix_left_invertible: + fixes f :: "real^'m \ real^'n" + assumes "linear f" + shows "((\B. B ** matrix f = mat 1) \ (\g. linear g \ g \ f = id))" +proof safe + fix B + assume 1: "B ** matrix f = mat 1" + show "\g. linear g \ g \ f = id" + proof (intro exI conjI) + show "linear (\y. B *v y)" + by (simp add: matrix_vector_mul_linear) + show "(( *v) B) \ f = id" + unfolding o_def + by (metis assms 1 eq_id_iff matrix_vector_mul matrix_vector_mul_assoc matrix_vector_mul_lid) + qed +next + fix g + assume "linear g" "g \ f = id" + then have "matrix g ** matrix f = mat 1" + by (metis assms matrix_compose matrix_id_mat_1) + then show "\B. B ** matrix f = mat 1" .. +qed + +lemma matrix_right_invertible: + fixes f :: "real^'m \ real^'n" + assumes "linear f" + shows "((\B. matrix f ** B = mat 1) \ (\g. linear g \ f \ g = id))" +proof safe + fix B + assume 1: "matrix f ** B = mat 1" + show "\g. linear g \ f \ g = id" + proof (intro exI conjI) + show "linear (( *v) B)" + by (simp add: matrix_vector_mul_linear) + show "f \ ( *v) B = id" + by (metis 1 assms comp_apply eq_id_iff linear_id matrix_id_mat_1 matrix_vector_mul_assoc matrix_works) + qed +next + fix g + assume "linear g" and "f \ g = id" + then have "matrix f ** matrix g = mat 1" + by (metis assms matrix_compose matrix_id_mat_1) + then show "\B. matrix f ** B = mat 1" .. +qed + +lemma matrix_invertible: + fixes f :: "real^'m \ real^'n" + assumes "linear f" + shows "invertible (matrix f) \ (\g. linear g \ f \ g = id \ g \ f = id)" + (is "?lhs = ?rhs") +proof + assume ?lhs then show ?rhs + by (metis assms invertible_def left_right_inverse_eq matrix_left_invertible matrix_right_invertible) +next + assume ?rhs then show ?lhs + by (metis assms invertible_def matrix_compose matrix_id_mat_1) +qed + +lemma invertible_eq_bij: + fixes m :: "real^'m^'n" + shows "invertible m \ bij (( *v) m)" + using matrix_invertible [OF matrix_vector_mul_linear] o_bij + apply (auto simp: bij_betw_def) + by (metis left_right_inverse_eq linear_injective_left_inverse [OF matrix_vector_mul_linear] + linear_surjective_right_inverse[OF matrix_vector_mul_linear]) + +subsection \Cramer's rule.\ lemma cramer_lemma_transpose: fixes A:: "real^'n^'n" @@ -929,6 +997,9 @@ definition "orthogonal_transformation f \ linear f \ (\v w. f v \ f w = v \ w)" +definition "orthogonal_matrix (Q::'a::semiring_1^'n^'n) \ + transpose Q ** Q = mat 1 \ Q ** transpose Q = mat 1" + lemma orthogonal_transformation: "orthogonal_transformation f \ linear f \ (\v. norm (f v) = norm v)" unfolding orthogonal_transformation_def @@ -938,9 +1009,6 @@ apply (simp add: dot_norm linear_add[symmetric]) done -definition "orthogonal_matrix (Q::'a::semiring_1^'n^'n) \ - transpose Q ** Q = mat 1 \ Q ** transpose Q = mat 1" - lemma orthogonal_transformation_id [simp]: "orthogonal_transformation (\x. x)" by (simp add: linear_iff orthogonal_transformation_def) @@ -956,6 +1024,9 @@ "orthogonal_transformation(\x. -(f x)) \ orthogonal_transformation f" by (auto simp: orthogonal_transformation_def dest: linear_compose_neg) +lemma orthogonal_transformation_scaleR: "orthogonal_transformation f \ f (c *\<^sub>R v) = c *\<^sub>R f v" + by (simp add: linear_iff orthogonal_transformation_def) + lemma orthogonal_transformation_linear: "orthogonal_transformation f \ linear f" by (simp add: orthogonal_transformation_def) diff -r a8177d098b74 -r 349c639e593c src/HOL/Analysis/Equivalence_Lebesgue_Henstock_Integration.thy --- a/src/HOL/Analysis/Equivalence_Lebesgue_Henstock_Integration.thy Sat Apr 14 15:36:49 2018 +0100 +++ b/src/HOL/Analysis/Equivalence_Lebesgue_Henstock_Integration.thy Sat Apr 14 20:19:52 2018 +0100 @@ -2434,7 +2434,6 @@ then show ?thesis by (simp add: euclidean_representation) qed - lemma absolutely_integrable_component_ubound: fixes f :: "'a :: euclidean_space \ 'b :: euclidean_space" @@ -2450,7 +2449,6 @@ by simp qed - lemma absolutely_integrable_component_lbound: fixes f :: "'a :: euclidean_space \ 'b :: euclidean_space" assumes f: "f absolutely_integrable_on A" and g: "g integrable_on A" @@ -2465,6 +2463,165 @@ by simp qed +lemma integrable_on_1_iff: + fixes f :: "'a::euclidean_space \ real^1" + shows "f integrable_on S \ (\x. f x $ 1) integrable_on S" + by (auto simp: integrable_componentwise_iff [of f] Basis_vec_def cart_eq_inner_axis) + +lemma integral_on_1_eq: + fixes f :: "'a::euclidean_space \ real^1" + shows "integral S f = vec (integral S (\x. f x $ 1))" +by (cases "f integrable_on S") (simp_all add: integrable_on_1_iff vec_eq_iff not_integrable_integral) + +lemma absolutely_integrable_on_1_iff: + fixes f :: "'a::euclidean_space \ real^1" + shows "f absolutely_integrable_on S \ (\x. f x $ 1) absolutely_integrable_on S" + unfolding absolutely_integrable_on_def + by (auto simp: integrable_on_1_iff norm_real) + +lemma absolutely_integrable_absolutely_integrable_lbound: + fixes f :: "'m::euclidean_space \ real" + assumes f: "f integrable_on S" and g: "g absolutely_integrable_on S" + and *: "\x. x \ S \ g x \ f x" + shows "f absolutely_integrable_on S" + by (rule absolutely_integrable_component_lbound [OF g f]) (simp add: *) + +lemma absolutely_integrable_absolutely_integrable_ubound: + fixes f :: "'m::euclidean_space \ real" + assumes fg: "f integrable_on S" "g absolutely_integrable_on S" + and *: "\x. x \ S \ f x \ g x" + shows "f absolutely_integrable_on S" + by (rule absolutely_integrable_component_ubound [OF fg]) (simp add: *) + +lemma has_integral_vec1_I_cbox: + fixes f :: "real^1 \ 'a::real_normed_vector" + assumes "(f has_integral y) (cbox a b)" + shows "((f \ vec) has_integral y) {a$1..b$1}" +proof - + have "((\x. f(vec x)) has_integral (1 / 1) *\<^sub>R y) ((\x. x $ 1) ` cbox a b)" + proof (rule has_integral_twiddle) + show "\w z::real^1. vec ` cbox u v = cbox w z" + "content (vec ` cbox u v :: (real^1) set) = 1 * content (cbox u v)" for u v + unfolding vec_cbox_1_eq + by (auto simp: content_cbox_if_cart interval_eq_empty_cart) + show "\w z. (\x. x $ 1) ` cbox u v = cbox w z" for u v :: "real^1" + using vec_nth_cbox_1_eq by blast + qed (auto simp: continuous_vec assms) + then show ?thesis + by (simp add: o_def) +qed + +lemma has_integral_vec1_I: + fixes f :: "real^1 \ 'a::real_normed_vector" + assumes "(f has_integral y) S" + shows "(f \ vec has_integral y) ((\x. x $ 1) ` S)" +proof - + have *: "\z. ((\x. if x \ (\x. x $ 1) ` S then (f \ vec) x else 0) has_integral z) {a..b} \ norm (z - y) < e" + if int: "\a b. ball 0 B \ cbox a b \ + (\z. ((\x. if x \ S then f x else 0) has_integral z) (cbox a b) \ norm (z - y) < e)" + and B: "ball 0 B \ {a..b}" for e B a b + proof - + have [simp]: "(\y\S. x = y $ 1) \ vec x \ S" for x + by force + have B': "ball (0::real^1) B \ cbox (vec a) (vec b)" + using B by (simp add: Basis_vec_def cart_eq_inner_axis [symmetric] mem_box norm_real subset_iff) + show ?thesis + using int [OF B'] by (auto simp: image_iff o_def cong: if_cong dest!: has_integral_vec1_I_cbox) + qed + show ?thesis + using assms + apply (subst has_integral_alt) + apply (subst (asm) has_integral_alt) + apply (simp add: has_integral_vec1_I_cbox split: if_split_asm) + apply (metis vector_one_nth) + apply (erule all_forward imp_forward asm_rl ex_forward conj_forward)+ + apply (blast intro!: *) + done +qed + +lemma has_integral_vec1_nth_cbox: + fixes f :: "real \ 'a::real_normed_vector" + assumes "(f has_integral y) {a..b}" + shows "((\x::real^1. f(x$1)) has_integral y) (cbox (vec a) (vec b))" +proof - + have "((\x::real^1. f(x$1)) has_integral (1 / 1) *\<^sub>R y) (vec ` cbox a b)" + proof (rule has_integral_twiddle) + show "\w z::real. (\x. x $ 1) ` cbox u v = cbox w z" + "content ((\x. x $ 1) ` cbox u v) = 1 * content (cbox u v)" for u v::"real^1" + unfolding vec_cbox_1_eq by (auto simp: content_cbox_if_cart interval_eq_empty_cart) + show "\w z::real^1. vec ` cbox u v = cbox w z" for u v :: "real" + using vec_cbox_1_eq by auto + qed (auto simp: continuous_vec assms) + then show ?thesis + using vec_cbox_1_eq by auto +qed + +lemma has_integral_vec1_D_cbox: + fixes f :: "real^1 \ 'a::real_normed_vector" + assumes "((f \ vec) has_integral y) {a$1..b$1}" + shows "(f has_integral y) (cbox a b)" + by (metis (mono_tags, lifting) assms comp_apply has_integral_eq has_integral_vec1_nth_cbox vector_one_nth) + +lemma has_integral_vec1_D: + fixes f :: "real^1 \ 'a::real_normed_vector" + assumes "((f \ vec) has_integral y) ((\x. x $ 1) ` S)" + shows "(f has_integral y) S" +proof - + have *: "\z. ((\x. if x \ S then f x else 0) has_integral z) (cbox a b) \ norm (z - y) < e" + if int: "\a b. ball 0 B \ {a..b} \ + (\z. ((\x. if x \ (\x. x $ 1) ` S then (f \ vec) x else 0) has_integral z) {a..b} \ norm (z - y) < e)" + and B: "ball 0 B \ cbox a b" for e B and a b::"real^1" + proof - + have B': "ball 0 B \ {a$1..b$1}" + using B + apply (simp add: subset_iff Basis_vec_def cart_eq_inner_axis [symmetric] mem_box) + apply (metis (full_types) norm_real vec_component) + done + have eq: "(\x. if vec x \ S then f (vec x) else 0) = (\x. if x \ S then f x else 0) \ vec" + by force + have [simp]: "(\y\S. x = y $ 1) \ vec x \ S" for x + by force + show ?thesis + using int [OF B'] by (auto simp: image_iff eq cong: if_cong dest!: has_integral_vec1_D_cbox) +qed + show ?thesis + using assms + apply (subst has_integral_alt) + apply (subst (asm) has_integral_alt) + apply (simp add: has_integral_vec1_D_cbox eq_cbox split: if_split_asm, blast) + apply (intro conjI impI) + apply (metis vector_one_nth) + apply (erule thin_rl) + apply (erule all_forward imp_forward asm_rl ex_forward conj_forward)+ + using * apply blast + done +qed + + +lemma integral_vec1_eq: + fixes f :: "real^1 \ 'a::real_normed_vector" + shows "integral S f = integral ((\x. x $ 1) ` S) (f \ vec)" + using has_integral_vec1_I [of f] has_integral_vec1_D [of f] + by (metis has_integral_iff not_integrable_integral) + +lemma absolutely_integrable_drop: + fixes f :: "real^1 \ 'b::euclidean_space" + shows "f absolutely_integrable_on S \ (f \ vec) absolutely_integrable_on (\x. x $ 1) ` S" + unfolding absolutely_integrable_on_def integrable_on_def +proof safe + fix y r + assume "(f has_integral y) S" "((\x. norm (f x)) has_integral r) S" + then show "\y. (f \ vec has_integral y) ((\x. x $ 1) ` S)" + "\y. ((\x. norm ((f \ vec) x)) has_integral y) ((\x. x $ 1) ` S)" + by (force simp: o_def dest!: has_integral_vec1_I)+ +next + fix y :: "'b" and r :: "real" + assume "(f \ vec has_integral y) ((\x. x $ 1) ` S)" + "((\x. norm ((f \ vec) x)) has_integral r) ((\x. x $ 1) ` S)" + then show "\y. (f has_integral y) S" "\y. ((\x. norm (f x)) has_integral y) S" + by (force simp: o_def intro: has_integral_vec1_D)+ +qed + subsection \Dominated convergence\ lemma dominated_convergence: @@ -2582,7 +2739,6 @@ qed (use b in auto) qed - lemma dominated_convergence_absolutely_integrable: fixes f :: "nat \ 'n::euclidean_space \ 'm::euclidean_space" assumes f: "\k. f k absolutely_integrable_on S" @@ -2597,6 +2753,37 @@ by (blast intro: absolutely_integrable_integrable_bound [where g=h]) qed + +proposition integral_countable_UN: + fixes f :: "real^'m \ real^'n" + assumes f: "f absolutely_integrable_on (\(range s))" + and s: "\m. s m \ sets lebesgue" + shows "\n. f absolutely_integrable_on (\m\n. s m)" + and "(\n. integral (\m\n. s m) f) \ integral (UNION UNIV s) f" (is "?F \ ?I") +proof - + show fU: "f absolutely_integrable_on (\m\n. s m)" for n + using assms by (blast intro: set_integrable_subset [OF f]) + have fint: "f integrable_on (\ (range s))" + using absolutely_integrable_on_def f by blast + let ?h = "\x. if x \ UNION UNIV s then norm(f x) else 0" + have "(\n. integral UNIV (\x. if x \ (\m\n. s m) then f x else 0)) + \ integral UNIV (\x. if x \ UNION UNIV s then f x else 0)" + proof (rule dominated_convergence) + show "(\x. if x \ (\m\n. s m) then f x else 0) integrable_on UNIV" for n + unfolding integrable_restrict_UNIV + using fU absolutely_integrable_on_def by blast + show "(\x. if x \ UNION UNIV s then norm(f x) else 0) integrable_on UNIV" + by (metis (no_types) absolutely_integrable_on_def f integrable_restrict_UNIV) + show "\x\UNIV. + (\n. if x \ (\m\n. s m) then f x else 0) + \ (if x \ UNION UNIV s then f x else 0)" + by (force intro: Lim_eventually eventually_sequentiallyI) + qed auto + then show "?F \ ?I" + by (simp only: integral_restrict_UNIV) +qed + + subsection \Fundamental Theorem of Calculus for the Lebesgue integral\ text \ diff -r a8177d098b74 -r 349c639e593c src/HOL/Analysis/Ordered_Euclidean_Space.thy --- a/src/HOL/Analysis/Ordered_Euclidean_Space.thy Sat Apr 14 15:36:49 2018 +0100 +++ b/src/HOL/Analysis/Ordered_Euclidean_Space.thy Sat Apr 14 20:19:52 2018 +0100 @@ -182,6 +182,11 @@ and eucl_le_atLeast: "{x. \i\Basis. a \ i <= x \ i} = {a..}" by (auto simp: eucl_le[where 'a='a] eucl_less_def box_def cbox_def) +lemma vec_nth_real_1_iff_cbox [simp]: + fixes a b :: real + shows "(\x::real^1. x $ 1) ` S = {a..b} \ S = cbox (vec a) (vec b)" + by (metis interval_cbox vec_nth_1_iff_cbox) + lemma closed_eucl_atLeastAtMost[simp, intro]: fixes a :: "'a::ordered_euclidean_space" shows "closed {a..b}"