| author | wenzelm | 
| Mon, 05 Nov 2018 20:53:16 +0100 | |
| changeset 69242 | c911716d29bb | 
| parent 69064 | 5840724b1d71 | 
| child 69260 | 0a9688695a1b | 
| permissions | -rw-r--r-- | 
| 63627 | 1  | 
(* Title: HOL/Analysis/Finite_Cartesian_Product.thy  | 
| 35253 | 2  | 
Author: Amine Chaieb, University of Cambridge  | 
| 33175 | 3  | 
*)  | 
4  | 
||
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
5  | 
section%important \<open>Definition of finite Cartesian product types\<close>  | 
| 33175 | 6  | 
|
7  | 
theory Finite_Cartesian_Product  | 
|
| 
41413
 
64cd30d6b0b8
explicit file specifications -- avoid secondary load path;
 
wenzelm 
parents: 
39302 
diff
changeset
 | 
8  | 
imports  | 
| 
44135
 
18b4ab6854f1
move euclidean_space instance from Cartesian_Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
42290 
diff
changeset
 | 
9  | 
Euclidean_Space  | 
| 
41413
 
64cd30d6b0b8
explicit file specifications -- avoid secondary load path;
 
wenzelm 
parents: 
39302 
diff
changeset
 | 
10  | 
L2_Norm  | 
| 
66453
 
cc19f7ca2ed6
session-qualified theory imports: isabelle imports -U -i -d '~~/src/Benchmarks' -a;
 
wenzelm 
parents: 
66281 
diff
changeset
 | 
11  | 
"HOL-Library.Numeral_Type"  | 
| 
 
cc19f7ca2ed6
session-qualified theory imports: isabelle imports -U -i -d '~~/src/Benchmarks' -a;
 
wenzelm 
parents: 
66281 
diff
changeset
 | 
12  | 
"HOL-Library.Countable_Set"  | 
| 
68188
 
2af1f142f855
move FuncSet back to HOL-Library (amending 493b818e8e10)
 
immler 
parents: 
68074 
diff
changeset
 | 
13  | 
"HOL-Library.FuncSet"  | 
| 33175 | 14  | 
begin  | 
15  | 
||
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
16  | 
subsection%unimportant \<open>Finite Cartesian products, with indexing and lambdas\<close>  | 
| 33175 | 17  | 
|
| 67731 | 18  | 
typedef ('a, 'b) vec = "UNIV :: ('b::finite \<Rightarrow> 'a) set"
 | 
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
19  | 
morphisms vec_nth vec_lambda ..  | 
| 33175 | 20  | 
|
| 
67673
 
c8caefb20564
lots of new material, ultimately related to measure theory
 
paulson <lp15@cam.ac.uk> 
parents: 
67399 
diff
changeset
 | 
21  | 
declare vec_lambda_inject [simplified, simp]  | 
| 
 
c8caefb20564
lots of new material, ultimately related to measure theory
 
paulson <lp15@cam.ac.uk> 
parents: 
67399 
diff
changeset
 | 
22  | 
|
| 
67685
 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 
immler 
parents: 
67673 
diff
changeset
 | 
23  | 
bundle vec_syntax begin  | 
| 
35254
 
0f17eda72e60
binder notation for default print_mode -- to avoid strange output if "xsymbols" is not active;
 
wenzelm 
parents: 
35253 
diff
changeset
 | 
24  | 
notation  | 
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
25  | 
vec_nth (infixl "$" 90) and  | 
| 
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
26  | 
vec_lambda (binder "\<chi>" 10)  | 
| 
67685
 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 
immler 
parents: 
67673 
diff
changeset
 | 
27  | 
end  | 
| 
 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 
immler 
parents: 
67673 
diff
changeset
 | 
28  | 
|
| 
 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 
immler 
parents: 
67673 
diff
changeset
 | 
29  | 
bundle no_vec_syntax begin  | 
| 
 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 
immler 
parents: 
67673 
diff
changeset
 | 
30  | 
no_notation  | 
| 
 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 
immler 
parents: 
67673 
diff
changeset
 | 
31  | 
vec_nth (infixl "$" 90) and  | 
| 
 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 
immler 
parents: 
67673 
diff
changeset
 | 
32  | 
vec_lambda (binder "\<chi>" 10)  | 
| 
 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 
immler 
parents: 
67673 
diff
changeset
 | 
33  | 
end  | 
| 
 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 
immler 
parents: 
67673 
diff
changeset
 | 
34  | 
|
| 
 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 
immler 
parents: 
67673 
diff
changeset
 | 
35  | 
unbundle vec_syntax  | 
| 33175 | 36  | 
|
| 67731 | 37  | 
text \<open>  | 
38  | 
  Concrete syntax for \<open>('a, 'b) vec\<close>:
 | 
|
39  | 
    \<^item> \<open>'a^'b\<close> becomes \<open>('a, 'b::finite) vec\<close>
 | 
|
40  | 
    \<^item> \<open>'a^'b::_\<close> becomes \<open>('a, 'b) vec\<close> without extra sort-constraint
 | 
|
41  | 
\<close>  | 
|
| 67732 | 42  | 
syntax "_vec_type" :: "type \<Rightarrow> type \<Rightarrow> type" (infixl "^" 15)  | 
| 60420 | 43  | 
parse_translation \<open>  | 
| 52143 | 44  | 
let  | 
45  | 
    fun vec t u = Syntax.const @{type_syntax vec} $ t $ u;
 | 
|
46  | 
fun finite_vec_tr [t, u] =  | 
|
47  | 
(case Term_Position.strip_positions u of  | 
|
48  | 
v as Free (x, _) =>  | 
|
49  | 
if Lexicon.is_tid x then  | 
|
50  | 
            vec t (Syntax.const @{syntax_const "_ofsort"} $ v $
 | 
|
51  | 
              Syntax.const @{class_syntax finite})
 | 
|
52  | 
else vec t u  | 
|
53  | 
| _ => vec t u)  | 
|
54  | 
in  | 
|
| 67732 | 55  | 
    [(@{syntax_const "_vec_type"}, K finite_vec_tr)]
 | 
| 52143 | 56  | 
end  | 
| 60420 | 57  | 
\<close>  | 
| 
34290
 
1edf0f223c6e
added syntax translation to automatically add finite typeclass to index type of cartesian product type
 
hoelzl 
parents: 
34289 
diff
changeset
 | 
58  | 
|
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
59  | 
lemma vec_eq_iff: "(x = y) \<longleftrightarrow> (\<forall>i. x$i = y$i)"  | 
| 
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
60  | 
by (simp add: vec_nth_inject [symmetric] fun_eq_iff)  | 
| 33175 | 61  | 
|
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
62  | 
lemma vec_lambda_beta [simp]: "vec_lambda g $ i = g i"  | 
| 
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
63  | 
by (simp add: vec_lambda_inverse)  | 
| 33175 | 64  | 
|
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
65  | 
lemma vec_lambda_unique: "(\<forall>i. f$i = g i) \<longleftrightarrow> vec_lambda g = f"  | 
| 
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
66  | 
by (auto simp add: vec_eq_iff)  | 
| 33175 | 67  | 
|
| 
67673
 
c8caefb20564
lots of new material, ultimately related to measure theory
 
paulson <lp15@cam.ac.uk> 
parents: 
67399 
diff
changeset
 | 
68  | 
lemma vec_lambda_eta [simp]: "(\<chi> i. (g$i)) = g"  | 
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
69  | 
by (simp add: vec_eq_iff)  | 
| 33175 | 70  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
71  | 
subsection%important \<open>Cardinality of vectors\<close>  | 
| 
66281
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
72  | 
|
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
73  | 
instance vec :: (finite, finite) finite  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
74  | 
proof  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
75  | 
  show "finite (UNIV :: ('a, 'b) vec set)"
 | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
76  | 
proof (subst bij_betw_finite)  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
77  | 
show "bij_betw vec_nth UNIV (Pi (UNIV :: 'b set) (\<lambda>_. UNIV :: 'a set))"  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
78  | 
by (intro bij_betwI[of _ _ _ vec_lambda]) (auto simp: vec_eq_iff)  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
79  | 
have "finite (PiE (UNIV :: 'b set) (\<lambda>_. UNIV :: 'a set))"  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
80  | 
by (intro finite_PiE) auto  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
81  | 
also have "(PiE (UNIV :: 'b set) (\<lambda>_. UNIV :: 'a set)) = Pi UNIV (\<lambda>_. UNIV)"  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
82  | 
by auto  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
83  | 
finally show "finite \<dots>" .  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
84  | 
qed  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
85  | 
qed  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
86  | 
|
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
87  | 
lemma countable_PiE:  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
88  | 
"finite I \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> countable (F i)) \<Longrightarrow> countable (Pi\<^sub>E I F)"  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
89  | 
by (induct I arbitrary: F rule: finite_induct) (auto simp: PiE_insert_eq)  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
90  | 
|
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
91  | 
instance vec :: (countable, finite) countable  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
92  | 
proof  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
93  | 
  have "countable (UNIV :: ('a, 'b) vec set)"
 | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
94  | 
proof (rule countableI_bij2)  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
95  | 
show "bij_betw vec_nth UNIV (Pi (UNIV :: 'b set) (\<lambda>_. UNIV :: 'a set))"  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
96  | 
by (intro bij_betwI[of _ _ _ vec_lambda]) (auto simp: vec_eq_iff)  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
97  | 
have "countable (PiE (UNIV :: 'b set) (\<lambda>_. UNIV :: 'a set))"  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
98  | 
by (intro countable_PiE) auto  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
99  | 
also have "(PiE (UNIV :: 'b set) (\<lambda>_. UNIV :: 'a set)) = Pi UNIV (\<lambda>_. UNIV)"  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
100  | 
by auto  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
101  | 
finally show "countable \<dots>" .  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
102  | 
qed  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
103  | 
  thus "\<exists>t::('a, 'b) vec \<Rightarrow> nat. inj t"
 | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
