src/HOL/Real/RealVector.thy
author huffman
Sun, 17 Sep 2006 16:42:38 +0200
changeset 20560 49996715bc6e
parent 20554 c433e78d4203
child 20584 60b1d52a455d
permissions -rw-r--r--
norm_one is now proved from other class axioms
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
     1
(*  Title       : RealVector.thy
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
     2
    ID:         $Id$
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
     3
    Author      : Brian Huffman
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
     4
*)
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
     5
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
     6
header {* Vector Spaces and Algebras over the Reals *}
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
     7
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
     8
theory RealVector
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
     9
imports RealDef
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    10
begin
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    11
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    12
subsection {* Locale for additive functions *}
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    13
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    14
locale additive =
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    15
  fixes f :: "'a::ab_group_add \<Rightarrow> 'b::ab_group_add"
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    16
  assumes add: "f (x + y) = f x + f y"
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    17
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    18
lemma (in additive) zero: "f 0 = 0"
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    19
proof -
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    20
  have "f 0 = f (0 + 0)" by simp
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    21
  also have "\<dots> = f 0 + f 0" by (rule add)
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    22
  finally show "f 0 = 0" by simp
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    23
qed
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    24
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    25
lemma (in additive) minus: "f (- x) = - f x"
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    26
proof -
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    27
  have "f (- x) + f x = f (- x + x)" by (rule add [symmetric])
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    28
  also have "\<dots> = - f x + f x" by (simp add: zero)
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    29
  finally show "f (- x) = - f x" by (rule add_right_imp_eq)
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    30
qed
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    31
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    32
lemma (in additive) diff: "f (x - y) = f x - f y"
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    33
by (simp add: diff_def add minus)
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    34
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    35
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    36
subsection {* Real vector spaces *}
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    37
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    38
axclass scaleR < type
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    39
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    40
consts
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    41
  scaleR :: "real \<Rightarrow> 'a \<Rightarrow> 'a::scaleR" (infixr "*#" 75)
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    42
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    43
syntax (xsymbols)
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    44
  scaleR :: "real \<Rightarrow> 'a \<Rightarrow> 'a::scaleR" (infixr "*\<^sub>R" 75)
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    45
20554
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
    46
instance real :: scaleR ..
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
    47
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
    48
defs (overloaded)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
    49
  real_scaleR_def: "a *# x \<equiv> a * x"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
    50
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    51
axclass real_vector < scaleR, ab_group_add
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    52
  scaleR_right_distrib: "a *# (x + y) = a *# x + a *# y"
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    53
  scaleR_left_distrib: "(a + b) *# x = a *# x + b *# x"
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    54
  scaleR_assoc: "(a * b) *# x = a *# b *# x"
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    55
  scaleR_one [simp]: "1 *# x = x"
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    56
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    57
axclass real_algebra < real_vector, ring
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    58
  mult_scaleR_left: "a *# x * y = a *# (x * y)"
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    59
  mult_scaleR_right: "x * a *# y = a *# (x * y)"
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    60
20554
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
    61
axclass real_algebra_1 < real_algebra, ring_1
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
    62
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
    63
instance real :: real_algebra_1
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
    64
apply (intro_classes, unfold real_scaleR_def)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
    65
apply (rule right_distrib)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
    66
apply (rule left_distrib)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
    67
apply (rule mult_assoc)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
    68
apply (rule mult_1_left)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
    69
apply (rule mult_assoc)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
    70
apply (rule mult_left_commute)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
    71
