| author | berghofe | 
| Sat, 26 Nov 2005 18:41:41 +0100 | |
| changeset 18261 | 1318955d57ac | 
| parent 17876 | b9c92f384109 | 
| child 18708 | 4b3dadb4fe33 | 
| permissions | -rw-r--r-- | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: diff
changeset | 1 | (* Title: HOL/Real/rat_arith0.ML | 
| 
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: Lawrence C Paulson | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: diff
changeset | 4 | Copyright 2004 University of Cambridge | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: diff
changeset | 5 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: diff
changeset | 6 | Simprocs for common factor cancellation & Rational coefficient handling | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: diff
changeset | 7 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: diff
changeset | 8 | Instantiation of the generic linear arithmetic package for type rat. | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: diff
changeset | 9 | *) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: diff
changeset | 10 | |
| 14387 
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
 paulson parents: 
14378diff
changeset | 11 | (****Instantiation of the generic linear arithmetic package for fields****) | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: diff
changeset | 12 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: diff
changeset | 13 | local | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: diff
changeset | 14 | |
| 14390 | 15 | val simprocs = field_cancel_numeral_factors | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: diff
changeset | 16 | |
| 14390 | 17 | val simps = [order_less_irrefl, neg_less_iff_less, True_implies_equals, | 
| 14369 | 18 | inst "a" "(number_of ?v)" right_distrib, | 
| 14387 
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
 paulson parents: 
14378diff
changeset | 19 | divide_1, divide_zero_left, | 
| 
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
 paulson parents: 
14378diff
changeset | 20 | times_divide_eq_right, times_divide_eq_left, | 
| 14390 | 21 | minus_divide_left RS sym, minus_divide_right RS sym, | 
| 14378 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 paulson parents: 
14369diff
changeset | 22 | of_int_0, of_int_1, of_int_add, of_int_minus, of_int_diff, | 
| 14387 
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
 paulson parents: 
14378diff
changeset | 23 | of_int_mult, of_int_of_nat_eq]; | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: diff
changeset | 24 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: diff
changeset | 25 | in | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: diff
changeset | 26 | |
| 14387 
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
 paulson parents: 
14378diff
changeset | 27 | val fast_rat_arith_simproc = | 
| 
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
 paulson parents: 
14378diff
changeset | 28 | Simplifier.simproc (Theory.sign_of(the_context())) | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: diff
changeset | 29 | "fast_rat_arith" ["(m::rat) < n","(m::rat) <= n", "(m::rat) = n"] | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: diff
changeset | 30 | Fast_Arith.lin_arith_prover; | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: diff
changeset | 31 | |
| 14378 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 paulson parents: 
14369diff
changeset | 32 | val nat_inj_thms = [of_nat_le_iff RS iffD2, of_nat_less_iff RS iffD2, | 
| 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 paulson parents: 
14369diff
changeset | 33 | of_nat_eq_iff RS iffD2]; | 
| 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 paulson parents: 
14369diff
changeset | 34 | |
| 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 paulson parents: 
14369diff
changeset | 35 | val int_inj_thms = [of_int_le_iff RS iffD2, of_int_less_iff RS iffD2, | 
| 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 paulson parents: 
14369diff
changeset | 36 | of_int_eq_iff RS iffD2]; | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: diff
changeset | 37 | |
| 14387 
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
 paulson parents: 
14378diff
changeset | 38 | val ratT = Type("Rational.rat", []);
 | 
| 
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
 paulson parents: 
14378diff
changeset | 39 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: diff
changeset | 40 | val rat_arith_setup = | 
| 15923 | 41 |  [Fast_Arith.map_data (fn {add_mono_thms, mult_mono_thms, inj_thms, lessD,
 | 
| 42 | neqE, simpset} => | |
| 15121 
1198032bad25
Initial changes to extend arithmetic from individual types to type classes.
 nipkow parents: 
14390diff
changeset | 43 |    {add_mono_thms = add_mono_thms,
 | 
| 15184 | 44 | mult_mono_thms = mult_mono_thms, | 
| 14369 | 45 | inj_thms = int_inj_thms @ inj_thms, | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: diff
changeset | 46 | lessD = lessD, (*Can't change LA_Data_Ref.lessD: the rats are dense!*) | 
| 15923 | 47 | neqE = neqE, | 
| 14387 
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
 paulson parents: 
14378diff
changeset | 48 | simpset = simpset addsimps simps | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: diff
changeset | 49 | addsimprocs simprocs}), | 
| 14387 
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
 paulson parents: 
14378diff
changeset | 50 |   arith_inj_const("IntDef.of_nat", HOLogic.natT --> ratT),
 | 
| 
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
 paulson parents: 
14378diff
changeset | 51 |   arith_inj_const("IntDef.of_int", HOLogic.intT --> ratT),
 | 
| 17876 | 52 | fn thy => (change_simpset_of thy (fn ss => ss addsimprocs [fast_rat_arith_simproc]); thy)]; | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: diff
changeset | 53 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: diff
changeset | 54 | end; |