src/HOL/Analysis/Cartesian_Euclidean_Space.thy
author wenzelm
Fri, 12 Apr 2019 22:09:25 +0200
changeset 70136 f03a01a18c6e
parent 70113 c8deb8ba6d05
child 70817 dd675800469d
permissions -rw-r--r--
modernized tags: default scope excludes proof;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
68038
20b713cff87a new material on matricies by Tim Makarios (from Tarskis_Geometry in the AFP)
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
     1
(* Title:      HOL/Analysis/Cartesian_Euclidean_Space.thy
68043
d345e9c35ae1 some of Jose Divasón's material from Rank_Nullity_Theorem/Miscellaneous
paulson <lp15@cam.ac.uk>
parents: 68041
diff changeset
     2
   Some material by Jose Divasón, Tim Makarios and L C Paulson
68038
20b713cff87a new material on matricies by Tim Makarios (from Tarskis_Geometry in the AFP)
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
     3
*)
20b713cff87a new material on matricies by Tim Makarios (from Tarskis_Geometry in the AFP)
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
     4
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
     5
section \<open>Finite Cartesian Products of Euclidean Spaces\<close>
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
     6
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
     7
theory Cartesian_Euclidean_Space
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67986
diff changeset
     8
imports Cartesian_Space Derivative
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
     9
begin
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
    10
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
    11
lemma subspace_special_hyperplane: "subspace {x. x $ k = 0}"
63016
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 62397
diff changeset
    12
  by (simp add: subspace_def)
3590590699b1 numerous theorems about affine hulls, hyperplanes, etc.
paulson <lp15@cam.ac.uk>
parents: 62397
diff changeset
    13
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
    14
lemma sum_mult_product:
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63945
diff changeset
    15
  "sum h {..<A * B :: nat} = (\<Sum>i\<in>{..<A}. \<Sum>j\<in>{..<B}. h (j + i * B))"
70113
c8deb8ba6d05 Fixing the main Homology theory; also moving a lot of sum/prod lemmas into their generic context
paulson <lp15@cam.ac.uk>
parents: 69723
diff changeset
    16
  unfolding sum.nat_group[of h B A, unfolded atLeast0LessThan, symmetric]
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
    17
proof (rule sum.cong, simp, rule sum.reindex_cong)
49644
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
    18
  fix i
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
    19
  show "inj_on (\<lambda>j. j + i * B) {..<B}" by (auto intro!: inj_onI)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
    20
  show "{i * B..<i * B + B} = (\<lambda>j. j + i * B) ` {..<B}"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
    21
  proof safe
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
    22
    fix j assume "j \<in> {i * B..<i * B + B}"
49644
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
    23
    then show "j \<in> (\<lambda>j. j + i * B) ` {..<B}"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
    24
      by (auto intro!: image_eqI[of _ _ "j - i * B"])
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
    25
  qed simp
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
    26
qed simp
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
    27
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
    28
lemma interval_cbox_cart: "{a::real^'n..b} = cbox a b"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 55522
diff changeset
    29
  by (auto simp add: less_eq_vec_def mem_box Basis_vec_def inner_axis)
0268784f60da use cbox to relax class constraints
immler
parents: 55522
diff changeset
    30
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
    31
lemma differentiable_vec:
67979
53323937ee25 new material about vec, real^1, etc.
paulson <lp15@cam.ac.uk>
parents: 67971
diff changeset
    32
  fixes S :: "'a::euclidean_space set"
53323937ee25 new material about vec, real^1, etc.
paulson <lp15@cam.ac.uk>
parents: 67971
diff changeset
    33
  shows "vec differentiable_on S"
53323937ee25 new material about vec, real^1, etc.
paulson <lp15@cam.ac.uk>
parents: 67971
diff changeset
    34
  by (simp add: linear_linear bounded_linear_imp_differentiable_on)
53323937ee25 new material about vec, real^1, etc.
paulson <lp15@cam.ac.uk>
parents: 67971
diff changeset
    35
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
    36
lemma continuous_vec [continuous_intros]:
67979
53323937ee25 new material about vec, real^1, etc.
paulson <lp15@cam.ac.uk>
parents: 67971
diff changeset
    37
  fixes x :: "'a::euclidean_space"
53323937ee25 new material about vec, real^1, etc.
paulson <lp15@cam.ac.uk>
parents: 67971
diff changeset
    38
  shows "isCont vec x"
53323937ee25 new material about vec, real^1, etc.
paulson <lp15@cam.ac.uk>
parents: 67971
diff changeset
    39
  apply (clarsimp simp add: continuous_def LIM_def dist_vec_def L2_set_def)
53323937ee25 new material about vec, real^1, etc.
paulson <lp15@cam.ac.uk>
parents: 67971
diff changeset
    40
  apply (rule_tac x="r / sqrt (real CARD('b))" in exI)
53323937ee25 new material about vec, real^1, etc.
paulson <lp15@cam.ac.uk>
parents: 67971
diff changeset
    41
  by (simp add: mult.commute pos_less_divide_eq real_sqrt_mult)
53323937ee25 new material about vec, real^1, etc.
paulson <lp15@cam.ac.uk>
parents: 67971
diff changeset
    42
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
    43
lemma box_vec_eq_empty [simp]:
67979
53323937ee25 new material about vec, real^1, etc.
paulson <lp15@cam.ac.uk>
parents: 67971
diff changeset
    44
  shows "cbox (vec a) (vec b) = {} \<longleftrightarrow> cbox a b = {}"
53323937ee25 new material about vec, real^1, etc.
paulson <lp15@cam.ac.uk>
parents: 67971
diff changeset
    45
        "box (vec a) (vec b) = {} \<longleftrightarrow> box a b = {}"
53323937ee25 new material about vec, real^1, etc.
paulson <lp15@cam.ac.uk>
parents: 67971
diff changeset
    46
  by (auto simp: Basis_vec_def mem_box box_eq_empty inner_axis)
53323937ee25 new material about vec, real^1, etc.
paulson <lp15@cam.ac.uk>
parents: 67971
diff changeset
    47
69683
8b3458ca0762 subsection is always %important
immler
parents: 69678
diff changeset
    48
subsection\<open>Closures and interiors of halfspaces\<close>
62397
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    49
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
    50
lemma interior_halfspace_le [simp]:
62397
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    51
  assumes "a \<noteq> 0"
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    52
    shows "interior {x. a \<bullet> x \<le> b} = {x. a \<bullet> x < b}"
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
    53
proof -
62397
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    54
  have *: "a \<bullet> x < b" if x: "x \<in> S" and S: "S \<subseteq> {x. a \<bullet> x \<le> b}" and "open S" for S x
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    55
  proof -
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    56
    obtain e where "e>0" and e: "cball x e \<subseteq> S"
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    57
      using \<open>open S\<close> open_contains_cball x by blast
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    58
    then have "x + (e / norm a) *\<^sub>R a \<in> cball x e"
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    59
      by (simp add: dist_norm)
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    60
    then have "x + (e / norm a) *\<^sub>R a \<in> S"
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    61
      using e by blast
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    62
    then have "x + (e / norm a) *\<^sub>R a \<in> {x. a \<bullet> x \<le> b}"
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    63
      using S by blast
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    64
    moreover have "e * (a \<bullet> a) / norm a > 0"
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    65
      by (simp add: \<open>0 < e\<close> assms)
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    66
    ultimately show ?thesis
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    67
      by (simp add: algebra_simps)
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    68
  qed
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    69
  show ?thesis
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    70
    by (rule interior_unique) (auto simp: open_halfspace_lt *)
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    71
qed
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    72
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
    73
