| author | wenzelm | 
| Thu, 10 Oct 2024 12:19:50 +0200 | |
| changeset 81144 | 6e6766cddf73 | 
| parent 78656 | 4da1e18a9633 | 
| child 82518 | da14e77a48b2 | 
| permissions | -rw-r--r-- | 
| 63627 | 1 | (* Title: HOL/Analysis/Linear_Algebra.thy | 
| 44133 | 2 | Author: Amine Chaieb, University of Cambridge | 
| 3 | *) | |
| 4 | ||
| 69517 | 5 | section \<open>Elementary Linear Algebra on Euclidean Spaces\<close> | 
| 44133 | 6 | |
| 7 | theory Linear_Algebra | |
| 8 | imports | |
| 9 | Euclidean_Space | |
| 66453 
cc19f7ca2ed6
session-qualified theory imports: isabelle imports -U -i -d '~~/src/Benchmarks' -a;
 wenzelm parents: 
66447diff
changeset | 10 | "HOL-Library.Infinite_Set" | 
| 44133 | 11 | begin | 
| 12 | ||
| 63886 
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
 hoelzl parents: 
63881diff
changeset | 13 | lemma linear_simps: | 
| 
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
 hoelzl parents: 
63881diff
changeset | 14 | assumes "bounded_linear f" | 
| 
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
 hoelzl parents: 
63881diff
changeset | 15 | shows | 
| 
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
 hoelzl parents: 
63881diff
changeset | 16 | "f (a + b) = f a + f b" | 
| 
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
 hoelzl parents: 
63881diff
changeset | 17 | "f (a - b) = f a - f b" | 
| 
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
 hoelzl parents: 
63881diff
changeset | 18 | "f 0 = 0" | 
| 
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
 hoelzl parents: 
63881diff
changeset | 19 | "f (- a) = - f a" | 
| 
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
 hoelzl parents: 
63881diff
changeset | 20 | "f (s *\<^sub>R v) = s *\<^sub>R (f v)" | 
| 
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
 hoelzl parents: 
63881diff
changeset | 21 | proof - | 
| 
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
 hoelzl parents: 
63881diff
changeset | 22 | interpret f: bounded_linear f by fact | 
| 
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
 hoelzl parents: 
63881diff
changeset | 23 | show "f (a + b) = f a + f b" by (rule f.add) | 
| 
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
 hoelzl parents: 
63881diff
changeset | 24 | show "f (a - b) = f a - f b" by (rule f.diff) | 
| 
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
 hoelzl parents: 
63881diff
changeset | 25 | show "f 0 = 0" by (rule f.zero) | 
| 68072 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 26 | show "f (- a) = - f a" by (rule f.neg) | 
| 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 27 | show "f (s *\<^sub>R v) = s *\<^sub>R (f v)" by (rule f.scale) | 
| 44133 | 28 | qed | 
| 29 | ||
| 68069 
36209dfb981e
tidying up and using real induction methods
 paulson <lp15@cam.ac.uk> parents: 
68062diff
changeset | 30 | lemma finite_Atleast_Atmost_nat[simp]: "finite {f x |x. x \<in> (UNIV::'a::finite set)}"
 | 
| 
36209dfb981e
tidying up and using real induction methods
 paulson <lp15@cam.ac.uk> parents: 
68062diff
changeset | 31 | using finite finite_image_set by blast | 
| 44133 | 32 | |
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 33 | lemma substdbasis_expansion_unique: | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 34 | includes inner_syntax | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 35 | assumes d: "d \<subseteq> Basis" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 36 | shows "(\<Sum>i\<in>d. f i *\<^sub>R i) = (x::'a::euclidean_space) \<longleftrightarrow> | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 37 | (\<forall>i\<in>Basis. (i \<in> d \<longrightarrow> f i = x \<bullet> i) \<and> (i \<notin> d \<longrightarrow> x \<bullet> i = 0))" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 38 | proof - | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 39 | have *: "\<And>x a b P. x * (if P then a else b) = (if P then x * a else x * b)" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 40 | by auto | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 41 | have **: "finite d" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 42 | by (auto intro: finite_subset[OF assms]) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 43 | have ***: "\<And>i. i \<in> Basis \<Longrightarrow> (\<Sum>i\<in>d. f i *\<^sub>R i) \<bullet> i = (\<Sum>x\<in>d. if x = i then f x else 0)" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 44 | using d | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 45 | by (auto intro!: sum.cong simp: inner_Basis inner_sum_left) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 46 | show ?thesis | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 47 | unfolding euclidean_eq_iff[where 'a='a] by (auto simp: sum.delta[OF **] ***) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 48 | qed | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 49 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 50 | lemma independent_substdbasis: "d \<subseteq> Basis \<Longrightarrow> independent d" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 51 | by (rule independent_mono[OF independent_Basis]) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 52 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 53 | lemma subset_translation_eq [simp]: | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 54 | fixes a :: "'a::real_vector" shows "(+) a ` s \<subseteq> (+) a ` t \<longleftrightarrow> s \<subseteq> t" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 55 | by auto | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 56 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 57 | lemma translate_inj_on: | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 58 | fixes A :: "'a::ab_group_add set" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 59 | shows "inj_on (\<lambda>x. a + x) A" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 60 | unfolding inj_on_def by auto | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 61 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 62 | lemma translation_assoc: | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 63 | fixes a b :: "'a::ab_group_add" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 64 | shows "(\<lambda>x. b + x) ` ((\<lambda>x. a + x) ` S) = (\<lambda>x. (a + b) + x) ` S" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 65 | by auto | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 66 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 67 | lemma translation_invert: | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 68 | fixes a :: "'a::ab_group_add" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 69 | assumes "(\<lambda>x. a + x) ` A = (\<lambda>x. a + x) ` B" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 70 | shows "A = B" | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 71 | using assms translation_assoc by fastforce | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 72 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 73 | lemma translation_galois: | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 74 | fixes a :: "'a::ab_group_add" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 75 | shows "T = ((\<lambda>x. a + x) ` S) \<longleftrightarrow> S = ((\<lambda>x. (- a) + x) ` T)" | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 76 | by (metis add.right_inverse group_cancel.rule0 translation_invert translation_assoc) | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 77 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 78 | lemma translation_inverse_subset: | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 79 | assumes "((\<lambda>x. - a + x) ` V) \<le> (S :: 'n::ab_group_add set)" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 80 | shows "V \<le> ((\<lambda>x. a + x) ` S)" | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 81 | by (metis assms subset_image_iff translation_galois) | 
| 53406 | 82 | |
| 70136 | 83 | subsection\<^marker>\<open>tag unimportant\<close> \<open>More interesting properties of the norm\<close> | 
| 63050 | 84 | |
| 69674 | 85 | unbundle inner_syntax | 
| 63050 | 86 | |
| 69597 | 87 | text\<open>Equality of vectors in terms of \<^term>\<open>(\<bullet>)\<close> products.\<close> | 
| 63050 | 88 | |
| 89 | lemma linear_componentwise: | |
| 90 | fixes f:: "'a::euclidean_space \<Rightarrow> 'b::real_inner" | |
| 91 | assumes lf: "linear f" | |
| 92 | shows "(f x) \<bullet> j = (\<Sum>i\<in>Basis. (x\<bullet>i) * (f i\<bullet>j))" (is "?lhs = ?rhs") | |
| 93 | proof - | |
| 68072 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 94 | interpret linear f by fact | 
| 63050 | 95 | have "?rhs = (\<Sum>i\<in>Basis. (x\<bullet>i) *\<^sub>R (f i))\<bullet>j" | 
| 64267 | 96 | by (simp add: inner_sum_left) | 
| 63050 | 97 | then show ?thesis | 
| 68072 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 98 | by (simp add: euclidean_representation sum[symmetric] scale[symmetric]) | 
| 63050 | 99 | qed | 
| 100 | ||
| 101 | lemma vector_eq: "x = y \<longleftrightarrow> x \<bullet> x = x \<bullet> y \<and> y \<bullet> y = x \<bullet> x" | |
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 102 | by (metis (no_types, opaque_lifting) inner_commute inner_diff_right inner_eq_zero_iff right_minus_eq) | 
| 63050 | 103 | |
| 104 | lemma norm_triangle_half_r: | |
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 105 | "norm (y - x1) < e/2 \<Longrightarrow> norm (y - x2) < e/2 \<Longrightarrow> norm (x1 - x2) < e" | 
| 63050 | 106 | using dist_triangle_half_r unfolding dist_norm[symmetric] by auto | 
| 107 | ||
| 108 | lemma norm_triangle_half_l: | |
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 109 | assumes "norm (x - y) < e/2" and "norm (x' - y) < e/2" | 
| 63050 | 110 | shows "norm (x - x') < e" | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 111 | by (metis assms dist_norm dist_triangle_half_l) | 
| 63050 | 112 | |
| 66420 | 113 | lemma abs_triangle_half_r: | 
| 114 | fixes y :: "'a::linordered_field" | |
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 115 | shows "abs (y - x1) < e/2 \<Longrightarrow> abs (y - x2) < e/2 \<Longrightarrow> abs (x1 - x2) < e" | 
| 66420 | 116 | by linarith | 
| 117 | ||
| 118 | lemma abs_triangle_half_l: | |
| 119 | fixes y :: "'a::linordered_field" | |
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 120 | assumes "abs (x - y) < e/2" and "abs (x' - y) < e/2" | 
| 66420 | 121 | shows "abs (x - x') < e" | 
| 122 | using assms by linarith | |
| 123 | ||
| 64267 | 124 | lemma sum_clauses: | 
| 125 |   shows "sum f {} = 0"
 | |
| 126 | and "finite S \<Longrightarrow> sum f (insert x S) = (if x \<in> S then sum f S else f x + sum f S)" | |
| 63050 | 127 | by (auto simp add: insert_absorb) | 
| 128 | ||
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 129 | lemma vector_eq_ldot: "(\<forall>x. x \<bullet> y = x \<bullet> z) \<longleftrightarrow> y = z" and vector_eq_rdot: "(\<forall>z. x \<bullet> z = y \<bullet> z) \<longleftrightarrow> x = y" | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 130 | by (metis inner_commute vector_eq)+ | 
| 63050 | 131 | |
| 69619 
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
 immler parents: 
69600diff
changeset | 132 | subsection \<open>Substandard Basis\<close> | 
| 
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
 immler parents: 
69600diff
changeset | 133 | |
| 
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
 immler parents: 
69600diff
changeset | 134 | lemma ex_card: | 
| 
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
 immler parents: 
69600diff
changeset | 135 | assumes "n \<le> card A" | 
| 
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
 immler parents: 
69600diff
changeset | 136 | shows "\<exists>S\<subseteq>A. card S = n" | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 137 | by (meson assms obtain_subset_with_card_n) | 
| 69619 
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
 immler parents: 
69600diff
changeset | 138 | |
| 
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
 immler parents: 
69600diff
changeset | 139 | lemma subspace_substandard: "subspace {x::'a::euclidean_space. (\<forall>i\<in>Basis. P i \<longrightarrow> x\<bullet>i = 0)}"
 | 
| 
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
 immler parents: 
69600diff
changeset | 140 | by (auto simp: subspace_def inner_add_left) | 
| 
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
 immler parents: 
69600diff
changeset | 141 | |
| 
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
 immler parents: 
69600diff
changeset | 142 | lemma dim_substandard: | 
| 
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
 immler parents: 
69600diff
changeset | 143 | assumes d: "d \<subseteq> Basis" | 
| 
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
 immler parents: 
69600diff
changeset | 144 |   shows "dim {x::'a::euclidean_space. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x\<bullet>i = 0} = card d" (is "dim ?A = _")
 | 
| 
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
 immler parents: 
69600diff
changeset | 145 | proof (rule dim_unique) | 
| 
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
 immler parents: 
69600diff
changeset | 146 | from d show "d \<subseteq> ?A" | 
| 
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
 immler parents: 
69600diff
changeset | 147 | by (auto simp: inner_Basis) | 
| 
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
 immler parents: 
69600diff
changeset | 148 | from d show "independent d" | 
| 
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
 immler parents: 
69600diff
changeset | 149 | by (rule independent_mono [OF independent_Basis]) | 
| 
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
 immler parents: 
69600diff
changeset | 150 | have "x \<in> span d" if "\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0" for x | 
| 
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
 immler parents: 
69600diff
changeset | 151 | proof - | 
| 
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
 immler parents: 
69600diff
changeset | 152 | have "finite d" | 
| 
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
 immler parents: 
69600diff
changeset | 153 | by (rule finite_subset [OF d finite_Basis]) | 
| 
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
 immler parents: 
69600diff
changeset | 154 | then have "(\<Sum>i\<in>d. (x \<bullet> i) *\<^sub>R i) \<in> span d" | 
| 
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
 immler parents: 
69600diff
changeset | 155 | by (simp add: span_sum span_clauses) | 
| 
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
 immler parents: 
69600diff
changeset | 156 | also have "(\<Sum>i\<in>d. (x \<bullet> i) *\<^sub>R i) = (\<Sum>i\<in>Basis. (x \<bullet> i) *\<^sub>R i)" | 
| 
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
 immler parents: 
69600diff
changeset | 157 | by (rule sum.mono_neutral_cong_left [OF finite_Basis d]) (auto simp: that) | 
| 
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
 immler parents: 
69600diff
changeset | 158 | finally show "x \<in> span d" | 
| 
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
 immler parents: 
69600diff
changeset | 159 | by (simp only: euclidean_representation) | 
| 
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
 immler parents: 
69600diff
changeset | 160 | qed | 
| 
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
 immler parents: 
69600diff
changeset | 161 | then show "?A \<subseteq> span d" by auto | 
| 
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
 immler parents: 
69600diff
changeset | 162 | qed simp | 
| 
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
 immler parents: 
