src/HOL/Real/RealArith.thy
author paulson
Sat, 13 Dec 2003 09:33:52 +0100
changeset 14294 f4d806fd72ce
parent 14293 22542982bffd
child 14295 7f115e5c5de4
permissions -rw-r--r--
absolute value theorems moved to HOL/Ring_and_Field
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10722
55c8367bab05 rational linear arithmetic
nipkow
parents: 10574
diff changeset
     1
theory RealArith = RealArith0
14275
031a5a051bb4 Converting more of the "real" development to Isar scripts
paulson
parents: 14270
diff changeset
     2
files ("real_arith.ML"):
031a5a051bb4 Converting more of the "real" development to Isar scripts
paulson
parents: 14270
diff changeset
     3
031a5a051bb4 Converting more of the "real" development to Isar scripts
paulson
parents: 14270
diff changeset
     4
use "real_arith.ML"
9436
62bb04ab4b01 rearranged setup of arithmetic procedures, avoiding global reference values;
wenzelm
parents:
diff changeset
     5
62bb04ab4b01 rearranged setup of arithmetic procedures, avoiding global reference values;
wenzelm
parents:
diff changeset
     6
setup real_arith_setup
62bb04ab4b01 rearranged setup of arithmetic procedures, avoiding global reference values;
wenzelm
parents:
diff changeset
     7
14288
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
     8
subsection{* Simprules combining x+y and 0: ARE THEY NEEDED?*}
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
     9
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    10
text{*Needed in this non-standard form by Hyperreal/Transcendental*}
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    11
lemma real_0_le_divide_iff:
14294
f4d806fd72ce absolute value theorems moved to HOL/Ring_and_Field
paulson
parents: 14293
diff changeset
    12
     "((0::real) \<le> x/y) = ((x \<le> 0 | 0 \<le> y) & (0 \<le> x | y \<le> 0))"
14288
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    13
by (simp add: real_divide_def zero_le_mult_iff, auto)
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    14
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    15
lemma real_add_minus_iff [simp]: "(x + - a = (0::real)) = (x=a)" 
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    16
by arith
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    17
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    18
lemma real_add_eq_0_iff [iff]: "(x+y = (0::real)) = (y = -x)"
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    19
by auto
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    20
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    21
lemma real_add_less_0_iff [iff]: "(x+y < (0::real)) = (y < -x)"
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    22
by auto
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    23
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    24
lemma real_0_less_add_iff [iff]: "((0::real) < x+y) = (-x < y)"
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    25
by auto
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    26
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    27
lemma real_add_le_0_iff [iff]: "(x+y \<le> (0::real)) = (y \<le> -x)"
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    28
by auto
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    29
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    30
lemma real_0_le_add_iff [iff]: "((0::real) \<le> x+y) = (-x \<le> y)"
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    31
by auto
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    32
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    33
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    34
(** Simprules combining x-y and 0; see also real_less_iff_diff_less_0, etc.,
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    35
    in RealBin
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    36
**)
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    37
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    38
lemma real_0_less_diff_iff [iff]: "((0::real) < x-y) = (y < x)"
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    39
by auto
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    40
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    41
lemma real_0_le_diff_iff [iff]: "((0::real) \<le> x-y) = (y \<le> x)"
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    42
by auto
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    43
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    44
(*
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    45
FIXME: we should have this, as for type int, but many proofs would break.
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    46
It replaces x+-y by x-y.
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    47
Addsimps [symmetric real_diff_def]
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    48
*)
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    49
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    50
(** Division by 1, -1 **)
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    51
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    52
lemma real_divide_minus1 [simp]: "x/-1 = -(x::real)"
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    53
by simp
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    54
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    55
lemma real_minus1_divide [simp]: "-1/(x::real) = - (1/x)"
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    56
by (simp add: real_divide_def real_minus_inverse)
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    57
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    58
lemma real_lbound_gt_zero:
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    59
     "[| (0::real) < d1; 0 < d2 |] ==> \<exists>e. 0 < e & e < d1 & e < d2"
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    60
apply (rule_tac x = " (min d1 d2) /2" in exI)
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    61
apply (simp add: min_def)
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    62
done
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    63
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    64
(*** Density of the Reals ***)
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    65
14293
22542982bffd moving some division theorems to Ring_and_Field
paulson
parents: 14290
diff changeset
    66
text{*Similar results are proved in @{text Ring_and_Field}*}
14288
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    67
lemma real_less_half_sum: "x < y ==> x < (x+y) / (2::real)"
14293
22542982bffd moving some division theorems to Ring_and_Field
paulson
parents: 14290
diff changeset
    68
  by auto
