137 [("field_eq_cancel_numeral_factor", |
137 [("field_eq_cancel_numeral_factor", |
138 ["(l::'a::{field,number_ring}) * m = n", |
138 ["(l::'a::{field,number_ring}) * m = n", |
139 "(l::'a::{field,number_ring}) = m * n"], |
139 "(l::'a::{field,number_ring}) = m * n"], |
140 FieldEqCancelNumeralFactor.proc), |
140 FieldEqCancelNumeralFactor.proc), |
141 ("field_cancel_numeral_factor", |
141 ("field_cancel_numeral_factor", |
142 ["((l::'a::{field,number_ring}) * m) / n", |
142 ["((l::'a::{division_by_zero,field,number_ring}) * m) / n", |
143 "(l::'a::{field,number_ring}) / (m * n)", |
143 "(l::'a::{division_by_zero,field,number_ring}) / (m * n)", |
144 "((number_of v)::'a::{field,number_ring}) / (number_of w)"], |
144 "((number_of v)::'a::{division_by_zero,field,number_ring}) / (number_of w)"], |
145 FieldDivCancelNumeralFactor.proc)] |
145 FieldDivCancelNumeralFactor.proc)] |
146 |
146 |
147 end; |
147 end; |
148 |
148 |
149 Addsimprocs ring_cancel_numeral_factors; |
149 Addsimprocs ring_cancel_numeral_factors; |
234 fun cancel_simplify_meta_eq cancel_th th = |
234 fun cancel_simplify_meta_eq cancel_th th = |
235 Int_Numeral_Simprocs.simplify_meta_eq |
235 Int_Numeral_Simprocs.simplify_meta_eq |
236 [mult_1, mult_1_right] |
236 [mult_1, mult_1_right] |
237 (([th, cancel_th]) MRS trans); |
237 (([th, cancel_th]) MRS trans); |
238 |
238 |
|
239 (*At present, long_mk_prod creates Numeral1, so this requires the axclass |
|
240 number_ring*) |
239 structure CancelFactorCommon = |
241 structure CancelFactorCommon = |
240 struct |
242 struct |
241 val mk_sum = long_mk_prod |
243 val mk_sum = long_mk_prod |
242 val dest_sum = dest_prod |
244 val dest_sum = dest_prod |
243 val mk_coeff = mk_coeff |
245 val mk_coeff = mk_coeff |
290 val mk_bal = HOLogic.mk_binop "HOL.divide" |
292 val mk_bal = HOLogic.mk_binop "HOL.divide" |
291 val dest_bal = HOLogic.dest_bin "HOL.divide" Term.dummyT |
293 val dest_bal = HOLogic.dest_bin "HOL.divide" Term.dummyT |
292 val simplify_meta_eq = cancel_simplify_meta_eq mult_divide_cancel_eq_if |
294 val simplify_meta_eq = cancel_simplify_meta_eq mult_divide_cancel_eq_if |
293 ); |
295 ); |
294 |
296 |
|
297 (*The number_ring class is necessary because the simprocs refer to the |
|
298 binary number 1. FIXME: probably they could use 1 instead.*) |
295 val field_cancel_factor = |
299 val field_cancel_factor = |
296 map Bin_Simprocs.prep_simproc |
300 map Bin_Simprocs.prep_simproc |
297 [("field_eq_cancel_factor", |
301 [("field_eq_cancel_factor", |
298 ["(l::'a::field) * m = n", "(l::'a::field) = m * n"], |
302 ["(l::'a::{field,number_ring}) * m = n", |
|
303 "(l::'a::{field,number_ring}) = m * n"], |
299 FieldEqCancelFactor.proc), |
304 FieldEqCancelFactor.proc), |
300 ("field_divide_cancel_factor", |
305 ("field_divide_cancel_factor", |
301 ["((l::'a::field) * m) / n", "(l::'a::field) / (m * n)"], |
306 ["((l::'a::{division_by_zero,field,number_ring}) * m) / n", |
|
307 "(l::'a::{division_by_zero,field,number_ring}) / (m * n)"], |
302 FieldDivideCancelFactor.proc)]; |
308 FieldDivideCancelFactor.proc)]; |
303 |
309 |
304 end; |
310 end; |
305 |
311 |
306 Addsimprocs int_cancel_factor; |
312 Addsimprocs int_cancel_factor; |