104  | 
by (auto elim!: countableE)  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
105  | 
qed  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
106  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
107  | 
lemma%important infinite_UNIV_vec:  | 
| 
66281
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
108  | 
assumes "infinite (UNIV :: 'a set)"  | 
| 67731 | 109  | 
  shows   "infinite (UNIV :: ('a^'b) set)"
 | 
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
110  | 
proof%unimportant (subst bij_betw_finite)  | 
| 
66281
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
111  | 
show "bij_betw vec_nth UNIV (Pi (UNIV :: 'b set) (\<lambda>_. UNIV :: 'a set))"  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
112  | 
by (intro bij_betwI[of _ _ _ vec_lambda]) (auto simp: vec_eq_iff)  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
113  | 
have "infinite (PiE (UNIV :: 'b set) (\<lambda>_. UNIV :: 'a set))" (is "infinite ?A")  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
114  | 
proof  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
115  | 
assume "finite ?A"  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
116  | 
hence "finite ((\<lambda>f. f undefined) ` ?A)"  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
117  | 
by (rule finite_imageI)  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
118  | 
also have "(\<lambda>f. f undefined) ` ?A = UNIV"  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
119  | 
by auto  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
120  | 
finally show False  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
121  | 
using \<open>infinite (UNIV :: 'a set)\<close> by contradiction  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
122  | 
qed  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
123  | 
also have "?A = Pi UNIV (\<lambda>_. UNIV)"  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
124  | 
by auto  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
125  | 
finally show "infinite (Pi (UNIV :: 'b set) (\<lambda>_. UNIV :: 'a set))" .  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
126  | 
qed  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
127  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
128  | 
lemma%important CARD_vec [simp]:  | 
| 67731 | 129  | 
  "CARD('a^'b) = CARD('a) ^ CARD('b)"
 | 
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
130  | 
proof%unimportant (cases "finite (UNIV :: 'a set)")  | 
| 
66281
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
131  | 
case True  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
132  | 
show ?thesis  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
133  | 
proof (subst bij_betw_same_card)  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
134  | 
show "bij_betw vec_nth UNIV (Pi (UNIV :: 'b set) (\<lambda>_. UNIV :: 'a set))"  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
135  | 
by (intro bij_betwI[of _ _ _ vec_lambda]) (auto simp: vec_eq_iff)  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
136  | 
    have "CARD('a) ^ CARD('b) = card (PiE (UNIV :: 'b set) (\<lambda>_. UNIV :: 'a set))"
 | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
137  | 
(is "_ = card ?A")  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
138  | 
by (subst card_PiE) (auto simp: prod_constant)  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
139  | 
|
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
140  | 
also have "?A = Pi UNIV (\<lambda>_. UNIV)"  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
141  | 
by auto  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
142  | 
    finally show "card \<dots> = CARD('a) ^ CARD('b)" ..
 | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
143  | 
qed  | 
| 
 
6ad54b84ca5d
facts about cardinality of vector type
 
eberlm <eberlm@in.tum.de> 
parents: 
64267 
diff
changeset
 | 
144  | 
qed (simp_all add: infinite_UNIV_vec)  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
145  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
146  | 
lemma%unimportant countable_vector:  | 
| 
67683
 
817944aeac3f
Lots of new material about matrices, etc.
 
paulson <lp15@cam.ac.uk> 
parents: 
67673 
diff
changeset
 | 
147  | 
fixes B:: "'n::finite \<Rightarrow> 'a set"  | 
| 
 
817944aeac3f
Lots of new material about matrices, etc.
 
paulson <lp15@cam.ac.uk> 
parents: 
67673 
diff
changeset
 | 
148  | 
assumes "\<And>i. countable (B i)"  | 
| 
 
817944aeac3f
Lots of new material about matrices, etc.
 
paulson <lp15@cam.ac.uk> 
parents: 
67673 
diff
changeset
 | 
149  | 
  shows "countable {V. \<forall>i::'n::finite. V $ i \<in> B i}"
 | 
| 
 
817944aeac3f
Lots of new material about matrices, etc.
 
paulson <lp15@cam.ac.uk> 
parents: 
67673 
diff
changeset
 | 
150  | 
proof -  | 
| 
 
817944aeac3f
Lots of new material about matrices, etc.
 
paulson <lp15@cam.ac.uk> 
parents: 
67673 
diff
changeset
 | 
151  | 
  have "f \<in> ($) ` {V. \<forall>i. V $ i \<in> B i}" if "f \<in> Pi\<^sub>E UNIV B" for f
 | 
| 
 
817944aeac3f
Lots of new material about matrices, etc.
 
paulson <lp15@cam.ac.uk> 
parents: 
67673 
diff
changeset
 | 
152  | 
proof -  | 
| 
 
817944aeac3f
Lots of new material about matrices, etc.
 
paulson <lp15@cam.ac.uk> 
parents: 
67673 
diff
changeset
 | 
153  | 
have "\<exists>W. (\<forall>i. W $ i \<in> B i) \<and> ($) W = f"  | 
| 
 
817944aeac3f
Lots of new material about matrices, etc.
 
paulson <lp15@cam.ac.uk> 
parents: 
67673 
diff
changeset
 | 
154  | 
by (metis that PiE_iff UNIV_I vec_lambda_inverse)  | 
| 
 
817944aeac3f
Lots of new material about matrices, etc.
 
paulson <lp15@cam.ac.uk> 
parents: 
67673 
diff
changeset
 | 
155  | 
    then show "f \<in> ($) ` {v. \<forall>i. v $ i \<in> B i}"
 | 
| 
 
817944aeac3f
Lots of new material about matrices, etc.
 
paulson <lp15@cam.ac.uk> 
parents: 
67673 
diff
changeset
 | 
156  | 
by blast  | 
| 
 
817944aeac3f
Lots of new material about matrices, etc.
 
paulson <lp15@cam.ac.uk> 
parents: 
67673 
diff
changeset
 | 
157  | 
qed  | 
| 
 
817944aeac3f
Lots of new material about matrices, etc.
 
paulson <lp15@cam.ac.uk> 
parents: 
67673 
diff
changeset
 | 
158  | 
  then have "Pi\<^sub>E UNIV B = vec_nth ` {V. \<forall>i::'n. V $ i \<in> B i}"
 | 
| 
 
817944aeac3f
Lots of new material about matrices, etc.
 
paulson <lp15@cam.ac.uk> 
parents: 
67673 
diff
changeset
 | 
159  | 
by blast  | 
| 
 
817944aeac3f
Lots of new material about matrices, etc.
 
paulson <lp15@cam.ac.uk> 
parents: 
67673 
diff
changeset
 | 
160  | 
  then have "countable (vec_nth ` {V. \<forall>i. V $ i \<in> B i})"
 | 
| 
 
817944aeac3f
Lots of new material about matrices, etc.
 
paulson <lp15@cam.ac.uk> 
parents: 
67673 
diff
changeset
 | 
161  | 
by (metis finite_class.finite_UNIV countable_PiE assms)  | 
| 
 
817944aeac3f
Lots of new material about matrices, etc.
 
paulson <lp15@cam.ac.uk> 
parents: 
67673 
diff
changeset
 | 
162  | 
  then have "countable (vec_lambda ` vec_nth ` {V. \<forall>i. V $ i \<in> B i})"
 | 
| 
 
817944aeac3f
Lots of new material about matrices, etc.
 
paulson <lp15@cam.ac.uk> 
parents: 
67673 
diff
changeset
 | 
163  | 
by auto  | 
| 
 
817944aeac3f
Lots of new material about matrices, etc.
 
paulson <lp15@cam.ac.uk> 
parents: 
67673 
diff
changeset
 | 
164  | 
then show ?thesis  | 
| 
 
817944aeac3f
Lots of new material about matrices, etc.
 
paulson <lp15@cam.ac.uk> 
parents: 
67673 
diff
changeset
 | 
165  | 
by (simp add: image_comp o_def vec_nth_inverse)  | 
| 
 
817944aeac3f
Lots of new material about matrices, etc.
 
paulson <lp15@cam.ac.uk> 
parents: 
67673 
diff
changeset
 | 
166  | 
qed  | 
| 
 
817944aeac3f
Lots of new material about matrices, etc.
 
paulson <lp15@cam.ac.uk> 
parents: 
67673 
diff
changeset
 | 
167  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
168  | 
subsection%unimportant \<open>Group operations and class instances\<close>  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
169  | 
|
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
170  | 
instantiation vec :: (zero, finite) zero  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
171  | 
begin  | 
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
172  | 
definition "0 \<equiv> (\<chi> i. 0)"  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
173  | 
instance ..  | 
| 33175 | 174  | 
end  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
175  | 
|
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
176  | 
instantiation vec :: (plus, finite) plus  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
177  | 
begin  | 
| 67399 | 178  | 
definition "(+) \<equiv> (\<lambda> x y. (\<chi> i. x$i + y$i))"  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
179  | 
instance ..  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
180  | 
end  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
181  | 
|
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
182  | 
instantiation vec :: (minus, finite) minus  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
183  | 
begin  | 
| 67399 | 184  | 
definition "(-) \<equiv> (\<lambda> x y. (\<chi> i. x$i - y$i))"  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
185  | 
instance ..  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
186  | 
end  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
187  | 
|
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
188  | 
instantiation vec :: (uminus, finite) uminus  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
189  | 
begin  | 
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
190  | 
definition "uminus \<equiv> (\<lambda> x. (\<chi> i. - (x$i)))"  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
191  | 
instance ..  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
192  | 
end  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
193  | 
|
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
194  | 
lemma zero_index [simp]: "0 $ i = 0"  | 
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
195  | 
unfolding zero_vec_def by simp  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
196  | 
|
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
197  | 
lemma vector_add_component [simp]: "(x + y)$i = x$i + y$i"  | 
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
198  | 
unfolding plus_vec_def by simp  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
199  | 
|
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
200  | 
lemma vector_minus_component [simp]: "(x - y)$i = x$i - y$i"  | 
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
201  | 
unfolding minus_vec_def by simp  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
202  | 
|
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
203  | 
lemma vector_uminus_component [simp]: "(- x)$i = - (x$i)"  | 
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
204  | 
unfolding uminus_vec_def by simp  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
205  | 
|
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
206  | 
instance vec :: (semigroup_add, finite) semigroup_add  | 
| 61169 | 207  | 
by standard (simp add: vec_eq_iff add.assoc)  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
208  | 
|
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
209  | 
instance vec :: (ab_semigroup_add, finite) ab_semigroup_add  | 
| 61169 | 210  | 
by standard (simp add: vec_eq_iff add.commute)  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
211  | 
|
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
212  | 
instance vec :: (monoid_add, finite) monoid_add  | 
| 61169 | 213  | 
by standard (simp_all add: vec_eq_iff)  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
214  | 
|
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
215  | 
instance vec :: (comm_monoid_add, finite) comm_monoid_add  | 
| 61169 | 216  | 
by standard (simp add: vec_eq_iff)  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
217  | 
|
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
218  | 
instance vec :: (cancel_semigroup_add, finite) cancel_semigroup_add  | 
| 61169 | 219  | 
by standard (simp_all add: vec_eq_iff)  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
220  | 
|
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
221  | 
instance vec :: (cancel_ab_semigroup_add, finite) cancel_ab_semigroup_add  | 
| 61169 | 222  | 
by standard (simp_all add: vec_eq_iff diff_diff_eq)  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
223  | 
|
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
224  | 
instance vec :: (cancel_comm_monoid_add, finite) cancel_comm_monoid_add ..  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
225  | 
|
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
226  | 
instance vec :: (group_add, finite) group_add  | 
| 61169 | 227  | 
by standard (simp_all add: vec_eq_iff)  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
228  | 
|
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
229  | 
instance vec :: (ab_group_add, finite) ab_group_add  | 
| 61169 | 230  | 
by standard (simp_all add: vec_eq_iff)  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
231  | 
|
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
232  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
233  | 
subsection%unimportant\<open>Basic componentwise operations on vectors\<close>  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
234  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
235  | 
instantiation vec :: (times, finite) times  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
236  | 
begin  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
237  | 
|
| 
69064
 
5840724b1d71
Prefix form of infix with * on either side no longer needs special treatment
 
nipkow 
parents: 
68833 
diff
changeset
 | 
238  | 
definition "(*) \<equiv> (\<lambda> x y. (\<chi> i. (x$i) * (y$i)))"  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
239  | 
instance ..  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
240  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
241  | 
end  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
242  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
243  | 
instantiation vec :: (one, finite) one  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
244  | 
begin  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
245  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
246  | 
definition "1 \<equiv> (\<chi> i. 1)"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
247  | 
instance ..  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
248  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
249  | 
end  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
250  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
251  | 
instantiation vec :: (ord, finite) ord  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
252  | 
begin  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
253  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
254  | 
definition "x \<le> y \<longleftrightarrow> (\<forall>i. x$i \<le> y$i)"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
255  | 
definition "x < (y::'a^'b) \<longleftrightarrow> x \<le> y \<and> \<not> y \<le> x"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
256  | 
instance ..  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
257  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
258  | 
end  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
259  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
260  | 
text\<open>The ordering on one-dimensional vectors is linear.\<close>  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
261  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
262  | 
class cart_one =  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
263  | 
assumes UNIV_one: "card (UNIV :: 'a set) = Suc 0"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
264  | 
begin  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
265  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
266  | 
subclass finite  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
267  | 
proof  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
268  | 
from UNIV_one show "finite (UNIV :: 'a set)"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
269  | 
by (auto intro!: card_ge_0_finite)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
270  | 
qed  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
271  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
272  | 
end  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
273  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
274  | 
instance vec:: (order, finite) order  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
275  | 
by standard (auto simp: less_eq_vec_def less_vec_def vec_eq_iff  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
276  | 
intro: order.trans order.antisym order.strict_implies_order)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
277  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
278  | 
instance vec :: (linorder, cart_one) linorder  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
279  | 
proof  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
280  | 
obtain a :: 'b where all: "\<And>P. (\<forall>i. P i) \<longleftrightarrow> P a"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
281  | 
proof -  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
282  | 
have "card (UNIV :: 'b set) = Suc 0" by (rule UNIV_one)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
283  | 
    then obtain b :: 'b where "UNIV = {b}" by (auto iff: card_Suc_eq)
 | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
284  | 
then have "\<And>P. (\<forall>i\<in>UNIV. P i) \<longleftrightarrow> P b" by auto  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
285  | 
then show thesis by (auto intro: that)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
286  | 
qed  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
287  | 
fix x y :: "'a^'b::cart_one"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
288  | 
note [simp] = less_eq_vec_def less_vec_def all vec_eq_iff field_simps  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
289  | 
show "x \<le> y \<or> y \<le> x" by auto  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
290  | 
qed  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
291  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
292  | 
text\<open>Constant Vectors\<close>  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
293  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
294  | 
definition "vec x = (\<chi> i. x)"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
295  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
296  | 
text\<open>Also the scalar-vector multiplication.\<close>  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
297  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
298  | 
definition vector_scalar_mult:: "'a::times \<Rightarrow> 'a ^ 'n \<Rightarrow> 'a ^ 'n" (infixl "*s" 70)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
299  | 
where "c *s x = (\<chi> i. c * (x$i))"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
300  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
301  | 
text \<open>scalar product\<close>  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
302  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
303  | 
definition scalar_product :: "'a :: semiring_1 ^ 'n \<Rightarrow> 'a ^ 'n \<Rightarrow> 'a" where  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
304  | 
"scalar_product v w = (\<Sum> i \<in> UNIV. v $ i * w $ i)"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
305  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
306  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
307  | 
subsection%important \<open>Real vector space\<close>  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
308  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
309  | 
instantiation%unimportant vec :: (real_vector, finite) real_vector  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
310  | 
begin  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
311  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
312  | 
definition%important "scaleR \<equiv> (\<lambda> r x. (\<chi> i. scaleR r (x$i)))"  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
313  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
314  | 
lemma%important vector_scaleR_component [simp]: "(scaleR r x)$i = scaleR r (x$i)"  | 
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
315  | 
unfolding scaleR_vec_def by simp  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
316  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
317  | 
instance%unimportant  | 
| 61169 | 318  | 
by standard (simp_all add: vec_eq_iff scaleR_left_distrib scaleR_right_distrib)  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
319  | 
|
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
320  | 
end  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
321  | 
|
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
322  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
323  | 
subsection%important \<open>Topological space\<close>  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
324  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
325  | 
instantiation%unimportant vec :: (topological_space, finite) topological_space  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
326  | 
begin  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
327  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
328  | 
definition%important [code del]:  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
329  | 
  "open (S :: ('a ^ 'b) set) \<longleftrightarrow>
 | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
330  | 
(\<forall>x\<in>S. \<exists>A. (\<forall>i. open (A i) \<and> x$i \<in> A i) \<and>  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
331  | 
(\<forall>y. (\<forall>i. y$i \<in> A i) \<longrightarrow> y \<in> S))"  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
332  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
333  | 
instance proof%unimportant  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
334  | 
  show "open (UNIV :: ('a ^ 'b) set)"
 | 
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
335  | 
unfolding open_vec_def by auto  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
336  | 
next  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
337  | 
  fix S T :: "('a ^ 'b) set"
 | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
338  | 
assume "open S" "open T" thus "open (S \<inter> T)"  | 
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
339  | 
unfolding open_vec_def  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
340  | 
apply clarify  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
341  | 
apply (drule (1) bspec)+  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
342  | 
apply (clarify, rename_tac Sa Ta)  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
343  | 
apply (rule_tac x="\<lambda>i. Sa i \<inter> Ta i" in exI)  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
344  | 
apply (simp add: open_Int)  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
345  | 
done  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
346  | 
next  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
347  | 
  fix K :: "('a ^ 'b) set set"
 | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
348  | 
assume "\<forall>S\<in>K. open S" thus "open (\<Union>K)"  | 
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
349  | 
unfolding open_vec_def  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
350  | 
apply clarify  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
351  | 
apply (drule (1) bspec)  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
352  | 
apply (drule (1) bspec)  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
353  | 
apply clarify  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
354  | 
apply (rule_tac x=A in exI)  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
355  | 
apply fast  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
356  | 
done  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
357  | 
qed  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
358  | 
|
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
359  | 
end  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
360  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
361  | 
lemma%unimportant open_vector_box: "\<forall>i. open (S i) \<Longrightarrow> open {x. \<forall>i. x $ i \<in> S i}"
 | 
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
362  | 
unfolding open_vec_def by auto  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
363  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
364  | 
lemma%unimportant open_vimage_vec_nth: "open S \<Longrightarrow> open ((\<lambda>x. x $ i) -` S)"  | 
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
365  | 
unfolding open_vec_def  | 
| 
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
366  | 
apply clarify  | 
| 
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
367  | 
apply (rule_tac x="\<lambda>k. if k = i then S else UNIV" in exI, simp)  | 
| 
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
368  | 
done  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
369  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
370  | 
lemma%unimportant closed_vimage_vec_nth: "closed S \<Longrightarrow> closed ((\<lambda>x. x $ i) -` S)"  | 
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
371  | 
unfolding closed_open vimage_Compl [symmetric]  | 
| 
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
372  | 
by (rule open_vimage_vec_nth)  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
373  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
374  | 
lemma%unimportant closed_vector_box: "\<forall>i. closed (S i) \<Longrightarrow> closed {x. \<forall>i. x $ i \<in> S i}"
 | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
375  | 
proof -  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
376  | 
  have "{x. \<forall>i. x $ i \<in> S i} = (\<Inter>i. (\<lambda>x. x $ i) -` S i)" by auto
 | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
377  | 
  thus "\<forall>i. closed (S i) \<Longrightarrow> closed {x. \<forall>i. x $ i \<in> S i}"
 | 
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
378  | 
by (simp add: closed_INT closed_vimage_vec_nth)  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
379  | 
qed  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
380  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
381  | 
lemma%important tendsto_vec_nth [tendsto_intros]:  | 
| 61973 | 382  | 
assumes "((\<lambda>x. f x) \<longlongrightarrow> a) net"  | 
383  | 
shows "((\<lambda>x. f x $ i) \<longlongrightarrow> a $ i) net"  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
384  | 
proof%unimportant (rule topological_tendstoI)  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
385  | 
fix S assume "open S" "a $ i \<in> S"  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
386  | 
then have "open ((\<lambda>y. y $ i) -` S)" "a \<in> ((\<lambda>y. y $ i) -` S)"  | 
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
387  | 
by (simp_all add: open_vimage_vec_nth)  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
388  | 
with assms have "eventually (\<lambda>x. f x \<in> (\<lambda>y. y $ i) -` S) net"  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
389  | 
by (rule topological_tendstoD)  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
390  | 
then show "eventually (\<lambda>x. f x $ i \<in> S) net"  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
391  | 
by simp  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
392  | 
qed  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
393  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
394  | 
lemma%unimportant isCont_vec_nth [simp]: "isCont f a \<Longrightarrow> isCont (\<lambda>x. f x $ i) a"  | 
| 44631 | 395  | 
unfolding isCont_def by (rule tendsto_vec_nth)  | 
396  | 
||
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
397  | 
lemma%important vec_tendstoI:  | 
| 61973 | 398  | 
assumes "\<And>i. ((\<lambda>x. f x $ i) \<longlongrightarrow> a $ i) net"  | 
399  | 
shows "((\<lambda>x. f x) \<longlongrightarrow> a) net"  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
400  | 
proof%unimportant (rule topological_tendstoI)  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
401  | 
fix S assume "open S" and "a \<in> S"  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
402  | 
then obtain A where A: "\<And>i. open (A i)" "\<And>i. a $ i \<in> A i"  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
403  | 
and S: "\<And>y. \<forall>i. y $ i \<in> A i \<Longrightarrow> y \<in> S"  | 
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
404  | 
unfolding open_vec_def by metis  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
405  | 
have "\<And>i. eventually (\<lambda>x. f x $ i \<in> A i) net"  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
406  | 
using assms A by (rule topological_tendstoD)  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
407  | 
hence "eventually (\<lambda>x. \<forall>i. f x $ i \<in> A i) net"  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
408  | 
by (rule eventually_all_finite)  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
409  | 
thus "eventually (\<lambda>x. f x \<in> S) net"  | 
| 61810 | 410  | 
by (rule eventually_mono, simp add: S)  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
411  | 
qed  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
412  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
413  | 
lemma%unimportant tendsto_vec_lambda [tendsto_intros]:  | 
| 61973 | 414  | 
assumes "\<And>i. ((\<lambda>x. f x i) \<longlongrightarrow> a i) net"  | 
415  | 
shows "((\<lambda>x. \<chi> i. f x i) \<longlongrightarrow> (\<chi> i. a i)) net"  | 
|
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
416  | 
using assms by (simp add: vec_tendstoI)  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
417  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
418  | 
lemma%important open_image_vec_nth: assumes "open S" shows "open ((\<lambda>x. x $ i) ` S)"  | 
| 
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
419  | 
proof%unimportant (rule openI)  | 
| 44571 | 420  | 
fix a assume "a \<in> (\<lambda>x. x $ i) ` S"  | 
421  | 
then obtain z where "a = z $ i" and "z \<in> S" ..  | 
|
422  | 
then obtain A where A: "\<forall>i. open (A i) \<and> z $ i \<in> A i"  | 
|
423  | 
and S: "\<forall>y. (\<forall>i. y $ i \<in> A i) \<longrightarrow> y \<in> S"  | 
|
| 60420 | 424  | 
using \<open>open S\<close> unfolding open_vec_def by auto  | 
| 44571 | 425  | 
hence "A i \<subseteq> (\<lambda>x. x $ i) ` S"  | 
426  | 
by (clarsimp, rule_tac x="\<chi> j. if j = i then x else z $ j" in image_eqI,  | 
|
427  | 
simp_all)  | 
|
428  | 
hence "open (A i) \<and> a \<in> A i \<and> A i \<subseteq> (\<lambda>x. x $ i) ` S"  | 
|
| 60420 | 429  | 
using A \<open>a = z $ i\<close> by simp  | 
| 44571 | 430  | 
then show "\<exists>T. open T \<and> a \<in> T \<and> T \<subseteq> (\<lambda>x. x $ i) ` S" by - (rule exI)  | 
431  | 
qed  | 
|
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
432  | 
|
| 44571 | 433  | 
instance vec :: (perfect_space, finite) perfect_space  | 
434  | 
proof  | 
|
435  | 
  fix x :: "'a ^ 'b" show "\<not> open {x}"
 | 
|
436  | 
proof  | 
|
437  | 
    assume "open {x}"
 | 
|
| 
62102
 
877463945ce9
fix code generation for uniformity: uniformity is a non-computable pure data.
 
hoelzl 
parents: 
62101 
diff
changeset
 | 
438  | 
    hence "\<forall>i. open ((\<lambda>x. x $ i) ` {x})" by (fast intro: open_image_vec_nth)
 | 
| 44571 | 439  | 
    hence "\<forall>i. open {x $ i}" by simp
 | 
440  | 
thus "False" by (simp add: not_open_singleton)  | 
|
441  | 
qed  | 
|
442  | 
qed  | 
|
443  | 
||
444  | 
||
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
445  | 
subsection%important \<open>Metric space\<close>  | 
| 62101 | 446  | 
(* TODO: Product of uniform spaces and compatibility with metric_spaces! *)  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
447  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
448  | 
instantiation%unimportant vec :: (metric_space, finite) dist  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
449  | 
begin  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
450  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
451  | 
definition%important  | 
| 67155 | 452  | 
"dist x y = L2_set (\<lambda>i. dist (x$i) (y$i)) UNIV"  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
453  | 
|
| 62101 | 454  | 
instance ..  | 
455  | 
end  | 
|
456  | 
||
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
457  | 
instantiation%unimportant vec :: (metric_space, finite) uniformity_dist  | 
| 62101 | 458  | 
begin  | 
459  | 
||
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
460  | 
definition%important [code del]:  | 
| 67731 | 461  | 
  "(uniformity :: (('a^'b::_) \<times> ('a^'b::_)) filter) =
 | 
| 62101 | 462  | 
    (INF e:{0 <..}. principal {(x, y). dist x y < e})"
 | 
463  | 
||
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
464  | 
instance%unimportant  | 
| 62101 | 465  | 
by standard (rule uniformity_vec_def)  | 
466  | 
end  | 
|
467  | 
||
| 
62102
 
877463945ce9
fix code generation for uniformity: uniformity is a non-computable pure data.
 
hoelzl 
parents: 
62101 
diff
changeset
 | 
468  | 
declare uniformity_Abort[where 'a="'a :: metric_space ^ 'b :: finite", code]  | 
| 
 
877463945ce9
fix code generation for uniformity: uniformity is a non-computable pure data.
 
hoelzl 
parents: 
62101 
diff
changeset
 | 
469  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
470  | 
instantiation%unimportant vec :: (metric_space, finite) metric_space  | 
| 62101 | 471  | 
begin  | 
472  | 
||
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
473  | 
lemma%important dist_vec_nth_le: "dist (x $ i) (y $ i) \<le> dist x y"  | 
| 67155 | 474  | 
unfolding dist_vec_def by (rule member_le_L2_set) simp_all  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
475  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
476  | 
instance proof%unimportant  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
477  | 
fix x y :: "'a ^ 'b"  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
478  | 
show "dist x y = 0 \<longleftrightarrow> x = y"  | 
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
479  | 
unfolding dist_vec_def  | 
| 67155 | 480  | 
by (simp add: L2_set_eq_0_iff vec_eq_iff)  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
481  | 
next  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
482  | 
fix x y z :: "'a ^ 'b"  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
483  | 
show "dist x y \<le> dist x z + dist y z"  | 
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
484  | 
unfolding dist_vec_def  | 
| 67155 | 485  | 
apply (rule order_trans [OF _ L2_set_triangle_ineq])  | 
486  | 
apply (simp add: L2_set_mono dist_triangle2)  | 
|
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
487  | 
done  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
488  | 
next  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
489  | 
  fix S :: "('a ^ 'b) set"
 | 
| 62101 | 490  | 
have *: "open S \<longleftrightarrow> (\<forall>x\<in>S. \<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<in> S)"  | 
| 44630 | 491  | 
proof  | 
492  | 
assume "open S" show "\<forall>x\<in>S. \<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<in> S"  | 
|
493  | 
proof  | 
|
494  | 
fix x assume "x \<in> S"  | 
|
495  | 
obtain A where A: "\<forall>i. open (A i)" "\<forall>i. x $ i \<in> A i"  | 
|
496  | 
and S: "\<forall>y. (\<forall>i. y $ i \<in> A i) \<longrightarrow> y \<in> S"  | 
|
| 60420 | 497  | 
using \<open>open S\<close> and \<open>x \<in> S\<close> unfolding open_vec_def by metis  | 
| 44630 | 498  | 
have "\<forall>i\<in>UNIV. \<exists>r>0. \<forall>y. dist y (x $ i) < r \<longrightarrow> y \<in> A i"  | 
499  | 
using A unfolding open_dist by simp  | 
|
500  | 
hence "\<exists>r. \<forall>i\<in>UNIV. 0 < r i \<and> (\<forall>y. dist y (x $ i) < r i \<longrightarrow> y \<in> A i)"  | 
|
| 
44681
 
49ef76b4a634
remove duplicate lemma finite_choice in favor of finite_set_choice
 
huffman 
parents: 
44631 
diff
changeset
 | 
501  | 
by (rule finite_set_choice [OF finite])  | 
| 44630 | 502  | 
then obtain r where r1: "\<forall>i. 0 < r i"  | 
503  | 
and r2: "\<forall>i y. dist y (x $ i) < r i \<longrightarrow> y \<in> A i" by fast  | 
|
504  | 
have "0 < Min (range r) \<and> (\<forall>y. dist y x < Min (range r) \<longrightarrow> y \<in> S)"  | 
|
505  | 
by (simp add: r1 r2 S le_less_trans [OF dist_vec_nth_le])  | 
|
506  | 
thus "\<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<in> S" ..  | 
|
507  | 
qed  | 
|
508  | 
next  | 
|
509  | 
assume *: "\<forall>x\<in>S. \<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<in> S" show "open S"  | 
|
510  | 
proof (unfold open_vec_def, rule)  | 
|
511  | 
fix x assume "x \<in> S"  | 
|
512  | 
then obtain e where "0 < e" and S: "\<forall>y. dist y x < e \<longrightarrow> y \<in> S"  | 
|
513  | 
using * by fast  | 
|
| 63040 | 514  | 
      define r where [abs_def]: "r i = e / sqrt (of_nat CARD('b))" for i :: 'b
 | 
| 60420 | 515  | 
from \<open>0 < e\<close> have r: "\<forall>i. 0 < r i"  | 
| 56541 | 516  | 
unfolding r_def by simp_all  | 
| 67155 | 517  | 
from \<open>0 < e\<close> have e: "e = L2_set r UNIV"  | 
518  | 
unfolding r_def by (simp add: L2_set_constant)  | 
|
| 63040 | 519  | 
      define A where "A i = {y. dist (x $ i) y < r i}" for i
 | 
| 44630 | 520  | 
have "\<forall>i. open (A i) \<and> x $ i \<in> A i"  | 
521  | 
unfolding A_def by (simp add: open_ball r)  | 
|
522  | 
moreover have "\<forall>y. (\<forall>i. y $ i \<in> A i) \<longrightarrow> y \<in> S"  | 
|
| 67155 | 523  | 
by (simp add: A_def S dist_vec_def e L2_set_strict_mono dist_commute)  | 
| 44630 | 524  | 
ultimately show "\<exists>A. (\<forall>i. open (A i) \<and> x $ i \<in> A i) \<and>  | 
525  | 
(\<forall>y. (\<forall>i. y $ i \<in> A i) \<longrightarrow> y \<in> S)" by metis  | 
|
526  | 
qed  | 
|
527  | 
qed  | 
|
| 62101 | 528  | 
show "open S = (\<forall>x\<in>S. \<forall>\<^sub>F (x', y) in uniformity. x' = x \<longrightarrow> y \<in> S)"  | 
529  | 
unfolding * eventually_uniformity_metric  | 
|
530  | 
by (simp del: split_paired_All add: dist_vec_def dist_commute)  | 
|
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
531  | 
qed  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
532  | 
|
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
533  | 
end  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
534  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
535  | 
lemma%important Cauchy_vec_nth:  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
536  | 
"Cauchy (\<lambda>n. X n) \<Longrightarrow> Cauchy (\<lambda>n. X n $ i)"  | 
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
537  | 
unfolding Cauchy_def by (fast intro: le_less_trans [OF dist_vec_nth_le])  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
538  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
539  | 
lemma%important vec_CauchyI:  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
540  | 
fixes X :: "nat \<Rightarrow> 'a::metric_space ^ 'n"  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
541  | 
assumes X: "\<And>i. Cauchy (\<lambda>n. X n $ i)"  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
542  | 
shows "Cauchy (\<lambda>n. X n)"  | 
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
543  | 
proof%unimportant (rule metric_CauchyI)  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
544  | 
fix r :: real assume "0 < r"  | 
| 56541 | 545  | 
  hence "0 < r / of_nat CARD('n)" (is "0 < ?s") by simp
 | 
| 63040 | 546  | 
define N where "N i = (LEAST N. \<forall>m\<ge>N. \<forall>n\<ge>N. dist (X m $ i) (X n $ i) < ?s)" for i  | 
547  | 
define M where "M = Max (range N)"  | 
|
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
548  | 
have "\<And>i. \<exists>N. \<forall>m\<ge>N. \<forall>n\<ge>N. dist (X m $ i) (X n $ i) < ?s"  | 
| 60420 | 549  | 
using X \<open>0 < ?s\<close> by (rule metric_CauchyD)  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
550  | 
hence "\<And>i. \<forall>m\<ge>N i. \<forall>n\<ge>N i. dist (X m $ i) (X n $ i) < ?s"  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
551  | 
unfolding N_def by (rule LeastI_ex)  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
552  | 
hence M: "\<And>i. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (X m $ i) (X n $ i) < ?s"  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
553  | 
unfolding M_def by simp  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
554  | 
  {
 | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
555  | 
fix m n :: nat  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
556  | 
assume "M \<le> m" "M \<le> n"  | 
| 67155 | 557  | 
have "dist (X m) (X n) = L2_set (\<lambda>i. dist (X m $ i) (X n $ i)) UNIV"  | 
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
558  | 
unfolding dist_vec_def ..  | 
| 64267 | 559  | 
also have "\<dots> \<le> sum (\<lambda>i. dist (X m $ i) (X n $ i)) UNIV"  | 
| 67155 | 560  | 
by (rule L2_set_le_sum [OF zero_le_dist])  | 
| 64267 | 561  | 
also have "\<dots> < sum (\<lambda>i::'n. ?s) UNIV"  | 
562  | 
by (rule sum_strict_mono, simp_all add: M \<open>M \<le> m\<close> \<open>M \<le> n\<close>)  | 
|
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
563  | 
also have "\<dots> = r"  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
564  | 
by simp  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
565  | 
finally have "dist (X m) (X n) < r" .  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
566  | 
}  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
567  | 
hence "\<forall>m\<ge>M. \<forall>n\<ge>M. dist (X m) (X n) < r"  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
568  | 
by simp  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
569  | 
then show "\<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (X m) (X n) < r" ..  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
570  | 
qed  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
571  | 
|
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
572  | 
instance vec :: (complete_space, finite) complete_space  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
573  | 
proof  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
574  | 
fix X :: "nat \<Rightarrow> 'a ^ 'b" assume "Cauchy X"  | 
| 61969 | 575  | 
have "\<And>i. (\<lambda>n. X n $ i) \<longlonglongrightarrow> lim (\<lambda>n. X n $ i)"  | 
| 60420 | 576  | 
using Cauchy_vec_nth [OF \<open>Cauchy X\<close>]  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
577  | 
by (simp add: Cauchy_convergent_iff convergent_LIMSEQ_iff)  | 
| 61969 | 578  | 
hence "X \<longlonglongrightarrow> vec_lambda (\<lambda>i. lim (\<lambda>n. X n $ i))"  | 
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
579  | 
by (simp add: vec_tendstoI)  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
580  | 
then show "convergent X"  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
581  | 
by (rule convergentI)  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
582  | 
qed  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
583  | 
|
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
584  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
585  | 
subsection%important \<open>Normed vector space\<close>  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
586  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
587  | 
instantiation%unimportant vec :: (real_normed_vector, finite) real_normed_vector  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
588  | 
begin  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
589  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
590  | 
definition%important "norm x = L2_set (\<lambda>i. norm (x$i)) UNIV"  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
591  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
592  | 
definition%important "sgn (x::'a^'b) = scaleR (inverse (norm x)) x"  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
593  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
594  | 
instance proof%unimportant  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
595  | 
fix a :: real and x y :: "'a ^ 'b"  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
596  | 
show "norm x = 0 \<longleftrightarrow> x = 0"  | 
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
597  | 
unfolding norm_vec_def  | 
| 67155 | 598  | 
by (simp add: L2_set_eq_0_iff vec_eq_iff)  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
599  | 
show "norm (x + y) \<le> norm x + norm y"  | 
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
600  | 
unfolding norm_vec_def  | 
| 67155 | 601  | 
apply (rule order_trans [OF _ L2_set_triangle_ineq])  | 
602  | 
apply (simp add: L2_set_mono norm_triangle_ineq)  | 
|
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
603  | 
done  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
604  | 
show "norm (scaleR a x) = \<bar>a\<bar> * norm x"  | 
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
605  | 
unfolding norm_vec_def  | 
| 67155 | 606  | 
by (simp add: L2_set_right_distrib)  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
607  | 
show "sgn x = scaleR (inverse (norm x)) x"  | 
| 44141 | 608  | 
by (rule sgn_vec_def)  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
609  | 
show "dist x y = norm (x - y)"  | 
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
610  | 
unfolding dist_vec_def norm_vec_def  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
611  | 
by (simp add: dist_norm)  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
612  | 
qed  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
613  | 
|
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
614  | 
end  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
615  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
616  | 
lemma%unimportant norm_nth_le: "norm (x $ i) \<le> norm x"  | 
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
617  | 
unfolding norm_vec_def  | 
| 67155 | 618  | 
by (rule member_le_L2_set) simp_all  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
619  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
620  | 
lemma%important norm_le_componentwise_cart:  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
621  | 
fixes x :: "'a::real_normed_vector^'n"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
622  | 
assumes "\<And>i. norm(x$i) \<le> norm(y$i)"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
623  | 
shows "norm x \<le> norm y"  | 
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
624  | 
unfolding%unimportant norm_vec_def  | 
| 
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
625  | 
by%unimportant (rule L2_set_mono) (auto simp: assms)  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
626  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
627  | 
lemma%unimportant component_le_norm_cart: "\<bar>x$i\<bar> \<le> norm x"  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
628  | 
apply (simp add: norm_vec_def)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
629  | 
apply (rule member_le_L2_set, simp_all)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
630  | 
done  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
631  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
632  | 
lemma%unimportant norm_bound_component_le_cart: "norm x \<le> e ==> \<bar>x$i\<bar> \<le> e"  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
633  | 
by (metis component_le_norm_cart order_trans)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
634  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
635  | 
lemma%unimportant norm_bound_component_lt_cart: "norm x < e ==> \<bar>x$i\<bar> < e"  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
636  | 
by (metis component_le_norm_cart le_less_trans)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
637  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
638  | 
lemma%unimportant norm_le_l1_cart: "norm x \<le> sum(\<lambda>i. \<bar>x$i\<bar>) UNIV"  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
639  | 
by (simp add: norm_vec_def L2_set_le_sum)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
640  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
641  | 
lemma%unimportant bounded_linear_vec_nth: "bounded_linear (\<lambda>x. x $ i)"  | 
| 61169 | 642  | 
apply standard  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
643  | 
apply (rule vector_add_component)  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
644  | 
apply (rule vector_scaleR_component)  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
645  | 
apply (rule_tac x="1" in exI, simp add: norm_nth_le)  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
646  | 
done  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
647  | 
|
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
648  | 
instance vec :: (banach, finite) banach ..  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
649  | 
|
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
650  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
651  | 
subsection%important \<open>Inner product space\<close>  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
652  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
653  | 
instantiation%unimportant vec :: (real_inner, finite) real_inner  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
654  | 
begin  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
655  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
656  | 
definition%important "inner x y = sum (\<lambda>i. inner (x$i) (y$i)) UNIV"  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
657  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
658  | 
instance proof%unimportant  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
659  | 
fix r :: real and x y z :: "'a ^ 'b"  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
660  | 
show "inner x y = inner y x"  | 
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
661  | 
unfolding inner_vec_def  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
662  | 
by (simp add: inner_commute)  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
663  | 
show "inner (x + y) z = inner x z + inner y z"  | 
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
664  | 
unfolding inner_vec_def  | 
| 64267 | 665  | 
by (simp add: inner_add_left sum.distrib)  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
666  | 
show "inner (scaleR r x) y = r * inner x y"  | 
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
667  | 
unfolding inner_vec_def  | 
| 64267 | 668  | 
by (simp add: sum_distrib_left)  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
669  | 
show "0 \<le> inner x x"  | 
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
670  | 
unfolding inner_vec_def  | 
| 64267 | 671  | 
by (simp add: sum_nonneg)  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
672  | 
show "inner x x = 0 \<longleftrightarrow> x = 0"  | 
| 
44136
 
e63ad7d5158d
more uniform naming scheme for finite cartesian product type and related theorems
 
huffman 
parents: 
44135 
diff
changeset
 | 
673  | 
unfolding inner_vec_def  | 
| 64267 | 674  | 
by (simp add: vec_eq_iff sum_nonneg_eq_0_iff)  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
675  | 
show "norm x = sqrt (inner x x)"  | 
| 67155 | 676  | 
unfolding inner_vec_def norm_vec_def L2_set_def  | 
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
677  | 
by (simp add: power2_norm_eq_inner)  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
678  | 
qed  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
679  | 
|
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
680  | 
end  | 
| 
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
681  | 
|
| 
44166
 
d12d89a66742
modify euclidean_space class to include basis set
 
huffman 
parents: 
44165 
diff
changeset
 | 
682  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
683  | 
subsection%important \<open>Euclidean space\<close>  | 
| 
44135
 
18b4ab6854f1
move euclidean_space instance from Cartesian_Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
42290 
diff
changeset
 | 
684  | 
|
| 60420 | 685  | 
text \<open>Vectors pointing along a single axis.\<close>  | 
| 
44166
 
d12d89a66742
modify euclidean_space class to include basis set
 
huffman 
parents: 
44165 
diff
changeset
 | 
686  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
687  | 
definition%important "axis k x = (\<chi> i. if i = k then x else 0)"  | 
| 
44166
 
d12d89a66742
modify euclidean_space class to include basis set
 
huffman 
parents: 
44165 
diff
changeset
 | 
688  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
689  | 
lemma%unimportant axis_nth [simp]: "axis i x $ i = x"  | 
| 
44166
 
d12d89a66742
modify euclidean_space class to include basis set
 
huffman 
parents: 
44165 
diff
changeset
 | 
690  | 
unfolding axis_def by simp  | 
| 
 
d12d89a66742
modify euclidean_space class to include basis set
 
huffman 
parents: 
44165 
diff
changeset
 | 
691  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
692  | 
lemma%unimportant axis_eq_axis: "axis i x = axis j y \<longleftrightarrow> x = y \<and> i = j \<or> x = 0 \<and> y = 0"  | 
| 
44166
 
d12d89a66742
modify euclidean_space class to include basis set
 
huffman 
parents: 
44165 
diff
changeset
 | 
693  | 
unfolding axis_def vec_eq_iff by auto  | 
| 
 
d12d89a66742
modify euclidean_space class to include basis set
 
huffman 
parents: 
44165 
diff
changeset
 | 
694  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
695  | 
lemma%unimportant inner_axis_axis:  | 
| 
44166
 
d12d89a66742
modify euclidean_space class to include basis set
 
huffman 
parents: 
44165 
diff
changeset
 | 
696  | 
"inner (axis i x) (axis j y) = (if i = j then inner x y else 0)"  | 
| 
 
d12d89a66742
modify euclidean_space class to include basis set
 
huffman 
parents: 
44165 
diff
changeset
 | 
697  | 
unfolding inner_vec_def  | 
| 
 
d12d89a66742
modify euclidean_space class to include basis set
 
huffman 
parents: 
44165 
diff
changeset
 | 
698  | 
apply (cases "i = j")  | 
| 
 
d12d89a66742
modify euclidean_space class to include basis set
 
huffman 
parents: 
44165 
diff
changeset
 | 
699  | 
apply clarsimp  | 
| 64267 | 700  | 
apply (subst sum.remove [of _ j], simp_all)  | 
701  | 
apply (rule sum.neutral, simp add: axis_def)  | 
|
702  | 
apply (rule sum.neutral, simp add: axis_def)  | 
|
| 
44166
 
d12d89a66742
modify euclidean_space class to include basis set
 
huffman 
parents: 
44165 
diff
changeset
 | 
703  | 
done  | 
| 
 
d12d89a66742
modify euclidean_space class to include basis set
 
huffman 
parents: 
44165 
diff
changeset
 | 
704  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
705  | 
lemma%unimportant inner_axis: "inner x (axis i y) = inner (x $ i) y"  | 
| 
67982
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67968 
diff
changeset
 | 
706  | 
by (simp add: inner_vec_def axis_def sum.remove [where x=i])  | 
| 
44166
 
d12d89a66742
modify euclidean_space class to include basis set
 
huffman 
parents: 
44165 
diff
changeset
 | 
707  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
708  | 
lemma%unimportant inner_axis': "inner(axis i y) x = inner y (x $ i)"  | 
| 
67683
 
817944aeac3f
Lots of new material about matrices, etc.
 
paulson <lp15@cam.ac.uk> 
parents: 
67673 
diff
changeset
 | 
709  | 
by (simp add: inner_axis inner_commute)  | 
| 
 
817944aeac3f
Lots of new material about matrices, etc.
 
paulson <lp15@cam.ac.uk> 
parents: 
67673 
diff
changeset
 | 
710  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
711  | 
instantiation%unimportant vec :: (euclidean_space, finite) euclidean_space  | 
| 
44135
 
18b4ab6854f1
move euclidean_space instance from Cartesian_Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
42290 
diff
changeset
 | 
712  | 
begin  | 
| 
 
18b4ab6854f1
move euclidean_space instance from Cartesian_Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
42290 
diff
changeset
 | 
713  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
714  | 
definition%important "Basis = (\<Union>i. \<Union>u\<in>Basis. {axis i u})"
 | 
| 
44166
 
d12d89a66742
modify euclidean_space class to include basis set
 
huffman 
parents: 
44165 
diff
changeset
 | 
715  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
716  | 
instance proof%unimportant  | 
| 
44166
 
d12d89a66742
modify euclidean_space class to include basis set
 
huffman 
parents: 
44165 
diff
changeset
 | 
717  | 
  show "(Basis :: ('a ^ 'b) set) \<noteq> {}"
 | 
| 
 
d12d89a66742
modify euclidean_space class to include basis set
 
huffman 
parents: 
44165 
diff
changeset
 | 
718  | 
unfolding Basis_vec_def by simp  | 
| 
 
d12d89a66742
modify euclidean_space class to include basis set
 
huffman 
parents: 
44165 
diff
changeset
 | 
719  | 
next  | 
| 
 
d12d89a66742
modify euclidean_space class to include basis set
 
huffman 
parents: 
44165 
diff
changeset
 | 
720  | 
  show "finite (Basis :: ('a ^ 'b) set)"
 | 
| 
 
d12d89a66742
modify euclidean_space class to include basis set
 
huffman 
parents: 
44165 
diff
changeset
 | 
721  | 
unfolding Basis_vec_def by simp  | 
| 
44135
 
18b4ab6854f1
move euclidean_space instance from Cartesian_Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
42290 
diff
changeset
 | 
722  | 
next  | 
| 
44166
 
d12d89a66742
modify euclidean_space class to include basis set
 
huffman 
parents: 
44165 
diff
changeset
 | 
723  | 
fix u v :: "'a ^ 'b"  | 
| 
 
d12d89a66742
modify euclidean_space class to include basis set
 
huffman 
parents: 
44165 
diff
changeset
 | 
724  | 
assume "u \<in> Basis" and "v \<in> Basis"  | 
| 
 
d12d89a66742
modify euclidean_space class to include basis set
 
huffman 
parents: 
44165 
diff
changeset
 | 
725  | 
thus "inner u v = (if u = v then 1 else 0)"  | 
| 
 
d12d89a66742
modify euclidean_space class to include basis set
 
huffman 
parents: 
44165 
diff
changeset
 | 
726  | 
unfolding Basis_vec_def  | 
| 
 
d12d89a66742
modify euclidean_space class to include basis set
 
huffman 
parents: 
44165 
diff
changeset
 | 
727  | 
by (auto simp add: inner_axis_axis axis_eq_axis inner_Basis)  | 
| 
44135
 
18b4ab6854f1
move euclidean_space instance from Cartesian_Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
42290 
diff
changeset
 | 
728  | 
next  | 
| 
44166
 
d12d89a66742
modify euclidean_space class to include basis set
 
huffman 
parents: 
44165 
diff
changeset
 | 
729  | 
fix x :: "'a ^ 'b"  | 
| 
 
d12d89a66742
modify euclidean_space class to include basis set
 
huffman 
parents: 
44165 
diff
changeset
 | 
730  | 
show "(\<forall>u\<in>Basis. inner x u = 0) \<longleftrightarrow> x = 0"  | 
| 
 
d12d89a66742
modify euclidean_space class to include basis set
 
huffman 
parents: 
44165 
diff
changeset
 | 
731  | 
unfolding Basis_vec_def  | 
| 
 
d12d89a66742
modify euclidean_space class to include basis set
 
huffman 
parents: 
44165 
diff
changeset
 | 
732  | 
by (simp add: inner_axis euclidean_all_zero_iff vec_eq_iff)  | 
| 
50526
 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 
hoelzl 
parents: 
50252 
diff
changeset
 | 
733  | 
qed  | 
| 
 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 
hoelzl 
parents: 
50252 
diff
changeset
 | 
734  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
735  | 
lemma%important DIM_cart [simp]: "DIM('a^'b) = CARD('b) * DIM('a)"
 | 
| 
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
736  | 
proof%unimportant -  | 
| 
67982
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67968 
diff
changeset
 | 
737  | 
  have "card (\<Union>i::'b. \<Union>u::'a\<in>Basis. {axis i u}) = (\<Sum>i::'b\<in>UNIV. card (\<Union>u::'a\<in>Basis. {axis i u}))"
 | 
| 
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67968 
diff
changeset
 | 
738  | 
by (rule card_UN_disjoint) (auto simp: axis_eq_axis)  | 
| 
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67968 
diff
changeset
 | 
739  | 
  also have "... = CARD('b) * DIM('a)"
 | 
| 
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67968 
diff
changeset
 | 
740  | 
by (subst card_UN_disjoint) (auto simp: axis_eq_axis)  | 
| 
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67968 
diff
changeset
 | 
741  | 
finally show ?thesis  | 
| 
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67968 
diff
changeset
 | 
742  | 
by (simp add: Basis_vec_def)  | 
| 
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67968 
diff
changeset
 | 
743  | 
qed  | 
| 
44135
 
18b4ab6854f1
move euclidean_space instance from Cartesian_Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
42290 
diff
changeset
 | 
744  | 
|
| 
36591
 
df38e0c5c123
move class instantiations from Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
36590 
diff
changeset
 | 
745  | 
end  | 
| 
44135
 
18b4ab6854f1
move euclidean_space instance from Cartesian_Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
42290 
diff
changeset
 | 
746  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
747  | 
lemma%unimportant norm_axis_1 [simp]: "norm (axis m (1::real)) = 1"  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
748  | 
by (simp add: inner_axis' norm_eq_1)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
749  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
750  | 
lemma%important sum_norm_allsubsets_bound_cart:  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
751  | 
fixes f:: "'a \<Rightarrow> real ^'n"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
752  | 
assumes fP: "finite P" and fPs: "\<And>Q. Q \<subseteq> P \<Longrightarrow> norm (sum f Q) \<le> e"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
753  | 
  shows "sum (\<lambda>x. norm (f x)) P \<le> 2 * real CARD('n) *  e"
 | 
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
754  | 
using%unimportant sum_norm_allsubsets_bound[OF assms]  | 
| 
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
755  | 
by%unimportant simp  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
756  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
757  | 
lemma%unimportant cart_eq_inner_axis: "a $ i = inner a (axis i 1)"  | 
| 
62397
 
5ae24f33d343
Substantial new material for multivariate analysis. Also removal of some duplicates.
 
paulson <lp15@cam.ac.uk> 
parents: 
62102 
diff
changeset
 | 
758  | 
by (simp add: inner_axis)  | 
| 
 
5ae24f33d343
Substantial new material for multivariate analysis. Also removal of some duplicates.
 
paulson <lp15@cam.ac.uk> 
parents: 
62102 
diff
changeset
 | 
759  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
760  | 
lemma%unimportant axis_eq_0_iff [simp]:  | 
| 
67982
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67968 
diff
changeset
 | 
761  | 
shows "axis m x = 0 \<longleftrightarrow> x = 0"  | 
| 
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67968 
diff
changeset
 | 
762  | 
by (simp add: axis_def vec_eq_iff)  | 
| 
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67968 
diff
changeset
 | 
763  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
764  | 
lemma%unimportant axis_in_Basis_iff [simp]: "axis i a \<in> Basis \<longleftrightarrow> a \<in> Basis"  | 
| 
67982
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67968 
diff
changeset
 | 
765  | 
by (auto simp: Basis_vec_def axis_eq_axis)  | 
| 
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67968 
diff
changeset
 | 
766  | 
|
| 
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67968 
diff
changeset
 | 
767  | 
text\<open>Mapping each basis element to the corresponding finite index\<close>  | 
| 
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67968 
diff
changeset
 | 
768  | 
definition axis_index :: "('a::comm_ring_1)^'n \<Rightarrow> 'n" where "axis_index v \<equiv> SOME i. v = axis i 1"
 | 
| 
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67968 
diff
changeset
 | 
769  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
770  | 
lemma%unimportant axis_inverse:  | 
| 
67982
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67968 
diff
changeset
 | 
771  | 
fixes v :: "real^'n"  | 
| 
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67968 
diff
changeset
 | 
772  | 
assumes "v \<in> Basis"  | 
| 
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67968 
diff
changeset
 | 
773  | 
shows "\<exists>i. v = axis i 1"  | 
| 
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67968 
diff
changeset
 | 
774  | 
proof -  | 
| 
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67968 
diff
changeset
 | 
775  | 
  have "v \<in> (\<Union>n. \<Union>r\<in>Basis. {axis n r})"
 | 
| 
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67968 
diff
changeset
 | 
776  | 
using assms Basis_vec_def by blast  | 
| 
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67968 
diff
changeset
 | 
777  | 
then show ?thesis  | 
| 
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67968 
diff
changeset
 | 
778  | 
by (force simp add: vec_eq_iff)  | 
| 
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67968 
diff
changeset
 | 
779  | 
qed  | 
| 
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67968 
diff
changeset
 | 
780  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
781  | 
lemma%unimportant axis_index:  | 
| 
67982
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67968 
diff
changeset
 | 
782  | 
fixes v :: "real^'n"  | 
| 
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67968 
diff
changeset
 | 
783  | 
assumes "v \<in> Basis"  | 
| 
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67968 
diff
changeset
 | 
784  | 
shows "v = axis (axis_index v) 1"  | 
| 
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67968 
diff
changeset
 | 
785  | 
by (metis (mono_tags) assms axis_inverse axis_index_def someI_ex)  | 
| 
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67968 
diff
changeset
 | 
786  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
787  | 
lemma%unimportant axis_index_axis [simp]:  | 
| 
67982
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67968 
diff
changeset
 | 
788  | 
fixes UU :: "real^'n"  | 
| 
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67968 
diff
changeset
 | 
789  | 
shows "(axis_index (axis u 1 :: real^'n)) = (u::'n)"  | 
| 
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67968 
diff
changeset
 | 
790  | 
by (simp add: axis_eq_axis axis_index_def)  | 
| 
62397
 
5ae24f33d343
Substantial new material for multivariate analysis. Also removal of some duplicates.
 
paulson <lp15@cam.ac.uk> 
parents: 
62102 
diff
changeset
 | 
791  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
792  | 
subsection%unimportant \<open>A naive proof procedure to lift really trivial arithmetic stuff from the basis of the vector space\<close>  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
793  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
794  | 
lemma%unimportant sum_cong_aux:  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
795  | 
"(\<And>x. x \<in> A \<Longrightarrow> f x = g x) \<Longrightarrow> sum f A = sum g A"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
796  | 
by (auto intro: sum.cong)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
797  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
798  | 
hide_fact (open) sum_cong_aux  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
799  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
800  | 
method_setup vector = \<open>  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
801  | 
let  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
802  | 
val ss1 =  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
803  | 
    simpset_of (put_simpset HOL_basic_ss @{context}
 | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
804  | 
      addsimps [@{thm sum.distrib} RS sym,
 | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
805  | 
      @{thm sum_subtractf} RS sym, @{thm sum_distrib_left},
 | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
806  | 
      @{thm sum_distrib_right}, @{thm sum_negf} RS sym])
 | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
807  | 
val ss2 =  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
808  | 
    simpset_of (@{context} addsimps
 | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
809  | 
             [@{thm plus_vec_def}, @{thm times_vec_def},
 | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
810  | 
              @{thm minus_vec_def}, @{thm uminus_vec_def},
 | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
811  | 
              @{thm one_vec_def}, @{thm zero_vec_def}, @{thm vec_def},
 | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
812  | 
              @{thm scaleR_vec_def},
 | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
813  | 
              @{thm vec_lambda_beta}, @{thm vector_scalar_mult_def}])
 | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
814  | 
fun vector_arith_tac ctxt ths =  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
815  | 
simp_tac (put_simpset ss1 ctxt)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
816  | 
    THEN' (fn i => resolve_tac ctxt @{thms Finite_Cartesian_Product.sum_cong_aux} i
 | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
817  | 
         ORELSE resolve_tac ctxt @{thms sum.neutral} i
 | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
818  | 
         ORELSE simp_tac (put_simpset HOL_basic_ss ctxt addsimps [@{thm vec_eq_iff}]) i)
 | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
819  | 
    (* THEN' TRY o clarify_tac HOL_cs  THEN' (TRY o rtac @{thm iffI}) *)
 | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
820  | 
THEN' asm_full_simp_tac (put_simpset ss2 ctxt addsimps ths)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
821  | 
in  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
822  | 
Attrib.thms >> (fn ths => fn ctxt => SIMPLE_METHOD' (vector_arith_tac ctxt ths))  | 
| 
44135
 
18b4ab6854f1
move euclidean_space instance from Cartesian_Euclidean_Space.thy to Finite_Cartesian_Product.thy
 
huffman 
parents: 
42290 
diff
changeset
 | 
823  | 
end  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
824  | 
\<close> "lift trivial vector statements to real arith statements"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
825  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
826  | 
lemma%unimportant vec_0[simp]: "vec 0 = 0" by vector  | 
| 
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
827  | 
lemma%unimportant vec_1[simp]: "vec 1 = 1" by vector  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
828  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
829  | 
lemma%unimportant vec_inj[simp]: "vec x = vec y \<longleftrightarrow> x = y" by vector  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
830  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
831  | 
lemma%unimportant vec_in_image_vec: "vec x \<in> (vec ` S) \<longleftrightarrow> x \<in> S" by auto  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
832  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
833  | 
lemma%unimportant vec_add: "vec(x + y) = vec x + vec y" by vector  | 
| 
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
834  | 
lemma%unimportant vec_sub: "vec(x - y) = vec x - vec y" by vector  | 
| 
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
835  | 
lemma%unimportant vec_cmul: "vec(c * x) = c *s vec x " by vector  | 
| 
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
836  | 
lemma%unimportant vec_neg: "vec(- x) = - vec x " by vector  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
837  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
838  | 
lemma%unimportant vec_scaleR: "vec(c * x) = c *\<^sub>R vec x"  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
839  | 
by vector  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
840  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
841  | 
lemma%unimportant vec_sum:  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
842  | 
assumes "finite S"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
843  | 
shows "vec(sum f S) = sum (vec \<circ> f) S"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
844  | 
using assms  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
845  | 
proof induct  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
846  | 
case empty  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
847  | 
then show ?case by simp  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
848  | 
next  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
849  | 
case insert  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
850  | 
then show ?case by (auto simp add: vec_add)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
851  | 
qed  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
852  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
853  | 
text\<open>Obvious "component-pushing".\<close>  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
854  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
855  | 
lemma%unimportant vec_component [simp]: "vec x $ i = x"  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
856  | 
by vector  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
857  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
858  | 
lemma%unimportant vector_mult_component [simp]: "(x * y)$i = x$i * y$i"  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
859  | 
by vector  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
860  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
861  | 
lemma%unimportant vector_smult_component [simp]: "(c *s y)$i = c * (y$i)"  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
862  | 
by vector  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
863  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
864  | 
lemma%unimportant cond_component: "(if b then x else y)$i = (if b then x$i else y$i)" by vector  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
865  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
866  | 
lemmas%unimportant vector_component =  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
867  | 
vec_component vector_add_component vector_mult_component  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
868  | 
vector_smult_component vector_minus_component vector_uminus_component  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
869  | 
vector_scaleR_component cond_component  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
870  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
871  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
872  | 
subsection%unimportant \<open>Some frequently useful arithmetic lemmas over vectors\<close>  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
873  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
874  | 
instance vec :: (semigroup_mult, finite) semigroup_mult  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
875  | 
by standard (vector mult.assoc)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
876  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
877  | 
instance vec :: (monoid_mult, finite) monoid_mult  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
878  | 
by standard vector+  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
879  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
880  | 
instance vec :: (ab_semigroup_mult, finite) ab_semigroup_mult  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
881  | 
by standard (vector mult.commute)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
882  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
883  | 
instance vec :: (comm_monoid_mult, finite) comm_monoid_mult  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
884  | 
by standard vector  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
885  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
886  | 
instance vec :: (semiring, finite) semiring  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
887  | 
by standard (vector field_simps)+  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
888  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
889  | 
instance vec :: (semiring_0, finite) semiring_0  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
890  | 
by standard (vector field_simps)+  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
891  | 
instance vec :: (semiring_1, finite) semiring_1  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
892  | 
by standard vector  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
893  | 
instance vec :: (comm_semiring, finite) comm_semiring  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
894  | 
by standard (vector field_simps)+  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
895  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
896  | 
instance vec :: (comm_semiring_0, finite) comm_semiring_0 ..  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
897  | 
instance vec :: (semiring_0_cancel, finite) semiring_0_cancel ..  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
898  | 
instance vec :: (comm_semiring_0_cancel, finite) comm_semiring_0_cancel ..  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
899  | 
instance vec :: (ring, finite) ring ..  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
900  | 
instance vec :: (semiring_1_cancel, finite) semiring_1_cancel ..  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
901  | 
instance vec :: (comm_semiring_1, finite) comm_semiring_1 ..  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
902  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
903  | 
instance vec :: (ring_1, finite) ring_1 ..  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
904  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
905  | 
instance vec :: (real_algebra, finite) real_algebra  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
906  | 
by standard (simp_all add: vec_eq_iff)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
907  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
908  | 
instance vec :: (real_algebra_1, finite) real_algebra_1 ..  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
909  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
910  | 
lemma of_nat_index: "(of_nat n :: 'a::semiring_1 ^'n)$i = of_nat n"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
911  | 
proof (induct n)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
912  | 
case 0  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
913  | 
then show ?case by vector  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
914  | 
next  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
915  | 
case Suc  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
916  | 
then show ?case by vector  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
917  | 
qed  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
918  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
919  | 
lemma one_index [simp]: "(1 :: 'a :: one ^ 'n) $ i = 1"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
920  | 
by vector  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
921  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
922  | 
lemma neg_one_index [simp]: "(- 1 :: 'a :: {one, uminus} ^ 'n) $ i = - 1"
 | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
923  | 
by vector  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
924  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
925  | 
instance vec :: (semiring_char_0, finite) semiring_char_0  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
926  | 
proof  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
927  | 
fix m n :: nat  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
928  | 
show "inj (of_nat :: nat \<Rightarrow> 'a ^ 'b)"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
929  | 
by (auto intro!: injI simp add: vec_eq_iff of_nat_index)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
930  | 
qed  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
931  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
932  | 
instance vec :: (numeral, finite) numeral ..  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
933  | 
instance vec :: (semiring_numeral, finite) semiring_numeral ..  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
934  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
935  | 
lemma numeral_index [simp]: "numeral w $ i = numeral w"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
936  | 
by (induct w) (simp_all only: numeral.simps vector_add_component one_index)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
937  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
938  | 
lemma neg_numeral_index [simp]: "- numeral w $ i = - numeral w"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
939  | 
by (simp only: vector_uminus_component numeral_index)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
940  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
941  | 
instance vec :: (comm_ring_1, finite) comm_ring_1 ..  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
942  | 
instance vec :: (ring_char_0, finite) ring_char_0 ..  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
943  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
944  | 
lemma vector_smult_assoc: "a *s (b *s x) = ((a::'a::semigroup_mult) * b) *s x"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
945  | 
by (vector mult.assoc)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
946  | 
lemma vector_sadd_rdistrib: "((a::'a::semiring) + b) *s x = a *s x + b *s x"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
947  | 
by (vector field_simps)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
948  | 
lemma vector_add_ldistrib: "(c::'a::semiring) *s (x + y) = c *s x + c *s y"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
949  | 
by (vector field_simps)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
950  | 
lemma vector_smult_lzero[simp]: "(0::'a::mult_zero) *s x = 0" by vector  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
951  | 
lemma vector_smult_lid[simp]: "(1::'a::monoid_mult) *s x = x" by vector  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
952  | 
lemma vector_ssub_ldistrib: "(c::'a::ring) *s (x - y) = c *s x - c *s y"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
953  | 
by (vector field_simps)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
954  | 
lemma vector_smult_rneg: "(c::'a::ring) *s -x = -(c *s x)" by vector  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
955  | 
lemma vector_smult_lneg: "- (c::'a::ring) *s x = -(c *s x)" by vector  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
956  | 
lemma vector_sneg_minus1: "-x = (-1::'a::ring_1) *s x" by vector  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
957  | 
lemma vector_smult_rzero[simp]: "c *s 0 = (0::'a::mult_zero ^ 'n)" by vector  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
958  | 
lemma vector_sub_rdistrib: "((a::'a::ring) - b) *s x = a *s x - b *s x"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
959  | 
by (vector field_simps)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
960  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
961  | 
lemma vec_eq[simp]: "(vec m = vec n) \<longleftrightarrow> (m = n)"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
962  | 
by (simp add: vec_eq_iff)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
963  | 
|
| 
69064
 
5840724b1d71
Prefix form of infix with * on either side no longer needs special treatment
 
nipkow 
parents: 
68833 
diff
changeset
 | 
964  | 
lemma Vector_Spaces_linear_vec [simp]: "Vector_Spaces.linear (*) vector_scalar_mult vec"  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
965  | 
by unfold_locales (vector algebra_simps)+  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
966  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
967  | 
lemma vector_mul_eq_0[simp]: "(a *s x = 0) \<longleftrightarrow> a = (0::'a::idom) \<or> x = 0"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
968  | 
by vector  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
969  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
970  | 
lemma vector_mul_lcancel[simp]: "a *s x = a *s y \<longleftrightarrow> a = (0::'a::field) \<or> x = y"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
971  | 
by (metis eq_iff_diff_eq_0 vector_mul_eq_0 vector_ssub_ldistrib)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
972  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
973  | 
lemma vector_mul_rcancel[simp]: "a *s x = b *s x \<longleftrightarrow> (a::'a::field) = b \<or> x = 0"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
974  | 
by (metis eq_iff_diff_eq_0 vector_mul_eq_0 vector_sub_rdistrib)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
975  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
976  | 
lemma scalar_mult_eq_scaleR [abs_def]: "c *s x = c *\<^sub>R x"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
977  | 
unfolding scaleR_vec_def vector_scalar_mult_def by simp  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
978  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
979  | 
lemma dist_mul[simp]: "dist (c *s x) (c *s y) = \<bar>c\<bar> * dist x y"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
980  | 
unfolding dist_norm scalar_mult_eq_scaleR  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
981  | 
unfolding scaleR_right_diff_distrib[symmetric] by simp  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
982  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
983  | 
lemma sum_component [simp]:  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
984  | 
  fixes f:: " 'a \<Rightarrow> ('b::comm_monoid_add) ^'n"
 | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
985  | 
shows "(sum f S)$i = sum (\<lambda>x. (f x)$i) S"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
986  | 
proof (cases "finite S")  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
987  | 
case True  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
988  | 
then show ?thesis by induct simp_all  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
989  | 
next  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
990  | 
case False  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
991  | 
then show ?thesis by simp  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
992  | 
qed  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
993  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
994  | 
lemma sum_eq: "sum f S = (\<chi> i. sum (\<lambda>x. (f x)$i ) S)"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
995  | 
by (simp add: vec_eq_iff)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
996  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
997  | 
lemma sum_cmul:  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
998  | 
  fixes f:: "'c \<Rightarrow> ('a::semiring_1)^'n"
 | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
999  | 
shows "sum (\<lambda>x. c *s f x) S = c *s sum f S"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1000  | 
by (simp add: vec_eq_iff sum_distrib_left)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1001  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1002  | 
lemma linear_vec [simp]: "linear vec"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1003  | 
using Vector_Spaces_linear_vec  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1004  | 
apply (auto )  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1005  | 
by unfold_locales (vector algebra_simps)+  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1006  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1007  | 
subsection%important \<open>Matrix operations\<close>  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1008  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1009  | 
text\<open>Matrix notation. NB: an MxN matrix is of type @{typ "'a^'n^'m"}, not @{typ "'a^'m^'n"}\<close>
 | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1010  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1011  | 
definition%important map_matrix::"('a \<Rightarrow> 'b) \<Rightarrow> (('a, 'i::finite)vec, 'j::finite) vec \<Rightarrow> (('b, 'i)vec, 'j) vec" where
 | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1012  | 
"map_matrix f x = (\<chi> i j. f (x $ i $ j))"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1013  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1014  | 
lemma%unimportant nth_map_matrix[simp]: "map_matrix f x $ i $ j = f (x $ i $ j)"  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1015  | 
by (simp add: map_matrix_def)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1016  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1017  | 
definition%important matrix_matrix_mult :: "('a::semiring_1) ^'n^'m \<Rightarrow> 'a ^'p^'n \<Rightarrow> 'a ^ 'p ^'m"
 | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1018  | 
(infixl "**" 70)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1019  | 
where "m ** m' == (\<chi> i j. sum (\<lambda>k. ((m$i)$k) * ((m'$k)$j)) (UNIV :: 'n set)) ::'a ^ 'p ^'m"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1020  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1021  | 
definition%important matrix_vector_mult :: "('a::semiring_1) ^'n^'m \<Rightarrow> 'a ^'n \<Rightarrow> 'a ^ 'm"
 | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1022  | 
(infixl "*v" 70)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1023  | 
where "m *v x \<equiv> (\<chi> i. sum (\<lambda>j. ((m$i)$j) * (x$j)) (UNIV ::'n set)) :: 'a^'m"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1024  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1025  | 
definition%important vector_matrix_mult :: "'a ^ 'm \<Rightarrow> ('a::semiring_1) ^'n^'m \<Rightarrow> 'a ^'n "
 | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1026  | 
(infixl "v*" 70)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1027  | 
where "v v* m == (\<chi> j. sum (\<lambda>i. ((m$i)$j) * (v$i)) (UNIV :: 'm set)) :: 'a^'n"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1028  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1029  | 
definition%unimportant "(mat::'a::zero => 'a ^'n^'n) k = (\<chi> i j. if i = j then k else 0)"  | 
| 
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1030  | 
definition%unimportant transpose where  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1031  | 
"(transpose::'a^'n^'m \<Rightarrow> 'a^'m^'n) A = (\<chi> i j. ((A$j)$i))"  | 
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1032  | 
definition%unimportant "(row::'m => 'a ^'n^'m \<Rightarrow> 'a ^'n) i A = (\<chi> j. ((A$i)$j))"  | 
| 
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1033  | 
definition%unimportant "(column::'n =>'a^'n^'m =>'a^'m) j A = (\<chi> i. ((A$i)$j))"  | 
| 
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1034  | 
definition%unimportant "rows(A::'a^'n^'m) = { row i A | i. i \<in> (UNIV :: 'm set)}"
 | 
| 
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1035  | 
definition%unimportant "columns(A::'a^'n^'m) = { column i A | i. i \<in> (UNIV :: 'n set)}"
 | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1036  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1037  | 
lemma%unimportant times0_left [simp]: "(0::'a::semiring_1^'n^'m) ** (A::'a ^'p^'n) = 0"  | 
| 
68073
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1038  | 
by (simp add: matrix_matrix_mult_def zero_vec_def)  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1039  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1040  | 
lemma%unimportant times0_right [simp]: "(A::'a::semiring_1^'n^'m) ** (0::'a ^'p^'n) = 0"  | 
| 
68073
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1041  | 
by (simp add: matrix_matrix_mult_def zero_vec_def)  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1042  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1043  | 
lemma%unimportant mat_0[simp]: "mat 0 = 0" by (vector mat_def)  | 
| 
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1044  | 
lemma%unimportant matrix_add_ldistrib: "(A ** (B + C)) = (A ** B) + (A ** C)"  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1045  | 
by (vector matrix_matrix_mult_def sum.distrib[symmetric] field_simps)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1046  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1047  | 
lemma%unimportant matrix_mul_lid [simp]:  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1048  | 
fixes A :: "'a::semiring_1 ^ 'm ^ 'n"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1049  | 
shows "mat 1 ** A = A"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1050  | 
apply (simp add: matrix_matrix_mult_def mat_def)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1051  | 
apply vector  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1052  | 
apply (auto simp only: if_distrib if_distribR sum.delta'[OF finite]  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1053  | 
mult_1_left mult_zero_left if_True UNIV_I)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1054  | 
done  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1055  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1056  | 
lemma%unimportant matrix_mul_rid [simp]:  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1057  | 
fixes A :: "'a::semiring_1 ^ 'm ^ 'n"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1058  | 
shows "A ** mat 1 = A"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1059  | 
apply (simp add: matrix_matrix_mult_def mat_def)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1060  | 
apply vector  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1061  | 
apply (auto simp only: if_distrib if_distribR sum.delta[OF finite]  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1062  | 
mult_1_right mult_zero_right if_True UNIV_I cong: if_cong)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1063  | 
done  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1064  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1065  | 
lemma%unimportant matrix_mul_assoc: "A ** (B ** C) = (A ** B) ** C"  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1066  | 
apply (vector matrix_matrix_mult_def sum_distrib_left sum_distrib_right mult.assoc)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1067  | 
apply (subst sum.swap)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1068  | 
apply simp  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1069  | 
done  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1070  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1071  | 
lemma%unimportant matrix_vector_mul_assoc: "A *v (B *v x) = (A ** B) *v x"  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1072  | 
apply (vector matrix_matrix_mult_def matrix_vector_mult_def  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1073  | 
sum_distrib_left sum_distrib_right mult.assoc)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1074  | 
apply (subst sum.swap)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1075  | 
apply simp  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1076  | 
done  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1077  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1078  | 
lemma%unimportant scalar_matrix_assoc:  | 
| 
68073
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1079  | 
  fixes A :: "('a::real_algebra_1)^'m^'n"
 | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1080  | 
shows "k *\<^sub>R (A ** B) = (k *\<^sub>R A) ** B"  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1081  | 
by (simp add: matrix_matrix_mult_def sum_distrib_left mult_ac vec_eq_iff scaleR_sum_right)  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1082  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1083  | 
lemma%unimportant matrix_scalar_ac:  | 
| 
68073
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1084  | 
  fixes A :: "('a::real_algebra_1)^'m^'n"
 | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1085  | 
shows "A ** (k *\<^sub>R B) = k *\<^sub>R A ** B"  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1086  | 
by (simp add: matrix_matrix_mult_def sum_distrib_left mult_ac vec_eq_iff)  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1087  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1088  | 
lemma%unimportant matrix_vector_mul_lid [simp]: "mat 1 *v x = (x::'a::semiring_1 ^ 'n)"  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1089  | 
apply (vector matrix_vector_mult_def mat_def)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1090  | 
apply (simp add: if_distrib if_distribR sum.delta' cong del: if_weak_cong)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1091  | 
done  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1092  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1093  | 
lemma%unimportant matrix_transpose_mul:  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1094  | 
"transpose(A ** B) = transpose B ** transpose (A::'a::comm_semiring_1^_^_)"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1095  | 
by (simp add: matrix_matrix_mult_def transpose_def vec_eq_iff mult.commute)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1096  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1097  | 
lemma%unimportant matrix_eq:  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1098  | 
fixes A B :: "'a::semiring_1 ^ 'n ^ 'm"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1099  | 
shows "A = B \<longleftrightarrow> (\<forall>x. A *v x = B *v x)" (is "?lhs \<longleftrightarrow> ?rhs")  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1100  | 
apply auto  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1101  | 
apply (subst vec_eq_iff)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1102  | 
apply clarify  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1103  | 
apply (clarsimp simp add: matrix_vector_mult_def if_distrib if_distribR vec_eq_iff cong del: if_weak_cong)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1104  | 
apply (erule_tac x="axis ia 1" in allE)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1105  | 
apply (erule_tac x="i" in allE)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1106  | 
apply (auto simp add: if_distrib if_distribR axis_def  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1107  | 
sum.delta[OF finite] cong del: if_weak_cong)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1108  | 
done  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1109  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1110  | 
lemma%unimportant matrix_vector_mul_component: "(A *v x)$k = inner (A$k) x"  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1111  | 
by (simp add: matrix_vector_mult_def inner_vec_def)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1112  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1113  | 
lemma%unimportant dot_lmul_matrix: "inner ((x::real ^_) v* A) y = inner x (A *v y)"  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1114  | 
apply (simp add: inner_vec_def matrix_vector_mult_def vector_matrix_mult_def sum_distrib_right sum_distrib_left ac_simps)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1115  | 
apply (subst sum.swap)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1116  | 
apply simp  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1117  | 
done  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1118  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1119  | 
lemma%unimportant transpose_mat [simp]: "transpose (mat n) = mat n"  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1120  | 
by (vector transpose_def mat_def)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1121  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1122  | 
lemma%unimportant transpose_transpose [simp]: "transpose(transpose A) = A"  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1123  | 
by (vector transpose_def)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1124  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1125  | 
lemma%unimportant row_transpose [simp]: "row i (transpose A) = column i A"  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1126  | 
by (simp add: row_def column_def transpose_def vec_eq_iff)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1127  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1128  | 
lemma%unimportant column_transpose [simp]: "column i (transpose A) = row i A"  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1129  | 
by (simp add: row_def column_def transpose_def vec_eq_iff)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1130  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1131  | 
lemma%unimportant rows_transpose [simp]: "rows(transpose A) = columns A"  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1132  | 
by (auto simp add: rows_def columns_def intro: set_eqI)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1133  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1134  | 
lemma%unimportant columns_transpose [simp]: "columns(transpose A) = rows A"  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1135  | 
by (metis transpose_transpose rows_transpose)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1136  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1137  | 
lemma%unimportant transpose_scalar: "transpose (k *\<^sub>R A) = k *\<^sub>R transpose A"  | 
| 
68073
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1138  | 
unfolding transpose_def  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1139  | 
by (simp add: vec_eq_iff)  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1140  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1141  | 
lemma%unimportant transpose_iff [iff]: "transpose A = transpose B \<longleftrightarrow> A = B"  | 
| 
68073
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1142  | 
by (metis transpose_transpose)  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1143  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1144  | 
lemma%unimportant matrix_mult_sum:  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1145  | 
"(A::'a::comm_semiring_1^'n^'m) *v x = sum (\<lambda>i. (x$i) *s column i A) (UNIV:: 'n set)"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1146  | 
by (simp add: matrix_vector_mult_def vec_eq_iff column_def mult.commute)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1147  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1148  | 
lemma%unimportant vector_componentwise:  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1149  | 
"(x::'a::ring_1^'n) = (\<chi> j. \<Sum>i\<in>UNIV. (x$i) * (axis i 1 :: 'a^'n) $ j)"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1150  | 
by (simp add: axis_def if_distrib sum.If_cases vec_eq_iff)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1151  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1152  | 
lemma%unimportant basis_expansion: "sum (\<lambda>i. (x$i) *s axis i 1) UNIV = (x::('a::ring_1) ^'n)"
 | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1153  | 
by (auto simp add: axis_def vec_eq_iff if_distrib sum.If_cases cong del: if_weak_cong)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1154  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1155  | 
|
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1156  | 
text\<open>Correspondence between matrices and linear operators.\<close>  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1157  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1158  | 
definition%important matrix :: "('a::{plus,times, one, zero}^'m \<Rightarrow> 'a ^ 'n) \<Rightarrow> 'a^'m^'n"
 | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1159  | 
where "matrix f = (\<chi> i j. (f(axis j 1))$i)"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1160  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1161  | 
lemma%unimportant matrix_id_mat_1: "matrix id = mat 1"  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1162  | 
by (simp add: mat_def matrix_def axis_def)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1163  | 
|
| 
69064
 
5840724b1d71
Prefix form of infix with * on either side no longer needs special treatment
 
nipkow 
parents: 
68833 
diff
changeset
 | 
1164  | 
lemma%unimportant matrix_scaleR: "(matrix ((*\<^sub>R) r)) = mat r"  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1165  | 
by (simp add: mat_def matrix_def axis_def if_distrib cong: if_cong)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1166  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1167  | 
lemma%unimportant matrix_vector_mul_linear[intro, simp]: "linear (\<lambda>x. A *v (x::'a::real_algebra_1 ^ _))"  | 
| 68074 | 1168  | 
by (simp add: linear_iff matrix_vector_mult_def vec_eq_iff field_simps sum_distrib_left  | 
1169  | 
sum.distrib scaleR_right.sum)  | 
|
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1170  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1171  | 
lemma%unimportant vector_matrix_left_distrib [algebra_simps]:  | 
| 
68073
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1172  | 
shows "(x + y) v* A = x v* A + y v* A"  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1173  | 
unfolding vector_matrix_mult_def  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1174  | 
by (simp add: algebra_simps sum.distrib vec_eq_iff)  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1175  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1176  | 
lemma%unimportant matrix_vector_right_distrib [algebra_simps]:  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1177  | 
"A *v (x + y) = A *v x + A *v y"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1178  | 
by (vector matrix_vector_mult_def sum.distrib distrib_left)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1179  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1180  | 
lemma%unimportant matrix_vector_mult_diff_distrib [algebra_simps]:  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1181  | 
fixes A :: "'a::ring_1^'n^'m"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1182  | 
shows "A *v (x - y) = A *v x - A *v y"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1183  | 
by (vector matrix_vector_mult_def sum_subtractf right_diff_distrib)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1184  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1185  | 
lemma%unimportant matrix_vector_mult_scaleR[algebra_simps]:  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1186  | 
fixes A :: "real^'n^'m"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1187  | 
shows "A *v (c *\<^sub>R x) = c *\<^sub>R (A *v x)"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1188  | 
using linear_iff matrix_vector_mul_linear by blast  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1189  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1190  | 
lemma%unimportant matrix_vector_mult_0_right [simp]: "A *v 0 = 0"  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1191  | 
by (simp add: matrix_vector_mult_def vec_eq_iff)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1192  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1193  | 
lemma%unimportant matrix_vector_mult_0 [simp]: "0 *v w = 0"  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1194  | 
by (simp add: matrix_vector_mult_def vec_eq_iff)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1195  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1196  | 
lemma%unimportant matrix_vector_mult_add_rdistrib [algebra_simps]:  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1197  | 
"(A + B) *v x = (A *v x) + (B *v x)"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1198  | 
by (vector matrix_vector_mult_def sum.distrib distrib_right)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1199  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1200  | 
lemma%unimportant matrix_vector_mult_diff_rdistrib [algebra_simps]:  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1201  | 
fixes A :: "'a :: ring_1^'n^'m"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1202  | 
shows "(A - B) *v x = (A *v x) - (B *v x)"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1203  | 
by (vector matrix_vector_mult_def sum_subtractf left_diff_distrib)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1204  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1205  | 
lemma%unimportant matrix_vector_column:  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1206  | 
"(A::'a::comm_semiring_1^'n^_) *v x = sum (\<lambda>i. (x$i) *s ((transpose A)$i)) (UNIV:: 'n set)"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1207  | 
by (simp add: matrix_vector_mult_def transpose_def vec_eq_iff mult.commute)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1208  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1209  | 
subsection%important\<open>Inverse matrices (not necessarily square)\<close>  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1210  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1211  | 
definition%important  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1212  | 
"invertible(A::'a::semiring_1^'n^'m) \<longleftrightarrow> (\<exists>A'::'a^'m^'n. A ** A' = mat 1 \<and> A' ** A = mat 1)"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1213  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1214  | 
definition%important  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1215  | 
"matrix_inv(A:: 'a::semiring_1^'n^'m) =  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1216  | 
(SOME A'::'a^'m^'n. A ** A' = mat 1 \<and> A' ** A = mat 1)"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1217  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1218  | 
lemma%unimportant inj_matrix_vector_mult:  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1219  | 
fixes A::"'a::field^'n^'m"  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1220  | 
assumes "invertible A"  | 
| 
69064
 
5840724b1d71
Prefix form of infix with * on either side no longer needs special treatment
 
nipkow 
parents: 
68833 
diff
changeset
 | 
1221  | 
shows "inj ((*v) A)"  | 
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1222  | 
by (metis assms inj_on_inverseI invertible_def matrix_vector_mul_assoc matrix_vector_mul_lid)  | 
| 
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1223  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1224  | 
lemma%important scalar_invertible:  | 
| 
68073
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1225  | 
  fixes A :: "('a::real_algebra_1)^'m^'n"
 | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1226  | 
assumes "k \<noteq> 0" and "invertible A"  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1227  | 
shows "invertible (k *\<^sub>R A)"  | 
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1228  | 
proof%unimportant -  | 
| 
68073
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1229  | 
obtain A' where "A ** A' = mat 1" and "A' ** A = mat 1"  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1230  | 
using assms unfolding invertible_def by auto  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1231  | 
with `k \<noteq> 0`  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1232  | 
have "(k *\<^sub>R A) ** ((1/k) *\<^sub>R A') = mat 1" "((1/k) *\<^sub>R A') ** (k *\<^sub>R A) = mat 1"  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1233  | 
by (simp_all add: assms matrix_scalar_ac)  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1234  | 
thus "invertible (k *\<^sub>R A)"  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1235  | 
unfolding invertible_def by auto  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1236  | 
qed  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1237  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1238  | 
lemma%unimportant scalar_invertible_iff:  | 
| 
68073
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1239  | 
  fixes A :: "('a::real_algebra_1)^'m^'n"
 | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1240  | 
assumes "k \<noteq> 0" and "invertible A"  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1241  | 
shows "invertible (k *\<^sub>R A) \<longleftrightarrow> k \<noteq> 0 \<and> invertible A"  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1242  | 
by (simp add: assms scalar_invertible)  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1243  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1244  | 
lemma%unimportant vector_transpose_matrix [simp]: "x v* transpose A = A *v x"  | 
| 
68073
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1245  | 
unfolding transpose_def vector_matrix_mult_def matrix_vector_mult_def  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1246  | 
by simp  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1247  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1248  | 
lemma%unimportant transpose_matrix_vector [simp]: "transpose A *v x = x v* A"  | 
| 
68073
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1249  | 
unfolding transpose_def vector_matrix_mult_def matrix_vector_mult_def  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1250  | 
by simp  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1251  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1252  | 
lemma%unimportant vector_scalar_commute:  | 
| 
68073
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1253  | 
  fixes A :: "'a::{field}^'m^'n"
 | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1254  | 
shows "A *v (c *s x) = c *s (A *v x)"  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1255  | 
by (simp add: vector_scalar_mult_def matrix_vector_mult_def mult_ac sum_distrib_left)  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1256  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1257  | 
lemma%unimportant scalar_vector_matrix_assoc:  | 
| 
68073
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1258  | 
  fixes k :: "'a::{field}" and x :: "'a::{field}^'n" and A :: "'a^'m^'n"
 | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1259  | 
shows "(k *s x) v* A = k *s (x v* A)"  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1260  | 
by (metis transpose_matrix_vector vector_scalar_commute)  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1261  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1262  | 
lemma%unimportant vector_matrix_mult_0 [simp]: "0 v* A = 0"  | 
| 
68073
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1263  | 
unfolding vector_matrix_mult_def by (simp add: zero_vec_def)  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1264  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1265  | 
lemma%unimportant vector_matrix_mult_0_right [simp]: "x v* 0 = 0"  | 
| 
68073
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1266  | 
unfolding vector_matrix_mult_def by (simp add: zero_vec_def)  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1267  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1268  | 
lemma%unimportant vector_matrix_mul_rid [simp]:  | 
| 
68073
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1269  | 
  fixes v :: "('a::semiring_1)^'n"
 | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1270  | 
shows "v v* mat 1 = v"  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1271  | 
by (metis matrix_vector_mul_lid transpose_mat vector_transpose_matrix)  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1272  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1273  | 
lemma%unimportant scaleR_vector_matrix_assoc:  | 
| 
68073
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1274  | 
fixes k :: real and x :: "real^'n" and A :: "real^'m^'n"  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1275  | 
shows "(k *\<^sub>R x) v* A = k *\<^sub>R (x v* A)"  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1276  | 
by (metis matrix_vector_mult_scaleR transpose_matrix_vector)  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1277  | 
|
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1278  | 
lemma%important vector_scaleR_matrix_ac:  | 
| 
68073
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1279  | 
fixes k :: real and x :: "real^'n" and A :: "real^'m^'n"  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1280  | 
shows "x v* (k *\<^sub>R A) = k *\<^sub>R (x v* A)"  | 
| 
68833
 
fde093888c16
tagged 21 theories in the Analysis library for the manual
 
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk> 
parents: 
68188 
diff
changeset
 | 
1281  | 
proof%unimportant -  | 
| 
68073
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1282  | 
have "x v* (k *\<^sub>R A) = (k *\<^sub>R x) v* A"  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1283  | 
unfolding vector_matrix_mult_def  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1284  | 
by (simp add: algebra_simps)  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1285  | 
with scaleR_vector_matrix_assoc  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1286  | 
show "x v* (k *\<^sub>R A) = k *\<^sub>R (x v* A)"  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1287  | 
by auto  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1288  | 
qed  | 
| 
 
fad29d2a17a5
merged; resolved conflicts manually (esp. lemmas that have been moved from Linear_Algebra and Cartesian_Euclidean_Space)
 
immler 
parents: 
68072 
diff
changeset
 | 
1289  | 
|
| 
68072
 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 
immler 
parents: 
67982 
diff
changeset
 | 
1290  | 
end  |