src/HOL/Hyperreal/IntFloor.ML
changeset 14387 e96d5c42c4b0
parent 14365 3d4df8c166ae
child 14390 55fe71faadda
equal deleted inserted replaced
14386:ad1ffcc90162 14387:e96d5c42c4b0
     1 (*  Title:       IntFloor.ML
     1 (*  Title:       IntFloor.ML
     2     Author:      Jacques D. Fleuriot
     2     Author:      Jacques D. Fleuriot
     3     Copyright:   2001,2002  University of Edinburgh
     3     Copyright:   2001,2002  University of Edinburgh
     4     Description: Floor and ceiling operations over reals
     4     Description: Floor and ceiling operations over reals
     5 *)
     5 *)
       
     6 
       
     7 val real_number_of = thm"real_number_of";
     6 
     8 
     7 Goal "((number_of n) < real (m::int)) = (number_of n < m)";
     9 Goal "((number_of n) < real (m::int)) = (number_of n < m)";
     8 by Auto_tac;
    10 by Auto_tac;
     9 by (rtac (real_of_int_less_iff RS iffD1) 1);
    11 by (rtac (real_of_int_less_iff RS iffD1) 1);
    10 by (dtac (real_of_int_less_iff RS iffD2) 2);
    12 by (dtac (real_of_int_less_iff RS iffD2) 2);
   185 Goal "[| real n <= x; x < real (Suc n) |] ==> nat(floor x) = n";
   187 Goal "[| real n <= x; x < real (Suc n) |] ==> nat(floor x) = n";
   186 by (dtac order_le_imp_less_or_eq 1);
   188 by (dtac order_le_imp_less_or_eq 1);
   187 by (auto_tac (claset() addIs [floor_eq3],simpset()));
   189 by (auto_tac (claset() addIs [floor_eq3],simpset()));
   188 qed "floor_eq4";
   190 qed "floor_eq4";
   189 
   191 
   190 Goalw [real_number_of_def] 
   192 Goal "floor(number_of n :: real) = (number_of n :: int)";
   191        "floor(number_of n :: real) = (number_of n :: int)";
   193 by (stac (real_number_of RS sym) 1);
   192 by (rtac floor_eq2 1);
   194 by (rtac floor_eq2 1);
   193 by (rtac (CLAIM "x < x + (1::real)") 2);
   195 by (rtac (CLAIM "x < x + (1::real)") 2);
   194 by (rtac real_le_refl 1);
   196 by (rtac real_le_refl 1);
   195 qed "floor_number_of_eq";
   197 qed "floor_number_of_eq";
   196 Addsimps [floor_number_of_eq];
   198 Addsimps [floor_number_of_eq];
   277 Goalw [ceiling_def] "[| real n - 1 < x; x <= real n  |] ==> ceiling x = n";
   279 Goalw [ceiling_def] "[| real n - 1 < x; x <= real n  |] ==> ceiling x = n";
   278 by (rtac (CLAIM "x = -(y::int) ==> - x = y") 1);
   280 by (rtac (CLAIM "x = -(y::int) ==> - x = y") 1);
   279 by (auto_tac (claset() addIs [floor_eq2],simpset()));
   281 by (auto_tac (claset() addIs [floor_eq2],simpset()));
   280 qed "ceiling_eq3";
   282 qed "ceiling_eq3";
   281 
   283 
   282 Goalw [ceiling_def,real_number_of_def] 
   284 Goalw [ceiling_def] 
   283   "ceiling (number_of n :: real) = (number_of n :: int)";
   285   "ceiling (number_of n :: real) = (number_of n :: int)";
       
   286 by (stac (real_number_of RS sym) 1);
   284 by (rtac (CLAIM "x = - y ==> - (x::int) = y") 1);
   287 by (rtac (CLAIM "x = - y ==> - (x::int) = y") 1);
   285 by (rtac (floor_minus_real_of_int RS ssubst) 1);
   288 by (rtac (floor_minus_real_of_int RS ssubst) 1);
   286 by Auto_tac;
   289 by Auto_tac;
   287 qed "ceiling_number_of_eq";
   290 qed "ceiling_number_of_eq";
   288 Addsimps [ceiling_number_of_eq];
   291 Addsimps [ceiling_number_of_eq];