| author | haftmann | 
| Fri, 09 Mar 2007 08:45:50 +0100 | |
| changeset 22422 | ee19cdb07528 | 
| parent 21404 | eb85850d3eb7 | 
| child 22456 | 6070e48ecb78 | 
| permissions | -rw-r--r-- | 
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
1  | 
(* Title: HOL/Library/Rational.thy  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
2  | 
ID: $Id$  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
3  | 
Author: Markus Wenzel, TU Muenchen  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
4  | 
*)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
5  | 
|
| 14691 | 6  | 
header {* Rational numbers *}
 | 
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
7  | 
|
| 15131 | 8  | 
theory Rational  | 
| 18913 | 9  | 
imports Main  | 
| 16417 | 10  | 
uses ("rat_arith.ML")
 | 
| 15131 | 11  | 
begin  | 
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
12  | 
|
| 18913 | 13  | 
subsection {* Rational numbers *}
 | 
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
14  | 
|
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
15  | 
subsubsection {* Equivalence of fractions *}
 | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
16  | 
|
| 19765 | 17  | 
definition  | 
| 
21404
 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 
wenzelm 
parents: 
20522 
diff
changeset
 | 
18  | 
fraction :: "(int \<times> int) set" where  | 
| 19765 | 19  | 
  "fraction = {x. snd x \<noteq> 0}"
 | 
| 18913 | 20  | 
|
| 
21404
 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 
wenzelm 
parents: 
20522 
diff
changeset
 | 
21  | 
definition  | 
| 
 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 
wenzelm 
parents: 
20522 
diff
changeset
 | 
22  | 
ratrel :: "((int \<times> int) \<times> (int \<times> int)) set" where  | 
| 19765 | 23  | 
  "ratrel = {(x,y). snd x \<noteq> 0 \<and> snd y \<noteq> 0 \<and> fst x * snd y = fst y * snd x}"
 | 
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
24  | 
|
| 18913 | 25  | 
lemma fraction_iff [simp]: "(x \<in> fraction) = (snd x \<noteq> 0)"  | 
26  | 
by (simp add: fraction_def)  | 
|
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
27  | 
|
| 18913 | 28  | 
lemma ratrel_iff [simp]:  | 
29  | 
"((x,y) \<in> ratrel) =  | 
|
30  | 
(snd x \<noteq> 0 \<and> snd y \<noteq> 0 \<and> fst x * snd y = fst y * snd x)"  | 
|
31  | 
by (simp add: ratrel_def)  | 
|
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
32  | 
|
| 18913 | 33  | 
lemma refl_ratrel: "refl fraction ratrel"  | 
34  | 
by (auto simp add: refl_def fraction_def ratrel_def)  | 
|
35  | 
||
36  | 
lemma sym_ratrel: "sym ratrel"  | 
|
37  | 
by (simp add: ratrel_def sym_def)  | 
|
38  | 
||
39  | 
lemma trans_ratrel_lemma:  | 
|
40  | 
assumes 1: "a * b' = a' * b"  | 
|
41  | 
assumes 2: "a' * b'' = a'' * b'"  | 
|
42  | 
assumes 3: "b' \<noteq> (0::int)"  | 
|
43  | 
shows "a * b'' = a'' * b"  | 
|
44  | 
proof -  | 
|
45  | 
have "b' * (a * b'') = b'' * (a * b')" by simp  | 
|
46  | 
also note 1  | 
|
47  | 
also have "b'' * (a' * b) = b * (a' * b'')" by simp  | 
|
48  | 
also note 2  | 
|
49  | 
also have "b * (a'' * b') = b' * (a'' * b)" by simp  | 
|
50  | 
finally have "b' * (a * b'') = b' * (a'' * b)" .  | 
|
51  | 
with 3 show "a * b'' = a'' * b" by simp  | 
|
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
52  | 
qed  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
53  | 
|
| 18913 | 54  | 
lemma trans_ratrel: "trans ratrel"  | 
55  | 
by (auto simp add: trans_def elim: trans_ratrel_lemma)  | 
|
56  | 
||
57  | 
lemma equiv_ratrel: "equiv fraction ratrel"  | 
|
58  | 
by (rule equiv.intro [OF refl_ratrel sym_ratrel trans_ratrel])  | 
|
59  | 
||
60  | 
lemmas equiv_ratrel_iff [iff] = eq_equiv_class_iff [OF equiv_ratrel]  | 
|
61  | 
||
62  | 
lemma equiv_ratrel_iff2:  | 
|
63  | 
"\<lbrakk>snd x \<noteq> 0; snd y \<noteq> 0\<rbrakk>  | 
|
64  | 
    \<Longrightarrow> (ratrel `` {x} = ratrel `` {y}) = ((x,y) \<in> ratrel)"
 | 