14288
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    69
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    70
lemma real_gt_half_sum: "x < y ==> (x+y)/(2::real) < y"
14293
22542982bffd moving some division theorems to Ring_and_Field
paulson
parents: 14290
diff changeset
    71
  by auto
14288
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    72
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    73
lemma real_dense: "x < y ==> \<exists>r::real. x < r & r < y"
14293
22542982bffd moving some division theorems to Ring_and_Field
paulson
parents: 14290
diff changeset
    74
  by (rule Ring_and_Field.dense)
22542982bffd moving some division theorems to Ring_and_Field
paulson
parents: 14290
diff changeset
    75
14288
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
    76
14269
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    77
subsection{*Absolute Value Function for the Reals*}
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    78
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    79
lemma abs_nat_number_of: 
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    80
     "abs (number_of v :: real) =  
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    81
        (if neg (number_of v) then number_of (bin_minus v)  
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    82
         else number_of v)"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    83
apply (simp add: real_abs_def bin_arith_simps minus_real_number_of le_real_number_of_eq_not_less less_real_number_of real_of_int_le_iff)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    84
done
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    85
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    86
declare abs_nat_number_of [simp]
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    87
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    88
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    89
(*----------------------------------------------------------------------------
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    90
       Properties of the absolute value function over the reals
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    91
       (adapted version of previously proved theorems about abs)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    92
 ----------------------------------------------------------------------------*)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    93
14294
f4d806fd72ce absolute value theorems moved to HOL/Ring_and_Field
paulson
parents: 14293
diff changeset
    94
text{*FIXME: these should go!*}
f4d806fd72ce absolute value theorems moved to HOL/Ring_and_Field
paulson
parents: 14293
diff changeset
    95
lemma abs_eqI1: "(0::real)\<le>x ==> abs x = x"
14269
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    96
by (unfold real_abs_def, simp)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    97
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    98
lemma abs_eqI2: "(0::real) < x ==> abs x = x"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    99
by (unfold real_abs_def, simp)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   100
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   101
lemma abs_minus_eqI2: "x < (0::real) ==> abs x = -x"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   102
by (unfold real_abs_def real_le_def, simp)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   103
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   104
lemma abs_mult_inverse: "abs (x * inverse y) = (abs x) * inverse (abs (y::real))"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   105
by (simp add: abs_mult abs_inverse)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   106
14294
f4d806fd72ce absolute value theorems moved to HOL/Ring_and_Field
paulson
parents: 14293
diff changeset
   107
text{*Much easier to prove using arithmetic than abstractly!!*}
f4d806fd72ce absolute value theorems moved to HOL/Ring_and_Field
paulson
parents: 14293
diff changeset
   108
lemma abs_triangle_ineq: "abs(x+y) \<le> abs x + abs (y::real)"
14269
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   109
by (unfold real_abs_def, simp)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   110
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   111
(*Unused, but perhaps interesting as an example*)
14294
f4d806fd72ce absolute value theorems moved to HOL/Ring_and_Field
paulson
parents: 14293
diff changeset
   112
lemma abs_triangle_ineq_four: "abs(w + x + y + z) \<le> abs(w) + abs(x) + abs(y) + abs(z::real)"
14269
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   113
by (simp add: abs_triangle_ineq [THEN order_trans])
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   114
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   115
lemma abs_minus_add_cancel: "abs(x + (-y)) = abs (y + (-(x::real)))"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   116
by (unfold real_abs_def, simp)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   117
14294
f4d806fd72ce absolute value theorems moved to HOL/Ring_and_Field
paulson
parents: 14293
diff changeset
   118
lemma abs_triangle_minus_ineq: "abs(x + (-y)) \<le> abs x + abs (y::real)"
14269
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   119
by (unfold real_abs_def, simp)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   120
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   121
lemma abs_add_less [rule_format (no_asm)]: "abs x < r --> abs y < s --> abs(x+y) < r+(s::real)"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   122
by (unfold real_abs_def, simp)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   123
14294
f4d806fd72ce absolute value theorems moved to HOL/Ring_and_Field
paulson
parents: 14293
diff changeset
   124
lemma abs_add_minus_less:
f4d806fd72ce absolute value theorems moved to HOL/Ring_and_Field
paulson
parents: 14293
diff changeset
   125
     "abs x < r --> abs y < s --> abs(x+ (-y)) < r+(s::real)"
14269
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   126
by (unfold real_abs_def, simp)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   127
14294
f4d806fd72ce absolute value theorems moved to HOL/Ring_and_Field
paulson
parents: 14293
diff changeset
   128
