src/HOL/Real/RealVector.thy
author huffman
Thu, 28 Sep 2006 19:04:13 +0200
changeset 20763 052b348a98a9
parent 20722 741737aa70b2
child 20772 7a51ed817ec7
permissions -rw-r--r--
rearranged axioms and simp rules for scaleR
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
20684
74e8b46abb97 add lemma norm_power
huffman
parents: 20584
diff changeset
     9
imports RealPow
20504
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
20763
052b348a98a9 rearranged axioms and simp rules for scaleR
huffman
parents: 20722
diff changeset
    43
abbreviation
052b348a98a9 rearranged axioms and simp rules for scaleR
huffman
parents: 20722
diff changeset
    44
  divideR :: "'a \<Rightarrow> real \<Rightarrow> 'a::scaleR" (infixl "'/#" 70)
052b348a98a9 rearranged axioms and simp rules for scaleR
huffman
parents: 20722
diff changeset
    45
  "x /# r == inverse r *# x"
052b348a98a9 rearranged axioms and simp rules for scaleR
huffman
parents: 20722
diff changeset
    46
052b348a98a9 rearranged axioms and simp rules for scaleR
huffman
parents: 20722
diff changeset
    47
const_syntax (xsymbols)
052b348a98a9 rearranged axioms and simp rules for scaleR
huffman
parents: 20722
diff changeset
    48
  scaleR (infixr "*\<^sub>R" 75)
052b348a98a9 rearranged axioms and simp rules for scaleR
huffman
parents: 20722
diff changeset
    49
  divideR (infixl "'/\<^sub>R" 70)
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    50
20554
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
    51
instance real :: scaleR ..
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
    52
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
    53
defs (overloaded)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
    54
  real_scaleR_def: "a *# x \<equiv> a * x"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
    55
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    56
axclass real_vector < scaleR, ab_group_add
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    57
  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
    58
  scaleR_left_distrib: "(a + b) *# x = a *# x + b *# x"
20763
052b348a98a9 rearranged axioms and simp rules for scaleR
huffman
parents: 20722
diff changeset
    59
  scaleR_scaleR [simp]: "a *# b *# x = (a * b) *# x"
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    60
  scaleR_one [simp]: "1 *# x = x"
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    61
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    62
axclass real_algebra < real_vector, ring
20763
052b348a98a9 rearranged axioms and simp rules for scaleR
huffman
parents: 20722
diff changeset
    63
  mult_scaleR_left [simp]: "a *# x * y = a *# (x * y)"
052b348a98a9 rearranged axioms and simp rules for scaleR
huffman
parents: 20722
diff changeset
    64
  mult_scaleR_right [simp]: "x * a *# y = a *# (x * y)"
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    65
20554
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
    66
axclass real_algebra_1 < real_algebra, ring_1
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
    67
20584
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
    68
axclass real_div_algebra < real_algebra_1, division_ring
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
    69
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
    70
axclass real_field < real_div_algebra, field
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
    71
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
    72
instance real :: real_field
20554
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
    73
apply (intro_classes, unfold real_scaleR_def)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
    74
apply (rule right_distrib)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
    75
apply (rule left_distrib)
20763
052b348a98a9 rearranged axioms and simp rules for scaleR
huffman
parents: 20722
diff changeset
    76
apply (rule mult_assoc [symmetric])
20554
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
    77
apply (rule mult_1_left)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
    78
apply (rule mult_assoc)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
    79
apply (rule mult_left_commute)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
    80
done
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
    81
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    82
lemma scaleR_left_commute:
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    83
  fixes x :: "'a::real_vector"
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    84
  shows "a *# b *# x = b *# a *# x"
20763
052b348a98a9 rearranged axioms and simp rules for scaleR
huffman
parents: 20722
diff changeset
    85
by (simp add: mult_commute)
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    86
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    87
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
    88
by (rule additive.intro, rule scaleR_right_distrib)
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    89
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    90
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
    91
