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