lemma abs_minus_one [simp]: "abs (-1) = (1::real)"
14269
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   129
by (unfold real_abs_def, simp)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   130
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   131
lemma abs_interval_iff: "(abs x < r) = (-r < x & x < (r::real))"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   132
by (unfold real_abs_def, auto)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   133
14294
f4d806fd72ce absolute value theorems moved to HOL/Ring_and_Field
paulson
parents: 14293
diff changeset
   134
lemma abs_le_interval_iff: "(abs x \<le> r) = (-r\<le>x & x\<le>(r::real))"
14269
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   135
by (unfold real_abs_def, auto)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   136
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   137
lemma abs_add_pos_gt_zero: "(0::real) < k ==> 0 < k + abs(x)"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   138
by (unfold real_abs_def, auto)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   139
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   140
lemma abs_add_one_gt_zero: "(0::real) < 1 + abs(x)"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   141
by (unfold real_abs_def, auto)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   142
declare abs_add_one_gt_zero [simp]
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   143
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   144
lemma abs_circle: "abs h < abs y - abs x ==> abs (x + h) < abs (y::real)"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   145
by (auto intro: abs_triangle_ineq [THEN order_le_less_trans])
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   146
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   147
lemma abs_real_of_nat_cancel: "abs (real x) = real (x::nat)"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   148
by (auto intro: abs_eqI1 simp add: real_of_nat_ge_zero)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   149
declare abs_real_of_nat_cancel [simp]
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   150
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   151
lemma abs_add_one_not_less_self: "~ abs(x) + (1::real) < x"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   152
apply (rule real_leD)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   153
apply (auto intro: abs_ge_self [THEN order_trans])
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   154
done
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   155
declare abs_add_one_not_less_self [simp]
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   156
 
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   157
(* used in vector theory *)
14294
f4d806fd72ce absolute value theorems moved to HOL/Ring_and_Field
paulson
parents: 14293
diff changeset
   158
lemma abs_triangle_ineq_three: "abs(w + x + (y::real)) \<le> abs(w) + abs(x) + abs(y)"
14270
342451d763f9 More re-organising of numerical theorems
paulson
parents: 14269
diff changeset
   159
by (auto intro!: abs_triangle_ineq [THEN order_trans] real_add_left_mono
342451d763f9 More re-organising of numerical theorems
paulson
parents: 14269
diff changeset
   160
                 simp add: real_add_assoc)
14269
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   161
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   162
lemma abs_diff_less_imp_gt_zero: "abs(x - y) < y ==> (0::real) < y"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   163
apply (unfold real_abs_def)
14294
f4d806fd72ce absolute value theorems moved to HOL/Ring_and_Field
paulson
parents: 14293
diff changeset
   164
apply (case_tac "0 \<le> x - y", auto)
14269
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   165
done
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   166
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   167
lemma abs_diff_less_imp_gt_zero2: "abs(x - y) < x ==> (0::real) < x"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   168
apply (unfold real_abs_def)
14294
f4d806fd72ce absolute value theorems moved to HOL/Ring_and_Field
paulson
parents: 14293
diff changeset
   169
apply (case_tac "0 \<le> x - y", auto)
14269
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   170
done
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   171
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   172
lemma abs_diff_less_imp_gt_zero3: "abs(x - y) < y ==> (0::real) < x"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   173
by (auto simp add: abs_interval_iff)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   174
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   175
lemma abs_diff_less_imp_gt_zero4: "abs(x - y) < -y ==> x < (0::real)"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   176
by (auto simp add: abs_interval_iff)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   177
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   178
lemma abs_triangle_ineq_minus_cancel: 
14294
f4d806fd72ce absolute value theorems moved to HOL/Ring_and_Field
paulson
parents: 14293
diff changeset
   179
     "abs(x) \<le> abs(x + (-y)) + abs((y::real))"
14269
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   180
apply (unfold real_abs_def, auto)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   181
done
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   182
14294
f4d806fd72ce absolute value theorems moved to HOL/Ring_and_Field
paulson
parents: 14293
diff changeset
   183
lemma abs_sum_triangle_ineq: "abs ((x::real) + y + (-l + -m)) \<le> abs(x + -l) + abs(y + -m)"
14269
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   184
apply (simp add: real_add_assoc)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   185
apply (rule_tac x1 = y in real_add_left_commute [THEN ssubst])
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   186
apply (rule real_add_assoc [THEN subst])
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   187
apply (rule abs_triangle_ineq)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   188
done
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   189
14288
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
   190
14290
84fda1b39947 removal of abel_cancel from Real
paulson
parents: 14288
diff changeset
   191