lemma interior_halfspace_ge [simp]:
62397
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    74
   "a \<noteq> 0 \<Longrightarrow> interior {x. a \<bullet> x \<ge> b} = {x. a \<bullet> x > b}"
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    75
using interior_halfspace_le [of "-a" "-b"] by simp
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    76
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
    77
lemma interior_halfspace_component_le [simp]:
67731
184c293f0a33 clarified use of vec type syntax;
wenzelm
parents: 67728
diff changeset
    78
     "interior {x. x$k \<le> a} = {x :: (real^'n). x$k < a}" (is "?LE")
62397
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    79
  and interior_halfspace_component_ge [simp]:
67731
184c293f0a33 clarified use of vec type syntax;
wenzelm
parents: 67728
diff changeset
    80
     "interior {x. x$k \<ge> a} = {x :: (real^'n). x$k > a}" (is "?GE")
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
    81
proof -
62397
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    82
  have "axis k (1::real) \<noteq> 0"
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    83
    by (simp add: axis_def vec_eq_iff)
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    84
  moreover have "axis k (1::real) \<bullet> x = x$k" for x
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    85
    by (simp add: cart_eq_inner_axis inner_commute)
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    86
  ultimately show ?LE ?GE
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    87
    using interior_halfspace_le [of "axis k (1::real)" a]
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    88
          interior_halfspace_ge [of "axis k (1::real)" a] by auto
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    89
qed
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    90
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
    91
lemma closure_halfspace_lt [simp]:
62397
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    92
  assumes "a \<noteq> 0"
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    93
    shows "closure {x. a \<bullet> x < b} = {x. a \<bullet> x \<le> b}"
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    94
proof -
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    95
  have [simp]: "-{x. a \<bullet> x < b} = {x. a \<bullet> x \<ge> b}"
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    96
    by (force simp:)
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    97
  then show ?thesis
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    98
    using interior_halfspace_ge [of a b] assms
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
    99
    by (force simp: closure_interior)
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   100
qed
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   101
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   102
lemma closure_halfspace_gt [simp]:
62397
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   103
   "a \<noteq> 0 \<Longrightarrow> closure {x. a \<bullet> x > b} = {x. a \<bullet> x \<ge> b}"
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   104
using closure_halfspace_lt [of "-a" "-b"] by simp
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   105
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   106
lemma closure_halfspace_component_lt [simp]:
67731
184c293f0a33 clarified use of vec type syntax;
wenzelm
parents: 67728
diff changeset
   107
     "closure {x. x$k < a} = {x :: (real^'n). x$k \<le> a}" (is "?LE")
62397
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   108
  and closure_halfspace_component_gt [simp]:
67731
184c293f0a33 clarified use of vec type syntax;
wenzelm
parents: 67728
diff changeset
   109
     "closure {x. x$k > a} = {x :: (real^'n). x$k \<ge> a}" (is "?GE")
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   110
proof -
62397
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   111
  have "axis k (1::real) \<noteq> 0"
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   112
    by (simp add: axis_def vec_eq_iff)
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   113
  moreover have "axis k (1::real) \<bullet> x = x$k" for x
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   114
    by (simp add: cart_eq_inner_axis inner_commute)
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   115
  ultimately show ?LE ?GE
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   116
    using closure_halfspace_lt [of "axis k (1::real)" a]
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   117
          closure_halfspace_gt [of "axis k (1::real)" a] by auto
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   118
qed
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   119
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   120
lemma interior_hyperplane [simp]:
62397
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   121
  assumes "a \<noteq> 0"
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   122
    shows "interior {x. a \<bullet> x = b} = {}"
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   123
proof -
62397
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   124
  have [simp]: "{x. a \<bullet> x = b} = {x. a \<bullet> x \<le> b} \<inter> {x. a \<bullet> x \<ge> b}"
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   125
    by (force simp:)
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   126
  then show ?thesis
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   127
    by (auto simp: assms)
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   128
qed
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   129
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   130
lemma frontier_halfspace_le:
62397
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   131
  assumes "a \<noteq> 0 \<or> b \<noteq> 0"
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   132
    shows "frontier {x. a \<bullet> x \<le> b} = {x. a \<bullet> x = b}"
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   133
proof (cases "a = 0")
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   134
  case True with assms show ?thesis by simp
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   135
next
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   136
  case False then show ?thesis
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   137
    by (force simp: frontier_def closed_halfspace_le)
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   138
qed
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   139
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   140
lemma frontier_halfspace_ge:
62397
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   141
  assumes "a \<noteq> 0 \<or> b \<noteq> 0"
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   142
    shows "frontier {x. a \<bullet> x \<ge> b} = {x. a \<bullet> x = b}"
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   143
proof (cases "a = 0")
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   144
  case True with assms show ?thesis by simp
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   145
next
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   146
  case False then show ?thesis
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   147
    by (force simp: frontier_def closed_halfspace_ge)
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   148
qed
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   149
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   150
lemma frontier_halfspace_lt:
62397
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   151
  assumes "a \<noteq> 0 \<or> b \<noteq> 0"
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   152
    shows "frontier {x. a \<bullet> x < b} = {x. a \<bullet> x = b}"
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   153
proof (cases "a = 0")
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   154
  case True with assms show ?thesis by simp
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   155
next
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   156
  case False then show ?thesis
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   157
    by (force simp: frontier_def interior_open open_halfspace_lt)
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   158
qed
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   159
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   160
lemma frontier_halfspace_gt:
62397
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   161
  assumes "a \<noteq> 0 \<or> b \<noteq> 0"
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   162
    shows "frontier {x. a \<bullet> x > b} = {x. a \<bullet> x = b}"
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   163
proof (cases "a = 0")
62397
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   164
  case True with assms show ?thesis by simp
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   165
next
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   166
  case False then show ?thesis
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   167
    by (force simp: frontier_def interior_open open_halfspace_gt)
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   168
qed
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   169
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   170
lemma interior_standard_hyperplane:
67731
184c293f0a33 clarified use of vec type syntax;
wenzelm
parents: 67728
diff changeset
   171
   "interior {x :: (real^'n). x$k = a} = {}"
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   172
proof -
62397
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   173
  have "axis k (1::real) \<noteq> 0"
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   174
    by (simp add: axis_def vec_eq_iff)
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   175
  moreover have "axis k (1::real) \<bullet> x = x$k" for x
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   176
    by (simp add: cart_eq_inner_axis inner_commute)
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   177
  ultimately show ?thesis
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   178
    using interior_hyperplane [of "axis k (1::real)" a]
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   179
    by force
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   180
qed
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62127
diff changeset
   181
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   182
lemma matrix_vector_mul_bounded_linear[intro, simp]: "bounded_linear ((*v) A)" for A :: "'a::{euclidean_space,real_algebra_1}^'n^'m"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67986
diff changeset
   183
  using matrix_vector_mul_linear[of A]
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67986
diff changeset
   184
  by (simp add: linear_conv_bounded_linear linear_matrix_vector_mul_eq)
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67986
diff changeset
   185
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   186
lemma
68073
fad29d2a17a5 merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
immler
parents: 68072 68069
diff changeset
   187
  fixes A :: "'a::{euclidean_space,real_algebra_1}^'n^'m"
