src/HOL/Real/RealArith.thy
author paulson
Fri, 05 Dec 2003 10:28:02 +0100
changeset 14275 031a5a051bb4
parent 14270 342451d763f9
child 14288 d149e3cbdb39
permissions -rw-r--r--
Converting more of the "real" development to Isar scripts
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
14269
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
     8
subsection{*Absolute Value Function for the Reals*}
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
     9
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    10
(** abs (absolute value) **)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    11
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    12
lemma abs_nat_number_of: 
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    13
     "abs (number_of v :: real) =  
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    14
        (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
    15
         else number_of v)"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    16
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
    17
done
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    18
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    19
declare abs_nat_number_of [simp]
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    20
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    21
lemma abs_split [arith_split]: 
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    22
  "P(abs (x::real)) = ((0 <= x --> P x) & (x < 0 --> P(-x)))"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    23
apply (unfold real_abs_def, auto)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    24
done
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    25
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    26
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    27
(*----------------------------------------------------------------------------
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    28
       Properties of the absolute value function over the reals
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    29
       (adapted version of previously proved theorems about abs)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    30
 ----------------------------------------------------------------------------*)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    31
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    32
lemma abs_iff: "abs (r::real) = (if 0<=r then r else -r)"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    33
apply (unfold real_abs_def, auto)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    34
done
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    35
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    36
lemma abs_zero: "abs 0 = (0::real)"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    37
by (unfold real_abs_def, auto)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    38
declare abs_zero [simp]
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    39
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    40
lemma abs_one: "abs (1::real) = 1"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    41
by (unfold real_abs_def, simp)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    42
declare abs_one [simp]
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    43
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    44
lemma abs_eqI1: "(0::real)<=x ==> abs x = x"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    45
by (unfold real_abs_def, simp)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    46
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    47
lemma abs_eqI2: "(0::real) < x ==> abs x = x"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    48
by (unfold real_abs_def, simp)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    49
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    50
lemma abs_minus_eqI2: "x < (0::real) ==> abs x = -x"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    51
by (unfold real_abs_def real_le_def, simp)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    52
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    53
lemma abs_minus_eqI1: "x<=(0::real) ==> abs x = -x"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    54
by (unfold real_abs_def, simp)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    55
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    56
lemma abs_ge_zero: "(0::real)<= abs x"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    57
by (unfold real_abs_def, simp)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    58
declare abs_ge_zero [simp]
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    59
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    60
lemma abs_idempotent: "abs(abs x)=abs (x::real)"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    61
by (unfold real_abs_def, simp)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    62
declare abs_idempotent [simp]
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    63
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    64
lemma abs_zero_iff: "(abs x = 0) = (x=(0::real))"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    65
by (unfold real_abs_def, simp)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    66
declare abs_zero_iff [iff]
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    67
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    68
lemma abs_ge_self: "x<=abs (x::real)"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    69
by (unfold real_abs_def, simp)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    70
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    71
lemma abs_ge_minus_self: "-x<=abs (x::real)"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    72
by (unfold real_abs_def, simp)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    73
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    74
lemma abs_mult: "abs (x * y) = abs x * abs (y::real)"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    75
apply (unfold real_abs_def)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    76
apply (auto dest!: order_antisym simp add: real_0_le_mult_iff)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    77
done
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_inverse: "abs(inverse(x::real)) = inverse(abs(x))"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    80
apply (unfold real_abs_def)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    81
apply (case_tac "x=0")
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    82
apply (auto simp add: real_minus_inverse real_le_less INVERSE_ZERO real_inverse_gt_0)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    83
done
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    84
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    85
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
    86
by (simp add: abs_mult abs_inverse)
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
lemma abs_triangle_ineq: "abs(x+y) <= abs x + abs (y::real)"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    89
by (unfold real_abs_def, simp)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    90
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    91
(*Unused, but perhaps interesting as an example*)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    92
lemma abs_triangle_ineq_four: "abs(w + x + y + z) <= abs(w) + abs(x) + abs(y) + abs(z::real)"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    93
by (simp add: abs_triangle_ineq [THEN order_trans])
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    94
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    95
lemma abs_minus_cancel: "abs(-x)=abs(x::real)"
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
declare abs_minus_cancel [simp]
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    98
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
    99
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
   100