14269
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   192
ML
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   193
{*
14288
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
   194
val real_0_le_divide_iff = thm"real_0_le_divide_iff";
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
   195
val real_add_minus_iff = thm"real_add_minus_iff";
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
   196
val real_add_eq_0_iff = thm"real_add_eq_0_iff";
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
   197
val real_add_less_0_iff = thm"real_add_less_0_iff";
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
   198
val real_0_less_add_iff = thm"real_0_less_add_iff";
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
   199
val real_add_le_0_iff = thm"real_add_le_0_iff";
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
   200
val real_0_le_add_iff = thm"real_0_le_add_iff";
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
   201
val real_0_less_diff_iff = thm"real_0_less_diff_iff";
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
   202
val real_0_le_diff_iff = thm"real_0_le_diff_iff";
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
   203
val real_divide_minus1 = thm"real_divide_minus1";
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
   204
val real_minus1_divide = thm"real_minus1_divide";
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
   205
val real_lbound_gt_zero = thm"real_lbound_gt_zero";
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
   206
val real_less_half_sum = thm"real_less_half_sum";
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
   207
val real_gt_half_sum = thm"real_gt_half_sum";
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
   208
val real_dense = thm"real_dense";
d149e3cbdb39 Moving some theorems from Real/RealArith0.ML
paulson
parents: 14275
diff changeset
   209
14269
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   210
val abs_nat_number_of = thm"abs_nat_number_of";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   211
val abs_split = thm"abs_split";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   212
val abs_zero = thm"abs_zero";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   213
val abs_eqI1 = thm"abs_eqI1";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   214
val abs_eqI2 = thm"abs_eqI2";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   215
val abs_minus_eqI2 = thm"abs_minus_eqI2";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   216
val abs_ge_zero = thm"abs_ge_zero";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   217
val abs_idempotent = thm"abs_idempotent";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   218
val abs_zero_iff = thm"abs_zero_iff";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   219
val abs_ge_self = thm"abs_ge_self";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   220
val abs_ge_minus_self = thm"abs_ge_minus_self";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   221
val abs_mult = thm"abs_mult";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   222
val abs_inverse = thm"abs_inverse";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   223
val abs_mult_inverse = thm"abs_mult_inverse";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   224
val abs_triangle_ineq = thm"abs_triangle_ineq";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   225
val abs_triangle_ineq_four = thm"abs_triangle_ineq_four";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   226
val abs_minus_cancel = thm"abs_minus_cancel";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   227
val abs_minus_add_cancel = thm"abs_minus_add_cancel";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   228
val abs_triangle_minus_ineq = thm"abs_triangle_minus_ineq";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   229
val abs_add_less = thm"abs_add_less";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   230
val abs_add_minus_less = thm"abs_add_minus_less";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   231
val abs_minus_one = thm"abs_minus_one";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   232
val abs_interval_iff = thm"abs_interval_iff";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   233
val abs_le_interval_iff = thm"abs_le_interval_iff";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   234
val abs_add_pos_gt_zero = thm"abs_add_pos_gt_zero";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   235
val abs_add_one_gt_zero = thm"abs_add_one_gt_zero";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   236
val abs_circle = thm"abs_circle";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   237
val abs_le_zero_iff = thm"abs_le_zero_iff";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   238
val abs_real_of_nat_cancel = thm"abs_real_of_nat_cancel";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   239
val abs_add_one_not_less_self = thm"abs_add_one_not_less_self";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   240
val abs_triangle_ineq_three = thm"abs_triangle_ineq_three";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   241
val abs_diff_less_imp_gt_zero = thm"abs_diff_less_imp_gt_zero";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   242
val abs_diff_less_imp_gt_zero2 = thm"abs_diff_less_imp_gt_zero2";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   243
val abs_diff_less_imp_gt_zero3 = thm"abs_diff_less_imp_gt_zero3";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   244
val abs_diff_less_imp_gt_zero4 = thm"abs_diff_less_imp_gt_zero4";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   245
val abs_triangle_ineq_minus_cancel = thm"abs_triangle_ineq_minus_cancel";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   246
val abs_sum_triangle_ineq = thm"abs_sum_triangle_ineq";
14294
f4d806fd72ce absolute value theorems moved to HOL/Ring_and_Field
paulson
parents: 14293
diff changeset
   247
f4d806fd72ce absolute value theorems moved to HOL/Ring_and_Field
paulson
parents: 14293
diff changeset
   248
val abs_mult_less = thm"abs_mult_less";
14269
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   249
*}
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   250
9436
62bb04ab4b01 rearranged setup of arithmetic procedures, avoiding global reference values;
wenzelm
parents:
diff changeset
   251
end