src/HOL/Analysis/Cartesian_Euclidean_Space.thy
changeset 67968 a5ad4c015d1c
parent 67962 0acdcd8f4ba1
child 67971 e9f66b35d636
equal deleted inserted replaced
67967:5a4280946a25 67968:a5ad4c015d1c
     1 section \<open>Instantiates the finite Cartesian product of Euclidean spaces as a Euclidean space.\<close>
     1 section \<open>Instantiates the finite Cartesian product of Euclidean spaces as a Euclidean space\<close>
     2 
     2 
     3 theory Cartesian_Euclidean_Space
     3 theory Cartesian_Euclidean_Space
     4 imports Finite_Cartesian_Product Derivative
     4 imports Finite_Cartesian_Product Derivative
     5 begin
     5 begin
     6 
     6 
    19     then show "j \<in> (\<lambda>j. j + i * B) ` {..<B}"
    19     then show "j \<in> (\<lambda>j. j + i * B) ` {..<B}"
    20       by (auto intro!: image_eqI[of _ _ "j - i * B"])
    20       by (auto intro!: image_eqI[of _ _ "j - i * B"])
    21   qed simp
    21   qed simp
    22 qed simp
    22 qed simp
    23 
    23 
    24 subsection\<open>Basic componentwise operations on vectors.\<close>
    24 subsection\<open>Basic componentwise operations on vectors\<close>
    25 
    25 
    26 instantiation vec :: (times, finite) times
    26 instantiation vec :: (times, finite) times
    27 begin
    27 begin
    28 
    28 
    29 definition "( * ) \<equiv> (\<lambda> x y.  (\<chi> i. (x$i) * (y$i)))"
    29 definition "( * ) \<equiv> (\<lambda> x y.  (\<chi> i. (x$i) * (y$i)))"
    91 
    91 
    92 definition vector_scalar_mult:: "'a::times \<Rightarrow> 'a ^ 'n \<Rightarrow> 'a ^ 'n" (infixl "*s" 70)
    92 definition vector_scalar_mult:: "'a::times \<Rightarrow> 'a ^ 'n \<Rightarrow> 'a ^ 'n" (infixl "*s" 70)
    93   where "c *s x = (\<chi> i. c * (x$i))"
    93   where "c *s x = (\<chi> i. c * (x$i))"
    94 
    94 
    95 
    95 
    96 subsection \<open>A naive proof procedure to lift really trivial arithmetic stuff from the basis of the vector space.\<close>
    96 subsection \<open>A naive proof procedure to lift really trivial arithmetic stuff from the basis of the vector space\<close>
    97 
    97 
    98 lemma sum_cong_aux:
    98 lemma sum_cong_aux:
    99   "(\<And>x. x \<in> A \<Longrightarrow> f x = g x) \<Longrightarrow> sum f A = sum g A"
    99   "(\<And>x. x \<in> A \<Longrightarrow> f x = g x) \<Longrightarrow> sum f A = sum g A"
   100   by (auto intro: sum.cong)
   100   by (auto intro: sum.cong)
   101 
   101 
   168   vec_component vector_add_component vector_mult_component
   168   vec_component vector_add_component vector_mult_component
   169   vector_smult_component vector_minus_component vector_uminus_component
   169   vector_smult_component vector_minus_component vector_uminus_component
   170   vector_scaleR_component cond_component
   170   vector_scaleR_component cond_component
   171 
   171 
   172 
   172 
   173 subsection \<open>Some frequently useful arithmetic lemmas over vectors.\<close>
   173 subsection \<open>Some frequently useful arithmetic lemmas over vectors\<close>
   174 
   174 
   175 instance vec :: (semigroup_mult, finite) semigroup_mult
   175 instance vec :: (semigroup_mult, finite) semigroup_mult
   176   by standard (vector mult.assoc)
   176   by standard (vector mult.assoc)
   177 
   177 
   178 instance vec :: (monoid_mult, finite) monoid_mult
   178 instance vec :: (monoid_mult, finite) monoid_mult
   717   unfolding adjoint_matrix matrix_of_matrix_vector_mul
   717   unfolding adjoint_matrix matrix_of_matrix_vector_mul
   718   apply rule
   718   apply rule
   719   done
   719   done
   720 
   720 
   721 
   721 
   722 subsection\<open>Some bounds on components etc. relative to operator norm.\<close>
   722 subsection\<open>Some bounds on components etc. relative to operator norm\<close>
   723 
   723 
   724 lemma norm_column_le_onorm:
   724 lemma norm_column_le_onorm:
   725   fixes A :: "real^'n^'m"
   725   fixes A :: "real^'n^'m"
   726   shows "norm(column i A) \<le> onorm(( *v) A)"
   726   shows "norm(column i A) \<le> onorm(( *v) A)"
   727 proof -
   727 proof -
  1414   apply assumption
  1414   apply assumption
  1415   done
  1415   done
  1416 
  1416 
  1417 
  1417 
  1418 subsection \<open>Component of the differential must be zero if it exists at a local
  1418 subsection \<open>Component of the differential must be zero if it exists at a local
  1419   maximum or minimum for that corresponding component.\<close>
  1419   maximum or minimum for that corresponding component\<close>
  1420 
  1420 
  1421 lemma differential_zero_maxmin_cart:
  1421 lemma differential_zero_maxmin_cart:
  1422   fixes f::"real^'a \<Rightarrow> real^'b"
  1422   fixes f::"real^'a \<Rightarrow> real^'b"
  1423   assumes "0 < e" "((\<forall>y \<in> ball x e. (f y)$k \<le> (f x)$k) \<or> (\<forall>y\<in>ball x e. (f x)$k \<le> (f y)$k))"
  1423   assumes "0 < e" "((\<forall>y \<in> ball x e. (f y)$k \<le> (f x)$k) \<or> (\<forall>y\<in>ball x e. (f x)$k \<le> (f y)$k))"
  1424     "f differentiable (at x)"
  1424     "f differentiable (at x)"
  1487   show "CARD(1) = Suc 0" by auto
  1487   show "CARD(1) = Suc 0" by auto
  1488 qed
  1488 qed
  1489 
  1489 
  1490 end
  1490 end
  1491 
  1491 
  1492 subsection\<open>The collapse of the general concepts to dimension one.\<close>
  1492 subsection\<open>The collapse of the general concepts to dimension one\<close>
  1493 
  1493 
  1494 lemma vector_one: "(x::'a ^1) = (\<chi> i. (x$1))"
  1494 lemma vector_one: "(x::'a ^1) = (\<chi> i. (x$1))"
  1495   by (simp add: vec_eq_iff)
  1495   by (simp add: vec_eq_iff)
  1496 
  1496 
  1497 lemma forall_one: "(\<forall>(x::'a ^1). P x) \<longleftrightarrow> (\<forall>x. P(\<chi> i. x))"
  1497 lemma forall_one: "(\<forall>(x::'a ^1). P x) \<longleftrightarrow> (\<forall>x. P(\<chi> i. x))"
  1508 
  1508 
  1509 lemma dist_real: "dist(x::real ^ 1) y = \<bar>(x$1) - (y$1)\<bar>"
  1509 lemma dist_real: "dist(x::real ^ 1) y = \<bar>(x$1) - (y$1)\<bar>"
  1510   by (auto simp add: norm_real dist_norm)
  1510   by (auto simp add: norm_real dist_norm)
  1511 
  1511 
  1512 
  1512 
  1513 subsection\<open>Explicit vector construction from lists.\<close>
  1513 subsection\<open>Explicit vector construction from lists\<close>
  1514 
  1514 
  1515 definition "vector l = (\<chi> i. foldr (\<lambda>x f n. fun_upd (f (n+1)) n x) l (\<lambda>n x. 0) 1 i)"
  1515 definition "vector l = (\<chi> i. foldr (\<lambda>x f n. fun_upd (f (n+1)) n x) l (\<lambda>n x. 0) 1 i)"
  1516 
  1516 
  1517 lemma vector_1: "(vector[x]) $1 = x"
  1517 lemma vector_1: "(vector[x]) $1 = x"
  1518   unfolding vector_def by simp
  1518   unfolding vector_def by simp