src/HOL/Real/RealDef.thy
changeset 14378 69c4d5997669
parent 14369 c50188fe6366
child 14387 e96d5c42c4b0
     1.1 --- a/src/HOL/Real/RealDef.thy	Thu Feb 05 10:45:28 2004 +0100
     1.2 +++ b/src/HOL/Real/RealDef.thy	Tue Feb 10 12:02:11 2004 +0100
     1.3 @@ -23,9 +23,8 @@
     1.4  instance real :: inverse ..
     1.5  
     1.6  consts
     1.7 -   (*Overloaded constants denoting the Nat and Real subsets of enclosing
     1.8 +   (*Overloaded constant denoting the Real subset of enclosing
     1.9       types such as hypreal and complex*)
    1.10 -   Nats  :: "'a set"
    1.11     Reals :: "'a set"
    1.12  
    1.13     (*overloaded constant for injecting other types into "real"*)
    1.14 @@ -85,16 +84,6 @@
    1.15  
    1.16  syntax (xsymbols)
    1.17    Reals     :: "'a set"                   ("\<real>")
    1.18 -  Nats      :: "'a set"                   ("\<nat>")
    1.19 -
    1.20 -
    1.21 -defs (overloaded)
    1.22 -  real_of_int_def:
    1.23 -   "real z == Abs_REAL(\<Union>(i,j) \<in> Rep_Integ z. realrel ``
    1.24 -		       {(preal_of_rat(rat(int(Suc i))),
    1.25 -			 preal_of_rat(rat(int(Suc j))))})"
    1.26 -
    1.27 -  real_of_nat_def:   "real n == real (int n)"
    1.28  
    1.29  
    1.30  subsection{*Proving that realrel is an equivalence relation*}
    1.31 @@ -172,30 +161,6 @@
    1.32  apply (simp add: Rep_REAL_inverse)
    1.33  done
    1.34  
    1.35 -lemma real_eq_iff:
    1.36 -     "[|(x1,y1) \<in> Rep_REAL w; (x2,y2) \<in> Rep_REAL z|] 
    1.37 -      ==> (z = w) = (x1+y2 = x2+y1)"
    1.38 -apply (insert quotient_eq_iff
    1.39 -                [OF equiv_realrel, 
    1.40 -                 of "Rep_REAL w" "Rep_REAL z" "(x1,y1)" "(x2,y2)"])
    1.41 -apply (simp add: Rep_REAL [unfolded REAL_def] Rep_REAL_inject eq_commute) 
    1.42 -done 
    1.43 -
    1.44 -lemma mem_REAL_imp_eq:
    1.45 -     "[|R \<in> REAL; (x1,y1) \<in> R; (x2,y2) \<in> R|] ==> x1+y2 = x2+y1" 
    1.46 -apply (auto simp add: REAL_def realrel_def quotient_def)
    1.47 -apply (blast dest: preal_trans_lemma) 
    1.48 -done
    1.49 -
    1.50 -lemma Rep_REAL_cancel_right:
    1.51 -     "((x + z, y + z) \<in> Rep_REAL R) = ((x, y) \<in> Rep_REAL R)"
    1.52 -apply (rule_tac z = R in eq_Abs_REAL, simp) 
    1.53 -apply (rename_tac u v) 
    1.54 -apply (subgoal_tac "(u + (y + z) = x + z + v) = ((u + y) + z = (x + v) + z)")
    1.55 - prefer 2 apply (simp add: preal_add_ac) 
    1.56 -apply (simp add: preal_add_right_cancel_iff) 
    1.57 -done
    1.58 -
    1.59  
    1.60  subsection{*Congruence property for addition*}
    1.61  
    1.62 @@ -218,21 +183,21 @@
    1.63  done
    1.64  
    1.65  lemma real_add_commute: "(z::real) + w = w + z"
    1.66 -apply (rule_tac z = z in eq_Abs_REAL)
    1.67 -apply (rule_tac z = w in eq_Abs_REAL)
    1.68 +apply (rule eq_Abs_REAL [of z])
    1.69 +apply (rule eq_Abs_REAL [of w])
    1.70  apply (simp add: preal_add_ac real_add)
    1.71  done
    1.72  
    1.73  lemma real_add_assoc: "((z1::real) + z2) + z3 = z1 + (z2 + z3)"
    1.74 -apply (rule_tac z = z1 in eq_Abs_REAL)
    1.75 -apply (rule_tac z = z2 in eq_Abs_REAL)
    1.76 -apply (rule_tac z = z3 in eq_Abs_REAL)
    1.77 +apply (rule eq_Abs_REAL [of z1])
    1.78 +apply (rule eq_Abs_REAL [of z2])
    1.79 +apply (rule eq_Abs_REAL [of z3])
    1.80  apply (simp add: real_add preal_add_assoc)
    1.81  done
    1.82  
    1.83  lemma real_add_zero_left: "(0::real) + z = z"
    1.84  apply (unfold real_of_preal_def real_zero_def)
    1.85 -apply (rule_tac z = z in eq_Abs_REAL)
    1.86 +apply (rule eq_Abs_REAL [of z])
    1.87  apply (simp add: real_add preal_add_ac)
    1.88  done
    1.89  
    1.90 @@ -263,7 +228,7 @@
    1.91  
    1.92  lemma real_add_minus_left: "(-z) + z = (0::real)"
    1.93  apply (unfold real_zero_def)
    1.94 -apply (rule_tac z = z in eq_Abs_REAL)
    1.95 +apply (rule eq_Abs_REAL [of z])
    1.96  apply (simp add: real_minus real_add preal_add_commute)
    1.97  done
    1.98  
    1.99 @@ -283,7 +248,7 @@
   1.100  
   1.101  lemma real_mult_congruent2:
   1.102      "congruent2 realrel (%p1 p2.
   1.103 -          (%(x1,y1). (%(x2,y2). realrel``{(x1*x2 + y1*y2, x1*y2+x2*y1)}) p2) p1)"
   1.104 +        (%(x1,y1). (%(x2,y2). realrel``{(x1*x2 + y1*y2, x1*y2+x2*y1)}) p2) p1)"
   1.105  apply (rule equiv_realrel [THEN congruent2_commuteI], clarify)
   1.106  apply (unfold split_def)
   1.107  apply (simp add: preal_mult_commute preal_add_commute)
   1.108 @@ -298,29 +263,29 @@
   1.109  done
   1.110  
   1.111  lemma real_mult_commute: "(z::real) * w = w * z"
   1.112 -apply (rule_tac z = z in eq_Abs_REAL)
   1.113 -apply (rule_tac z = w in eq_Abs_REAL)
   1.114 +apply (rule eq_Abs_REAL [of z])
   1.115 +apply (rule eq_Abs_REAL [of w])
   1.116  apply (simp add: real_mult preal_add_ac preal_mult_ac)
   1.117  done
   1.118  
   1.119  lemma real_mult_assoc: "((z1::real) * z2) * z3 = z1 * (z2 * z3)"
   1.120 -apply (rule_tac z = z1 in eq_Abs_REAL)
   1.121 -apply (rule_tac z = z2 in eq_Abs_REAL)
   1.122 -apply (rule_tac z = z3 in eq_Abs_REAL)
   1.123 +apply (rule eq_Abs_REAL [of z1])
   1.124 +apply (rule eq_Abs_REAL [of z2])
   1.125 +apply (rule eq_Abs_REAL [of z3])
   1.126  apply (simp add: preal_add_mult_distrib2 real_mult preal_add_ac preal_mult_ac)
   1.127  done
   1.128  
   1.129  lemma real_mult_1: "(1::real) * z = z"
   1.130  apply (unfold real_one_def)
   1.131 -apply (rule_tac z = z in eq_Abs_REAL)
   1.132 +apply (rule eq_Abs_REAL [of z])
   1.133  apply (simp add: real_mult preal_add_mult_distrib2 preal_mult_1_right
   1.134                   preal_mult_ac preal_add_ac)
   1.135  done
   1.136  
   1.137  lemma real_add_mult_distrib: "((z1::real) + z2) * w = (z1 * w) + (z2 * w)"
   1.138 -apply (rule_tac z = z1 in eq_Abs_REAL)
   1.139 -apply (rule_tac z = z2 in eq_Abs_REAL)
   1.140 -apply (rule_tac z = w in eq_Abs_REAL)
   1.141 +apply (rule eq_Abs_REAL [of z1])
   1.142 +apply (rule eq_Abs_REAL [of z2])
   1.143 +apply (rule eq_Abs_REAL [of w])
   1.144  apply (simp add: preal_add_mult_distrib2 real_add real_mult preal_add_ac preal_mult_ac)
   1.145  done
   1.146  
   1.147 @@ -344,7 +309,7 @@
   1.148  
   1.149  lemma real_mult_inverse_left_ex: "x \<noteq> 0 ==> \<exists>y. y*x = (1::real)"
   1.150  apply (unfold real_zero_def real_one_def)
   1.151 -apply (rule_tac z = x in eq_Abs_REAL)
   1.152 +apply (rule eq_Abs_REAL [of x])
   1.153  apply (cut_tac x = xa and y = y in linorder_less_linear)
   1.154  apply (auto dest!: less_add_left_Ex simp add: real_zero_iff)
   1.155  apply (rule_tac
   1.156 @@ -420,63 +385,69 @@
   1.157  subsection{*The @{text "\<le>"} Ordering*}
   1.158  
   1.159  lemma real_le_refl: "w \<le> (w::real)"
   1.160 -apply (rule_tac z = w in eq_Abs_REAL)
   1.161 +apply (rule eq_Abs_REAL [of w])
   1.162  apply (force simp add: real_le_def)
   1.163  done
   1.164  
   1.165 -lemma real_le_trans_lemma:
   1.166 -  assumes le1: "x1 + y2 \<le> x2 + y1"
   1.167 -      and le2: "u1 + v2 \<le> u2 + v1"
   1.168 -      and eq: "x2 + v1 = u1 + y2"
   1.169 -  shows "x1 + v2 + u1 + y2 \<le> u2 + u1 + y2 + (y1::preal)"
   1.170 +text{*The arithmetic decision procedure is not set up for type preal.
   1.171 +  This lemma is currently unused, but it could simplify the proofs of the
   1.172 +  following two lemmas.*}
   1.173 +lemma preal_eq_le_imp_le:
   1.174 +  assumes eq: "a+b = c+d" and le: "c \<le> a"
   1.175 +  shows "b \<le> (d::preal)"
   1.176 +proof -
   1.177 +  have "c+d \<le> a+d" by (simp add: prems preal_cancels)
   1.178 +  hence "a+b \<le> a+d" by (simp add: prems)
   1.179 +  thus "b \<le> d" by (simp add: preal_cancels)
   1.180 +qed
   1.181 +
   1.182 +lemma real_le_lemma:
   1.183 +  assumes l: "u1 + v2 \<le> u2 + v1"
   1.184 +      and "x1 + v1 = u1 + y1"
   1.185 +      and "x2 + v2 = u2 + y2"
   1.186 +  shows "x1 + y2 \<le> x2 + (y1::preal)"
   1.187  proof -
   1.188 -  have "x1 + v2 + u1 + y2 = (x1 + y2) + (u1 + v2)" by (simp add: preal_add_ac)
   1.189 -  also have "... \<le> (x2 + y1) + (u1 + v2)"
   1.190 -         by (simp add: prems preal_add_le_cancel_right)
   1.191 -  also have "... \<le> (x2 + y1) + (u2 + v1)"
   1.192 +  have "(x1+v1) + (u2+y2) = (u1+y1) + (x2+v2)" by (simp add: prems)
   1.193 +  hence "(x1+y2) + (u2+v1) = (x2+y1) + (u1+v2)" by (simp add: preal_add_ac)
   1.194 +  also have "... \<le> (x2+y1) + (u2+v1)"
   1.195           by (simp add: prems preal_add_le_cancel_left)
   1.196 -  also have "... = (x2 + v1) + (u2 + y1)" by (simp add: preal_add_ac)
   1.197 -  also have "... = (u1 + y2) + (u2 + y1)" by (simp add: prems)
   1.198 -  also have "... = u2 + u1 + y2 + y1" by (simp add: preal_add_ac)
   1.199 -  finally show ?thesis .
   1.200 +  finally show ?thesis by (simp add: preal_add_le_cancel_right)
   1.201 +qed						 
   1.202 +
   1.203 +lemma real_le: 
   1.204 +  "(Abs_REAL(realrel``{(x1,y1)}) \<le> Abs_REAL(realrel``{(x2,y2)})) =  
   1.205 +   (x1 + y2 \<le> x2 + y1)"
   1.206 +apply (simp add: real_le_def) 
   1.207 +apply (auto intro: real_le_lemma);
   1.208 +done
   1.209 +
   1.210 +lemma real_le_anti_sym: "[| z \<le> w; w \<le> z |] ==> z = (w::real)"
   1.211 +apply (rule eq_Abs_REAL [of z])
   1.212 +apply (rule eq_Abs_REAL [of w])
   1.213 +apply (simp add: real_le order_antisym) 
   1.214 +done
   1.215 +
   1.216 +lemma real_trans_lemma:
   1.217 +  assumes "x + v \<le> u + y"
   1.218 +      and "u + v' \<le> u' + v"
   1.219 +      and "x2 + v2 = u2 + y2"
   1.220 +  shows "x + v' \<le> u' + (y::preal)"
   1.221 +proof -
   1.222 +  have "(x+v') + (u+v) = (x+v) + (u+v')" by (simp add: preal_add_ac)
   1.223 +  also have "... \<le> (u+y) + (u+v')" 
   1.224 +    by (simp add: preal_add_le_cancel_right prems) 
   1.225 +  also have "... \<le> (u+y) + (u'+v)" 
   1.226 +    by (simp add: preal_add_le_cancel_left prems) 
   1.227 +  also have "... = (u'+y) + (u+v)"  by (simp add: preal_add_ac)
   1.228 +  finally show ?thesis by (simp add: preal_add_le_cancel_right)
   1.229  qed						 
   1.230  
   1.231  lemma real_le_trans: "[| i \<le> j; j \<le> k |] ==> i \<le> (k::real)"
   1.232 -apply (simp add: real_le_def, clarify)
   1.233 -apply (rename_tac x1 u1 y1 v1 x2 u2 y2 v2) 
   1.234 -apply (drule mem_REAL_imp_eq [OF Rep_REAL], assumption)  
   1.235 -apply (rule_tac x=x1 in exI) 
   1.236 -apply (rule_tac x=y1 in exI) 
   1.237 -apply (rule_tac x="u2 + (x2 + v1)" in exI) 
   1.238 -apply (rule_tac x="v2 + (u1 + y2)" in exI) 
   1.239 -apply (simp add: Rep_REAL_cancel_right preal_add_le_cancel_right 
   1.240 -                 preal_add_assoc [symmetric] real_le_trans_lemma)
   1.241 -done
   1.242 -
   1.243 -lemma real_le_anti_sym_lemma: 
   1.244 -  assumes le1: "x1 + y2 \<le> x2 + y1"
   1.245 -      and le2: "u1 + v2 \<le> u2 + v1"
   1.246 -      and eq1: "x1 + v2 = u2 + y1"
   1.247 -      and eq2: "x2 + v1 = u1 + y2"
   1.248 -  shows "x2 + y1 = x1 + (y2::preal)"
   1.249 -proof (rule order_antisym)
   1.250 -  show "x1 + y2 \<le> x2 + y1" .
   1.251 -  have "(x2 + y1) + (u1+u2) = x2 + u1 + (u2 + y1)" by (simp add: preal_add_ac)
   1.252 -  also have "... = x2 + u1 + (x1 + v2)" by (simp add: prems)
   1.253 -  also have "... = (x2 + x1) + (u1 + v2)" by (simp add: preal_add_ac)
   1.254 -  also have "... \<le> (x2 + x1) + (u2 + v1)" 
   1.255 -                                  by (simp add: preal_add_le_cancel_left)
   1.256 -  also have "... = (x1 + u2) + (x2 + v1)" by (simp add: preal_add_ac)
   1.257 -  also have "... = (x1 + u2) + (u1 + y2)" by (simp add: prems)
   1.258 -  also have "... = (x1 + y2) + (u1 + u2)" by (simp add: preal_add_ac)
   1.259 -  finally show "x2 + y1 \<le> x1 + y2" by (simp add: preal_add_le_cancel_right)
   1.260 -qed  
   1.261 -
   1.262 -lemma real_le_anti_sym: "[| z \<le> w; w \<le> z |] ==> z = (w::real)"
   1.263 -apply (simp add: real_le_def, clarify) 
   1.264 -apply (rule real_eq_iff [THEN iffD2], assumption+)
   1.265 -apply (drule mem_REAL_imp_eq [OF Rep_REAL], assumption)+
   1.266 -apply (blast intro: real_le_anti_sym_lemma) 
   1.267 +apply (rule eq_Abs_REAL [of i])
   1.268 +apply (rule eq_Abs_REAL [of j])
   1.269 +apply (rule eq_Abs_REAL [of k])
   1.270 +apply (simp add: real_le) 
   1.271 +apply (blast intro: real_trans_lemma) 
   1.272  done
   1.273  
   1.274  (* Axiom 'order_less_le' of class 'order': *)
   1.275 @@ -488,124 +459,50 @@
   1.276   (assumption |
   1.277    rule real_le_refl real_le_trans real_le_anti_sym real_less_le)+
   1.278  
   1.279 -text{*Simplifies a strange formula that occurs quantified.*}
   1.280 -lemma preal_strange_le_eq: "(x1 + x2 \<le> x2 + y1) = (x1 \<le> (y1::preal))"
   1.281 -by (simp add: preal_add_commute [of x1] preal_add_le_cancel_left) 
   1.282 -
   1.283 -text{*This is the nicest way to prove linearity*}
   1.284 -lemma real_le_linear_0: "(z::real) \<le> 0 | 0 \<le> z"
   1.285 -apply (rule_tac z = z in eq_Abs_REAL)
   1.286 -apply (auto simp add: real_le_def real_zero_def preal_add_ac 
   1.287 -                      preal_cancels preal_strange_le_eq)
   1.288 -apply (cut_tac x=x and y=y in linorder_linear, auto) 
   1.289 -done
   1.290 -
   1.291 -lemma real_minus_zero_le_iff: "(0 \<le> -R) = (R \<le> (0::real))"
   1.292 -apply (rule_tac z = R in eq_Abs_REAL)
   1.293 -apply (force simp add: real_le_def real_zero_def real_minus preal_add_ac 
   1.294 -                       preal_cancels preal_strange_le_eq)
   1.295 +(* Axiom 'linorder_linear' of class 'linorder': *)
   1.296 +lemma real_le_linear: "(z::real) \<le> w | w \<le> z"
   1.297 +apply (rule eq_Abs_REAL [of z])
   1.298 +apply (rule eq_Abs_REAL [of w]) 
   1.299 +apply (auto simp add: real_le real_zero_def preal_add_ac preal_cancels)
   1.300 +apply (cut_tac x="x+ya" and y="xa+y" in linorder_linear) 
   1.301 +apply (auto ); 
   1.302  done
   1.303  
   1.304 -lemma real_le_imp_diff_le_0: "x \<le> y ==> x-y \<le> (0::real)"
   1.305 -apply (rule_tac z = x in eq_Abs_REAL)
   1.306 -apply (rule_tac z = y in eq_Abs_REAL)
   1.307 -apply (auto simp add: real_le_def real_zero_def real_diff_def real_minus 
   1.308 -    real_add preal_add_ac preal_cancels preal_strange_le_eq)
   1.309 -apply (rule exI)+
   1.310 -apply (rule conjI, assumption)
   1.311 -apply (subgoal_tac " x + (x2 + y1 + ya) = (x + y1) + (x2 + ya)")
   1.312 - prefer 2 apply (simp (no_asm) only: preal_add_ac) 
   1.313 -apply (subgoal_tac "x1 + y2 + (xa + y) = (x1 + y) + (xa + y2)")
   1.314 - prefer 2 apply (simp (no_asm) only: preal_add_ac) 
   1.315 -apply simp 
   1.316 -done
   1.317 -
   1.318 -lemma real_diff_le_0_imp_le: "x-y \<le> (0::real) ==> x \<le> y"
   1.319 -apply (rule_tac z = x in eq_Abs_REAL)
   1.320 -apply (rule_tac z = y in eq_Abs_REAL)
   1.321 -apply (auto simp add: real_le_def real_zero_def real_diff_def real_minus 
   1.322 -    real_add preal_add_ac preal_cancels preal_strange_le_eq)
   1.323 -apply (rule exI)+
   1.324 -apply (rule conjI, rule_tac [2] conjI)
   1.325 - apply (rule_tac [2] refl)+
   1.326 -apply (subgoal_tac "(x + ya) + (x1 + y1) \<le> (xa + y) + (x1 + y1)") 
   1.327 -apply (simp add: preal_cancels)
   1.328 -apply (subgoal_tac "x1 + (x + (y1 + ya)) \<le> y1 + (x1 + (xa + y))")
   1.329 - apply (simp add: preal_add_ac) 
   1.330 -apply (simp add: preal_cancels)
   1.331 -done
   1.332 -
   1.333 -lemma real_le_eq_diff: "(x \<le> y) = (x-y \<le> (0::real))"
   1.334 -by (blast intro!: real_diff_le_0_imp_le real_le_imp_diff_le_0)
   1.335 -
   1.336 -
   1.337 -(* Axiom 'linorder_linear' of class 'linorder': *)
   1.338 -lemma real_le_linear: "(z::real) \<le> w | w \<le> z"
   1.339 -apply (insert real_le_linear_0 [of "z-w"])
   1.340 -apply (auto simp add: real_le_eq_diff [of w] real_le_eq_diff [of z] 
   1.341 -                      real_minus_zero_le_iff [symmetric])
   1.342 -done
   1.343  
   1.344  instance real :: linorder
   1.345    by (intro_classes, rule real_le_linear)
   1.346  
   1.347  
   1.348 +lemma real_le_eq_diff: "(x \<le> y) = (x-y \<le> (0::real))"
   1.349 +apply (rule eq_Abs_REAL [of x])
   1.350 +apply (rule eq_Abs_REAL [of y]) 
   1.351 +apply (auto simp add: real_le real_zero_def real_diff_def real_add real_minus
   1.352 +                      preal_add_ac)
   1.353 +apply (simp_all add: preal_add_assoc [symmetric] preal_cancels)
   1.354 +done 
   1.355 +
   1.356  lemma real_add_left_mono: "x \<le> y ==> z + x \<le> z + (y::real)"
   1.357  apply (auto simp add: real_le_eq_diff [of x] real_le_eq_diff [of "z+x"])
   1.358  apply (subgoal_tac "z + x - (z + y) = (z + -z) + (x - y)")
   1.359   prefer 2 apply (simp add: diff_minus add_ac, simp) 
   1.360  done
   1.361  
   1.362 -
   1.363 -lemma real_minus_zero_le_iff2: "(-R \<le> 0) = (0 \<le> (R::real))"
   1.364 -apply (rule_tac z = R in eq_Abs_REAL)
   1.365 -apply (force simp add: real_le_def real_zero_def real_minus preal_add_ac 
   1.366 -                       preal_cancels preal_strange_le_eq)
   1.367 -done
   1.368 -
   1.369 -lemma real_minus_zero_less_iff: "(0 < -R) = (R < (0::real))"
   1.370 -by (simp add: linorder_not_le [symmetric] real_minus_zero_le_iff2) 
   1.371 -
   1.372 -lemma real_minus_zero_less_iff2: "(-R < 0) = ((0::real) < R)"
   1.373 -by (simp add: linorder_not_le [symmetric] real_minus_zero_le_iff) 
   1.374 -
   1.375  lemma real_sum_gt_zero_less: "(0 < S + (-W::real)) ==> (W < S)"
   1.376  by (simp add: linorder_not_le [symmetric] real_le_eq_diff [of S] diff_minus)
   1.377  
   1.378 -text{*Used a few times in Lim and Transcendental*}
   1.379  lemma real_less_sum_gt_zero: "(W < S) ==> (0 < S + (-W::real))"
   1.380  by (simp add: linorder_not_le [symmetric] real_le_eq_diff [of S] diff_minus)
   1.381  
   1.382 -text{*Handles other strange cases that arise in these proofs.*}
   1.383 -lemma forall_imp_less: "\<forall>u v. u \<le> v \<longrightarrow> x + v \<noteq> u + (y::preal) ==> y < x";
   1.384 -apply (drule_tac x=x in spec) 
   1.385 -apply (drule_tac x=y in spec) 
   1.386 -apply (simp add: preal_add_commute linorder_not_le) 
   1.387 -done
   1.388 -
   1.389 -text{*The arithmetic decision procedure is not set up for type preal.*}
   1.390 -lemma preal_eq_le_imp_le:
   1.391 -  assumes eq: "a+b = c+d" and le: "c \<le> a"
   1.392 -  shows "b \<le> (d::preal)"
   1.393 -proof -
   1.394 -  have "c+d \<le> a+d" by (simp add: prems preal_cancels)
   1.395 -  hence "a+b \<le> a+d" by (simp add: prems)
   1.396 -  thus "b \<le> d" by (simp add: preal_cancels)
   1.397 -qed
   1.398 -
   1.399  lemma real_mult_order: "[| 0 < x; 0 < y |] ==> (0::real) < x * y"
   1.400 -apply (simp add: linorder_not_le [symmetric])
   1.401 +apply (rule eq_Abs_REAL [of x])
   1.402 +apply (rule eq_Abs_REAL [of y])
   1.403 +apply (simp add: linorder_not_le [where 'a = real, symmetric] 
   1.404 +                 linorder_not_le [where 'a = preal] 
   1.405 +                  real_zero_def real_le real_mult)
   1.406    --{*Reduce to the (simpler) @{text "\<le>"} relation *}
   1.407 -apply (rule_tac z = x in eq_Abs_REAL)
   1.408 -apply (rule_tac z = y in eq_Abs_REAL)
   1.409 -apply (auto simp add: real_zero_def real_le_def real_mult preal_add_ac 
   1.410 -                      preal_cancels preal_strange_le_eq)
   1.411 -apply (drule preal_eq_le_imp_le, assumption)
   1.412 -apply (auto  dest!: forall_imp_less less_add_left_Ex 
   1.413 +apply (auto  dest!: less_add_left_Ex 
   1.414       simp add: preal_add_ac preal_mult_ac 
   1.415 -         preal_add_mult_distrib preal_add_mult_distrib2)
   1.416 -apply (insert preal_self_less_add_right)
   1.417 -apply (simp add: linorder_not_le [symmetric])
   1.418 +          preal_add_mult_distrib2 preal_cancels preal_self_less_add_right)
   1.419  done
   1.420  
   1.421  lemma real_mult_less_mono2: "[| (0::real) < z; x < y |] ==> z * x < z * y"
   1.422 @@ -617,13 +514,11 @@
   1.423  
   1.424  text{*lemma for proving @{term "0<(1::real)"}*}
   1.425  lemma real_zero_le_one: "0 \<le> (1::real)"
   1.426 -apply (auto simp add: real_zero_def real_one_def real_le_def preal_add_ac 
   1.427 -                      preal_cancels)
   1.428 -apply (rule_tac x="preal_of_rat 1 + preal_of_rat 1" in exI) 
   1.429 -apply (rule_tac x="preal_of_rat 1" in exI) 
   1.430 -apply (auto simp add: preal_add_ac preal_self_less_add_left order_less_imp_le)
   1.431 +apply (simp add: real_zero_def real_one_def real_le 
   1.432 +                 preal_self_less_add_left order_less_imp_le)
   1.433  done
   1.434  
   1.435 +
   1.436  subsection{*The Reals Form an Ordered Field*}
   1.437  
   1.438  instance real :: ordered_field
   1.439 @@ -658,7 +553,7 @@
   1.440  lemma real_of_preal_trichotomy:
   1.441        "\<exists>m. (x::real) = real_of_preal m | x = 0 | x = -(real_of_preal m)"
   1.442  apply (unfold real_of_preal_def real_zero_def)
   1.443 -apply (rule_tac z = x in eq_Abs_REAL)
   1.444 +apply (rule eq_Abs_REAL [of x])
   1.445  apply (auto simp add: real_minus preal_add_ac)
   1.446  apply (cut_tac x = x and y = y in linorder_less_linear)
   1.447  apply (auto dest!: less_add_left_Ex simp add: preal_add_assoc [symmetric])
   1.448 @@ -824,126 +719,43 @@
   1.449  
   1.450  subsection{*Embedding the Integers into the Reals*}
   1.451  
   1.452 -lemma real_of_int_congruent: 
   1.453 -  "congruent intrel (%p. (%(i,j). realrel ``  
   1.454 -   {(preal_of_rat (rat (int(Suc i))), preal_of_rat (rat (int(Suc j))))}) p)"
   1.455 -apply (simp add: congruent_def add_ac del: int_Suc, clarify)
   1.456 -(*OPTION raised if only is changed to add?????????*)  
   1.457 -apply (simp only: add_Suc_right zero_less_rat_of_int_iff zadd_int
   1.458 -          preal_of_rat_add [symmetric] rat_of_int_add_distrib [symmetric], simp) 
   1.459 -done
   1.460 -
   1.461 -lemma real_of_int: 
   1.462 -   "real (Abs_Integ (intrel `` {(i, j)})) =  
   1.463 -      Abs_REAL(realrel ``  
   1.464 -        {(preal_of_rat (rat (int(Suc i))),  
   1.465 -          preal_of_rat (rat (int(Suc j))))})"
   1.466 -apply (unfold real_of_int_def)
   1.467 -apply (rule_tac f = Abs_REAL in arg_cong)
   1.468 -apply (simp del: int_Suc
   1.469 -            add: realrel_in_real [THEN Abs_REAL_inverse] 
   1.470 -             UN_equiv_class [OF equiv_intrel real_of_int_congruent])
   1.471 -done
   1.472 -
   1.473 -lemma inj_real_of_int: "inj(real :: int => real)"
   1.474 -apply (rule inj_onI)
   1.475 -apply (rule_tac z = x in eq_Abs_Integ)
   1.476 -apply (rule_tac z = y in eq_Abs_Integ, clarify) 
   1.477 -apply (simp del: int_Suc 
   1.478 -            add: real_of_int zadd_int preal_of_rat_eq_iff
   1.479 -               preal_of_rat_add [symmetric] rat_of_int_add_distrib [symmetric])
   1.480 -done
   1.481 -
   1.482 -lemma real_of_int_int_zero: "real (int 0) = 0"  
   1.483 -by (simp add: int_def real_zero_def real_of_int preal_add_commute)
   1.484 +defs (overloaded)
   1.485 +  real_of_nat_def: "real z == of_nat z"
   1.486 +  real_of_int_def: "real z == of_int z"
   1.487  
   1.488  lemma real_of_int_zero [simp]: "real (0::int) = 0"  
   1.489 -by (insert real_of_int_int_zero, simp)
   1.490 +by (simp add: real_of_int_def) 
   1.491  
   1.492  lemma real_of_one [simp]: "real (1::int) = (1::real)"
   1.493 -apply (subst int_1 [symmetric])
   1.494 -apply (simp add: int_def real_one_def)
   1.495 -apply (simp add: real_of_int preal_of_rat_add [symmetric])  
   1.496 -done
   1.497 +by (simp add: real_of_int_def) 
   1.498  
   1.499  lemma real_of_int_add: "real (x::int) + real y = real (x + y)"
   1.500 -apply (rule_tac z = x in eq_Abs_Integ)
   1.501 -apply (rule_tac z = y in eq_Abs_Integ, clarify) 
   1.502 -apply (simp del: int_Suc
   1.503 -            add: pos_add_strict real_of_int real_add zadd
   1.504 -                 preal_of_rat_add [symmetric], simp) 
   1.505 -done
   1.506 +by (simp add: real_of_int_def) 
   1.507  declare real_of_int_add [symmetric, simp]
   1.508  
   1.509  lemma real_of_int_minus: "-real (x::int) = real (-x)"
   1.510 -apply (rule_tac z = x in eq_Abs_Integ)
   1.511 -apply (auto simp add: real_of_int real_minus zminus)
   1.512 -done
   1.513 +by (simp add: real_of_int_def) 
   1.514  declare real_of_int_minus [symmetric, simp]
   1.515  
   1.516  lemma real_of_int_diff: "real (x::int) - real y = real (x - y)"
   1.517 -by (simp only: zdiff_def real_diff_def real_of_int_add real_of_int_minus)
   1.518 +by (simp add: real_of_int_def) 
   1.519  declare real_of_int_diff [symmetric, simp]
   1.520  
   1.521  lemma real_of_int_mult: "real (x::int) * real y = real (x * y)"
   1.522 -apply (rule_tac z = x in eq_Abs_Integ)
   1.523 -apply (rule_tac z = y in eq_Abs_Integ)
   1.524 -apply (rename_tac a b c d) 
   1.525 -apply (simp del: int_Suc
   1.526 -            add: pos_add_strict mult_pos real_of_int real_mult zmult
   1.527 -                 preal_of_rat_add [symmetric] preal_of_rat_mult [symmetric])
   1.528 -apply (rule_tac f=preal_of_rat in arg_cong) 
   1.529 -apply (simp only: int_Suc right_distrib add_ac mult_ac zadd_int zmult_int
   1.530 -        rat_of_int_add_distrib [symmetric] rat_of_int_mult_distrib [symmetric]
   1.531 -        rat_inject)
   1.532 -done
   1.533 +by (simp add: real_of_int_def) 
   1.534  declare real_of_int_mult [symmetric, simp]
   1.535  
   1.536 -lemma real_of_int_Suc: "real (int (Suc n)) = real (int n) + (1::real)"
   1.537 -by (simp only: real_of_one [symmetric] zadd_int add_ac int_Suc real_of_int_add)
   1.538 -
   1.539  lemma real_of_int_zero_cancel [simp]: "(real x = 0) = (x = (0::int))"
   1.540 -by (auto intro: inj_real_of_int [THEN injD])
   1.541 -
   1.542 -lemma zero_le_real_of_int: "0 \<le> real y ==> 0 \<le> (y::int)"
   1.543 -apply (rule_tac z = y in eq_Abs_Integ)
   1.544 -apply (simp add: real_le_def, clarify)  
   1.545 -apply (rename_tac a b c d) 
   1.546 -apply (simp del: int_Suc zdiff_def [symmetric]
   1.547 -            add: real_zero_def real_of_int zle_def zless_def zdiff_def zadd
   1.548 -                 zminus neg_def preal_add_ac preal_cancels)
   1.549 -apply (drule sym, drule preal_eq_le_imp_le, assumption) 
   1.550 -apply (simp del: int_Suc add: preal_of_rat_le_iff)
   1.551 -done
   1.552 -
   1.553 -lemma real_of_int_le_cancel:
   1.554 -  assumes le: "real (x::int) \<le> real y"
   1.555 -  shows "x \<le> y"
   1.556 -proof -
   1.557 -  have "real x - real x \<le> real y - real x" using le
   1.558 -    by (simp only: diff_minus add_le_cancel_right) 
   1.559 -  hence "0 \<le> real y - real x" by simp
   1.560 -  hence "0 \<le> y - x" by (simp only: real_of_int_diff zero_le_real_of_int) 
   1.561 -  hence "0 + x \<le> (y - x) + x" by (simp only: add_le_cancel_right) 
   1.562 -  thus  "x \<le> y" by simp 
   1.563 -qed
   1.564 +by (simp add: real_of_int_def) 
   1.565  
   1.566  lemma real_of_int_inject [iff]: "(real (x::int) = real y) = (x = y)"
   1.567 -by (blast dest!: inj_real_of_int [THEN injD])
   1.568 -
   1.569 -lemma real_of_int_less_cancel: "real (x::int) < real y ==> x < y"
   1.570 -by (auto simp add: order_less_le real_of_int_le_cancel)
   1.571 -
   1.572 -lemma real_of_int_less_mono: "x < y ==> (real (x::int) < real y)"
   1.573 -apply (simp add: linorder_not_le [symmetric])
   1.574 -apply (auto dest!: real_of_int_less_cancel simp add: order_le_less)
   1.575 -done
   1.576 +by (simp add: real_of_int_def) 
   1.577  
   1.578  lemma real_of_int_less_iff [iff]: "(real (x::int) < real y) = (x < y)"
   1.579 -by (blast dest: real_of_int_less_cancel intro: real_of_int_less_mono)
   1.580 +by (simp add: real_of_int_def) 
   1.581  
   1.582  lemma real_of_int_le_iff [simp]: "(real (x::int) \<le> real y) = (x \<le> y)"
   1.583 -by (simp add: linorder_not_less [symmetric])
   1.584 +by (simp add: real_of_int_def) 
   1.585  
   1.586  
   1.587  subsection{*Embedding the Naturals into the Reals*}
   1.588 @@ -955,73 +767,64 @@
   1.589  by (simp add: real_of_nat_def)
   1.590  
   1.591  lemma real_of_nat_add [simp]: "real (m + n) = real (m::nat) + real n"
   1.592 -by (simp add: real_of_nat_def add_ac)
   1.593 +by (simp add: real_of_nat_def)
   1.594  
   1.595  (*Not for addsimps: often the LHS is used to represent a positive natural*)
   1.596  lemma real_of_nat_Suc: "real (Suc n) = real n + (1::real)"
   1.597 -by (simp add: real_of_nat_def add_ac)
   1.598 +by (simp add: real_of_nat_def)
   1.599  
   1.600  lemma real_of_nat_less_iff [iff]: 
   1.601       "(real (n::nat) < real m) = (n < m)"
   1.602  by (simp add: real_of_nat_def)
   1.603  
   1.604  lemma real_of_nat_le_iff [iff]: "(real (n::nat) \<le> real m) = (n \<le> m)"
   1.605 -by (simp add: linorder_not_less [symmetric])
   1.606 -
   1.607 -lemma inj_real_of_nat: "inj (real :: nat => real)"
   1.608 -apply (rule inj_onI)
   1.609 -apply (simp add: real_of_nat_def)
   1.610 -done
   1.611 +by (simp add: real_of_nat_def)
   1.612  
   1.613  lemma real_of_nat_ge_zero [iff]: "0 \<le> real (n::nat)"
   1.614 -apply (insert real_of_int_le_iff [of 0 "int n"]) 
   1.615 -apply (simp add: real_of_nat_def) 
   1.616 -done
   1.617 +by (simp add: real_of_nat_def zero_le_imp_of_nat)
   1.618  
   1.619  lemma real_of_nat_Suc_gt_zero: "0 < real (Suc n)"
   1.620 -by (insert real_of_nat_less_iff [of 0 "Suc n"], simp) 
   1.621 +by (simp add: real_of_nat_def del: of_nat_Suc)
   1.622  
   1.623  lemma real_of_nat_mult [simp]: "real (m * n) = real (m::nat) * real n"
   1.624 -by (simp add: real_of_nat_def zmult_int [symmetric]) 
   1.625 +by (simp add: real_of_nat_def)
   1.626  
   1.627  lemma real_of_nat_inject [iff]: "(real (n::nat) = real m) = (n = m)"
   1.628 -by (auto dest: inj_real_of_nat [THEN injD])
   1.629 +by (simp add: real_of_nat_def)
   1.630  
   1.631  lemma real_of_nat_zero_iff: "(real (n::nat) = 0) = (n = 0)"
   1.632 -  proof 
   1.633 -    assume "real n = 0"
   1.634 -    have "real n = real (0::nat)" by simp
   1.635 -    then show "n = 0" by (simp only: real_of_nat_inject)
   1.636 -  next
   1.637 -    show "n = 0 \<Longrightarrow> real n = 0" by simp
   1.638 -  qed
   1.639 +by (simp add: real_of_nat_def)
   1.640  
   1.641  lemma real_of_nat_diff: "n \<le> m ==> real (m - n) = real (m::nat) - real n"
   1.642 -by (simp add: real_of_nat_def zdiff_int [symmetric])
   1.643 -
   1.644 -lemma real_of_nat_neg_int [simp]: "neg z ==> real (nat z) = 0"
   1.645 -by (simp add: neg_nat)
   1.646 +by (simp add: add: real_of_nat_def) 
   1.647  
   1.648  lemma real_of_nat_gt_zero_cancel_iff [simp]: "(0 < real (n::nat)) = (0 < n)"
   1.649 -by (rule real_of_nat_less_iff [THEN subst], auto)
   1.650 +by (simp add: add: real_of_nat_def) 
   1.651  
   1.652  lemma real_of_nat_le_zero_cancel_iff [simp]: "(real (n::nat) \<le> 0) = (n = 0)"
   1.653 -apply (rule real_of_nat_zero [THEN subst])
   1.654 -apply (simp only: real_of_nat_le_iff, simp) 
   1.655 -done
   1.656 -
   1.657 +by (simp add: add: real_of_nat_def)
   1.658  
   1.659  lemma not_real_of_nat_less_zero [simp]: "~ real (n::nat) < 0"
   1.660 -by (simp add: linorder_not_less real_of_nat_ge_zero)
   1.661 +by (simp add: add: real_of_nat_def)
   1.662  
   1.663  lemma real_of_nat_ge_zero_cancel_iff [simp]: "(0 \<le> real (n::nat)) = (0 \<le> n)"
   1.664 -by (simp add: linorder_not_less)
   1.665 +by (simp add: add: real_of_nat_def)
   1.666  
   1.667  lemma real_of_int_real_of_nat: "real (int n) = real n"
   1.668 -by (simp add: real_of_nat_def)
   1.669 +by (simp add: real_of_nat_def real_of_int_def int_eq_of_nat)
   1.670 +
   1.671 +
   1.672  
   1.673 +text{*Still needed for binary arith*}
   1.674  lemma real_of_nat_real_of_int: "~neg z ==> real (nat z) = real z"
   1.675 -by (simp add: not_neg_eq_ge_0 real_of_nat_def)
   1.676 +proof (simp add: not_neg_eq_ge_0 real_of_nat_def real_of_int_def)
   1.677 +  assume "0 \<le> z"
   1.678 +  hence eq: "of_nat (nat z) = z" 
   1.679 +    by (simp add: nat_0_le int_eq_of_nat[symmetric]) 
   1.680 +  have "of_nat (nat z) = of_int (of_nat (nat z))" by simp
   1.681 +  also have "... = of_int z" by (simp add: eq)
   1.682 +  finally show "of_nat (nat z) = of_int z" .
   1.683 +qed
   1.684  
   1.685  ML
   1.686  {*
   1.687 @@ -1031,7 +834,6 @@
   1.688  val real_diff_def = thm "real_diff_def";
   1.689  val real_divide_def = thm "real_divide_def";
   1.690  
   1.691 -val preal_trans_lemma = thm"preal_trans_lemma";
   1.692  val realrel_iff = thm"realrel_iff";
   1.693  val realrel_refl = thm"realrel_refl";
   1.694  val equiv_realrel = thm"equiv_realrel";
   1.695 @@ -1099,20 +901,14 @@
   1.696  val real_inverse_unique = thm "real_inverse_unique";
   1.697  val real_inverse_gt_one = thm "real_inverse_gt_one";
   1.698  
   1.699 -val real_of_int = thm"real_of_int";
   1.700 -val inj_real_of_int = thm"inj_real_of_int";
   1.701  val real_of_int_zero = thm"real_of_int_zero";
   1.702  val real_of_one = thm"real_of_one";
   1.703  val real_of_int_add = thm"real_of_int_add";
   1.704  val real_of_int_minus = thm"real_of_int_minus";
   1.705  val real_of_int_diff = thm"real_of_int_diff";
   1.706  val real_of_int_mult = thm"real_of_int_mult";
   1.707 -val real_of_int_Suc = thm"real_of_int_Suc";
   1.708  val real_of_int_real_of_nat = thm"real_of_int_real_of_nat";
   1.709 -val real_of_nat_real_of_int = thm"real_of_nat_real_of_int";
   1.710 -val real_of_int_less_cancel = thm"real_of_int_less_cancel";
   1.711  val real_of_int_inject = thm"real_of_int_inject";
   1.712 -val real_of_int_less_mono = thm"real_of_int_less_mono";
   1.713  val real_of_int_less_iff = thm"real_of_int_less_iff";
   1.714  val real_of_int_le_iff = thm"real_of_int_le_iff";
   1.715  val real_of_nat_zero = thm "real_of_nat_zero";
   1.716 @@ -1121,14 +917,12 @@
   1.717  val real_of_nat_Suc = thm "real_of_nat_Suc";
   1.718  val real_of_nat_less_iff = thm "real_of_nat_less_iff";
   1.719  val real_of_nat_le_iff = thm "real_of_nat_le_iff";
   1.720 -val inj_real_of_nat = thm "inj_real_of_nat";
   1.721  val real_of_nat_ge_zero = thm "real_of_nat_ge_zero";
   1.722  val real_of_nat_Suc_gt_zero = thm "real_of_nat_Suc_gt_zero";
   1.723  val real_of_nat_mult = thm "real_of_nat_mult";
   1.724  val real_of_nat_inject = thm "real_of_nat_inject";
   1.725  val real_of_nat_diff = thm "real_of_nat_diff";
   1.726  val real_of_nat_zero_iff = thm "real_of_nat_zero_iff";
   1.727 -val real_of_nat_neg_int = thm "real_of_nat_neg_int";
   1.728  val real_of_nat_gt_zero_cancel_iff = thm "real_of_nat_gt_zero_cancel_iff";
   1.729  val real_of_nat_le_zero_cancel_iff = thm "real_of_nat_le_zero_cancel_iff";
   1.730  val not_real_of_nat_less_zero = thm "not_real_of_nat_less_zero";