223 val dest_sum = dest_sum |
223 val dest_sum = dest_sum |
224 val mk_coeff = mk_coeff |
224 val mk_coeff = mk_coeff |
225 val dest_coeff = dest_coeff 1 |
225 val dest_coeff = dest_coeff 1 |
226 val find_first_coeff = find_first_coeff [] |
226 val find_first_coeff = find_first_coeff [] |
227 fun trans_tac _ = ArithData.gen_trans_tac iff_trans |
227 fun trans_tac _ = ArithData.gen_trans_tac iff_trans |
228 val norm_tac_ss1 = ZF_ss addsimps add_0s@mult_1s@diff_simps@ |
228 |
229 zminus_simps@zadd_ac |
229 val norm_ss1 = ZF_ss addsimps add_0s @ mult_1s @ diff_simps @ zminus_simps @ zadd_ac |
230 val norm_tac_ss2 = ZF_ss addsimps bin_simps@int_mult_minus_simps@intifys |
230 val norm_ss2 = ZF_ss addsimps bin_simps @ int_mult_minus_simps @ intifys |
231 val norm_tac_ss3 = ZF_ss addsimps int_minus_from_mult_simps@ |
231 val norm_ss3 = ZF_ss addsimps int_minus_from_mult_simps @ zadd_ac @ zmult_ac @ tc_rules @ intifys |
232 zadd_ac@zmult_ac@tc_rules@intifys |
|
233 fun norm_tac ss = |
232 fun norm_tac ss = |
234 ALLGOALS (asm_simp_tac (Simplifier.inherit_context ss norm_tac_ss1)) |
233 ALLGOALS (asm_simp_tac (Simplifier.inherit_context ss norm_ss1)) |
235 THEN ALLGOALS (asm_simp_tac (Simplifier.inherit_context ss norm_tac_ss2)) |
234 THEN ALLGOALS (asm_simp_tac (Simplifier.inherit_context ss norm_ss2)) |
236 THEN ALLGOALS (asm_simp_tac (Simplifier.inherit_context ss norm_tac_ss3)) |
235 THEN ALLGOALS (asm_simp_tac (Simplifier.inherit_context ss norm_ss3)) |
|
236 |
|
237 val numeral_simp_ss = ZF_ss addsimps add_0s @ bin_simps @ tc_rules @ intifys |
237 fun numeral_simp_tac ss = |
238 fun numeral_simp_tac ss = |
238 ALLGOALS (simp_tac (Simplifier.inherit_context ss ZF_ss addsimps |
239 ALLGOALS (simp_tac (Simplifier.inherit_context ss numeral_simp_ss)) |
239 add_0s @ bin_simps @ tc_rules @ intifys)) |
|
240 THEN ALLGOALS (SIMPSET' (fn simpset => asm_simp_tac (Simplifier.inherit_context ss simpset))) |
240 THEN ALLGOALS (SIMPSET' (fn simpset => asm_simp_tac (Simplifier.inherit_context ss simpset))) |
241 val simplify_meta_eq = ArithData.simplify_meta_eq (add_0s @ mult_1s) |
241 val simplify_meta_eq = ArithData.simplify_meta_eq (add_0s @ mult_1s) |
242 end; |
242 end; |
243 |
243 |
244 |
244 |
299 val mk_coeff = mk_coeff |
299 val mk_coeff = mk_coeff |
300 val dest_coeff = dest_coeff 1 |
300 val dest_coeff = dest_coeff 1 |
301 val left_distrib = left_zadd_zmult_distrib RS trans |
301 val left_distrib = left_zadd_zmult_distrib RS trans |
302 val prove_conv = prove_conv_nohyps "int_combine_numerals" |
302 val prove_conv = prove_conv_nohyps "int_combine_numerals" |
303 fun trans_tac _ = ArithData.gen_trans_tac trans |
303 fun trans_tac _ = ArithData.gen_trans_tac trans |
304 val norm_tac_ss1 = ZF_ss addsimps add_0s@mult_1s@diff_simps@ |
304 |
305 zminus_simps@zadd_ac@intifys |
305 val norm_ss1 = ZF_ss addsimps add_0s @ mult_1s @ diff_simps @ zminus_simps @ zadd_ac @ intifys |
306 val norm_tac_ss2 = ZF_ss addsimps bin_simps@int_mult_minus_simps@intifys |
306 val norm_ss2 = ZF_ss addsimps bin_simps @ int_mult_minus_simps @ intifys |
307 val norm_tac_ss3 = ZF_ss addsimps int_minus_from_mult_simps@ |
307 val norm_ss3 = ZF_ss addsimps int_minus_from_mult_simps @ zadd_ac @ zmult_ac @ tc_rules @ intifys |
308 zadd_ac@zmult_ac@tc_rules@intifys |
|
309 fun norm_tac ss = |
308 fun norm_tac ss = |
310 ALLGOALS (asm_simp_tac (Simplifier.inherit_context ss norm_tac_ss1)) |
309 ALLGOALS (asm_simp_tac (Simplifier.inherit_context ss norm_ss1)) |
311 THEN ALLGOALS (asm_simp_tac (Simplifier.inherit_context ss norm_tac_ss2)) |
310 THEN ALLGOALS (asm_simp_tac (Simplifier.inherit_context ss norm_ss2)) |
312 THEN ALLGOALS (asm_simp_tac (Simplifier.inherit_context ss norm_tac_ss3)) |
311 THEN ALLGOALS (asm_simp_tac (Simplifier.inherit_context ss norm_ss3)) |
|
312 |
|
313 val numeral_simp_ss = ZF_ss addsimps add_0s @ bin_simps @ tc_rules @ intifys |
313 fun numeral_simp_tac ss = |
314 fun numeral_simp_tac ss = |
314 ALLGOALS (simp_tac (Simplifier.inherit_context ss ZF_ss addsimps |
315 ALLGOALS (simp_tac (Simplifier.inherit_context ss numeral_simp_ss)) |
315 add_0s @ bin_simps @ tc_rules @ intifys)) |
316 val simplify_meta_eq = ArithData.simplify_meta_eq (add_0s @ mult_1s) |
316 val simplify_meta_eq = ArithData.simplify_meta_eq (add_0s@mult_1s) |
|
317 end; |
317 end; |
318 |
318 |
319 structure CombineNumerals = CombineNumeralsFun(CombineNumeralsData); |
319 structure CombineNumerals = CombineNumeralsFun(CombineNumeralsData); |
320 |
320 |
321 val combine_numerals = |
321 val combine_numerals = |
338 else raise TERM("mk_coeff", []) |
338 else raise TERM("mk_coeff", []) |
339 fun dest_coeff t = (dest_numeral t, one) (*We ONLY want pure numerals.*) |
339 fun dest_coeff t = (dest_numeral t, one) (*We ONLY want pure numerals.*) |
340 val left_distrib = zmult_assoc RS sym RS trans |
340 val left_distrib = zmult_assoc RS sym RS trans |
341 val prove_conv = prove_conv_nohyps "int_combine_numerals_prod" |
341 val prove_conv = prove_conv_nohyps "int_combine_numerals_prod" |
342 fun trans_tac _ = ArithData.gen_trans_tac trans |
342 fun trans_tac _ = ArithData.gen_trans_tac trans |
343 val norm_tac_ss1 = ZF_ss addsimps mult_1s@diff_simps@zminus_simps |
343 |
344 val norm_tac_ss2 = ZF_ss addsimps [zmult_zminus_right RS sym]@ |
344 val norm_ss1 = ZF_ss addsimps mult_1s @ diff_simps @ zminus_simps |
345 bin_simps@zmult_ac@tc_rules@intifys |
345 val norm_ss2 = ZF_ss addsimps [zmult_zminus_right RS sym] @ |
|
346 bin_simps @ zmult_ac @ tc_rules @ intifys |
346 fun norm_tac ss = |
347 fun norm_tac ss = |
347 ALLGOALS (asm_simp_tac (Simplifier.inherit_context ss norm_tac_ss1)) |
348 ALLGOALS (asm_simp_tac (Simplifier.inherit_context ss norm_ss1)) |
348 THEN ALLGOALS (asm_simp_tac (Simplifier.inherit_context ss norm_tac_ss2)) |
349 THEN ALLGOALS (asm_simp_tac (Simplifier.inherit_context ss norm_ss2)) |
|
350 |
|
351 val numeral_simp_ss = ZF_ss addsimps bin_simps @ tc_rules @ intifys |
349 fun numeral_simp_tac ss = |
352 fun numeral_simp_tac ss = |
350 ALLGOALS (simp_tac (Simplifier.inherit_context ss ZF_ss addsimps |
353 ALLGOALS (simp_tac (Simplifier.inherit_context ss numeral_simp_ss)) |
351 bin_simps @ tc_rules @ intifys)) |
354 val simplify_meta_eq = ArithData.simplify_meta_eq (mult_1s); |
352 val simplify_meta_eq = ArithData.simplify_meta_eq (mult_1s) |
|
353 end; |
355 end; |
354 |
356 |
355 |
357 |
356 structure CombineNumeralsProd = CombineNumeralsFun(CombineNumeralsProdData); |
358 structure CombineNumeralsProd = CombineNumeralsFun(CombineNumeralsProdData); |
357 |
359 |