|
65  | 
by (rule eq_equiv_class_iff [OF equiv_ratrel], simp_all)  | 
|
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
66  | 
|
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
67  | 
|
| 18913 | 68  | 
subsubsection {* The type of rational numbers *}
 | 
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
69  | 
|
| 18913 | 70  | 
typedef (Rat) rat = "fraction//ratrel"  | 
71  | 
proof  | 
|
72  | 
have "(0,1) \<in> fraction" by (simp add: fraction_def)  | 
|
73  | 
  thus "ratrel``{(0,1)} \<in> fraction//ratrel" by (rule quotientI)
 | 
|
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
74  | 
qed  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
75  | 
|
| 18913 | 76  | 
lemma ratrel_in_Rat [simp]: "snd x \<noteq> 0 \<Longrightarrow> ratrel``{x} \<in> Rat"
 | 
77  | 
by (simp add: Rat_def quotientI)  | 
|
78  | 
||
79  | 
declare Abs_Rat_inject [simp] Abs_Rat_inverse [simp]  | 
|
80  | 
||
81  | 
||
| 19765 | 82  | 
definition  | 
| 
21404
 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 
wenzelm 
parents: 
20522 
diff
changeset
 | 
83  | 
Fract :: "int \<Rightarrow> int \<Rightarrow> rat" where  | 
| 19765 | 84  | 
  "Fract a b = Abs_Rat (ratrel``{(a,b)})"
 | 
| 18913 | 85  | 
|
86  | 
theorem Rat_cases [case_names Fract, cases type: rat]:  | 
|
| 
21404
 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 
wenzelm 
parents: 
20522 
diff
changeset
 | 
87  | 
"(!!a b. q = Fract a b ==> b \<noteq> 0 ==> C) ==> C"  | 
| 
 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 
wenzelm 
parents: 
20522 
diff
changeset
 | 
88  | 
by (cases q) (clarsimp simp add: Fract_def Rat_def fraction_def quotient_def)  | 
| 18913 | 89  | 
|
90  | 
theorem Rat_induct [case_names Fract, induct type: rat]:  | 
|
91  | 
"(!!a b. b \<noteq> 0 ==> P (Fract a b)) ==> P q"  | 
|
92  | 
by (cases q) simp  | 
|
93  | 
||
94  | 
||
95  | 
subsubsection {* Congruence lemmas *}
 | 
|
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
96  | 
|
| 18913 | 97  | 
lemma add_congruent2:  | 
98  | 
     "(\<lambda>x y. ratrel``{(fst x * snd y + fst y * snd x, snd x * snd y)})
 | 
|
99  | 
respects2 ratrel"  | 
|
100  | 
apply (rule equiv_ratrel [THEN congruent2_commuteI])  | 
|
101  | 
apply (simp_all add: left_distrib)  | 
|
102  | 
done  | 
|
103  | 
||
104  | 
lemma minus_congruent:  | 
|
105  | 
  "(\<lambda>x. ratrel``{(- fst x, snd x)}) respects ratrel"
 | 
|
106  | 
by (simp add: congruent_def)  | 
|
107  | 
||
108  | 
lemma mult_congruent2:  | 
|
109  | 
  "(\<lambda>x y. ratrel``{(fst x * fst y, snd x * snd y)}) respects2 ratrel"
 | 
|
110  | 
by (rule equiv_ratrel [THEN congruent2_commuteI], simp_all)  | 
|
111  | 
||
112  | 
lemma inverse_congruent:  | 
|
113  | 
  "(\<lambda>x. ratrel``{if fst x=0 then (0,1) else (snd x, fst x)}) respects ratrel"
 | 
|
114  | 
by (auto simp add: congruent_def mult_commute)  | 
|
115  | 
||
116  | 
lemma le_congruent2:  | 
|
| 18982 | 117  | 
  "(\<lambda>x y. {(fst x * snd y)*(snd x * snd y) \<le> (fst y * snd x)*(snd x * snd y)})
 | 