by (rule additive.intro, rule scaleR_left_distrib)
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    92
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    93
lemmas scaleR_zero_left [simp] =
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    94
  additive.zero [OF additive_scaleR_left, standard]
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    95
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    96
lemmas scaleR_zero_right [simp] =
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    97
  additive.zero [OF additive_scaleR_right, standard]
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    98
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
    99
lemmas scaleR_minus_left [simp] =
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   100
  additive.minus [OF additive_scaleR_left, standard]
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   101
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   102
lemmas scaleR_minus_right [simp] =
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   103
  additive.minus [OF additive_scaleR_right, standard]
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   104
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   105
lemmas scaleR_left_diff_distrib =
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   106
  additive.diff [OF additive_scaleR_left, standard]
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   107
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   108
lemmas scaleR_right_diff_distrib =
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   109
  additive.diff [OF additive_scaleR_right, standard]
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   110
20554
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   111
lemma scaleR_eq_0_iff:
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   112
  fixes x :: "'a::real_vector"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   113
  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
   114
proof cases
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   115
  assume "a = 0" thus ?thesis by simp
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   116
next
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   117
  assume anz [simp]: "a \<noteq> 0"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   118
  { assume "a *# x = 0"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   119
    hence "inverse a *# a *# x = 0" by simp
20763
052b348a98a9 rearranged axioms and simp rules for scaleR
huffman
parents: 20722
diff changeset
   120
    hence "x = 0" by simp }
20554
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   121
  thus ?thesis by force
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   122
qed
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   123
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   124
lemma scaleR_left_imp_eq:
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   125
  fixes x y :: "'a::real_vector"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   126
  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
   127
proof -
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   128
  assume nonzero: "a \<noteq> 0"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   129
  assume "a *# x = a *# y"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   130
  hence "a *# (x - y) = 0"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   131
     by (simp add: scaleR_right_diff_distrib)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   132
  hence "x - y = 0"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   133
     by (simp add: scaleR_eq_0_iff nonzero)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   134
  thus "x = y" by simp
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   135
qed
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   136
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   137
lemma scaleR_right_imp_eq:
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   138
  fixes x y :: "'a::real_vector"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   139
  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
   140
proof -
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   141
  assume nonzero: "x \<noteq> 0"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   142
  assume "a *# x = b *# x"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   143
  hence "(a - b) *# x = 0"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   144
     by (simp add: scaleR_left_diff_distrib)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   145
  hence "a - b = 0"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   146
     by (simp add: scaleR_eq_0_iff nonzero)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   147
  thus "a = b" by simp
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   148
qed
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   149
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   150
lemma scaleR_cancel_left:
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   151
  fixes x y :: "'a::real_vector"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   152
  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
   153
by (auto intro: scaleR_left_imp_eq)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   154
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   155
lemma scaleR_cancel_right:
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   156
  fixes x y :: "'a::real_vector"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   157
  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
   158
by (auto intro: scaleR_right_imp_eq)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   159
20584
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   160
lemma nonzero_inverse_scaleR_distrib:
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   161
  fixes x :: "'a::real_div_algebra"
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   162
  shows "\<lbrakk>a \<noteq> 0; x \<noteq> 0\<rbrakk> \<Longrightarrow> inverse (a *# x) = inverse a *# inverse x"
20763
052b348a98a9 rearranged axioms and simp rules for scaleR
huffman
parents: 20722
diff changeset
   163
by (rule inverse_unique, simp)
20584
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   164
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   165
lemma inverse_scaleR_distrib:
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   166
  fixes x :: "'a::{real_div_algebra,division_by_zero}"
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   167
  shows "inverse (a *# x) = inverse a *# inverse x"
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   168
apply (case_tac "a = 0", simp)
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   169
apply (case_tac "x = 0", simp)
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   170
apply (erule (1) nonzero_inverse_scaleR_distrib)
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   171
done
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   172
20554
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   173
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   174
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
   175