69064
5840724b1d71 Prefix form of infix with * on either side no longer needs special treatment
nipkow
parents: 68833
diff changeset
   188
  shows matrix_vector_mult_linear_continuous_at [continuous_intros]: "isCont ((*v) A) z"
5840724b1d71 Prefix form of infix with * on either side no longer needs special treatment
nipkow
parents: 68833
diff changeset
   189
    and matrix_vector_mult_linear_continuous_on [continuous_intros]: "continuous_on S ((*v) A)"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67986
diff changeset
   190
  by (simp_all add: linear_continuous_at linear_continuous_on)
67981
349c639e593c more new theorems on real^1, matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
   191
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   192
69683
8b3458ca0762 subsection is always %important
immler
parents: 69678
diff changeset
   193
subsection\<open>Bounds on components etc.\ relative to operator norm\<close>
67719
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   194
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   195
lemma norm_column_le_onorm:
67719
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   196
  fixes A :: "real^'n^'m"
69064
5840724b1d71 Prefix form of infix with * on either side no longer needs special treatment
nipkow
parents: 68833
diff changeset
   197
  shows "norm(column i A) \<le> onorm((*v) A)"
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   198
proof -
67719
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   199
  have "norm (\<chi> j. A $ j $ i) \<le> norm (A *v axis i 1)"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   200
    by (simp add: matrix_mult_dot cart_eq_inner_axis)
69064
5840724b1d71 Prefix form of infix with * on either side no longer needs special treatment
nipkow
parents: 68833
diff changeset
   201
  also have "\<dots> \<le> onorm ((*v) A)"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67986
diff changeset
   202
    using onorm [OF matrix_vector_mul_bounded_linear, of A "axis i 1"] by auto
69064
5840724b1d71 Prefix form of infix with * on either side no longer needs special treatment
nipkow
parents: 68833
diff changeset
   203
  finally have "norm (\<chi> j. A $ j $ i) \<le> onorm ((*v) A)" .
67719
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   204
  then show ?thesis
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   205
    unfolding column_def .
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   206
qed
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   207
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   208
lemma matrix_component_le_onorm:
67719
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   209
  fixes A :: "real^'n^'m"
69064
5840724b1d71 Prefix form of infix with * on either side no longer needs special treatment
nipkow
parents: 68833
diff changeset
   210
  shows "\<bar>A $ i $ j\<bar> \<le> onorm((*v) A)"
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   211
proof -
67719
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   212
  have "\<bar>A $ i $ j\<bar> \<le> norm (\<chi> n. (A $ n $ j))"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   213
    by (metis (full_types, lifting) component_le_norm_cart vec_lambda_beta)
69064
5840724b1d71 Prefix form of infix with * on either side no longer needs special treatment
nipkow
parents: 68833
diff changeset
   214
  also have "\<dots> \<le> onorm ((*v) A)"
67719
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   215
    by (metis (no_types) column_def norm_column_le_onorm)
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   216
  finally show ?thesis .
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   217
qed
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   218
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   219
lemma component_le_onorm:
67719
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   220
  fixes f :: "real^'m \<Rightarrow> real^'n"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   221
  shows "linear f \<Longrightarrow> \<bar>matrix f $ i $ j\<bar> \<le> onorm f"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67986
diff changeset
   222
  by (metis linear_matrix_vector_mul_eq matrix_component_le_onorm matrix_vector_mul)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   223
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   224
lemma onorm_le_matrix_component_sum:
67719
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   225
  fixes A :: "real^'n^'m"
69064
5840724b1d71 Prefix form of infix with * on either side no longer needs special treatment
nipkow
parents: 68833
diff changeset
   226
  shows "onorm((*v) A) \<le> (\<Sum>i\<in>UNIV. \<Sum>j\<in>UNIV. \<bar>A $ i $ j\<bar>)"
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   227
proof (rule onorm_le)
67719
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   228
  fix x
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   229
  have "norm (A *v x) \<le> (\<Sum>i\<in>UNIV. \<bar>(A *v x) $ i\<bar>)"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   230
    by (rule norm_le_l1_cart)
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   231
  also have "\<dots> \<le> (\<Sum>i\<in>UNIV. \<Sum>j\<in>UNIV. \<bar>A $ i $ j\<bar> * norm x)"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   232
  proof (rule sum_mono)
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   233
    fix i
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   234
    have "\<bar>(A *v x) $ i\<bar> \<le> \<bar>\<Sum>j\<in>UNIV. A $ i $ j * x $ j\<bar>"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   235
      by (simp add: matrix_vector_mult_def)
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   236
    also have "\<dots> \<le> (\<Sum>j\<in>UNIV. \<bar>A $ i $ j * x $ j\<bar>)"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   237
      by (rule sum_abs)
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   238
    also have "\<dots> \<le> (\<Sum>j\<in>UNIV. \<bar>A $ i $ j\<bar> * norm x)"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   239
      by (rule sum_mono) (simp add: abs_mult component_le_norm_cart mult_left_mono)
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   240
    finally show "\<bar>(A *v x) $ i\<bar> \<le> (\<Sum>j\<in>UNIV. \<bar>A $ i $ j\<bar> * norm x)" .
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   241
  qed
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   242
  finally show "norm (A *v x) \<le> (\<Sum>i\<in>UNIV. \<Sum>j\<in>UNIV. \<bar>A $ i $ j\<bar>) * norm x"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   243
    by (simp add: sum_distrib_right)
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   244
qed
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   245
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   246
lemma onorm_le_matrix_component:
67719
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   247
  fixes A :: "real^'n^'m"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   248
  assumes "\<And>i j. abs(A$i$j) \<le> B"
69064
5840724b1d71 Prefix form of infix with * on either side no longer needs special treatment
nipkow
parents: 68833
diff changeset
   249
  shows "onorm((*v) A) \<le> real (CARD('m)) * real (CARD('n)) * B"
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   250
proof (rule onorm_le)
67731
184c293f0a33 clarified use of vec type syntax;
wenzelm
parents: 67728
diff changeset
   251
  fix x :: "real^'n::_"