| 18913 | 118  | 
respects2 ratrel"  | 
119  | 
proof (clarsimp simp add: congruent2_def)  | 
|
120  | 
fix a b a' b' c d c' d'::int  | 
|
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
121  | 
assume neq: "b \<noteq> 0" "b' \<noteq> 0" "d \<noteq> 0" "d' \<noteq> 0"  | 
| 18913 | 122  | 
assume eq1: "a * b' = a' * b"  | 
123  | 
assume eq2: "c * d' = c' * d"  | 
|
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
124  | 
|
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
125  | 
let ?le = "\<lambda>a b c d. ((a * d) * (b * d) \<le> (c * b) * (b * d))"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
126  | 
  {
 | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
127  | 
fix a b c d x :: int assume x: "x \<noteq> 0"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
128  | 
have "?le a b c d = ?le (a * x) (b * x) c d"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
129  | 
proof -  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
130  | 
from x have "0 < x * x" by (auto simp add: zero_less_mult_iff)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
131  | 
hence "?le a b c d =  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
132  | 
((a * d) * (b * d) * (x * x) \<le> (c * b) * (b * d) * (x * x))"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
133  | 
by (simp add: mult_le_cancel_right)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
134  | 
also have "... = ?le (a * x) (b * x) c d"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
135  | 
by (simp add: mult_ac)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
136  | 
finally show ?thesis .  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
137  | 
qed  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
138  | 
} note le_factor = this  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
139  | 
|
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
140  | 
let ?D = "b * d" and ?D' = "b' * d'"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
141  | 
from neq have D: "?D \<noteq> 0" by simp  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
142  | 
from neq have "?D' \<noteq> 0" by simp  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
143  | 
hence "?le a b c d = ?le (a * ?D') (b * ?D') c d"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
144  | 
by (rule le_factor)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
145  | 
also have "... = ((a * b') * ?D * ?D' * d * d' \<le> (c * d') * ?D * ?D' * b * b')"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
146  | 
by (simp add: mult_ac)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
147  | 
also have "... = ((a' * b) * ?D * ?D' * d * d' \<le> (c' * d) * ?D * ?D' * b * b')"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
148  | 
by (simp only: eq1 eq2)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
149  | 
also have "... = ?le (a' * ?D) (b' * ?D) c' d'"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
150  | 
by (simp add: mult_ac)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
151  | 
also from D have "... = ?le a' b' c' d'"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
152  | 
by (rule le_factor [symmetric])  | 
| 18913 | 153  | 
finally show "?le a b c d = ?le a' b' c' d'" .  | 
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
154  | 
qed  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
155  | 
|
| 18913 | 156  | 
lemmas UN_ratrel = UN_equiv_class [OF equiv_ratrel]  | 
157  | 
lemmas UN_ratrel2 = UN_equiv_class2 [OF equiv_ratrel equiv_ratrel]  | 
|
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
158  | 
|
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
159  | 
|
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
160  | 
subsubsection {* Standard operations on rational numbers *}
 | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
161  | 
|
| 20522 | 162  | 
instance rat :: "{ord, zero, one, plus, times, minus, inverse, power}" ..
 | 
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
163  | 
|
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
164  | 
defs (overloaded)  | 
| 18913 | 165  | 
Zero_rat_def: "0 == Fract 0 1"  | 
166  | 
One_rat_def: "1 == Fract 1 1"  | 
|
167  | 
||
168  | 
add_rat_def:  | 
|
169  | 
"q + r ==  | 
|
170  | 
Abs_Rat (\<Union>x \<in> Rep_Rat q. \<Union>y \<in> Rep_Rat r.  | 
|
171  | 
           ratrel``{(fst x * snd y + fst y * snd x, snd x * snd y)})"
 | 
|
172  | 
||
173  | 
minus_rat_def:  | 
|
174  | 
    "- q == Abs_Rat (\<Union>x \<in> Rep_Rat q. ratrel``{(- fst x, snd x)})"
 | 
|
175  | 
||
176  | 
diff_rat_def: "q - r == q + - (r::rat)"  | 
|
177  | 
||
178  | 
mult_rat_def:  | 
|
179  | 
"q * r ==  | 
|
180  | 
Abs_Rat (\<Union>x \<in> Rep_Rat q. \<Union>y \<in> Rep_Rat r.  | 
|
181  | 
           ratrel``{(fst x * fst y, snd x * snd y)})"
 | 