69600diff
changeset | 163 | |
| 63050 | 164 | |
| 68901 | 165 | subsection \<open>Orthogonality\<close> | 
| 63050 | 166 | |
| 70136 | 167 | definition\<^marker>\<open>tag important\<close> (in real_inner) "orthogonal x y \<longleftrightarrow> x \<bullet> y = 0" | 
| 67962 | 168 | |
| 63050 | 169 | context real_inner | 
| 170 | begin | |
| 171 | ||
| 63072 | 172 | lemma orthogonal_self: "orthogonal x x \<longleftrightarrow> x = 0" | 
| 173 | by (simp add: orthogonal_def) | |
| 174 | ||
| 63050 | 175 | lemma orthogonal_clauses: | 
| 176 | "orthogonal a 0" | |
| 177 | "orthogonal a x \<Longrightarrow> orthogonal a (c *\<^sub>R x)" | |
| 178 | "orthogonal a x \<Longrightarrow> orthogonal a (- x)" | |
| 179 | "orthogonal a x \<Longrightarrow> orthogonal a y \<Longrightarrow> orthogonal a (x + y)" | |
| 180 | "orthogonal a x \<Longrightarrow> orthogonal a y \<Longrightarrow> orthogonal a (x - y)" | |
| 181 | "orthogonal 0 a" | |
| 182 | "orthogonal x a \<Longrightarrow> orthogonal (c *\<^sub>R x) a" | |
| 183 | "orthogonal x a \<Longrightarrow> orthogonal (- x) a" | |
| 184 | "orthogonal x a \<Longrightarrow> orthogonal y a \<Longrightarrow> orthogonal (x + y) a" | |
| 185 | "orthogonal x a \<Longrightarrow> orthogonal y a \<Longrightarrow> orthogonal (x - y) a" | |
| 186 | unfolding orthogonal_def inner_add inner_diff by auto | |
| 187 | ||
| 188 | end | |
| 189 | ||
| 190 | lemma orthogonal_commute: "orthogonal x y \<longleftrightarrow> orthogonal y x" | |
| 191 | by (simp add: orthogonal_def inner_commute) | |
| 192 | ||
| 63114 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63075diff
changeset | 193 | lemma orthogonal_scaleR [simp]: "c \<noteq> 0 \<Longrightarrow> orthogonal (c *\<^sub>R x) = orthogonal x" | 
| 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63075diff
changeset | 194 | by (rule ext) (simp add: orthogonal_def) | 
| 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63075diff
changeset | 195 | |
| 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63075diff
changeset | 196 | lemma pairwise_ortho_scaleR: | 
| 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63075diff
changeset | 197 | "pairwise (\<lambda>i j. orthogonal (f i) (g j)) B | 
| 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63075diff
changeset | 198 | \<Longrightarrow> pairwise (\<lambda>i j. orthogonal (a i *\<^sub>R f i) (a j *\<^sub>R g j)) B" | 
| 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63075diff
changeset | 199 | by (auto simp: pairwise_def orthogonal_clauses) | 
| 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63075diff
changeset | 200 | |
| 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63075diff
changeset | 201 | lemma orthogonal_rvsum: | 
| 64267 | 202 | "\<lbrakk>finite s; \<And>y. y \<in> s \<Longrightarrow> orthogonal x (f y)\<rbrakk> \<Longrightarrow> orthogonal x (sum f s)" | 
| 63114 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63075diff
changeset | 203 | by (induction s rule: finite_induct) (auto simp: orthogonal_clauses) | 
| 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63075diff
changeset | 204 | |
| 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63075diff
changeset | 205 | lemma orthogonal_lvsum: | 
| 64267 | 206 | "\<lbrakk>finite s; \<And>x. x \<in> s \<Longrightarrow> orthogonal (f x) y\<rbrakk> \<Longrightarrow> orthogonal (sum f s) y" | 
| 63114 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63075diff
changeset | 207 | by (induction s rule: finite_induct) (auto simp: orthogonal_clauses) | 
| 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63075diff
changeset | 208 | |
| 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63075diff
changeset | 209 | lemma norm_add_Pythagorean: | 
| 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63075diff
changeset | 210 | assumes "orthogonal a b" | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 211 | shows "(norm (a + b))\<^sup>2 = (norm a)\<^sup>2 + (norm b)\<^sup>2" | 
| 63114 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63075diff
changeset | 212 | proof - | 
| 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63075diff
changeset | 213 | from assms have "(a - (0 - b)) \<bullet> (a - (0 - b)) = a \<bullet> a - (0 - b \<bullet> b)" | 
| 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63075diff
changeset | 214 | by (simp add: algebra_simps orthogonal_def inner_commute) | 
| 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63075diff
changeset | 215 | then show ?thesis | 
| 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63075diff
changeset | 216 | by (simp add: power2_norm_eq_inner) | 
| 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63075diff
changeset | 217 | qed | 
| 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63075diff
changeset | 218 | |
| 64267 | 219 | lemma norm_sum_Pythagorean: | 
| 63114 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63075diff
changeset | 220 | assumes "finite I" "pairwise (\<lambda>i j. orthogonal (f i) (f j)) I" | 
| 64267 | 221 | shows "(norm (sum f I))\<^sup>2 = (\<Sum>i\<in>I. (norm (f i))\<^sup>2)" | 
| 63114 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63075diff
changeset | 222 | using assms | 
| 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63075diff
changeset | 223 | proof (induction I rule: finite_induct) | 
| 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63075diff
changeset | 224 | case empty then show ?case by simp | 
| 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63075diff
changeset | 225 | next | 
| 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63075diff
changeset | 226 | case (insert x I) | 
| 64267 | 227 | then have "orthogonal (f x) (sum f I)" | 
| 63114 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63075diff
changeset | 228 | by (metis pairwise_insert orthogonal_rvsum) | 
| 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63075diff
changeset | 229 | with insert show ?case | 
| 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63075diff
changeset | 230 | by (simp add: pairwise_insert norm_add_Pythagorean) | 
| 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63075diff
changeset | 231 | qed | 
| 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63075diff
changeset | 232 | |
| 63050 | 233 | |
| 69683 | 234 | subsection \<open>Orthogonality of a transformation\<close> | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 235 | |
| 70136 | 236 | definition\<^marker>\<open>tag important\<close> "orthogonal_transformation f \<longleftrightarrow> linear f \<and> (\<forall>v w. f v \<bullet> f w = v \<bullet> w)" | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 237 | |
| 70136 | 238 | lemma\<^marker>\<open>tag unimportant\<close> orthogonal_transformation: | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 239 | "orthogonal_transformation f \<longleftrightarrow> linear f \<and> (\<forall>v. norm (f v) = norm v)" | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 240 | by (smt (verit, ccfv_threshold) dot_norm linear_add norm_eq_sqrt_inner orthogonal_transformation_def) | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 241 | |
| 70136 | 242 | lemma\<^marker>\<open>tag unimportant\<close> orthogonal_transformation_id [simp]: "orthogonal_transformation (\<lambda>x. x)" | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 243 | by (simp add: linear_iff orthogonal_transformation_def) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 244 | |
| 70136 | 245 | lemma\<^marker>\<open>tag unimportant\<close> orthogonal_orthogonal_transformation: | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 246 | "orthogonal_transformation f \<Longrightarrow> orthogonal (f x) (f y) \<longleftrightarrow> orthogonal x y" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 247 | by (simp add: orthogonal_def orthogonal_transformation_def) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 248 | |
| 70136 | 249 | lemma\<^marker>\<open>tag unimportant\<close> orthogonal_transformation_compose: | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 250 | "\<lbrakk>orthogonal_transformation f; orthogonal_transformation g\<rbrakk> \<Longrightarrow> orthogonal_transformation(f \<circ> g)" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 251 | by (auto simp: orthogonal_transformation_def linear_compose) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 252 | |
| 70136 | 253 | lemma\<^marker>\<open>tag unimportant\<close> orthogonal_transformation_neg: | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 254 | "orthogonal_transformation(\<lambda>x. -(f x)) \<longleftrightarrow> orthogonal_transformation f" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 255 | by (auto simp: orthogonal_transformation_def dest: linear_compose_neg) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 256 | |
| 70136 | 257 | lemma\<^marker>\<open>tag unimportant\<close> orthogonal_transformation_scaleR: "orthogonal_transformation f \<Longrightarrow> f (c *\<^sub>R v) = c *\<^sub>R f v" | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 258 | by (simp add: linear_iff orthogonal_transformation_def) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 259 | |
| 70136 | 260 | lemma\<^marker>\<open>tag unimportant\<close> orthogonal_transformation_linear: | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 261 | "orthogonal_transformation f \<Longrightarrow> linear f" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 262 | by (simp add: orthogonal_transformation_def) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 263 | |
| 70136 | 264 | lemma\<^marker>\<open>tag unimportant\<close> orthogonal_transformation_inj: | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 265 | "orthogonal_transformation f \<Longrightarrow> inj f" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 266 | unfolding orthogonal_transformation_def inj_on_def | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 267 | by (metis vector_eq) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 268 | |
| 70136 | 269 | lemma\<^marker>\<open>tag unimportant\<close> orthogonal_transformation_surj: | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 270 | "orthogonal_transformation f \<Longrightarrow> surj f" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 271 | for f :: "'a::euclidean_space \<Rightarrow> 'a::euclidean_space" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 272 | by (simp add: linear_injective_imp_surjective orthogonal_transformation_inj orthogonal_transformation_linear) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 273 | |
| 70136 | 274 | lemma\<^marker>\<open>tag unimportant\<close> orthogonal_transformation_bij: | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 275 | "orthogonal_transformation f \<Longrightarrow> bij f" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 276 | for f :: "'a::euclidean_space \<Rightarrow> 'a::euclidean_space" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 277 | by (simp add: bij_def orthogonal_transformation_inj orthogonal_transformation_surj) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 278 | |
| 70136 | 279 | lemma\<^marker>\<open>tag unimportant\<close> orthogonal_transformation_inv: | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 280 | "orthogonal_transformation f \<Longrightarrow> orthogonal_transformation (inv f)" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 281 | for f :: "'a::euclidean_space \<Rightarrow> 'a::euclidean_space" | 
| 73932 
fd21b4a93043
added opaque_combs and renamed hide_lams to opaque_lifting
 desharna parents: 
73795diff
changeset | 282 | by (metis (no_types, opaque_lifting) bijection.inv_right bijection_def inj_linear_imp_inv_linear orthogonal_transformation orthogonal_transformation_bij orthogonal_transformation_inj) | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 283 | |
| 70136 | 284 | lemma\<^marker>\<open>tag unimportant\<close> orthogonal_transformation_norm: | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 285 | "orthogonal_transformation f \<Longrightarrow> norm (f x) = norm x" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 286 | by (metis orthogonal_transformation) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 287 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 288 | |
| 68901 | 289 | subsection \<open>Bilinear functions\<close> | 
| 63050 | 290 | |
| 70136 | 291 | definition\<^marker>\<open>tag important\<close> | 
| 69600 | 292 | bilinear :: "('a::real_vector \<Rightarrow> 'b::real_vector \<Rightarrow> 'c::real_vector) \<Rightarrow> bool" where
 | 
| 293 | "bilinear f \<longleftrightarrow> (\<forall>x. linear (\<lambda>y. f x y)) \<and> (\<forall>y. linear (\<lambda>x. f x y))" | |
| 63050 | 294 | |
| 295 | lemma bilinear_ladd: "bilinear h \<Longrightarrow> h (x + y) z = h x z + h y z" | |
| 296 | by (simp add: bilinear_def linear_iff) | |
| 297 | ||
| 298 | lemma bilinear_radd: "bilinear h \<Longrightarrow> h x (y + z) = h x y + h x z" | |
| 299 | by (simp add: bilinear_def linear_iff) | |
| 300 | ||
| 70707 
125705f5965f
A little-known material, and some tidying up
 paulson <lp15@cam.ac.uk> parents: 
70688diff
changeset | 301 | lemma bilinear_times: | 
| 
125705f5965f
A little-known material, and some tidying up
 paulson <lp15@cam.ac.uk> parents: 
70688diff
changeset | 302 | fixes c::"'a::real_algebra" shows "bilinear (\<lambda>x y::'a. x*y)" | 
| 
125705f5965f
A little-known material, and some tidying up
 paulson <lp15@cam.ac.uk> parents: 
70688diff
changeset | 303 | by (auto simp: bilinear_def distrib_left distrib_right intro!: linearI) | 
| 
125705f5965f
A little-known material, and some tidying up
 paulson <lp15@cam.ac.uk> parents: 
70688diff
changeset | 304 | |
| 63050 | 305 | lemma bilinear_lmul: "bilinear h \<Longrightarrow> h (c *\<^sub>R x) y = c *\<^sub>R h x y" | 
| 306 | by (simp add: bilinear_def linear_iff) | |
| 307 | ||
| 308 | lemma bilinear_rmul: "bilinear h \<Longrightarrow> h x (c *\<^sub>R y) = c *\<^sub>R h x y" | |
| 309 | by (simp add: bilinear_def linear_iff) | |
| 310 | ||
| 311 | lemma bilinear_lneg: "bilinear h \<Longrightarrow> h (- x) y = - h x y" | |
| 312 | by (drule bilinear_lmul [of _ "- 1"]) simp | |
| 313 | ||
| 314 | lemma bilinear_rneg: "bilinear h \<Longrightarrow> h x (- y) = - h x y" | |
| 315 | by (drule bilinear_rmul [of _ _ "- 1"]) simp | |
| 316 | ||
| 317 | lemma (in ab_group_add) eq_add_iff: "x = x + y \<longleftrightarrow> y = 0" | |
| 318 | using add_left_imp_eq[of x y 0] by auto | |
| 319 | ||
| 320 | lemma bilinear_lzero: | |
| 321 | assumes "bilinear h" | |
| 322 | shows "h 0 x = 0" | |
| 323 | using bilinear_ladd [OF assms, of 0 0 x] by (simp add: eq_add_iff field_simps) | |
| 324 | ||
| 325 | lemma bilinear_rzero: | |
| 326 | assumes "bilinear h" | |
| 327 | shows "h x 0 = 0" | |
| 328 | using bilinear_radd [OF assms, of x 0 0 ] by (simp add: eq_add_iff field_simps) | |
| 329 | ||
| 330 | lemma bilinear_lsub: "bilinear h \<Longrightarrow> h (x - y) z = h x z - h y z" | |
| 331 | using bilinear_ladd [of h x "- y"] by (simp add: bilinear_lneg) | |
| 332 | ||
| 333 | lemma bilinear_rsub: "bilinear h \<Longrightarrow> h z (x - y) = h z x - h z y" | |
| 334 | using bilinear_radd [of h _ x "- y"] by (simp add: bilinear_rneg) | |
| 335 | ||
| 64267 | 336 | lemma bilinear_sum: | 
| 68072 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 337 | assumes "bilinear h" | 
| 64267 | 338 | shows "h (sum f S) (sum g T) = sum (\<lambda>(i,j). h (f i) (g j)) (S \<times> T) " | 
| 63050 | 339 | proof - | 
| 68072 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 340 | interpret l: linear "\<lambda>x. h x y" for y using assms by (simp add: bilinear_def) | 
| 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 341 | interpret r: linear "\<lambda>y. h x y" for x using assms by (simp add: bilinear_def) | 
| 64267 | 342 | have "h (sum f S) (sum g T) = sum (\<lambda>x. h (f x) (sum g T)) S" | 
| 68072 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 343 | by (simp add: l.sum) | 
| 64267 | 344 | also have "\<dots> = sum (\<lambda>x. sum (\<lambda>y. h (f x) (g y)) T) S" | 
| 68072 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 345 | by (rule sum.cong) (simp_all add: r.sum) | 
| 63050 | 346 | finally show ?thesis | 
| 64267 | 347 | unfolding sum.cartesian_product . | 
| 63050 | 348 | qed | 
| 349 | ||
| 350 | ||
| 68901 | 351 | subsection \<open>Adjoints\<close> | 
| 63050 | 352 | |
| 70136 | 353 | definition\<^marker>\<open>tag important\<close> adjoint :: "(('a::real_inner) \<Rightarrow> ('b::real_inner)) \<Rightarrow> 'b \<Rightarrow> 'a" where
 | 
