src/HOL/Library/Float.thy
changeset 54230 b1d955791529
parent 53381 355a4cac5440
child 54489 03ff4d1e6784
equal deleted inserted replaced
54229:ca638d713ff8 54230:b1d955791529
    86   apply (rule_tac x="xb + xc" in exI)
    86   apply (rule_tac x="xb + xc" in exI)
    87   apply (simp add: powr_add)
    87   apply (simp add: powr_add)
    88   done
    88   done
    89 
    89 
    90 lemma minus_float[simp]: "x \<in> float \<Longrightarrow> y \<in> float \<Longrightarrow> x - y \<in> float"
    90 lemma minus_float[simp]: "x \<in> float \<Longrightarrow> y \<in> float \<Longrightarrow> x - y \<in> float"
    91   unfolding ab_diff_minus by (intro uminus_float plus_float)
    91   using plus_float [of x "- y"] by simp
    92 
    92 
    93 lemma abs_float[simp]: "x \<in> float \<Longrightarrow> abs x \<in> float"
    93 lemma abs_float[simp]: "x \<in> float \<Longrightarrow> abs x \<in> float"
    94   by (cases x rule: linorder_cases[of 0]) auto
    94   by (cases x rule: linorder_cases[of 0]) auto
    95 
    95 
    96 lemma sgn_of_float[simp]: "x \<in> float \<Longrightarrow> sgn x \<in> float"
    96 lemma sgn_of_float[simp]: "x \<in> float \<Longrightarrow> sgn x \<in> float"
   958   have "x * 2 powr real (rat_precision n (int x) (int y)) / y = (x / y) *
   958   have "x * 2 powr real (rat_precision n (int x) (int y)) / y = (x / y) *
   959      2 powr real (rat_precision n (int x) (int y))" by simp
   959      2 powr real (rat_precision n (int x) (int y))" by simp
   960   also have "... < (1 / 2) * 2 powr real (rat_precision n (int x) (int y))"
   960   also have "... < (1 / 2) * 2 powr real (rat_precision n (int x) (int y))"
   961     apply (rule mult_strict_right_mono) by (insert assms) auto
   961     apply (rule mult_strict_right_mono) by (insert assms) auto
   962   also have "\<dots> = 2 powr real (rat_precision n (int x) (int y) - 1)"
   962   also have "\<dots> = 2 powr real (rat_precision n (int x) (int y) - 1)"
   963     by (simp add: powr_add diff_def powr_neg_numeral)
   963     using powr_add [of 2 _ "- 1", simplified add_uminus_conv_diff] by (simp add: powr_neg_numeral)
   964   also have "\<dots> = 2 ^ nat (rat_precision n (int x) (int y) - 1)"
   964   also have "\<dots> = 2 ^ nat (rat_precision n (int x) (int y) - 1)"
   965     using rat_precision_pos[of x y n] assms by (simp add: powr_realpow[symmetric])
   965     using rat_precision_pos[of x y n] assms by (simp add: powr_realpow[symmetric])
   966   also have "\<dots> \<le> 2 ^ nat (rat_precision n (int x) (int y)) - 1"
   966   also have "\<dots> \<le> 2 ^ nat (rat_precision n (int x) (int y)) - 1"
   967     unfolding int_of_reals real_of_int_le_iff
   967     unfolding int_of_reals real_of_int_le_iff
   968     using rat_precision_pos[OF assms] by (rule power_aux)
   968     using rat_precision_pos[OF assms] by (rule power_aux)