|
182  | 
||
183  | 
inverse_rat_def:  | 
|
184  | 
"inverse q ==  | 
|
185  | 
Abs_Rat (\<Union>x \<in> Rep_Rat q.  | 
|
186  | 
            ratrel``{if fst x=0 then (0,1) else (snd x, fst x)})"
 | 
|
187  | 
||
188  | 
divide_rat_def: "q / r == q * inverse (r::rat)"  | 
|
189  | 
||
190  | 
le_rat_def:  | 
|
| 18982 | 191  | 
"q \<le> r == contents (\<Union>x \<in> Rep_Rat q. \<Union>y \<in> Rep_Rat r.  | 
192  | 
      {(fst x * snd y)*(snd x * snd y) \<le> (fst y * snd x)*(snd x * snd y)})"
 | 
|
| 18913 | 193  | 
|
194  | 
less_rat_def: "(z < (w::rat)) == (z \<le> w & z \<noteq> w)"  | 
|
195  | 
||
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
196  | 
abs_rat_def: "\<bar>q\<bar> == if q < 0 then -q else (q::rat)"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
197  | 
|
| 20522 | 198  | 
primrec (rat)  | 
199  | 
rat_power_0: "q ^ 0 = 1"  | 
|
200  | 
rat_power_Suc: "q ^ (Suc n) = (q::rat) * (q ^ n)"  | 
|
201  | 
||
| 18913 | 202  | 
lemma zero_rat: "0 = Fract 0 1"  | 
203  | 
by (simp add: Zero_rat_def)  | 
|
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
204  | 
|
| 18913 | 205  | 
lemma one_rat: "1 = Fract 1 1"  | 
206  | 
by (simp add: One_rat_def)  | 
|
207  | 
||
208  | 
theorem eq_rat: "b \<noteq> 0 ==> d \<noteq> 0 ==>  | 
|
209  | 
(Fract a b = Fract c d) = (a * d = c * b)"  | 
|
210  | 
by (simp add: Fract_def)  | 
|
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
211  | 
|
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
212  | 
theorem add_rat: "b \<noteq> 0 ==> d \<noteq> 0 ==>  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
213  | 
Fract a b + Fract c d = Fract (a * d + c * b) (b * d)"  | 
| 18913 | 214  | 
by (simp add: Fract_def add_rat_def add_congruent2 UN_ratrel2)  | 
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
215  | 
|
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
216  | 
theorem minus_rat: "b \<noteq> 0 ==> -(Fract a b) = Fract (-a) b"  | 
| 18913 | 217  | 
by (simp add: Fract_def minus_rat_def minus_congruent UN_ratrel)  | 
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
218  | 
|
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
219  | 
theorem diff_rat: "b \<noteq> 0 ==> d \<noteq> 0 ==>  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
220  | 
Fract a b - Fract c d = Fract (a * d - c * b) (b * d)"  | 
| 18913 | 221  | 
by (simp add: diff_rat_def add_rat minus_rat)  | 
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
222  | 
|
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
223  | 
theorem mult_rat: "b \<noteq> 0 ==> d \<noteq> 0 ==>  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
224  | 
Fract a b * Fract c d = Fract (a * c) (b * d)"  | 
| 18913 | 225  | 
by (simp add: Fract_def mult_rat_def mult_congruent2 UN_ratrel2)  | 
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
226  | 
|
| 18913 | 227  | 
theorem inverse_rat: "a \<noteq> 0 ==> b \<noteq> 0 ==>  | 
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
228  | 
inverse (Fract a b) = Fract b a"  | 
| 18913 | 229  | 
by (simp add: Fract_def inverse_rat_def inverse_congruent UN_ratrel)  | 
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
230  | 
|
| 18913 | 231  | 
theorem divide_rat: "c \<noteq> 0 ==> b \<noteq> 0 ==> d \<noteq> 0 ==>  | 
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
232  | 
Fract a b / Fract c d = Fract (a * d) (b * c)"  | 
| 18913 | 233  | 
by (simp add: divide_rat_def inverse_rat mult_rat)  | 
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
234  | 
|
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
235  | 
theorem le_rat: "b \<noteq> 0 ==> d \<noteq> 0 ==>  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
236  | 
(Fract a b \<le> Fract c d) = ((a * d) * (b * d) \<le> (c * b) * (b * d))"  | 
| 18982 | 237  | 
by (simp add: Fract_def le_rat_def le_congruent2 UN_ratrel2)  | 
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
238  | 
|
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
239  | 
theorem less_rat: "b \<noteq> 0 ==> d \<noteq> 0 ==>  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
240  | 
(Fract a b < Fract c d) = ((a * d) * (b * d) < (c * b) * (b * d))"  | 
| 18913 | 241  | 
by (simp add: less_rat_def le_rat eq_rat order_less_le)  | 
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
242  | 
|
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
243  | 
theorem abs_rat: "b \<noteq> 0 ==> \<bar>Fract a b\<bar> = Fract \<bar>a\<bar> \<bar>b\<bar>"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
244  | 
by (simp add: abs_rat_def minus_rat zero_rat less_rat eq_rat)  | 
| 14691 | 245  | 
(auto simp add: mult_less_0_iff zero_less_mult_iff order_le_less  | 
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
246  | 
split: abs_split)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
247  | 
|
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
248  | 
|
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
249  | 
subsubsection {* The ordered field of rational numbers *}
 | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
