293 proof - |
293 proof - |
294 from that have "(p * gcd r s) * (sgn (q * s) * s * gcd p q) = |
294 from that have "(p * gcd r s) * (sgn (q * s) * s * gcd p q) = |
295 (q * gcd r s) * (sgn (q * s) * r * gcd p q)" |
295 (q * gcd r s) * (sgn (q * s) * r * gcd p q)" |
296 by simp |
296 by simp |
297 with assms show ?thesis |
297 with assms show ?thesis |
298 by (auto simp add: ac_simps sgn_times sgn_0_0) |
298 by (auto simp add: ac_simps sgn_mult sgn_0_0) |
299 qed |
299 qed |
300 from assms show ?thesis |
300 from assms show ?thesis |
301 by (auto simp: normalize_def Let_def dvd_div_div_eq_mult mult.commute sgn_times |
301 by (auto simp: normalize_def Let_def dvd_div_div_eq_mult mult.commute sgn_mult |
302 split: if_splits intro: *) |
302 split: if_splits intro: *) |
303 qed |
303 qed |
304 |
304 |
305 lemma normalize_eq: "normalize (a, b) = (p, q) \<Longrightarrow> Fract p q = Fract a b" |
305 lemma normalize_eq: "normalize (a, b) = (p, q) \<Longrightarrow> Fract p q = Fract a b" |
306 by (auto simp: normalize_def Let_def Fract_coprime dvd_div_neg rat_number_collapse |
306 by (auto simp: normalize_def Let_def Fract_coprime dvd_div_neg rat_number_collapse |
649 (* not needed because x < (y::int) can be rewritten as x + 1 <= y: of_int_less_iff RS iffD2 *) |
649 (* not needed because x < (y::int) can be rewritten as x + 1 <= y: of_int_less_iff RS iffD2 *) |
650 #> Lin_Arith.add_simps [@{thm neg_less_iff_less}, |
650 #> Lin_Arith.add_simps [@{thm neg_less_iff_less}, |
651 @{thm True_implies_equals}, |
651 @{thm True_implies_equals}, |
652 @{thm distrib_left [where a = "numeral v" for v]}, |
652 @{thm distrib_left [where a = "numeral v" for v]}, |
653 @{thm distrib_left [where a = "- numeral v" for v]}, |
653 @{thm distrib_left [where a = "- numeral v" for v]}, |
654 @{thm divide_1}, @{thm divide_zero_left}, |
654 @{thm div_by_1}, @{thm div_0}, |
655 @{thm times_divide_eq_right}, @{thm times_divide_eq_left}, |
655 @{thm times_divide_eq_right}, @{thm times_divide_eq_left}, |
656 @{thm minus_divide_left} RS sym, @{thm minus_divide_right} RS sym, |
656 @{thm minus_divide_left} RS sym, @{thm minus_divide_right} RS sym, |
657 @{thm add_divide_distrib}, @{thm diff_divide_distrib}, |
657 @{thm add_divide_distrib}, @{thm diff_divide_distrib}, |
658 @{thm of_int_minus}, @{thm of_int_diff}, |
658 @{thm of_int_minus}, @{thm of_int_diff}, |
659 @{thm of_int_of_nat_eq}] |
659 @{thm of_int_of_nat_eq}] |