67719
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   252
  have "norm (A *v x) \<le> (\<Sum>i\<in>UNIV. \<bar>(A *v x) $ i\<bar>)"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   253
    by (rule norm_le_l1_cart)
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   254
  also have "\<dots> \<le> (\<Sum>i::'m \<in>UNIV. real (CARD('n)) * B * norm x)"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   255
  proof (rule sum_mono)
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   256
    fix i
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   257
    have "\<bar>(A *v x) $ i\<bar> \<le> norm(A $ i) * norm x"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   258
      by (simp add: matrix_mult_dot Cauchy_Schwarz_ineq2)
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   259
    also have "\<dots> \<le> (\<Sum>j\<in>UNIV. \<bar>A $ i $ j\<bar>) * norm x"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   260
      by (simp add: mult_right_mono norm_le_l1_cart)
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   261
    also have "\<dots> \<le> real (CARD('n)) * B * norm x"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   262
      by (simp add: assms sum_bounded_above mult_right_mono)
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   263
    finally show "\<bar>(A *v x) $ i\<bar> \<le> real (CARD('n)) * B * norm x" .
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   264
  qed
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   265
  also have "\<dots> \<le> CARD('m) * real (CARD('n)) * B * norm x"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   266
    by simp
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   267
  finally show "norm (A *v x) \<le> CARD('m) * real (CARD('n)) * B * norm x" .
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   268
qed
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   269
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   270
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   271
lemma rational_approximation:
67719
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   272
  assumes "e > 0"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   273
  obtains r::real where "r \<in> \<rat>" "\<bar>r - x\<bar> < e"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   274
  using Rats_dense_in_real [of "x - e/2" "x + e/2"] assms by auto
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   275
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   276
proposition matrix_rational_approximation:
67719
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   277
  fixes A :: "real^'n^'m"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   278
  assumes "e > 0"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   279
  obtains B where "\<And>i j. B$i$j \<in> \<rat>" "onorm(\<lambda>x. (A - B) *v x) < e"
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   280
proof -
67719
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   281
  have "\<forall>i j. \<exists>q \<in> \<rat>. \<bar>q - A $ i $ j\<bar> < e / (2 * CARD('m) * CARD('n))"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   282
    using assms by (force intro: rational_approximation [of "e / (2 * CARD('m) * CARD('n))"])
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   283
  then obtain B where B: "\<And>i j. B$i$j \<in> \<rat>" and Bclo: "\<And>i j. \<bar>B$i$j - A $ i $ j\<bar> < e / (2 * CARD('m) * CARD('n))"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   284
    by (auto simp: lambda_skolem Bex_def)
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   285
  show ?thesis
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   286
  proof
69064
5840724b1d71 Prefix form of infix with * on either side no longer needs special treatment
nipkow
parents: 68833
diff changeset
   287
    have "onorm ((*v) (A - B)) \<le> real CARD('m) * real CARD('n) *
67719
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   288
    (e / (2 * real CARD('m) * real CARD('n)))"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   289
      apply (rule onorm_le_matrix_component)
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   290
      using Bclo by (simp add: abs_minus_commute less_imp_le)
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   291
    also have "\<dots> < e"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   292
      using \<open>0 < e\<close> by (simp add: divide_simps)
69064
5840724b1d71 Prefix form of infix with * on either side no longer needs special treatment
nipkow
parents: 68833
diff changeset
   293
    finally show "onorm ((*v) (A - B)) < e" .
67719
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   294
  qed (use B in auto)
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   295
qed
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   296
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   297
lemma vector_sub_project_orthogonal_cart: "(b::real^'n) \<bullet> (x - ((b \<bullet> x) / (b \<bullet> b)) *s b) = 0"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 49962
diff changeset
   298
  unfolding inner_simps scalar_mult_eq_scaleR by auto
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   299
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   300
lemma infnorm_cart:"infnorm (x::real^'n) = Sup {\<bar>x$i\<bar> |i. i\<in>UNIV}"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 49962
diff changeset
   301
  by (simp add: infnorm_def inner_axis Basis_vec_def) (metis (lifting) inner_axis real_inner_1_right)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   302
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   303
lemma component_le_infnorm_cart: "\<bar>x$i\<bar> \<le> infnorm (x::real^'n)"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 49962
diff changeset
   304
  using Basis_le_infnorm[of "axis i 1" x]
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 49962
diff changeset
   305
  by (simp add: Basis_vec_def axis_eq_axis inner_axis)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   306
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   307
lemma continuous_component[continuous_intros]: "continuous F f \<Longrightarrow> continuous F (\<lambda>x. f x $ i)"
44647
e4de7750cdeb modernize lemmas about 'continuous' and 'continuous_on';
huffman
parents: 44571
diff changeset
   308
  unfolding continuous_def by (rule tendsto_vec_nth)
44213
6fb54701a11b add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
huffman
parents: 44211
diff changeset
   309
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   310
lemma continuous_on_component[continuous_intros]: "continuous_on s f \<Longrightarrow> continuous_on s (\<lambda>x. f x $ i)"
44647
e4de7750cdeb modernize lemmas about 'continuous' and 'continuous_on';
huffman
parents: 44571
diff changeset
   311
  unfolding continuous_on_def by (fast intro: tendsto_vec_nth)
44213
6fb54701a11b add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
huffman
parents: 44211
diff changeset
   312
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   313
lemma continuous_on_vec_lambda[continuous_intros]:
63334
bd37a72a940a Multivariate_Analysis: add continuous_on_vec_lambda
hoelzl
parents: 63332
diff changeset
   314
  "(\<And>i. continuous_on S (f i)) \<Longrightarrow> continuous_on S (\<lambda>x. \<chi> i. f i x)"
bd37a72a940a Multivariate_Analysis: add continuous_on_vec_lambda
hoelzl
parents: 63332
diff changeset
   315
  unfolding continuous_on_def by (auto intro: tendsto_vec_lambda)
bd37a72a940a Multivariate_Analysis: add continuous_on_vec_lambda
hoelzl
parents: 63332
diff changeset
   316
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   317
lemma closed_positive_orthant: "closed {x::real^'n. \<forall>i. 0 \<le>x$i}"
63332
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63075
diff changeset
   318
  by (simp add: Collect_all_eq closed_INT closed_Collect_le continuous_on_const continuous_on_id continuous_on_component)
44213
6fb54701a11b add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
huffman
parents: 44211
diff changeset
   319
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   320
lemma bounded_component_cart: "bounded s \<Longrightarrow> bounded ((\<lambda>x. x $ i) ` s)"
49644
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   321
  unfolding bounded_def
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   322
  apply clarify
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   323
  apply (rule_tac x="x $ i" in exI)
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   324
  apply (rule_tac x="e" in exI)
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   325
  apply clarify
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   326
  apply (rule order_trans [OF dist_vec_nth_le], simp)
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   327
  done
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   328
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   329
lemma compact_lemma_cart:
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   330
  fixes f :: "nat \<Rightarrow> 'a::heine_borel ^ 'n"
50998
501200635659 simplify heine_borel type class
hoelzl
parents: 50526
diff changeset
   331
  assumes f: "bounded (range f)"
66447
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 64267
diff changeset
   332
  shows "\<exists>l r. strict_mono r \<and>
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   333
        (\<forall>e>0. eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r n) $ i) (l $ i) < e) sequentially)"
62127
d8e7738bd2e9 generalized proofs
immler
parents: 61973
diff changeset
   334
    (is "?th d")
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   335
proof -
62127
d8e7738bd2e9 generalized proofs
immler
parents: 61973
diff changeset
   336
  have "\<forall>d' \<subseteq> d. ?th d'"
d8e7738bd2e9 generalized proofs
immler
parents: 61973
diff changeset
   337
    by (rule compact_lemma_general[where unproj=vec_lambda])