250  | 
|
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
251  | 
instance rat :: field  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
252  | 
proof  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
253  | 
fix q r s :: rat  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
254  | 
show "(q + r) + s = q + (r + s)"  | 
| 18913 | 255  | 
by (induct q, induct r, induct s)  | 
256  | 
(simp add: add_rat add_ac mult_ac int_distrib)  | 
|
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
257  | 
show "q + r = r + q"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
258  | 
by (induct q, induct r) (simp add: add_rat add_ac mult_ac)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
259  | 
show "0 + q = q"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
260  | 
by (induct q) (simp add: zero_rat add_rat)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
261  | 
show "(-q) + q = 0"  | 
| 18913 | 262  | 
by (induct q) (simp add: zero_rat minus_rat add_rat eq_rat)  | 
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
263  | 
show "q - r = q + (-r)"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
264  | 
by (induct q, induct r) (simp add: add_rat minus_rat diff_rat)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
265  | 
show "(q * r) * s = q * (r * s)"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
266  | 
by (induct q, induct r, induct s) (simp add: mult_rat mult_ac)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
267  | 
show "q * r = r * q"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
268  | 
by (induct q, induct r) (simp add: mult_rat mult_ac)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
269  | 
show "1 * q = q"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
270  | 
by (induct q) (simp add: one_rat mult_rat)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
271  | 
show "(q + r) * s = q * s + r * s"  | 
| 14691 | 272  | 
by (induct q, induct r, induct s)  | 
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
273  | 
(simp add: add_rat mult_rat eq_rat int_distrib)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
274  | 
show "q \<noteq> 0 ==> inverse q * q = 1"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
275  | 
by (induct q) (simp add: inverse_rat mult_rat one_rat zero_rat eq_rat)  | 
| 
14430
 
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
 
paulson 
parents: 
14421 
diff
changeset
 | 