by (unfold real_abs_def, simp)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   101
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   102
lemma abs_triangle_minus_ineq: "abs(x + (-y)) <= abs x + abs (y::real)"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   103
by (unfold real_abs_def, simp)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   104
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   105
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
   106
by (unfold real_abs_def, simp)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   107
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   108
lemma abs_add_minus_less: "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
   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
(* lemmas manipulating terms *)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   112
lemma real_mult_0_less: "((0::real)*x < r)=(0 < r)"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   113
by simp
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 real_mult_less_trans: "[| (0::real) < y; x < r; y*r < t*s |] ==> y*x < t*s"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   116
by (blast intro!: real_mult_less_mono2 intro: order_less_trans)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   117
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   118
(*USED ONLY IN NEXT THM*)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   119
lemma real_mult_le_less_trans:
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   120
     "[| (0::real)<=y; x < r; y*r < t*s; 0 < t*s|] ==> y*x < t*s"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   121
apply (drule order_le_imp_less_or_eq)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   122
apply (fast  elim: real_mult_0_less [THEN iffD2] real_mult_less_trans) 
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   123
done
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   124
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   125
lemma abs_mult_less: "[| 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
   126
apply (simp add: abs_mult)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   127
apply (rule real_mult_le_less_trans)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   128
apply (rule abs_ge_zero, assumption)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   129
apply (rule_tac [2] real_mult_order)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   130
apply (auto intro!: real_mult_less_mono1 abs_ge_zero intro: order_le_less_trans)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   131
done
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   132
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   133
lemma abs_mult_less2: "[| abs x < r; abs y < s |] ==> abs(x)*abs(y) < r*(s::real)"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   134
by (auto intro: abs_mult_less simp add: abs_mult [symmetric])
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   135
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   136
lemma abs_less_gt_zero: "abs(x) < r ==> (0::real) < r"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   137
by (blast intro!: order_le_less_trans abs_ge_zero)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   138
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   139
lemma abs_minus_one: "abs (-1) = (1::real)"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   140
by (unfold real_abs_def, simp)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   141
declare abs_minus_one [simp]
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   142
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   143
lemma abs_disj: "abs x =x | abs x = -(x::real)"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   144
by (unfold real_abs_def, auto)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   145
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   146
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
   147
by (unfold real_abs_def, auto)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   148
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   149
lemma abs_le_interval_iff: "(abs x <= r) = (-r<=x & x<=(r::real))"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   150
by (unfold real_abs_def, auto)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   151
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   152
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
   153
by (unfold real_abs_def, auto)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   154
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   155
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
   156
by (unfold real_abs_def, auto)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   157
declare abs_add_one_gt_zero [simp]
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   158
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   159
lemma abs_not_less_zero: "~ abs x < (0::real)"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   160
by (unfold real_abs_def, auto)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   161
declare abs_not_less_zero [simp]
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   162
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   163
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
   164
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
   165
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   166
lemma abs_le_zero_iff: "(abs x <= (0::real)) = (x = 0)"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   167
by (unfold real_abs_def, auto)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   168
declare abs_le_zero_iff [simp]
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   169
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   170
lemma real_0_less_abs_iff: "((0::real) < abs x) = (x ~= 0)"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   171
by (simp add: real_abs_def, arith)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   172
declare real_0_less_abs_iff [simp]
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   173
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   174
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
   175
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
   176
declare abs_real_of_nat_cancel [simp]
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_add_one_not_less_self: "~ abs(x) + (1::real) < x"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   179
apply (rule real_leD)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   180
apply (auto intro: abs_ge_self [THEN order_trans])
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
declare abs_add_one_not_less_self [simp]
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   183
 
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   184
(* used in vector theory *)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   185
lemma abs_triangle_ineq_three: "abs(w + x + (y::real)) <= abs(w) + abs(x) + abs(y)"
14270
342451d763f9 More re-organising of numerical theorems
paulson
parents: 14269
diff changeset
   186
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
   187
                 simp add: real_add_assoc)