d8e7738bd2e9 generalized proofs
immler
parents: 61973
diff changeset
   338
      (auto intro!: f bounded_component_cart simp: vec_lambda_eta)
d8e7738bd2e9 generalized proofs
immler
parents: 61973
diff changeset
   339
  then show "?th d" by simp
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   340
qed
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   341
44136
e63ad7d5158d more uniform naming scheme for finite cartesian product type and related theorems
huffman
parents: 44135
diff changeset
   342
instance vec :: (heine_borel, finite) heine_borel
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   343
proof
50998
501200635659 simplify heine_borel type class
hoelzl
parents: 50526
diff changeset
   344
  fix f :: "nat \<Rightarrow> 'a ^ 'b"
501200635659 simplify heine_borel type class
hoelzl
parents: 50526
diff changeset
   345
  assume f: "bounded (range f)"
66447
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 64267
diff changeset
   346
  then obtain l r where r: "strict_mono r"
49644
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   347
      and l: "\<forall>e>0. eventually (\<lambda>n. \<forall>i\<in>UNIV. dist (f (r n) $ i) (l $ i) < e) sequentially"
50998
501200635659 simplify heine_borel type class
hoelzl
parents: 50526
diff changeset
   348
    using compact_lemma_cart [OF f] by blast
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   349
  let ?d = "UNIV::'b set"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   350
  { fix e::real assume "e>0"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   351
    hence "0 < e / (real_of_nat (card ?d))"
49644
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   352
      using zero_less_card_finite divide_pos_pos[of e, of "real_of_nat (card ?d)"] by auto
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   353
    with l have "eventually (\<lambda>n. \<forall>i. dist (f (r n) $ i) (l $ i) < e / (real_of_nat (card ?d))) sequentially"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   354
      by simp
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   355
    moreover
49644
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   356
    { fix n
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   357
      assume n: "\<forall>i. dist (f (r n) $ i) (l $ i) < e / (real_of_nat (card ?d))"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   358
      have "dist (f (r n)) l \<le> (\<Sum>i\<in>?d. dist (f (r n) $ i) (l $ i))"
67155
9e5b05d54f9d canonical name
nipkow
parents: 66804
diff changeset
   359
        unfolding dist_vec_def using zero_le_dist by (rule L2_set_le_sum)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   360
      also have "\<dots> < (\<Sum>i\<in>?d. e / (real_of_nat (card ?d)))"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63945
diff changeset
   361
        by (rule sum_strict_mono) (simp_all add: n)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   362
      finally have "dist (f (r n)) l < e" by simp
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   363
    }
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   364
    ultimately have "eventually (\<lambda>n. dist (f (r n)) l < e) sequentially"
61810
3c5040d5694a sorted out eventually_mono
paulson <lp15@cam.ac.uk>
parents: 61736
diff changeset
   365
      by (rule eventually_mono)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   366
  }
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61945
diff changeset
   367
  hence "((f \<circ> r) \<longlongrightarrow> l) sequentially" unfolding o_def tendsto_iff by simp
66447
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 64267
diff changeset
   368
  with r show "\<exists>l r. strict_mono r \<and> ((f \<circ> r) \<longlongrightarrow> l) sequentially" by auto
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   369
qed
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   370
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   371
lemma interval_cart:
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54489
diff changeset
   372
  fixes a :: "real^'n"
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54489
diff changeset
   373
  shows "box a b = {x::real^'n. \<forall>i. a$i < x$i \<and> x$i < b$i}"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 55522
diff changeset
   374
    and "cbox a b = {x::real^'n. \<forall>i. a$i \<le> x$i \<and> x$i \<le> b$i}"
0268784f60da use cbox to relax class constraints
immler
parents: 55522
diff changeset
   375
  by (auto simp add: set_eq_iff less_vec_def less_eq_vec_def mem_box Basis_vec_def inner_axis)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   376
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   377
lemma mem_box_cart:
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54489
diff changeset
   378
  fixes a :: "real^'n"
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54489
diff changeset
   379
  shows "x \<in> box a b \<longleftrightarrow> (\<forall>i. a$i < x$i \<and> x$i < b$i)"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 55522
diff changeset
   380
    and "x \<in> cbox a b \<longleftrightarrow> (\<forall>i. a$i \<le> x$i \<and> x$i \<le> b$i)"
49644
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   381
  using interval_cart[of a b] by (auto simp add: set_eq_iff less_vec_def less_eq_vec_def)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   382
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   383
lemma interval_eq_empty_cart:
49644
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   384
  fixes a :: "real^'n"
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54489
diff changeset
   385
  shows "(box a b = {} \<longleftrightarrow> (\<exists>i. b$i \<le> a$i))" (is ?th1)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 55522
diff changeset
   386
    and "(cbox a b = {} \<longleftrightarrow> (\<exists>i. b$i < a$i))" (is ?th2)
49644
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   387
proof -
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54489
diff changeset
   388
  { fix i x assume as:"b$i \<le> a$i" and x:"x\<in>box a b"
67673
c8caefb20564 lots of new material, ultimately related to measure theory
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   389
    hence "a $ i < x $ i \<and> x $ i < b $ i" unfolding mem_box_cart by auto
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   390
    hence "a$i < b$i" by auto
49644
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   391
    hence False using as by auto }
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   392
  moreover
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   393
  { assume as:"\<forall>i. \<not> (b$i \<le> a$i)"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   394
    let ?x = "(1/2) *\<^sub>R (a + b)"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   395
    { fix i
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   396
      have "a$i < b$i" using as[THEN spec[where x=i]] by auto
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   397
      hence "a$i < ((1/2) *\<^sub>R (a+b)) $ i" "((1/2) *\<^sub>R (a+b)) $ i < b$i"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   398
        unfolding vector_smult_component and vector_add_component
49644
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   399
        by auto }
67673
c8caefb20564 lots of new material, ultimately related to measure theory
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   400
    hence "box a b \<noteq> {}" using mem_box_cart(1)[of "?x" a b] by auto }
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   401
  ultimately show ?th1 by blast
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   402
56188
0268784f60da use cbox to relax class constraints
immler
parents: 55522
diff changeset
   403
  { fix i x assume as:"b$i < a$i" and x:"x\<in>cbox a b"
67673
c8caefb20564 lots of new material, ultimately related to measure theory
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   404
    hence "a $ i \<le> x $ i \<and> x $ i \<le> b $ i" unfolding mem_box_cart by auto
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   405
    hence "a$i \<le> b$i" by auto
49644
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   406
    hence False using as by auto }
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   407
  moreover
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   408
  { assume as:"\<forall>i. \<not> (b$i < a$i)"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   409
    let ?x = "(1/2) *\<^sub>R (a + b)"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   410
    { fix i
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   411
      have "a$i \<le> b$i" using as[THEN spec[where x=i]] by auto
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   412
      hence "a$i \<le> ((1/2) *\<^sub>R (a+b)) $ i" "((1/2) *\<^sub>R (a+b)) $ i \<le> b$i"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   413
        unfolding vector_smult_component and vector_add_component
49644
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   414
        by auto }
67673
c8caefb20564 lots of new material, ultimately related to measure theory
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   415
    hence "cbox a b \<noteq> {}" using mem_box_cart(2)[of "?x" a b] by auto  }
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   416
  ultimately show ?th2 by blast
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   417
qed
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   418
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   419
lemma interval_ne_empty_cart:
49644
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   420
  fixes a :: "real^'n"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 55522