@{term of_real} *}
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   176
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   177
definition
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   178
  of_real :: "real \<Rightarrow> 'a::real_algebra_1"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   179
  "of_real r = r *# 1"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   180
20763
052b348a98a9 rearranged axioms and simp rules for scaleR
huffman
parents: 20722
diff changeset
   181
lemma scaleR_conv_of_real: "r *# x = of_real r * x"
052b348a98a9 rearranged axioms and simp rules for scaleR
huffman
parents: 20722
diff changeset
   182
by (simp add: of_real_def)
052b348a98a9 rearranged axioms and simp rules for scaleR
huffman
parents: 20722
diff changeset
   183
20554
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   184
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
   185
by (simp add: of_real_def)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   186
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   187
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
   188
by (simp add: of_real_def)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   189
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   190
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
   191
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
   192
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   193
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
   194
by (simp add: of_real_def)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   195
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   196
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
   197
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
   198
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   199
lemma of_real_mult [simp]: "of_real (x * y) = of_real x * of_real y"
20763
052b348a98a9 rearranged axioms and simp rules for scaleR
huffman
parents: 20722
diff changeset
   200
by (simp add: of_real_def mult_commute)
20554
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   201
20584
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   202
lemma nonzero_of_real_inverse:
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   203
  "x \<noteq> 0 \<Longrightarrow> of_real (inverse x) =
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   204
   inverse (of_real x :: 'a::real_div_algebra)"
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   205
by (simp add: of_real_def nonzero_inverse_scaleR_distrib)
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   206
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   207
lemma of_real_inverse [simp]:
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   208
  "of_real (inverse x) =
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   209
   inverse (of_real x :: 'a::{real_div_algebra,division_by_zero})"
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   210
by (simp add: of_real_def inverse_scaleR_distrib)
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   211
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   212
lemma nonzero_of_real_divide:
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   213
  "y \<noteq> 0 \<Longrightarrow> of_real (x / y) =
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   214
   (of_real x / of_real y :: 'a::real_field)"
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   215
by (simp add: divide_inverse nonzero_of_real_inverse)
20722
741737aa70b2 add lemmas about of_real and power
huffman
parents: 20718
diff changeset
   216
741737aa70b2 add lemmas about of_real and power
huffman
parents: 20718
diff changeset
   217
lemma of_real_divide [simp]:
20584
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   218
  "of_real (x / y) =
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   219
   (of_real x / of_real y :: 'a::{real_field,division_by_zero})"
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   220
by (simp add: divide_inverse)
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   221
20722
741737aa70b2 add lemmas about of_real and power
huffman
parents: 20718
diff changeset
   222
lemma of_real_power [simp]:
741737aa70b2 add lemmas about of_real and power
huffman
parents: 20718
diff changeset
   223
  "of_real (x ^ n) = (of_real x :: 'a::{real_algebra_1,recpower}) ^ n"
741737aa70b2 add lemmas about of_real and power
huffman
parents: 20718
diff changeset
   224
by (induct n, simp_all add: power_Suc)
741737aa70b2 add lemmas about of_real and power
huffman
parents: 20718
diff changeset
   225
20554
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   226
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
   227
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
   228
20584
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   229
lemmas of_real_eq_0_iff [simp] = of_real_eq_iff [of _ 0, simplified]
20554
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 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
   232
proof
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   233
  fix r
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   234
  show "of_real r = id r"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   235
    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
   236
qed
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   237
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   238
text{*Collapse nested embeddings*}
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   239
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
   240
by (induct n, auto)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   241
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   242
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
   243
by (cases z rule: int_diff_cases, simp)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   244
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   245
lemma of_real_number_of_eq:
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   246
  "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
   247
by (simp add: number_of_eq)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   248
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   249
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   250
subsection {* The Set of Real Numbers *}
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   251
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   252
constdefs
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   253
   Reals :: "'a::real_algebra_1 set"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   254
   "Reals \<equiv> range of_real"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   255
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   256
const_syntax (xsymbols)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   257
  Reals  ("\<real>")
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   258
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   259
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
   260
by (simp add: Reals_def)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   261
20718
4c4869e4ddb7 add lemmas of_int_in_Reals, of_nat_in_Reals
huffman
parents: 20694
diff changeset
   262
lemma of_int_in_Reals [simp]: "of_int z \<in> Reals"
4c4869e4ddb7 add lemmas of_int_in_Reals, of_nat_in_Reals
huffman
parents: 20694
diff changeset
   263
by (subst of_real_of_int_eq [symmetric], rule of_real_in_Reals)
4c4869e4ddb7 add lemmas of_int_in_Reals, of_nat_in_Reals
huffman
parents: 20694
diff changeset
   264
4c4869e4ddb7 add lemmas of_int_in_Reals, of_nat_in_Reals
huffman
parents: 20694
diff changeset
   265
lemma of_nat_in_Reals [simp]: "of_nat n \<in> Reals"
4c4869e4ddb7 add lemmas of_int_in_Reals, of_nat_in_Reals
huffman
parents: 20694
diff changeset
   266
by (subst of_real_of_nat_eq [symmetric], rule of_real_in_Reals)
4c4869e4ddb7 add lemmas of_int_in_Reals, of_nat_in_Reals
huffman
parents: 20694
diff changeset
   267
20554
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   268
lemma Reals_0 [simp]: "0 \<in> Reals"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   269
apply (unfold Reals_def)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   270
apply (rule range_eqI)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   271
apply (rule of_real_0 [symmetric])
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   272
done
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   273
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   274
lemma Reals_1 [simp]: "1 \<in> Reals"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   275
apply (unfold Reals_def)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   276
apply (rule range_eqI)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   277
apply (rule of_real_1 [symmetric])
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   278
done
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   279
20584
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   280
lemma Reals_add [simp]: "\<lbrakk>a \<in> Reals; b \<in> Reals\<rbrakk> \<Longrightarrow> a + b \<in> Reals"
20554
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   281
apply (auto simp add: Reals_def)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   282
apply (rule range_eqI)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   283
apply (rule of_real_add [symmetric])
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   284
done
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   285
20584
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   286
lemma Reals_minus [simp]: "a \<in> Reals \<Longrightarrow> - a \<in> Reals"
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   287
apply (auto simp add: Reals_def)
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   288
apply (rule range_eqI)
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   289
apply (rule of_real_minus [symmetric])
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   290
done
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   291
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   292
lemma Reals_diff [simp]: "\<lbrakk>a \<in> Reals; b \<in> Reals\<rbrakk> \<Longrightarrow> a - b \<in> Reals"
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   293
apply (auto simp add: Reals_def)
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   294
apply (rule range_eqI)
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   295
apply (rule of_real_diff [symmetric])
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   296
done
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   297
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   298
lemma Reals_mult [simp]: "\<lbrakk>a \<in> Reals; b \<in> Reals\<rbrakk> \<Longrightarrow> a * b \<in> Reals"
20554
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   299
apply (auto simp add: Reals_def)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   300
apply (rule range_eqI)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   301
apply (rule of_real_mult [symmetric])
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   302
done
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   303
20584
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   304
lemma nonzero_Reals_inverse:
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   305
  fixes a :: "'a::real_div_algebra"
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   306
  shows "\<lbrakk>a \<in> Reals; a \<noteq> 0\<rbrakk> \<Longrightarrow> inverse a \<in> Reals"
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   307
apply (auto simp add: Reals_def)
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   308
apply (rule range_eqI)
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   309
apply (erule nonzero_of_real_inverse [symmetric])
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   310
done
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   311
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   312
lemma Reals_inverse [simp]:
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   313
  fixes a :: "'a::{real_div_algebra,division_by_zero}"
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   314
  shows "a \<in> Reals \<Longrightarrow> inverse a \<in> Reals"
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   315
apply (auto simp add: Reals_def)
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   316
apply (rule range_eqI)
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   317
apply (rule of_real_inverse [symmetric])
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   318
done
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   319
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   320
lemma nonzero_Reals_divide:
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   321
  fixes a b :: "'a::real_field"
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   322
  shows "\<lbrakk>a \<in> Reals; b \<in> Reals; b \<noteq> 0\<rbrakk> \<Longrightarrow> a / b \<in> Reals"
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   323
apply (auto simp add: Reals_def)
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   324
apply (rule range_eqI)
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   325
apply (erule nonzero_of_real_divide [symmetric])
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   326
done
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   327
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   328
lemma Reals_divide [simp]:
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   329
  fixes a b :: "'a::{real_field,division_by_zero}"
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   330
  shows "\<lbrakk>a \<in> Reals; b \<in> Reals\<rbrakk> \<Longrightarrow> a / b \<in> Reals"
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   331
apply (auto simp add: Reals_def)
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   332
apply (rule range_eqI)
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   333
apply (rule of_real_divide [symmetric])
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   334
done
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   335
20722
741737aa70b2 add lemmas about of_real and power
huffman
parents: 20718
diff changeset
   336
lemma Reals_power [simp]:
741737aa70b2 add lemmas about of_real and power
huffman
parents: 20718
diff changeset
   337
  fixes a :: "'a::{real_algebra_1,recpower}"
741737aa70b2 add lemmas about of_real and power
huffman
parents: 20718
diff changeset
   338
  shows "a \<in> Reals \<Longrightarrow> a ^ n \<in> Reals"
741737aa70b2 add lemmas about of_real and power
huffman
parents: 20718
diff changeset
   339
apply (auto simp add: Reals_def)
741737aa70b2 add lemmas about of_real and power
huffman
parents: 20718
diff changeset
   340
apply (rule range_eqI)
741737aa70b2 add lemmas about of_real and power
huffman
parents: 20718
diff changeset
   341
apply (rule of_real_power [symmetric])
741737aa70b2 add lemmas about of_real and power
huffman
parents: 20718
diff changeset
   342
done
741737aa70b2 add lemmas about of_real and power
huffman
parents: 20718
diff changeset
   343
20554
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   344
lemma Reals_cases [cases set: Reals]:
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   345
  assumes "q \<in> \<real>"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   346
  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
   347
  unfolding Reals_def
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   348
proof -
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   349
  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
   350
  then obtain r where "q = of_real r" ..
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   351
  then show thesis ..
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   352
qed
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   353
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   354
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
   355
  "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
   356
  by (rule Reals_cases) auto
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   357
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   358
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   359
subsection {* Real normed vector spaces *}
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   360
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   361
axclass norm < type
20533
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   362
consts norm :: "'a::norm \<Rightarrow> real"
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   363
20554
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   364
instance real :: norm ..
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   365
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   366
defs (overloaded)
20694
76c49548d14c real_norm_def [simp]
huffman
parents: 20684
diff changeset
   367
  real_norm_def [simp]: "norm r \<equiv> \<bar>r\<bar>"
20554
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   368
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   369
axclass normed < plus, zero, norm
20533
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   370
  norm_ge_zero [simp]: "0 \<le> norm x"
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   371
  norm_eq_zero [simp]: "(norm x = 0) = (x = 0)"
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   372
  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
   373
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   374
axclass real_normed_vector < real_vector, normed
20533
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   375
  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
   376
20584
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   377
axclass real_normed_algebra < real_algebra, real_normed_vector
20533
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   378
  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
   379
20584
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   380
axclass real_normed_div_algebra < real_div_algebra, normed
20554
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   381
  norm_of_real: "norm (of_real r) = abs r"
20533
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   382
  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
   383
20584
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   384
axclass real_normed_field < real_field, real_normed_div_algebra
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   385
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   386
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
   387
proof
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   388
  fix a :: real and x :: 'a
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   389
  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
   390
    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
   391
  also have "\<dots> = abs a * norm x"
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   392
    by (simp add: norm_mult norm_of_real)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   393
  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
   394
next
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   395
  fix x y :: 'a
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   396
  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
   397
    by (simp add: norm_mult)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   398
qed
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   399
20584
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   400
instance real :: real_normed_field
20554
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   401
apply (intro_classes, unfold real_norm_def)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   402
apply (rule abs_ge_zero)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   403
apply (rule abs_eq_0)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   404
apply (rule abs_triangle_ineq)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   405
apply simp
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   406
apply (rule abs_mult)
c433e78d4203 define new constant of_real for class real_algebra_1;
huffman
parents: 20551
diff changeset
   407
done
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   408
20533
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   409
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
   410
by simp
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   411
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   412
lemma zero_less_norm_iff [simp]:
20584
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   413
  fixes x :: "'a::real_normed_vector"
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   414
  shows "(0 < norm x) = (x \<noteq> 0)"
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   415
by (simp add: order_less_le)
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   416
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   417
lemma norm_minus_cancel [simp]:
20584
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   418
  fixes x :: "'a::real_normed_vector"
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   419
  shows "norm (- x) = norm x"
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   420
proof -
20533
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   421
  have "norm (- x) = norm (- 1 *# x)"
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   422
    by (simp only: scaleR_minus_left scaleR_one)
20533
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   423
  also have "\<dots> = \<bar>- 1\<bar> * norm x"
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   424
    by (rule norm_scaleR)
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   425
  finally show ?thesis by simp
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   426
qed
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   427
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   428
lemma norm_minus_commute:
20584
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   429
  fixes a b :: "'a::real_normed_vector"
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   430
  shows "norm (a - b) = norm (b - a)"
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   431
proof -
20533
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   432
  have "norm (a - b) = norm (- (a - b))"
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   433
    by (simp only: norm_minus_cancel)
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   434
  also have "\<dots> = norm (b - a)" by simp
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   435
  finally show ?thesis .
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   436
qed
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   437
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   438
lemma norm_triangle_ineq2:
20584
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   439
  fixes a b :: "'a::real_normed_vector"
20533
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   440
  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
   441
proof -
20533
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   442
  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
   443
    by (rule norm_triangle_ineq)
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   444
  also have "(a - b + b) = a"
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   445
    by simp
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   446
  finally show ?thesis
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   447
    by (simp add: compare_rls)
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   448
qed
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   449
20584
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   450
lemma norm_triangle_ineq3:
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   451
  fixes a b :: "'a::real_normed_vector"
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   452
  shows "\<bar>norm a - norm b\<bar> \<le> norm (a - b)"
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   453
apply (subst abs_le_iff)
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   454
apply auto
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   455
apply (rule norm_triangle_ineq2)
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   456
apply (subst norm_minus_commute)
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   457
apply (rule norm_triangle_ineq2)
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   458
done
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   459
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   460
lemma norm_triangle_ineq4:
20584
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   461
  fixes a b :: "'a::real_normed_vector"
20533
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   462
  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
   463
proof -
20533
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   464
  have "norm (a - b) = norm (a + - b)"
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   465
    by (simp only: diff_minus)
20533
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   466
  also have "\<dots> \<le> norm a + norm (- b)"
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   467
    by (rule norm_triangle_ineq)
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   468
  finally show ?thesis
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   469
    by simp
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   470
qed
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   471
20551
ba543692bfa1 add theorem norm_diff_triangle_ineq
huffman
parents: 20533
diff changeset
   472
lemma norm_diff_triangle_ineq:
ba543692bfa1 add theorem norm_diff_triangle_ineq
huffman
parents: 20533
diff changeset
   473
  fixes a b c d :: "'a::real_normed_vector"
ba543692bfa1 add theorem norm_diff_triangle_ineq
huffman
parents: 20533
diff changeset
   474
  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
   475
proof -
ba543692bfa1 add theorem norm_diff_triangle_ineq
huffman
parents: 20533
diff changeset
   476
  have "norm ((a + b) - (c + d)) = norm ((a - c) + (b - d))"
ba543692bfa1 add theorem norm_diff_triangle_ineq
huffman
parents: 20533
diff changeset
   477
    by (simp add: diff_minus add_ac)
ba543692bfa1 add theorem norm_diff_triangle_ineq
huffman
parents: 20533
diff changeset
   478
  also have "\<dots> \<le> norm (a - c) + norm (b - d)"
ba543692bfa1 add theorem norm_diff_triangle_ineq
huffman
parents: 20533
diff changeset
   479
    by (rule norm_triangle_ineq)
ba543692bfa1 add theorem norm_diff_triangle_ineq
huffman
parents: 20533
diff changeset
   480
  finally show ?thesis .
ba543692bfa1 add theorem norm_diff_triangle_ineq
huffman
parents: 20533
diff changeset
   481
qed
ba543692bfa1 add theorem norm_diff_triangle_ineq
huffman
parents: 20533
diff changeset
   482
20560
49996715bc6e norm_one is now proved from other class axioms
huffman
parents: 20554
diff changeset
   483
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
   484
proof -
49996715bc6e norm_one is now proved from other class axioms
huffman
parents: 20554
diff changeset
   485
  have "norm (of_real 1 :: 'a) = abs 1"
49996715bc6e norm_one is now proved from other class axioms
huffman
parents: 20554
diff changeset
   486
    by (rule norm_of_real)
49996715bc6e norm_one is now proved from other class axioms
huffman
parents: 20554
diff changeset
   487
  thus ?thesis by simp
49996715bc6e norm_one is now proved from other class axioms
huffman
parents: 20554
diff changeset
   488
qed
49996715bc6e norm_one is now proved from other class axioms
huffman
parents: 20554
diff changeset
   489
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   490
lemma nonzero_norm_inverse:
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   491
  fixes a :: "'a::real_normed_div_algebra"
20533
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   492
  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
   493
apply (rule inverse_unique [symmetric])
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   494
apply (simp add: norm_mult [symmetric])
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   495
done
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   496
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   497
lemma norm_inverse:
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   498
  fixes a :: "'a::{real_normed_div_algebra,division_by_zero}"
20533
49442b3024bb remove conflicting norm syntax
huffman
parents: 20504
diff changeset
   499
  shows "norm (inverse a) = inverse (norm a)"
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   500
apply (case_tac "a = 0", simp)
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   501
apply (erule nonzero_norm_inverse)
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   502
done
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   503
20584
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   504
lemma nonzero_norm_divide:
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   505
  fixes a b :: "'a::real_normed_field"
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   506
  shows "b \<noteq> 0 \<Longrightarrow> norm (a / b) = norm a / norm b"
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   507
by (simp add: divide_inverse norm_mult nonzero_norm_inverse)
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   508
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   509
lemma norm_divide:
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   510
  fixes a b :: "'a::{real_normed_field,division_by_zero}"
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   511
  shows "norm (a / b) = norm a / norm b"
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   512
by (simp add: divide_inverse norm_mult norm_inverse)
60b1d52a455d added classes real_div_algebra and real_field; added lemmas
huffman
parents: 20560
diff changeset
   513
20684
74e8b46abb97 add lemma norm_power
huffman
parents: 20584
diff changeset
   514
lemma norm_power:
74e8b46abb97 add lemma norm_power
huffman
parents: 20584
diff changeset
   515
  fixes x :: "'a::{real_normed_div_algebra,recpower}"
74e8b46abb97 add lemma norm_power
huffman
parents: 20584
diff changeset
   516
  shows "norm (x ^ n) = norm x ^ n"
74e8b46abb97 add lemma norm_power
huffman
parents: 20584
diff changeset
   517
by (induct n, simp, simp add: power_Suc norm_mult)
74e8b46abb97 add lemma norm_power
huffman
parents: 20584
diff changeset
   518
20504
6342e872e71d formalization of vector spaces and algebras over the real numbers
huffman
parents:
diff changeset
   519
end