14269
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   188
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   189
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
   190
apply (unfold real_abs_def)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   191
apply (case_tac "0 <= x - y", auto)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   192
done
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   193
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   194
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
   195
apply (unfold real_abs_def)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   196
apply (case_tac "0 <= x - y", auto)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   197
done
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   198
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   199
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
   200
by (auto simp add: abs_interval_iff)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   201
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   202
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
   203
by (auto simp add: abs_interval_iff)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   204
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   205
lemma abs_triangle_ineq_minus_cancel: 
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   206
     "abs(x) <= abs(x + (-y)) + abs((y::real))"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   207
apply (unfold real_abs_def, auto)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   208
done
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   209
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   210
lemma abs_sum_triangle_ineq: "abs ((x::real) + y + (-l + -m)) <= abs(x + -l) + abs(y + -m)"
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   211
apply (simp add: real_add_assoc)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   212
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
   213
apply (rule real_add_assoc [THEN subst])
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   214
apply (rule abs_triangle_ineq)
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   215
done
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   216
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   217
ML
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   218
{*
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   219
val abs_nat_number_of = thm"abs_nat_number_of";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   220
val abs_split = thm"abs_split";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   221
val abs_iff = thm"abs_iff";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   222
val abs_zero = thm"abs_zero";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   223
val abs_one = thm"abs_one";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   224
val abs_eqI1 = thm"abs_eqI1";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   225
val abs_eqI2 = thm"abs_eqI2";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   226
val abs_minus_eqI2 = thm"abs_minus_eqI2";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   227
val abs_minus_eqI1 = thm"abs_minus_eqI1";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   228
val abs_ge_zero = thm"abs_ge_zero";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   229
val abs_idempotent = thm"abs_idempotent";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   230
val abs_zero_iff = thm"abs_zero_iff";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   231
val abs_ge_self = thm"abs_ge_self";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   232
val abs_ge_minus_self = thm"abs_ge_minus_self";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   233
val abs_mult = thm"abs_mult";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   234
val abs_inverse = thm"abs_inverse";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   235
val abs_mult_inverse = thm"abs_mult_inverse";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   236
val abs_triangle_ineq = thm"abs_triangle_ineq";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   237
val abs_triangle_ineq_four = thm"abs_triangle_ineq_four";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   238
val abs_minus_cancel = thm"abs_minus_cancel";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   239
val abs_minus_add_cancel = thm"abs_minus_add_cancel";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   240
val abs_triangle_minus_ineq = thm"abs_triangle_minus_ineq";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   241
val abs_add_less = thm"abs_add_less";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   242
val abs_add_minus_less = thm"abs_add_minus_less";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   243
val real_mult_0_less = thm"real_mult_0_less";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   244
val real_mult_less_trans = thm"real_mult_less_trans";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   245
val real_mult_le_less_trans = thm"real_mult_le_less_trans";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   246
val abs_mult_less = thm"abs_mult_less";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   247
val abs_mult_less2 = thm"abs_mult_less2";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   248
val abs_less_gt_zero = thm"abs_less_gt_zero";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   249
val abs_minus_one = thm"abs_minus_one";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   250
val abs_disj = thm"abs_disj";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   251
val abs_interval_iff = thm"abs_interval_iff";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   252
val abs_le_interval_iff = thm"abs_le_interval_iff";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   253
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
   254
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
   255
val abs_not_less_zero = thm"abs_not_less_zero";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   256
val abs_circle = thm"abs_circle";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   257
val abs_le_zero_iff = thm"abs_le_zero_iff";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   258
val real_0_less_abs_iff = thm"real_0_less_abs_iff";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   259
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
   260
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
   261
val abs_triangle_ineq_three = thm"abs_triangle_ineq_three";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   262
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
   263
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
   264
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
   265
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
   266
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
   267
val abs_sum_triangle_ineq = thm"abs_sum_triangle_ineq";
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   268
*}
502a7c95de73 conversion of some Real theories to Isar scripts
paulson
parents: 10722
diff changeset
   269
9436
62bb04ab4b01 rearranged setup of arithmetic procedures, avoiding global reference values;
wenzelm
parents:
diff changeset
   270
end