# HG changeset patch # User paulson # Date 1523824900 -3600 # Node ID b65c4a6a015e902288085ec24c71a73e238ae2c9 # Parent 7811748de2719d2b33b668ba5cc187d252bbd73b quite a few more results about negligibility, etc., and a bit of tidying up diff -r 7811748de271 -r b65c4a6a015e src/HOL/Analysis/Cartesian_Euclidean_Space.thy --- a/src/HOL/Analysis/Cartesian_Euclidean_Space.thy Sun Apr 15 17:22:58 2018 +0100 +++ b/src/HOL/Analysis/Cartesian_Euclidean_Space.thy Sun Apr 15 21:41:40 2018 +0100 @@ -540,7 +540,6 @@ mult_1_left mult_zero_left if_True UNIV_I) done - lemma matrix_mul_rid [simp]: fixes A :: "'a::semiring_1 ^ 'm ^ 'n" shows "A ** mat 1 = A" @@ -672,6 +671,12 @@ definition matrix :: "('a::{plus,times, one, zero}^'m \ 'a ^ 'n) \ 'a^'m^'n" where "matrix f = (\ i j. (f(axis j 1))$i)" +lemma matrix_id_mat_1: "matrix id = mat 1" + by (simp add: mat_def matrix_def axis_def) + +lemma matrix_scaleR: "(matrix (( *\<^sub>R) r)) = mat r" + by (simp add: mat_def matrix_def axis_def if_distrib cong: if_cong) + lemma matrix_vector_mul_linear: "linear(\x. A *v (x::real ^ _))" by (simp add: linear_iff matrix_vector_mult_def vec_eq_iff field_simps sum_distrib_left sum.distrib) @@ -896,22 +901,23 @@ by (metis matrix_transpose_mul transpose_mat transpose_transpose) lemma matrix_left_invertible_injective: - "(\B. (B::real^'m^'n) ** (A::real^'n^'m) = mat 1) \ (\x y. A *v x = A *v y \ x = y)" -proof - - { fix B:: "real^'m^'n" and x y assume B: "B ** A = mat 1" and xy: "A *v x = A*v y" - from xy have "B*v (A *v x) = B *v (A*v y)" by simp - hence "x = y" - unfolding matrix_vector_mul_assoc B matrix_vector_mul_lid . } - moreover - { assume A: "\x y. A *v x = A *v y \ x = y" - hence i: "inj (( *v) A)" unfolding inj_on_def by auto - from linear_injective_left_inverse[OF matrix_vector_mul_linear i] - obtain g where g: "linear g" "g \ ( *v) A = id" by blast - have "matrix g ** A = mat 1" - unfolding matrix_eq matrix_vector_mul_lid matrix_vector_mul_assoc[symmetric] matrix_works[OF g(1)] - using g(2) by (simp add: fun_eq_iff) - then have "\B. (B::real ^'m^'n) ** A = mat 1" by blast } - ultimately show ?thesis by blast + fixes A :: "real^'n^'m" + shows "(\B. B ** A = mat 1) \ inj (( *v) A)" +proof safe + fix B + assume B: "B ** A = mat 1" + show "inj (( *v) A)" + unfolding inj_on_def + by (metis B matrix_vector_mul_assoc matrix_vector_mul_lid) +next + assume "inj (( *v) A)" + with linear_injective_left_inverse[OF matrix_vector_mul_linear] + obtain g where "linear g" and g: "g \ ( *v) A = id" + by blast + have "matrix g ** A = mat 1" + by (metis \linear g\ g matrix_compose matrix_id_mat_1 matrix_of_matrix_vector_mul matrix_vector_mul_linear) + then show "\B. B ** A = mat 1" + by metis qed lemma matrix_left_invertible_ker: @@ -1443,15 +1449,14 @@ lemma jacobian_works: "(f::(real^'a) \ (real^'b)) differentiable net \ - (f has_derivative (\h. (jacobian f net) *v h)) net" - apply rule - unfolding jacobian_def - apply (simp only: matrix_works[OF linear_frechet_derivative]) defer - apply (rule differentiableI) - apply assumption - unfolding frechet_derivative_works - apply assumption - done + (f has_derivative (\h. (jacobian f net) *v h)) net" (is "?lhs = ?rhs") +proof + assume ?lhs then show ?rhs + by (simp add: frechet_derivative_works has_derivative_linear jacobian_def) +next + assume ?rhs then show ?lhs + by (rule differentiableI) +qed subsection \Component of the differential must be zero if it exists at a local @@ -1571,6 +1576,153 @@ lemma dist_real: "dist(x::real ^ 1) y = \(x$1) - (y$1)\" by (auto simp add: norm_real dist_norm) +subsection\ Rank of a matrix\ + +text\Equivalence of row and column rank is taken from George Mackiw's paper, Mathematics Magazine 1995, p. 285.\ + +lemma matrix_vector_mult_in_columnspace: + fixes A :: "real^'n^'m" + shows "(A *v x) \ span(columns A)" + apply (simp add: matrix_vector_column columns_def transpose_def column_def) + apply (intro span_sum span_mul) + apply (force intro: span_superset) + done + +lemma orthogonal_nullspace_rowspace: + fixes A :: "real^'n^'m" + assumes 0: "A *v x = 0" and y: "y \ span(rows A)" + shows "orthogonal x y" +proof (rule span_induct [OF y]) + show "subspace {a. orthogonal x a}" + by (simp add: subspace_orthogonal_to_vector) +next + fix v + assume "v \ rows A" + then obtain i where "v = row i A" + by (auto simp: rows_def) + with 0 show "orthogonal x v" + unfolding orthogonal_def inner_vec_def matrix_vector_mult_def row_def + by (simp add: mult.commute) (metis (no_types) vec_lambda_beta zero_index) +qed + +lemma nullspace_inter_rowspace: + fixes A :: "real^'n^'m" + shows "A *v x = 0 \ x \ span(rows A) \ x = 0" + using orthogonal_nullspace_rowspace orthogonal_self by auto + +lemma matrix_vector_mul_injective_on_rowspace: + fixes A :: "real^'n^'m" + shows "\A *v x = A *v y; x \ span(rows A); y \ span(rows A)\ \ x = y" + using nullspace_inter_rowspace [of A "x-y"] + by (metis eq_iff_diff_eq_0 matrix_vector_mult_diff_distrib span_diff) + +definition rank :: "real^'n^'m=>nat" + where "rank A \ dim(columns A)" + +lemma dim_rows_le_dim_columns: + fixes A :: "real^'n^'m" + shows "dim(rows A) \ dim(columns A)" +proof - + have "dim (span (rows A)) \ dim (span (columns A))" + proof - + obtain B where "independent B" "span(rows A) \ span B" + and B: "B \ span(rows A)""card B = dim (span(rows A))" + using basis_exists [of "span(rows A)"] by blast + with span_subspace have eq: "span B = span(rows A)" + by auto + then have inj: "inj_on (( *v) A) (span B)" + using inj_on_def matrix_vector_mul_injective_on_rowspace by blast + then have ind: "independent (( *v) A ` B)" + by (rule independent_inj_on_image [OF \independent B\ matrix_vector_mul_linear]) + then have "finite (( *v) A ` B) \ card (( *v) A ` B) \ dim (( *v) A ` B)" + by (rule independent_bound_general) + then show ?thesis + by (metis (no_types, lifting) B ind inj eq card_image image_subset_iff independent_card_le_dim inj_on_subset matrix_vector_mult_in_columnspace) + qed + then show ?thesis + by simp +qed + +lemma rank_row: + fixes A :: "real^'n^'m" + shows "rank A = dim(rows A)" + unfolding rank_def + by (metis dim_rows_le_dim_columns columns_transpose dual_order.antisym rows_transpose) + +lemma rank_transpose: + fixes A :: "real^'n^'m" + shows "rank(transpose A) = rank A" + by (metis rank_def rank_row rows_transpose) + +lemma matrix_vector_mult_basis: + fixes A :: "real^'n^'m" + shows "A *v (axis k 1) = column k A" + by (simp add: cart_eq_inner_axis column_def matrix_mult_dot) + +lemma columns_image_basis: + fixes A :: "real^'n^'m" + shows "columns A = ( *v) A ` (range (\i. axis i 1))" + by (force simp: columns_def matrix_vector_mult_basis [symmetric]) + +lemma rank_dim_range: + fixes A :: "real^'n^'m" + shows "rank A = dim(range (\x. A *v x))" + unfolding rank_def +proof (rule span_eq_dim) + show "span (columns A) = span (range (( *v) A))" + apply (auto simp: columns_image_basis span_linear_image matrix_vector_mul_linear) + by (metis columns_image_basis matrix_vector_mul_linear matrix_vector_mult_in_columnspace span_linear_image) +qed + +lemma rank_bound: + fixes A :: "real^'n^'m" + shows "rank A \ min CARD('m) (CARD('n))" + by (metis (mono_tags, hide_lams) min.bounded_iff DIM_cart DIM_real dim_subset_UNIV mult.right_neutral rank_def rank_transpose) + +lemma full_rank_injective: + fixes A :: "real^'n^'m" + shows "rank A = CARD('n) \ inj (( *v) A)" + by (simp add: matrix_left_invertible_injective [symmetric] matrix_left_invertible_span_rows rank_row dim_eq_full [symmetric]) + +lemma full_rank_surjective: + fixes A :: "real^'n^'m" + shows "rank A = CARD('m) \ surj (( *v) A)" + by (simp add: matrix_right_invertible_surjective [symmetric] left_invertible_transpose [symmetric] + matrix_left_invertible_injective full_rank_injective [symmetric] rank_transpose) + +lemma rank_I: "rank(mat 1::real^'n^'n) = CARD('n)" + by (simp add: full_rank_injective inj_on_def) + +lemma less_rank_noninjective: + fixes A :: "real^'n^'m" + shows "rank A < CARD('n) \ \ inj (( *v) A)" +using less_le rank_bound by (auto simp: full_rank_injective [symmetric]) + +lemma matrix_nonfull_linear_equations_eq: + fixes A :: "real^'n^'m" + shows "(\x. (x \ 0) \ A *v x = 0) \ ~(rank A = CARD('n))" + by (meson matrix_left_invertible_injective full_rank_injective matrix_left_invertible_ker) + +lemma rank_eq_0: "rank A = 0 \ A = 0" and rank_0 [simp]: "rank 0 = 0" + by (auto simp: rank_dim_range matrix_eq) + + +lemma rank_mul_le_right: + fixes A :: "real^'n^'m" and B :: "real^'p^'n" + shows "rank(A ** B) \ rank B" +proof - + have "rank(A ** B) \ dim (( *v) A ` range (( *v) B))" + by (auto simp: rank_dim_range image_comp o_def matrix_vector_mul_assoc) + also have "\ \ rank B" + by (simp add: rank_dim_range matrix_vector_mul_linear dim_image_le) + finally show ?thesis . +qed + +lemma rank_mul_le_left: + fixes A :: "real^'n^'m" and B :: "real^'p^'n" + shows "rank(A ** B) \ rank A" + by (metis matrix_transpose_mul rank_mul_le_right rank_transpose) + subsection\Routine results connecting the types @{typ "real^1"} and @{typ real}\ lemma vector_one_nth [simp]: diff -r 7811748de271 -r b65c4a6a015e src/HOL/Analysis/Determinants.thy --- a/src/HOL/Analysis/Determinants.thy Sun Apr 15 17:22:58 2018 +0100 +++ b/src/HOL/Analysis/Determinants.thy Sun Apr 15 21:41:40 2018 +0100 @@ -464,15 +464,9 @@ done qed -lemma matrix_id_mat_1: "matrix id = mat 1" - by (simp add: mat_def matrix_def axis_def) - lemma matrix_id [simp]: "det (matrix id) = 1" by (simp add: matrix_id_mat_1) -lemma matrix_scaleR: "(matrix (( *\<^sub>R) r)) = mat r" - by (simp add: mat_def matrix_def axis_def if_distrib cong: if_cong) - lemma det_matrix_scaleR [simp]: "det (matrix ((( *\<^sub>R) r)) :: real^'n^'n) = r ^ CARD('n::finite)" apply (subst det_diagonal) apply (auto simp: matrix_def mat_def prod_constant) diff -r 7811748de271 -r b65c4a6a015e src/HOL/Analysis/Equivalence_Lebesgue_Henstock_Integration.thy --- a/src/HOL/Analysis/Equivalence_Lebesgue_Henstock_Integration.thy Sun Apr 15 17:22:58 2018 +0100 +++ b/src/HOL/Analysis/Equivalence_Lebesgue_Henstock_Integration.thy Sun Apr 15 21:41:40 2018 +0100 @@ -1337,6 +1337,31 @@ by (metis S Un_commute add.right_neutral lmeasurable_negligible_symdiff measure_Un2 neg negligible_Un_eq negligible_imp_measure0) qed +text\Negligibility of image under non-injective linear map\ +lemma negligible_Union_nat: + assumes "\n::nat. negligible(S n)" + shows "negligible(\n. S n)" +proof - + have "negligible (\m\k. S m)" for k + using assms by blast + then have 0: "integral UNIV (indicat_real (\m\k. S m)) = 0" + and 1: "(indicat_real (\m\k. S m)) integrable_on UNIV" for k + by (auto simp: negligible has_integral_iff) + have 2: "\k x. indicat_real (\m\k. S m) x \ (indicat_real (\m\Suc k. S m) x)" + by (simp add: indicator_def) + have 3: "\x. (\k. indicat_real (\m\k. S m) x) \ (indicat_real (\n. S n) x)" + by (force simp: indicator_def eventually_sequentially intro: Lim_eventually) + have 4: "bounded (range (\k. integral UNIV (indicat_real (\m\k. S m))))" + by (simp add: 0 image_def) + have *: "indicat_real (\n. S n) integrable_on UNIV \ + (\k. integral UNIV (indicat_real (\m\k. S m))) \ (integral UNIV (indicat_real (\n. S n)))" + by (intro monotone_convergence_increasing 1 2 3 4) + then have "integral UNIV (indicat_real (\n. S n)) = (0::real)" + using LIMSEQ_unique by (auto simp: 0) + then show ?thesis + using * by (simp add: negligible_UNIV has_integral_iff) +qed + subsection \Negligibility of a Lipschitz image of a negligible set\ text\The bound will be eliminated by a sort of onion argument\ diff -r 7811748de271 -r b65c4a6a015e src/HOL/Analysis/Inner_Product.thy --- a/src/HOL/Analysis/Inner_Product.thy Sun Apr 15 17:22:58 2018 +0100 +++ b/src/HOL/Analysis/Inner_Product.thy Sun Apr 15 21:41:40 2018 +0100 @@ -49,6 +49,9 @@ lemma inner_sum_left: "inner (\x\A. f x) y = (\x\A. inner (f x) y)" by (cases "finite A", induct set: finite, simp_all add: inner_add_left) +lemma all_zero_iff [simp]: "(\u. inner x u = 0) \ (x = 0)" + by auto (use inner_eq_zero_iff in blast) + text \Transfer distributivity rules to right argument.\ lemma inner_add_right: "inner x (y + z) = inner x y + inner x z" @@ -420,32 +423,12 @@ lemma GDERIV_inverse: "\GDERIV f x :> df; f x \ 0\ \ GDERIV (\x. inverse (f x)) x :> - (inverse (f x))\<^sup>2 *\<^sub>R df" - apply (erule GDERIV_DERIV_compose) - apply (erule DERIV_inverse [folded numeral_2_eq_2]) - done - + by (metis DERIV_inverse GDERIV_DERIV_compose numerals(2)) + lemma GDERIV_norm: assumes "x \ 0" shows "GDERIV (\x. norm x) x :> sgn x" -proof - - have 1: "FDERIV (\x. inner x x) x :> (\h. inner x h + inner h x)" - by (intro has_derivative_inner has_derivative_ident) - have 2: "(\h. inner x h + inner h x) = (\h. inner h (scaleR 2 x))" - by (simp add: fun_eq_iff inner_commute) - have "0 < inner x x" using \x \ 0\ by simp - then have 3: "DERIV sqrt (inner x x) :> (inverse (sqrt (inner x x)) / 2)" - by (rule DERIV_real_sqrt) - have 4: "(inverse (sqrt (inner x x)) / 2) *\<^sub>R 2 *\<^sub>R x = sgn x" - by (simp add: sgn_div_norm norm_eq_sqrt_inner) - show ?thesis - unfolding norm_eq_sqrt_inner - apply (rule GDERIV_subst [OF _ 4]) - apply (rule GDERIV_DERIV_compose [where g=sqrt and df="scaleR 2 x"]) - apply (subst gderiv_def) - apply (rule has_derivative_subst [OF _ 2]) - apply (rule 1) - apply (rule 3) - done -qed + unfolding gderiv_def norm_eq_sqrt_inner + by (rule derivative_eq_intros | force simp add: inner_commute sgn_div_norm norm_eq_sqrt_inner assms)+ lemmas has_derivative_norm = GDERIV_norm [unfolded gderiv_def] diff -r 7811748de271 -r b65c4a6a015e src/HOL/Analysis/Lebesgue_Measure.thy --- a/src/HOL/Analysis/Lebesgue_Measure.thy Sun Apr 15 17:22:58 2018 +0100 +++ b/src/HOL/Analysis/Lebesgue_Measure.thy Sun Apr 15 21:41:40 2018 +0100 @@ -1004,6 +1004,83 @@ assumes "bounded S" "S \ sets lebesgue" shows "S \ lmeasurable" by (metis assms bounded_Un emeasure_bounded_finite emeasure_completion fmeasurableI main_part_null_part_Un) + +subsection\Translation preserves Lebesgue measure\ + +lemma sigma_sets_image: + assumes S: "S \ sigma_sets \ M" and "M \ Pow \" "f ` \ = \" "inj_on f \" + and M: "\y. y \ M \ f ` y \ M" + shows "(f ` S) \ sigma_sets \ M" + using S +proof (induct S rule: sigma_sets.induct) + case (Basic a) then show ?case + by (simp add: M) +next + case Empty then show ?case + by (simp add: sigma_sets.Empty) +next + case (Compl a) + then have "\ - a \ \" "a \ \" + by (auto simp: sigma_sets_into_sp [OF \M \ Pow \\]) + then show ?case + by (auto simp: inj_on_image_set_diff [OF \inj_on f \\] assms intro: Compl sigma_sets.Compl) +next + case (Union a) then show ?case + by (metis image_UN sigma_sets.simps) +qed + +lemma null_sets_translation: + assumes "N \ null_sets lborel" shows "{x. x - a \ N} \ null_sets lborel" +proof - + have [simp]: "(\x. x + a) ` N = {x. x - a \ N}" + by force + show ?thesis + using assms emeasure_lebesgue_affine [of 1 a N] by (auto simp: null_sets_def) +qed + +lemma lebesgue_sets_translation: + fixes f :: "'a \ 'a::euclidean_space" + assumes S: "S \ sets lebesgue" + shows "((\x. a + x) ` S) \ sets lebesgue" +proof - + have im_eq: "(+) a ` A = {x. x - a \ A}" for A + by force + have "((\x. a + x) ` S) = ((\x. -a + x) -` S) \ (space lebesgue)" + using image_iff by fastforce + also have "\ \ sets lebesgue" + proof (rule measurable_sets [OF measurableI assms]) + fix A :: "'b set" + assume A: "A \ sets lebesgue" + have vim_eq: "(\x. x - a) -` A = (+) a ` A" for A + by force + have "\s n N'. (+) a ` (S \ N) = s \ n \ s \ sets borel \ N' \ null_sets lborel \ n \ N'" + if "S \ sets borel" and "N' \ null_sets lborel" and "N \ N'" for S N N' + proof (intro exI conjI) + show "(+) a ` (S \ N) = (\x. a + x) ` S \ (\x. a + x) ` N" + by auto + show "(\x. a + x) ` N' \ null_sets lborel" + using that by (auto simp: null_sets_translation im_eq) + qed (use that im_eq in auto) + with A have "(\x. x - a) -` A \ sets lebesgue" + by (force simp: vim_eq completion_def intro!: sigma_sets_image) + then show "(+) (- a) -` A \ space lebesgue \ sets lebesgue" + by (auto simp: vimage_def im_eq) + qed auto + finally show ?thesis . +qed + +lemma measurable_translation: + "S \ lmeasurable \ ((\x. a + x) ` S) \ lmeasurable" + unfolding fmeasurable_def +apply (auto intro: lebesgue_sets_translation) + using emeasure_lebesgue_affine [of 1 a S] + by (auto simp: add.commute [of _ a]) + +lemma measure_translation: + "measure lebesgue ((\x. a + x) ` S) = measure lebesgue S" + using measure_lebesgue_affine [of 1 a S] + by (auto simp: add.commute [of _ a]) + subsection \A nice lemma for negligibility proofs\ lemma summable_iff_suminf_neq_top: "(\n. f n \ 0) \ \ summable f \ (\i. ennreal (f i)) = top" diff -r 7811748de271 -r b65c4a6a015e src/HOL/Analysis/Starlike.thy --- a/src/HOL/Analysis/Starlike.thy Sun Apr 15 17:22:58 2018 +0100 +++ b/src/HOL/Analysis/Starlike.thy Sun Apr 15 21:41:40 2018 +0100 @@ -8302,5 +8302,125 @@ using that by metis qed + +subsection{*Orthogonal complement*} + +definition orthogonal_comp ("_\<^sup>\" [80] 80) + where "orthogonal_comp W \ {x. \y \ W. orthogonal y x}" + +lemma subspace_orthogonal_comp: "subspace (W\<^sup>\)" + unfolding subspace_def orthogonal_comp_def orthogonal_def + by (auto simp: inner_right_distrib) + +lemma orthogonal_comp_anti_mono: + assumes "A \ B" + shows "B\<^sup>\ \ A\<^sup>\" +proof + fix x assume x: "x \ B\<^sup>\" + show "x \ orthogonal_comp A" using x unfolding orthogonal_comp_def + by (simp add: orthogonal_def, metis assms in_mono) +qed + +lemma orthogonal_comp_null [simp]: "{0}\<^sup>\ = UNIV" + by (auto simp: orthogonal_comp_def orthogonal_def) + +lemma orthogonal_comp_UNIV [simp]: "UNIV\<^sup>\ = {0}" + unfolding orthogonal_comp_def orthogonal_def + by auto (use inner_eq_zero_iff in blast) + +lemma orthogonal_comp_subset: "U \ U\<^sup>\\<^sup>\" + by (auto simp: orthogonal_comp_def orthogonal_def inner_commute) + +lemma subspace_sum_minimal: + assumes "S \ U" "T \ U" "subspace U" + shows "S + T \ U" +proof + fix x + assume "x \ S + T" + then obtain xs xt where "xs \ S" "xt \ T" "x = xs+xt" + by (meson set_plus_elim) + then show "x \ U" + by (meson assms subsetCE subspace_add) +qed + +lemma subspace_sum_orthogonal_comp: + fixes U :: "'a :: euclidean_space set" + assumes "subspace U" + shows "U + U\<^sup>\ = UNIV" +proof - + obtain B where "B \ U" + and ortho: "pairwise orthogonal B" "\x. x \ B \ norm x = 1" + and "independent B" "card B = dim U" "span B = U" + using orthonormal_basis_subspace [OF assms] by metis + then have "finite B" + by (simp add: indep_card_eq_dim_span) + have *: "\x\B. \y\B. x \ y = (if x=y then 1 else 0)" + using ortho norm_eq_1 by (auto simp: orthogonal_def pairwise_def) + { fix v + let ?u = "\b\B. (v \ b) *\<^sub>R b" + have "v = ?u + (v - ?u)" + by simp + moreover have "?u \ U" + by (metis (no_types, lifting) \span B = U\ assms real_vector_class.subspace_sum span_clauses(1) span_mul) + moreover have "(v - ?u) \ U\<^sup>\" + proof (clarsimp simp: orthogonal_comp_def orthogonal_def) + fix y + assume "y \ U" + with \span B = U\ span_finite [OF \finite B\] + obtain u where u: "y = (\b\B. u b *\<^sub>R b)" + by auto + have "b \ (v - ?u) = 0" if "b \ B" for b + using that \finite B\ + by (simp add: * algebra_simps inner_sum_right if_distrib [of "( *)v" for v] inner_commute cong: if_cong) + then show "y \ (v - ?u) = 0" + by (simp add: u inner_sum_left) + qed + ultimately have "v \ U + U\<^sup>\" + using set_plus_intro by fastforce + } then show ?thesis + by auto +qed + +lemma orthogonal_Int_0: + assumes "subspace U" + shows "U \ U\<^sup>\ = {0}" + using orthogonal_comp_def orthogonal_self + by (force simp: assms subspace_0 subspace_orthogonal_comp) + +lemma orthogonal_comp_self: + fixes U :: "'a :: euclidean_space set" + assumes "subspace U" + shows "U\<^sup>\\<^sup>\ = U" +proof + have ssU': "subspace (U\<^sup>\)" + by (simp add: subspace_orthogonal_comp) + have "u \ U" if "u \ U\<^sup>\\<^sup>\" for u + proof - + obtain v w where "u = v+w" "v \ U" "w \ U\<^sup>\" + using subspace_sum_orthogonal_comp [OF assms] set_plus_elim by blast + then have "u-v \ U\<^sup>\" + by simp + moreover have "v \ U\<^sup>\\<^sup>\" + using \v \ U\ orthogonal_comp_subset by blast + then have "u-v \ U\<^sup>\\<^sup>\" + by (simp add: subspace_diff subspace_orthogonal_comp that) + ultimately have "u-v = 0" + using orthogonal_Int_0 ssU' by blast + with \v \ U\ show ?thesis + by auto + qed + then show "U\<^sup>\\<^sup>\ \ U" + by auto +qed (use orthogonal_comp_subset in auto) + +lemma ker_orthogonal_comp_adjoint: + fixes f :: "'m::euclidean_space \ 'n::euclidean_space" + assumes "linear f" + shows "f -` {0} = (range (adjoint f))\<^sup>\" + apply (auto simp: orthogonal_comp_def orthogonal_def) + apply (simp add: adjoint_works assms(1) inner_commute) + by (metis adjoint_works all_zero_iff assms(1) inner_commute) + + end diff -r 7811748de271 -r b65c4a6a015e src/HOL/Analysis/Weierstrass_Theorems.thy --- a/src/HOL/Analysis/Weierstrass_Theorems.thy Sun Apr 15 17:22:58 2018 +0100 +++ b/src/HOL/Analysis/Weierstrass_Theorems.thy Sun Apr 15 21:41:40 2018 +0100 @@ -1375,7 +1375,8 @@ apply (simp add: \finite B\) using \polynomial_function g\ by auto show "(\x. \i\B. (g x \ i) *\<^sub>R i) ` S \ T" - using \B \ T\ by (blast intro: subspace_sum subspace_mul \subspace T\) + using \B \ T\ + by (blast intro: real_vector_class.subspace_sum subspace_mul \subspace T\) show "norm (f x - (\i\B. (g x \ i) *\<^sub>R i)) < e" if "x \ S" for x proof - have orth': "pairwise (\i j. orthogonal ((f x \ i) *\<^sub>R i - (g x \ i) *\<^sub>R i)