276  | 
show "q / r = q * inverse r"  | 
| 14691 | 277  | 
by (simp add: divide_rat_def)  | 
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
278  | 
show "0 \<noteq> (1::rat)"  | 
| 14691 | 279  | 
by (simp add: zero_rat one_rat eq_rat)  | 
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
280  | 
qed  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
281  | 
|
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
282  | 
instance rat :: linorder  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
283  | 
proof  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
284  | 
fix q r s :: rat  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
285  | 
  {
 | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
286  | 
assume "q \<le> r" and "r \<le> s"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
287  | 
show "q \<le> s"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
288  | 
proof (insert prems, induct q, induct r, induct s)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
289  | 
fix a b c d e f :: int  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
290  | 
assume neq: "b \<noteq> 0" "d \<noteq> 0" "f \<noteq> 0"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
291  | 
assume 1: "Fract a b \<le> Fract c d" and 2: "Fract c d \<le> Fract e f"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
292  | 
show "Fract a b \<le> Fract e f"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
293  | 
proof -  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
294  | 
from neq obtain bb: "0 < b * b" and dd: "0 < d * d" and ff: "0 < f * f"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
295  | 
by (auto simp add: zero_less_mult_iff linorder_neq_iff)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
296  | 
have "(a * d) * (b * d) * (f * f) \<le> (c * b) * (b * d) * (f * f)"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
297  | 
proof -  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
298  | 
from neq 1 have "(a * d) * (b * d) \<le> (c * b) * (b * d)"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
299  | 
by (simp add: le_rat)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
300  | 
with ff show ?thesis by (simp add: mult_le_cancel_right)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
301  | 
qed  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
302  | 
also have "... = (c * f) * (d * f) * (b * b)"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
303  | 
by (simp only: mult_ac)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
304  | 
also have "... \<le> (e * d) * (d * f) * (b * b)"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
305  | 
proof -  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
306  | 
from neq 2 have "(c * f) * (d * f) \<le> (e * d) * (d * f)"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
307  | 
by (simp add: le_rat)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
308  | 
with bb show ?thesis by (simp add: mult_le_cancel_right)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
309  | 
qed  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
310  | 
finally have "(a * f) * (b * f) * (d * d) \<le> e * b * (b * f) * (d * d)"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
311  | 
by (simp only: mult_ac)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
312  | 
with dd have "(a * f) * (b * f) \<le> (e * b) * (b * f)"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
313  | 
by (simp add: mult_le_cancel_right)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
314  | 
with neq show ?thesis by (simp add: le_rat)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
315  | 
qed  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
316  | 
qed  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
317  | 
next  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
318  | 
assume "q \<le> r" and "r \<le> q"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
319  | 
show "q = r"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
320  | 
proof (insert prems, induct q, induct r)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
321  | 
fix a b c d :: int  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
322  | 
assume neq: "b \<noteq> 0" "d \<noteq> 0"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
323  | 
assume 1: "Fract a b \<le> Fract c d" and 2: "Fract c d \<le> Fract a b"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
324  | 
show "Fract a b = Fract c d"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
325  | 
proof -  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
326  | 
from neq 1 have "(a * d) * (b * d) \<le> (c * b) * (b * d)"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
327  | 
by (simp add: le_rat)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
328  | 
also have "... \<le> (a * d) * (b * d)"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
329  | 
proof -  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
330  | 
from neq 2 have "(c * b) * (d * b) \<le> (a * d) * (d * b)"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
331  | 
by (simp add: le_rat)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
332  | 
thus ?thesis by (simp only: mult_ac)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
333  | 
qed  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
334  | 
finally have "(a * d) * (b * d) = (c * b) * (b * d)" .  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
335  | 
moreover from neq have "b * d \<noteq> 0" by simp  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
336  | 
ultimately have "a * d = c * b" by simp  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
337  | 
with neq show ?thesis by (simp add: eq_rat)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
338  | 
qed  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
339  | 
qed  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
340  | 
next  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
341  | 
show "q \<le> q"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
342  | 
by (induct q) (simp add: le_rat)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
343  | 
show "(q < r) = (q \<le> r \<and> q \<noteq> r)"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
344  | 
by (simp only: less_rat_def)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
345  | 
show "q \<le> r \<or> r \<le> q"  | 
| 18913 | 346  | 
by (induct q, induct r)  | 
347  | 
(simp add: le_rat mult_commute, rule linorder_linear)  | 
|
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
348  | 
}  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
349  | 
qed  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
350  | 
|
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
351  | 
instance rat :: ordered_field  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
352  | 
proof  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
353  | 
fix q r s :: rat  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
354  | 
show "q \<le> r ==> s + q \<le> s + r"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
355  | 
proof (induct q, induct r, induct s)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
356  | 
fix a b c d e f :: int  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
357  | 
assume neq: "b \<noteq> 0" "d \<noteq> 0" "f \<noteq> 0"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
358  | 
assume le: "Fract a b \<le> Fract c d"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
359  | 
show "Fract e f + Fract a b \<le> Fract e f + Fract c d"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
360  | 
proof -  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
361  | 
let ?F = "f * f" from neq have F: "0 < ?F"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
362  | 
by (auto simp add: zero_less_mult_iff)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
363  | 
from neq le have "(a * d) * (b * d) \<le> (c * b) * (b * d)"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
364  | 
by (simp add: le_rat)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
365  | 
with F have "(a * d) * (b * d) * ?F * ?F \<le> (c * b) * (b * d) * ?F * ?F"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
366  | 
by (simp add: mult_le_cancel_right)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
367  | 
with neq show ?thesis by (simp add: add_rat le_rat mult_ac int_distrib)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
368  | 
qed  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
369  | 
qed  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
370  | 
show "q < r ==> 0 < s ==> s * q < s * r"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
371  | 
proof (induct q, induct r, induct s)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
372  | 
fix a b c d e f :: int  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
373  | 
assume neq: "b \<noteq> 0" "d \<noteq> 0" "f \<noteq> 0"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
374  | 
assume le: "Fract a b < Fract c d"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
375  | 
assume gt: "0 < Fract e f"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
376  | 
show "Fract e f * Fract a b < Fract e f * Fract c d"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
377  | 
proof -  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
378  | 
let ?E = "e * f" and ?F = "f * f"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
379  | 
from neq gt have "0 < ?E"  | 
| 
14378
 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 