done
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
    72
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    73
lemmas scaleR_scaleR = scaleR_assoc [symmetric]
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    74
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    75
lemma scaleR_left_commute:
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    76
  fixes x :: "'a::real_vector"
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    77
  shows "a *# b *# x = b *# a *# x"
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    78
by (simp add: scaleR_scaleR mult_commute)
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    79
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    80
lemma additive_scaleR_right: "additive (\<lambda>x. a *# x :: 'a::real_vector)"
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    81
by (rule additive.intro, rule scaleR_right_distrib)
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    82
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    83
lemma additive_scaleR_left: "additive (\<lambda>a. a *# x :: 'a::real_vector)"
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    84
by (rule additive.intro, rule scaleR_left_distrib)
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    85
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    86
lemmas scaleR_zero_left [simp] =
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    87
  additive.zero [OF additive_scaleR_left, standard]
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    88
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    89
lemmas scaleR_zero_right [simp] =
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    90
  additive.zero [OF additive_scaleR_right, standard]
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    91
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    92
lemmas scaleR_minus_left [simp] =
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    93
  additive.minus [OF additive_scaleR_left, standard]
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    94
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    95
lemmas scaleR_minus_right [simp] =
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    96
  additive.minus [OF additive_scaleR_right, standard]
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    97
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    98
lemmas scaleR_left_diff_distrib =
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    99
  additive.diff [OF additive_scaleR_left, standard]
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   100
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   101
lemmas scaleR_right_diff_distrib =
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   102
  additive.diff [OF additive_scaleR_right, standard]
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   103
20554
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   104
lemma scaleR_eq_0_iff:
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   105
  fixes x :: "'a::real_vector"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   106
  shows "(a *# x = 0) = (a = 0 \<or> x = 0)"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   107
proof cases
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   108
  assume "a = 0" thus ?thesis by simp
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   109
next
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   110
  assume anz [simp]: "a \<noteq> 0"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   111
  { assume "a *# x = 0"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   112
    hence "inverse a *# a *# x = 0" by simp
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   113
    hence "x = 0" by (simp (no_asm_use) add: scaleR_scaleR)}
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   114
  thus ?thesis by force
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   115
qed
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   116
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   117
lemma scaleR_left_imp_eq:
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   118
  fixes x y :: "'a::real_vector"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   119
  shows "\<lbrakk>a \<noteq> 0; a *# x = a *# y\<rbrakk> \<Longrightarrow> x = y"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   120
proof -
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   121
  assume nonzero: "a \<noteq> 0"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   122
  assume "a *# x = a *# y"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   123
  hence "a *# (x - y) = 0"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   124
     by (simp add: scaleR_right_diff_distrib)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   125
  hence "x - y = 0"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   126
     by (simp add: scaleR_eq_0_iff nonzero)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   127
  thus "x = y" by simp
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   128
qed
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   129
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   130
lemma scaleR_right_imp_eq:
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   131
  fixes x y :: "'a::real_vector"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   132
  shows "\<lbrakk>x \<noteq> 0; a *# x = b *# x\<rbrakk> \<Longrightarrow> a = b"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   133
proof -
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   134
  assume nonzero: "x \<noteq> 0"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   135
  assume "a *# x = b *# x"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   136
  hence "(a - b) *# x = 0"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   137
     by (simp add: scaleR_left_diff_distrib)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   138
  hence "a - b = 0"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   139
     by (simp add: scaleR_eq_0_iff nonzero)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   140
  thus "a = b" by simp
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   141
qed
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   142
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   143
lemma scaleR_cancel_left:
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   144
  fixes x y :: "'a::real_vector"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   145
  shows "(a *# x = a *# y) = (x = y \<or> a = 0)"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   146
by (auto intro: scaleR_left_imp_eq)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   147
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   148
lemma scaleR_cancel_right:
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   149
  fixes x y :: "'a::real_vector"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   150
  shows "(a *# x = b *# x) = (a = b \<or> x = 0)"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   151
