diff -r 00c436488398 -r 817944aeac3f src/HOL/Analysis/Starlike.thy --- a/src/HOL/Analysis/Starlike.thy Tue Feb 20 22:25:23 2018 +0100 +++ b/src/HOL/Analysis/Starlike.thy Wed Feb 21 12:57:49 2018 +0000 @@ -7261,6 +7261,66 @@ with assms show ?thesis by auto qed +lemma vector_in_orthogonal_spanningset: + fixes a :: "'a::euclidean_space" + obtains S where "a \ S" "pairwise orthogonal S" "span S = UNIV" + by (metis UNIV_I Un_iff empty_iff insert_subset orthogonal_extension pairwise_def pairwise_orthogonal_insert span_UNIV subsetI subset_antisym) + +lemma vector_in_orthogonal_basis: + fixes a :: "'a::euclidean_space" + assumes "a \ 0" + obtains S where "a \ S" "0 \ S" "pairwise orthogonal S" "independent S" "finite S" + "span S = UNIV" "card S = DIM('a)" +proof - + obtain S where S: "a \ S" "pairwise orthogonal S" "span S = UNIV" + using vector_in_orthogonal_spanningset . + show thesis + proof + show "pairwise orthogonal (S - {0})" + using pairwise_mono S(2) by blast + show "independent (S - {0})" + by (simp add: \pairwise orthogonal (S - {0})\ pairwise_orthogonal_independent) + show "finite (S - {0})" + using \independent (S - {0})\ independent_finite by blast + show "card (S - {0}) = DIM('a)" + using span_delete_0 [of S] S + by (simp add: \independent (S - {0})\ indep_card_eq_dim_span) + qed (use S \a \ 0\ in auto) +qed + +lemma vector_in_orthonormal_basis: + fixes a :: "'a::euclidean_space" + assumes "norm a = 1" + obtains S where "a \ S" "pairwise orthogonal S" "\x. x \ S \ norm x = 1" + "independent S" "card S = DIM('a)" "span S = UNIV" +proof - + have "a \ 0" + using assms by auto + then obtain S where "a \ S" "0 \ S" "finite S" + and S: "pairwise orthogonal S" "independent S" "span S = UNIV" "card S = DIM('a)" + by (metis vector_in_orthogonal_basis) + let ?S = "(\x. x /\<^sub>R norm x) ` S" + show thesis + proof + show "a \ ?S" + using \a \ S\ assms image_iff by fastforce + next + show "pairwise orthogonal ?S" + using \pairwise orthogonal S\ by (auto simp: pairwise_def orthogonal_def) + show "\x. x \ (\x. x /\<^sub>R norm x) ` S \ norm x = 1" + using \0 \ S\ by (auto simp: divide_simps) + then show "independent ?S" + by (metis \pairwise orthogonal ((\x. x /\<^sub>R norm x) ` S)\ norm_zero pairwise_orthogonal_independent zero_neq_one) + have "inj_on (\x. x /\<^sub>R norm x) S" + unfolding inj_on_def + by (metis (full_types) S(1) \0 \ S\ inverse_nonzero_iff_nonzero norm_eq_zero orthogonal_scaleR orthogonal_self pairwise_def) + then show "card ?S = DIM('a)" + by (simp add: card_image S) + show "span ?S = UNIV" + by (metis (no_types) \0 \ S\ \finite S\ \span S = UNIV\ field_class.field_inverse_zero inverse_inverse_eq less_irrefl span_image_scale zero_less_norm_iff) + qed +qed + proposition dim_orthogonal_sum: fixes A :: "'a::euclidean_space set" assumes "\x y. \x \ A; y \ B\ \ x \ y = 0"