paulson 
parents: 
14365 
diff
changeset
 | 
380  | 
by (auto simp add: zero_rat less_rat le_rat order_less_le eq_rat)  | 
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
381  | 
moreover from neq have "0 < ?F"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
382  | 
by (auto simp add: zero_less_mult_iff)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
383  | 
moreover from neq le have "(a * d) * (b * d) < (c * b) * (b * d)"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
384  | 
by (simp add: less_rat)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
385  | 
ultimately have "(a * d) * (b * d) * ?E * ?F < (c * b) * (b * d) * ?E * ?F"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
386  | 
by (simp add: mult_less_cancel_right)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
387  | 
with neq show ?thesis  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
388  | 
by (simp add: less_rat mult_rat mult_ac)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
389  | 
qed  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
390  | 
qed  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
391  | 
show "\<bar>q\<bar> = (if q < 0 then -q else q)"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
392  | 
by (simp only: abs_rat_def)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
393  | 
qed  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
394  | 
|
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
395  | 
instance rat :: division_by_zero  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
396  | 
proof  | 
| 18913 | 397  | 
show "inverse 0 = (0::rat)"  | 
398  | 
by (simp add: zero_rat Fract_def inverse_rat_def  | 
|
399  | 
inverse_congruent UN_ratrel)  | 
|
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
400  | 
qed  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
401  | 
|
| 20522 | 402  | 
instance rat :: recpower  | 
403  | 
proof  | 
|
404  | 
fix q :: rat  | 
|
405  | 
fix n :: nat  | 
|
406  | 
show "q ^ 0 = 1" by simp  | 
|
407  | 
show "q ^ (Suc n) = q * (q ^ n)" by simp  | 
|
408  | 
qed  | 
|
409  | 
||
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
410  | 
|
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
411  | 
subsection {* Various Other Results *}
 | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
