src/HOL/Real/RealVector.thy
 author huffman Wed Jul 02 19:35:43 2008 +0200 (2008-07-02) changeset 27443 22b6281d6719 parent 27435 b3f8e9bdf9a7 child 27515 13137fcd49aa permissions -rw-r--r--
use begin and end for proofs in locales
 huffman@20504 ` 1` ```(* Title : RealVector.thy ``` huffman@20504 ` 2` ``` ID: \$Id\$ ``` huffman@20504 ` 3` ``` Author : Brian Huffman ``` huffman@20504 ` 4` ```*) ``` huffman@20504 ` 5` huffman@20504 ` 6` ```header {* Vector Spaces and Algebras over the Reals *} ``` huffman@20504 ` 7` huffman@20504 ` 8` ```theory RealVector ``` huffman@20684 ` 9` ```imports RealPow ``` huffman@20504 ` 10` ```begin ``` huffman@20504 ` 11` huffman@20504 ` 12` ```subsection {* Locale for additive functions *} ``` huffman@20504 ` 13` huffman@20504 ` 14` ```locale additive = ``` huffman@20504 ` 15` ``` fixes f :: "'a::ab_group_add \ 'b::ab_group_add" ``` huffman@20504 ` 16` ``` assumes add: "f (x + y) = f x + f y" ``` huffman@27443 ` 17` ```begin ``` huffman@20504 ` 18` huffman@27443 ` 19` ```lemma zero: "f 0 = 0" ``` huffman@20504 ` 20` ```proof - ``` huffman@20504 ` 21` ``` have "f 0 = f (0 + 0)" by simp ``` huffman@20504 ` 22` ``` also have "\ = f 0 + f 0" by (rule add) ``` huffman@20504 ` 23` ``` finally show "f 0 = 0" by simp ``` huffman@20504 ` 24` ```qed ``` huffman@20504 ` 25` huffman@27443 ` 26` ```lemma minus: "f (- x) = - f x" ``` huffman@20504 ` 27` ```proof - ``` huffman@20504 ` 28` ``` have "f (- x) + f x = f (- x + x)" by (rule add [symmetric]) ``` huffman@20504 ` 29` ``` also have "\ = - f x + f x" by (simp add: zero) ``` huffman@20504 ` 30` ``` finally show "f (- x) = - f x" by (rule add_right_imp_eq) ``` huffman@20504 ` 31` ```qed ``` huffman@20504 ` 32` huffman@27443 ` 33` ```lemma diff: "f (x - y) = f x - f y" ``` huffman@20504 ` 34` ```by (simp add: diff_def add minus) ``` huffman@20504 ` 35` huffman@27443 ` 36` ```lemma setsum: "f (setsum g A) = (\x\A. f (g x))" ``` huffman@22942 ` 37` ```apply (cases "finite A") ``` huffman@22942 ` 38` ```apply (induct set: finite) ``` huffman@22942 ` 39` ```apply (simp add: zero) ``` huffman@22942 ` 40` ```apply (simp add: add) ``` huffman@22942 ` 41` ```apply (simp add: zero) ``` huffman@22942 ` 42` ```done ``` huffman@22942 ` 43` huffman@27443 ` 44` ```end ``` huffman@20504 ` 45` huffman@20504 ` 46` ```subsection {* Real vector spaces *} ``` huffman@20504 ` 47` huffman@22636 ` 48` ```class scaleR = type + ``` haftmann@25062 ` 49` ``` fixes scaleR :: "real \ 'a \ 'a" (infixr "*\<^sub>R" 75) ``` haftmann@24748 ` 50` ```begin ``` huffman@20504 ` 51` huffman@20763 ` 52` ```abbreviation ``` haftmann@25062 ` 53` ``` divideR :: "'a \ real \ 'a" (infixl "'/\<^sub>R" 70) ``` haftmann@24748 ` 54` ```where ``` haftmann@25062 ` 55` ``` "x /\<^sub>R r == scaleR (inverse r) x" ``` haftmann@24748 ` 56` haftmann@24748 ` 57` ```end ``` haftmann@24748 ` 58` haftmann@25571 ` 59` ```instantiation real :: scaleR ``` haftmann@25571 ` 60` ```begin ``` haftmann@25571 ` 61` haftmann@25571 ` 62` ```definition ``` haftmann@25571 ` 63` ``` real_scaleR_def [simp]: "scaleR a x = a * x" ``` haftmann@25571 ` 64` haftmann@25571 ` 65` ```instance .. ``` haftmann@25571 ` 66` haftmann@25571 ` 67` ```end ``` huffman@20554 ` 68` haftmann@24588 ` 69` ```class real_vector = scaleR + ab_group_add + ``` haftmann@25062 ` 70` ``` assumes scaleR_right_distrib: "scaleR a (x + y) = scaleR a x + scaleR a y" ``` haftmann@25062 ` 71` ``` and scaleR_left_distrib: "scaleR (a + b) x = scaleR a x + scaleR b x" ``` haftmann@24588 ` 72` ``` and scaleR_scaleR [simp]: "scaleR a (scaleR b x) = scaleR (a * b) x" ``` haftmann@24588 ` 73` ``` and scaleR_one [simp]: "scaleR 1 x = x" ``` huffman@20504 ` 74` haftmann@24588 ` 75` ```class real_algebra = real_vector + ring + ``` haftmann@25062 ` 76` ``` assumes mult_scaleR_left [simp]: "scaleR a x * y = scaleR a (x * y)" ``` haftmann@25062 ` 77` ``` and mult_scaleR_right [simp]: "x * scaleR a y = scaleR a (x * y)" ``` huffman@20504 ` 78` haftmann@24588 ` 79` ```class real_algebra_1 = real_algebra + ring_1 ``` huffman@20554 ` 80` haftmann@24588 ` 81` ```class real_div_algebra = real_algebra_1 + division_ring ``` huffman@20584 ` 82` haftmann@24588 ` 83` ```class real_field = real_div_algebra + field ``` huffman@20584 ` 84` huffman@20584 ` 85` ```instance real :: real_field ``` huffman@20554 ` 86` ```apply (intro_classes, unfold real_scaleR_def) ``` huffman@20554 ` 87` ```apply (rule right_distrib) ``` huffman@20554 ` 88` ```apply (rule left_distrib) ``` huffman@20763 ` 89` ```apply (rule mult_assoc [symmetric]) ``` huffman@20554 ` 90` ```apply (rule mult_1_left) ``` huffman@20554 ` 91` ```apply (rule mult_assoc) ``` huffman@20554 ` 92` ```apply (rule mult_left_commute) ``` huffman@20554 ` 93` ```done ``` huffman@20554 ` 94` huffman@20504 ` 95` ```lemma scaleR_left_commute: ``` huffman@20504 ` 96` ``` fixes x :: "'a::real_vector" ``` huffman@21809 ` 97` ``` shows "scaleR a (scaleR b x) = scaleR b (scaleR a x)" ``` huffman@20763 ` 98` ```by (simp add: mult_commute) ``` huffman@20504 ` 99` huffman@23127 ` 100` ```interpretation scaleR_left: additive ["(\a. scaleR a x::'a::real_vector)"] ``` huffman@23127 ` 101` ```by unfold_locales (rule scaleR_left_distrib) ``` huffman@20504 ` 102` huffman@23127 ` 103` ```interpretation scaleR_right: additive ["(\x. scaleR a x::'a::real_vector)"] ``` huffman@23127 ` 104` ```by unfold_locales (rule scaleR_right_distrib) ``` huffman@20504 ` 105` huffman@23127 ` 106` ```lemmas scaleR_zero_left [simp] = scaleR_left.zero ``` huffman@20504 ` 107` huffman@23127 ` 108` ```lemmas scaleR_zero_right [simp] = scaleR_right.zero ``` huffman@20504 ` 109` huffman@23127 ` 110` ```lemmas scaleR_minus_left [simp] = scaleR_left.minus ``` huffman@23113 ` 111` huffman@23127 ` 112` ```lemmas scaleR_minus_right [simp] = scaleR_right.minus ``` huffman@20504 ` 113` huffman@23127 ` 114` ```lemmas scaleR_left_diff_distrib = scaleR_left.diff ``` huffman@20504 ` 115` huffman@23127 ` 116` ```lemmas scaleR_right_diff_distrib = scaleR_right.diff ``` huffman@20504 ` 117` huffman@22973 ` 118` ```lemma scaleR_eq_0_iff [simp]: ``` huffman@20554 ` 119` ``` fixes x :: "'a::real_vector" ``` huffman@21809 ` 120` ``` shows "(scaleR a x = 0) = (a = 0 \ x = 0)" ``` huffman@20554 ` 121` ```proof cases ``` huffman@20554 ` 122` ``` assume "a = 0" thus ?thesis by simp ``` huffman@20554 ` 123` ```next ``` huffman@20554 ` 124` ``` assume anz [simp]: "a \ 0" ``` huffman@21809 ` 125` ``` { assume "scaleR a x = 0" ``` huffman@21809 ` 126` ``` hence "scaleR (inverse a) (scaleR a x) = 0" by simp ``` huffman@20763 ` 127` ``` hence "x = 0" by simp } ``` huffman@20554 ` 128` ``` thus ?thesis by force ``` huffman@20554 ` 129` ```qed ``` huffman@20554 ` 130` huffman@20554 ` 131` ```lemma scaleR_left_imp_eq: ``` huffman@20554 ` 132` ``` fixes x y :: "'a::real_vector" ``` huffman@21809 ` 133` ``` shows "\a \ 0; scaleR a x = scaleR a y\ \ x = y" ``` huffman@20554 ` 134` ```proof - ``` huffman@20554 ` 135` ``` assume nonzero: "a \ 0" ``` huffman@21809 ` 136` ``` assume "scaleR a x = scaleR a y" ``` huffman@21809 ` 137` ``` hence "scaleR a (x - y) = 0" ``` huffman@20554 ` 138` ``` by (simp add: scaleR_right_diff_distrib) ``` huffman@22973 ` 139` ``` hence "x - y = 0" by (simp add: nonzero) ``` huffman@20554 ` 140` ``` thus "x = y" by simp ``` huffman@20554 ` 141` ```qed ``` huffman@20554 ` 142` huffman@20554 ` 143` ```lemma scaleR_right_imp_eq: ``` huffman@20554 ` 144` ``` fixes x y :: "'a::real_vector" ``` huffman@21809 ` 145` ``` shows "\x \ 0; scaleR a x = scaleR b x\ \ a = b" ``` huffman@20554 ` 146` ```proof - ``` huffman@20554 ` 147` ``` assume nonzero: "x \ 0" ``` huffman@21809 ` 148` ``` assume "scaleR a x = scaleR b x" ``` huffman@21809 ` 149` ``` hence "scaleR (a - b) x = 0" ``` huffman@20554 ` 150` ``` by (simp add: scaleR_left_diff_distrib) ``` huffman@22973 ` 151` ``` hence "a - b = 0" by (simp add: nonzero) ``` huffman@20554 ` 152` ``` thus "a = b" by simp ``` huffman@20554 ` 153` ```qed ``` huffman@20554 ` 154` huffman@20554 ` 155` ```lemma scaleR_cancel_left: ``` huffman@20554 ` 156` ``` fixes x y :: "'a::real_vector" ``` huffman@21809 ` 157` ``` shows "(scaleR a x = scaleR a y) = (x = y \ a = 0)" ``` huffman@20554 ` 158` ```by (auto intro: scaleR_left_imp_eq) ``` huffman@20554 ` 159` huffman@20554 ` 160` ```lemma scaleR_cancel_right: ``` huffman@20554 ` 161` ``` fixes x y :: "'a::real_vector" ``` huffman@21809 ` 162` ``` shows "(scaleR a x = scaleR b x) = (a = b \ x = 0)" ``` huffman@20554 ` 163` ```by (auto intro: scaleR_right_imp_eq) ``` huffman@20554 ` 164` huffman@20584 ` 165` ```lemma nonzero_inverse_scaleR_distrib: ``` huffman@21809 ` 166` ``` fixes x :: "'a::real_div_algebra" shows ``` huffman@21809 ` 167` ``` "\a \ 0; x \ 0\ \ inverse (scaleR a x) = scaleR (inverse a) (inverse x)" ``` huffman@20763 ` 168` ```by (rule inverse_unique, simp) ``` huffman@20584 ` 169` huffman@20584 ` 170` ```lemma inverse_scaleR_distrib: ``` huffman@20584 ` 171` ``` fixes x :: "'a::{real_div_algebra,division_by_zero}" ``` huffman@21809 ` 172` ``` shows "inverse (scaleR a x) = scaleR (inverse a) (inverse x)" ``` huffman@20584 ` 173` ```apply (case_tac "a = 0", simp) ``` huffman@20584 ` 174` ```apply (case_tac "x = 0", simp) ``` huffman@20584 ` 175` ```apply (erule (1) nonzero_inverse_scaleR_distrib) ``` huffman@20584 ` 176` ```done ``` huffman@20584 ` 177` huffman@20554 ` 178` huffman@20554 ` 179` ```subsection {* Embedding of the Reals into any @{text real_algebra_1}: ``` huffman@20554 ` 180` ```@{term of_real} *} ``` huffman@20554 ` 181` huffman@20554 ` 182` ```definition ``` wenzelm@21404 ` 183` ``` of_real :: "real \ 'a::real_algebra_1" where ``` huffman@21809 ` 184` ``` "of_real r = scaleR r 1" ``` huffman@20554 ` 185` huffman@21809 ` 186` ```lemma scaleR_conv_of_real: "scaleR r x = of_real r * x" ``` huffman@20763 ` 187` ```by (simp add: of_real_def) ``` huffman@20763 ` 188` huffman@20554 ` 189` ```lemma of_real_0 [simp]: "of_real 0 = 0" ``` huffman@20554 ` 190` ```by (simp add: of_real_def) ``` huffman@20554 ` 191` huffman@20554 ` 192` ```lemma of_real_1 [simp]: "of_real 1 = 1" ``` huffman@20554 ` 193` ```by (simp add: of_real_def) ``` huffman@20554 ` 194` huffman@20554 ` 195` ```lemma of_real_add [simp]: "of_real (x + y) = of_real x + of_real y" ``` huffman@20554 ` 196` ```by (simp add: of_real_def scaleR_left_distrib) ``` huffman@20554 ` 197` huffman@20554 ` 198` ```lemma of_real_minus [simp]: "of_real (- x) = - of_real x" ``` huffman@20554 ` 199` ```by (simp add: of_real_def) ``` huffman@20554 ` 200` huffman@20554 ` 201` ```lemma of_real_diff [simp]: "of_real (x - y) = of_real x - of_real y" ``` huffman@20554 ` 202` ```by (simp add: of_real_def scaleR_left_diff_distrib) ``` huffman@20554 ` 203` huffman@20554 ` 204` ```lemma of_real_mult [simp]: "of_real (x * y) = of_real x * of_real y" ``` huffman@20763 ` 205` ```by (simp add: of_real_def mult_commute) ``` huffman@20554 ` 206` huffman@20584 ` 207` ```lemma nonzero_of_real_inverse: ``` huffman@20584 ` 208` ``` "x \ 0 \ of_real (inverse x) = ``` huffman@20584 ` 209` ``` inverse (of_real x :: 'a::real_div_algebra)" ``` huffman@20584 ` 210` ```by (simp add: of_real_def nonzero_inverse_scaleR_distrib) ``` huffman@20584 ` 211` huffman@20584 ` 212` ```lemma of_real_inverse [simp]: ``` huffman@20584 ` 213` ``` "of_real (inverse x) = ``` huffman@20584 ` 214` ``` inverse (of_real x :: 'a::{real_div_algebra,division_by_zero})" ``` huffman@20584 ` 215` ```by (simp add: of_real_def inverse_scaleR_distrib) ``` huffman@20584 ` 216` huffman@20584 ` 217` ```lemma nonzero_of_real_divide: ``` huffman@20584 ` 218` ``` "y \ 0 \ of_real (x / y) = ``` huffman@20584 ` 219` ``` (of_real x / of_real y :: 'a::real_field)" ``` huffman@20584 ` 220` ```by (simp add: divide_inverse nonzero_of_real_inverse) ``` huffman@20722 ` 221` huffman@20722 ` 222` ```lemma of_real_divide [simp]: ``` huffman@20584 ` 223` ``` "of_real (x / y) = ``` huffman@20584 ` 224` ``` (of_real x / of_real y :: 'a::{real_field,division_by_zero})" ``` huffman@20584 ` 225` ```by (simp add: divide_inverse) ``` huffman@20584 ` 226` huffman@20722 ` 227` ```lemma of_real_power [simp]: ``` huffman@20722 ` 228` ``` "of_real (x ^ n) = (of_real x :: 'a::{real_algebra_1,recpower}) ^ n" ``` wenzelm@20772 ` 229` ```by (induct n) (simp_all add: power_Suc) ``` huffman@20722 ` 230` huffman@20554 ` 231` ```lemma of_real_eq_iff [simp]: "(of_real x = of_real y) = (x = y)" ``` huffman@20554 ` 232` ```by (simp add: of_real_def scaleR_cancel_right) ``` huffman@20554 ` 233` huffman@20584 ` 234` ```lemmas of_real_eq_0_iff [simp] = of_real_eq_iff [of _ 0, simplified] ``` huffman@20554 ` 235` huffman@20554 ` 236` ```lemma of_real_eq_id [simp]: "of_real = (id :: real \ real)" ``` huffman@20554 ` 237` ```proof ``` huffman@20554 ` 238` ``` fix r ``` huffman@20554 ` 239` ``` show "of_real r = id r" ``` huffman@22973 ` 240` ``` by (simp add: of_real_def) ``` huffman@20554 ` 241` ```qed ``` huffman@20554 ` 242` huffman@20554 ` 243` ```text{*Collapse nested embeddings*} ``` huffman@20554 ` 244` ```lemma of_real_of_nat_eq [simp]: "of_real (of_nat n) = of_nat n" ``` wenzelm@20772 ` 245` ```by (induct n) auto ``` huffman@20554 ` 246` huffman@20554 ` 247` ```lemma of_real_of_int_eq [simp]: "of_real (of_int z) = of_int z" ``` huffman@20554 ` 248` ```by (cases z rule: int_diff_cases, simp) ``` huffman@20554 ` 249` huffman@20554 ` 250` ```lemma of_real_number_of_eq: ``` huffman@20554 ` 251` ``` "of_real (number_of w) = (number_of w :: 'a::{number_ring,real_algebra_1})" ``` huffman@20554 ` 252` ```by (simp add: number_of_eq) ``` huffman@20554 ` 253` huffman@22912 ` 254` ```text{*Every real algebra has characteristic zero*} ``` huffman@22912 ` 255` ```instance real_algebra_1 < ring_char_0 ``` huffman@22912 ` 256` ```proof ``` huffman@23282 ` 257` ``` fix m n :: nat ``` huffman@23282 ` 258` ``` have "(of_real (of_nat m) = (of_real (of_nat n)::'a)) = (m = n)" ``` huffman@23282 ` 259` ``` by (simp only: of_real_eq_iff of_nat_eq_iff) ``` huffman@23282 ` 260` ``` thus "(of_nat m = (of_nat n::'a)) = (m = n)" ``` huffman@23282 ` 261` ``` by (simp only: of_real_of_nat_eq) ``` huffman@22912 ` 262` ```qed ``` huffman@22912 ` 263` huffman@20554 ` 264` huffman@20554 ` 265` ```subsection {* The Set of Real Numbers *} ``` huffman@20554 ` 266` wenzelm@20772 ` 267` ```definition ``` wenzelm@21404 ` 268` ``` Reals :: "'a::real_algebra_1 set" where ``` haftmann@27435 ` 269` ``` [code func del]: "Reals \ range of_real" ``` huffman@20554 ` 270` wenzelm@21210 ` 271` ```notation (xsymbols) ``` huffman@20554 ` 272` ``` Reals ("\") ``` huffman@20554 ` 273` huffman@21809 ` 274` ```lemma Reals_of_real [simp]: "of_real r \ Reals" ``` huffman@20554 ` 275` ```by (simp add: Reals_def) ``` huffman@20554 ` 276` huffman@21809 ` 277` ```lemma Reals_of_int [simp]: "of_int z \ Reals" ``` huffman@21809 ` 278` ```by (subst of_real_of_int_eq [symmetric], rule Reals_of_real) ``` huffman@20718 ` 279` huffman@21809 ` 280` ```lemma Reals_of_nat [simp]: "of_nat n \ Reals" ``` huffman@21809 ` 281` ```by (subst of_real_of_nat_eq [symmetric], rule Reals_of_real) ``` huffman@21809 ` 282` huffman@21809 ` 283` ```lemma Reals_number_of [simp]: ``` huffman@21809 ` 284` ``` "(number_of w::'a::{number_ring,real_algebra_1}) \ Reals" ``` huffman@21809 ` 285` ```by (subst of_real_number_of_eq [symmetric], rule Reals_of_real) ``` huffman@20718 ` 286` huffman@20554 ` 287` ```lemma Reals_0 [simp]: "0 \ Reals" ``` huffman@20554 ` 288` ```apply (unfold Reals_def) ``` huffman@20554 ` 289` ```apply (rule range_eqI) ``` huffman@20554 ` 290` ```apply (rule of_real_0 [symmetric]) ``` huffman@20554 ` 291` ```done ``` huffman@20554 ` 292` huffman@20554 ` 293` ```lemma Reals_1 [simp]: "1 \ Reals" ``` huffman@20554 ` 294` ```apply (unfold Reals_def) ``` huffman@20554 ` 295` ```apply (rule range_eqI) ``` huffman@20554 ` 296` ```apply (rule of_real_1 [symmetric]) ``` huffman@20554 ` 297` ```done ``` huffman@20554 ` 298` huffman@20584 ` 299` ```lemma Reals_add [simp]: "\a \ Reals; b \ Reals\ \ a + b \ Reals" ``` huffman@20554 ` 300` ```apply (auto simp add: Reals_def) ``` huffman@20554 ` 301` ```apply (rule range_eqI) ``` huffman@20554 ` 302` ```apply (rule of_real_add [symmetric]) ``` huffman@20554 ` 303` ```done ``` huffman@20554 ` 304` huffman@20584 ` 305` ```lemma Reals_minus [simp]: "a \ Reals \ - a \ Reals" ``` huffman@20584 ` 306` ```apply (auto simp add: Reals_def) ``` huffman@20584 ` 307` ```apply (rule range_eqI) ``` huffman@20584 ` 308` ```apply (rule of_real_minus [symmetric]) ``` huffman@20584 ` 309` ```done ``` huffman@20584 ` 310` huffman@20584 ` 311` ```lemma Reals_diff [simp]: "\a \ Reals; b \ Reals\ \ a - b \ Reals" ``` huffman@20584 ` 312` ```apply (auto simp add: Reals_def) ``` huffman@20584 ` 313` ```apply (rule range_eqI) ``` huffman@20584 ` 314` ```apply (rule of_real_diff [symmetric]) ``` huffman@20584 ` 315` ```done ``` huffman@20584 ` 316` huffman@20584 ` 317` ```lemma Reals_mult [simp]: "\a \ Reals; b \ Reals\ \ a * b \ Reals" ``` huffman@20554 ` 318` ```apply (auto simp add: Reals_def) ``` huffman@20554 ` 319` ```apply (rule range_eqI) ``` huffman@20554 ` 320` ```apply (rule of_real_mult [symmetric]) ``` huffman@20554 ` 321` ```done ``` huffman@20554 ` 322` huffman@20584 ` 323` ```lemma nonzero_Reals_inverse: ``` huffman@20584 ` 324` ``` fixes a :: "'a::real_div_algebra" ``` huffman@20584 ` 325` ``` shows "\a \ Reals; a \ 0\ \ inverse a \ Reals" ``` huffman@20584 ` 326` ```apply (auto simp add: Reals_def) ``` huffman@20584 ` 327` ```apply (rule range_eqI) ``` huffman@20584 ` 328` ```apply (erule nonzero_of_real_inverse [symmetric]) ``` huffman@20584 ` 329` ```done ``` huffman@20584 ` 330` huffman@20584 ` 331` ```lemma Reals_inverse [simp]: ``` huffman@20584 ` 332` ``` fixes a :: "'a::{real_div_algebra,division_by_zero}" ``` huffman@20584 ` 333` ``` shows "a \ Reals \ inverse a \ Reals" ``` huffman@20584 ` 334` ```apply (auto simp add: Reals_def) ``` huffman@20584 ` 335` ```apply (rule range_eqI) ``` huffman@20584 ` 336` ```apply (rule of_real_inverse [symmetric]) ``` huffman@20584 ` 337` ```done ``` huffman@20584 ` 338` huffman@20584 ` 339` ```lemma nonzero_Reals_divide: ``` huffman@20584 ` 340` ``` fixes a b :: "'a::real_field" ``` huffman@20584 ` 341` ``` shows "\a \ Reals; b \ Reals; b \ 0\ \ a / b \ Reals" ``` huffman@20584 ` 342` ```apply (auto simp add: Reals_def) ``` huffman@20584 ` 343` ```apply (rule range_eqI) ``` huffman@20584 ` 344` ```apply (erule nonzero_of_real_divide [symmetric]) ``` huffman@20584 ` 345` ```done ``` huffman@20584 ` 346` huffman@20584 ` 347` ```lemma Reals_divide [simp]: ``` huffman@20584 ` 348` ``` fixes a b :: "'a::{real_field,division_by_zero}" ``` huffman@20584 ` 349` ``` shows "\a \ Reals; b \ Reals\ \ a / b \ Reals" ``` huffman@20584 ` 350` ```apply (auto simp add: Reals_def) ``` huffman@20584 ` 351` ```apply (rule range_eqI) ``` huffman@20584 ` 352` ```apply (rule of_real_divide [symmetric]) ``` huffman@20584 ` 353` ```done ``` huffman@20584 ` 354` huffman@20722 ` 355` ```lemma Reals_power [simp]: ``` huffman@20722 ` 356` ``` fixes a :: "'a::{real_algebra_1,recpower}" ``` huffman@20722 ` 357` ``` shows "a \ Reals \ a ^ n \ Reals" ``` huffman@20722 ` 358` ```apply (auto simp add: Reals_def) ``` huffman@20722 ` 359` ```apply (rule range_eqI) ``` huffman@20722 ` 360` ```apply (rule of_real_power [symmetric]) ``` huffman@20722 ` 361` ```done ``` huffman@20722 ` 362` huffman@20554 ` 363` ```lemma Reals_cases [cases set: Reals]: ``` huffman@20554 ` 364` ``` assumes "q \ \" ``` huffman@20554 ` 365` ``` obtains (of_real) r where "q = of_real r" ``` huffman@20554 ` 366` ``` unfolding Reals_def ``` huffman@20554 ` 367` ```proof - ``` huffman@20554 ` 368` ``` from `q \ \` have "q \ range of_real" unfolding Reals_def . ``` huffman@20554 ` 369` ``` then obtain r where "q = of_real r" .. ``` huffman@20554 ` 370` ``` then show thesis .. ``` huffman@20554 ` 371` ```qed ``` huffman@20554 ` 372` huffman@20554 ` 373` ```lemma Reals_induct [case_names of_real, induct set: Reals]: ``` huffman@20554 ` 374` ``` "q \ \ \ (\r. P (of_real r)) \ P q" ``` huffman@20554 ` 375` ``` by (rule Reals_cases) auto ``` huffman@20554 ` 376` huffman@20504 ` 377` huffman@20504 ` 378` ```subsection {* Real normed vector spaces *} ``` huffman@20504 ` 379` huffman@22636 ` 380` ```class norm = type + ``` huffman@22636 ` 381` ``` fixes norm :: "'a \ real" ``` huffman@20504 ` 382` haftmann@25571 ` 383` ```instantiation real :: norm ``` haftmann@25571 ` 384` ```begin ``` haftmann@25571 ` 385` haftmann@25571 ` 386` ```definition ``` haftmann@25571 ` 387` ``` real_norm_def [simp]: "norm r \ \r\" ``` haftmann@25571 ` 388` haftmann@25571 ` 389` ```instance .. ``` haftmann@25571 ` 390` haftmann@25571 ` 391` ```end ``` huffman@20554 ` 392` huffman@24520 ` 393` ```class sgn_div_norm = scaleR + norm + sgn + ``` haftmann@25062 ` 394` ``` assumes sgn_div_norm: "sgn x = x /\<^sub>R norm x" ``` nipkow@24506 ` 395` haftmann@24588 ` 396` ```class real_normed_vector = real_vector + sgn_div_norm + ``` haftmann@24588 ` 397` ``` assumes norm_ge_zero [simp]: "0 \ norm x" ``` haftmann@25062 ` 398` ``` and norm_eq_zero [simp]: "norm x = 0 \ x = 0" ``` haftmann@25062 ` 399` ``` and norm_triangle_ineq: "norm (x + y) \ norm x + norm y" ``` haftmann@24588 ` 400` ``` and norm_scaleR: "norm (scaleR a x) = \a\ * norm x" ``` huffman@20504 ` 401` haftmann@24588 ` 402` ```class real_normed_algebra = real_algebra + real_normed_vector + ``` haftmann@25062 ` 403` ``` assumes norm_mult_ineq: "norm (x * y) \ norm x * norm y" ``` huffman@20504 ` 404` haftmann@24588 ` 405` ```class real_normed_algebra_1 = real_algebra_1 + real_normed_algebra + ``` haftmann@25062 ` 406` ``` assumes norm_one [simp]: "norm 1 = 1" ``` huffman@22852 ` 407` haftmann@24588 ` 408` ```class real_normed_div_algebra = real_div_algebra + real_normed_vector + ``` haftmann@25062 ` 409` ``` assumes norm_mult: "norm (x * y) = norm x * norm y" ``` huffman@20504 ` 410` haftmann@24588 ` 411` ```class real_normed_field = real_field + real_normed_div_algebra ``` huffman@20584 ` 412` huffman@22852 ` 413` ```instance real_normed_div_algebra < real_normed_algebra_1 ``` huffman@20554 ` 414` ```proof ``` huffman@20554 ` 415` ``` fix x y :: 'a ``` huffman@20554 ` 416` ``` show "norm (x * y) \ norm x * norm y" ``` huffman@20554 ` 417` ``` by (simp add: norm_mult) ``` huffman@22852 ` 418` ```next ``` huffman@22852 ` 419` ``` have "norm (1 * 1::'a) = norm (1::'a) * norm (1::'a)" ``` huffman@22852 ` 420` ``` by (rule norm_mult) ``` huffman@22852 ` 421` ``` thus "norm (1::'a) = 1" by simp ``` huffman@20554 ` 422` ```qed ``` huffman@20554 ` 423` huffman@20584 ` 424` ```instance real :: real_normed_field ``` huffman@22852 ` 425` ```apply (intro_classes, unfold real_norm_def real_scaleR_def) ``` nipkow@24506 ` 426` ```apply (simp add: real_sgn_def) ``` huffman@20554 ` 427` ```apply (rule abs_ge_zero) ``` huffman@20554 ` 428` ```apply (rule abs_eq_0) ``` huffman@20554 ` 429` ```apply (rule abs_triangle_ineq) ``` huffman@22852 ` 430` ```apply (rule abs_mult) ``` huffman@20554 ` 431` ```apply (rule abs_mult) ``` huffman@20554 ` 432` ```done ``` huffman@20504 ` 433` huffman@22852 ` 434` ```lemma norm_zero [simp]: "norm (0::'a::real_normed_vector) = 0" ``` huffman@20504 ` 435` ```by simp ``` huffman@20504 ` 436` huffman@22852 ` 437` ```lemma zero_less_norm_iff [simp]: ``` huffman@22852 ` 438` ``` fixes x :: "'a::real_normed_vector" ``` huffman@22852 ` 439` ``` shows "(0 < norm x) = (x \ 0)" ``` huffman@20504 ` 440` ```by (simp add: order_less_le) ``` huffman@20504 ` 441` huffman@22852 ` 442` ```lemma norm_not_less_zero [simp]: ``` huffman@22852 ` 443` ``` fixes x :: "'a::real_normed_vector" ``` huffman@22852 ` 444` ``` shows "\ norm x < 0" ``` huffman@20828 ` 445` ```by (simp add: linorder_not_less) ``` huffman@20828 ` 446` huffman@22852 ` 447` ```lemma norm_le_zero_iff [simp]: ``` huffman@22852 ` 448` ``` fixes x :: "'a::real_normed_vector" ``` huffman@22852 ` 449` ``` shows "(norm x \ 0) = (x = 0)" ``` huffman@20828 ` 450` ```by (simp add: order_le_less) ``` huffman@20828 ` 451` huffman@20504 ` 452` ```lemma norm_minus_cancel [simp]: ``` huffman@20584 ` 453` ``` fixes x :: "'a::real_normed_vector" ``` huffman@20584 ` 454` ``` shows "norm (- x) = norm x" ``` huffman@20504 ` 455` ```proof - ``` huffman@21809 ` 456` ``` have "norm (- x) = norm (scaleR (- 1) x)" ``` huffman@20504 ` 457` ``` by (simp only: scaleR_minus_left scaleR_one) ``` huffman@20533 ` 458` ``` also have "\ = \- 1\ * norm x" ``` huffman@20504 ` 459` ``` by (rule norm_scaleR) ``` huffman@20504 ` 460` ``` finally show ?thesis by simp ``` huffman@20504 ` 461` ```qed ``` huffman@20504 ` 462` huffman@20504 ` 463` ```lemma norm_minus_commute: ``` huffman@20584 ` 464` ``` fixes a b :: "'a::real_normed_vector" ``` huffman@20584 ` 465` ``` shows "norm (a - b) = norm (b - a)" ``` huffman@20504 ` 466` ```proof - ``` huffman@22898 ` 467` ``` have "norm (- (b - a)) = norm (b - a)" ``` huffman@22898 ` 468` ``` by (rule norm_minus_cancel) ``` huffman@22898 ` 469` ``` thus ?thesis by simp ``` huffman@20504 ` 470` ```qed ``` huffman@20504 ` 471` huffman@20504 ` 472` ```lemma norm_triangle_ineq2: ``` huffman@20584 ` 473` ``` fixes a b :: "'a::real_normed_vector" ``` huffman@20533 ` 474` ``` shows "norm a - norm b \ norm (a - b)" ``` huffman@20504 ` 475` ```proof - ``` huffman@20533 ` 476` ``` have "norm (a - b + b) \ norm (a - b) + norm b" ``` huffman@20504 ` 477` ``` by (rule norm_triangle_ineq) ``` huffman@22898 ` 478` ``` thus ?thesis by simp ``` huffman@20504 ` 479` ```qed ``` huffman@20504 ` 480` huffman@20584 ` 481` ```lemma norm_triangle_ineq3: ``` huffman@20584 ` 482` ``` fixes a b :: "'a::real_normed_vector" ``` huffman@20584 ` 483` ``` shows "\norm a - norm b\ \ norm (a - b)" ``` huffman@20584 ` 484` ```apply (subst abs_le_iff) ``` huffman@20584 ` 485` ```apply auto ``` huffman@20584 ` 486` ```apply (rule norm_triangle_ineq2) ``` huffman@20584 ` 487` ```apply (subst norm_minus_commute) ``` huffman@20584 ` 488` ```apply (rule norm_triangle_ineq2) ``` huffman@20584 ` 489` ```done ``` huffman@20584 ` 490` huffman@20504 ` 491` ```lemma norm_triangle_ineq4: ``` huffman@20584 ` 492` ``` fixes a b :: "'a::real_normed_vector" ``` huffman@20533 ` 493` ``` shows "norm (a - b) \ norm a + norm b" ``` huffman@20504 ` 494` ```proof - ``` huffman@22898 ` 495` ``` have "norm (a + - b) \ norm a + norm (- b)" ``` huffman@20504 ` 496` ``` by (rule norm_triangle_ineq) ``` huffman@22898 ` 497` ``` thus ?thesis ``` huffman@22898 ` 498` ``` by (simp only: diff_minus norm_minus_cancel) ``` huffman@22898 ` 499` ```qed ``` huffman@22898 ` 500` huffman@22898 ` 501` ```lemma norm_diff_ineq: ``` huffman@22898 ` 502` ``` fixes a b :: "'a::real_normed_vector" ``` huffman@22898 ` 503` ``` shows "norm a - norm b \ norm (a + b)" ``` huffman@22898 ` 504` ```proof - ``` huffman@22898 ` 505` ``` have "norm a - norm (- b) \ norm (a - - b)" ``` huffman@22898 ` 506` ``` by (rule norm_triangle_ineq2) ``` huffman@22898 ` 507` ``` thus ?thesis by simp ``` huffman@20504 ` 508` ```qed ``` huffman@20504 ` 509` huffman@20551 ` 510` ```lemma norm_diff_triangle_ineq: ``` huffman@20551 ` 511` ``` fixes a b c d :: "'a::real_normed_vector" ``` huffman@20551 ` 512` ``` shows "norm ((a + b) - (c + d)) \ norm (a - c) + norm (b - d)" ``` huffman@20551 ` 513` ```proof - ``` huffman@20551 ` 514` ``` have "norm ((a + b) - (c + d)) = norm ((a - c) + (b - d))" ``` huffman@20551 ` 515` ``` by (simp add: diff_minus add_ac) ``` huffman@20551 ` 516` ``` also have "\ \ norm (a - c) + norm (b - d)" ``` huffman@20551 ` 517` ``` by (rule norm_triangle_ineq) ``` huffman@20551 ` 518` ``` finally show ?thesis . ``` huffman@20551 ` 519` ```qed ``` huffman@20551 ` 520` huffman@22857 ` 521` ```lemma abs_norm_cancel [simp]: ``` huffman@22857 ` 522` ``` fixes a :: "'a::real_normed_vector" ``` huffman@22857 ` 523` ``` shows "\norm a\ = norm a" ``` huffman@22857 ` 524` ```by (rule abs_of_nonneg [OF norm_ge_zero]) ``` huffman@22857 ` 525` huffman@22880 ` 526` ```lemma norm_add_less: ``` huffman@22880 ` 527` ``` fixes x y :: "'a::real_normed_vector" ``` huffman@22880 ` 528` ``` shows "\norm x < r; norm y < s\ \ norm (x + y) < r + s" ``` huffman@22880 ` 529` ```by (rule order_le_less_trans [OF norm_triangle_ineq add_strict_mono]) ``` huffman@22880 ` 530` huffman@22880 ` 531` ```lemma norm_mult_less: ``` huffman@22880 ` 532` ``` fixes x y :: "'a::real_normed_algebra" ``` huffman@22880 ` 533` ``` shows "\norm x < r; norm y < s\ \ norm (x * y) < r * s" ``` huffman@22880 ` 534` ```apply (rule order_le_less_trans [OF norm_mult_ineq]) ``` huffman@22880 ` 535` ```apply (simp add: mult_strict_mono') ``` huffman@22880 ` 536` ```done ``` huffman@22880 ` 537` huffman@22857 ` 538` ```lemma norm_of_real [simp]: ``` huffman@22857 ` 539` ``` "norm (of_real r :: 'a::real_normed_algebra_1) = \r\" ``` huffman@22852 ` 540` ```unfolding of_real_def by (simp add: norm_scaleR) ``` huffman@20560 ` 541` huffman@22876 ` 542` ```lemma norm_number_of [simp]: ``` huffman@22876 ` 543` ``` "norm (number_of w::'a::{number_ring,real_normed_algebra_1}) ``` huffman@22876 ` 544` ``` = \number_of w\" ``` huffman@22876 ` 545` ```by (subst of_real_number_of_eq [symmetric], rule norm_of_real) ``` huffman@22876 ` 546` huffman@22876 ` 547` ```lemma norm_of_int [simp]: ``` huffman@22876 ` 548` ``` "norm (of_int z::'a::real_normed_algebra_1) = \of_int z\" ``` huffman@22876 ` 549` ```by (subst of_real_of_int_eq [symmetric], rule norm_of_real) ``` huffman@22876 ` 550` huffman@22876 ` 551` ```lemma norm_of_nat [simp]: ``` huffman@22876 ` 552` ``` "norm (of_nat n::'a::real_normed_algebra_1) = of_nat n" ``` huffman@22876 ` 553` ```apply (subst of_real_of_nat_eq [symmetric]) ``` huffman@22876 ` 554` ```apply (subst norm_of_real, simp) ``` huffman@22876 ` 555` ```done ``` huffman@22876 ` 556` huffman@20504 ` 557` ```lemma nonzero_norm_inverse: ``` huffman@20504 ` 558` ``` fixes a :: "'a::real_normed_div_algebra" ``` huffman@20533 ` 559` ``` shows "a \ 0 \ norm (inverse a) = inverse (norm a)" ``` huffman@20504 ` 560` ```apply (rule inverse_unique [symmetric]) ``` huffman@20504 ` 561` ```apply (simp add: norm_mult [symmetric]) ``` huffman@20504 ` 562` ```done ``` huffman@20504 ` 563` huffman@20504 ` 564` ```lemma norm_inverse: ``` huffman@20504 ` 565` ``` fixes a :: "'a::{real_normed_div_algebra,division_by_zero}" ``` huffman@20533 ` 566` ``` shows "norm (inverse a) = inverse (norm a)" ``` huffman@20504 ` 567` ```apply (case_tac "a = 0", simp) ``` huffman@20504 ` 568` ```apply (erule nonzero_norm_inverse) ``` huffman@20504 ` 569` ```done ``` huffman@20504 ` 570` huffman@20584 ` 571` ```lemma nonzero_norm_divide: ``` huffman@20584 ` 572` ``` fixes a b :: "'a::real_normed_field" ``` huffman@20584 ` 573` ``` shows "b \ 0 \ norm (a / b) = norm a / norm b" ``` huffman@20584 ` 574` ```by (simp add: divide_inverse norm_mult nonzero_norm_inverse) ``` huffman@20584 ` 575` huffman@20584 ` 576` ```lemma norm_divide: ``` huffman@20584 ` 577` ``` fixes a b :: "'a::{real_normed_field,division_by_zero}" ``` huffman@20584 ` 578` ``` shows "norm (a / b) = norm a / norm b" ``` huffman@20584 ` 579` ```by (simp add: divide_inverse norm_mult norm_inverse) ``` huffman@20584 ` 580` huffman@22852 ` 581` ```lemma norm_power_ineq: ``` huffman@22852 ` 582` ``` fixes x :: "'a::{real_normed_algebra_1,recpower}" ``` huffman@22852 ` 583` ``` shows "norm (x ^ n) \ norm x ^ n" ``` huffman@22852 ` 584` ```proof (induct n) ``` huffman@22852 ` 585` ``` case 0 show "norm (x ^ 0) \ norm x ^ 0" by simp ``` huffman@22852 ` 586` ```next ``` huffman@22852 ` 587` ``` case (Suc n) ``` huffman@22852 ` 588` ``` have "norm (x * x ^ n) \ norm x * norm (x ^ n)" ``` huffman@22852 ` 589` ``` by (rule norm_mult_ineq) ``` huffman@22852 ` 590` ``` also from Suc have "\ \ norm x * norm x ^ n" ``` huffman@22852 ` 591` ``` using norm_ge_zero by (rule mult_left_mono) ``` huffman@22852 ` 592` ``` finally show "norm (x ^ Suc n) \ norm x ^ Suc n" ``` huffman@22852 ` 593` ``` by (simp add: power_Suc) ``` huffman@22852 ` 594` ```qed ``` huffman@22852 ` 595` huffman@20684 ` 596` ```lemma norm_power: ``` huffman@20684 ` 597` ``` fixes x :: "'a::{real_normed_div_algebra,recpower}" ``` huffman@20684 ` 598` ``` shows "norm (x ^ n) = norm x ^ n" ``` wenzelm@20772 ` 599` ```by (induct n) (simp_all add: power_Suc norm_mult) ``` huffman@20684 ` 600` huffman@22442 ` 601` huffman@22972 ` 602` ```subsection {* Sign function *} ``` huffman@22972 ` 603` nipkow@24506 ` 604` ```lemma norm_sgn: ``` nipkow@24506 ` 605` ``` "norm (sgn(x::'a::real_normed_vector)) = (if x = 0 then 0 else 1)" ``` nipkow@24506 ` 606` ```by (simp add: sgn_div_norm norm_scaleR) ``` huffman@22972 ` 607` nipkow@24506 ` 608` ```lemma sgn_zero [simp]: "sgn(0::'a::real_normed_vector) = 0" ``` nipkow@24506 ` 609` ```by (simp add: sgn_div_norm) ``` huffman@22972 ` 610` nipkow@24506 ` 611` ```lemma sgn_zero_iff: "(sgn(x::'a::real_normed_vector) = 0) = (x = 0)" ``` nipkow@24506 ` 612` ```by (simp add: sgn_div_norm) ``` huffman@22972 ` 613` nipkow@24506 ` 614` ```lemma sgn_minus: "sgn (- x) = - sgn(x::'a::real_normed_vector)" ``` nipkow@24506 ` 615` ```by (simp add: sgn_div_norm) ``` huffman@22972 ` 616` nipkow@24506 ` 617` ```lemma sgn_scaleR: ``` nipkow@24506 ` 618` ``` "sgn (scaleR r x) = scaleR (sgn r) (sgn(x::'a::real_normed_vector))" ``` nipkow@24506 ` 619` ```by (simp add: sgn_div_norm norm_scaleR mult_ac) ``` huffman@22973 ` 620` huffman@22972 ` 621` ```lemma sgn_one [simp]: "sgn (1::'a::real_normed_algebra_1) = 1" ``` nipkow@24506 ` 622` ```by (simp add: sgn_div_norm) ``` huffman@22972 ` 623` huffman@22972 ` 624` ```lemma sgn_of_real: ``` huffman@22972 ` 625` ``` "sgn (of_real r::'a::real_normed_algebra_1) = of_real (sgn r)" ``` huffman@22972 ` 626` ```unfolding of_real_def by (simp only: sgn_scaleR sgn_one) ``` huffman@22972 ` 627` huffman@22973 ` 628` ```lemma sgn_mult: ``` huffman@22973 ` 629` ``` fixes x y :: "'a::real_normed_div_algebra" ``` huffman@22973 ` 630` ``` shows "sgn (x * y) = sgn x * sgn y" ``` nipkow@24506 ` 631` ```by (simp add: sgn_div_norm norm_mult mult_commute) ``` huffman@22973 ` 632` huffman@22972 ` 633` ```lemma real_sgn_eq: "sgn (x::real) = x / \x\" ``` nipkow@24506 ` 634` ```by (simp add: sgn_div_norm divide_inverse) ``` huffman@22972 ` 635` huffman@22972 ` 636` ```lemma real_sgn_pos: "0 < (x::real) \ sgn x = 1" ``` huffman@22972 ` 637` ```unfolding real_sgn_eq by simp ``` huffman@22972 ` 638` huffman@22972 ` 639` ```lemma real_sgn_neg: "(x::real) < 0 \ sgn x = -1" ``` huffman@22972 ` 640` ```unfolding real_sgn_eq by simp ``` huffman@22972 ` 641` huffman@22972 ` 642` huffman@22442 ` 643` ```subsection {* Bounded Linear and Bilinear Operators *} ``` huffman@22442 ` 644` huffman@22442 ` 645` ```locale bounded_linear = additive + ``` huffman@22442 ` 646` ``` constrains f :: "'a::real_normed_vector \ 'b::real_normed_vector" ``` huffman@22442 ` 647` ``` assumes scaleR: "f (scaleR r x) = scaleR r (f x)" ``` huffman@22442 ` 648` ``` assumes bounded: "\K. \x. norm (f x) \ norm x * K" ``` huffman@27443 ` 649` ```begin ``` huffman@22442 ` 650` huffman@27443 ` 651` ```lemma pos_bounded: ``` huffman@22442 ` 652` ``` "\K>0. \x. norm (f x) \ norm x * K" ``` huffman@22442 ` 653` ```proof - ``` huffman@22442 ` 654` ``` obtain K where K: "\x. norm (f x) \ norm x * K" ``` huffman@22442 ` 655` ``` using bounded by fast ``` huffman@22442 ` 656` ``` show ?thesis ``` huffman@22442 ` 657` ``` proof (intro exI impI conjI allI) ``` huffman@22442 ` 658` ``` show "0 < max 1 K" ``` huffman@22442 ` 659` ``` by (rule order_less_le_trans [OF zero_less_one le_maxI1]) ``` huffman@22442 ` 660` ``` next ``` huffman@22442 ` 661` ``` fix x ``` huffman@22442 ` 662` ``` have "norm (f x) \ norm x * K" using K . ``` huffman@22442 ` 663` ``` also have "\ \ norm x * max 1 K" ``` huffman@22442 ` 664` ``` by (rule mult_left_mono [OF le_maxI2 norm_ge_zero]) ``` huffman@22442 ` 665` ``` finally show "norm (f x) \ norm x * max 1 K" . ``` huffman@22442 ` 666` ``` qed ``` huffman@22442 ` 667` ```qed ``` huffman@22442 ` 668` huffman@27443 ` 669` ```lemma nonneg_bounded: ``` huffman@22442 ` 670` ``` "\K\0. \x. norm (f x) \ norm x * K" ``` huffman@22442 ` 671` ```proof - ``` huffman@22442 ` 672` ``` from pos_bounded ``` huffman@22442 ` 673` ``` show ?thesis by (auto intro: order_less_imp_le) ``` huffman@22442 ` 674` ```qed ``` huffman@22442 ` 675` huffman@27443 ` 676` ```end ``` huffman@27443 ` 677` huffman@22442 ` 678` ```locale bounded_bilinear = ``` huffman@22442 ` 679` ``` fixes prod :: "['a::real_normed_vector, 'b::real_normed_vector] ``` huffman@22442 ` 680` ``` \ 'c::real_normed_vector" ``` huffman@22442 ` 681` ``` (infixl "**" 70) ``` huffman@22442 ` 682` ``` assumes add_left: "prod (a + a') b = prod a b + prod a' b" ``` huffman@22442 ` 683` ``` assumes add_right: "prod a (b + b') = prod a b + prod a b'" ``` huffman@22442 ` 684` ``` assumes scaleR_left: "prod (scaleR r a) b = scaleR r (prod a b)" ``` huffman@22442 ` 685` ``` assumes scaleR_right: "prod a (scaleR r b) = scaleR r (prod a b)" ``` huffman@22442 ` 686` ``` assumes bounded: "\K. \a b. norm (prod a b) \ norm a * norm b * K" ``` huffman@27443 ` 687` ```begin ``` huffman@22442 ` 688` huffman@27443 ` 689` ```lemma pos_bounded: ``` huffman@22442 ` 690` ``` "\K>0. \a b. norm (a ** b) \ norm a * norm b * K" ``` huffman@22442 ` 691` ```apply (cut_tac bounded, erule exE) ``` huffman@22442 ` 692` ```apply (rule_tac x="max 1 K" in exI, safe) ``` huffman@22442 ` 693` ```apply (rule order_less_le_trans [OF zero_less_one le_maxI1]) ``` huffman@22442 ` 694` ```apply (drule spec, drule spec, erule order_trans) ``` huffman@22442 ` 695` ```apply (rule mult_left_mono [OF le_maxI2]) ``` huffman@22442 ` 696` ```apply (intro mult_nonneg_nonneg norm_ge_zero) ``` huffman@22442 ` 697` ```done ``` huffman@22442 ` 698` huffman@27443 ` 699` ```lemma nonneg_bounded: ``` huffman@22442 ` 700` ``` "\K\0. \a b. norm (a ** b) \ norm a * norm b * K" ``` huffman@22442 ` 701` ```proof - ``` huffman@22442 ` 702` ``` from pos_bounded ``` huffman@22442 ` 703` ``` show ?thesis by (auto intro: order_less_imp_le) ``` huffman@22442 ` 704` ```qed ``` huffman@22442 ` 705` huffman@27443 ` 706` ```lemma additive_right: "additive (\b. prod a b)" ``` huffman@22442 ` 707` ```by (rule additive.intro, rule add_right) ``` huffman@22442 ` 708` huffman@27443 ` 709` ```lemma additive_left: "additive (\a. prod a b)" ``` huffman@22442 ` 710` ```by (rule additive.intro, rule add_left) ``` huffman@22442 ` 711` huffman@27443 ` 712` ```lemma zero_left: "prod 0 b = 0" ``` huffman@22442 ` 713` ```by (rule additive.zero [OF additive_left]) ``` huffman@22442 ` 714` huffman@27443 ` 715` ```lemma zero_right: "prod a 0 = 0" ``` huffman@22442 ` 716` ```by (rule additive.zero [OF additive_right]) ``` huffman@22442 ` 717` huffman@27443 ` 718` ```lemma minus_left: "prod (- a) b = - prod a b" ``` huffman@22442 ` 719` ```by (rule additive.minus [OF additive_left]) ``` huffman@22442 ` 720` huffman@27443 ` 721` ```lemma minus_right: "prod a (- b) = - prod a b" ``` huffman@22442 ` 722` ```by (rule additive.minus [OF additive_right]) ``` huffman@22442 ` 723` huffman@27443 ` 724` ```lemma diff_left: ``` huffman@22442 ` 725` ``` "prod (a - a') b = prod a b - prod a' b" ``` huffman@22442 ` 726` ```by (rule additive.diff [OF additive_left]) ``` huffman@22442 ` 727` huffman@27443 ` 728` ```lemma diff_right: ``` huffman@22442 ` 729` ``` "prod a (b - b') = prod a b - prod a b'" ``` huffman@22442 ` 730` ```by (rule additive.diff [OF additive_right]) ``` huffman@22442 ` 731` huffman@27443 ` 732` ```lemma bounded_linear_left: ``` huffman@22442 ` 733` ``` "bounded_linear (\a. a ** b)" ``` huffman@22442 ` 734` ```apply (unfold_locales) ``` huffman@22442 ` 735` ```apply (rule add_left) ``` huffman@22442 ` 736` ```apply (rule scaleR_left) ``` huffman@22442 ` 737` ```apply (cut_tac bounded, safe) ``` huffman@22442 ` 738` ```apply (rule_tac x="norm b * K" in exI) ``` huffman@22442 ` 739` ```apply (simp add: mult_ac) ``` huffman@22442 ` 740` ```done ``` huffman@22442 ` 741` huffman@27443 ` 742` ```lemma bounded_linear_right: ``` huffman@22442 ` 743` ``` "bounded_linear (\b. a ** b)" ``` huffman@22442 ` 744` ```apply (unfold_locales) ``` huffman@22442 ` 745` ```apply (rule add_right) ``` huffman@22442 ` 746` ```apply (rule scaleR_right) ``` huffman@22442 ` 747` ```apply (cut_tac bounded, safe) ``` huffman@22442 ` 748` ```apply (rule_tac x="norm a * K" in exI) ``` huffman@22442 ` 749` ```apply (simp add: mult_ac) ``` huffman@22442 ` 750` ```done ``` huffman@22442 ` 751` huffman@27443 ` 752` ```lemma prod_diff_prod: ``` huffman@22442 ` 753` ``` "(x ** y - a ** b) = (x - a) ** (y - b) + (x - a) ** b + a ** (y - b)" ``` huffman@22442 ` 754` ```by (simp add: diff_left diff_right) ``` huffman@22442 ` 755` huffman@27443 ` 756` ```end ``` huffman@27443 ` 757` huffman@23127 ` 758` ```interpretation mult: ``` huffman@22442 ` 759` ``` bounded_bilinear ["op * :: 'a \ 'a \ 'a::real_normed_algebra"] ``` huffman@22442 ` 760` ```apply (rule bounded_bilinear.intro) ``` huffman@22442 ` 761` ```apply (rule left_distrib) ``` huffman@22442 ` 762` ```apply (rule right_distrib) ``` huffman@22442 ` 763` ```apply (rule mult_scaleR_left) ``` huffman@22442 ` 764` ```apply (rule mult_scaleR_right) ``` huffman@22442 ` 765` ```apply (rule_tac x="1" in exI) ``` huffman@22442 ` 766` ```apply (simp add: norm_mult_ineq) ``` huffman@22442 ` 767` ```done ``` huffman@22442 ` 768` huffman@23127 ` 769` ```interpretation mult_left: ``` huffman@22442 ` 770` ``` bounded_linear ["(\x::'a::real_normed_algebra. x * y)"] ``` huffman@23127 ` 771` ```by (rule mult.bounded_linear_left) ``` huffman@22442 ` 772` huffman@23127 ` 773` ```interpretation mult_right: ``` huffman@23127 ` 774` ``` bounded_linear ["(\y::'a::real_normed_algebra. x * y)"] ``` huffman@23127 ` 775` ```by (rule mult.bounded_linear_right) ``` huffman@23127 ` 776` huffman@23127 ` 777` ```interpretation divide: ``` huffman@23120 ` 778` ``` bounded_linear ["(\x::'a::real_normed_field. x / y)"] ``` huffman@23127 ` 779` ```unfolding divide_inverse by (rule mult.bounded_linear_left) ``` huffman@23120 ` 780` huffman@23127 ` 781` ```interpretation scaleR: bounded_bilinear ["scaleR"] ``` huffman@22442 ` 782` ```apply (rule bounded_bilinear.intro) ``` huffman@22442 ` 783` ```apply (rule scaleR_left_distrib) ``` huffman@22442 ` 784` ```apply (rule scaleR_right_distrib) ``` huffman@22973 ` 785` ```apply simp ``` huffman@22442 ` 786` ```apply (rule scaleR_left_commute) ``` huffman@22442 ` 787` ```apply (rule_tac x="1" in exI) ``` huffman@22442 ` 788` ```apply (simp add: norm_scaleR) ``` huffman@22442 ` 789` ```done ``` huffman@22442 ` 790` huffman@23127 ` 791` ```interpretation scaleR_left: bounded_linear ["\r. scaleR r x"] ``` huffman@23127 ` 792` ```by (rule scaleR.bounded_linear_left) ``` huffman@23127 ` 793` huffman@23127 ` 794` ```interpretation scaleR_right: bounded_linear ["\x. scaleR r x"] ``` huffman@23127 ` 795` ```by (rule scaleR.bounded_linear_right) ``` huffman@23127 ` 796` huffman@23127 ` 797` ```interpretation of_real: bounded_linear ["\r. of_real r"] ``` huffman@23127 ` 798` ```unfolding of_real_def by (rule scaleR.bounded_linear_left) ``` huffman@22625 ` 799` huffman@20504 ` 800` ```end ```