| 69600 | 354 | "adjoint f = (SOME f'. \<forall>x y. f x \<bullet> y = x \<bullet> f' y)" | 
| 63050 | 355 | |
| 356 | lemma adjoint_unique: | |
| 357 | assumes "\<forall>x y. inner (f x) y = inner x (g y)" | |
| 358 | shows "adjoint f = g" | |
| 359 | unfolding adjoint_def | |
| 360 | proof (rule some_equality) | |
| 361 | show "\<forall>x y. inner (f x) y = inner x (g y)" | |
| 362 | by (rule assms) | |
| 363 | next | |
| 364 | fix h | |
| 365 | assume "\<forall>x y. inner (f x) y = inner x (h y)" | |
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 366 | then show "h = g" | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 367 | by (metis assms ext vector_eq_ldot) | 
| 63050 | 368 | qed | 
| 369 | ||
| 370 | text \<open>TODO: The following lemmas about adjoints should hold for any | |
| 63680 | 371 | Hilbert space (i.e. complete inner product space). | 
| 68224 | 372 | (see \<^url>\<open>https://en.wikipedia.org/wiki/Hermitian_adjoint\<close>) | 
| 63050 | 373 | \<close> | 
| 374 | ||
| 375 | lemma adjoint_works: | |
| 376 | fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space" | |
| 377 | assumes lf: "linear f" | |
| 378 | shows "x \<bullet> adjoint f y = f x \<bullet> y" | |
| 379 | proof - | |
| 68072 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 380 | interpret linear f by fact | 
| 63050 | 381 | have "\<forall>y. \<exists>w. \<forall>x. f x \<bullet> y = x \<bullet> w" | 
| 382 | proof (intro allI exI) | |
| 383 | fix y :: "'m" and x | |
| 384 | let ?w = "(\<Sum>i\<in>Basis. (f i \<bullet> y) *\<^sub>R i) :: 'n" | |
| 385 | have "f x \<bullet> y = f (\<Sum>i\<in>Basis. (x \<bullet> i) *\<^sub>R i) \<bullet> y" | |
| 386 | by (simp add: euclidean_representation) | |
| 387 | also have "\<dots> = (\<Sum>i\<in>Basis. (x \<bullet> i) *\<^sub>R f i) \<bullet> y" | |
| 68072 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 388 | by (simp add: sum scale) | 
| 63050 | 389 | finally show "f x \<bullet> y = x \<bullet> ?w" | 
| 64267 | 390 | by (simp add: inner_sum_left inner_sum_right mult.commute) | 
| 63050 | 391 | qed | 
| 392 | then show ?thesis | |
| 393 | unfolding adjoint_def choice_iff | |
| 394 | by (intro someI2_ex[where Q="\<lambda>f'. x \<bullet> f' y = f x \<bullet> y"]) auto | |
| 395 | qed | |
| 396 | ||
| 397 | lemma adjoint_clauses: | |
| 398 | fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space" | |
| 399 | assumes lf: "linear f" | |
| 400 | shows "x \<bullet> adjoint f y = f x \<bullet> y" | |
| 401 | and "adjoint f y \<bullet> x = y \<bullet> f x" | |
| 402 | by (simp_all add: adjoint_works[OF lf] inner_commute) | |
| 403 | ||
| 404 | lemma adjoint_linear: | |
| 405 | fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space" | |
| 406 | assumes lf: "linear f" | |
| 407 | shows "linear (adjoint f)" | |
| 408 | by (simp add: lf linear_iff euclidean_eq_iff[where 'a='n] euclidean_eq_iff[where 'a='m] | |
| 409 | adjoint_clauses[OF lf] inner_distrib) | |
| 410 | ||
| 411 | lemma adjoint_adjoint: | |
| 412 | fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space" | |
| 413 | assumes lf: "linear f" | |
| 414 | shows "adjoint (adjoint f) = f" | |
| 415 | by (rule adjoint_unique, simp add: adjoint_clauses [OF lf]) | |
| 416 | ||
| 417 | ||
| 70136 | 418 | subsection\<^marker>\<open>tag unimportant\<close> \<open>Euclidean Spaces as Typeclass\<close> | 
| 44133 | 419 | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50105diff
changeset | 420 | lemma independent_Basis: "independent Basis" | 
| 68072 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 421 | by (rule independent_Basis) | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50105diff
changeset | 422 | |
| 53939 | 423 | lemma span_Basis [simp]: "span Basis = UNIV" | 
| 68072 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 424 | by (rule span_Basis) | 
| 44133 | 425 | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50105diff
changeset | 426 | lemma in_span_Basis: "x \<in> span Basis" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50105diff
changeset | 427 | unfolding span_Basis .. | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50105diff
changeset | 428 | |
| 53406 | 429 | |
| 70136 | 430 | subsection\<^marker>\<open>tag unimportant\<close> \<open>Linearity and Bilinearity continued\<close> | 
| 44133 | 431 | |
| 432 | lemma linear_bounded: | |
| 56444 | 433 | fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector" | 
| 44133 | 434 | assumes lf: "linear f" | 
| 435 | shows "\<exists>B. \<forall>x. norm (f x) \<le> B * norm x" | |
| 53939 | 436 | proof | 
| 68072 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 437 | interpret linear f by fact | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50105diff
changeset | 438 | let ?B = "\<Sum>b\<in>Basis. norm (f b)" | 
| 53939 | 439 | show "\<forall>x. norm (f x) \<le> ?B * norm x" | 
| 440 | proof | |
| 53406 | 441 | fix x :: 'a | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50105diff
changeset | 442 | let ?g = "\<lambda>b. (x \<bullet> b) *\<^sub>R f b" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50105diff
changeset | 443 | have "norm (f x) = norm (f (\<Sum>b\<in>Basis. (x \<bullet> b) *\<^sub>R b))" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50105diff
changeset | 444 | unfolding euclidean_representation .. | 
| 64267 | 445 | also have "\<dots> = norm (sum ?g Basis)" | 
| 68072 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 446 | by (simp add: sum scale) | 
| 64267 | 447 | finally have th0: "norm (f x) = norm (sum ?g Basis)" . | 
| 64773 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64267diff
changeset | 448 | have th: "norm (?g i) \<le> norm (f i) * norm x" if "i \<in> Basis" for i | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64267diff
changeset | 449 | proof - | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64267diff
changeset | 450 | from Basis_le_norm[OF that, of x] | 
| 53939 | 451 | show "norm (?g i) \<le> norm (f i) * norm x" | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 452 | unfolding norm_scaleR by (metis mult.commute mult_left_mono norm_ge_zero) | 
| 53939 | 453 | qed | 
| 64267 | 454 | from sum_norm_le[of _ ?g, OF th] | 
| 53939 | 455 | show "norm (f x) \<le> ?B * norm x" | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 456 | by (simp add: sum_distrib_right th0) | 
| 53939 | 457 | qed | 
| 44133 | 458 | qed | 
| 459 | ||
| 460 | lemma linear_conv_bounded_linear: | |
| 461 | fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector" | |
| 462 | shows "linear f \<longleftrightarrow> bounded_linear f" | |
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 463 | by (metis mult.commute bounded_linear_axioms.intro bounded_linear_def linear_bounded) | 
| 53939 | 464 | |
| 61518 
ff12606337e9
new lemmas about topology, etc., for Cauchy integral formula
 paulson parents: 
61306diff
changeset | 465 | lemmas linear_linear = linear_conv_bounded_linear[symmetric] | 
| 
ff12606337e9
new lemmas about topology, etc., for Cauchy integral formula
 paulson parents: 
61306diff
changeset | 466 | |
| 70999 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 467 | lemma inj_linear_imp_inv_bounded_linear: | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 468 | fixes f::"'a::euclidean_space \<Rightarrow> 'a" | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 469 | shows "\<lbrakk>bounded_linear f; inj f\<rbrakk> \<Longrightarrow> bounded_linear (inv f)" | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 470 | by (simp add: inj_linear_imp_inv_linear linear_linear) | 
| 
5b753486c075
Inverse function theorem + lemmas
 paulson <lp15@cam.ac.uk> parents: 
70817diff
changeset | 471 | |
| 53939 | 472 | lemma linear_bounded_pos: | 
| 56444 | 473 | fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector" | 
| 53939 | 474 | assumes lf: "linear f" | 
| 67982 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 paulson <lp15@cam.ac.uk> parents: 
67962diff
changeset | 475 | obtains B where "B > 0" "\<And>x. norm (f x) \<le> B * norm x" | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 476 | by (metis bounded_linear.pos_bounded lf linear_linear mult.commute) | 
| 44133 | 477 | |
| 67982 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 paulson <lp15@cam.ac.uk> parents: 
67962diff
changeset | 478 | lemma linear_invertible_bounded_below_pos: | 
| 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 paulson <lp15@cam.ac.uk> parents: 
67962diff
changeset | 479 | fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::euclidean_space" | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 480 | assumes "linear f" "linear g" and gf: "g \<circ> f = id" | 
| 67982 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 paulson <lp15@cam.ac.uk> parents: 
67962diff
changeset | 481 | obtains B where "B > 0" "\<And>x. B * norm x \<le> norm(f x)" | 
| 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 paulson <lp15@cam.ac.uk> parents: 
67962diff
changeset | 482 | proof - | 
| 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 paulson <lp15@cam.ac.uk> parents: 
67962diff
changeset | 483 | obtain B where "B > 0" and B: "\<And>x. norm (g x) \<le> B * norm x" | 
| 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 paulson <lp15@cam.ac.uk> parents: 
67962diff
changeset | 484 | using linear_bounded_pos [OF \<open>linear g\<close>] by blast | 
| 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 paulson <lp15@cam.ac.uk> parents: 
67962diff
changeset | 485 | show thesis | 
| 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 paulson <lp15@cam.ac.uk> parents: 
67962diff
changeset | 486 | proof | 
| 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 paulson <lp15@cam.ac.uk> parents: 
67962diff
changeset | 487 | show "0 < 1/B" | 
| 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 paulson <lp15@cam.ac.uk> parents: 
67962diff
changeset | 488 | by (simp add: \<open>B > 0\<close>) | 
| 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 paulson <lp15@cam.ac.uk> parents: 
67962diff
changeset | 489 | show "1/B * norm x \<le> norm (f x)" for x | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 490 | by (smt (verit, ccfv_SIG) B \<open>0 < B\<close> gf comp_apply divide_inverse id_apply inverse_eq_divide | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 491 | less_divide_eq mult.commute) | 
| 67982 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 paulson <lp15@cam.ac.uk> parents: 
67962diff
changeset | 492 | qed | 
| 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 paulson <lp15@cam.ac.uk> parents: 
67962diff
changeset | 493 | qed | 
| 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 paulson <lp15@cam.ac.uk> parents: 
67962diff
changeset | 494 | |
| 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 paulson <lp15@cam.ac.uk> parents: 
67962diff
changeset | 495 | lemma linear_inj_bounded_below_pos: | 
| 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 paulson <lp15@cam.ac.uk> parents: 
67962diff
changeset | 496 | fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::euclidean_space" | 
| 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 paulson <lp15@cam.ac.uk> parents: 
67962diff
changeset | 497 | assumes "linear f" "inj f" | 
| 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 paulson <lp15@cam.ac.uk> parents: 
67962diff
changeset | 498 | obtains B where "B > 0" "\<And>x. B * norm x \<le> norm(f x)" | 
| 68072 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 499 | using linear_injective_left_inverse [OF assms] | 
| 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 500 | linear_invertible_bounded_below_pos assms by blast | 
| 67982 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 paulson <lp15@cam.ac.uk> parents: 
67962diff
changeset | 501 | |
| 49522 | 502 | lemma bounded_linearI': | 
| 56444 | 503 | fixes f ::"'a::euclidean_space \<Rightarrow> 'b::real_normed_vector" | 
| 53406 | 504 | assumes "\<And>x y. f (x + y) = f x + f y" | 
| 505 | and "\<And>c x. f (c *\<^sub>R x) = c *\<^sub>R f x" | |
| 49522 | 506 | shows "bounded_linear f" | 
| 68072 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 507 | using assms linearI linear_conv_bounded_linear by blast | 
| 44133 | 508 | |
| 509 | lemma bilinear_bounded: | |
| 56444 | 510 | fixes h :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space \<Rightarrow> 'k::real_normed_vector" | 
| 44133 | 511 | assumes bh: "bilinear h" | 
| 512 | shows "\<exists>B. \<forall>x y. norm (h x y) \<le> B * norm x * norm y" | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50105diff
changeset | 513 | proof (clarify intro!: exI[of _ "\<Sum>i\<in>Basis. \<Sum>j\<in>Basis. norm (h i j)"]) | 
| 53406 | 514 | fix x :: 'm | 
| 515 | fix y :: 'n | |
| 64267 | 516 | have "norm (h x y) = norm (h (sum (\<lambda>i. (x \<bullet> i) *\<^sub>R i) Basis) (sum (\<lambda>i. (y \<bullet> i) *\<^sub>R i) Basis))" | 
| 68069 
36209dfb981e
tidying up and using real induction methods
 paulson <lp15@cam.ac.uk> parents: 
68062diff
changeset | 517 | by (simp add: euclidean_representation) | 
| 64267 | 518 | also have "\<dots> = norm (sum (\<lambda> (i,j). h ((x \<bullet> i) *\<^sub>R i) ((y \<bullet> j) *\<^sub>R j)) (Basis \<times> Basis))" | 
| 68072 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 519 | unfolding bilinear_sum[OF bh] .. | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50105diff
changeset | 520 | finally have th: "norm (h x y) = \<dots>" . | 
| 68069 
36209dfb981e
tidying up and using real induction methods
 paulson <lp15@cam.ac.uk> parents: 
68062diff
changeset | 521 | have "\<And>i j. \<lbrakk>i \<in> Basis; j \<in> Basis\<rbrakk> | 
| 
36209dfb981e
tidying up and using real induction methods
 paulson <lp15@cam.ac.uk> parents: 
68062diff
changeset | 522 | \<Longrightarrow> \<bar>x \<bullet> i\<bar> * (\<bar>y \<bullet> j\<bar> * norm (h i j)) \<le> norm x * (norm y * norm (h i j))" | 
| 
36209dfb981e
tidying up and using real induction methods
 paulson <lp15@cam.ac.uk> parents: 
68062diff
changeset | 523 | by (auto simp add: zero_le_mult_iff Basis_le_norm mult_mono) | 
| 
36209dfb981e
tidying up and using real induction methods
 paulson <lp15@cam.ac.uk> parents: 
68062diff
changeset | 524 | then show "norm (h x y) \<le> (\<Sum>i\<in>Basis. \<Sum>j\<in>Basis. norm (h i j)) * norm x * norm y" | 
| 
36209dfb981e
tidying up and using real induction methods
 paulson <lp15@cam.ac.uk> parents: 
68062diff
changeset | 525 | unfolding sum_distrib_right th sum.cartesian_product | 
| 
36209dfb981e
tidying up and using real induction methods
 paulson <lp15@cam.ac.uk> parents: 
68062diff
changeset | 526 | by (clarsimp simp add: bilinear_rmul[OF bh] bilinear_lmul[OF bh] | 
| 
36209dfb981e
tidying up and using real induction methods
 paulson <lp15@cam.ac.uk> parents: 
68062diff
changeset | 527 | field_simps simp del: scaleR_scaleR intro!: sum_norm_le) | 
| 44133 | 528 | qed | 
| 529 | ||
| 530 | lemma bilinear_conv_bounded_bilinear: | |
| 531 | fixes h :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space \<Rightarrow> 'c::real_normed_vector" | |
| 532 | shows "bilinear h \<longleftrightarrow> bounded_bilinear h" | |
| 533 | proof | |
| 534 | assume "bilinear h" | |
| 535 | show "bounded_bilinear h" | |
| 536 | proof | |
| 53406 | 537 | fix x y z | 
| 538 | show "h (x + y) z = h x z + h y z" | |
| 60420 | 539 | using \<open>bilinear h\<close> unfolding bilinear_def linear_iff by simp | 
| 44133 | 540 | next | 
| 53406 | 541 | fix x y z | 
| 542 | show "h x (y + z) = h x y + h x z" | |
| 60420 | 543 | using \<open>bilinear h\<close> unfolding bilinear_def linear_iff by simp | 
| 44133 | 544 | next | 
| 68069 
36209dfb981e
tidying up and using real induction methods
 paulson <lp15@cam.ac.uk> parents: 
68062diff
changeset | 545 | show "h (scaleR r x) y = scaleR r (h x y)" "h x (scaleR r y) = scaleR r (h x y)" for r x y | 
| 60420 | 546 | using \<open>bilinear h\<close> unfolding bilinear_def linear_iff | 
| 68069 
36209dfb981e
tidying up and using real induction methods
 paulson <lp15@cam.ac.uk> parents: 
68062diff
changeset | 547 | by simp_all | 
| 44133 | 548 | next | 
| 549 | have "\<exists>B. \<forall>x y. norm (h x y) \<le> B * norm x * norm y" | |
| 60420 | 550 | using \<open>bilinear h\<close> by (rule bilinear_bounded) | 
| 49522 | 551 | then show "\<exists>K. \<forall>x y. norm (h x y) \<le> norm x * norm y * K" | 
| 57514 
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
 haftmann parents: 
57512diff
changeset | 552 | by (simp add: ac_simps) | 
| 44133 | 553 | qed | 
| 554 | next | |
| 555 | assume "bounded_bilinear h" | |
| 556 | then interpret h: bounded_bilinear h . | |
| 557 | show "bilinear h" | |
| 558 | unfolding bilinear_def linear_conv_bounded_linear | |
| 49522 | 559 | using h.bounded_linear_left h.bounded_linear_right by simp | 
| 44133 | 560 | qed | 
| 561 | ||
| 53939 | 562 | lemma bilinear_bounded_pos: | 
| 56444 | 563 | fixes h :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space \<Rightarrow> 'c::real_normed_vector" | 
| 53939 | 564 | assumes bh: "bilinear h" | 
| 565 | shows "\<exists>B > 0. \<forall>x y. norm (h x y) \<le> B * norm x * norm y" | |
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 566 | by (metis mult.assoc bh bilinear_conv_bounded_bilinear bounded_bilinear.pos_bounded mult.commute) | 
| 53939 | 567 | |
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 568 | lemma bounded_linear_imp_has_derivative: | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 569 | "bounded_linear f \<Longrightarrow> (f has_derivative f) net" | 
| 68072 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 570 | by (auto simp add: has_derivative_def linear_diff linear_linear linear_def | 
| 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 571 | dest: bounded_linear.linear) | 
| 63469 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63170diff
changeset | 572 | |
| 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63170diff
changeset | 573 | lemma linear_imp_has_derivative: | 
| 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63170diff
changeset | 574 | fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector" | 
| 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63170diff
changeset | 575 | shows "linear f \<Longrightarrow> (f has_derivative f) net" | 
| 68072 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 576 | by (simp add: bounded_linear_imp_has_derivative linear_conv_bounded_linear) | 
| 63469 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63170diff
changeset | 577 | |
| 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63170diff
changeset | 578 | lemma bounded_linear_imp_differentiable: "bounded_linear f \<Longrightarrow> f differentiable net" | 
| 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63170diff
changeset | 579 | using bounded_linear_imp_has_derivative differentiable_def by blast | 
| 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63170diff
changeset | 580 | |
| 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63170diff
changeset | 581 | lemma linear_imp_differentiable: | 
| 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63170diff
changeset | 582 | fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector" | 
| 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63170diff
changeset | 583 | shows "linear f \<Longrightarrow> f differentiable net" | 
| 68072 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 584 | by (metis linear_imp_has_derivative differentiable_def) | 
| 63469 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63170diff
changeset | 585 | |
| 73795 | 586 | lemma of_real_differentiable [simp,derivative_intros]: "of_real differentiable F" | 
| 587 | by (simp add: bounded_linear_imp_differentiable bounded_linear_of_real) | |
| 588 | ||
| 49522 | 589 | |
| 70136 | 590 | subsection\<^marker>\<open>tag unimportant\<close> \<open>We continue\<close> | 
| 44133 | 591 | |
| 592 | lemma independent_bound: | |
| 53716 | 593 | fixes S :: "'a::euclidean_space set" | 
| 594 |   shows "independent S \<Longrightarrow> finite S \<and> card S \<le> DIM('a)"
 | |
| 68072 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 595 | by (metis dim_subset_UNIV finiteI_independent dim_span_eq_card_independent) | 
| 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 596 | |
| 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 597 | lemmas independent_imp_finite = finiteI_independent | 
| 44133 | 598 | |
| 71120 | 599 | corollary\<^marker>\<open>tag unimportant\<close> independent_card_le: | 
| 60303 | 600 | fixes S :: "'a::euclidean_space set" | 
| 601 | assumes "independent S" | |
| 71120 | 602 |   shows "card S \<le> DIM('a)"
 | 
| 68072 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 603 | using assms independent_bound by auto | 
| 63075 
60a42a4166af
lemmas about dimension, hyperplanes, span, etc.
 paulson <lp15@cam.ac.uk> parents: 
63072diff
changeset | 604 | |
| 49663 | 605 | lemma dependent_biggerset: | 
| 56444 | 606 | fixes S :: "'a::euclidean_space set" | 
| 607 |   shows "(finite S \<Longrightarrow> card S > DIM('a)) \<Longrightarrow> dependent S"
 | |
| 44133 | 608 | by (metis independent_bound not_less) | 
| 609 | ||
| 60420 | 610 | text \<open>Picking an orthogonal replacement for a spanning set.\<close> | 
| 44133 | 611 | |
| 53406 | 612 | lemma vector_sub_project_orthogonal: | 
| 613 | fixes b x :: "'a::euclidean_space" | |
| 614 | shows "b \<bullet> (x - ((b \<bullet> x) / (b \<bullet> b)) *\<^sub>R b) = 0" | |
| 44133 | 615 | unfolding inner_simps by auto | 
| 616 | ||
| 44528 | 617 | lemma pairwise_orthogonal_insert: | 
| 618 | assumes "pairwise orthogonal S" | |
| 49522 | 619 | and "\<And>y. y \<in> S \<Longrightarrow> orthogonal x y" | 
| 44528 | 620 | shows "pairwise orthogonal (insert x S)" | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 621 | using assms by (auto simp: pairwise_def orthogonal_commute) | 
| 44528 | 622 | |
| 44133 | 623 | lemma basis_orthogonal: | 
| 53406 | 624 | fixes B :: "'a::real_inner set" | 
| 44133 | 625 | assumes fB: "finite B" | 
| 626 | shows "\<exists>C. finite C \<and> card C \<le> card B \<and> span C = span B \<and> pairwise orthogonal C" | |
| 627 | (is " \<exists>C. ?P B C") | |
| 49522 | 628 | using fB | 
| 629 | proof (induct rule: finite_induct) | |
| 630 | case empty | |
| 53406 | 631 | then show ?case | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 632 | using pairwise_empty by blast | 
| 44133 | 633 | next | 
| 49522 | 634 | case (insert a B) | 
| 60420 | 635 | note fB = \<open>finite B\<close> and aB = \<open>a \<notin> B\<close> | 
| 636 | from \<open>\<exists>C. finite C \<and> card C \<le> card B \<and> span C = span B \<and> pairwise orthogonal C\<close> | |
| 44133 | 637 | obtain C where C: "finite C" "card C \<le> card B" | 
| 638 | "span C = span B" "pairwise orthogonal C" by blast | |
| 64267 | 639 | let ?a = "a - sum (\<lambda>x. (x \<bullet> a / (x \<bullet> x)) *\<^sub>R x) C" | 
| 44133 | 640 | let ?C = "insert ?a C" | 
| 53406 | 641 | from C(1) have fC: "finite ?C" | 
| 642 | by simp | |
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 643 | have cC: "card ?C \<le> card (insert a B)" | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 644 | using C aB card_insert_if local.insert(1) by fastforce | 
| 53406 | 645 |   {
 | 
| 646 | fix x k | |
| 49522 | 647 | have th0: "\<And>(a::'a) b c. a - (b - c) = c + (a - b)" | 
| 648 | by (simp add: field_simps) | |
| 44133 | 649 | have "x - k *\<^sub>R (a - (\<Sum>x\<in>C. (x \<bullet> a / (x \<bullet> x)) *\<^sub>R x)) \<in> span C \<longleftrightarrow> x - k *\<^sub>R a \<in> span C" | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 650 | unfolding scaleR_right_diff_distrib th0 | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 651 | by (intro span_add_eq span_scale span_sum span_base) | 
| 53406 | 652 | } | 
| 44133 | 653 | then have SC: "span ?C = span (insert a B)" | 
| 654 | unfolding set_eq_iff span_breakdown_eq C(3)[symmetric] by auto | |
| 53406 | 655 |   {
 | 
| 656 | fix y | |
| 657 | assume yC: "y \<in> C" | |
| 658 |     then have Cy: "C = insert y (C - {y})"
 | |
| 659 | by blast | |
| 660 |     have fth: "finite (C - {y})"
 | |
| 661 | using C by simp | |
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 662 |     have "y \<noteq> 0 \<Longrightarrow> \<forall>x\<in>C - {y}. x \<bullet> a * (x \<bullet> y) / (x \<bullet> x) = 0"
 | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 663 | using \<open>pairwise orthogonal C\<close> | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 664 | by (metis Cy DiffE div_0 insertCI mult_zero_right orthogonal_def pairwise_insert) | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 665 | then have "orthogonal ?a y" | 
| 44528 | 666 | unfolding orthogonal_def | 
| 64267 | 667 | unfolding inner_diff inner_sum_left right_minus_eq | 
| 668 | unfolding sum.remove [OF \<open>finite C\<close> \<open>y \<in> C\<close>] | |
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 669 | by (auto simp add: sum.neutral inner_commute[of y a]) | 
| 53406 | 670 | } | 
| 60420 | 671 | with \<open>pairwise orthogonal C\<close> have CPO: "pairwise orthogonal ?C" | 
| 44528 | 672 | by (rule pairwise_orthogonal_insert) | 
| 53406 | 673 | from fC cC SC CPO have "?P (insert a B) ?C" | 
| 674 | by blast | |
| 44133 | 675 | then show ?case by blast | 
| 676 | qed | |
| 677 | ||
| 678 | lemma orthogonal_basis_exists: | |
| 679 |   fixes V :: "('a::euclidean_space) set"
 | |
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 680 | shows "\<exists>B. independent B \<and> B \<subseteq> span V \<and> V \<subseteq> span B \<and> (card B = dim V) \<and> pairwise orthogonal B" | 
| 49663 | 681 | proof - | 
| 49522 | 682 | from basis_exists[of V] obtain B where | 
| 53406 | 683 | B: "B \<subseteq> V" "independent B" "V \<subseteq> span B" "card B = dim V" | 
| 68073 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 immlerdiff
changeset | 684 | by force | 
| 53406 | 685 | from B have fB: "finite B" "card B = dim V" | 
| 686 | using independent_bound by auto | |
| 44133 | 687 | from basis_orthogonal[OF fB(1)] obtain C where | 
| 53406 | 688 | C: "finite C" "card C \<le> card B" "span C = span B" "pairwise orthogonal C" | 
| 689 | by blast | |
| 690 | from C B have CSV: "C \<subseteq> span V" | |
| 68072 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 691 | by (metis span_superset span_mono subset_trans) | 
| 53406 | 692 | from span_mono[OF B(3)] C have SVC: "span V \<subseteq> span C" | 
| 693 | by (simp add: span_span) | |
| 694 | from C fB have "card C \<le> dim V" | |
| 695 | by simp | |
| 696 | moreover have "dim V \<le> card C" | |
| 697 | using span_card_ge_dim[OF CSV SVC C(1)] | |
| 68072 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 698 | by simp | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 699 | ultimately have "card C = dim V" | 
| 53406 | 700 | using C(1) by simp | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 701 | with C B CSV show ?thesis | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 702 | by (metis SVC card_eq_dim dim_span) | 
| 44133 | 703 | qed | 
| 704 | ||
| 60420 | 705 | text \<open>Low-dimensional subset is in a hyperplane (weak orthogonal complement).\<close> | 
| 44133 | 706 | |
| 78656 
4da1e18a9633
Loads of new material related to porting the Euler Polyhedron Formula from HOL Light
 paulson <lp15@cam.ac.uk> parents: 
78127diff
changeset | 707 | lemma span_not_UNIV_orthogonal: | 
| 53406 | 708 | fixes S :: "'a::euclidean_space set" | 
| 44133 | 709 | assumes sU: "span S \<noteq> UNIV" | 
| 56444 | 710 | shows "\<exists>a::'a. a \<noteq> 0 \<and> (\<forall>x \<in> span S. a \<bullet> x = 0)" | 
| 49522 | 711 | proof - | 
| 53406 | 712 | from sU obtain a where a: "a \<notin> span S" | 
| 713 | by blast | |
| 44133 | 714 | from orthogonal_basis_exists obtain B where | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 715 | B: "independent B" "B \<subseteq> span S" "S \<subseteq> span B" "card B = dim S" "pairwise orthogonal B" | 
| 44133 | 716 | by blast | 
| 53406 | 717 | from B have fB: "finite B" "card B = dim S" | 
| 718 | using independent_bound by auto | |
| 719 | have sSB: "span S = span B" | |
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 720 | by (simp add: B span_eq) | 
| 64267 | 721 | let ?a = "a - sum (\<lambda>b. (a \<bullet> b / (b \<bullet> b)) *\<^sub>R b) B" | 
| 722 | have "sum (\<lambda>b. (a \<bullet> b / (b \<bullet> b)) *\<^sub>R b) B \<in> span S" | |
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 723 | by (simp add: sSB span_base span_mul span_sum) | 
| 53406 | 724 | with a have a0:"?a \<noteq> 0" | 
| 725 | by auto | |
| 68058 | 726 | have "?a \<bullet> x = 0" if "x\<in>span B" for x | 
| 727 | proof (rule span_induct [OF that]) | |
| 49522 | 728 |     show "subspace {x. ?a \<bullet> x = 0}"
 | 
| 729 | by (auto simp add: subspace_def inner_add) | |
| 730 | next | |
| 53406 | 731 |     {
 | 
| 732 | fix x | |
| 733 | assume x: "x \<in> B" | |
| 734 |       from x have B': "B = insert x (B - {x})"
 | |
| 735 | by blast | |
| 736 |       have fth: "finite (B - {x})"
 | |
| 737 | using fB by simp | |
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 738 |       have "(\<Sum>b\<in>B - {x}. a \<bullet> b * (b \<bullet> x) / (b \<bullet> b)) = 0" if "x \<noteq> 0"
 | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 739 | by (smt (verit) B' B(5) DiffD2 divide_eq_0_iff inner_real_def inner_zero_right insertCI orthogonal_def pairwise_insert sum.neutral) | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 740 | then have "?a \<bullet> x = 0" | 
| 53406 | 741 | apply (subst B') | 
| 742 | using fB fth | |
| 64267 | 743 | unfolding sum_clauses(2)[OF fth] | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 744 | by (auto simp add: inner_add_left inner_diff_left inner_sum_left) | 
| 53406 | 745 | } | 
| 68058 | 746 | then show "?a \<bullet> x = 0" if "x \<in> B" for x | 
| 747 | using that by blast | |
| 748 | qed | |
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 749 | with a0 sSB show ?thesis | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 750 | by blast | 
| 44133 | 751 | qed | 
| 752 | ||
| 753 | lemma span_not_univ_subset_hyperplane: | |
| 53406 | 754 | fixes S :: "'a::euclidean_space set" | 
| 755 | assumes SU: "span S \<noteq> UNIV" | |
| 44133 | 756 |   shows "\<exists> a. a \<noteq>0 \<and> span S \<subseteq> {x. a \<bullet> x = 0}"
 | 
| 78656 
4da1e18a9633
Loads of new material related to porting the Euler Polyhedron Formula from HOL Light
 paulson <lp15@cam.ac.uk> parents: 
78127diff
changeset | 757 | using span_not_UNIV_orthogonal[OF SU] by auto | 
| 44133 | 758 | |
| 49663 | 759 | lemma lowdim_subset_hyperplane: | 
| 53406 | 760 | fixes S :: "'a::euclidean_space set" | 
| 44133 | 761 |   assumes d: "dim S < DIM('a)"
 | 
| 56444 | 762 |   shows "\<exists>a::'a. a \<noteq> 0 \<and> span S \<subseteq> {x. a \<bullet> x = 0}"
 | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 763 | using d dim_eq_full nless_le span_not_univ_subset_hyperplane by blast | 
| 44133 | 764 | |
| 765 | lemma linear_eq_stdbasis: | |
| 56444 | 766 | fixes f :: "'a::euclidean_space \<Rightarrow> _" | 
| 767 | assumes lf: "linear f" | |
| 49663 | 768 | and lg: "linear g" | 
| 68058 | 769 | and fg: "\<And>b. b \<in> Basis \<Longrightarrow> f b = g b" | 
| 44133 | 770 | shows "f = g" | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 771 | using linear_eq_on_span[OF lf lg, of Basis] fg by auto | 
| 68072 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 772 | |
| 44133 | 773 | |
| 60420 | 774 | text \<open>Similar results for bilinear functions.\<close> | 
| 44133 | 775 | |
| 776 | lemma bilinear_eq: | |
| 777 | assumes bf: "bilinear f" | |
| 49522 | 778 | and bg: "bilinear g" | 
| 53406 | 779 | and SB: "S \<subseteq> span B" | 
| 780 | and TC: "T \<subseteq> span C" | |
| 68058 | 781 | and "x\<in>S" "y\<in>T" | 
| 782 | and fg: "\<And>x y. \<lbrakk>x \<in> B; y\<in> C\<rbrakk> \<Longrightarrow> f x y = g x y" | |
| 783 | shows "f x y = g x y" | |
| 49663 | 784 | proof - | 
| 44170 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 huffman parents: 
44166diff
changeset | 785 |   let ?P = "{x. \<forall>y\<in> span C. f x y = g x y}"
 | 
| 44133 | 786 | from bf bg have sp: "subspace ?P" | 
| 53600 
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
 huffman parents: 
53596diff
changeset | 787 | unfolding bilinear_def linear_iff subspace_def bf bg | 
| 68072 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 788 | by (auto simp add: span_zero bilinear_lzero[OF bf] bilinear_lzero[OF bg] | 
| 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 789 | span_add Ball_def | 
| 49663 | 790 | intro: bilinear_ladd[OF bf]) | 
| 68058 | 791 |   have sfg: "\<And>x. x \<in> B \<Longrightarrow> subspace {a. f x a = g x a}"
 | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 792 | by (auto simp: subspace_def bf bg bilinear_rzero bilinear_radd bilinear_rmul) | 
| 68058 | 793 | have "\<forall>y\<in> span C. f x y = g x y" if "x \<in> span B" for x | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 794 | using span_induct [OF that sp] fg sfg span_induct by blast | 
| 53406 | 795 | then show ?thesis | 
| 68058 | 796 | using SB TC assms by auto | 
| 44133 | 797 | qed | 
| 798 | ||
| 49522 | 799 | lemma bilinear_eq_stdbasis: | 
| 53406 | 800 | fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space \<Rightarrow> _" | 
| 44133 | 801 | assumes bf: "bilinear f" | 
| 49522 | 802 | and bg: "bilinear g" | 
| 68058 | 803 | and fg: "\<And>i j. i \<in> Basis \<Longrightarrow> j \<in> Basis \<Longrightarrow> f i j = g i j" | 
| 44133 | 804 | shows "f = g" | 
| 68074 | 805 | using bilinear_eq[OF bf bg equalityD2[OF span_Basis] equalityD2[OF span_Basis]] fg by blast | 
| 49522 | 806 | |
| 69619 
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
 immler parents: 
69600diff
changeset | 807 | |
| 60420 | 808 | subsection \<open>Infinity norm\<close> | 
| 44133 | 809 | |
| 70136 | 810 | definition\<^marker>\<open>tag important\<close> "infnorm (x::'a::euclidean_space) = Sup {\<bar>x \<bullet> b\<bar> |b. b \<in> Basis}"
 | 
| 44133 | 811 | |
| 812 | lemma infnorm_set_image: | |
| 53716 | 813 | fixes x :: "'a::euclidean_space" | 
| 56444 | 814 |   shows "{\<bar>x \<bullet> i\<bar> |i. i \<in> Basis} = (\<lambda>i. \<bar>x \<bullet> i\<bar>) ` Basis"
 | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50105diff
changeset | 815 | by blast | 
| 44133 | 816 | |
| 53716 | 817 | lemma infnorm_Max: | 
| 818 | fixes x :: "'a::euclidean_space" | |
| 56444 | 819 | shows "infnorm x = Max ((\<lambda>i. \<bar>x \<bullet> i\<bar>) ` Basis)" | 
| 62343 
24106dc44def
prefer abbreviations for compound operators INFIMUM and SUPREMUM
 haftmann parents: 
61973diff
changeset | 820 | by (simp add: infnorm_def infnorm_set_image cSup_eq_Max) | 
| 51475 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
50526diff
changeset | 821 | |
| 44133 | 822 | lemma infnorm_set_lemma: | 
| 53716 | 823 | fixes x :: "'a::euclidean_space" | 
| 56444 | 824 |   shows "finite {\<bar>x \<bullet> i\<bar> |i. i \<in> Basis}"
 | 
| 825 |     and "{\<bar>x \<bullet> i\<bar> |i. i \<in> Basis} \<noteq> {}"
 | |
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 826 | unfolding infnorm_set_image by auto | 
| 44133 | 827 | |
| 53406 | 828 | lemma infnorm_pos_le: | 
| 829 | fixes x :: "'a::euclidean_space" | |
| 830 | shows "0 \<le> infnorm x" | |
| 51475 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
50526diff
changeset | 831 | by (simp add: infnorm_Max Max_ge_iff ex_in_conv) | 
| 44133 | 832 | |
| 53406 | 833 | lemma infnorm_triangle: | 
| 834 | fixes x :: "'a::euclidean_space" | |
| 835 | shows "infnorm (x + y) \<le> infnorm x + infnorm y" | |
| 49522 | 836 | proof - | 
| 51475 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
50526diff
changeset | 837 | have *: "\<And>a b c d :: real. \<bar>a\<bar> \<le> c \<Longrightarrow> \<bar>b\<bar> \<le> d \<Longrightarrow> \<bar>a + b\<bar> \<le> c + d" | 
| 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
50526diff
changeset | 838 | by simp | 
| 44133 | 839 | show ?thesis | 
| 51475 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
50526diff
changeset | 840 | by (auto simp: infnorm_Max inner_add_left intro!: *) | 
| 44133 | 841 | qed | 
| 842 | ||
| 53406 | 843 | lemma infnorm_eq_0: | 
| 844 | fixes x :: "'a::euclidean_space" | |
| 845 | shows "infnorm x = 0 \<longleftrightarrow> x = 0" | |
| 49522 | 846 | proof - | 
| 51475 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
50526diff
changeset | 847 | have "infnorm x \<le> 0 \<longleftrightarrow> x = 0" | 
| 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
50526diff
changeset | 848 | unfolding infnorm_Max by (simp add: euclidean_all_zero_iff) | 
| 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
50526diff
changeset | 849 | then show ?thesis | 
| 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
50526diff
changeset | 850 | using infnorm_pos_le[of x] by simp | 
| 44133 | 851 | qed | 
| 852 | ||
| 853 | lemma infnorm_0: "infnorm 0 = 0" | |
| 854 | by (simp add: infnorm_eq_0) | |
| 855 | ||
| 856 | lemma infnorm_neg: "infnorm (- x) = infnorm x" | |
| 68062 | 857 | unfolding infnorm_def by simp | 
| 44133 | 858 | |
| 859 | lemma infnorm_sub: "infnorm (x - y) = infnorm (y - x)" | |
| 68062 | 860 | by (metis infnorm_neg minus_diff_eq) | 
| 861 | ||
| 862 | lemma absdiff_infnorm: "\<bar>infnorm x - infnorm y\<bar> \<le> infnorm (x - y)" | |
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 863 | by (smt (verit, del_insts) diff_add_cancel infnorm_sub infnorm_triangle) | 
| 44133 | 864 | |
| 53406 | 865 | lemma real_abs_infnorm: "\<bar>infnorm x\<bar> = infnorm x" | 
| 44133 | 866 | using infnorm_pos_le[of x] by arith | 
| 867 | ||
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50105diff
changeset | 868 | lemma Basis_le_infnorm: | 
| 53406 | 869 | fixes x :: "'a::euclidean_space" | 
| 870 | shows "b \<in> Basis \<Longrightarrow> \<bar>x \<bullet> b\<bar> \<le> infnorm x" | |
| 51475 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
50526diff
changeset | 871 | by (simp add: infnorm_Max) | 
| 44133 | 872 | |
| 56444 | 873 | lemma infnorm_mul: "infnorm (a *\<^sub>R x) = \<bar>a\<bar> * infnorm x" | 
| 51475 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
50526diff
changeset | 874 | unfolding infnorm_Max | 
| 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
50526diff
changeset | 875 | proof (safe intro!: Max_eqI) | 
| 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
50526diff
changeset | 876 | let ?B = "(\<lambda>i. \<bar>x \<bullet> i\<bar>) ` Basis" | 
| 68062 | 877 |   { fix b :: 'a
 | 
| 53406 | 878 | assume "b \<in> Basis" | 
| 879 | then show "\<bar>a *\<^sub>R x \<bullet> b\<bar> \<le> \<bar>a\<bar> * Max ?B" | |
| 880 | by (simp add: abs_mult mult_left_mono) | |
| 881 | next | |
| 882 | from Max_in[of ?B] obtain b where "b \<in> Basis" "Max ?B = \<bar>x \<bullet> b\<bar>" | |
| 883 | by (auto simp del: Max_in) | |
| 884 | then show "\<bar>a\<bar> * Max ((\<lambda>i. \<bar>x \<bullet> i\<bar>) ` Basis) \<in> (\<lambda>i. \<bar>a *\<^sub>R x \<bullet> i\<bar>) ` Basis" | |
| 885 | by (intro image_eqI[where x=b]) (auto simp: abs_mult) | |
| 886 | } | |
| 51475 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
50526diff
changeset | 887 | qed simp | 
| 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
50526diff
changeset | 888 | |
| 53406 | 889 | lemma infnorm_mul_lemma: "infnorm (a *\<^sub>R x) \<le> \<bar>a\<bar> * infnorm x" | 
| 51475 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
50526diff
changeset | 890 | unfolding infnorm_mul .. | 
| 44133 | 891 | |
| 892 | lemma infnorm_pos_lt: "infnorm x > 0 \<longleftrightarrow> x \<noteq> 0" | |
| 893 | using infnorm_pos_le[of x] infnorm_eq_0[of x] by arith | |
| 894 | ||
| 60420 | 895 | text \<open>Prove that it differs only up to a bound from Euclidean norm.\<close> | 
| 44133 | 896 | |
| 897 | lemma infnorm_le_norm: "infnorm x \<le> norm x" | |
| 51475 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
50526diff
changeset | 898 | by (simp add: Basis_le_norm infnorm_Max) | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50105diff
changeset | 899 | |
| 53716 | 900 | lemma norm_le_infnorm: | 
| 901 | fixes x :: "'a::euclidean_space" | |
| 902 |   shows "norm x \<le> sqrt DIM('a) * infnorm x"
 | |
| 73795 | 903 | unfolding norm_eq_sqrt_inner id_def | 
| 78127 
24b70433c2e8
New HOL Light material on metric spaces and topological spaces
 paulson <lp15@cam.ac.uk> parents: 
76836diff
changeset | 904 | proof (rule real_le_lsqrt) | 
| 68062 | 905 |   show "sqrt DIM('a) * infnorm x \<ge> 0"
 | 
| 44133 | 906 | by (simp add: zero_le_mult_iff infnorm_pos_le) | 
| 68062 | 907 | have "x \<bullet> x \<le> (\<Sum>b\<in>Basis. x \<bullet> b * (x \<bullet> b))" | 
| 908 | by (metis euclidean_inner order_refl) | |
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 909 |   also have "\<dots> \<le> DIM('a) * \<bar>infnorm x\<bar>\<^sup>2"
 | 
| 68062 | 910 | by (rule sum_bounded_above) (metis Basis_le_infnorm abs_le_square_iff power2_eq_square real_abs_infnorm) | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 911 |   also have "\<dots> \<le> (sqrt DIM('a) * infnorm x)\<^sup>2"
 | 
| 68062 | 912 | by (simp add: power_mult_distrib) | 
| 913 |   finally show "x \<bullet> x \<le> (sqrt DIM('a) * infnorm x)\<^sup>2" .
 | |
| 44133 | 914 | qed | 
| 915 | ||
| 44646 | 916 | lemma tendsto_infnorm [tendsto_intros]: | 
| 61973 | 917 | assumes "(f \<longlongrightarrow> a) F" | 
| 918 | shows "((\<lambda>x. infnorm (f x)) \<longlongrightarrow> infnorm a) F" | |
| 44646 | 919 | proof (rule tendsto_compose [OF LIM_I assms]) | 
| 53406 | 920 | fix r :: real | 
| 921 | assume "r > 0" | |
| 49522 | 922 | then show "\<exists>s>0. \<forall>x. x \<noteq> a \<and> norm (x - a) < s \<longrightarrow> norm (infnorm x - infnorm a) < r" | 
| 68062 | 923 | by (metis real_norm_def le_less_trans absdiff_infnorm infnorm_le_norm) | 
| 44646 | 924 | qed | 
| 925 | ||
| 60420 | 926 | text \<open>Equality in Cauchy-Schwarz and triangle inequalities.\<close> | 
| 44133 | 927 | |
| 53406 | 928 | lemma norm_cauchy_schwarz_eq: "x \<bullet> y = norm x * norm y \<longleftrightarrow> norm x *\<^sub>R y = norm y *\<^sub>R x" | 
| 929 | (is "?lhs \<longleftrightarrow> ?rhs") | |
| 68062 | 930 | proof (cases "x=0") | 
| 931 | case True | |
| 73795 | 932 | then show ?thesis | 
| 68062 | 933 | by auto | 
| 934 | next | |
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 935 | case False | 
| 68062 | 936 | from inner_eq_zero_iff[of "norm y *\<^sub>R x - norm x *\<^sub>R y"] | 
| 937 | have "?rhs \<longleftrightarrow> | |
| 49522 | 938 | (norm y * (norm y * norm x * norm x - norm x * (x \<bullet> y)) - | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 939 | norm x * (norm y * (y \<bullet> x) - norm x * norm y * norm y) = 0)" | 
| 68062 | 940 | using False unfolding inner_simps | 
| 941 | by (auto simp add: power2_norm_eq_inner[symmetric] power2_eq_square inner_commute field_simps) | |
| 73795 | 942 | also have "\<dots> \<longleftrightarrow> (2 * norm x * norm y * (norm x * norm y - x \<bullet> y) = 0)" | 
| 68062 | 943 | using False by (simp add: field_simps inner_commute) | 
| 73795 | 944 | also have "\<dots> \<longleftrightarrow> ?lhs" | 
| 68062 | 945 | using False by auto | 
| 946 | finally show ?thesis by metis | |
| 44133 | 947 | qed | 
| 948 | ||
| 949 | lemma norm_cauchy_schwarz_abs_eq: | |
| 56444 | 950 | "\<bar>x \<bullet> y\<bar> = norm x * norm y \<longleftrightarrow> | 
| 53716 | 951 | norm x *\<^sub>R y = norm y *\<^sub>R x \<or> norm x *\<^sub>R y = - norm y *\<^sub>R x" | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 952 | using norm_cauchy_schwarz_eq [symmetric, of x y] | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 953 | using norm_cauchy_schwarz_eq [symmetric, of "-x" y] Cauchy_Schwarz_ineq2 [of x y] | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 954 | by auto | 
| 44133 | 955 | |
| 956 | lemma norm_triangle_eq: | |
| 957 | fixes x y :: "'a::real_inner" | |
| 53406 | 958 | shows "norm (x + y) = norm x + norm y \<longleftrightarrow> norm x *\<^sub>R y = norm y *\<^sub>R x" | 
| 68062 | 959 | proof (cases "x = 0 \<or> y = 0") | 
| 960 | case True | |
| 73795 | 961 | then show ?thesis | 
| 68062 | 962 | by force | 
| 963 | next | |
| 964 | case False | |
| 965 | then have n: "norm x > 0" "norm y > 0" | |
| 966 | by auto | |
| 967 | have "norm (x + y) = norm x + norm y \<longleftrightarrow> (norm (x + y))\<^sup>2 = (norm x + norm y)\<^sup>2" | |
| 968 | by simp | |
| 969 | also have "\<dots> \<longleftrightarrow> norm x *\<^sub>R y = norm y *\<^sub>R x" | |
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 970 | by (smt (verit, best) dot_norm inner_real_def inner_simps norm_cauchy_schwarz_eq power2_eq_square) | 
| 68062 | 971 | finally show ?thesis . | 
| 44133 | 972 | qed | 
| 973 | ||
| 74729 
64b3d8d9bd10
new lemmas about convex, concave functions, + tidying
 paulson <lp15@cam.ac.uk> parents: 
73933diff
changeset | 974 | lemma dist_triangle_eq: | 
| 
64b3d8d9bd10
new lemmas about convex, concave functions, + tidying
 paulson <lp15@cam.ac.uk> parents: 
73933diff
changeset | 975 | fixes x y z :: "'a::real_inner" | 
| 
64b3d8d9bd10
new lemmas about convex, concave functions, + tidying
 paulson <lp15@cam.ac.uk> parents: 
73933diff
changeset | 976 | shows "dist x z = dist x y + dist y z \<longleftrightarrow> | 
| 
64b3d8d9bd10
new lemmas about convex, concave functions, + tidying
 paulson <lp15@cam.ac.uk> parents: 
73933diff
changeset | 977 | norm (x - y) *\<^sub>R (y - z) = norm (y - z) *\<^sub>R (x - y)" | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 978 | by (metis (no_types, lifting) add_diff_eq diff_add_cancel dist_norm norm_triangle_eq) | 
| 49522 | 979 | |
| 60420 | 980 | subsection \<open>Collinearity\<close> | 
| 44133 | 981 | |
| 70136 | 982 | definition\<^marker>\<open>tag important\<close> collinear :: "'a::real_vector set \<Rightarrow> bool" | 
| 49522 | 983 | where "collinear S \<longleftrightarrow> (\<exists>u. \<forall>x \<in> S. \<forall> y \<in> S. \<exists>c. x - y = c *\<^sub>R u)" | 
| 44133 | 984 | |
| 66287 
005a30862ed0
new material: Colinearity, convex sets, polytopes
 paulson <lp15@cam.ac.uk> parents: 
65680diff
changeset | 985 | lemma collinear_alt: | 
| 
005a30862ed0
new material: Colinearity, convex sets, polytopes
 paulson <lp15@cam.ac.uk> parents: 
65680diff
changeset | 986 | "collinear S \<longleftrightarrow> (\<exists>u v. \<forall>x \<in> S. \<exists>c. x = u + c *\<^sub>R v)" (is "?lhs = ?rhs") | 
| 
005a30862ed0
new material: Colinearity, convex sets, polytopes
 paulson <lp15@cam.ac.uk> parents: 
65680diff
changeset | 987 | proof | 
| 
005a30862ed0
new material: Colinearity, convex sets, polytopes
 paulson <lp15@cam.ac.uk> parents: 
65680diff
changeset | 988 | assume ?lhs | 
| 
005a30862ed0
new material: Colinearity, convex sets, polytopes
 paulson <lp15@cam.ac.uk> parents: 
65680diff
changeset | 989 | then show ?rhs | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 990 | unfolding collinear_def by (metis add.commute diff_add_cancel) | 
| 66287 
005a30862ed0
new material: Colinearity, convex sets, polytopes
 paulson <lp15@cam.ac.uk> parents: 
65680diff
changeset | 991 | next | 
| 
005a30862ed0
new material: Colinearity, convex sets, polytopes
 paulson <lp15@cam.ac.uk> parents: 
65680diff
changeset | 992 | assume ?rhs | 
| 
005a30862ed0
new material: Colinearity, convex sets, polytopes
 paulson <lp15@cam.ac.uk> parents: 
65680diff
changeset | 993 | then obtain u v where *: "\<And>x. x \<in> S \<Longrightarrow> \<exists>c. x = u + c *\<^sub>R v" | 
| 75455 
91c16c5ad3e9
tidied auto / simp with null arguments
 paulson <lp15@cam.ac.uk> parents: 
74729diff
changeset | 994 | by auto | 
| 66287 
005a30862ed0
new material: Colinearity, convex sets, polytopes
 paulson <lp15@cam.ac.uk> parents: 
65680diff
changeset | 995 | have "\<exists>c. x - y = c *\<^sub>R v" if "x \<in> S" "y \<in> S" for x y | 
| 
005a30862ed0
new material: Colinearity, convex sets, polytopes
 paulson <lp15@cam.ac.uk> parents: 
65680diff
changeset | 996 | by (metis *[OF \<open>x \<in> S\<close>] *[OF \<open>y \<in> S\<close>] scaleR_left.diff add_diff_cancel_left) | 
| 
005a30862ed0
new material: Colinearity, convex sets, polytopes
 paulson <lp15@cam.ac.uk> parents: 
65680diff
changeset | 997 | then show ?lhs | 
| 
005a30862ed0
new material: Colinearity, convex sets, polytopes
 paulson <lp15@cam.ac.uk> parents: 
65680diff
changeset | 998 | using collinear_def by blast | 
| 
005a30862ed0
new material: Colinearity, convex sets, polytopes
 paulson <lp15@cam.ac.uk> parents: 
65680diff
changeset | 999 | qed | 
| 
005a30862ed0
new material: Colinearity, convex sets, polytopes
 paulson <lp15@cam.ac.uk> parents: 
65680diff
changeset | 1000 | |
| 
005a30862ed0
new material: Colinearity, convex sets, polytopes
 paulson <lp15@cam.ac.uk> parents: 
65680diff
changeset | 1001 | lemma collinear: | 
| 
005a30862ed0
new material: Colinearity, convex sets, polytopes
 paulson <lp15@cam.ac.uk> parents: 
65680diff
changeset | 1002 |   fixes S :: "'a::{perfect_space,real_vector} set"
 | 
| 
005a30862ed0
new material: Colinearity, convex sets, polytopes
 paulson <lp15@cam.ac.uk> parents: 
65680diff
changeset | 1003 | shows "collinear S \<longleftrightarrow> (\<exists>u. u \<noteq> 0 \<and> (\<forall>x \<in> S. \<forall> y \<in> S. \<exists>c. x - y = c *\<^sub>R u))" | 
| 
005a30862ed0
new material: Colinearity, convex sets, polytopes
 paulson <lp15@cam.ac.uk> parents: 
65680diff
changeset | 1004 | proof - | 
| 
005a30862ed0
new material: Colinearity, convex sets, polytopes
 paulson <lp15@cam.ac.uk> parents: 
65680diff
changeset | 1005 | have "\<exists>v. v \<noteq> 0 \<and> (\<forall>x\<in>S. \<forall>y\<in>S. \<exists>c. x - y = c *\<^sub>R v)" | 
| 
005a30862ed0
new material: Colinearity, convex sets, polytopes
 paulson <lp15@cam.ac.uk> parents: 
65680diff
changeset | 1006 | if "\<forall>x\<in>S. \<forall>y\<in>S. \<exists>c. x - y = c *\<^sub>R u" "u=0" for u | 
| 
005a30862ed0
new material: Colinearity, convex sets, polytopes
 paulson <lp15@cam.ac.uk> parents: 
65680diff
changeset | 1007 | proof - | 
| 
005a30862ed0
new material: Colinearity, convex sets, polytopes
 paulson <lp15@cam.ac.uk> parents: 
65680diff
changeset | 1008 | have "\<forall>x\<in>S. \<forall>y\<in>S. x = y" | 
| 
005a30862ed0
new material: Colinearity, convex sets, polytopes
 paulson <lp15@cam.ac.uk> parents: 
65680diff
changeset | 1009 | using that by auto | 
| 
005a30862ed0
new material: Colinearity, convex sets, polytopes
 paulson <lp15@cam.ac.uk> parents: 
65680diff
changeset | 1010 | moreover | 
| 
005a30862ed0
new material: Colinearity, convex sets, polytopes
 paulson <lp15@cam.ac.uk> parents: 
65680diff
changeset | 1011 | obtain v::'a where "v \<noteq> 0" | 
| 
005a30862ed0
new material: Colinearity, convex sets, polytopes
 paulson <lp15@cam.ac.uk> parents: 
65680diff
changeset | 1012 | using UNIV_not_singleton [of 0] by auto | 
| 
005a30862ed0
new material: Colinearity, convex sets, polytopes
 paulson <lp15@cam.ac.uk> parents: 
65680diff
changeset | 1013 | ultimately have "\<forall>x\<in>S. \<forall>y\<in>S. \<exists>c. x - y = c *\<^sub>R v" | 
| 
005a30862ed0
new material: Colinearity, convex sets, polytopes
 paulson <lp15@cam.ac.uk> parents: 
65680diff
changeset | 1014 | by auto | 
| 
005a30862ed0
new material: Colinearity, convex sets, polytopes
 paulson <lp15@cam.ac.uk> parents: 
65680diff
changeset | 1015 | then show ?thesis | 
| 
005a30862ed0
new material: Colinearity, convex sets, polytopes
 paulson <lp15@cam.ac.uk> parents: 
65680diff
changeset | 1016 | using \<open>v \<noteq> 0\<close> by blast | 
| 
005a30862ed0
new material: Colinearity, convex sets, polytopes
 paulson <lp15@cam.ac.uk> parents: 
65680diff
changeset | 1017 | qed | 
| 
005a30862ed0
new material: Colinearity, convex sets, polytopes
 paulson <lp15@cam.ac.uk> parents: 
65680diff
changeset | 1018 | then show ?thesis | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1019 | by (metis collinear_def) | 
| 66287 
005a30862ed0
new material: Colinearity, convex sets, polytopes
 paulson <lp15@cam.ac.uk> parents: 
65680diff
changeset | 1020 | qed | 
| 
005a30862ed0
new material: Colinearity, convex sets, polytopes
 paulson <lp15@cam.ac.uk> parents: 
65680diff
changeset | 1021 | |
| 63881 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63680diff
changeset | 1022 | lemma collinear_subset: "\<lbrakk>collinear T; S \<subseteq> T\<rbrakk> \<Longrightarrow> collinear S" | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63680diff
changeset | 1023 | by (meson collinear_def subsetCE) | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63680diff
changeset | 1024 | |
| 60762 | 1025 | lemma collinear_empty [iff]: "collinear {}"
 | 
| 53406 | 1026 | by (simp add: collinear_def) | 
| 44133 | 1027 | |
| 60762 | 1028 | lemma collinear_sing [iff]: "collinear {x}"
 | 
| 44133 | 1029 | by (simp add: collinear_def) | 
| 1030 | ||
| 60762 | 1031 | lemma collinear_2 [iff]: "collinear {x, y}"
 | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1032 | by (simp add: collinear_def) (metis minus_diff_eq scaleR_left.minus scaleR_one) | 
| 44133 | 1033 | |
| 56444 | 1034 | lemma collinear_lemma: "collinear {0, x, y} \<longleftrightarrow> x = 0 \<or> y = 0 \<or> (\<exists>c. y = c *\<^sub>R x)"
 | 
| 53406 | 1035 | (is "?lhs \<longleftrightarrow> ?rhs") | 
| 68062 | 1036 | proof (cases "x = 0 \<or> y = 0") | 
| 1037 | case True | |
| 1038 | then show ?thesis | |
| 1039 | by (auto simp: insert_commute) | |
| 1040 | next | |
| 1041 | case False | |
| 73795 | 1042 | show ?thesis | 
| 68062 | 1043 | proof | 
| 1044 | assume h: "?lhs" | |
| 1045 |     then obtain u where u: "\<forall> x\<in> {0,x,y}. \<forall>y\<in> {0,x,y}. \<exists>c. x - y = c *\<^sub>R u"
 | |
| 1046 | unfolding collinear_def by blast | |
| 1047 | from u[rule_format, of x 0] u[rule_format, of y 0] | |
| 1048 | obtain cx and cy where | |
| 1049 | cx: "x = cx *\<^sub>R u" and cy: "y = cy *\<^sub>R u" | |
| 1050 | by auto | |
| 1051 | from cx cy False have cx0: "cx \<noteq> 0" and cy0: "cy \<noteq> 0" by auto | |
| 1052 | let ?d = "cy / cx" | |
| 1053 | from cx cy cx0 have "y = ?d *\<^sub>R x" | |
| 1054 | by simp | |
| 1055 | then show ?rhs using False by blast | |
| 1056 | next | |
| 1057 | assume h: "?rhs" | |
| 1058 | then obtain c where c: "y = c *\<^sub>R x" | |
| 1059 | using False by blast | |
| 1060 | show ?lhs | |
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1061 | apply (simp add: collinear_def c) | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1062 | by (metis (mono_tags, lifting) scaleR_left.minus scaleR_left_diff_distrib scaleR_one) | 
| 68062 | 1063 | qed | 
| 44133 | 1064 | qed | 
| 1065 | ||
| 73885 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
73795diff
changeset | 1066 | lemma collinear_iff_Reals: "collinear {0::complex,w,z} \<longleftrightarrow> z/w \<in> \<real>"
 | 
| 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
73795diff
changeset | 1067 | proof | 
| 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
73795diff
changeset | 1068 |   show "z/w \<in> \<real> \<Longrightarrow> collinear {0,w,z}"
 | 
| 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
73795diff
changeset | 1069 | by (metis Reals_cases collinear_lemma nonzero_divide_eq_eq scaleR_conv_of_real) | 
| 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
73795diff
changeset | 1070 | qed (auto simp: collinear_lemma scaleR_conv_of_real) | 
| 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
73795diff
changeset | 1071 | |
| 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
73795diff
changeset | 1072 | lemma collinear_scaleR_iff: "collinear {0, \<alpha> *\<^sub>R w, \<beta> *\<^sub>R z} \<longleftrightarrow> collinear {0,w,z} \<or> \<alpha>=0 \<or> \<beta>=0"
 | 
| 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
73795diff
changeset | 1073 | (is "?lhs = ?rhs") | 
| 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
73795diff
changeset | 1074 | proof (cases "\<alpha>=0 \<or> \<beta>=0") | 
| 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
73795diff
changeset | 1075 | case False | 
| 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
73795diff
changeset | 1076 | then have "(\<exists>c. \<beta> *\<^sub>R z = (c * \<alpha>) *\<^sub>R w) = (\<exists>c. z = c *\<^sub>R w)" | 
| 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
73795diff
changeset | 1077 | by (metis mult.commute scaleR_scaleR vector_fraction_eq_iff) | 
| 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
73795diff
changeset | 1078 | then show ?thesis | 
| 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
73795diff
changeset | 1079 | by (auto simp add: collinear_lemma) | 
| 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
73795diff
changeset | 1080 | qed (auto simp: collinear_lemma) | 
| 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
73795diff
changeset | 1081 | |
| 56444 | 1082 | lemma norm_cauchy_schwarz_equal: "\<bar>x \<bullet> y\<bar> = norm x * norm y \<longleftrightarrow> collinear {0, x, y}"
 | 
| 68062 | 1083 | proof (cases "x=0") | 
| 1084 | case True | |
| 1085 | then show ?thesis | |
| 1086 | by (auto simp: insert_commute) | |
| 1087 | next | |
| 1088 | case False | |
| 1089 | then have nnz: "norm x \<noteq> 0" | |
| 1090 | by auto | |
| 1091 | show ?thesis | |
| 1092 | proof | |
| 1093 | assume "\<bar>x \<bullet> y\<bar> = norm x * norm y" | |
| 1094 |     then show "collinear {0, x, y}"
 | |
| 73795 | 1095 | unfolding norm_cauchy_schwarz_abs_eq collinear_lemma | 
| 68062 | 1096 | by (meson eq_vector_fraction_iff nnz) | 
| 1097 | next | |
| 1098 |     assume "collinear {0, x, y}"
 | |
| 1099 | with False show "\<bar>x \<bullet> y\<bar> = norm x * norm y" | |
| 1100 | unfolding norm_cauchy_schwarz_abs_eq collinear_lemma by (auto simp: abs_if) | |
| 1101 | qed | |
| 1102 | qed | |
| 49522 | 1103 | |
| 73885 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
73795diff
changeset | 1104 | lemma norm_triangle_eq_imp_collinear: | 
| 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
73795diff
changeset | 1105 | fixes x y :: "'a::real_inner" | 
| 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
73795diff
changeset | 1106 | assumes "norm (x + y) = norm x + norm y" | 
| 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
73795diff
changeset | 1107 |   shows "collinear{0,x,y}"
 | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1108 | using assms norm_cauchy_schwarz_abs_eq norm_cauchy_schwarz_equal norm_triangle_eq | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1109 | by blast | 
| 73885 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
73795diff
changeset | 1110 | |
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1111 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1112 | subsection\<open>Properties of special hyperplanes\<close> | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1113 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1114 | lemma subspace_hyperplane: "subspace {x. a \<bullet> x = 0}"
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1115 | by (simp add: subspace_def inner_right_distrib) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1116 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1117 | lemma subspace_hyperplane2: "subspace {x. x \<bullet> a = 0}"
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1118 | by (simp add: inner_commute inner_right_distrib subspace_def) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1119 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1120 | lemma special_hyperplane_span: | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1121 | fixes S :: "'n::euclidean_space set" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1122 | assumes "k \<in> Basis" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1123 |   shows "{x. k \<bullet> x = 0} = span (Basis - {k})"
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1124 | proof - | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1125 |   have *: "x \<in> span (Basis - {k})" if "k \<bullet> x = 0" for x
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1126 | proof - | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1127 | have "x = (\<Sum>b\<in>Basis. (x \<bullet> b) *\<^sub>R b)" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1128 | by (simp add: euclidean_representation) | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1129 |     also have "\<dots> = (\<Sum>b \<in> Basis - {k}. (x \<bullet> b) *\<^sub>R b)"
 | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1130 | by (auto simp: sum.remove [of _ k] inner_commute assms that) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1131 |     finally have "x = (\<Sum>b\<in>Basis - {k}. (x \<bullet> b) *\<^sub>R b)" .
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1132 | then show ?thesis | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1133 | by (simp add: span_finite) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1134 | qed | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1135 | show ?thesis | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1136 | apply (rule span_subspace [symmetric]) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1137 | using assms | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1138 | apply (auto simp: inner_not_same_Basis intro: * subspace_hyperplane) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1139 | done | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1140 | qed | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1141 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1142 | lemma dim_special_hyperplane: | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1143 | fixes k :: "'n::euclidean_space" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1144 |   shows "k \<in> Basis \<Longrightarrow> dim {x. k \<bullet> x = 0} = DIM('n) - 1"
 | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1145 | by (metis Diff_subset card_Diff_singleton indep_card_eq_dim_span independent_substdbasis special_hyperplane_span) | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1146 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1147 | proposition dim_hyperplane: | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1148 | fixes a :: "'a::euclidean_space" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1149 | assumes "a \<noteq> 0" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1150 |     shows "dim {x. a \<bullet> x = 0} = DIM('a) - 1"
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1151 | proof - | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1152 |   have span0: "span {x. a \<bullet> x = 0} = {x. a \<bullet> x = 0}"
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1153 | by (rule span_unique) (auto simp: subspace_hyperplane) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1154 | then obtain B where "independent B" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1155 |               and Bsub: "B \<subseteq> {x. a \<bullet> x = 0}"
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1156 |               and subspB: "{x. a \<bullet> x = 0} \<subseteq> span B"
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1157 |               and card0: "(card B = dim {x. a \<bullet> x = 0})"
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1158 | and ortho: "pairwise orthogonal B" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1159 | using orthogonal_basis_exists by metis | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1160 | with assms have "a \<notin> span B" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1161 | by (metis (mono_tags, lifting) span_eq inner_eq_zero_iff mem_Collect_eq span0) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1162 | then have ind: "independent (insert a B)" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1163 | by (simp add: \<open>independent B\<close> independent_insert) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1164 | have "finite B" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1165 | using \<open>independent B\<close> independent_bound by blast | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1166 | have "UNIV \<subseteq> span (insert a B)" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1167 | proof fix y::'a | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1168 | obtain r z where "y = r *\<^sub>R a + z" "a \<bullet> z = 0" | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1169 | by (metis add.commute diff_add_cancel vector_sub_project_orthogonal) | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1170 | then show "y \<in> span (insert a B)" | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1171 | by (metis (mono_tags, lifting) Bsub add_diff_cancel_left' | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1172 | mem_Collect_eq span0 span_breakdown_eq span_eq subspB) | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1173 | qed | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1174 |   then have "DIM('a) = dim(insert a B)"
 | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1175 | by (metis independent_Basis span_Basis dim_eq_card top.extremum_uniqueI) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1176 | then show ?thesis | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1177 | by (metis One_nat_def \<open>a \<notin> span B\<close> \<open>finite B\<close> card0 card_insert_disjoint | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1178 | diff_Suc_Suc diff_zero dim_eq_card_independent ind span_base) | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1179 | qed | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1180 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1181 | lemma lowdim_eq_hyperplane: | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1182 | fixes S :: "'a::euclidean_space set" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1183 |   assumes "dim S = DIM('a) - 1"
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1184 |   obtains a where "a \<noteq> 0" and "span S = {x. a \<bullet> x = 0}"
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1185 | proof - | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1186 |   obtain b where b: "b \<noteq> 0" "span S \<subseteq> {a. b \<bullet> a = 0}"
 | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1187 | by (metis DIM_positive assms diff_less zero_less_one lowdim_subset_hyperplane) | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1188 | then show ?thesis | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1189 | by (metis assms dim_hyperplane dim_span dim_subset subspace_dim_equal subspace_hyperplane subspace_span that) | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1190 | qed | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1191 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1192 | lemma dim_eq_hyperplane: | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1193 | fixes S :: "'n::euclidean_space set" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1194 |   shows "dim S = DIM('n) - 1 \<longleftrightarrow> (\<exists>a. a \<noteq> 0 \<and> span S = {x. a \<bullet> x = 0})"
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1195 | by (metis One_nat_def dim_hyperplane dim_span lowdim_eq_hyperplane) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1196 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1197 | |
| 71044 | 1198 | subsection\<open> Orthogonal bases and Gram-Schmidt process\<close> | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1199 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1200 | lemma pairwise_orthogonal_independent: | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1201 | assumes "pairwise orthogonal S" and "0 \<notin> S" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1202 | shows "independent S" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1203 | proof - | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1204 | have 0: "\<And>x y. \<lbrakk>x \<noteq> y; x \<in> S; y \<in> S\<rbrakk> \<Longrightarrow> x \<bullet> y = 0" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1205 | using assms by (simp add: pairwise_def orthogonal_def) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1206 |   have "False" if "a \<in> S" and a: "a \<in> span (S - {a})" for a
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1207 | proof - | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1208 |     obtain T U where "T \<subseteq> S - {a}" "a = (\<Sum>v\<in>T. U v *\<^sub>R v)"
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1209 | using a by (force simp: span_explicit) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1210 | then have "a \<bullet> a = a \<bullet> (\<Sum>v\<in>T. U v *\<^sub>R v)" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1211 | by simp | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1212 | also have "\<dots> = 0" | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1213 | apply (simp add: inner_sum_right) | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1214 |       by (smt (verit) "0" DiffE \<open>T \<subseteq> S - {a}\<close> in_mono insertCI mult_not_zero sum.neutral that(1))
 | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1215 | finally show ?thesis | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1216 | using \<open>0 \<notin> S\<close> \<open>a \<in> S\<close> by auto | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1217 | qed | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1218 | then show ?thesis | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1219 | by (force simp: dependent_def) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1220 | qed | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1221 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1222 | lemma pairwise_orthogonal_imp_finite: | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1223 | fixes S :: "'a::euclidean_space set" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1224 | assumes "pairwise orthogonal S" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1225 | shows "finite S" | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1226 | by (metis Set.set_insert assms finite_insert independent_bound pairwise_insert | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1227 | pairwise_orthogonal_independent) | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1228 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1229 | lemma subspace_orthogonal_to_vector: "subspace {y. orthogonal x y}"
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1230 | by (simp add: subspace_def orthogonal_clauses) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1231 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1232 | lemma subspace_orthogonal_to_vectors: "subspace {y. \<forall>x \<in> S. orthogonal x y}"
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1233 | by (simp add: subspace_def orthogonal_clauses) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1234 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1235 | lemma orthogonal_to_span: | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1236 | assumes a: "a \<in> span S" and x: "\<And>y. y \<in> S \<Longrightarrow> orthogonal x y" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1237 | shows "orthogonal x a" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1238 | by (metis a orthogonal_clauses(1,2,4) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1239 | span_induct_alt x) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1240 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1241 | proposition Gram_Schmidt_step: | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1242 | fixes S :: "'a::euclidean_space set" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1243 | assumes S: "pairwise orthogonal S" and x: "x \<in> span S" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1244 | shows "orthogonal x (a - (\<Sum>b\<in>S. (b \<bullet> a / (b \<bullet> b)) *\<^sub>R b))" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1245 | proof - | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1246 | have "finite S" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1247 | by (simp add: S pairwise_orthogonal_imp_finite) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1248 | have "orthogonal (a - (\<Sum>b\<in>S. (b \<bullet> a / (b \<bullet> b)) *\<^sub>R b)) x" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1249 | if "x \<in> S" for x | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1250 | proof - | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1251 | have "a \<bullet> x = (\<Sum>y\<in>S. if y = x then y \<bullet> a else 0)" | 
| 71044 | 1252 | by (simp add: \<open>finite S\<close> inner_commute that) | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1253 | also have "\<dots> = (\<Sum>b\<in>S. b \<bullet> a * (b \<bullet> x) / (b \<bullet> b))" | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1254 | apply (rule sum.cong [OF refl], simp) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1255 | by (meson S orthogonal_def pairwise_def that) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1256 | finally show ?thesis | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1257 | by (simp add: orthogonal_def algebra_simps inner_sum_left) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1258 | qed | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1259 | then show ?thesis | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1260 | using orthogonal_to_span orthogonal_commute x by blast | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1261 | qed | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1262 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1263 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1264 | lemma orthogonal_extension_aux: | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1265 | fixes S :: "'a::euclidean_space set" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1266 | assumes "finite T" "finite S" "pairwise orthogonal S" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1267 | shows "\<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> T)" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1268 | using assms | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1269 | proof (induction arbitrary: S) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1270 | case empty then show ?case | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1271 | by simp (metis sup_bot_right) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1272 | next | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1273 | case (insert a T) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1274 | have 0: "\<And>x y. \<lbrakk>x \<noteq> y; x \<in> S; y \<in> S\<rbrakk> \<Longrightarrow> x \<bullet> y = 0" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1275 | using insert by (simp add: pairwise_def orthogonal_def) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1276 | define a' where "a' = a - (\<Sum>b\<in>S. (b \<bullet> a / (b \<bullet> b)) *\<^sub>R b)" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1277 | obtain U where orthU: "pairwise orthogonal (S \<union> insert a' U)" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1278 | and spanU: "span (insert a' S \<union> U) = span (insert a' S \<union> T)" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1279 | by (rule exE [OF insert.IH [of "insert a' S"]]) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1280 | (auto simp: Gram_Schmidt_step a'_def insert.prems orthogonal_commute | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1281 | pairwise_orthogonal_insert span_clauses) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1282 | have orthS: "\<And>x. x \<in> S \<Longrightarrow> a' \<bullet> x = 0" | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1283 | using Gram_Schmidt_step a'_def insert.prems orthogonal_commute orthogonal_def span_base by blast | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1284 | have "span (S \<union> insert a' U) = span (insert a' (S \<union> T))" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1285 | using spanU by simp | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1286 | also have "\<dots> = span (insert a (S \<union> T))" | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1287 | by (simp add: a'_def span_neg span_sum span_base span_mul eq_span_insert_eq) | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1288 | also have "\<dots> = span (S \<union> insert a T)" | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1289 | by simp | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1290 | finally show ?case | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1291 | using orthU by blast | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1292 | qed | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1293 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1294 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1295 | proposition orthogonal_extension: | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1296 | fixes S :: "'a::euclidean_space set" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1297 | assumes S: "pairwise orthogonal S" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1298 | obtains U where "pairwise orthogonal (S \<union> U)" "span (S \<union> U) = span (S \<union> T)" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1299 | proof - | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1300 | obtain B where "finite B" "span B = span T" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1301 | using basis_subspace_exists [of "span T"] subspace_span by metis | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1302 | with orthogonal_extension_aux [of B S] | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1303 | obtain U where "pairwise orthogonal (S \<union> U)" "span (S \<union> U) = span (S \<union> B)" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1304 | using assms pairwise_orthogonal_imp_finite by auto | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1305 | with \<open>span B = span T\<close> show ?thesis | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1306 | by (rule_tac U=U in that) (auto simp: span_Un) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1307 | qed | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1308 | |
| 70136 | 1309 | corollary\<^marker>\<open>tag unimportant\<close> orthogonal_extension_strong: | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1310 | fixes S :: "'a::euclidean_space set" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1311 | assumes S: "pairwise orthogonal S" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1312 |   obtains U where "U \<inter> (insert 0 S) = {}" "pairwise orthogonal (S \<union> U)"
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1313 | "span (S \<union> U) = span (S \<union> T)" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1314 | proof - | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1315 | obtain U where U: "pairwise orthogonal (S \<union> U)" "span (S \<union> U) = span (S \<union> T)" | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1316 | using orthogonal_extension assms by blast | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1317 | moreover have "pairwise orthogonal (S \<union> (U - insert 0 S))" | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1318 | by (smt (verit, best) Un_Diff_Int Un_iff U pairwise_def) | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1319 | ultimately show ?thesis | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1320 | by (metis Diff_disjoint Un_Diff_cancel Un_insert_left inf_commute span_insert_0 that) | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1321 | qed | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1322 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1323 | subsection\<open>Decomposing a vector into parts in orthogonal subspaces\<close> | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1324 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1325 | text\<open>existence of orthonormal basis for a subspace.\<close> | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1326 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1327 | lemma orthogonal_spanningset_subspace: | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1328 | fixes S :: "'a :: euclidean_space set" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1329 | assumes "subspace S" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1330 | obtains B where "B \<subseteq> S" "pairwise orthogonal B" "span B = S" | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1331 | by (metis assms basis_orthogonal basis_subspace_exists span_eq) | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1332 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1333 | lemma orthogonal_basis_subspace: | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1334 | fixes S :: "'a :: euclidean_space set" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1335 | assumes "subspace S" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1336 | obtains B where "0 \<notin> B" "B \<subseteq> S" "pairwise orthogonal B" "independent B" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1337 | "card B = dim S" "span B = S" | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1338 | by (metis assms dependent_zero orthogonal_basis_exists span_eq span_eq_iff) | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1339 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1340 | proposition orthonormal_basis_subspace: | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1341 | fixes S :: "'a :: euclidean_space set" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1342 | assumes "subspace S" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1343 | obtains B where "B \<subseteq> S" "pairwise orthogonal B" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1344 | and "\<And>x. x \<in> B \<Longrightarrow> norm x = 1" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1345 | and "independent B" "card B = dim S" "span B = S" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1346 | proof - | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1347 | obtain B where "0 \<notin> B" "B \<subseteq> S" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1348 | and orth: "pairwise orthogonal B" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1349 | and "independent B" "card B = dim S" "span B = S" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1350 | by (blast intro: orthogonal_basis_subspace [OF assms]) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1351 | have 1: "(\<lambda>x. x /\<^sub>R norm x) ` B \<subseteq> S" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1352 | using \<open>span B = S\<close> span_superset span_mul by fastforce | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1353 | have 2: "pairwise orthogonal ((\<lambda>x. x /\<^sub>R norm x) ` B)" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1354 | using orth by (force simp: pairwise_def orthogonal_clauses) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1355 | have 3: "\<And>x. x \<in> (\<lambda>x. x /\<^sub>R norm x) ` B \<Longrightarrow> norm x = 1" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1356 | by (metis (no_types, lifting) \<open>0 \<notin> B\<close> image_iff norm_sgn sgn_div_norm) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1357 | have 4: "independent ((\<lambda>x. x /\<^sub>R norm x) ` B)" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1358 | by (metis "2" "3" norm_zero pairwise_orthogonal_independent zero_neq_one) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1359 | have "inj_on (\<lambda>x. x /\<^sub>R norm x) B" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1360 | proof | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1361 | fix x y | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1362 | assume "x \<in> B" "y \<in> B" "x /\<^sub>R norm x = y /\<^sub>R norm y" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1363 | moreover have "\<And>i. i \<in> B \<Longrightarrow> norm (i /\<^sub>R norm i) = 1" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1364 | using 3 by blast | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1365 | ultimately show "x = y" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1366 | by (metis norm_eq_1 orth orthogonal_clauses(7) orthogonal_commute orthogonal_def pairwise_def zero_neq_one) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1367 | qed | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1368 | then have 5: "card ((\<lambda>x. x /\<^sub>R norm x) ` B) = dim S" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1369 | by (metis \<open>card B = dim S\<close> card_image) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1370 | have 6: "span ((\<lambda>x. x /\<^sub>R norm x) ` B) = S" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1371 | by (metis "1" "4" "5" assms card_eq_dim independent_imp_finite span_subspace) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1372 | show ?thesis | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1373 | by (rule that [OF 1 2 3 4 5 6]) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1374 | qed | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1375 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1376 | |
| 70136 | 1377 | proposition\<^marker>\<open>tag unimportant\<close> orthogonal_to_subspace_exists_gen: | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1378 | fixes S :: "'a :: euclidean_space set" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1379 | assumes "span S \<subset> span T" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1380 | obtains x where "x \<noteq> 0" "x \<in> span T" "\<And>y. y \<in> span S \<Longrightarrow> orthogonal x y" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1381 | proof - | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1382 | obtain B where "B \<subseteq> span S" and orthB: "pairwise orthogonal B" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1383 | and "\<And>x. x \<in> B \<Longrightarrow> norm x = 1" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1384 | and "independent B" "card B = dim S" "span B = span S" | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1385 | by (metis dim_span orthonormal_basis_subspace subspace_span) | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1386 | with assms obtain u where spanBT: "span B \<subseteq> span T" and "u \<notin> span B" "u \<in> span T" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1387 | by auto | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1388 |   obtain C where orthBC: "pairwise orthogonal (B \<union> C)" and spanBC: "span (B \<union> C) = span (B \<union> {u})"
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1389 | by (blast intro: orthogonal_extension [OF orthB]) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1390 | show thesis | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1391 | proof (cases "C \<subseteq> insert 0 B") | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1392 | case True | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1393 | then have "C \<subseteq> span B" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1394 | using span_eq | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1395 | by (metis span_insert_0 subset_trans) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1396 | moreover have "u \<in> span (B \<union> C)" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1397 |       using \<open>span (B \<union> C) = span (B \<union> {u})\<close> span_superset by force
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1398 | ultimately show ?thesis | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1399 | using True \<open>u \<notin> span B\<close> | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1400 | by (metis Un_insert_left span_insert_0 sup.orderE) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1401 | next | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1402 | case False | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1403 | then obtain x where "x \<in> C" "x \<noteq> 0" "x \<notin> B" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1404 | by blast | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1405 | then have "x \<in> span T" | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1406 | by (smt (verit, ccfv_SIG) Set.set_insert \<open>u \<in> span T\<close> empty_subsetI insert_subset | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1407 | le_sup_iff spanBC spanBT span_mono span_span span_superset subset_trans) | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1408 | moreover have "orthogonal x y" if "y \<in> span B" for y | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1409 | using that | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1410 | proof (rule span_induct) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1411 |       show "subspace {a. orthogonal x a}"
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1412 | by (simp add: subspace_orthogonal_to_vector) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1413 | show "\<And>b. b \<in> B \<Longrightarrow> orthogonal x b" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1414 | by (metis Un_iff \<open>x \<in> C\<close> \<open>x \<notin> B\<close> orthBC pairwise_def) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1415 | qed | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1416 | ultimately show ?thesis | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1417 | using \<open>x \<noteq> 0\<close> that \<open>span B = span S\<close> by auto | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1418 | qed | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1419 | qed | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1420 | |
| 70136 | 1421 | corollary\<^marker>\<open>tag unimportant\<close> orthogonal_to_subspace_exists: | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1422 | fixes S :: "'a :: euclidean_space set" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1423 |   assumes "dim S < DIM('a)"
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1424 | obtains x where "x \<noteq> 0" "\<And>y. y \<in> span S \<Longrightarrow> orthogonal x y" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1425 | proof - | 
| 71044 | 1426 | have "span S \<subset> UNIV" | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1427 | by (metis assms dim_eq_full order_less_imp_not_less top.not_eq_extremum) | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1428 | with orthogonal_to_subspace_exists_gen [of S UNIV] that show ?thesis | 
| 71044 | 1429 | by (auto) | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1430 | qed | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1431 | |
| 70136 | 1432 | corollary\<^marker>\<open>tag unimportant\<close> orthogonal_to_vector_exists: | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1433 | fixes x :: "'a :: euclidean_space" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1434 |   assumes "2 \<le> DIM('a)"
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1435 | obtains y where "y \<noteq> 0" "orthogonal x y" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1436 | proof - | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1437 |   have "dim {x} < DIM('a)"
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1438 | using assms by auto | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1439 | then show thesis | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1440 | by (rule orthogonal_to_subspace_exists) (simp add: orthogonal_commute span_base that) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1441 | qed | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1442 | |
| 70136 | 1443 | proposition\<^marker>\<open>tag unimportant\<close> orthogonal_subspace_decomp_exists: | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1444 | fixes S :: "'a :: euclidean_space set" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1445 | obtains y z | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1446 | where "y \<in> span S" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1447 | and "\<And>w. w \<in> span S \<Longrightarrow> orthogonal z w" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1448 | and "x = y + z" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1449 | proof - | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1450 | obtain T where "0 \<notin> T" "T \<subseteq> span S" "pairwise orthogonal T" "independent T" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1451 | "card T = dim (span S)" "span T = span S" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1452 | using orthogonal_basis_subspace subspace_span by blast | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1453 | let ?a = "\<Sum>b\<in>T. (b \<bullet> x / (b \<bullet> b)) *\<^sub>R b" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1454 | have orth: "orthogonal (x - ?a) w" if "w \<in> span S" for w | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1455 | by (simp add: Gram_Schmidt_step \<open>pairwise orthogonal T\<close> \<open>span T = span S\<close> | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1456 | orthogonal_commute that) | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1457 | with that[of ?a "x-?a"] \<open>T \<subseteq> span S\<close> show ?thesis | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1458 | by (simp add: span_mul span_sum subsetD) | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1459 | qed | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1460 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1461 | lemma orthogonal_subspace_decomp_unique: | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1462 | fixes S :: "'a :: euclidean_space set" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1463 | assumes "x + y = x' + y'" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1464 | and ST: "x \<in> span S" "x' \<in> span S" "y \<in> span T" "y' \<in> span T" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1465 | and orth: "\<And>a b. \<lbrakk>a \<in> S; b \<in> T\<rbrakk> \<Longrightarrow> orthogonal a b" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1466 | shows "x = x' \<and> y = y'" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1467 | proof - | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1468 | have "x + y - y' = x'" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1469 | by (simp add: assms) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1470 | moreover have "\<And>a b. \<lbrakk>a \<in> span S; b \<in> span T\<rbrakk> \<Longrightarrow> orthogonal a b" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1471 | by (meson orth orthogonal_commute orthogonal_to_span) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1472 | ultimately have "0 = x' - x" | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1473 | using assms | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1474 | by (metis add.commute add_diff_cancel_right' diff_right_commute orthogonal_self span_diff) | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1475 | with assms show ?thesis by auto | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1476 | qed | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1477 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1478 | lemma vector_in_orthogonal_spanningset: | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1479 | fixes a :: "'a::euclidean_space" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1480 | obtains S where "a \<in> S" "pairwise orthogonal S" "span S = UNIV" | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1481 | by (metis UnI1 Un_UNIV_right insertI1 orthogonal_extension pairwise_singleton span_UNIV) | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1482 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1483 | lemma vector_in_orthogonal_basis: | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1484 | fixes a :: "'a::euclidean_space" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1485 | assumes "a \<noteq> 0" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1486 | obtains S where "a \<in> S" "0 \<notin> S" "pairwise orthogonal S" "independent S" "finite S" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1487 |                   "span S = UNIV" "card S = DIM('a)"
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1488 | proof - | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1489 | obtain S where S: "a \<in> S" "pairwise orthogonal S" "span S = UNIV" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1490 | using vector_in_orthogonal_spanningset . | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1491 | show thesis | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1492 | proof | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1493 |     show "pairwise orthogonal (S - {0})"
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1494 | using pairwise_mono S(2) by blast | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1495 |     show "independent (S - {0})"
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1496 |       by (simp add: \<open>pairwise orthogonal (S - {0})\<close> pairwise_orthogonal_independent)
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1497 |     show "finite (S - {0})"
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1498 |       using \<open>independent (S - {0})\<close> independent_imp_finite by blast
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1499 |     show "card (S - {0}) = DIM('a)"
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1500 | using span_delete_0 [of S] S | 
| 71044 | 1501 |       by (simp add: \<open>independent (S - {0})\<close> indep_card_eq_dim_span)
 | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1502 | qed (use S \<open>a \<noteq> 0\<close> in auto) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1503 | qed | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1504 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1505 | lemma vector_in_orthonormal_basis: | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1506 | fixes a :: "'a::euclidean_space" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1507 | assumes "norm a = 1" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1508 | obtains S where "a \<in> S" "pairwise orthogonal S" "\<And>x. x \<in> S \<Longrightarrow> norm x = 1" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1509 |     "independent S" "card S = DIM('a)" "span S = UNIV"
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1510 | proof - | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1511 | have "a \<noteq> 0" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1512 | using assms by auto | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1513 | then obtain S where "a \<in> S" "0 \<notin> S" "finite S" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1514 |           and S: "pairwise orthogonal S" "independent S" "span S = UNIV" "card S = DIM('a)"
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1515 | by (metis vector_in_orthogonal_basis) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1516 | let ?S = "(\<lambda>x. x /\<^sub>R norm x) ` S" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1517 | show thesis | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1518 | proof | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1519 | show "a \<in> ?S" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1520 | using \<open>a \<in> S\<close> assms image_iff by fastforce | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1521 | next | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1522 | show "pairwise orthogonal ?S" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1523 | using \<open>pairwise orthogonal S\<close> by (auto simp: pairwise_def orthogonal_def) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1524 | show "\<And>x. x \<in> (\<lambda>x. x /\<^sub>R norm x) ` S \<Longrightarrow> norm x = 1" | 
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70707diff
changeset | 1525 | using \<open>0 \<notin> S\<close> by (auto simp: field_split_simps) | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1526 | then show ind: "independent ?S" | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1527 | by (metis \<open>pairwise orthogonal ((\<lambda>x. x /\<^sub>R norm x) ` S)\<close> norm_zero pairwise_orthogonal_independent zero_neq_one) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1528 | have "inj_on (\<lambda>x. x /\<^sub>R norm x) S" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1529 | unfolding inj_on_def | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1530 | by (metis (full_types) S(1) \<open>0 \<notin> S\<close> inverse_nonzero_iff_nonzero norm_eq_zero orthogonal_scaleR orthogonal_self pairwise_def) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1531 |     then show "card ?S = DIM('a)"
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1532 | by (simp add: card_image S) | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1533 | then show "span ?S = UNIV" | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1534 | by (metis ind dim_eq_card dim_eq_full) | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1535 | qed | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1536 | qed | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1537 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1538 | proposition dim_orthogonal_sum: | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1539 | fixes A :: "'a::euclidean_space set" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1540 | assumes "\<And>x y. \<lbrakk>x \<in> A; y \<in> B\<rbrakk> \<Longrightarrow> x \<bullet> y = 0" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1541 | shows "dim(A \<union> B) = dim A + dim B" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1542 | proof - | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1543 | have 1: "\<And>x y. \<lbrakk>x \<in> span A; y \<in> B\<rbrakk> \<Longrightarrow> x \<bullet> y = 0" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1544 | by (erule span_induct [OF _ subspace_hyperplane2]; simp add: assms) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1545 | have "\<And>x y. \<lbrakk>x \<in> span A; y \<in> span B\<rbrakk> \<Longrightarrow> x \<bullet> y = 0" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1546 | using 1 by (simp add: span_induct [OF _ subspace_hyperplane]) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1547 | then have 0: "\<And>x y. \<lbrakk>x \<in> span A; y \<in> span B\<rbrakk> \<Longrightarrow> x \<bullet> y = 0" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1548 | by simp | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1549 | have "dim(A \<union> B) = dim (span (A \<union> B))" | 
| 71044 | 1550 | by (simp) | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1551 | also have "span (A \<union> B) = ((\<lambda>(a, b). a + b) ` (span A \<times> span B))" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1552 | by (auto simp add: span_Un image_def) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1553 |   also have "dim \<dots> = dim {x + y |x y. x \<in> span A \<and> y \<in> span B}"
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1554 | by (auto intro!: arg_cong [where f=dim]) | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1555 |   also have "\<dots> = dim {x + y |x y. x \<in> span A \<and> y \<in> span B} + dim(span A \<inter> span B)"
 | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1556 | by (auto dest: 0) | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1557 | also have "\<dots> = dim A + dim B" | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1558 | using dim_sums_Int by fastforce | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1559 | finally show ?thesis . | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1560 | qed | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1561 | |
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1562 | lemma dim_subspace_orthogonal_to_vectors: | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1563 | fixes A :: "'a::euclidean_space set" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1564 | assumes "subspace A" "subspace B" "A \<subseteq> B" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1565 |     shows "dim {y \<in> B. \<forall>x \<in> A. orthogonal x y} + dim A = dim B"
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1566 | proof - | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1567 |   have "dim (span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A)) = dim (span B)"
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1568 | proof (rule arg_cong [where f=dim, OF subset_antisym]) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1569 |     show "span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A) \<subseteq> span B"
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1570 | by (simp add: \<open>A \<subseteq> B\<close> Collect_restrict span_mono) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1571 | next | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1572 |     have *: "x \<in> span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A)"
 | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1573 | if "x \<in> B" for x | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1574 | proof - | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1575 | obtain y z where "x = y + z" "y \<in> span A" and orth: "\<And>w. w \<in> span A \<Longrightarrow> orthogonal z w" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1576 | using orthogonal_subspace_decomp_exists [of A x] that by auto | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1577 | moreover | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1578 | have "y \<in> span B" | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1579 | using \<open>y \<in> span A\<close> assms(3) span_mono by blast | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1580 | ultimately have "z \<in> B \<and> (\<forall>x. x \<in> A \<longrightarrow> orthogonal x z)" | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1581 | using assms by (metis orthogonal_commute span_add_eq span_eq_iff that) | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1582 |       then have z: "z \<in> span {y \<in> B. \<forall>x\<in>A. orthogonal x y}"
 | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1583 | by (simp add: span_base) | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1584 | then show ?thesis | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1585 | by (smt (verit, best) \<open>x = y + z\<close> \<open>y \<in> span A\<close> le_sup_iff span_add_eq span_subspace_induct | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1586 | span_superset subset_iff subspace_span) | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1587 | qed | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1588 |     show "span B \<subseteq> span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A)"
 | 
| 71044 | 1589 | by (rule span_minimal) (auto intro: * span_minimal) | 
| 69675 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1590 | qed | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1591 | then show ?thesis | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1592 | by (metis (no_types, lifting) dim_orthogonal_sum dim_span mem_Collect_eq | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1593 | orthogonal_commute orthogonal_def) | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1594 | qed | 
| 
880ab0f27ddf
Reorg, in particular Determinants as well as some linear algebra from Starlike and Change_Of_Vars
 immler parents: 
69674diff
changeset | 1595 | |
| 70688 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1596 | subsection\<open>Linear functions are (uniformly) continuous on any set\<close> | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1597 | |
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1598 | subsection\<^marker>\<open>tag unimportant\<close> \<open>Topological properties of linear functions\<close> | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1599 | |
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1600 | lemma linear_lim_0: | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1601 | assumes "bounded_linear f" | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1602 | shows "(f \<longlongrightarrow> 0) (at (0))" | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1603 | proof - | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1604 | interpret f: bounded_linear f by fact | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1605 | have "(f \<longlongrightarrow> f 0) (at 0)" | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1606 | using tendsto_ident_at by (rule f.tendsto) | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1607 | then show ?thesis unfolding f.zero . | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1608 | qed | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1609 | |
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1610 | lemma linear_continuous_at: | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1611 | "bounded_linear f \<Longrightarrow>continuous (at a) f" | 
| 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1612 | by (simp add: bounded_linear.isUCont isUCont_isCont) | 
| 70688 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1613 | |
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1614 | lemma linear_continuous_within: | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1615 | "bounded_linear f \<Longrightarrow> continuous (at x within s) f" | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1616 | using continuous_at_imp_continuous_at_within linear_continuous_at by blast | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1617 | |
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1618 | lemma linear_continuous_on: | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1619 | "bounded_linear f \<Longrightarrow> continuous_on s f" | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1620 | using continuous_at_imp_continuous_on[of s f] using linear_continuous_at[of f] by auto | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1621 | |
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1622 | lemma Lim_linear: | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1623 | fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space" and h :: "'b \<Rightarrow> 'c::real_normed_vector" | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1624 | assumes "(f \<longlongrightarrow> l) F" "linear h" | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1625 | shows "((\<lambda>x. h(f x)) \<longlongrightarrow> h l) F" | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1626 | proof - | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1627 | obtain B where B: "B > 0" "\<And>x. norm (h x) \<le> B * norm x" | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1628 | using linear_bounded_pos [OF \<open>linear h\<close>] by blast | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1629 | show ?thesis | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1630 | unfolding tendsto_iff | 
| 76836 
30182f9e1818
Big simplifications of old proofs
 paulson <lp15@cam.ac.uk> parents: 
75455diff
changeset | 1631 | by (simp add: assms bounded_linear.tendsto linear_linear tendstoD) | 
| 70688 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1632 | qed | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1633 | |
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1634 | lemma linear_continuous_compose: | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1635 | fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space" and g :: "'b \<Rightarrow> 'c::real_normed_vector" | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1636 | assumes "continuous F f" "linear g" | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1637 | shows "continuous F (\<lambda>x. g(f x))" | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1638 | using assms unfolding continuous_def by (rule Lim_linear) | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1639 | |
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1640 | lemma linear_continuous_on_compose: | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1641 | fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space" and g :: "'b \<Rightarrow> 'c::real_normed_vector" | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1642 | assumes "continuous_on S f" "linear g" | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1643 | shows "continuous_on S (\<lambda>x. g(f x))" | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1644 | using assms by (simp add: continuous_on_eq_continuous_within linear_continuous_compose) | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1645 | |
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1646 | text\<open>Also bilinear functions, in composition form\<close> | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1647 | |
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1648 | lemma bilinear_continuous_compose: | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1649 | fixes h :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space \<Rightarrow> 'c::real_normed_vector" | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1650 | assumes "continuous F f" "continuous F g" "bilinear h" | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1651 | shows "continuous F (\<lambda>x. h (f x) (g x))" | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1652 | using assms bilinear_conv_bounded_bilinear bounded_bilinear.continuous by blast | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1653 | |
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1654 | lemma bilinear_continuous_on_compose: | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1655 | fixes h :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space \<Rightarrow> 'c::real_normed_vector" | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1656 | and f :: "'d::t2_space \<Rightarrow> 'a" | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1657 | assumes "continuous_on S f" "continuous_on S g" "bilinear h" | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1658 | shows "continuous_on S (\<lambda>x. h (f x) (g x))" | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1659 | using assms by (simp add: continuous_on_eq_continuous_within bilinear_continuous_compose) | 
| 
3d894e1cfc75
new material on Analysis, plus some rearrangements
 paulson <lp15@cam.ac.uk> parents: 
70136diff
changeset | 1660 | |
| 54776 
db890d9fc5c2
ordered_euclidean_space compatible with more standard pointwise ordering on products; conditionally complete lattice with product order
 immler parents: 
54703diff
changeset | 1661 | end |