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