diff changeset
   421
  shows "cbox a b \<noteq> {} \<longleftrightarrow> (\<forall>i. a$i \<le> b$i)"
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54489
diff changeset
   422
    and "box a b \<noteq> {} \<longleftrightarrow> (\<forall>i. a$i < b$i)"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   423
  unfolding interval_eq_empty_cart[of a b] by (auto simp add: not_less not_le)
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   424
    (* BH: Why doesn't just "auto" work here? *)
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   425
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   426
lemma subset_interval_imp_cart:
49644
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   427
  fixes a :: "real^'n"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 55522
diff changeset
   428
  shows "(\<forall>i. a$i \<le> c$i \<and> d$i \<le> b$i) \<Longrightarrow> cbox c d \<subseteq> cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 55522
diff changeset
   429
    and "(\<forall>i. a$i < c$i \<and> d$i < b$i) \<Longrightarrow> cbox c d \<subseteq> box a b"
0268784f60da use cbox to relax class constraints
immler
parents: 55522
diff changeset
   430
    and "(\<forall>i. a$i \<le> c$i \<and> d$i \<le> b$i) \<Longrightarrow> box c d \<subseteq> cbox a b"
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54489
diff changeset
   431
    and "(\<forall>i. a$i \<le> c$i \<and> d$i \<le> b$i) \<Longrightarrow> box c d \<subseteq> box a b"
67673
c8caefb20564 lots of new material, ultimately related to measure theory
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   432
  unfolding subset_eq[unfolded Ball_def] unfolding mem_box_cart
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   433
  by (auto intro: order_trans less_le_trans le_less_trans less_imp_le) (* BH: Why doesn't just "auto" work here? *)
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   434
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   435
lemma interval_sing:
49644
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   436
  fixes a :: "'a::linorder^'n"
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   437
  shows "{a .. a} = {a} \<and> {a<..<a} = {}"
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   438
  apply (auto simp add: set_eq_iff less_vec_def less_eq_vec_def vec_eq_iff)
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   439
  done
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   440
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   441
lemma subset_interval_cart:
49644
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   442
  fixes a :: "real^'n"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 55522
diff changeset
   443
  shows "cbox c d \<subseteq> cbox a b \<longleftrightarrow> (\<forall>i. c$i \<le> d$i) --> (\<forall>i. a$i \<le> c$i \<and> d$i \<le> b$i)" (is ?th1)
0268784f60da use cbox to relax class constraints
immler
parents: 55522
diff changeset
   444
    and "cbox c d \<subseteq> box a b \<longleftrightarrow> (\<forall>i. c$i \<le> d$i) --> (\<forall>i. a$i < c$i \<and> d$i < b$i)" (is ?th2)
0268784f60da use cbox to relax class constraints
immler
parents: 55522
diff changeset
   445
    and "box c d \<subseteq> cbox a b \<longleftrightarrow> (\<forall>i. c$i < d$i) --> (\<forall>i. a$i \<le> c$i \<and> d$i \<le> b$i)" (is ?th3)
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54489
diff changeset
   446
    and "box c d \<subseteq> box a b \<longleftrightarrow> (\<forall>i. c$i < d$i) --> (\<forall>i. a$i \<le> c$i \<and> d$i \<le> b$i)" (is ?th4)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 55522
diff changeset
   447
  using subset_box[of c d a b] by (simp_all add: Basis_vec_def inner_axis)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   448
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   449
lemma disjoint_interval_cart:
49644
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   450
  fixes a::"real^'n"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 55522
diff changeset
   451
  shows "cbox a b \<inter> cbox c d = {} \<longleftrightarrow> (\<exists>i. (b$i < a$i \<or> d$i < c$i \<or> b$i < c$i \<or> d$i < a$i))" (is ?th1)
0268784f60da use cbox to relax class constraints
immler
parents: 55522
diff changeset
   452
    and "cbox a b \<inter> box c d = {} \<longleftrightarrow> (\<exists>i. (b$i < a$i \<or> d$i \<le> c$i \<or> b$i \<le> c$i \<or> d$i \<le> a$i))" (is ?th2)
0268784f60da use cbox to relax class constraints
immler
parents: 55522
diff changeset
   453
    and "box a b \<inter> cbox c d = {} \<longleftrightarrow> (\<exists>i. (b$i \<le> a$i \<or> d$i < c$i \<or> b$i \<le> c$i \<or> d$i \<le> a$i))" (is ?th3)
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54489
diff changeset
   454
    and "box a b \<inter> box c d = {} \<longleftrightarrow> (\<exists>i. (b$i \<le> a$i \<or> d$i \<le> c$i \<or> b$i \<le> c$i \<or> d$i \<le> a$i))" (is ?th4)
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 49962
diff changeset
   455
  using disjoint_interval[of a b c d] by (simp_all add: Basis_vec_def inner_axis)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   456
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   457
lemma Int_interval_cart:
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54489
diff changeset
   458
  fixes a :: "real^'n"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 55522
diff changeset
   459
  shows "cbox a b \<inter> cbox c d =  {(\<chi> i. max (a$i) (c$i)) .. (\<chi> i. min (b$i) (d$i))}"
63945
444eafb6e864 a few new theorems and a renaming
paulson <lp15@cam.ac.uk>
parents: 63938
diff changeset
   460
  unfolding Int_interval
56188
0268784f60da use cbox to relax class constraints
immler
parents: 55522
diff changeset
   461
  by (auto simp: mem_box less_eq_vec_def)
0268784f60da use cbox to relax class constraints
immler
parents: 55522
diff changeset
   462
    (auto simp: Basis_vec_def inner_axis)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   463
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   464
lemma closed_interval_left_cart:
49644
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   465
  fixes b :: "real^'n"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   466
  shows "closed {x::real^'n. \<forall>i. x$i \<le> b$i}"
63332
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63075
diff changeset
   467
  by (simp add: Collect_all_eq closed_INT closed_Collect_le continuous_on_const continuous_on_id continuous_on_component)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   468
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   469
lemma closed_interval_right_cart:
49644
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   470
  fixes a::"real^'n"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   471
  shows "closed {x::real^'n. \<forall>i. a$i \<le> x$i}"
63332
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63075
diff changeset
   472
  by (simp add: Collect_all_eq closed_INT closed_Collect_le continuous_on_const continuous_on_id continuous_on_component)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   473
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   474
lemma is_interval_cart:
49644
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   475
  "is_interval (s::(real^'n) set) \<longleftrightarrow>
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   476
    (\<forall>a\<in>s. \<forall>b\<in>s. \<forall>x. (\<forall>i. ((a$i \<le> x$i \<and> x$i \<le> b$i) \<or> (b$i \<le> x$i \<and> x$i \<le> a$i))) \<longrightarrow> x \<in> s)"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 49962
diff changeset
   477
  by (simp add: is_interval_def Ball_def Basis_vec_def inner_axis imp_ex)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   478
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   479
lemma closed_halfspace_component_le_cart: "closed {x::real^'n. x$i \<le> a}"
69669
de2f0a24b0f0 Reorg of material
nipkow
parents: 69668
diff changeset
   480
  by (simp add: closed_Collect_le continuous_on_component)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   481
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   482
lemma closed_halfspace_component_ge_cart: "closed {x::real^'n. x$i \<ge> a}"
69669
de2f0a24b0f0 Reorg of material
nipkow
parents: 69668
diff changeset
   483
  by (simp add: closed_Collect_le continuous_on_component)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   484
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   485
lemma open_halfspace_component_lt_cart: "open {x::real^'n. x$i < a}"
69669
de2f0a24b0f0 Reorg of material
nipkow
parents: 69668
diff changeset
   486
  by (simp add: open_Collect_less continuous_on_component)
49644
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   487
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   488
lemma open_halfspace_component_gt_cart: "open {x::real^'n. x$i  > a}"
69669
de2f0a24b0f0 Reorg of material
nipkow
parents: 69668
diff changeset
   489
  by (simp add: open_Collect_less continuous_on_component)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   490
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   491
lemma Lim_component_le_cart:
49644
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   492
  fixes f :: "'a \<Rightarrow> real^'n"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61945
diff changeset
   493
  assumes "(f \<longlongrightarrow> l) net" "\<not> (trivial_limit net)"  "eventually (\<lambda>x. f x $i \<le> b) net"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   494
  shows "l$i \<le> b"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 49962
diff changeset
   495
  by (rule tendsto_le[OF assms(2) tendsto_const tendsto_vec_nth, OF assms(1, 3)])
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   496
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   497
lemma Lim_component_ge_cart:
49644
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   498
  fixes f :: "'a \<Rightarrow> real^'n"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61945
diff changeset
   499
  assumes "(f \<longlongrightarrow> l) net"  "\<not> (trivial_limit net)"  "eventually (\<lambda>x. b \<le> (f x)$i) net"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   500
  shows "b \<le> l$i"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 49962
diff changeset
   501
  by (rule tendsto_le[OF assms(2) tendsto_vec_nth tendsto_const, OF assms(1, 3)])
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   502
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   503
lemma Lim_component_eq_cart:
49644
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   504
  fixes f :: "'a \<Rightarrow> real^'n"
69508
2a4c8a2a3f8e tuned headers; ~ -> \<not>
nipkow
parents: 69272
diff changeset
   505
  assumes net: "(f \<longlongrightarrow> l) net" "\<not> trivial_limit net" and ev:"eventually (\<lambda>x. f(x)$i = b) net"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   506
  shows "l$i = b"
49644
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   507
  using ev[unfolded order_eq_iff eventually_conj_iff] and
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   508
    Lim_component_ge_cart[OF net, of b i] and
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   509
    Lim_component_le_cart[OF net, of i b] by auto
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   510
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   511
lemma connected_ivt_component_cart:
49644
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   512
  fixes x :: "real^'n"
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   513
  shows "connected s \<Longrightarrow> x \<in> s \<Longrightarrow> y \<in> s \<Longrightarrow> x$k \<le> a \<Longrightarrow> a \<le> y$k \<Longrightarrow> (\<exists>z\<in>s.  z$k = a)"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 49962
diff changeset
   514
  using connected_ivt_hyperplane[of s x y "axis k 1" a]
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 49962
diff changeset
   515
  by (auto simp add: inner_axis inner_commute)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   516
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   517
lemma subspace_substandard_cart: "vec.subspace {x. (\<forall>i. P i \<longrightarrow> x$i = 0)}"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67986
diff changeset
   518
  unfolding vec.subspace_def by auto
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   519
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   520
lemma closed_substandard_cart:
44213
6fb54701a11b add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
huffman
parents: 44211
diff changeset
   521
  "closed {x::'a::real_normed_vector ^ 'n. \<forall>i. P i \<longrightarrow> x$i = 0}"
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   522
proof -
44213
6fb54701a11b add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
huffman
parents: 44211
diff changeset
   523
  { fix i::'n
6fb54701a11b add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
huffman
parents: 44211
diff changeset
   524
    have "closed {x::'a ^ 'n. P i \<longrightarrow> x$i = 0}"
63332
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63075
diff changeset
   525
      by (cases "P i") (simp_all add: closed_Collect_eq continuous_on_const continuous_on_id continuous_on_component) }
44213
6fb54701a11b add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
huffman
parents: 44211
diff changeset
   526
  thus ?thesis
6fb54701a11b add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
huffman
parents: 44211
diff changeset
   527
    unfolding Collect_all_eq by (simp add: closed_INT)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   528
qed
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   529
69683
8b3458ca0762 subsection is always %important
immler
parents: 69678
diff changeset
   530
subsection "Convex Euclidean Space"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   531
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   532
lemma Cart_1:"(1::real^'n) = \<Sum>Basis"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 49962
diff changeset
   533
  using const_vector_cart[of 1] by (simp add: one_vec_def)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   534
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   535
declare vector_add_ldistrib[simp] vector_ssub_ldistrib[simp] vector_smult_assoc[simp] vector_smult_rneg[simp]
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   536
declare vector_sadd_rdistrib[simp] vector_sub_rdistrib[simp]
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   537
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   538
lemmas vector_component_simps = vector_minus_component vector_smult_component vector_add_component less_eq_vec_def vec_lambda_beta vector_uminus_component
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   539
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   540
lemma convex_box_cart:
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   541
  assumes "\<And>i. convex {x. P i x}"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   542
  shows "convex {x. \<forall>i. P i (x$i)}"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   543
  using assms unfolding convex_def by auto
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   544
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   545
lemma convex_positive_orthant_cart: "convex {x::real^'n. (\<forall>i. 0 \<le> x$i)}"
63334
bd37a72a940a Multivariate_Analysis: add continuous_on_vec_lambda
hoelzl
parents: 63332
diff changeset
   546
  by (rule convex_box_cart) (simp add: atLeast_def[symmetric])
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   547
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   548
lemma unit_interval_convex_hull_cart:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 55522
diff changeset
   549
  "cbox (0::real^'n) 1 = convex hull {x. \<forall>i. (x$i = 0) \<or> (x$i = 1)}"
0268784f60da use cbox to relax class constraints
immler
parents: 55522
diff changeset
   550
  unfolding Cart_1 unit_interval_convex_hull[where 'a="real^'n"] box_real[symmetric]
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 49962
diff changeset
   551
  by (rule arg_cong[where f="\<lambda>x. convex hull x"]) (simp add: Basis_vec_def inner_axis)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   552
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   553
proposition cube_convex_hull_cart:
49644
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   554
  assumes "0 < d"
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   555
  obtains s::"(real^'n) set"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 55522
diff changeset
   556
    where "finite s" "cbox (x - (\<chi> i. d)) (x + (\<chi> i. d)) = convex hull s"
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   557
proof -
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 54776
diff changeset
   558
  from assms obtain s where "finite s"
69064
5840724b1d71 Prefix form of infix with * on either side no longer needs special treatment
nipkow
parents: 68833
diff changeset
   559
    and "cbox (x - sum ((*\<^sub>R) d) Basis) (x + sum ((*\<^sub>R) d) Basis) = convex hull s"
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 54776
diff changeset
   560
    by (rule cube_convex_hull)
23d2cbac6dce tuned proofs;
wenzelm
parents: 54776
diff changeset
   561
  with that[of s] show thesis
23d2cbac6dce tuned proofs;
wenzelm
parents: 54776
diff changeset
   562
    by (simp add: const_vector_cart)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   563
qed
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   564
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   565
69683
8b3458ca0762 subsection is always %important
immler
parents: 69678
diff changeset
   566
subsection "Derivative"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   567
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 70113
diff changeset
   568
definition\<^marker>\<open>tag important\<close> "jacobian f net = matrix(frechet_derivative f net)"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   569
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   570
proposition jacobian_works:
49644
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   571
  "(f::(real^'a) \<Rightarrow> (real^'b)) differentiable net \<longleftrightarrow>
67986
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
   572
    (f has_derivative (\<lambda>h. (jacobian f net) *v h)) net" (is "?lhs = ?rhs")
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   573
proof
67986
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
   574
  assume ?lhs then show ?rhs
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
   575
    by (simp add: frechet_derivative_works has_derivative_linear jacobian_def)
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
   576
next
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
   577
  assume ?rhs then show ?lhs
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
   578
    by (rule differentiableI)
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
   579
qed
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   580
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   581
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   582
text \<open>Component of the differential must be zero if it exists at a local
67968
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67962
diff changeset
   583
  maximum or minimum for that corresponding component\<close>
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   584
69723
9b9f203e0ba3 tagged 2 theories ie Cartesian_Euclidean_Space Cartesian_Space
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69686
diff changeset
   585
proposition differential_zero_maxmin_cart:
49644
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   586
  fixes f::"real^'a \<Rightarrow> real^'b"
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   587
  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))"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 49962
diff changeset
   588
    "f differentiable (at x)"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 49962
diff changeset
   589
  shows "jacobian f (at x) $ k = 0"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 49962
diff changeset
   590
  using differential_zero_maxmin_component[of "axis k 1" e x f] assms
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 49962
diff changeset
   591
    vector_cart[of "\<lambda>j. frechet_derivative f (at x) j $ k"]
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 49962
diff changeset
   592
  by (simp add: Basis_vec_def axis_eq_axis inner_axis jacobian_def matrix_def)
49644
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   593
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 70113
diff changeset
   594
subsection\<^marker>\<open>tag unimportant\<close>\<open>Routine results connecting the types \<^typ>\<open>real^1\<close> and \<^typ>\<open>real\<close>\<close>
67981
349c639e593c more new theorems on real^1, matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
   595
349c639e593c more new theorems on real^1, matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
   596
lemma vec_cbox_1_eq [simp]:
349c639e593c more new theorems on real^1, matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
   597
  shows "vec ` cbox u v = cbox (vec u) (vec v ::real^1)"
349c639e593c more new theorems on real^1, matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
   598
  by (force simp: Basis_vec_def cart_eq_inner_axis [symmetric] mem_box)
349c639e593c more new theorems on real^1, matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
   599
349c639e593c more new theorems on real^1, matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
   600
lemma vec_nth_cbox_1_eq [simp]:
349c639e593c more new theorems on real^1, matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
   601
  fixes u v :: "'a::euclidean_space^1"
349c639e593c more new theorems on real^1, matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
   602
  shows "(\<lambda>x. x $ 1) ` cbox u v = cbox (u$1) (v$1)"
349c639e593c more new theorems on real^1, matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
   603
    by (auto simp: Basis_vec_def cart_eq_inner_axis [symmetric] mem_box image_iff Bex_def inner_axis) (metis vec_component)
349c639e593c more new theorems on real^1, matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
   604
349c639e593c more new theorems on real^1, matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
   605
lemma vec_nth_1_iff_cbox [simp]:
349c639e593c more new theorems on real^1, matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
   606
  fixes a b :: "'a::euclidean_space"
349c639e593c more new theorems on real^1, matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
   607
  shows "(\<lambda>x::'a^1. x $ 1) ` S = cbox a b \<longleftrightarrow> S = cbox (vec a) (vec b)"
349c639e593c more new theorems on real^1, matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
   608
    (is "?lhs = ?rhs")
349c639e593c more new theorems on real^1, matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
   609
proof
349c639e593c more new theorems on real^1, matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
   610
  assume L: ?lhs show ?rhs
349c639e593c more new theorems on real^1, matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
   611
  proof (intro equalityI subsetI)
349c639e593c more new theorems on real^1, matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
   612
    fix x 
349c639e593c more new theorems on real^1, matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
   613
    assume "x \<in> S"
349c639e593c more new theorems on real^1, matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
   614
    then have "x $ 1 \<in> (\<lambda>v. v $ (1::1)) ` cbox (vec a) (vec b)"
349c639e593c more new theorems on real^1, matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
   615
      using L by auto
349c639e593c more new theorems on real^1, matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
   616
    then show "x \<in> cbox (vec a) (vec b)"
349c639e593c more new theorems on real^1, matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
   617
      by (metis (no_types, lifting) imageE vector_one_nth)
349c639e593c more new theorems on real^1, matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
   618
  next
349c639e593c more new theorems on real^1, matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
   619
    fix x :: "'a^1"
349c639e593c more new theorems on real^1, matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
   620
    assume "x \<in> cbox (vec a) (vec b)"
349c639e593c more new theorems on real^1, matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
   621
    then show "x \<in> S"
349c639e593c more new theorems on real^1, matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
   622
      by (metis (no_types, lifting) L imageE imageI vec_component vec_nth_cbox_1_eq vector_one_nth)
349c639e593c more new theorems on real^1, matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
   623
  qed
349c639e593c more new theorems on real^1, matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
   624
qed simp
49644
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   625
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   626
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   627
lemma interval_split_cart:
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   628
  "{a..b::real^'n} \<inter> {x. x$k \<le> c} = {a .. (\<chi> i. if i = k then min (b$k) c else b$i)}"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 55522
diff changeset
   629
  "cbox a b \<inter> {x. x$k \<ge> c} = {(\<chi> i. if i = k then max (a$k) c else a$i) .. b}"
49644
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   630
  apply (rule_tac[!] set_eqI)
67673
c8caefb20564 lots of new material, ultimately related to measure theory
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   631
  unfolding Int_iff mem_box_cart mem_Collect_eq interval_cbox_cart
49644
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   632
  unfolding vec_lambda_beta
343bfcbad2ec tuned proofs;
wenzelm
parents: 49197
diff changeset
   633
  by auto
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   634
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67673
diff changeset
   635
lemmas cartesian_euclidean_space_uniform_limit_intros[uniform_limit_intros] =
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67673
diff changeset
   636
  bounded_linear.uniform_limit[OF blinfun.bounded_linear_right]
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67673
diff changeset
   637
  bounded_linear.uniform_limit[OF bounded_linear_vec_nth]
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67673
diff changeset
   638
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
diff changeset
   639
end