src/HOL/Analysis/Cartesian_Euclidean_Space.thy
 author nipkow Thu Dec 27 19:48:28 2018 +0100 (5 months ago) changeset 69508 2a4c8a2a3f8e parent 69272 15e9ed5b28fb child 69597 ff784d5a5bfb permissions -rw-r--r--
 lp15@68038 ` 1` ```(* Title: HOL/Analysis/Cartesian_Euclidean_Space.thy ``` lp15@68043 ` 2` ``` Some material by Jose Divasón, Tim Makarios and L C Paulson ``` lp15@68038 ` 3` ```*) ``` lp15@68038 ` 4` ak2110@68833 ` 5` ```section%important \Instantiates the finite Cartesian product of Euclidean spaces as a Euclidean space\ ``` hoelzl@37489 ` 6` hoelzl@37489 ` 7` ```theory Cartesian_Euclidean_Space ``` immler@68072 ` 8` ```imports Cartesian_Space Derivative ``` hoelzl@37489 ` 9` ```begin ``` hoelzl@37489 ` 10` ak2110@68833 ` 11` ```lemma%unimportant subspace_special_hyperplane: "subspace {x. x \$ k = 0}" ``` lp15@63016 ` 12` ``` by (simp add: subspace_def) ``` lp15@63016 ` 13` ak2110@68833 ` 14` ```lemma%important sum_mult_product: ``` nipkow@64267 ` 15` ``` "sum h {..i\{..j\{..j. j + i * B) {..j. j + i * B) ` {.. {i * B.. (\j. j + i * B) ` {.. cbox a b = {}" ``` lp15@67979 ` 45` ``` "box (vec a) (vec b) = {} \ box a b = {}" ``` lp15@67979 ` 46` ``` by (auto simp: Basis_vec_def mem_box box_eq_empty inner_axis) ``` lp15@67979 ` 47` ak2110@68833 ` 48` ```subsection%important\Closures and interiors of halfspaces\ ``` lp15@62397 ` 49` ak2110@68833 ` 50` ```lemma%important interior_halfspace_le [simp]: ``` lp15@62397 ` 51` ``` assumes "a \ 0" ``` lp15@62397 ` 52` ``` shows "interior {x. a \ x \ b} = {x. a \ x < b}" ``` ak2110@68833 ` 53` ```proof%unimportant - ``` lp15@62397 ` 54` ``` have *: "a \ x < b" if x: "x \ S" and S: "S \ {x. a \ x \ b}" and "open S" for S x ``` lp15@62397 ` 55` ``` proof - ``` lp15@62397 ` 56` ``` obtain e where "e>0" and e: "cball x e \ S" ``` lp15@62397 ` 57` ``` using \open S\ open_contains_cball x by blast ``` lp15@62397 ` 58` ``` then have "x + (e / norm a) *\<^sub>R a \ cball x e" ``` lp15@62397 ` 59` ``` by (simp add: dist_norm) ``` lp15@62397 ` 60` ``` then have "x + (e / norm a) *\<^sub>R a \ S" ``` lp15@62397 ` 61` ``` using e by blast ``` lp15@62397 ` 62` ``` then have "x + (e / norm a) *\<^sub>R a \ {x. a \ x \ b}" ``` lp15@62397 ` 63` ``` using S by blast ``` lp15@62397 ` 64` ``` moreover have "e * (a \ a) / norm a > 0" ``` lp15@62397 ` 65` ``` by (simp add: \0 < e\ assms) ``` lp15@62397 ` 66` ``` ultimately show ?thesis ``` lp15@62397 ` 67` ``` by (simp add: algebra_simps) ``` lp15@62397 ` 68` ``` qed ``` lp15@62397 ` 69` ``` show ?thesis ``` lp15@62397 ` 70` ``` by (rule interior_unique) (auto simp: open_halfspace_lt *) ``` lp15@62397 ` 71` ```qed ``` lp15@62397 ` 72` ak2110@68833 ` 73` ```lemma%unimportant interior_halfspace_ge [simp]: ``` lp15@62397 ` 74` ``` "a \ 0 \ interior {x. a \ x \ b} = {x. a \ x > b}" ``` lp15@62397 ` 75` ```using interior_halfspace_le [of "-a" "-b"] by simp ``` lp15@62397 ` 76` ak2110@68833 ` 77` ```lemma%important interior_halfspace_component_le [simp]: ``` wenzelm@67731 ` 78` ``` "interior {x. x\$k \ a} = {x :: (real^'n). x\$k < a}" (is "?LE") ``` lp15@62397 ` 79` ``` and interior_halfspace_component_ge [simp]: ``` wenzelm@67731 ` 80` ``` "interior {x. x\$k \ a} = {x :: (real^'n). x\$k > a}" (is "?GE") ``` ak2110@68833 ` 81` ```proof%unimportant - ``` lp15@62397 ` 82` ``` have "axis k (1::real) \ 0" ``` lp15@62397 ` 83` ``` by (simp add: axis_def vec_eq_iff) ``` lp15@62397 ` 84` ``` moreover have "axis k (1::real) \ x = x\$k" for x ``` lp15@62397 ` 85` ``` by (simp add: cart_eq_inner_axis inner_commute) ``` lp15@62397 ` 86` ``` ultimately show ?LE ?GE ``` lp15@62397 ` 87` ``` using interior_halfspace_le [of "axis k (1::real)" a] ``` lp15@62397 ` 88` ``` interior_halfspace_ge [of "axis k (1::real)" a] by auto ``` lp15@62397 ` 89` ```qed ``` lp15@62397 ` 90` ak2110@68833 ` 91` ```lemma%unimportant closure_halfspace_lt [simp]: ``` lp15@62397 ` 92` ``` assumes "a \ 0" ``` lp15@62397 ` 93` ``` shows "closure {x. a \ x < b} = {x. a \ x \ b}" ``` lp15@62397 ` 94` ```proof - ``` lp15@62397 ` 95` ``` have [simp]: "-{x. a \ x < b} = {x. a \ x \ b}" ``` lp15@62397 ` 96` ``` by (force simp:) ``` lp15@62397 ` 97` ``` then show ?thesis ``` lp15@62397 ` 98` ``` using interior_halfspace_ge [of a b] assms ``` lp15@62397 ` 99` ``` by (force simp: closure_interior) ``` lp15@62397 ` 100` ```qed ``` lp15@62397 ` 101` ak2110@68833 ` 102` ```lemma%unimportant closure_halfspace_gt [simp]: ``` lp15@62397 ` 103` ``` "a \ 0 \ closure {x. a \ x > b} = {x. a \ x \ b}" ``` lp15@62397 ` 104` ```using closure_halfspace_lt [of "-a" "-b"] by simp ``` lp15@62397 ` 105` ak2110@68833 ` 106` ```lemma%important closure_halfspace_component_lt [simp]: ``` wenzelm@67731 ` 107` ``` "closure {x. x\$k < a} = {x :: (real^'n). x\$k \ a}" (is "?LE") ``` lp15@62397 ` 108` ``` and closure_halfspace_component_gt [simp]: ``` wenzelm@67731 ` 109` ``` "closure {x. x\$k > a} = {x :: (real^'n). x\$k \ a}" (is "?GE") ``` ak2110@68833 ` 110` ```proof%unimportant - ``` lp15@62397 ` 111` ``` have "axis k (1::real) \ 0" ``` lp15@62397 ` 112` ``` by (simp add: axis_def vec_eq_iff) ``` lp15@62397 ` 113` ``` moreover have "axis k (1::real) \ x = x\$k" for x ``` lp15@62397 ` 114` ``` by (simp add: cart_eq_inner_axis inner_commute) ``` lp15@62397 ` 115` ``` ultimately show ?LE ?GE ``` lp15@62397 ` 116` ``` using closure_halfspace_lt [of "axis k (1::real)" a] ``` lp15@62397 ` 117` ``` closure_halfspace_gt [of "axis k (1::real)" a] by auto ``` lp15@62397 ` 118` ```qed ``` lp15@62397 ` 119` ak2110@68833 ` 120` ```lemma%unimportant interior_hyperplane [simp]: ``` lp15@62397 ` 121` ``` assumes "a \ 0" ``` lp15@62397 ` 122` ``` shows "interior {x. a \ x = b} = {}" ``` ak2110@68833 ` 123` ```proof%unimportant - ``` lp15@62397 ` 124` ``` have [simp]: "{x. a \ x = b} = {x. a \ x \ b} \ {x. a \ x \ b}" ``` lp15@62397 ` 125` ``` by (force simp:) ``` lp15@62397 ` 126` ``` then show ?thesis ``` lp15@62397 ` 127` ``` by (auto simp: assms) ``` lp15@62397 ` 128` ```qed ``` lp15@62397 ` 129` ak2110@68833 ` 130` ```lemma%unimportant frontier_halfspace_le: ``` lp15@62397 ` 131` ``` assumes "a \ 0 \ b \ 0" ``` lp15@62397 ` 132` ``` shows "frontier {x. a \ x \ b} = {x. a \ x = b}" ``` lp15@62397 ` 133` ```proof (cases "a = 0") ``` lp15@62397 ` 134` ``` case True with assms show ?thesis by simp ``` lp15@62397 ` 135` ```next ``` lp15@62397 ` 136` ``` case False then show ?thesis ``` lp15@62397 ` 137` ``` by (force simp: frontier_def closed_halfspace_le) ``` lp15@62397 ` 138` ```qed ``` lp15@62397 ` 139` ak2110@68833 ` 140` ```lemma%unimportant frontier_halfspace_ge: ``` lp15@62397 ` 141` ``` assumes "a \ 0 \ b \ 0" ``` lp15@62397 ` 142` ``` shows "frontier {x. a \ x \ b} = {x. a \ x = b}" ``` lp15@62397 ` 143` ```proof (cases "a = 0") ``` lp15@62397 ` 144` ``` case True with assms show ?thesis by simp ``` lp15@62397 ` 145` ```next ``` lp15@62397 ` 146` ``` case False then show ?thesis ``` lp15@62397 ` 147` ``` by (force simp: frontier_def closed_halfspace_ge) ``` lp15@62397 ` 148` ```qed ``` lp15@62397 ` 149` ak2110@68833 ` 150` ```lemma%unimportant frontier_halfspace_lt: ``` lp15@62397 ` 151` ``` assumes "a \ 0 \ b \ 0" ``` lp15@62397 ` 152` ``` shows "frontier {x. a \ x < b} = {x. a \ x = b}" ``` lp15@62397 ` 153` ```proof (cases "a = 0") ``` lp15@62397 ` 154` ``` case True with assms show ?thesis by simp ``` lp15@62397 ` 155` ```next ``` lp15@62397 ` 156` ``` case False then show ?thesis ``` lp15@62397 ` 157` ``` by (force simp: frontier_def interior_open open_halfspace_lt) ``` lp15@62397 ` 158` ```qed ``` lp15@62397 ` 159` ak2110@68833 ` 160` ```lemma%important frontier_halfspace_gt: ``` lp15@62397 ` 161` ``` assumes "a \ 0 \ b \ 0" ``` lp15@62397 ` 162` ``` shows "frontier {x. a \ x > b} = {x. a \ x = b}" ``` ak2110@68833 ` 163` ```proof%unimportant (cases "a = 0") ``` lp15@62397 ` 164` ``` case True with assms show ?thesis by simp ``` lp15@62397 ` 165` ```next ``` lp15@62397 ` 166` ``` case False then show ?thesis ``` lp15@62397 ` 167` ``` by (force simp: frontier_def interior_open open_halfspace_gt) ``` lp15@62397 ` 168` ```qed ``` lp15@62397 ` 169` ak2110@68833 ` 170` ```lemma%important interior_standard_hyperplane: ``` wenzelm@67731 ` 171` ``` "interior {x :: (real^'n). x\$k = a} = {}" ``` ak2110@68833 ` 172` ```proof%unimportant - ``` lp15@62397 ` 173` ``` have "axis k (1::real) \ 0" ``` lp15@62397 ` 174` ``` by (simp add: axis_def vec_eq_iff) ``` lp15@62397 ` 175` ``` moreover have "axis k (1::real) \ x = x\$k" for x ``` lp15@62397 ` 176` ``` by (simp add: cart_eq_inner_axis inner_commute) ``` lp15@62397 ` 177` ``` ultimately show ?thesis ``` lp15@62397 ` 178` ``` using interior_hyperplane [of "axis k (1::real)" a] ``` lp15@62397 ` 179` ``` by force ``` lp15@62397 ` 180` ```qed ``` lp15@62397 ` 181` ak2110@68833 ` 182` ```lemma%unimportant matrix_mult_transpose_dot_column: ``` immler@68072 ` 183` ``` shows "transpose A ** A = (\ i j. inner (column i A) (column j A))" ``` lp15@67673 ` 184` ``` by (simp add: matrix_matrix_mult_def vec_eq_iff transpose_def column_def inner_vec_def) ``` lp15@67673 ` 185` ak2110@68833 ` 186` ```lemma%unimportant matrix_mult_transpose_dot_row: ``` immler@68072 ` 187` ``` shows "A ** transpose A = (\ i j. inner (row i A) (row j A))" ``` lp15@67673 ` 188` ``` by (simp add: matrix_matrix_mult_def vec_eq_iff transpose_def row_def inner_vec_def) ``` lp15@67673 ` 189` wenzelm@60420 ` 190` ```text\Two sometimes fruitful ways of looking at matrix-vector multiplication.\ ``` hoelzl@37489 ` 191` ak2110@68833 ` 192` ```lemma%important matrix_mult_dot: "A *v x = (\ i. inner (A\$i) x)" ``` huffman@44136 ` 193` ``` by (simp add: matrix_vector_mult_def inner_vec_def) ``` hoelzl@37489 ` 194` ak2110@68833 ` 195` ```lemma%unimportant adjoint_matrix: "adjoint(\x. (A::real^'n^'m) *v x) = (\x. transpose A *v x)" ``` hoelzl@37489 ` 196` ``` apply (rule adjoint_unique) ``` wenzelm@49644 ` 197` ``` apply (simp add: transpose_def inner_vec_def matrix_vector_mult_def ``` nipkow@64267 ` 198` ``` sum_distrib_right sum_distrib_left) ``` haftmann@66804 ` 199` ``` apply (subst sum.swap) ``` immler@68072 ` 200` ``` apply (simp add: ac_simps) ``` hoelzl@37489 ` 201` ``` done ``` hoelzl@37489 ` 202` ak2110@68833 ` 203` ```lemma%important matrix_adjoint: assumes lf: "linear (f :: real^'n \ real ^'m)" ``` hoelzl@37489 ` 204` ``` shows "matrix(adjoint f) = transpose(matrix f)" ``` ak2110@68833 ` 205` ```proof%unimportant - ``` nipkow@69064 ` 206` ``` have "matrix(adjoint f) = matrix(adjoint ((*v) (matrix f)))" ``` immler@68072 ` 207` ``` by (simp add: lf) ``` immler@68072 ` 208` ``` also have "\ = transpose(matrix f)" ``` immler@68072 ` 209` ``` unfolding adjoint_matrix matrix_of_matrix_vector_mul ``` immler@68072 ` 210` ``` apply rule ``` immler@68072 ` 211` ``` done ``` immler@68072 ` 212` ``` finally show ?thesis . ``` immler@68072 ` 213` ```qed ``` wenzelm@49644 ` 214` nipkow@69064 ` 215` ```lemma%unimportant matrix_vector_mul_bounded_linear[intro, simp]: "bounded_linear ((*v) A)" for A :: "'a::{euclidean_space,real_algebra_1}^'n^'m" ``` immler@68072 ` 216` ``` using matrix_vector_mul_linear[of A] ``` immler@68072 ` 217` ``` by (simp add: linear_conv_bounded_linear linear_matrix_vector_mul_eq) ``` immler@68072 ` 218` ak2110@68833 ` 219` ```lemma%unimportant (* FIX ME needs name*) ``` immler@68073 ` 220` ``` fixes A :: "'a::{euclidean_space,real_algebra_1}^'n^'m" ``` nipkow@69064 ` 221` ``` shows matrix_vector_mult_linear_continuous_at [continuous_intros]: "isCont ((*v) A) z" ``` nipkow@69064 ` 222` ``` and matrix_vector_mult_linear_continuous_on [continuous_intros]: "continuous_on S ((*v) A)" ``` immler@68072 ` 223` ``` by (simp_all add: linear_continuous_at linear_continuous_on) ``` lp15@67981 ` 224` ak2110@68833 ` 225` ```lemma%unimportant scalar_invertible: ``` lp15@68050 ` 226` ``` fixes A :: "('a::real_algebra_1)^'m^'n" ``` lp15@68038 ` 227` ``` assumes "k \ 0" and "invertible A" ``` lp15@68038 ` 228` ``` shows "invertible (k *\<^sub>R A)" ``` lp15@68038 ` 229` ```proof - ``` lp15@68038 ` 230` ``` obtain A' where "A ** A' = mat 1" and "A' ** A = mat 1" ``` lp15@68038 ` 231` ``` using assms unfolding invertible_def by auto ``` wenzelm@69272 ` 232` ``` with \k \ 0\ ``` lp15@68038 ` 233` ``` have "(k *\<^sub>R A) ** ((1/k) *\<^sub>R A') = mat 1" "((1/k) *\<^sub>R A') ** (k *\<^sub>R A) = mat 1" ``` lp15@68038 ` 234` ``` by (simp_all add: assms matrix_scalar_ac) ``` lp15@68038 ` 235` ``` thus "invertible (k *\<^sub>R A)" ``` lp15@68038 ` 236` ``` unfolding invertible_def by auto ``` lp15@68038 ` 237` ```qed ``` lp15@68038 ` 238` ak2110@68833 ` 239` ```lemma%unimportant scalar_invertible_iff: ``` lp15@68050 ` 240` ``` fixes A :: "('a::real_algebra_1)^'m^'n" ``` lp15@68038 ` 241` ``` assumes "k \ 0" and "invertible A" ``` lp15@68038 ` 242` ``` shows "invertible (k *\<^sub>R A) \ k \ 0 \ invertible A" ``` lp15@68038 ` 243` ``` by (simp add: assms scalar_invertible) ``` lp15@68038 ` 244` ak2110@68833 ` 245` ```lemma%unimportant vector_transpose_matrix [simp]: "x v* transpose A = A *v x" ``` lp15@68038 ` 246` ``` unfolding transpose_def vector_matrix_mult_def matrix_vector_mult_def ``` lp15@68038 ` 247` ``` by simp ``` lp15@68038 ` 248` ak2110@68833 ` 249` ```lemma%unimportant transpose_matrix_vector [simp]: "transpose A *v x = x v* A" ``` lp15@68038 ` 250` ``` unfolding transpose_def vector_matrix_mult_def matrix_vector_mult_def ``` lp15@68038 ` 251` ``` by simp ``` lp15@68038 ` 252` ak2110@68833 ` 253` ```lemma%unimportant vector_scalar_commute: ``` lp15@68043 ` 254` ``` fixes A :: "'a::{field}^'m^'n" ``` lp15@68043 ` 255` ``` shows "A *v (c *s x) = c *s (A *v x)" ``` lp15@68043 ` 256` ``` by (simp add: vector_scalar_mult_def matrix_vector_mult_def mult_ac sum_distrib_left) ``` lp15@68043 ` 257` ak2110@68833 ` 258` ```lemma%unimportant scalar_vector_matrix_assoc: ``` lp15@68043 ` 259` ``` fixes k :: "'a::{field}" and x :: "'a::{field}^'n" and A :: "'a^'m^'n" ``` lp15@68043 ` 260` ``` shows "(k *s x) v* A = k *s (x v* A)" ``` lp15@68043 ` 261` ``` by (metis transpose_matrix_vector vector_scalar_commute) ``` lp15@68043 ` 262` ``` ``` ak2110@68833 ` 263` ```lemma%unimportant vector_matrix_mult_0 [simp]: "0 v* A = 0" ``` lp15@68043 ` 264` ``` unfolding vector_matrix_mult_def by (simp add: zero_vec_def) ``` lp15@68043 ` 265` ak2110@68833 ` 266` ```lemma%unimportant vector_matrix_mult_0_right [simp]: "x v* 0 = 0" ``` lp15@68043 ` 267` ``` unfolding vector_matrix_mult_def by (simp add: zero_vec_def) ``` lp15@68043 ` 268` ak2110@68833 ` 269` ```lemma%unimportant vector_matrix_mul_rid [simp]: ``` lp15@68038 ` 270` ``` fixes v :: "('a::semiring_1)^'n" ``` lp15@68038 ` 271` ``` shows "v v* mat 1 = v" ``` lp15@68038 ` 272` ``` by (metis matrix_vector_mul_lid transpose_mat vector_transpose_matrix) ``` lp15@68038 ` 273` ak2110@68833 ` 274` ```lemma%unimportant scaleR_vector_matrix_assoc: ``` lp15@68038 ` 275` ``` fixes k :: real and x :: "real^'n" and A :: "real^'m^'n" ``` lp15@68038 ` 276` ``` shows "(k *\<^sub>R x) v* A = k *\<^sub>R (x v* A)" ``` lp15@68038 ` 277` ``` by (metis matrix_vector_mult_scaleR transpose_matrix_vector) ``` lp15@68038 ` 278` ak2110@68833 ` 279` ```lemma%important vector_scaleR_matrix_ac: ``` lp15@68038 ` 280` ``` fixes k :: real and x :: "real^'n" and A :: "real^'m^'n" ``` lp15@68038 ` 281` ``` shows "x v* (k *\<^sub>R A) = k *\<^sub>R (x v* A)" ``` ak2110@68833 ` 282` ```proof%unimportant - ``` lp15@68038 ` 283` ``` have "x v* (k *\<^sub>R A) = (k *\<^sub>R x) v* A" ``` lp15@68038 ` 284` ``` unfolding vector_matrix_mult_def ``` lp15@68038 ` 285` ``` by (simp add: algebra_simps) ``` lp15@68043 ` 286` ``` with scaleR_vector_matrix_assoc ``` lp15@68038 ` 287` ``` show "x v* (k *\<^sub>R A) = k *\<^sub>R (x v* A)" ``` lp15@68038 ` 288` ``` by auto ``` lp15@68038 ` 289` ```qed ``` lp15@68038 ` 290` hoelzl@37489 ` 291` ak2110@68833 ` 292` ```subsection%important\Some bounds on components etc. relative to operator norm\ ``` lp15@67719 ` 293` ak2110@68833 ` 294` ```lemma%important norm_column_le_onorm: ``` lp15@67719 ` 295` ``` fixes A :: "real^'n^'m" ``` nipkow@69064 ` 296` ``` shows "norm(column i A) \ onorm((*v) A)" ``` ak2110@68833 ` 297` ```proof%unimportant - ``` lp15@67719 ` 298` ``` have "norm (\ j. A \$ j \$ i) \ norm (A *v axis i 1)" ``` lp15@67719 ` 299` ``` by (simp add: matrix_mult_dot cart_eq_inner_axis) ``` nipkow@69064 ` 300` ``` also have "\ \ onorm ((*v) A)" ``` immler@68072 ` 301` ``` using onorm [OF matrix_vector_mul_bounded_linear, of A "axis i 1"] by auto ``` nipkow@69064 ` 302` ``` finally have "norm (\ j. A \$ j \$ i) \ onorm ((*v) A)" . ``` lp15@67719 ` 303` ``` then show ?thesis ``` lp15@67719 ` 304` ``` unfolding column_def . ``` lp15@67719 ` 305` ```qed ``` lp15@67719 ` 306` ak2110@68833 ` 307` ```lemma%important matrix_component_le_onorm: ``` lp15@67719 ` 308` ``` fixes A :: "real^'n^'m" ``` nipkow@69064 ` 309` ``` shows "\A \$ i \$ j\ \ onorm((*v) A)" ``` ak2110@68833 ` 310` ```proof%unimportant - ``` lp15@67719 ` 311` ``` have "\A \$ i \$ j\ \ norm (\ n. (A \$ n \$ j))" ``` lp15@67719 ` 312` ``` by (metis (full_types, lifting) component_le_norm_cart vec_lambda_beta) ``` nipkow@69064 ` 313` ``` also have "\ \ onorm ((*v) A)" ``` lp15@67719 ` 314` ``` by (metis (no_types) column_def norm_column_le_onorm) ``` lp15@67719 ` 315` ``` finally show ?thesis . ``` lp15@67719 ` 316` ```qed ``` lp15@67719 ` 317` ak2110@68833 ` 318` ```lemma%unimportant component_le_onorm: ``` lp15@67719 ` 319` ``` fixes f :: "real^'m \ real^'n" ``` lp15@67719 ` 320` ``` shows "linear f \ \matrix f \$ i \$ j\ \ onorm f" ``` immler@68072 ` 321` ``` by (metis linear_matrix_vector_mul_eq matrix_component_le_onorm matrix_vector_mul) ``` hoelzl@37489 ` 322` ak2110@68833 ` 323` ```lemma%important onorm_le_matrix_component_sum: ``` lp15@67719 ` 324` ``` fixes A :: "real^'n^'m" ``` nipkow@69064 ` 325` ``` shows "onorm((*v) A) \ (\i\UNIV. \j\UNIV. \A \$ i \$ j\)" ``` ak2110@68833 ` 326` ```proof%unimportant (rule onorm_le) ``` lp15@67719 ` 327` ``` fix x ``` lp15@67719 ` 328` ``` have "norm (A *v x) \ (\i\UNIV. \(A *v x) \$ i\)" ``` lp15@67719 ` 329` ``` by (rule norm_le_l1_cart) ``` lp15@67719 ` 330` ``` also have "\ \ (\i\UNIV. \j\UNIV. \A \$ i \$ j\ * norm x)" ``` lp15@67719 ` 331` ``` proof (rule sum_mono) ``` lp15@67719 ` 332` ``` fix i ``` lp15@67719 ` 333` ``` have "\(A *v x) \$ i\ \ \\j\UNIV. A \$ i \$ j * x \$ j\" ``` lp15@67719 ` 334` ``` by (simp add: matrix_vector_mult_def) ``` lp15@67719 ` 335` ``` also have "\ \ (\j\UNIV. \A \$ i \$ j * x \$ j\)" ``` lp15@67719 ` 336` ``` by (rule sum_abs) ``` lp15@67719 ` 337` ``` also have "\ \ (\j\UNIV. \A \$ i \$ j\ * norm x)" ``` lp15@67719 ` 338` ``` by (rule sum_mono) (simp add: abs_mult component_le_norm_cart mult_left_mono) ``` lp15@67719 ` 339` ``` finally show "\(A *v x) \$ i\ \ (\j\UNIV. \A \$ i \$ j\ * norm x)" . ``` lp15@67719 ` 340` ``` qed ``` lp15@67719 ` 341` ``` finally show "norm (A *v x) \ (\i\UNIV. \j\UNIV. \A \$ i \$ j\) * norm x" ``` lp15@67719 ` 342` ``` by (simp add: sum_distrib_right) ``` lp15@67719 ` 343` ```qed ``` lp15@67719 ` 344` ak2110@68833 ` 345` ```lemma%important onorm_le_matrix_component: ``` lp15@67719 ` 346` ``` fixes A :: "real^'n^'m" ``` lp15@67719 ` 347` ``` assumes "\i j. abs(A\$i\$j) \ B" ``` nipkow@69064 ` 348` ``` shows "onorm((*v) A) \ real (CARD('m)) * real (CARD('n)) * B" ``` ak2110@68833 ` 349` ```proof%unimportant (rule onorm_le) ``` wenzelm@67731 ` 350` ``` fix x :: "real^'n::_" ``` lp15@67719 ` 351` ``` have "norm (A *v x) \ (\i\UNIV. \(A *v x) \$ i\)" ``` lp15@67719 ` 352` ``` by (rule norm_le_l1_cart) ``` lp15@67719 ` 353` ``` also have "\ \ (\i::'m \UNIV. real (CARD('n)) * B * norm x)" ``` lp15@67719 ` 354` ``` proof (rule sum_mono) ``` lp15@67719 ` 355` ``` fix i ``` lp15@67719 ` 356` ``` have "\(A *v x) \$ i\ \ norm(A \$ i) * norm x" ``` lp15@67719 ` 357` ``` by (simp add: matrix_mult_dot Cauchy_Schwarz_ineq2) ``` lp15@67719 ` 358` ``` also have "\ \ (\j\UNIV. \A \$ i \$ j\) * norm x" ``` lp15@67719 ` 359` ``` by (simp add: mult_right_mono norm_le_l1_cart) ``` lp15@67719 ` 360` ``` also have "\ \ real (CARD('n)) * B * norm x" ``` lp15@67719 ` 361` ``` by (simp add: assms sum_bounded_above mult_right_mono) ``` lp15@67719 ` 362` ``` finally show "\(A *v x) \$ i\ \ real (CARD('n)) * B * norm x" . ``` lp15@67719 ` 363` ``` qed ``` lp15@67719 ` 364` ``` also have "\ \ CARD('m) * real (CARD('n)) * B * norm x" ``` lp15@67719 ` 365` ``` by simp ``` lp15@67719 ` 366` ``` finally show "norm (A *v x) \ CARD('m) * real (CARD('n)) * B * norm x" . ``` lp15@67719 ` 367` ```qed ``` lp15@67719 ` 368` ak2110@68833 ` 369` ```subsection%important \lambda skolemization on cartesian products\ ``` hoelzl@37489 ` 370` ak2110@68833 ` 371` ```lemma%important lambda_skolem: "(\i. \x. P i x) \ ``` hoelzl@37494 ` 372` ``` (\x::'a ^ 'n. \i. P i (x \$ i))" (is "?lhs \ ?rhs") ``` ak2110@68833 ` 373` ```proof%unimportant - ``` hoelzl@37489 ` 374` ``` let ?S = "(UNIV :: 'n set)" ``` wenzelm@49644 ` 375` ``` { assume H: "?rhs" ``` wenzelm@49644 ` 376` ``` then have ?lhs by auto } ``` hoelzl@37489 ` 377` ``` moreover ``` wenzelm@49644 ` 378` ``` { assume H: "?lhs" ``` hoelzl@37489 ` 379` ``` then obtain f where f:"\i. P i (f i)" unfolding choice_iff by metis ``` hoelzl@37489 ` 380` ``` let ?x = "(\ i. (f i)) :: 'a ^ 'n" ``` wenzelm@49644 ` 381` ``` { fix i ``` hoelzl@37489 ` 382` ``` from f have "P i (f i)" by metis ``` hoelzl@37494 ` 383` ``` then have "P i (?x \$ i)" by auto ``` hoelzl@37489 ` 384` ``` } ``` hoelzl@37489 ` 385` ``` hence "\i. P i (?x\$i)" by metis ``` hoelzl@37489 ` 386` ``` hence ?rhs by metis } ``` hoelzl@37489 ` 387` ``` ultimately show ?thesis by metis ``` hoelzl@37489 ` 388` ```qed ``` hoelzl@37489 ` 389` ak2110@68833 ` 390` ```lemma%unimportant rational_approximation: ``` lp15@67719 ` 391` ``` assumes "e > 0" ``` lp15@67719 ` 392` ``` obtains r::real where "r \ \" "\r - x\ < e" ``` lp15@67719 ` 393` ``` using Rats_dense_in_real [of "x - e/2" "x + e/2"] assms by auto ``` lp15@67719 ` 394` ak2110@68833 ` 395` ```lemma%important matrix_rational_approximation: ``` lp15@67719 ` 396` ``` fixes A :: "real^'n^'m" ``` lp15@67719 ` 397` ``` assumes "e > 0" ``` lp15@67719 ` 398` ``` obtains B where "\i j. B\$i\$j \ \" "onorm(\x. (A - B) *v x) < e" ``` ak2110@68833 ` 399` ```proof%unimportant - ``` lp15@67719 ` 400` ``` have "\i j. \q \ \. \q - A \$ i \$ j\ < e / (2 * CARD('m) * CARD('n))" ``` lp15@67719 ` 401` ``` using assms by (force intro: rational_approximation [of "e / (2 * CARD('m) * CARD('n))"]) ``` lp15@67719 ` 402` ``` then obtain B where B: "\i j. B\$i\$j \ \" and Bclo: "\i j. \B\$i\$j - A \$ i \$ j\ < e / (2 * CARD('m) * CARD('n))" ``` lp15@67719 ` 403` ``` by (auto simp: lambda_skolem Bex_def) ``` lp15@67719 ` 404` ``` show ?thesis ``` lp15@67719 ` 405` ``` proof ``` nipkow@69064 ` 406` ``` have "onorm ((*v) (A - B)) \ real CARD('m) * real CARD('n) * ``` lp15@67719 ` 407` ``` (e / (2 * real CARD('m) * real CARD('n)))" ``` lp15@67719 ` 408` ``` apply (rule onorm_le_matrix_component) ``` lp15@67719 ` 409` ``` using Bclo by (simp add: abs_minus_commute less_imp_le) ``` lp15@67719 ` 410` ``` also have "\ < e" ``` lp15@67719 ` 411` ``` using \0 < e\ by (simp add: divide_simps) ``` nipkow@69064 ` 412` ``` finally show "onorm ((*v) (A - B)) < e" . ``` lp15@67719 ` 413` ``` qed (use B in auto) ``` lp15@67719 ` 414` ```qed ``` lp15@67719 ` 415` ak2110@68833 ` 416` ```lemma%unimportant vector_sub_project_orthogonal_cart: "(b::real^'n) \ (x - ((b \ x) / (b \ b)) *s b) = 0" ``` hoelzl@50526 ` 417` ``` unfolding inner_simps scalar_mult_eq_scaleR by auto ``` hoelzl@37489 ` 418` immler@68072 ` 419` wenzelm@60420 ` 420` ```text \The same result in terms of square matrices.\ ``` hoelzl@37489 ` 421` lp15@68041 ` 422` wenzelm@60420 ` 423` ```text \Considering an n-element vector as an n-by-1 or 1-by-n matrix.\ ``` hoelzl@37489 ` 424` ak2110@68833 ` 425` ```definition%unimportant "rowvector v = (\ i j. (v\$j))" ``` hoelzl@37489 ` 426` ak2110@68833 ` 427` ```definition%unimportant "columnvector v = (\ i j. (v\$i))" ``` hoelzl@37489 ` 428` ak2110@68833 ` 429` ```lemma%unimportant transpose_columnvector: "transpose(columnvector v) = rowvector v" ``` huffman@44136 ` 430` ``` by (simp add: transpose_def rowvector_def columnvector_def vec_eq_iff) ``` hoelzl@37489 ` 431` ak2110@68833 ` 432` ```lemma%unimportant transpose_rowvector: "transpose(rowvector v) = columnvector v" ``` huffman@44136 ` 433` ``` by (simp add: transpose_def columnvector_def rowvector_def vec_eq_iff) ``` hoelzl@37489 ` 434` ak2110@68833 ` 435` ```lemma%unimportant dot_rowvector_columnvector: "columnvector (A *v v) = A ** columnvector v" ``` hoelzl@37489 ` 436` ``` by (vector columnvector_def matrix_matrix_mult_def matrix_vector_mult_def) ``` hoelzl@37489 ` 437` ak2110@68833 ` 438` ```lemma%unimportant dot_matrix_product: ``` wenzelm@49644 ` 439` ``` "(x::real^'n) \ y = (((rowvector x ::real^'n^1) ** (columnvector y :: real^1^'n))\$1)\$1" ``` huffman@44136 ` 440` ``` by (vector matrix_matrix_mult_def rowvector_def columnvector_def inner_vec_def) ``` hoelzl@37489 ` 441` ak2110@68833 ` 442` ```lemma%unimportant dot_matrix_vector_mul: ``` hoelzl@37489 ` 443` ``` fixes A B :: "real ^'n ^'n" and x y :: "real ^'n" ``` hoelzl@37489 ` 444` ``` shows "(A *v x) \ (B *v y) = ``` hoelzl@37489 ` 445` ``` (((rowvector x :: real^'n^1) ** ((transpose A ** B) ** (columnvector y :: real ^1^'n)))\$1)\$1" ``` wenzelm@49644 ` 446` ``` unfolding dot_matrix_product transpose_columnvector[symmetric] ``` wenzelm@49644 ` 447` ``` dot_rowvector_columnvector matrix_transpose_mul matrix_mul_assoc .. ``` hoelzl@37489 ` 448` ak2110@68833 ` 449` ```lemma%unimportant infnorm_cart:"infnorm (x::real^'n) = Sup {\x\$i\ |i. i\UNIV}" ``` hoelzl@50526 ` 450` ``` by (simp add: infnorm_def inner_axis Basis_vec_def) (metis (lifting) inner_axis real_inner_1_right) ``` hoelzl@37489 ` 451` ak2110@68833 ` 452` ```lemma%unimportant component_le_infnorm_cart: "\x\$i\ \ infnorm (x::real^'n)" ``` hoelzl@50526 ` 453` ``` using Basis_le_infnorm[of "axis i 1" x] ``` hoelzl@50526 ` 454` ``` by (simp add: Basis_vec_def axis_eq_axis inner_axis) ``` hoelzl@37489 ` 455` ak2110@68833 ` 456` ```lemma%unimportant continuous_component[continuous_intros]: "continuous F f \ continuous F (\x. f x \$ i)" ``` huffman@44647 ` 457` ``` unfolding continuous_def by (rule tendsto_vec_nth) ``` huffman@44213 ` 458` ak2110@68833 ` 459` ```lemma%unimportant continuous_on_component[continuous_intros]: "continuous_on s f \ continuous_on s (\x. f x \$ i)" ``` huffman@44647 ` 460` ``` unfolding continuous_on_def by (fast intro: tendsto_vec_nth) ``` huffman@44213 ` 461` ak2110@68833 ` 462` ```lemma%unimportant continuous_on_vec_lambda[continuous_intros]: ``` hoelzl@63334 ` 463` ``` "(\i. continuous_on S (f i)) \ continuous_on S (\x. \ i. f i x)" ``` hoelzl@63334 ` 464` ``` unfolding continuous_on_def by (auto intro: tendsto_vec_lambda) ``` hoelzl@63334 ` 465` ak2110@68833 ` 466` ```lemma%unimportant closed_positive_orthant: "closed {x::real^'n. \i. 0 \x\$i}" ``` hoelzl@63332 ` 467` ``` by (simp add: Collect_all_eq closed_INT closed_Collect_le continuous_on_const continuous_on_id continuous_on_component) ``` huffman@44213 ` 468` ak2110@68833 ` 469` ```lemma%unimportant bounded_component_cart: "bounded s \ bounded ((\x. x \$ i) ` s)" ``` wenzelm@49644 ` 470` ``` unfolding bounded_def ``` wenzelm@49644 ` 471` ``` apply clarify ``` wenzelm@49644 ` 472` ``` apply (rule_tac x="x \$ i" in exI) ``` wenzelm@49644 ` 473` ``` apply (rule_tac x="e" in exI) ``` wenzelm@49644 ` 474` ``` apply clarify ``` wenzelm@49644 ` 475` ``` apply (rule order_trans [OF dist_vec_nth_le], simp) ``` wenzelm@49644 ` 476` ``` done ``` hoelzl@37489 ` 477` ak2110@68833 ` 478` ```lemma%important compact_lemma_cart: ``` hoelzl@37489 ` 479` ``` fixes f :: "nat \ 'a::heine_borel ^ 'n" ``` hoelzl@50998 ` 480` ``` assumes f: "bounded (range f)" ``` eberlm@66447 ` 481` ``` shows "\l r. strict_mono r \ ``` hoelzl@37489 ` 482` ``` (\e>0. eventually (\n. \i\d. dist (f (r n) \$ i) (l \$ i) < e) sequentially)" ``` immler@62127 ` 483` ``` (is "?th d") ``` ak2110@68833 ` 484` ```proof%unimportant - ``` immler@62127 ` 485` ``` have "\d' \ d. ?th d'" ``` immler@62127 ` 486` ``` by (rule compact_lemma_general[where unproj=vec_lambda]) ``` immler@62127 ` 487` ``` (auto intro!: f bounded_component_cart simp: vec_lambda_eta) ``` immler@62127 ` 488` ``` then show "?th d" by simp ``` hoelzl@37489 ` 489` ```qed ``` hoelzl@37489 ` 490` huffman@44136 ` 491` ```instance vec :: (heine_borel, finite) heine_borel ``` hoelzl@37489 ` 492` ```proof ``` hoelzl@50998 ` 493` ``` fix f :: "nat \ 'a ^ 'b" ``` hoelzl@50998 ` 494` ``` assume f: "bounded (range f)" ``` eberlm@66447 ` 495` ``` then obtain l r where r: "strict_mono r" ``` wenzelm@49644 ` 496` ``` and l: "\e>0. eventually (\n. \i\UNIV. dist (f (r n) \$ i) (l \$ i) < e) sequentially" ``` hoelzl@50998 ` 497` ``` using compact_lemma_cart [OF f] by blast ``` hoelzl@37489 ` 498` ``` let ?d = "UNIV::'b set" ``` hoelzl@37489 ` 499` ``` { fix e::real assume "e>0" ``` hoelzl@37489 ` 500` ``` hence "0 < e / (real_of_nat (card ?d))" ``` wenzelm@49644 ` 501` ``` using zero_less_card_finite divide_pos_pos[of e, of "real_of_nat (card ?d)"] by auto ``` hoelzl@37489 ` 502` ``` with l have "eventually (\n. \i. dist (f (r n) \$ i) (l \$ i) < e / (real_of_nat (card ?d))) sequentially" ``` hoelzl@37489 ` 503` ``` by simp ``` hoelzl@37489 ` 504` ``` moreover ``` wenzelm@49644 ` 505` ``` { fix n ``` wenzelm@49644 ` 506` ``` assume n: "\i. dist (f (r n) \$ i) (l \$ i) < e / (real_of_nat (card ?d))" ``` hoelzl@37489 ` 507` ``` have "dist (f (r n)) l \ (\i\?d. dist (f (r n) \$ i) (l \$ i))" ``` nipkow@67155 ` 508` ``` unfolding dist_vec_def using zero_le_dist by (rule L2_set_le_sum) ``` hoelzl@37489 ` 509` ``` also have "\ < (\i\?d. e / (real_of_nat (card ?d)))" ``` nipkow@64267 ` 510` ``` by (rule sum_strict_mono) (simp_all add: n) ``` hoelzl@37489 ` 511` ``` finally have "dist (f (r n)) l < e" by simp ``` hoelzl@37489 ` 512` ``` } ``` hoelzl@37489 ` 513` ``` ultimately have "eventually (\n. dist (f (r n)) l < e) sequentially" ``` lp15@61810 ` 514` ``` by (rule eventually_mono) ``` hoelzl@37489 ` 515` ``` } ``` wenzelm@61973 ` 516` ``` hence "((f \ r) \ l) sequentially" unfolding o_def tendsto_iff by simp ``` eberlm@66447 ` 517` ``` with r show "\l r. strict_mono r \ ((f \ r) \ l) sequentially" by auto ``` hoelzl@37489 ` 518` ```qed ``` hoelzl@37489 ` 519` ak2110@68833 ` 520` ```lemma%unimportant interval_cart: ``` immler@54775 ` 521` ``` fixes a :: "real^'n" ``` immler@54775 ` 522` ``` shows "box a b = {x::real^'n. \i. a\$i < x\$i \ x\$i < b\$i}" ``` immler@56188 ` 523` ``` and "cbox a b = {x::real^'n. \i. a\$i \ x\$i \ x\$i \ b\$i}" ``` immler@56188 ` 524` ``` by (auto simp add: set_eq_iff less_vec_def less_eq_vec_def mem_box Basis_vec_def inner_axis) ``` hoelzl@37489 ` 525` ak2110@68833 ` 526` ```lemma%unimportant mem_box_cart: ``` immler@54775 ` 527` ``` fixes a :: "real^'n" ``` immler@54775 ` 528` ``` shows "x \ box a b \ (\i. a\$i < x\$i \ x\$i < b\$i)" ``` immler@56188 ` 529` ``` and "x \ cbox a b \ (\i. a\$i \ x\$i \ x\$i \ b\$i)" ``` wenzelm@49644 ` 530` ``` using interval_cart[of a b] by (auto simp add: set_eq_iff less_vec_def less_eq_vec_def) ``` hoelzl@37489 ` 531` ak2110@68833 ` 532` ```lemma%unimportant interval_eq_empty_cart: ``` wenzelm@49644 ` 533` ``` fixes a :: "real^'n" ``` immler@54775 ` 534` ``` shows "(box a b = {} \ (\i. b\$i \ a\$i))" (is ?th1) ``` immler@56188 ` 535` ``` and "(cbox a b = {} \ (\i. b\$i < a\$i))" (is ?th2) ``` wenzelm@49644 ` 536` ```proof - ``` immler@54775 ` 537` ``` { fix i x assume as:"b\$i \ a\$i" and x:"x\box a b" ``` lp15@67673 ` 538` ``` hence "a \$ i < x \$ i \ x \$ i < b \$ i" unfolding mem_box_cart by auto ``` hoelzl@37489 ` 539` ``` hence "a\$i < b\$i" by auto ``` wenzelm@49644 ` 540` ``` hence False using as by auto } ``` hoelzl@37489 ` 541` ``` moreover ``` hoelzl@37489 ` 542` ``` { assume as:"\i. \ (b\$i \ a\$i)" ``` hoelzl@37489 ` 543` ``` let ?x = "(1/2) *\<^sub>R (a + b)" ``` hoelzl@37489 ` 544` ``` { fix i ``` hoelzl@37489 ` 545` ``` have "a\$i < b\$i" using as[THEN spec[where x=i]] by auto ``` hoelzl@37489 ` 546` ``` hence "a\$i < ((1/2) *\<^sub>R (a+b)) \$ i" "((1/2) *\<^sub>R (a+b)) \$ i < b\$i" ``` hoelzl@37489 ` 547` ``` unfolding vector_smult_component and vector_add_component ``` wenzelm@49644 ` 548` ``` by auto } ``` lp15@67673 ` 549` ``` hence "box a b \ {}" using mem_box_cart(1)[of "?x" a b] by auto } ``` hoelzl@37489 ` 550` ``` ultimately show ?th1 by blast ``` hoelzl@37489 ` 551` immler@56188 ` 552` ``` { fix i x assume as:"b\$i < a\$i" and x:"x\cbox a b" ``` lp15@67673 ` 553` ``` hence "a \$ i \ x \$ i \ x \$ i \ b \$ i" unfolding mem_box_cart by auto ``` hoelzl@37489 ` 554` ``` hence "a\$i \ b\$i" by auto ``` wenzelm@49644 ` 555` ``` hence False using as by auto } ``` hoelzl@37489 ` 556` ``` moreover ``` hoelzl@37489 ` 557` ``` { assume as:"\i. \ (b\$i < a\$i)" ``` hoelzl@37489 ` 558` ``` let ?x = "(1/2) *\<^sub>R (a + b)" ``` hoelzl@37489 ` 559` ``` { fix i ``` hoelzl@37489 ` 560` ``` have "a\$i \ b\$i" using as[THEN spec[where x=i]] by auto ``` hoelzl@37489 ` 561` ``` hence "a\$i \ ((1/2) *\<^sub>R (a+b)) \$ i" "((1/2) *\<^sub>R (a+b)) \$ i \ b\$i" ``` hoelzl@37489 ` 562` ``` unfolding vector_smult_component and vector_add_component ``` wenzelm@49644 ` 563` ``` by auto } ``` lp15@67673 ` 564` ``` hence "cbox a b \ {}" using mem_box_cart(2)[of "?x" a b] by auto } ``` hoelzl@37489 ` 565` ``` ultimately show ?th2 by blast ``` hoelzl@37489 ` 566` ```qed ``` hoelzl@37489 ` 567` ak2110@68833 ` 568` ```lemma%unimportant interval_ne_empty_cart: ``` wenzelm@49644 ` 569` ``` fixes a :: "real^'n" ``` immler@56188 ` 570` ``` shows "cbox a b \ {} \ (\i. a\$i \ b\$i)" ``` immler@54775 ` 571` ``` and "box a b \ {} \ (\i. a\$i < b\$i)" ``` hoelzl@37489 ` 572` ``` unfolding interval_eq_empty_cart[of a b] by (auto simp add: not_less not_le) ``` hoelzl@37489 ` 573` ``` (* BH: Why doesn't just "auto" work here? *) ``` hoelzl@37489 ` 574` ak2110@68833 ` 575` ```lemma%unimportant subset_interval_imp_cart: ``` wenzelm@49644 ` 576` ``` fixes a :: "real^'n" ``` immler@56188 ` 577` ``` shows "(\i. a\$i \ c\$i \ d\$i \ b\$i) \ cbox c d \ cbox a b" ``` immler@56188 ` 578` ``` and "(\i. a\$i < c\$i \ d\$i < b\$i) \ cbox c d \ box a b" ``` immler@56188 ` 579` ``` and "(\i. a\$i \ c\$i \ d\$i \ b\$i) \ box c d \ cbox a b" ``` immler@54775 ` 580` ``` and "(\i. a\$i \ c\$i \ d\$i \ b\$i) \ box c d \ box a b" ``` lp15@67673 ` 581` ``` unfolding subset_eq[unfolded Ball_def] unfolding mem_box_cart ``` hoelzl@37489 ` 582` ``` by (auto intro: order_trans less_le_trans le_less_trans less_imp_le) (* BH: Why doesn't just "auto" work here? *) ``` hoelzl@37489 ` 583` ak2110@68833 ` 584` ```lemma%unimportant interval_sing: ``` wenzelm@49644 ` 585` ``` fixes a :: "'a::linorder^'n" ``` wenzelm@49644 ` 586` ``` shows "{a .. a} = {a} \ {a<.. cbox a b \ (\i. c\$i \ d\$i) --> (\i. a\$i \ c\$i \ d\$i \ b\$i)" (is ?th1) ``` immler@56188 ` 593` ``` and "cbox c d \ box a b \ (\i. c\$i \ d\$i) --> (\i. a\$i < c\$i \ d\$i < b\$i)" (is ?th2) ``` immler@56188 ` 594` ``` and "box c d \ cbox a b \ (\i. c\$i < d\$i) --> (\i. a\$i \ c\$i \ d\$i \ b\$i)" (is ?th3) ``` immler@54775 ` 595` ``` and "box c d \ box a b \ (\i. c\$i < d\$i) --> (\i. a\$i \ c\$i \ d\$i \ b\$i)" (is ?th4) ``` immler@56188 ` 596` ``` using subset_box[of c d a b] by (simp_all add: Basis_vec_def inner_axis) ``` hoelzl@37489 ` 597` ak2110@68833 ` 598` ```lemma%unimportant disjoint_interval_cart: ``` wenzelm@49644 ` 599` ``` fixes a::"real^'n" ``` immler@56188 ` 600` ``` shows "cbox a b \ cbox c d = {} \ (\i. (b\$i < a\$i \ d\$i < c\$i \ b\$i < c\$i \ d\$i < a\$i))" (is ?th1) ``` immler@56188 ` 601` ``` and "cbox a b \ box c d = {} \ (\i. (b\$i < a\$i \ d\$i \ c\$i \ b\$i \ c\$i \ d\$i \ a\$i))" (is ?th2) ``` immler@56188 ` 602` ``` and "box a b \ cbox c d = {} \ (\i. (b\$i \ a\$i \ d\$i < c\$i \ b\$i \ c\$i \ d\$i \ a\$i))" (is ?th3) ``` immler@54775 ` 603` ``` and "box a b \ box c d = {} \ (\i. (b\$i \ a\$i \ d\$i \ c\$i \ b\$i \ c\$i \ d\$i \ a\$i))" (is ?th4) ``` hoelzl@50526 ` 604` ``` using disjoint_interval[of a b c d] by (simp_all add: Basis_vec_def inner_axis) ``` hoelzl@37489 ` 605` ak2110@68833 ` 606` ```lemma%unimportant Int_interval_cart: ``` immler@54775 ` 607` ``` fixes a :: "real^'n" ``` immler@56188 ` 608` ``` shows "cbox a b \ cbox c d = {(\ i. max (a\$i) (c\$i)) .. (\ i. min (b\$i) (d\$i))}" ``` lp15@63945 ` 609` ``` unfolding Int_interval ``` immler@56188 ` 610` ``` by (auto simp: mem_box less_eq_vec_def) ``` immler@56188 ` 611` ``` (auto simp: Basis_vec_def inner_axis) ``` hoelzl@37489 ` 612` ak2110@68833 ` 613` ```lemma%unimportant closed_interval_left_cart: ``` wenzelm@49644 ` 614` ``` fixes b :: "real^'n" ``` hoelzl@37489 ` 615` ``` shows "closed {x::real^'n. \i. x\$i \ b\$i}" ``` hoelzl@63332 ` 616` ``` by (simp add: Collect_all_eq closed_INT closed_Collect_le continuous_on_const continuous_on_id continuous_on_component) ``` hoelzl@37489 ` 617` ak2110@68833 ` 618` ```lemma%unimportant closed_interval_right_cart: ``` wenzelm@49644 ` 619` ``` fixes a::"real^'n" ``` hoelzl@37489 ` 620` ``` shows "closed {x::real^'n. \i. a\$i \ x\$i}" ``` hoelzl@63332 ` 621` ``` by (simp add: Collect_all_eq closed_INT closed_Collect_le continuous_on_const continuous_on_id continuous_on_component) ``` hoelzl@37489 ` 622` ak2110@68833 ` 623` ```lemma%unimportant is_interval_cart: ``` wenzelm@49644 ` 624` ``` "is_interval (s::(real^'n) set) \ ``` wenzelm@49644 ` 625` ``` (\a\s. \b\s. \x. (\i. ((a\$i \ x\$i \ x\$i \ b\$i) \ (b\$i \ x\$i \ x\$i \ a\$i))) \ x \ s)" ``` hoelzl@50526 ` 626` ``` by (simp add: is_interval_def Ball_def Basis_vec_def inner_axis imp_ex) ``` hoelzl@37489 ` 627` ak2110@68833 ` 628` ```lemma%unimportant closed_halfspace_component_le_cart: "closed {x::real^'n. x\$i \ a}" ``` hoelzl@63332 ` 629` ``` by (simp add: closed_Collect_le continuous_on_const continuous_on_id continuous_on_component) ``` hoelzl@37489 ` 630` ak2110@68833 ` 631` ```lemma%unimportant closed_halfspace_component_ge_cart: "closed {x::real^'n. x\$i \ a}" ``` hoelzl@63332 ` 632` ``` by (simp add: closed_Collect_le continuous_on_const continuous_on_id continuous_on_component) ``` hoelzl@37489 ` 633` ak2110@68833 ` 634` ```lemma%unimportant open_halfspace_component_lt_cart: "open {x::real^'n. x\$i < a}" ``` hoelzl@63332 ` 635` ``` by (simp add: open_Collect_less continuous_on_const continuous_on_id continuous_on_component) ``` wenzelm@49644 ` 636` ak2110@68833 ` 637` ```lemma%unimportant open_halfspace_component_gt_cart: "open {x::real^'n. x\$i > a}" ``` hoelzl@63332 ` 638` ``` by (simp add: open_Collect_less continuous_on_const continuous_on_id continuous_on_component) ``` hoelzl@37489 ` 639` ak2110@68833 ` 640` ```lemma%unimportant Lim_component_le_cart: ``` wenzelm@49644 ` 641` ``` fixes f :: "'a \ real^'n" ``` wenzelm@61973 ` 642` ``` assumes "(f \ l) net" "\ (trivial_limit net)" "eventually (\x. f x \$i \ b) net" ``` hoelzl@37489 ` 643` ``` shows "l\$i \ b" ``` hoelzl@50526 ` 644` ``` by (rule tendsto_le[OF assms(2) tendsto_const tendsto_vec_nth, OF assms(1, 3)]) ``` hoelzl@37489 ` 645` ak2110@68833 ` 646` ```lemma%unimportant Lim_component_ge_cart: ``` wenzelm@49644 ` 647` ``` fixes f :: "'a \ real^'n" ``` wenzelm@61973 ` 648` ``` assumes "(f \ l) net" "\ (trivial_limit net)" "eventually (\x. b \ (f x)\$i) net" ``` hoelzl@37489 ` 649` ``` shows "b \ l\$i" ``` hoelzl@50526 ` 650` ``` by (rule tendsto_le[OF assms(2) tendsto_vec_nth tendsto_const, OF assms(1, 3)]) ``` hoelzl@37489 ` 651` ak2110@68833 ` 652` ```lemma%unimportant Lim_component_eq_cart: ``` wenzelm@49644 ` 653` ``` fixes f :: "'a \ real^'n" ``` nipkow@69508 ` 654` ``` assumes net: "(f \ l) net" "\ trivial_limit net" and ev:"eventually (\x. f(x)\$i = b) net" ``` hoelzl@37489 ` 655` ``` shows "l\$i = b" ``` wenzelm@49644 ` 656` ``` using ev[unfolded order_eq_iff eventually_conj_iff] and ``` wenzelm@49644 ` 657` ``` Lim_component_ge_cart[OF net, of b i] and ``` hoelzl@37489 ` 658` ``` Lim_component_le_cart[OF net, of i b] by auto ``` hoelzl@37489 ` 659` ak2110@68833 ` 660` ```lemma%unimportant connected_ivt_component_cart: ``` wenzelm@49644 ` 661` ``` fixes x :: "real^'n" ``` wenzelm@49644 ` 662` ``` shows "connected s \ x \ s \ y \ s \ x\$k \ a \ a \ y\$k \ (\z\s. z\$k = a)" ``` hoelzl@50526 ` 663` ``` using connected_ivt_hyperplane[of s x y "axis k 1" a] ``` hoelzl@50526 ` 664` ``` by (auto simp add: inner_axis inner_commute) ``` hoelzl@37489 ` 665` ak2110@68833 ` 666` ```lemma%unimportant subspace_substandard_cart: "vec.subspace {x. (\i. P i \ x\$i = 0)}" ``` immler@68072 ` 667` ``` unfolding vec.subspace_def by auto ``` hoelzl@37489 ` 668` ak2110@68833 ` 669` ```lemma%important closed_substandard_cart: ``` huffman@44213 ` 670` ``` "closed {x::'a::real_normed_vector ^ 'n. \i. P i \ x\$i = 0}" ``` ak2110@68833 ` 671` ```proof%unimportant - ``` huffman@44213 ` 672` ``` { fix i::'n ``` huffman@44213 ` 673` ``` have "closed {x::'a ^ 'n. P i \ x\$i = 0}" ``` hoelzl@63332 ` 674` ``` by (cases "P i") (simp_all add: closed_Collect_eq continuous_on_const continuous_on_id continuous_on_component) } ``` huffman@44213 ` 675` ``` thus ?thesis ``` huffman@44213 ` 676` ``` unfolding Collect_all_eq by (simp add: closed_INT) ``` hoelzl@37489 ` 677` ```qed ``` hoelzl@37489 ` 678` ak2110@68833 ` 679` ```lemma%important dim_substandard_cart: "vec.dim {x::'a::field^'n. \i. i \ d \ x\$i = 0} = card d" ``` immler@68072 ` 680` ``` (is "vec.dim ?A = _") ``` ak2110@68833 ` 681` ```proof%unimportant (rule vec.dim_unique) ``` immler@68072 ` 682` ``` let ?B = "((\x. axis x 1) ` d)" ``` immler@68072 ` 683` ``` have subset_basis: "?B \ cart_basis" ``` immler@68072 ` 684` ``` by (auto simp: cart_basis_def) ``` immler@68072 ` 685` ``` show "?B \ ?A" ``` immler@68072 ` 686` ``` by (auto simp: axis_def) ``` immler@68072 ` 687` ``` show "vec.independent ((\x. axis x 1) ` d)" ``` immler@68072 ` 688` ``` using subset_basis ``` immler@68072 ` 689` ``` by (rule vec.independent_mono[OF vec.independent_Basis]) ``` immler@68072 ` 690` ``` have "x \ vec.span ?B" if "\i. i \ d \ x \$ i = 0" for x::"'a^'n" ``` immler@68072 ` 691` ``` proof - ``` immler@68072 ` 692` ``` have "finite ?B" ``` immler@68072 ` 693` ``` using subset_basis finite_cart_basis ``` immler@68072 ` 694` ``` by (rule finite_subset) ``` immler@68072 ` 695` ``` have "x = (\i\UNIV. x \$ i *s axis i 1)" ``` immler@68072 ` 696` ``` by (rule basis_expansion[symmetric]) ``` immler@68072 ` 697` ``` also have "\ = (\i\d. (x \$ i) *s axis i 1)" ``` immler@68072 ` 698` ``` by (rule sum.mono_neutral_cong_right) (auto simp: that) ``` immler@68072 ` 699` ``` also have "\ \ vec.span ?B" ``` immler@68072 ` 700` ``` by (simp add: vec.span_sum vec.span_clauses) ``` immler@68072 ` 701` ``` finally show "x \ vec.span ?B" . ``` immler@68072 ` 702` ``` qed ``` immler@68072 ` 703` ``` then show "?A \ vec.span ?B" by auto ``` immler@68072 ` 704` ```qed (simp add: card_image inj_on_def axis_eq_axis) ``` immler@68072 ` 705` ak2110@68833 ` 706` ```lemma%unimportant dim_subset_UNIV_cart_gen: ``` immler@68072 ` 707` ``` fixes S :: "('a::field^'n) set" ``` immler@68072 ` 708` ``` shows "vec.dim S \ CARD('n)" ``` immler@68072 ` 709` ``` by (metis vec.dim_eq_full vec.dim_subset_UNIV vec.span_UNIV vec_dim_card) ``` hoelzl@37489 ` 710` ak2110@68833 ` 711` ```lemma%unimportant dim_subset_UNIV_cart: ``` lp15@67719 ` 712` ``` fixes S :: "(real^'n) set" ``` lp15@67719 ` 713` ``` shows "dim S \ CARD('n)" ``` immler@68072 ` 714` ``` using dim_subset_UNIV_cart_gen[of S] by (simp add: dim_vec_eq) ``` lp15@67719 ` 715` ak2110@68833 ` 716` ```lemma%unimportant affinity_inverses: ``` hoelzl@37489 ` 717` ``` assumes m0: "m \ (0::'a::field)" ``` wenzelm@61736 ` 718` ``` shows "(\x. m *s x + c) \ (\x. inverse(m) *s x + (-(inverse(m) *s c))) = id" ``` wenzelm@61736 ` 719` ``` "(\x. inverse(m) *s x + (-(inverse(m) *s c))) \ (\x. m *s x + c) = id" ``` hoelzl@37489 ` 720` ``` using m0 ``` immler@68072 ` 721` ``` by (auto simp add: fun_eq_iff vector_add_ldistrib diff_conv_add_uminus simp del: add_uminus_conv_diff) ``` hoelzl@37489 ` 722` ak2110@68833 ` 723` ```lemma%important vector_affinity_eq: ``` hoelzl@37489 ` 724` ``` assumes m0: "(m::'a::field) \ 0" ``` hoelzl@37489 ` 725` ``` shows "m *s x + c = y \ x = inverse m *s y + -(inverse m *s c)" ``` ak2110@68833 ` 726` ```proof%unimportant ``` hoelzl@37489 ` 727` ``` assume h: "m *s x + c = y" ``` hoelzl@37489 ` 728` ``` hence "m *s x = y - c" by (simp add: field_simps) ``` hoelzl@37489 ` 729` ``` hence "inverse m *s (m *s x) = inverse m *s (y - c)" by simp ``` hoelzl@37489 ` 730` ``` then show "x = inverse m *s y + - (inverse m *s c)" ``` hoelzl@37489 ` 731` ``` using m0 by (simp add: vector_smult_assoc vector_ssub_ldistrib) ``` hoelzl@37489 ` 732` ```next ``` hoelzl@37489 ` 733` ``` assume h: "x = inverse m *s y + - (inverse m *s c)" ``` haftmann@54230 ` 734` ``` show "m *s x + c = y" unfolding h ``` hoelzl@37489 ` 735` ``` using m0 by (simp add: vector_smult_assoc vector_ssub_ldistrib) ``` hoelzl@37489 ` 736` ```qed ``` hoelzl@37489 ` 737` ak2110@68833 ` 738` ```lemma%unimportant vector_eq_affinity: ``` wenzelm@49644 ` 739` ``` "(m::'a::field) \ 0 ==> (y = m *s x + c \ inverse(m) *s y + -(inverse(m) *s c) = x)" ``` hoelzl@37489 ` 740` ``` using vector_affinity_eq[where m=m and x=x and y=y and c=c] ``` hoelzl@37489 ` 741` ``` by metis ``` hoelzl@37489 ` 742` ak2110@68833 ` 743` ```lemma%unimportant vector_cart: ``` hoelzl@50526 ` 744` ``` fixes f :: "real^'n \ real" ``` hoelzl@50526 ` 745` ``` shows "(\ i. f (axis i 1)) = (\i\Basis. f i *\<^sub>R i)" ``` hoelzl@50526 ` 746` ``` unfolding euclidean_eq_iff[where 'a="real^'n"] ``` hoelzl@50526 ` 747` ``` by simp (simp add: Basis_vec_def inner_axis) ``` hoelzl@63332 ` 748` ak2110@68833 ` 749` ```lemma%unimportant const_vector_cart:"((\ i. d)::real^'n) = (\i\Basis. d *\<^sub>R i)" ``` hoelzl@50526 ` 750` ``` by (rule vector_cart) ``` wenzelm@49644 ` 751` ak2110@68833 ` 752` ```subsection%important "Convex Euclidean Space" ``` hoelzl@37489 ` 753` ak2110@68833 ` 754` ```lemma%unimportant Cart_1:"(1::real^'n) = \Basis" ``` hoelzl@50526 ` 755` ``` using const_vector_cart[of 1] by (simp add: one_vec_def) ``` hoelzl@37489 ` 756` hoelzl@37489 ` 757` ```declare vector_add_ldistrib[simp] vector_ssub_ldistrib[simp] vector_smult_assoc[simp] vector_smult_rneg[simp] ``` hoelzl@37489 ` 758` ```declare vector_sadd_rdistrib[simp] vector_sub_rdistrib[simp] ``` hoelzl@37489 ` 759` ak2110@68833 ` 760` ```lemmas%unimportant vector_component_simps = vector_minus_component vector_smult_component vector_add_component less_eq_vec_def vec_lambda_beta vector_uminus_component ``` hoelzl@37489 ` 761` ak2110@68833 ` 762` ```lemma%unimportant convex_box_cart: ``` hoelzl@37489 ` 763` ``` assumes "\i. convex {x. P i x}" ``` hoelzl@37489 ` 764` ``` shows "convex {x. \i. P i (x\$i)}" ``` hoelzl@37489 ` 765` ``` using assms unfolding convex_def by auto ``` hoelzl@37489 ` 766` ak2110@68833 ` 767` ```lemma%unimportant convex_positive_orthant_cart: "convex {x::real^'n. (\i. 0 \ x\$i)}" ``` hoelzl@63334 ` 768` ``` by (rule convex_box_cart) (simp add: atLeast_def[symmetric]) ``` hoelzl@37489 ` 769` ak2110@68833 ` 770` ```lemma%unimportant unit_interval_convex_hull_cart: ``` immler@56188 ` 771` ``` "cbox (0::real^'n) 1 = convex hull {x. \i. (x\$i = 0) \ (x\$i = 1)}" ``` immler@56188 ` 772` ``` unfolding Cart_1 unit_interval_convex_hull[where 'a="real^'n"] box_real[symmetric] ``` hoelzl@50526 ` 773` ``` by (rule arg_cong[where f="\x. convex hull x"]) (simp add: Basis_vec_def inner_axis) ``` hoelzl@37489 ` 774` ak2110@68833 ` 775` ```lemma%important cube_convex_hull_cart: ``` wenzelm@49644 ` 776` ``` assumes "0 < d" ``` wenzelm@49644 ` 777` ``` obtains s::"(real^'n) set" ``` immler@56188 ` 778` ``` where "finite s" "cbox (x - (\ i. d)) (x + (\ i. d)) = convex hull s" ``` ak2110@68833 ` 779` ```proof%unimportant - ``` wenzelm@55522 ` 780` ``` from assms obtain s where "finite s" ``` nipkow@69064 ` 781` ``` and "cbox (x - sum ((*\<^sub>R) d) Basis) (x + sum ((*\<^sub>R) d) Basis) = convex hull s" ``` wenzelm@55522 ` 782` ``` by (rule cube_convex_hull) ``` wenzelm@55522 ` 783` ``` with that[of s] show thesis ``` wenzelm@55522 ` 784` ``` by (simp add: const_vector_cart) ``` hoelzl@37489 ` 785` ```qed ``` hoelzl@37489 ` 786` hoelzl@37489 ` 787` ak2110@68833 ` 788` ```subsection%important "Derivative" ``` hoelzl@37489 ` 789` ak2110@68833 ` 790` ```definition%important "jacobian f net = matrix(frechet_derivative f net)" ``` hoelzl@37489 ` 791` ak2110@68833 ` 792` ```lemma%important jacobian_works: ``` wenzelm@49644 ` 793` ``` "(f::(real^'a) \ (real^'b)) differentiable net \ ``` lp15@67986 ` 794` ``` (f has_derivative (\h. (jacobian f net) *v h)) net" (is "?lhs = ?rhs") ``` ak2110@68833 ` 795` ```proof%unimportant ``` lp15@67986 ` 796` ``` assume ?lhs then show ?rhs ``` lp15@67986 ` 797` ``` by (simp add: frechet_derivative_works has_derivative_linear jacobian_def) ``` lp15@67986 ` 798` ```next ``` lp15@67986 ` 799` ``` assume ?rhs then show ?lhs ``` lp15@67986 ` 800` ``` by (rule differentiableI) ``` lp15@67986 ` 801` ```qed ``` hoelzl@37489 ` 802` hoelzl@37489 ` 803` ak2110@68833 ` 804` ```subsection%important \Component of the differential must be zero if it exists at a local ``` nipkow@67968 ` 805` ``` maximum or minimum for that corresponding component\ ``` hoelzl@37489 ` 806` ak2110@68833 ` 807` ```lemma%important differential_zero_maxmin_cart: ``` wenzelm@49644 ` 808` ``` fixes f::"real^'a \ real^'b" ``` wenzelm@49644 ` 809` ``` assumes "0 < e" "((\y \ ball x e. (f y)\$k \ (f x)\$k) \ (\y\ball x e. (f x)\$k \ (f y)\$k))" ``` hoelzl@50526 ` 810` ``` "f differentiable (at x)" ``` hoelzl@50526 ` 811` ``` shows "jacobian f (at x) \$ k = 0" ``` hoelzl@50526 ` 812` ``` using differential_zero_maxmin_component[of "axis k 1" e x f] assms ``` hoelzl@50526 ` 813` ``` vector_cart[of "\j. frechet_derivative f (at x) j \$ k"] ``` hoelzl@50526 ` 814` ``` by (simp add: Basis_vec_def axis_eq_axis inner_axis jacobian_def matrix_def) ``` wenzelm@49644 ` 815` ak2110@68833 ` 816` ```subsection%unimportant \Lemmas for working on @{typ "real^1"}\ ``` hoelzl@37489 ` 817` hoelzl@37489 ` 818` ```lemma forall_1[simp]: "(\i::1. P i) \ P 1" ``` wenzelm@49644 ` 819` ``` by (metis (full_types) num1_eq_iff) ``` hoelzl@37489 ` 820` hoelzl@37489 ` 821` ```lemma ex_1[simp]: "(\x::1. P x) \ P 1" ``` wenzelm@49644 ` 822` ``` by auto (metis (full_types) num1_eq_iff) ``` hoelzl@37489 ` 823` hoelzl@37489 ` 824` ```lemma exhaust_2: ``` wenzelm@49644 ` 825` ``` fixes x :: 2 ``` wenzelm@49644 ` 826` ``` shows "x = 1 \ x = 2" ``` hoelzl@37489 ` 827` ```proof (induct x) ``` hoelzl@37489 ` 828` ``` case (of_int z) ``` lp15@67979 ` 829` ``` then have "0 \ z" and "z < 2" by simp_all ``` hoelzl@37489 ` 830` ``` then have "z = 0 | z = 1" by arith ``` hoelzl@37489 ` 831` ``` then show ?case by auto ``` hoelzl@37489 ` 832` ```qed ``` hoelzl@37489 ` 833` hoelzl@37489 ` 834` ```lemma forall_2: "(\i::2. P i) \ P 1 \ P 2" ``` hoelzl@37489 ` 835` ``` by (metis exhaust_2) ``` hoelzl@37489 ` 836` hoelzl@37489 ` 837` ```lemma exhaust_3: ``` wenzelm@49644 ` 838` ``` fixes x :: 3 ``` wenzelm@49644 ` 839` ``` shows "x = 1 \ x = 2 \ x = 3" ``` hoelzl@37489 ` 840` ```proof (induct x) ``` hoelzl@37489 ` 841` ``` case (of_int z) ``` lp15@67979 ` 842` ``` then have "0 \ z" and "z < 3" by simp_all ``` hoelzl@37489 ` 843` ``` then have "z = 0 \ z = 1 \ z = 2" by arith ``` hoelzl@37489 ` 844` ``` then show ?case by auto ``` hoelzl@37489 ` 845` ```qed ``` hoelzl@37489 ` 846` hoelzl@37489 ` 847` ```lemma forall_3: "(\i::3. P i) \ P 1 \ P 2 \ P 3" ``` hoelzl@37489 ` 848` ``` by (metis exhaust_3) ``` hoelzl@37489 ` 849` hoelzl@37489 ` 850` ```lemma UNIV_1 [simp]: "UNIV = {1::1}" ``` hoelzl@37489 ` 851` ``` by (auto simp add: num1_eq_iff) ``` hoelzl@37489 ` 852` hoelzl@37489 ` 853` ```lemma UNIV_2: "UNIV = {1::2, 2::2}" ``` hoelzl@37489 ` 854` ``` using exhaust_2 by auto ``` hoelzl@37489 ` 855` hoelzl@37489 ` 856` ```lemma UNIV_3: "UNIV = {1::3, 2::3, 3::3}" ``` hoelzl@37489 ` 857` ``` using exhaust_3 by auto ``` hoelzl@37489 ` 858` nipkow@64267 ` 859` ```lemma sum_1: "sum f (UNIV::1 set) = f 1" ``` hoelzl@37489 ` 860` ``` unfolding UNIV_1 by simp ``` hoelzl@37489 ` 861` nipkow@64267 ` 862` ```lemma sum_2: "sum f (UNIV::2 set) = f 1 + f 2" ``` hoelzl@37489 ` 863` ``` unfolding UNIV_2 by simp ``` hoelzl@37489 ` 864` nipkow@64267 ` 865` ```lemma sum_3: "sum f (UNIV::3 set) = f 1 + f 2 + f 3" ``` haftmann@57514 ` 866` ``` unfolding UNIV_3 by (simp add: ac_simps) ``` hoelzl@37489 ` 867` lp15@67979 ` 868` ```lemma num1_eqI: ``` lp15@67979 ` 869` ``` fixes a::num1 shows "a = b" ``` lp15@67979 ` 870` ``` by (metis (full_types) UNIV_1 UNIV_I empty_iff insert_iff) ``` lp15@67979 ` 871` lp15@67979 ` 872` ```lemma num1_eq1 [simp]: ``` lp15@67979 ` 873` ``` fixes a::num1 shows "a = 1" ``` lp15@67979 ` 874` ``` by (rule num1_eqI) ``` lp15@67979 ` 875` wenzelm@49644 ` 876` ```instantiation num1 :: cart_one ``` wenzelm@49644 ` 877` ```begin ``` wenzelm@49644 ` 878` wenzelm@49644 ` 879` ```instance ``` wenzelm@49644 ` 880` ```proof ``` hoelzl@37489 ` 881` ``` show "CARD(1) = Suc 0" by auto ``` wenzelm@49644 ` 882` ```qed ``` wenzelm@49644 ` 883` wenzelm@49644 ` 884` ```end ``` hoelzl@37489 ` 885` lp15@67979 ` 886` ```instantiation num1 :: linorder begin ``` lp15@67979 ` 887` ```definition "a < b \ Rep_num1 a < Rep_num1 b" ``` lp15@67979 ` 888` ```definition "a \ b \ Rep_num1 a \ Rep_num1 b" ``` lp15@67979 ` 889` ```instance ``` lp15@67979 ` 890` ``` by intro_classes (auto simp: less_eq_num1_def less_num1_def intro: num1_eqI) ``` lp15@67979 ` 891` ```end ``` lp15@67979 ` 892` lp15@67979 ` 893` ```instance num1 :: wellorder ``` lp15@67979 ` 894` ``` by intro_classes (auto simp: less_eq_num1_def less_num1_def) ``` lp15@67979 ` 895` ak2110@68833 ` 896` ```subsection%unimportant\The collapse of the general concepts to dimension one\ ``` hoelzl@37489 ` 897` hoelzl@37489 ` 898` ```lemma vector_one: "(x::'a ^1) = (\ i. (x\$1))" ``` huffman@44136 ` 899` ``` by (simp add: vec_eq_iff) ``` hoelzl@37489 ` 900` hoelzl@37489 ` 901` ```lemma forall_one: "(\(x::'a ^1). P x) \ (\x. P(\ i. x))" ``` hoelzl@37489 ` 902` ``` apply auto ``` hoelzl@37489 ` 903` ``` apply (erule_tac x= "x\$1" in allE) ``` hoelzl@37489 ` 904` ``` apply (simp only: vector_one[symmetric]) ``` hoelzl@37489 ` 905` ``` done ``` hoelzl@37489 ` 906` hoelzl@37489 ` 907` ```lemma norm_vector_1: "norm (x :: _^1) = norm (x\$1)" ``` huffman@44136 ` 908` ``` by (simp add: norm_vec_def) ``` hoelzl@37489 ` 909` lp15@67979 ` 910` ```lemma dist_vector_1: ``` lp15@67979 ` 911` ``` fixes x :: "'a::real_normed_vector^1" ``` lp15@67979 ` 912` ``` shows "dist x y = dist (x\$1) (y\$1)" ``` lp15@67979 ` 913` ``` by (simp add: dist_norm norm_vector_1) ``` lp15@67979 ` 914` wenzelm@61945 ` 915` ```lemma norm_real: "norm(x::real ^ 1) = \x\$1\" ``` hoelzl@37489 ` 916` ``` by (simp add: norm_vector_1) ``` hoelzl@37489 ` 917` wenzelm@61945 ` 918` ```lemma dist_real: "dist(x::real ^ 1) y = \(x\$1) - (y\$1)\" ``` hoelzl@37489 ` 919` ``` by (auto simp add: norm_real dist_norm) ``` hoelzl@37489 ` 920` ak2110@68833 ` 921` ```subsection%important\ Rank of a matrix\ ``` lp15@67986 ` 922` lp15@67986 ` 923` ```text\Equivalence of row and column rank is taken from George Mackiw's paper, Mathematics Magazine 1995, p. 285.\ ``` lp15@67986 ` 924` ak2110@68833 ` 925` ```lemma%unimportant matrix_vector_mult_in_columnspace_gen: ``` immler@68072 ` 926` ``` fixes A :: "'a::field^'n^'m" ``` immler@68072 ` 927` ``` shows "(A *v x) \ vec.span(columns A)" ``` immler@68072 ` 928` ``` apply (simp add: matrix_vector_column columns_def transpose_def column_def) ``` immler@68072 ` 929` ``` apply (intro vec.span_sum vec.span_scale) ``` immler@68072 ` 930` ``` apply (force intro: vec.span_base) ``` immler@68072 ` 931` ``` done ``` immler@68072 ` 932` ak2110@68833 ` 933` ```lemma%unimportant matrix_vector_mult_in_columnspace: ``` lp15@67986 ` 934` ``` fixes A :: "real^'n^'m" ``` lp15@67986 ` 935` ``` shows "(A *v x) \ span(columns A)" ``` immler@68072 ` 936` ``` using matrix_vector_mult_in_columnspace_gen[of A x] by (simp add: span_vec_eq) ``` lp15@67986 ` 937` ak2110@68833 ` 938` ```lemma%important orthogonal_nullspace_rowspace: ``` lp15@67986 ` 939` ``` fixes A :: "real^'n^'m" ``` lp15@67986 ` 940` ``` assumes 0: "A *v x = 0" and y: "y \ span(rows A)" ``` lp15@67986 ` 941` ``` shows "orthogonal x y" ``` lp15@68077 ` 942` ``` using y ``` ak2110@68833 ` 943` ```proof%unimportant (induction rule: span_induct) ``` lp15@68077 ` 944` ``` case base ``` lp15@68077 ` 945` ``` then show ?case ``` lp15@67986 ` 946` ``` by (simp add: subspace_orthogonal_to_vector) ``` lp15@67986 ` 947` ```next ``` lp15@68077 ` 948` ``` case (step v) ``` lp15@67986 ` 949` ``` then obtain i where "v = row i A" ``` lp15@67986 ` 950` ``` by (auto simp: rows_def) ``` lp15@68077 ` 951` ``` with 0 show ?case ``` lp15@67986 ` 952` ``` unfolding orthogonal_def inner_vec_def matrix_vector_mult_def row_def ``` lp15@67986 ` 953` ``` by (simp add: mult.commute) (metis (no_types) vec_lambda_beta zero_index) ``` lp15@67986 ` 954` ```qed ``` lp15@67986 ` 955` ak2110@68833 ` 956` ```lemma%unimportant nullspace_inter_rowspace: ``` lp15@67986 ` 957` ``` fixes A :: "real^'n^'m" ``` lp15@67986 ` 958` ``` shows "A *v x = 0 \ x \ span(rows A) \ x = 0" ``` immler@68072 ` 959` ``` using orthogonal_nullspace_rowspace orthogonal_self span_zero matrix_vector_mult_0_right ``` immler@68072 ` 960` ``` by blast ``` lp15@67986 ` 961` ak2110@68833 ` 962` ```lemma%unimportant matrix_vector_mul_injective_on_rowspace: ``` lp15@67986 ` 963` ``` fixes A :: "real^'n^'m" ``` lp15@67986 ` 964` ``` shows "\A *v x = A *v y; x \ span(rows A); y \ span(rows A)\ \ x = y" ``` lp15@67986 ` 965` ``` using nullspace_inter_rowspace [of A "x-y"] ``` immler@68072 ` 966` ``` by (metis diff_eq_diff_eq diff_self matrix_vector_mult_diff_distrib span_diff) ``` lp15@67986 ` 967` ak2110@68833 ` 968` ```definition%important rank :: "'a::field^'n^'m=>nat" ``` immler@68072 ` 969` ``` where row_rank_def_gen: "rank A \ vec.dim(rows A)" ``` immler@68072 ` 970` ak2110@68833 ` 971` ```lemma%important row_rank_def: "rank A = dim (rows A)" for A::"real^'n^'m" ``` ak2110@68833 ` 972` ``` by%unimportant (auto simp: row_rank_def_gen dim_vec_eq) ``` lp15@67986 ` 973` ak2110@68833 ` 974` ```lemma%important dim_rows_le_dim_columns: ``` lp15@67986 ` 975` ``` fixes A :: "real^'n^'m" ``` lp15@67986 ` 976` ``` shows "dim(rows A) \ dim(columns A)" ``` ak2110@68833 ` 977` ```proof%unimportant - ``` lp15@67986 ` 978` ``` have "dim (span (rows A)) \ dim (span (columns A))" ``` lp15@67986 ` 979` ``` proof - ``` lp15@67986 ` 980` ``` obtain B where "independent B" "span(rows A) \ span B" ``` lp15@67986 ` 981` ``` and B: "B \ span(rows A)""card B = dim (span(rows A))" ``` immler@68074 ` 982` ``` using basis_exists [of "span(rows A)"] by metis ``` lp15@67986 ` 983` ``` with span_subspace have eq: "span B = span(rows A)" ``` lp15@67986 ` 984` ``` by auto ``` nipkow@69064 ` 985` ``` then have inj: "inj_on ((*v) A) (span B)" ``` immler@68072 ` 986` ``` by (simp add: inj_on_def matrix_vector_mul_injective_on_rowspace) ``` nipkow@69064 ` 987` ``` then have ind: "independent ((*v) A ` B)" ``` immler@68072 ` 988` ``` by (rule linear_independent_injective_image [OF Finite_Cartesian_Product.matrix_vector_mul_linear \independent B\]) ``` nipkow@69064 ` 989` ``` have "dim (span (rows A)) \ card ((*v) A ` B)" ``` immler@68072 ` 990` ``` unfolding B(2)[symmetric] ``` immler@68072 ` 991` ``` using inj ``` immler@68072 ` 992` ``` by (auto simp: card_image inj_on_subset span_superset) ``` immler@68072 ` 993` ``` also have "\ \ dim (span (columns A))" ``` immler@68072 ` 994` ``` using _ ind ``` immler@68072 ` 995` ``` by (rule independent_card_le_dim) (auto intro!: matrix_vector_mult_in_columnspace) ``` immler@68072 ` 996` ``` finally show ?thesis . ``` lp15@67986 ` 997` ``` qed ``` lp15@67986 ` 998` ``` then show ?thesis ``` immler@68072 ` 999` ``` by (simp add: dim_span) ``` lp15@67986 ` 1000` ```qed ``` lp15@67986 ` 1001` ak2110@68833 ` 1002` ```lemma%unimportant column_rank_def: ``` lp15@67986 ` 1003` ``` fixes A :: "real^'n^'m" ``` immler@68072 ` 1004` ``` shows "rank A = dim(columns A)" ``` immler@68072 ` 1005` ``` unfolding row_rank_def ``` immler@68072 ` 1006` ``` by (metis columns_transpose dim_rows_le_dim_columns le_antisym rows_transpose) ``` lp15@67986 ` 1007` ak2110@68833 ` 1008` ```lemma%unimportant rank_transpose: ``` lp15@67986 ` 1009` ``` fixes A :: "real^'n^'m" ``` lp15@67986 ` 1010` ``` shows "rank(transpose A) = rank A" ``` immler@68072 ` 1011` ``` by (metis column_rank_def row_rank_def rows_transpose) ``` lp15@67986 ` 1012` ak2110@68833 ` 1013` ```lemma%unimportant matrix_vector_mult_basis: ``` lp15@67986 ` 1014` ``` fixes A :: "real^'n^'m" ``` lp15@67986 ` 1015` ``` shows "A *v (axis k 1) = column k A" ``` lp15@67986 ` 1016` ``` by (simp add: cart_eq_inner_axis column_def matrix_mult_dot) ``` lp15@67986 ` 1017` ak2110@68833 ` 1018` ```lemma%unimportant columns_image_basis: ``` lp15@67986 ` 1019` ``` fixes A :: "real^'n^'m" ``` nipkow@69064 ` 1020` ``` shows "columns A = (*v) A ` (range (\i. axis i 1))" ``` lp15@67986 ` 1021` ``` by (force simp: columns_def matrix_vector_mult_basis [symmetric]) ``` lp15@67986 ` 1022` ak2110@68833 ` 1023` ```lemma%important rank_dim_range: ``` lp15@67986 ` 1024` ``` fixes A :: "real^'n^'m" ``` lp15@67986 ` 1025` ``` shows "rank A = dim(range (\x. A *v x))" ``` immler@68072 ` 1026` ``` unfolding column_rank_def ``` ak2110@68833 ` 1027` ```proof%unimportant (rule span_eq_dim) ``` nipkow@69064 ` 1028` ``` have "span (columns A) \ span (range ((*v) A))" (is "?l \ ?r") ``` immler@68072 ` 1029` ``` by (simp add: columns_image_basis image_subsetI span_mono) ``` immler@68072 ` 1030` ``` then show "?l = ?r" ``` immler@68072 ` 1031` ``` by (metis (no_types, lifting) image_subset_iff matrix_vector_mult_in_columnspace ``` immler@68072 ` 1032` ``` span_eq span_span) ``` lp15@67986 ` 1033` ```qed ``` lp15@67986 ` 1034` ak2110@68833 ` 1035` ```lemma%unimportant rank_bound: ``` lp15@67986 ` 1036` ``` fixes A :: "real^'n^'m" ``` lp15@67986 ` 1037` ``` shows "rank A \ min CARD('m) (CARD('n))" ``` immler@68072 ` 1038` ``` by (metis (mono_tags, lifting) dim_subset_UNIV_cart min.bounded_iff ``` immler@68072 ` 1039` ``` column_rank_def row_rank_def) ``` lp15@67986 ` 1040` ak2110@68833 ` 1041` ```lemma%unimportant full_rank_injective: ``` lp15@67986 ` 1042` ``` fixes A :: "real^'n^'m" ``` nipkow@69064 ` 1043` ``` shows "rank A = CARD('n) \ inj ((*v) A)" ``` immler@68072 ` 1044` ``` by (simp add: matrix_left_invertible_injective [symmetric] matrix_left_invertible_span_rows row_rank_def ``` immler@68072 ` 1045` ``` dim_eq_full [symmetric] card_cart_basis vec.dimension_def) ``` lp15@67986 ` 1046` ak2110@68833 ` 1047` ```lemma%unimportant full_rank_surjective: ``` lp15@67986 ` 1048` ``` fixes A :: "real^'n^'m" ``` nipkow@69064 ` 1049` ``` shows "rank A = CARD('m) \ surj ((*v) A)" ``` lp15@67986 ` 1050` ``` by (simp add: matrix_right_invertible_surjective [symmetric] left_invertible_transpose [symmetric] ``` lp15@67986 ` 1051` ``` matrix_left_invertible_injective full_rank_injective [symmetric] rank_transpose) ``` lp15@67986 ` 1052` ak2110@68833 ` 1053` ```lemma%unimportant rank_I: "rank(mat 1::real^'n^'n) = CARD('n)" ``` lp15@67986 ` 1054` ``` by (simp add: full_rank_injective inj_on_def) ``` lp15@67986 ` 1055` ak2110@68833 ` 1056` ```lemma%unimportant less_rank_noninjective: ``` lp15@67986 ` 1057` ``` fixes A :: "real^'n^'m" ``` nipkow@69064 ` 1058` ``` shows "rank A < CARD('n) \ \ inj ((*v) A)" ``` lp15@67986 ` 1059` ```using less_le rank_bound by (auto simp: full_rank_injective [symmetric]) ``` lp15@67986 ` 1060` ak2110@68833 ` 1061` ```lemma%unimportant matrix_nonfull_linear_equations_eq: ``` lp15@67986 ` 1062` ``` fixes A :: "real^'n^'m" ``` nipkow@69508 ` 1063` ``` shows "(\x. (x \ 0) \ A *v x = 0) \ rank A \ CARD('n)" ``` lp15@67986 ` 1064` ``` by (meson matrix_left_invertible_injective full_rank_injective matrix_left_invertible_ker) ``` lp15@67986 ` 1065` ak2110@68833 ` 1066` ```lemma%unimportant rank_eq_0: "rank A = 0 \ A = 0" and rank_0 [simp]: "rank (0::real^'n^'m) = 0" ``` immler@68072 ` 1067` ``` for A :: "real^'n^'m" ``` lp15@67986 ` 1068` ``` by (auto simp: rank_dim_range matrix_eq) ``` lp15@67986 ` 1069` ak2110@68833 ` 1070` ```lemma%important rank_mul_le_right: ``` lp15@67986 ` 1071` ``` fixes A :: "real^'n^'m" and B :: "real^'p^'n" ``` lp15@67986 ` 1072` ``` shows "rank(A ** B) \ rank B" ``` ak2110@68833 ` 1073` ```proof%unimportant - ``` nipkow@69064 ` 1074` ``` have "rank(A ** B) \ dim ((*v) A ` range ((*v) B))" ``` lp15@67986 ` 1075` ``` by (auto simp: rank_dim_range image_comp o_def matrix_vector_mul_assoc) ``` lp15@67986 ` 1076` ``` also have "\ \ rank B" ``` immler@68072 ` 1077` ``` by (simp add: rank_dim_range dim_image_le) ``` lp15@67986 ` 1078` ``` finally show ?thesis . ``` lp15@67986 ` 1079` ```qed ``` lp15@67986 ` 1080` ak2110@68833 ` 1081` ```lemma%unimportant rank_mul_le_left: ``` lp15@67986 ` 1082` ``` fixes A :: "real^'n^'m" and B :: "real^'p^'n" ``` lp15@67986 ` 1083` ``` shows "rank(A ** B) \ rank A" ``` lp15@67986 ` 1084` ``` by (metis matrix_transpose_mul rank_mul_le_right rank_transpose) ``` lp15@67986 ` 1085` ak2110@68833 ` 1086` ```subsection%unimportant\Routine results connecting the types @{typ "real^1"} and @{typ real}\ ``` lp15@67981 ` 1087` lp15@67981 ` 1088` ```lemma vector_one_nth [simp]: ``` lp15@67981 ` 1089` ``` fixes x :: "'a^1" shows "vec (x \$ 1) = x" ``` lp15@67981 ` 1090` ``` by (metis vec_def vector_one) ``` lp15@67981 ` 1091` lp15@67981 ` 1092` ```lemma vec_cbox_1_eq [simp]: ``` lp15@67981 ` 1093` ``` shows "vec ` cbox u v = cbox (vec u) (vec v ::real^1)" ``` lp15@67981 ` 1094` ``` by (force simp: Basis_vec_def cart_eq_inner_axis [symmetric] mem_box) ``` lp15@67981 ` 1095` lp15@67981 ` 1096` ```lemma vec_nth_cbox_1_eq [simp]: ``` lp15@67981 ` 1097` ``` fixes u v :: "'a::euclidean_space^1" ``` lp15@67981 ` 1098` ``` shows "(\x. x \$ 1) ` cbox u v = cbox (u\$1) (v\$1)" ``` lp15@67981 ` 1099` ``` by (auto simp: Basis_vec_def cart_eq_inner_axis [symmetric] mem_box image_iff Bex_def inner_axis) (metis vec_component) ``` lp15@67981 ` 1100` lp15@67981 ` 1101` ```lemma vec_nth_1_iff_cbox [simp]: ``` lp15@67981 ` 1102` ``` fixes a b :: "'a::euclidean_space" ``` lp15@67981 ` 1103` ``` shows "(\x::'a^1. x \$ 1) ` S = cbox a b \ S = cbox (vec a) (vec b)" ``` lp15@67981 ` 1104` ``` (is "?lhs = ?rhs") ``` lp15@67981 ` 1105` ```proof ``` lp15@67981 ` 1106` ``` assume L: ?lhs show ?rhs ``` lp15@67981 ` 1107` ``` proof (intro equalityI subsetI) ``` lp15@67981 ` 1108` ``` fix x ``` lp15@67981 ` 1109` ``` assume "x \ S" ``` lp15@67981 ` 1110` ``` then have "x \$ 1 \ (\v. v \$ (1::1)) ` cbox (vec a) (vec b)" ``` lp15@67981 ` 1111` ``` using L by auto ``` lp15@67981 ` 1112` ``` then show "x \ cbox (vec a) (vec b)" ``` lp15@67981 ` 1113` ``` by (metis (no_types, lifting) imageE vector_one_nth) ``` lp15@67981 ` 1114` ``` next ``` lp15@67981 ` 1115` ``` fix x :: "'a^1" ``` lp15@67981 ` 1116` ``` assume "x \ cbox (vec a) (vec b)" ``` lp15@67981 ` 1117` ``` then show "x \ S" ``` lp15@67981 ` 1118` ``` by (metis (no_types, lifting) L imageE imageI vec_component vec_nth_cbox_1_eq vector_one_nth) ``` lp15@67981 ` 1119` ``` qed ``` lp15@67981 ` 1120` ```qed simp ``` wenzelm@49644 ` 1121` lp15@67979 ` 1122` ```lemma tendsto_at_within_vector_1: ``` lp15@67979 ` 1123` ``` fixes S :: "'a :: metric_space set" ``` lp15@67979 ` 1124` ``` assumes "(f \ fx) (at x within S)" ``` lp15@67979 ` 1125` ``` shows "((\y::'a^1. \ i. f (y \$ 1)) \ (vec fx::'a^1)) (at (vec x) within vec ` S)" ``` lp15@67979 ` 1126` ```proof (rule topological_tendstoI) ``` lp15@67979 ` 1127` ``` fix T :: "('a^1) set" ``` lp15@67979 ` 1128` ``` assume "open T" "vec fx \ T" ``` lp15@67979 ` 1129` ``` have "\\<^sub>F x in at x within S. f x \ (\x. x \$ 1) ` T" ``` lp15@67979 ` 1130` ``` using \open T\ \vec fx \ T\ assms open_image_vec_nth tendsto_def by fastforce ``` lp15@67979 ` 1131` ``` then show "\\<^sub>F x::'a^1 in at (vec x) within vec ` S. (\ i. f (x \$ 1)) \ T" ``` lp15@67979 ` 1132` ``` unfolding eventually_at dist_norm [symmetric] ``` lp15@67979 ` 1133` ``` by (rule ex_forward) ``` lp15@67979 ` 1134` ``` (use \open T\ in ``` lp15@67979 ` 1135` ``` \fastforce simp: dist_norm dist_vec_def L2_set_def image_iff vector_one open_vec_def\) ``` lp15@67979 ` 1136` ```qed ``` lp15@67979 ` 1137` lp15@67979 ` 1138` ```lemma has_derivative_vector_1: ``` lp15@67979 ` 1139` ``` assumes der_g: "(g has_derivative (\x. x * g' a)) (at a within S)" ``` nipkow@69064 ` 1140` ``` shows "((\x. vec (g (x \$ 1))) has_derivative (*\<^sub>R) (g' a)) ``` lp15@67979 ` 1141` ``` (at ((vec a)::real^1) within vec ` S)" ``` lp15@67979 ` 1142` ``` using der_g ``` lp15@67979 ` 1143` ``` apply (auto simp: Deriv.has_derivative_within bounded_linear_scaleR_right norm_vector_1) ``` lp15@67979 ` 1144` ``` apply (drule tendsto_at_within_vector_1, vector) ``` lp15@67979 ` 1145` ``` apply (auto simp: algebra_simps eventually_at tendsto_def) ``` lp15@67979 ` 1146` ``` done ``` lp15@67979 ` 1147` lp15@67979 ` 1148` ak2110@68833 ` 1149` ```subsection%unimportant\Explicit vector construction from lists\ ``` hoelzl@37489 ` 1150` hoelzl@43995 ` 1151` ```definition "vector l = (\ i. foldr (\x f n. fun_upd (f (n+1)) n x) l (\n x. 0) 1 i)" ``` hoelzl@37489 ` 1152` lp15@68054 ` 1153` ```lemma vector_1 [simp]: "(vector[x]) \$1 = x" ``` hoelzl@37489 ` 1154` ``` unfolding vector_def by simp ``` hoelzl@37489 ` 1155` lp15@68054 ` 1156` ```lemma vector_2 [simp]: "(vector[x,y]) \$1 = x" "(vector[x,y] :: 'a^2)\$2 = (y::'a::zero)" ``` hoelzl@37489 ` 1157` ``` unfolding vector_def by simp_all ``` hoelzl@37489 ` 1158` lp15@68054 ` 1159` ```lemma vector_3 [simp]: ``` hoelzl@37489 ` 1160` ``` "(vector [x,y,z] ::('a::zero)^3)\$1 = x" ``` hoelzl@37489 ` 1161` ``` "(vector [x,y,z] ::('a::zero)^3)\$2 = y" ``` hoelzl@37489 ` 1162` ``` "(vector [x,y,z] ::('a::zero)^3)\$3 = z" ``` hoelzl@37489 ` 1163` ``` unfolding vector_def by simp_all ``` hoelzl@37489 ` 1164` hoelzl@37489 ` 1165` ```lemma forall_vector_1: "(\v::'a::zero^1. P v) \ (\x. P(vector[x]))" ``` lp15@67719 ` 1166` ``` by (metis vector_1 vector_one) ``` hoelzl@37489 ` 1167` hoelzl@37489 ` 1168` ```lemma forall_vector_2: "(\v::'a::zero^2. P v) \ (\x y. P(vector[x, y]))" ``` hoelzl@37489 ` 1169` ``` apply auto ``` hoelzl@37489 ` 1170` ``` apply (erule_tac x="v\$1" in allE) ``` hoelzl@37489 ` 1171` ``` apply (erule_tac x="v\$2" in allE) ``` hoelzl@37489 ` 1172` ``` apply (subgoal_tac "vector [v\$1, v\$2] = v") ``` hoelzl@37489 ` 1173` ``` apply simp ``` hoelzl@37489 ` 1174` ``` apply (vector vector_def) ``` hoelzl@37489 ` 1175` ``` apply (simp add: forall_2) ``` hoelzl@37489 ` 1176` ``` done ``` hoelzl@37489 ` 1177` hoelzl@37489 ` 1178` ```lemma forall_vector_3: "(\v::'a::zero^3. P v) \ (\x y z. P(vector[x, y, z]))" ``` hoelzl@37489 ` 1179` ``` apply auto ``` hoelzl@37489 ` 1180` ``` apply (erule_tac x="v\$1" in allE) ``` hoelzl@37489 ` 1181` ``` apply (erule_tac x="v\$2" in allE) ``` hoelzl@37489 ` 1182` ``` apply (erule_tac x="v\$3" in allE) ``` hoelzl@37489 ` 1183` ``` apply (subgoal_tac "vector [v\$1, v\$2, v\$3] = v") ``` hoelzl@37489 ` 1184` ``` apply simp ``` hoelzl@37489 ` 1185` ``` apply (vector vector_def) ``` hoelzl@37489 ` 1186` ``` apply (simp add: forall_3) ``` hoelzl@37489 ` 1187` ``` done ``` hoelzl@37489 ` 1188` hoelzl@37489 ` 1189` ```lemma bounded_linear_component_cart[intro]: "bounded_linear (\x::real^'n. x \$ k)" ``` lp15@68062 ` 1190` ``` apply (rule bounded_linear_intro[where K=1]) ``` hoelzl@37489 ` 1191` ``` using component_le_norm_cart[of _ k] unfolding real_norm_def by auto ``` hoelzl@37489 ` 1192` hoelzl@37489 ` 1193` ```lemma interval_split_cart: ``` hoelzl@37489 ` 1194` ``` "{a..b::real^'n} \ {x. x\$k \ c} = {a .. (\ i. if i = k then min (b\$k) c else b\$i)}" ``` immler@56188 ` 1195` ``` "cbox a b \ {x. x\$k \ c} = {(\ i. if i = k then max (a\$k) c else a\$i) .. b}" ``` wenzelm@49644 ` 1196` ``` apply (rule_tac[!] set_eqI) ``` lp15@67673 ` 1197` ``` unfolding Int_iff mem_box_cart mem_Collect_eq interval_cbox_cart ``` wenzelm@49644 ` 1198` ``` unfolding vec_lambda_beta ``` wenzelm@49644 ` 1199` ``` by auto ``` hoelzl@37489 ` 1200` immler@67685 ` 1201` ```lemmas cartesian_euclidean_space_uniform_limit_intros[uniform_limit_intros] = ``` immler@67685 ` 1202` ``` bounded_linear.uniform_limit[OF blinfun.bounded_linear_right] ``` immler@67685 ` 1203` ``` bounded_linear.uniform_limit[OF bounded_linear_vec_nth] ``` immler@67685 ` 1204` ``` bounded_linear.uniform_limit[OF bounded_linear_component_cart] ``` immler@67685 ` 1205` hoelzl@37489 ` 1206` ```end ```