src/HOL/Library/Fraction_Field.thy
 author Andreas Lochbihler Wed Feb 27 10:33:30 2013 +0100 (2013-02-27) changeset 51288 be7e9a675ec9 parent 49834 b27bbb021df1 child 53196 942a1b48bb31 permissions -rw-r--r--
add wellorder instance for Numeral_Type (suggested by Jesus Aransay)
1 (*  Title:      HOL/Library/Fraction_Field.thy
2     Author:     Amine Chaieb, University of Cambridge
3 *)
5 header{* A formalization of the fraction field of any integral domain;
6          generalization of theory Rat from int to any integral domain *}
8 theory Fraction_Field
9 imports Main
10 begin
12 subsection {* General fractions construction *}
14 subsubsection {* Construction of the type of fractions *}
16 definition fractrel :: "(('a::idom * 'a ) * ('a * 'a)) set" where
17   "fractrel = {(x, y). snd x \<noteq> 0 \<and> snd y \<noteq> 0 \<and> fst x * snd y = fst y * snd x}"
19 lemma fractrel_iff [simp]:
20   "(x, y) \<in> fractrel \<longleftrightarrow> snd x \<noteq> 0 \<and> snd y \<noteq> 0 \<and> fst x * snd y = fst y * snd x"
21   by (simp add: fractrel_def)
23 lemma refl_fractrel: "refl_on {x. snd x \<noteq> 0} fractrel"
24   by (auto simp add: refl_on_def fractrel_def)
26 lemma sym_fractrel: "sym fractrel"
27   by (simp add: fractrel_def sym_def)
29 lemma trans_fractrel: "trans fractrel"
30 proof (rule transI, unfold split_paired_all)
31   fix a b a' b' a'' b'' :: 'a
32   assume A: "((a, b), (a', b')) \<in> fractrel"
33   assume B: "((a', b'), (a'', b'')) \<in> fractrel"
34   have "b' * (a * b'') = b'' * (a * b')" by (simp add: mult_ac)
35   also from A have "a * b' = a' * b" by auto
36   also have "b'' * (a' * b) = b * (a' * b'')" by (simp add: mult_ac)
37   also from B have "a' * b'' = a'' * b'" by auto
38   also have "b * (a'' * b') = b' * (a'' * b)" by (simp add: mult_ac)
39   finally have "b' * (a * b'') = b' * (a'' * b)" .
40   moreover from B have "b' \<noteq> 0" by auto
41   ultimately have "a * b'' = a'' * b" by simp
42   with A B show "((a, b), (a'', b'')) \<in> fractrel" by auto
43 qed
45 lemma equiv_fractrel: "equiv {x. snd x \<noteq> 0} fractrel"
46   by (rule equivI [OF refl_fractrel sym_fractrel trans_fractrel])
48 lemmas UN_fractrel = UN_equiv_class [OF equiv_fractrel]
49 lemmas UN_fractrel2 = UN_equiv_class2 [OF equiv_fractrel equiv_fractrel]
51 lemma equiv_fractrel_iff [iff]:
52   assumes "snd x \<noteq> 0" and "snd y \<noteq> 0"
53   shows "fractrel `` {x} = fractrel `` {y} \<longleftrightarrow> (x, y) \<in> fractrel"
54   by (rule eq_equiv_class_iff, rule equiv_fractrel) (auto simp add: assms)
56 definition "fract = {(x::'a\<times>'a). snd x \<noteq> (0::'a::idom)} // fractrel"
58 typedef 'a fract = "fract :: ('a * 'a::idom) set set"
59   unfolding fract_def
60 proof
61   have "(0::'a, 1::'a) \<in> {x. snd x \<noteq> 0}" by simp
62   then show "fractrel `` {(0::'a, 1)} \<in> {x. snd x \<noteq> 0} // fractrel" by (rule quotientI)
63 qed
65 lemma fractrel_in_fract [simp]: "snd x \<noteq> 0 \<Longrightarrow> fractrel `` {x} \<in> fract"
66   by (simp add: fract_def quotientI)
68 declare Abs_fract_inject [simp] Abs_fract_inverse [simp]
71 subsubsection {* Representation and basic operations *}
73 definition Fract :: "'a::idom \<Rightarrow> 'a \<Rightarrow> 'a fract" where
74   "Fract a b = Abs_fract (fractrel `` {if b = 0 then (0, 1) else (a, b)})"
76 code_datatype Fract
78 lemma Fract_cases [case_names Fract, cases type: fract]:
79   assumes "\<And>a b. q = Fract a b \<Longrightarrow> b \<noteq> 0 \<Longrightarrow> C"
80   shows C
81   using assms by (cases q) (clarsimp simp add: Fract_def fract_def quotient_def)
83 lemma Fract_induct [case_names Fract, induct type: fract]:
84   assumes "\<And>a b. b \<noteq> 0 \<Longrightarrow> P (Fract a b)"
85   shows "P q"
86   using assms by (cases q) simp
88 lemma eq_fract:
89   shows "\<And>a b c d. b \<noteq> 0 \<Longrightarrow> d \<noteq> 0 \<Longrightarrow> Fract a b = Fract c d \<longleftrightarrow> a * d = c * b"
90   and "\<And>a. Fract a 0 = Fract 0 1"
91   and "\<And>a c. Fract 0 a = Fract 0 c"
92   by (simp_all add: Fract_def)
94 instantiation fract :: (idom) "{comm_ring_1, power}"
95 begin
97 definition Zero_fract_def [code_unfold]: "0 = Fract 0 1"
99 definition One_fract_def [code_unfold]: "1 = Fract 1 1"
102   "q + r = Abs_fract (\<Union>x \<in> Rep_fract q. \<Union>y \<in> Rep_fract r.
103     fractrel `` {(fst x * snd y + fst y * snd x, snd x * snd y)})"
105 lemma add_fract [simp]:
106   assumes "b \<noteq> (0::'a::idom)" and "d \<noteq> 0"
107   shows "Fract a b + Fract c d = Fract (a * d + c * b) (b * d)"
108 proof -
109   have "(\<lambda>x y. fractrel``{(fst x * snd y + fst y * snd x, snd x * snd y :: 'a)})
110     respects2 fractrel"
111   apply (rule equiv_fractrel [THEN congruent2_commuteI]) apply (auto simp add: algebra_simps)
112   unfolding mult_assoc[symmetric] .
113   with assms show ?thesis by (simp add: Fract_def add_fract_def UN_fractrel2)
114 qed
116 definition minus_fract_def:
117   "- q = Abs_fract (\<Union>x \<in> Rep_fract q. fractrel `` {(- fst x, snd x)})"
119 lemma minus_fract [simp, code]: "- Fract a b = Fract (- a) (b::'a::idom)"
120 proof -
121   have "(\<lambda>x. fractrel `` {(- fst x, snd x :: 'a)}) respects fractrel"
122     by (simp add: congruent_def split_paired_all)
123   then show ?thesis by (simp add: Fract_def minus_fract_def UN_fractrel)
124 qed
126 lemma minus_fract_cancel [simp]: "Fract (- a) (- b) = Fract a b"
127   by (cases "b = 0") (simp_all add: eq_fract)
129 definition diff_fract_def: "q - r = q + - (r::'a fract)"
131 lemma diff_fract [simp]:
132   assumes "b \<noteq> 0" and "d \<noteq> 0"
133   shows "Fract a b - Fract c d = Fract (a * d - c * b) (b * d)"
134   using assms by (simp add: diff_fract_def diff_minus)
136 definition mult_fract_def:
137   "q * r = Abs_fract (\<Union>x \<in> Rep_fract q. \<Union>y \<in> Rep_fract r.
138     fractrel``{(fst x * fst y, snd x * snd y)})"
140 lemma mult_fract [simp]: "Fract (a::'a::idom) b * Fract c d = Fract (a * c) (b * d)"
141 proof -
142   have "(\<lambda>x y. fractrel `` {(fst x * fst y, snd x * snd y :: 'a)}) respects2 fractrel"
143     apply (rule equiv_fractrel [THEN congruent2_commuteI]) apply (auto simp add: algebra_simps)
144     unfolding mult_assoc[symmetric] .
145   then show ?thesis by (simp add: Fract_def mult_fract_def UN_fractrel2)
146 qed
148 lemma mult_fract_cancel:
149   assumes "c \<noteq> (0::'a)"
150   shows "Fract (c * a) (c * b) = Fract a b"
151 proof -
152   from assms have "Fract c c = Fract 1 1" by (simp add: Fract_def)
153   then show ?thesis by (simp add: mult_fract [symmetric])
154 qed
156 instance
157 proof
158   fix q r s :: "'a fract" show "(q * r) * s = q * (r * s)"
159     by (cases q, cases r, cases s) (simp add: eq_fract algebra_simps)
160 next
161   fix q r :: "'a fract" show "q * r = r * q"
162     by (cases q, cases r) (simp add: eq_fract algebra_simps)
163 next
164   fix q :: "'a fract" show "1 * q = q"
165     by (cases q) (simp add: One_fract_def eq_fract)
166 next
167   fix q r s :: "'a fract" show "(q + r) + s = q + (r + s)"
168     by (cases q, cases r, cases s) (simp add: eq_fract algebra_simps)
169 next
170   fix q r :: "'a fract" show "q + r = r + q"
171     by (cases q, cases r) (simp add: eq_fract algebra_simps)
172 next
173   fix q :: "'a fract" show "0 + q = q"
174     by (cases q) (simp add: Zero_fract_def eq_fract)
175 next
176   fix q :: "'a fract" show "- q + q = 0"
177     by (cases q) (simp add: Zero_fract_def eq_fract)
178 next
179   fix q r :: "'a fract" show "q - r = q + - r"
180     by (cases q, cases r) (simp add: eq_fract)
181 next
182   fix q r s :: "'a fract" show "(q + r) * s = q * s + r * s"
183     by (cases q, cases r, cases s) (simp add: eq_fract algebra_simps)
184 next
185   show "(0::'a fract) \<noteq> 1" by (simp add: Zero_fract_def One_fract_def eq_fract)
186 qed
188 end
190 lemma of_nat_fract: "of_nat k = Fract (of_nat k) 1"
191   by (induct k) (simp_all add: Zero_fract_def One_fract_def)
193 lemma Fract_of_nat_eq: "Fract (of_nat k) 1 = of_nat k"
194   by (rule of_nat_fract [symmetric])
196 lemma fract_collapse [code_post]:
197   "Fract 0 k = 0"
198   "Fract 1 1 = 1"
199   "Fract k 0 = 0"
200   by (cases "k = 0")
201     (simp_all add: Zero_fract_def One_fract_def eq_fract Fract_def)
203 lemma fract_expand [code_unfold]:
204   "0 = Fract 0 1"
205   "1 = Fract 1 1"
206   by (simp_all add: fract_collapse)
208 lemma Fract_cases_nonzero [case_names Fract 0]:
209   assumes Fract: "\<And>a b. q = Fract a b \<Longrightarrow> b \<noteq> 0 \<Longrightarrow> a \<noteq> 0 \<Longrightarrow> C"
210   assumes 0: "q = 0 \<Longrightarrow> C"
211   shows C
212 proof (cases "q = 0")
213   case True then show C using 0 by auto
214 next
215   case False
216   then obtain a b where "q = Fract a b" and "b \<noteq> 0" by (cases q) auto
217   moreover with False have "0 \<noteq> Fract a b" by simp
218   with `b \<noteq> 0` have "a \<noteq> 0" by (simp add: Zero_fract_def eq_fract)
219   with Fract `q = Fract a b` `b \<noteq> 0` show C by auto
220 qed
224 subsubsection {* The field of rational numbers *}
226 context idom
227 begin
228 subclass ring_no_zero_divisors ..
229 thm mult_eq_0_iff
230 end
232 instantiation fract :: (idom) field_inverse_zero
233 begin
235 definition inverse_fract_def:
236   "inverse q = Abs_fract (\<Union>x \<in> Rep_fract q.
237      fractrel `` {if fst x = 0 then (0, 1) else (snd x, fst x)})"
240 lemma inverse_fract [simp]: "inverse (Fract a b) = Fract (b::'a::idom) a"
241 proof -
242   have stupid: "\<And>x. (0::'a) = x \<longleftrightarrow> x = 0" by auto
243   have "(\<lambda>x. fractrel `` {if fst x = 0 then (0, 1) else (snd x, fst x :: 'a)}) respects fractrel"
244     by (auto simp add: congruent_def stupid algebra_simps)
245   then show ?thesis by (simp add: Fract_def inverse_fract_def UN_fractrel)
246 qed
248 definition divide_fract_def: "q / r = q * inverse (r:: 'a fract)"
250 lemma divide_fract [simp]: "Fract a b / Fract c d = Fract (a * d) (b * c)"
251   by (simp add: divide_fract_def)
253 instance
254 proof
255   fix q :: "'a fract"
256   assume "q \<noteq> 0"
257   then show "inverse q * q = 1"
258     by (cases q rule: Fract_cases_nonzero)
259       (simp_all add: fract_expand eq_fract mult_commute)
260 next
261   fix q r :: "'a fract"
262   show "q / r = q * inverse r" by (simp add: divide_fract_def)
263 next
264   show "inverse 0 = (0:: 'a fract)"
265     by (simp add: fract_expand) (simp add: fract_collapse)
266 qed
268 end
271 subsubsection {* The ordered field of fractions over an ordered idom *}
273 lemma le_congruent2:
274   "(\<lambda>x y::'a \<times> 'a::linordered_idom.
275     {(fst x * snd y)*(snd x * snd y) \<le> (fst y * snd x)*(snd x * snd y)})
276     respects2 fractrel"
277 proof (clarsimp simp add: congruent2_def)
278   fix a b a' b' c d c' d' :: 'a
279   assume neq: "b \<noteq> 0"  "b' \<noteq> 0"  "d \<noteq> 0"  "d' \<noteq> 0"
280   assume eq1: "a * b' = a' * b"
281   assume eq2: "c * d' = c' * d"
283   let ?le = "\<lambda>a b c d. ((a * d) * (b * d) \<le> (c * b) * (b * d))"
284   {
285     fix a b c d x :: 'a assume x: "x \<noteq> 0"
286     have "?le a b c d = ?le (a * x) (b * x) c d"
287     proof -
288       from x have "0 < x * x" by (auto simp add: zero_less_mult_iff)
289       then have "?le a b c d =
290           ((a * d) * (b * d) * (x * x) \<le> (c * b) * (b * d) * (x * x))"
291         by (simp add: mult_le_cancel_right)
292       also have "... = ?le (a * x) (b * x) c d"
293         by (simp add: mult_ac)
294       finally show ?thesis .
295     qed
296   } note le_factor = this
298   let ?D = "b * d" and ?D' = "b' * d'"
299   from neq have D: "?D \<noteq> 0" by simp
300   from neq have "?D' \<noteq> 0" by simp
301   then have "?le a b c d = ?le (a * ?D') (b * ?D') c d"
302     by (rule le_factor)
303   also have "... = ((a * b') * ?D * ?D' * d * d' \<le> (c * d') * ?D * ?D' * b * b')"
304     by (simp add: mult_ac)
305   also have "... = ((a' * b) * ?D * ?D' * d * d' \<le> (c' * d) * ?D * ?D' * b * b')"
306     by (simp only: eq1 eq2)
307   also have "... = ?le (a' * ?D) (b' * ?D) c' d'"
308     by (simp add: mult_ac)
309   also from D have "... = ?le a' b' c' d'"
310     by (rule le_factor [symmetric])
311   finally show "?le a b c d = ?le a' b' c' d'" .
312 qed
314 instantiation fract :: (linordered_idom) linorder
315 begin
317 definition le_fract_def:
318    "q \<le> r \<longleftrightarrow> the_elem (\<Union>x \<in> Rep_fract q. \<Union>y \<in> Rep_fract r.
319       {(fst x * snd y)*(snd x * snd y) \<le> (fst y * snd x)*(snd x * snd y)})"
321 definition less_fract_def: "z < (w::'a fract) \<longleftrightarrow> z \<le> w \<and> \<not> w \<le> z"
323 lemma le_fract [simp]:
324   assumes "b \<noteq> 0" and "d \<noteq> 0"
325   shows "Fract a b \<le> Fract c d \<longleftrightarrow> (a * d) * (b * d) \<le> (c * b) * (b * d)"
326 by (simp add: Fract_def le_fract_def le_congruent2 UN_fractrel2 assms)
328 lemma less_fract [simp]:
329   assumes "b \<noteq> 0" and "d \<noteq> 0"
330   shows "Fract a b < Fract c d \<longleftrightarrow> (a * d) * (b * d) < (c * b) * (b * d)"
331 by (simp add: less_fract_def less_le_not_le mult_ac assms)
333 instance
334 proof
335   fix q r s :: "'a fract"
336   assume "q \<le> r" and "r \<le> s" thus "q \<le> s"
337   proof (induct q, induct r, induct s)
338     fix a b c d e f :: 'a
339     assume neq: "b \<noteq> 0"  "d \<noteq> 0"  "f \<noteq> 0"
340     assume 1: "Fract a b \<le> Fract c d" and 2: "Fract c d \<le> Fract e f"
341     show "Fract a b \<le> Fract e f"
342     proof -
343       from neq obtain bb: "0 < b * b" and dd: "0 < d * d" and ff: "0 < f * f"
344         by (auto simp add: zero_less_mult_iff linorder_neq_iff)
345       have "(a * d) * (b * d) * (f * f) \<le> (c * b) * (b * d) * (f * f)"
346       proof -
347         from neq 1 have "(a * d) * (b * d) \<le> (c * b) * (b * d)"
348           by simp
349         with ff show ?thesis by (simp add: mult_le_cancel_right)
350       qed
351       also have "... = (c * f) * (d * f) * (b * b)"
352         by (simp only: mult_ac)
353       also have "... \<le> (e * d) * (d * f) * (b * b)"
354       proof -
355         from neq 2 have "(c * f) * (d * f) \<le> (e * d) * (d * f)"
356           by simp
357         with bb show ?thesis by (simp add: mult_le_cancel_right)
358       qed
359       finally have "(a * f) * (b * f) * (d * d) \<le> e * b * (b * f) * (d * d)"
360         by (simp only: mult_ac)
361       with dd have "(a * f) * (b * f) \<le> (e * b) * (b * f)"
362         by (simp add: mult_le_cancel_right)
363       with neq show ?thesis by simp
364     qed
365   qed
366 next
367   fix q r :: "'a fract"
368   assume "q \<le> r" and "r \<le> q" thus "q = r"
369   proof (induct q, induct r)
370     fix a b c d :: 'a
371     assume neq: "b \<noteq> 0"  "d \<noteq> 0"
372     assume 1: "Fract a b \<le> Fract c d" and 2: "Fract c d \<le> Fract a b"
373     show "Fract a b = Fract c d"
374     proof -
375       from neq 1 have "(a * d) * (b * d) \<le> (c * b) * (b * d)"
376         by simp
377       also have "... \<le> (a * d) * (b * d)"
378       proof -
379         from neq 2 have "(c * b) * (d * b) \<le> (a * d) * (d * b)"
380           by simp
381         thus ?thesis by (simp only: mult_ac)
382       qed
383       finally have "(a * d) * (b * d) = (c * b) * (b * d)" .
384       moreover from neq have "b * d \<noteq> 0" by simp
385       ultimately have "a * d = c * b" by simp
386       with neq show ?thesis by (simp add: eq_fract)
387     qed
388   qed
389 next
390   fix q r :: "'a fract"
391   show "q \<le> q"
392     by (induct q) simp
393   show "(q < r) = (q \<le> r \<and> \<not> r \<le> q)"
394     by (simp only: less_fract_def)
395   show "q \<le> r \<or> r \<le> q"
396     by (induct q, induct r)
397        (simp add: mult_commute, rule linorder_linear)
398 qed
400 end
402 instantiation fract :: (linordered_idom) "{distrib_lattice, abs_if, sgn_if}"
403 begin
405 definition abs_fract_def: "\<bar>q\<bar> = (if q < 0 then -q else (q::'a fract))"
407 definition sgn_fract_def:
408   "sgn (q::'a fract) = (if q=0 then 0 else if 0<q then 1 else - 1)"
410 theorem abs_fract [simp]: "\<bar>Fract a b\<bar> = Fract \<bar>a\<bar> \<bar>b\<bar>"
411   by (auto simp add: abs_fract_def Zero_fract_def le_less
412       eq_fract zero_less_mult_iff mult_less_0_iff split: abs_split)
414 definition inf_fract_def:
415   "(inf \<Colon> 'a fract \<Rightarrow> 'a fract \<Rightarrow> 'a fract) = min"
417 definition sup_fract_def:
418   "(sup \<Colon> 'a fract \<Rightarrow> 'a fract \<Rightarrow> 'a fract) = max"
420 instance
421   by intro_classes
422     (auto simp add: abs_fract_def sgn_fract_def
423       min_max.sup_inf_distrib1 inf_fract_def sup_fract_def)
425 end
427 instance fract :: (linordered_idom) linordered_field_inverse_zero
428 proof
429   fix q r s :: "'a fract"
430   show "q \<le> r ==> s + q \<le> s + r"
431   proof (induct q, induct r, induct s)
432     fix a b c d e f :: 'a
433     assume neq: "b \<noteq> 0"  "d \<noteq> 0"  "f \<noteq> 0"
434     assume le: "Fract a b \<le> Fract c d"
435     show "Fract e f + Fract a b \<le> Fract e f + Fract c d"
436     proof -
437       let ?F = "f * f" from neq have F: "0 < ?F"
438         by (auto simp add: zero_less_mult_iff)
439       from neq le have "(a * d) * (b * d) \<le> (c * b) * (b * d)"
440         by simp
441       with F have "(a * d) * (b * d) * ?F * ?F \<le> (c * b) * (b * d) * ?F * ?F"
442         by (simp add: mult_le_cancel_right)
443       with neq show ?thesis by (simp add: field_simps)
444     qed
445   qed
446   show "q < r ==> 0 < s ==> s * q < s * r"
447   proof (induct q, induct r, induct s)
448     fix a b c d e f :: 'a
449     assume neq: "b \<noteq> 0"  "d \<noteq> 0"  "f \<noteq> 0"
450     assume le: "Fract a b < Fract c d"
451     assume gt: "0 < Fract e f"
452     show "Fract e f * Fract a b < Fract e f * Fract c d"
453     proof -
454       let ?E = "e * f" and ?F = "f * f"
455       from neq gt have "0 < ?E"
456         by (auto simp add: Zero_fract_def order_less_le eq_fract)
457       moreover from neq have "0 < ?F"
458         by (auto simp add: zero_less_mult_iff)
459       moreover from neq le have "(a * d) * (b * d) < (c * b) * (b * d)"
460         by simp
461       ultimately have "(a * d) * (b * d) * ?E * ?F < (c * b) * (b * d) * ?E * ?F"
462         by (simp add: mult_less_cancel_right)
463       with neq show ?thesis
464         by (simp add: mult_ac)
465     qed
466   qed
467 qed
469 lemma fract_induct_pos [case_names Fract]:
470   fixes P :: "'a::linordered_idom fract \<Rightarrow> bool"
471   assumes step: "\<And>a b. 0 < b \<Longrightarrow> P (Fract a b)"
472   shows "P q"
473 proof (cases q)
474   have step': "\<And>a b. b < 0 \<Longrightarrow> P (Fract a b)"
475   proof -
476     fix a::'a and b::'a
477     assume b: "b < 0"
478     then have "0 < -b" by simp
479     then have "P (Fract (-a) (-b))" by (rule step)
480     thus "P (Fract a b)" by (simp add: order_less_imp_not_eq [OF b])
481   qed
482   case (Fract a b)
483   thus "P q" by (force simp add: linorder_neq_iff step step')
484 qed
486 lemma zero_less_Fract_iff:
487   "0 < b \<Longrightarrow> 0 < Fract a b \<longleftrightarrow> 0 < a"
488   by (auto simp add: Zero_fract_def zero_less_mult_iff)
490 lemma Fract_less_zero_iff:
491   "0 < b \<Longrightarrow> Fract a b < 0 \<longleftrightarrow> a < 0"
492   by (auto simp add: Zero_fract_def mult_less_0_iff)
494 lemma zero_le_Fract_iff:
495   "0 < b \<Longrightarrow> 0 \<le> Fract a b \<longleftrightarrow> 0 \<le> a"
496   by (auto simp add: Zero_fract_def zero_le_mult_iff)
498 lemma Fract_le_zero_iff:
499   "0 < b \<Longrightarrow> Fract a b \<le> 0 \<longleftrightarrow> a \<le> 0"
500   by (auto simp add: Zero_fract_def mult_le_0_iff)
502 lemma one_less_Fract_iff:
503   "0 < b \<Longrightarrow> 1 < Fract a b \<longleftrightarrow> b < a"
504   by (auto simp add: One_fract_def mult_less_cancel_right_disj)
506 lemma Fract_less_one_iff:
507   "0 < b \<Longrightarrow> Fract a b < 1 \<longleftrightarrow> a < b"
508   by (auto simp add: One_fract_def mult_less_cancel_right_disj)
510 lemma one_le_Fract_iff:
511   "0 < b \<Longrightarrow> 1 \<le> Fract a b \<longleftrightarrow> b \<le> a"
512   by (auto simp add: One_fract_def mult_le_cancel_right)
514 lemma Fract_le_one_iff:
515   "0 < b \<Longrightarrow> Fract a b \<le> 1 \<longleftrightarrow> a \<le> b"
516   by (auto simp add: One_fract_def mult_le_cancel_right)
518 end