412  | 
|
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
413  | 
lemma minus_rat_cancel [simp]: "b \<noteq> 0 ==> Fract (-a) (-b) = Fract a b"  | 
| 18913 | 414  | 
by (simp add: eq_rat)  | 
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
415  | 
|
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
416  | 
theorem Rat_induct_pos [case_names Fract, induct type: rat]:  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
417  | 
assumes step: "!!a b. 0 < b ==> P (Fract a b)"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
418  | 
shows "P q"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
419  | 
proof (cases q)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
420  | 
have step': "!!a b. b < 0 ==> P (Fract a b)"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
421  | 
proof -  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
422  | 
fix a::int and b::int  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
423  | 
assume b: "b < 0"  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
424  | 
hence "0 < -b" by simp  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
425  | 
hence "P (Fract (-a) (-b))" by (rule step)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
426  | 
thus "P (Fract a b)" by (simp add: order_less_imp_not_eq [OF b])  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
427  | 
qed  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
428  | 
case (Fract a b)  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
429  | 
thus "P q" by (force simp add: linorder_neq_iff step step')  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
430  | 
qed  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
431  | 
|
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
432  | 
lemma zero_less_Fract_iff:  | 
| 
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
433  | 
"0 < b ==> (0 < Fract a b) = (0 < a)"  | 
| 14691 | 434  | 
by (simp add: zero_rat less_rat order_less_imp_not_eq2 zero_less_mult_iff)  | 
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
435  | 
|
| 
14378
 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 
paulson 
parents: 
14365 
diff
changeset
 | 
436  | 
lemma Fract_add_one: "n \<noteq> 0 ==> Fract (m + n) n = Fract m n + 1"  | 
| 
 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 
paulson 
parents: 
14365 
diff
changeset
 | 
437  | 
apply (insert add_rat [of concl: m n 1 1])  | 
| 14691 | 438  | 
apply (simp add: one_rat [symmetric])  | 
| 
14378
 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 
paulson 
parents: 
14365 
diff
changeset
 | 
439  | 
done  | 
| 
 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 
paulson 
parents: 
14365 
diff
changeset
 | 
440  | 
|
| 
 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 
paulson 
parents: 
14365 
diff
changeset
 | 
441  | 
lemma Fract_of_nat_eq: "Fract (of_nat k) 1 = of_nat k"  | 
| 14691 | 442  | 
apply (induct k)  | 
443  | 
apply (simp add: zero_rat)  | 
|
444  | 
apply (simp add: Fract_add_one)  | 
|
| 
14378
 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 
paulson 
parents: 
14365 
diff
changeset
 | 
445  | 
done  | 
| 
 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 
paulson 
parents: 
14365 
diff
changeset
 | 
446  | 
|
| 
 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 
paulson 
parents: 
14365 
diff
changeset
 | 
447  | 
lemma Fract_of_int_eq: "Fract k 1 = of_int k"  | 
| 14691 | 448  | 
proof (cases k rule: int_cases)  | 
| 
14378
 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 
paulson 
parents: 
14365 
diff
changeset
 | 
449  | 
case (nonneg n)  | 
| 
 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 
paulson 
parents: 
14365 
diff
changeset
 | 
450  | 
thus ?thesis by (simp add: int_eq_of_nat Fract_of_nat_eq)  | 
| 14691 | 451  | 
next  | 
| 
14378
 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 
paulson 
parents: 
14365 
diff
changeset
 | 
452  | 
case (neg n)  | 
| 
 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 
paulson 
parents: 
14365 
diff
changeset
 | 
453  | 
hence "Fract k 1 = - (Fract (of_nat (Suc n)) 1)"  | 
| 14691 | 454  | 
by (simp only: minus_rat int_eq_of_nat)  | 
| 
14378
 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 
paulson 
parents: 
14365 
diff
changeset
 | 
455  | 
also have "... = - (of_nat (Suc n))"  | 
| 
 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 
paulson 
parents: 
14365 
diff
changeset
 | 
456  | 
by (simp only: Fract_of_nat_eq)  | 
| 14691 | 457  | 
finally show ?thesis  | 
458  | 
by (simp add: only: prems int_eq_of_nat of_int_minus of_int_of_nat_eq)  | 
|
459  | 
qed  | 
|
| 
14378
 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 
paulson 
parents: 
14365 
diff
changeset
 | 
460  | 
|
| 
 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 
paulson 
parents: 
14365 
diff
changeset
 | 
461  | 
|
| 14691 | 462  | 
subsection {* Numerals and Arithmetic *}
 | 
| 
14387
 
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
 
paulson 
parents: 
14378 
diff
changeset
 | 
463  | 
|
| 
 
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
 
paulson 
parents: 
14378 
diff
changeset
 | 
464  | 
instance rat :: number ..  | 
| 
 
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
 
paulson 
parents: 
14378 
diff
changeset
 | 
465  | 
|
| 15013 | 466  | 
defs (overloaded)  | 
| 20485 | 467  | 
rat_number_of_def: "(number_of w :: rat) == of_int w"  | 
| 15013 | 468  | 
    --{*the type constraint is essential!*}
 | 
| 
14387
 
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
 
paulson 
parents: 
14378 
diff
changeset
 | 
469  | 
|
| 
 
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
 
paulson 
parents: 
14378 
diff
changeset
 | 
470  | 
instance rat :: number_ring  | 
| 19765 | 471  | 
by default (simp add: rat_number_of_def)  | 
| 
14387
 
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
 
paulson 
parents: 
14378 
diff
changeset
 | 
472  | 
|
| 
 
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
 
paulson 
parents: 
14378 
diff
changeset
 | 
473  | 
use "rat_arith.ML"  | 
| 
 
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
 
paulson 
parents: 
14378 
diff
changeset
 | 
474  | 
setup rat_arith_setup  | 
| 
 
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
 
paulson 
parents: 
14378 
diff
changeset
 | 
475  | 
|
| 
14365
 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 
paulson 
parents:  
diff
changeset
 | 
476  | 
end  |