by (auto intro: scaleR_right_imp_eq)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   152
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   153
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   154
subsection {* Embedding of the Reals into any @{text real_algebra_1}:
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   155
@{term of_real} *}
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   156
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   157
definition
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   158
  of_real :: "real \<Rightarrow> 'a::real_algebra_1"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   159
  "of_real r = r *# 1"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   160
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   161
lemma of_real_0 [simp]: "of_real 0 = 0"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   162
by (simp add: of_real_def)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   163
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   164
lemma of_real_1 [simp]: "of_real 1 = 1"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   165
by (simp add: of_real_def)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   166
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   167
lemma of_real_add [simp]: "of_real (x + y) = of_real x + of_real y"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   168
by (simp add: of_real_def scaleR_left_distrib)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   169
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   170
lemma of_real_minus [simp]: "of_real (- x) = - of_real x"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   171
by (simp add: of_real_def)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   172
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   173
lemma of_real_diff [simp]: "of_real (x - y) = of_real x - of_real y"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   174
by (simp add: of_real_def scaleR_left_diff_distrib)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   175
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   176
lemma of_real_mult [simp]: "of_real (x * y) = of_real x * of_real y"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   177
by (simp add: of_real_def mult_scaleR_left scaleR_scaleR)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   178
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   179
lemma of_real_eq_iff [simp]: "(of_real x = of_real y) = (x = y)"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   180
by (simp add: of_real_def scaleR_cancel_right)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   181
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   182
text{*Special cases where either operand is zero*}
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   183
lemmas of_real_0_eq_iff = of_real_eq_iff [of 0, simplified]
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   184
lemmas of_real_eq_0_iff = of_real_eq_iff [of _ 0, simplified]
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   185
declare of_real_0_eq_iff [simp]
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   186
declare of_real_eq_0_iff [simp]
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   187
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   188
lemma of_real_eq_id [simp]: "of_real = (id :: real \<Rightarrow> real)"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   189
proof
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   190
  fix r
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   191
  show "of_real r = id r"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   192
    by (simp add: of_real_def real_scaleR_def)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   193
qed
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   194
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   195
text{*Collapse nested embeddings*}
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   196
lemma of_real_of_nat_eq [simp]: "of_real (of_nat n) = of_nat n"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   197
by (induct n, auto)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   198
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   199
lemma of_real_of_int_eq [simp]: "of_real (of_int z) = of_int z"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   200
by (cases z rule: int_diff_cases, simp)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   201
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   202
lemma of_real_number_of_eq:
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   203
  "of_real (number_of w) = (number_of w :: 'a::{number_ring,real_algebra_1})"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   204
by (simp add: number_of_eq)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   205
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   206
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   207
subsection {* The Set of Real Numbers *}
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   208
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   209
constdefs
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   210
   Reals :: "'a::real_algebra_1 set"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   211
   "Reals \<equiv> range of_real"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   212
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   213
const_syntax (xsymbols)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   214
  Reals  ("\<real>")
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   215
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   216
lemma of_real_in_Reals [simp]: "of_real r \<in> Reals"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   217
by (simp add: Reals_def)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   218
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   219
lemma Reals_0 [simp]: "0 \<in> Reals"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   220
apply (unfold Reals_def)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   221
apply (rule range_eqI)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   222
apply (rule of_real_0 [symmetric])
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   223
done
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   224
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   225
lemma Reals_1 [simp]: "1 \<in> Reals"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   226
apply (unfold Reals_def)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   227
apply (rule range_eqI)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   228
apply (rule of_real_1 [symmetric])
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   229
done
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   230
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   231
lemma Reals_add [simp]: "\<lbrakk>a \<in> Reals; b \<in> Reals\<rbrakk> \<Longrightarrow> a+b \<in> Reals"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   232
apply (auto simp add: Reals_def)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   233
apply (rule range_eqI)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   234
apply (rule of_real_add [symmetric])
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   235
done
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   236
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   237
lemma Reals_mult [simp]: "\<lbrakk>a \<in> Reals; b \<in> Reals\<rbrakk> \<Longrightarrow> a*b \<in> Reals"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   238
apply (auto simp add: Reals_def)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   239
apply (rule range_eqI)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   240
apply (rule of_real_mult [symmetric])
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   241
done
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   242
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   243
lemma Reals_cases [cases set: Reals]:
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   244
  assumes "q \<in> \<real>"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   245
  obtains (of_real) r where "q = of_real r"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   246
  unfolding Reals_def
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   247
proof -
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   248
  from `q \<in> \<real>` have "q \<in> range of_real" unfolding Reals_def .
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   249
  then obtain r where "q = of_real r" ..
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   250
  then show thesis ..
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   251
qed
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   252
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   253
lemma Reals_induct [case_names of_real, induct set: Reals]:
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   254
  "q \<in> \<real> \<Longrightarrow> (\<And>r. P (of_real r)) \<Longrightarrow> P q"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   255
  by (rule Reals_cases) auto
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   256
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   257
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   258
subsection {* Real normed vector spaces *}
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   259
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   260
axclass norm < type
20533
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   261
consts norm :: "'a::norm \<Rightarrow> real"
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   262
20554
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   263
instance real :: norm ..
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   264
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   265
defs (overloaded)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   266
  real_norm_def: "norm r \<equiv> \<bar>r\<bar>"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   267
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   268
axclass normed < plus, zero, norm
20533
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   269
  norm_ge_zero [simp]: "0 \<le> norm x"
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   270
  norm_eq_zero [simp]: "(norm x = 0) = (x = 0)"
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   271
  norm_triangle_ineq: "norm (x + y) \<le> norm x + norm y"
