| author | haftmann | 
| Sat, 08 Oct 2016 14:09:55 +0200 | |
| changeset 64114 | 45e065eea984 | 
| parent 63971 | da89140186e2 | 
| child 64267 | b9a1486e79be | 
| permissions | -rw-r--r-- | 
| 63627 | 1 | (* Title: HOL/Analysis/Euclidean_Space.thy | 
| 44133 
691c52e900ca
split Linear_Algebra.thy from Euclidean_Space.thy
 huffman parents: 
44129diff
changeset | 2 | Author: Johannes Hölzl, TU München | 
| 
691c52e900ca
split Linear_Algebra.thy from Euclidean_Space.thy
 huffman parents: 
44129diff
changeset | 3 | Author: Brian Huffman, Portland State University | 
| 33175 | 4 | *) | 
| 5 | ||
| 60420 | 6 | section \<open>Finite-Dimensional Inner Product Spaces\<close> | 
| 33175 | 7 | |
| 8 | theory Euclidean_Space | |
| 9 | imports | |
| 63971 
da89140186e2
HOL-Analysis: move Product_Vector and Inner_Product from Library
 hoelzl parents: 
63952diff
changeset | 10 | L2_Norm Product_Vector | 
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
36778diff
changeset | 11 | begin | 
| 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
36778diff
changeset | 12 | |
| 60420 | 13 | subsection \<open>Type class 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: 
36778diff
changeset | 14 | |
| 44129 | 15 | class euclidean_space = real_inner + | 
| 44166 
d12d89a66742
modify euclidean_space class to include basis set
 huffman parents: 
44133diff
changeset | 16 | fixes Basis :: "'a set" | 
| 
d12d89a66742
modify euclidean_space class to include basis set
 huffman parents: 
44133diff
changeset | 17 |   assumes nonempty_Basis [simp]: "Basis \<noteq> {}"
 | 
| 
d12d89a66742
modify euclidean_space class to include basis set
 huffman parents: 
44133diff
changeset | 18 | assumes finite_Basis [simp]: "finite Basis" | 
| 
d12d89a66742
modify euclidean_space class to include basis set
 huffman parents: 
44133diff
changeset | 19 | assumes inner_Basis: | 
| 
d12d89a66742
modify euclidean_space class to include basis set
 huffman parents: 
44133diff
changeset | 20 | "\<lbrakk>u \<in> Basis; v \<in> Basis\<rbrakk> \<Longrightarrow> inner u v = (if u = v then 1 else 0)" | 
| 
d12d89a66742
modify euclidean_space class to include basis set
 huffman parents: 
44133diff
changeset | 21 | assumes euclidean_all_zero_iff: | 
| 
d12d89a66742
modify euclidean_space class to include basis set
 huffman parents: 
44133diff
changeset | 22 | "(\<forall>u\<in>Basis. inner x u = 0) \<longleftrightarrow> (x = 0)" | 
| 
d12d89a66742
modify euclidean_space class to include basis set
 huffman parents: 