20554
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   272
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   273
axclass real_normed_vector < real_vector, normed
20533
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   274
  norm_scaleR: "norm (a *# x) = \<bar>a\<bar> * norm x"
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   275
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   276
axclass real_normed_algebra < real_normed_vector, real_algebra
20533
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   277
  norm_mult_ineq: "norm (x * y) \<le> norm x * norm y"
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   278
20554
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   279
axclass real_normed_div_algebra < normed, real_algebra_1, division_ring
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   280
  norm_of_real: "norm (of_real r) = abs r"
20533
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   281
  norm_mult: "norm (x * y) = norm x * norm y"
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   282
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   283
instance real_normed_div_algebra < real_normed_algebra
20554
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   284
proof
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   285
  fix a :: real and x :: 'a
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   286
  have "norm (a *# x) = norm (of_real a * x)"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   287
    by (simp add: of_real_def mult_scaleR_left)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   288
  also have "\<dots> = abs a * norm x"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   289
    by (simp add: norm_mult norm_of_real)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   290
  finally show "norm (a *# x) = abs a * norm x" .
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   291
next
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   292
  fix x y :: 'a
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   293
  show "norm (x * y) \<le> norm x * norm y"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   294
    by (simp add: norm_mult)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   295
qed
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   296
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   297
instance real :: real_normed_div_algebra
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   298
apply (intro_classes, unfold real_norm_def)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   299
apply (rule abs_ge_zero)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   300
apply (rule abs_eq_0)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   301
apply (rule abs_triangle_ineq)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   302
apply simp
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   303
apply (rule abs_mult)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   304
done
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   305
20533
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   306
lemma norm_zero [simp]: "norm (0::'a::real_normed_vector) = 0"
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   307
by simp
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   308
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   309
lemma zero_less_norm_iff [simp]:
20533
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   310
  fixes x :: "'a::real_normed_vector" shows "(0 < norm x) = (x \<noteq> 0)"
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   311
by (simp add: order_less_le)
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   312
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   313
lemma norm_minus_cancel [simp]:
20533
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   314
  fixes x :: "'a::real_normed_vector" shows "norm (- x) = norm x"
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   315
proof -
20533
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   316
  have "norm (- x) = norm (- 1 *# x)"
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   317
    by (simp only: scaleR_minus_left scaleR_one)
20533
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   318
  also have "\<dots> = \<bar>- 1\<bar> * norm x"
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   319
    by (rule norm_scaleR)
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   320
  finally show ?thesis by simp
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   321
qed
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   322
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   323
lemma norm_minus_commute:
20533
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   324
  fixes a b :: "'a::real_normed_vector" shows "norm (a - b) = norm (b - a)"
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   325
proof -
20533
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   326
  have "norm (a - b) = norm (- (a - b))"
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   327
    by (simp only: norm_minus_cancel)
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   328
  also have "\<dots> = norm (b - a)" by simp
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   329
  finally show ?thesis .
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   330
qed
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   331
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   332
lemma norm_triangle_ineq2:
20533
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   333
  fixes a :: "'a::real_normed_vector"
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   334
  shows "norm a - norm b \<le> norm (a - b)"
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   335
proof -
20533
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   336
  have "norm (a - b + b) \<le> norm (a - b) + norm b"
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   337
    by (rule norm_triangle_ineq)
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   338
  also have "(a - b + b) = a"
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   339
    by simp
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   340
  finally show ?thesis
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   341
    by (simp add: compare_rls)
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   342
qed
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   343
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   344
lemma norm_triangle_ineq4:
20533
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   345
  fixes a :: "'a::real_normed_vector"
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   346
  shows "norm (a - b) \<le> norm a + norm b"
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   347
proof -
20533
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   348
  have "norm (a - b) = norm (a + - b)"
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   349
    by (simp only: diff_minus)
20533
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   350
  also have "\<dots> \<le> norm a + norm (- b)"
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   351
    by (rule norm_triangle_ineq)
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   352
  finally show ?thesis
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   353
    by simp
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   354
qed
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   355
20551
ba543692bfa1 add theorem norm_diff_triangle_ineq
huffman
parents: 20533
diff changeset
   356
lemma norm_diff_triangle_ineq:
ba543692bfa1 add theorem norm_diff_triangle_ineq
huffman
parents: 20533
diff changeset
   357
  fixes a b c d :: "'a::real_normed_vector"
ba543692bfa1 add theorem norm_diff_triangle_ineq
huffman
parents: 20533
diff changeset
   358
  shows "norm ((a + b) - (c + d)) \<le> norm (a - c) + norm (b - d)"
ba543692bfa1 add theorem norm_diff_triangle_ineq
huffman
parents: 20533
diff changeset
   359
proof -
ba543692bfa1 add theorem norm_diff_triangle_ineq
huffman
parents: 20533
diff changeset
   360
  have "norm ((a + b) - (c + d)) = norm ((a - c) + (b - d))"
ba543692bfa1 add theorem norm_diff_triangle_ineq
huffman
parents: 20533
diff changeset
   361
    by (simp add: diff_minus add_ac)
ba543692bfa1 add theorem norm_diff_triangle_ineq
huffman
parents: 20533
diff changeset
   362
  also have "\<dots> \<le> norm (a - c) + norm (b - d)"
ba543692bfa1 add theorem norm_diff_triangle_ineq
huffman
parents: 20533
diff changeset
   363
    by (rule norm_triangle_ineq)
ba543692bfa1 add theorem norm_diff_triangle_ineq
huffman
parents: 20533
diff changeset
   364
  finally show ?thesis .
ba543692bfa1 add theorem norm_diff_triangle_ineq
huffman
parents: 20533
diff changeset
   365
qed
ba543692bfa1 add theorem norm_diff_triangle_ineq
huffman
parents: 20533
diff changeset
   366
20560
49996715bc6e norm_one is now proved from other class axioms
huffman
parents: 20554
diff changeset
   367
lemma norm_one [simp]: "norm (1::'a::real_normed_div_algebra) = 1"
49996715bc6e norm_one is now proved from other class axioms
huffman
parents: 20554
diff changeset
   368
proof -
49996715bc6e norm_one is now proved from other class axioms
huffman
parents: 20554
diff changeset
   369
  have "norm (of_real 1 :: 'a) = abs 1"
49996715bc6e norm_one is now proved from other class axioms
huffman
parents: 20554
diff changeset
   370
    by (rule norm_of_real)
49996715bc6e norm_one is now proved from other class axioms
huffman
parents: 20554
diff changeset
   371
  thus ?thesis by simp
49996715bc6e norm_one is now proved from other class axioms
huffman
parents: 20554
diff changeset
   372
qed
49996715bc6e norm_one is now proved from other class axioms
huffman
parents: 20554
diff changeset
   373
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   374
lemma nonzero_norm_inverse:
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   375
  fixes a :: "'a::real_normed_div_algebra"
20533
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   376
  shows "a \<noteq> 0 \<Longrightarrow> norm (inverse a) = inverse (norm a)"
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   377
apply (rule inverse_unique [symmetric])
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   378
apply (simp add: norm_mult [symmetric])
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   379
done
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   380
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   381
lemma norm_inverse:
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   382
  fixes a :: "'a::{real_normed_div_algebra,division_by_zero}"
20533
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   383
  shows "norm (inverse a) = inverse (norm a)"
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   384
apply (case_tac "a = 0", simp)
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   385
apply (erule nonzero_norm_inverse)
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   386
done
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   387
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   388
end