44133diff
changeset | 23 | |
| 63141 
7e5084ad95aa
recovered printing of DIM('a) (cf. 899c9c4e4a4c);
 wenzelm parents: 
63114diff
changeset | 24 | syntax "_type_dimension" :: "type \<Rightarrow> nat"  ("(1DIM/(1'(_')))")
 | 
| 
7e5084ad95aa
recovered printing of DIM('a) (cf. 899c9c4e4a4c);
 wenzelm parents: 
63114diff
changeset | 25 | translations "DIM('a)" \<rightharpoonup> "CONST card (CONST Basis :: 'a set)"
 | 
| 
7e5084ad95aa
recovered printing of DIM('a) (cf. 899c9c4e4a4c);
 wenzelm parents: 
63114diff
changeset | 26 | typed_print_translation \<open> | 
| 
7e5084ad95aa
recovered printing of DIM('a) (cf. 899c9c4e4a4c);
 wenzelm parents: 
63114diff
changeset | 27 |   [(@{const_syntax card},
 | 
| 
7e5084ad95aa
recovered printing of DIM('a) (cf. 899c9c4e4a4c);
 wenzelm parents: 
63114diff
changeset | 28 |     fn ctxt => fn _ => fn [Const (@{const_syntax Basis}, Type (@{type_name set}, [T]))] =>
 | 
| 
7e5084ad95aa
recovered printing of DIM('a) (cf. 899c9c4e4a4c);
 wenzelm parents: 
63114diff
changeset | 29 |       Syntax.const @{syntax_const "_type_dimension"} $ Syntax_Phases.term_of_typ ctxt T)]
 | 
| 
7e5084ad95aa
recovered printing of DIM('a) (cf. 899c9c4e4a4c);
 wenzelm parents: 
63114diff
changeset | 30 | \<close> | 
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
36778diff
changeset | 31 | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 32 | lemma (in euclidean_space) norm_Basis[simp]: "u \<in> Basis \<Longrightarrow> norm u = 1" | 
| 44166 
d12d89a66742
modify euclidean_space class to include basis set
 huffman parents: 
44133diff
changeset | 33 | unfolding norm_eq_sqrt_inner by (simp add: inner_Basis) | 
| 
d12d89a66742
modify euclidean_space class to include basis set
 huffman parents: 
44133diff
changeset | 34 | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 35 | lemma (in euclidean_space) inner_same_Basis[simp]: "u \<in> Basis \<Longrightarrow> inner u u = 1" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 36 | by (simp add: inner_Basis) | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 37 | |
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 38 | lemma (in euclidean_space) inner_not_same_Basis: "u \<in> Basis \<Longrightarrow> v \<in> Basis \<Longrightarrow> u \<noteq> v \<Longrightarrow> inner u v = 0" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 39 | by (simp add: inner_Basis) | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 40 | |
| 44166 
d12d89a66742
modify euclidean_space class to include basis set
 huffman parents: 
44133diff
changeset | 41 | lemma (in euclidean_space) sgn_Basis: "u \<in> Basis \<Longrightarrow> sgn u = u" | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 42 | unfolding sgn_div_norm by (simp add: scaleR_one) | 
| 44166 
d12d89a66742
modify euclidean_space class to include basis set
 huffman parents: 
44133diff
changeset | 43 | |
| 
d12d89a66742
modify euclidean_space class to include basis set
 huffman parents: 
44133diff
changeset | 44 | lemma (in euclidean_space) Basis_zero [simp]: "0 \<notin> Basis" | 
| 
d12d89a66742
modify euclidean_space class to include basis set
 huffman parents: 
44133diff
changeset | 45 | proof | 
| 
d12d89a66742
modify euclidean_space class to include basis set
 huffman parents: 
44133diff
changeset | 46 | assume "0 \<in> Basis" thus "False" | 
| 
d12d89a66742
modify euclidean_space class to include basis set
 huffman parents: 
44133diff
changeset | 47 | using inner_Basis [of 0 0] by simp | 
| 
d12d89a66742
modify euclidean_space class to include basis set
 huffman parents: 
44133diff
changeset | 48 | qed | 
| 
d12d89a66742
modify euclidean_space class to include basis set
 huffman parents: 
44133diff
changeset | 49 | |
| 
d12d89a66742
modify euclidean_space class to include basis set
 huffman parents: 
44133diff
changeset | 50 | lemma (in euclidean_space) nonzero_Basis: "u \<in> Basis \<Longrightarrow> u \<noteq> 0" | 
| 
d12d89a66742
modify euclidean_space class to include basis set
 huffman parents: 
44133diff
changeset | 51 | by clarsimp | 
| 
d12d89a66742
modify euclidean_space class to include basis set
 huffman parents: 
44133diff
changeset | 52 | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 53 | lemma (in euclidean_space) SOME_Basis: "(SOME i. i \<in> Basis) \<in> Basis" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 54 | by (metis ex_in_conv nonempty_Basis someI_ex) | 
| 44166 
d12d89a66742
modify euclidean_space class to include basis set
 huffman parents: 
44133diff
changeset | 55 | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 56 | lemma (in euclidean_space) inner_setsum_left_Basis[simp]: | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 57 | "b \<in> Basis \<Longrightarrow> inner (\<Sum>i\<in>Basis. f i *\<^sub>R i) b = f b" | 
| 57418 | 58 | by (simp add: inner_setsum_left inner_Basis if_distrib comm_monoid_add_class.setsum.If_cases) | 
| 44166 
d12d89a66742
modify euclidean_space class to include basis set
 huffman parents: 
44133diff
changeset | 59 | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 60 | lemma (in euclidean_space) euclidean_eqI: | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 61 | assumes b: "\<And>b. b \<in> Basis \<Longrightarrow> inner x b = inner y b" shows "x = y" | 
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
36778diff
changeset | 62 | proof - | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 63 | from b have "\<forall>b\<in>Basis. inner (x - y) b = 0" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 64 | by (simp add: inner_diff_left) | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 65 | then show "x = y" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 66 | by (simp add: euclidean_all_zero_iff) | 
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
36778diff
changeset | 67 | qed | 
| 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
36778diff
changeset | 68 | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 69 | lemma (in euclidean_space) euclidean_eq_iff: | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 70 | "x = y \<longleftrightarrow> (\<forall>b\<in>Basis. inner x b = inner y b)" | 
| 44129 | 71 | by (auto intro: euclidean_eqI) | 
| 72 | ||
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 73 | lemma (in euclidean_space) euclidean_representation_setsum: | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 74 | "(\<Sum>i\<in>Basis. f i *\<^sub>R i) = b \<longleftrightarrow> (\<forall>i\<in>Basis. f i = inner b i)" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 75 | by (subst euclidean_eq_iff) simp | 
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
36778diff
changeset | 76 | |
| 54776 
db890d9fc5c2
ordered_euclidean_space compatible with more standard pointwise ordering on products; conditionally complete lattice with product order
 immler parents: 
53939diff
changeset | 77 | lemma (in euclidean_space) euclidean_representation_setsum': | 
| 
db890d9fc5c2
ordered_euclidean_space compatible with more standard pointwise ordering on products; conditionally complete lattice with product order
 immler parents: 
53939diff
changeset | 78 | "b = (\<Sum>i\<in>Basis. f i *\<^sub>R i) \<longleftrightarrow> (\<forall>i\<in>Basis. f i = inner b i)" | 
| 
db890d9fc5c2
ordered_euclidean_space compatible with more standard pointwise ordering on products; conditionally complete lattice with product order
 immler parents: 
53939diff
changeset | 79 | by (auto simp add: euclidean_representation_setsum[symmetric]) | 
| 
db890d9fc5c2
ordered_euclidean_space compatible with more standard pointwise ordering on products; conditionally complete lattice with product order
 immler parents: 
53939diff
changeset | 80 | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 81 | lemma (in euclidean_space) euclidean_representation: "(\<Sum>b\<in>Basis. inner x b *\<^sub>R b) = x" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 82 | unfolding euclidean_representation_setsum by simp | 
| 44129 | 83 | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 84 | lemma (in euclidean_space) choice_Basis_iff: | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 85 | fixes P :: "'a \<Rightarrow> real \<Rightarrow> bool" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 86 | shows "(\<forall>i\<in>Basis. \<exists>x. P i x) \<longleftrightarrow> (\<exists>x. \<forall>i\<in>Basis. P i (inner x i))" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 87 | unfolding bchoice_iff | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 88 | proof safe | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 89 | fix f assume "\<forall>i\<in>Basis. P i (f i)" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 90 | then show "\<exists>x. \<forall>i\<in>Basis. P i (inner x i)" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 91 | by (auto intro!: exI[of _ "\<Sum>i\<in>Basis. f i *\<^sub>R i"]) | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 92 | qed auto | 
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
36778diff
changeset | 93 | |
| 63952 
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
 paulson <lp15@cam.ac.uk> parents: 
63938diff
changeset | 94 | lemma (in euclidean_space) bchoice_Basis_iff: | 
| 
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
 paulson <lp15@cam.ac.uk> parents: 
63938diff
changeset | 95 | fixes P :: "'a \<Rightarrow> real \<Rightarrow> bool" | 
| 
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
 paulson <lp15@cam.ac.uk> parents: 
63938diff
changeset | 96 | shows "(\<forall>i\<in>Basis. \<exists>x\<in>A. P i x) \<longleftrightarrow> (\<exists>x. \<forall>i\<in>Basis. inner x i \<in> A \<and> P i (inner x i))" | 
| 
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
 paulson <lp15@cam.ac.uk> parents: 
63938diff
changeset | 97 | by (simp add: choice_Basis_iff Bex_def) | 
| 
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
 paulson <lp15@cam.ac.uk> parents: 
63938diff
changeset | 98 | |
| 63627 | 99 | lemma (in euclidean_space) euclidean_representation_setsum_fun: | 
| 60974 
6a6f15d8fbc4
New material and fixes related to the forthcoming Stone-Weierstrass development
 paulson <lp15@cam.ac.uk> parents: 
60420diff
changeset | 100 | "(\<lambda>x. \<Sum>b\<in>Basis. inner (f x) b *\<^sub>R b) = f" | 
| 
6a6f15d8fbc4
New material and fixes related to the forthcoming Stone-Weierstrass development
 paulson <lp15@cam.ac.uk> parents: 
60420diff
changeset | 101 | by (rule ext) (simp add: euclidean_representation_setsum) | 
| 
6a6f15d8fbc4
New material and fixes related to the forthcoming Stone-Weierstrass development
 paulson <lp15@cam.ac.uk> parents: 
60420diff
changeset | 102 | |
| 
6a6f15d8fbc4
New material and fixes related to the forthcoming Stone-Weierstrass development
 paulson <lp15@cam.ac.uk> parents: 
60420diff
changeset | 103 | lemma euclidean_isCont: | 
| 
6a6f15d8fbc4
New material and fixes related to the forthcoming Stone-Weierstrass development
 paulson <lp15@cam.ac.uk> parents: 
60420diff
changeset | 104 | assumes "\<And>b. b \<in> Basis \<Longrightarrow> isCont (\<lambda>x. (inner (f x) b) *\<^sub>R b) x" | 
| 
6a6f15d8fbc4
New material and fixes related to the forthcoming Stone-Weierstrass development
 paulson <lp15@cam.ac.uk> parents: 
60420diff
changeset | 105 | shows "isCont f x" | 
| 
6a6f15d8fbc4
New material and fixes related to the forthcoming Stone-Weierstrass development
 paulson <lp15@cam.ac.uk> parents: 
60420diff
changeset | 106 | apply (subst euclidean_representation_setsum_fun [symmetric]) | 
| 
6a6f15d8fbc4
New material and fixes related to the forthcoming Stone-Weierstrass development
 paulson <lp15@cam.ac.uk> parents: 
60420diff
changeset | 107 | apply (rule isCont_setsum) | 
| 
6a6f15d8fbc4
New material and fixes related to the forthcoming Stone-Weierstrass development
 paulson <lp15@cam.ac.uk> parents: 
60420diff
changeset | 108 | apply (blast intro: assms) | 
| 
6a6f15d8fbc4
New material and fixes related to the forthcoming Stone-Weierstrass development
 paulson <lp15@cam.ac.uk> parents: 
60420diff
changeset | 109 | done | 
| 
6a6f15d8fbc4
New material and fixes related to the forthcoming Stone-Weierstrass development
 paulson <lp15@cam.ac.uk> parents: 
60420diff
changeset | 110 | |
| 63938 | 111 | lemma DIM_positive [simp]: "0 < DIM('a::euclidean_space)"
 | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 112 | by (simp add: card_gt_0_iff) | 
| 44628 
bd17b7543af1
move lemmas from Topology_Euclidean_Space to Euclidean_Space
 huffman parents: 
44571diff
changeset | 113 | |
| 63938 | 114 | lemma DIM_ge_Suc0 [simp]: "Suc 0 \<le> card Basis" | 
| 63007 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62390diff
changeset | 115 | by (meson DIM_positive Suc_leI) | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62390diff
changeset | 116 | |
| 63114 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63040diff
changeset | 117 | |
| 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63040diff
changeset | 118 | lemma setsum_inner_Basis_scaleR [simp]: | 
| 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63040diff
changeset | 119 | fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_vector" | 
| 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63040diff
changeset | 120 | assumes "b \<in> Basis" shows "(\<Sum>i\<in>Basis. (inner i b) *\<^sub>R f i) = f b" | 
| 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63040diff
changeset | 121 | by (simp add: comm_monoid_add_class.setsum.remove [OF finite_Basis assms] | 
| 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63040diff
changeset | 122 | assms inner_not_same_Basis comm_monoid_add_class.setsum.neutral) | 
| 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63040diff
changeset | 123 | |
| 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63040diff
changeset | 124 | lemma setsum_inner_Basis_eq [simp]: | 
| 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63040diff
changeset | 125 | assumes "b \<in> Basis" shows "(\<Sum>i\<in>Basis. (inner i b) * f i) = f b" | 
| 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63040diff
changeset | 126 | by (simp add: comm_monoid_add_class.setsum.remove [OF finite_Basis assms] | 
| 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63040diff
changeset | 127 | assms inner_not_same_Basis comm_monoid_add_class.setsum.neutral) | 
| 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63040diff
changeset | 128 | |
| 60420 | 129 | subsection \<open>Subclass relationships\<close> | 
| 44571 | 130 | |
| 131 | instance euclidean_space \<subseteq> perfect_space | |
| 132 | proof | |
| 133 |   fix x :: 'a show "\<not> open {x}"
 | |
| 134 | proof | |
| 135 |     assume "open {x}"
 | |
| 136 | then obtain e where "0 < e" and e: "\<forall>y. dist y x < e \<longrightarrow> y = x" | |
| 137 | unfolding open_dist by fast | |
| 63040 | 138 | define y where "y = x + scaleR (e/2) (SOME b. b \<in> Basis)" | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 139 | have [simp]: "(SOME b. b \<in> Basis) \<in> Basis" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 140 | by (rule someI_ex) (auto simp: ex_in_conv) | 
| 60420 | 141 | from \<open>0 < e\<close> have "y \<noteq> x" | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 142 | unfolding y_def by (auto intro!: nonzero_Basis) | 
| 60420 | 143 | from \<open>0 < e\<close> have "dist y x < e" | 
| 53939 | 144 | unfolding y_def by (simp add: dist_norm) | 
| 60420 | 145 | from \<open>y \<noteq> x\<close> and \<open>dist y x < e\<close> show "False" | 
| 44571 | 146 | using e by simp | 
| 147 | qed | |
| 148 | qed | |
| 149 | ||
| 60420 | 150 | subsection \<open>Class instances\<close> | 
| 33175 | 151 | |
| 60420 | 152 | subsubsection \<open>Type @{typ real}\<close>
 | 
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
36778diff
changeset | 153 | |
| 44129 | 154 | instantiation real :: euclidean_space | 
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
36778diff
changeset | 155 | begin | 
| 44129 | 156 | |
| 63627 | 157 | definition | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 158 |   [simp]: "Basis = {1::real}"
 | 
| 44129 | 159 | |
| 160 | instance | |
| 61169 | 161 | by standard auto | 
| 44129 | 162 | |
| 163 | end | |
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
36778diff
changeset | 164 | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 165 | lemma DIM_real[simp]: "DIM(real) = 1" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 166 | by simp | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 167 | |
| 60420 | 168 | subsubsection \<open>Type @{typ complex}\<close>
 | 
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
36778diff
changeset | 169 | |
| 44129 | 170 | instantiation complex :: euclidean_space | 
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
36778diff
changeset | 171 | begin | 
| 44129 | 172 | |
| 63589 | 173 | definition Basis_complex_def: "Basis = {1, \<i>}"
 | 
| 44166 
d12d89a66742
modify euclidean_space class to include basis set
 huffman parents: 
44133diff
changeset | 174 | |
| 
d12d89a66742
modify euclidean_space class to include basis set
 huffman parents: 
44133diff
changeset | 175 | instance | 
| 62390 | 176 | by standard (auto simp add: Basis_complex_def intro: complex_eqI split: if_split_asm) | 
| 44129 | 177 | |
| 178 | end | |
| 179 | ||
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
36778diff
changeset | 180 | lemma DIM_complex[simp]: "DIM(complex) = 2" | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 181 | unfolding Basis_complex_def by simp | 
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
36778diff
changeset | 182 | |
| 60420 | 183 | subsubsection \<open>Type @{typ "'a \<times> 'b"}\<close>
 | 
| 38656 | 184 | |
| 44129 | 185 | instantiation prod :: (euclidean_space, euclidean_space) euclidean_space | 
| 38656 | 186 | begin | 
| 187 | ||
| 44129 | 188 | definition | 
| 44166 
d12d89a66742
modify euclidean_space class to include basis set
 huffman parents: 
44133diff
changeset | 189 | "Basis = (\<lambda>u. (u, 0)) ` Basis \<union> (\<lambda>v. (0, v)) ` Basis" | 
| 
d12d89a66742
modify euclidean_space class to include basis set
 huffman parents: 
44133diff
changeset | 190 | |
| 54781 | 191 | lemma setsum_Basis_prod_eq: | 
| 192 |   fixes f::"('a*'b)\<Rightarrow>('a*'b)"
 | |
| 193 | shows "setsum f Basis = setsum (\<lambda>i. f (i, 0)) Basis + setsum (\<lambda>i. f (0, i)) Basis" | |
| 194 | proof - | |
| 195 | have "inj_on (\<lambda>u. (u::'a, 0::'b)) Basis" "inj_on (\<lambda>u. (0::'a, u::'b)) Basis" | |
| 196 | by (auto intro!: inj_onI Pair_inject) | |
| 197 | thus ?thesis | |
| 198 | unfolding Basis_prod_def | |
| 57418 | 199 | by (subst setsum.union_disjoint) (auto simp: Basis_prod_def setsum.reindex) | 
| 54781 | 200 | qed | 
| 201 | ||
| 44129 | 202 | instance proof | 
| 44166 
d12d89a66742
modify euclidean_space class to include basis set
 huffman parents: 
44133diff
changeset | 203 |   show "(Basis :: ('a \<times> 'b) set) \<noteq> {}"
 | 
| 
d12d89a66742
modify euclidean_space class to include basis set
 huffman parents: 
44133diff
changeset | 204 | unfolding Basis_prod_def by simp | 
| 44129 | 205 | next | 
| 44166 
d12d89a66742
modify euclidean_space class to include basis set
 huffman parents: 
44133diff
changeset | 206 |   show "finite (Basis :: ('a \<times> 'b) set)"
 | 
| 
d12d89a66742
modify euclidean_space class to include basis set
 huffman parents: 
44133diff
changeset | 207 | unfolding Basis_prod_def by simp | 
| 44129 | 208 | next | 
| 44166 
d12d89a66742
modify euclidean_space class to include basis set
 huffman parents: 
44133diff
changeset | 209 | fix u v :: "'a \<times> 'b" | 
| 
d12d89a66742
modify euclidean_space class to include basis set
 huffman parents: 
44133diff
changeset | 210 | assume "u \<in> Basis" and "v \<in> Basis" | 
| 
d12d89a66742
modify euclidean_space class to include basis set
 huffman parents: 
44133diff
changeset | 211 | thus "inner u v = (if u = v then 1 else 0)" | 
| 
d12d89a66742
modify euclidean_space class to include basis set
 huffman parents: 
44133diff
changeset | 212 | unfolding Basis_prod_def inner_prod_def | 
| 62390 | 213 | by (auto simp add: inner_Basis split: if_split_asm) | 
| 44129 | 214 | next | 
| 215 | fix x :: "'a \<times> 'b" | |
| 44166 
d12d89a66742
modify euclidean_space class to include basis set
 huffman parents: 
44133diff
changeset | 216 | show "(\<forall>u\<in>Basis. inner x u = 0) \<longleftrightarrow> x = 0" | 
| 
d12d89a66742
modify euclidean_space class to include basis set
 huffman parents: 
44133diff
changeset | 217 | unfolding Basis_prod_def ball_Un ball_simps | 
| 
d12d89a66742
modify euclidean_space class to include basis set
 huffman parents: 
44133diff
changeset | 218 | by (simp add: inner_prod_def prod_eq_iff euclidean_all_zero_iff) | 
| 38656 | 219 | qed | 
| 44129 | 220 | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 221 | lemma DIM_prod[simp]: "DIM('a \<times> 'b) = DIM('a) + DIM('b)"
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 222 | unfolding Basis_prod_def | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 223 | by (subst card_Un_disjoint) (auto intro!: card_image arg_cong2[where f="op +"] inj_onI) | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
44902diff
changeset | 224 | |
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
36778diff
changeset | 225 | end | 
| 38656 | 226 | |
| 227 | end |