29 @{thm "divide_divide_eq_left"}, @{thm "times_divide_eq_right"}, |
29 @{thm "divide_divide_eq_left"}, @{thm "times_divide_eq_right"}, |
30 @{thm "times_divide_eq_left"}, @{thm "divide_divide_eq_right"}, |
30 @{thm "times_divide_eq_left"}, @{thm "divide_divide_eq_right"}, |
31 @{thm uminus_add_conv_diff [symmetric]}, @{thm "minus_divide_left"}] |
31 @{thm uminus_add_conv_diff [symmetric]}, @{thm "minus_divide_left"}] |
32 val comp_ths = distinct Thm.eq_thm (ths @ comp_arith @ @{thms simp_thms}); |
32 val comp_ths = distinct Thm.eq_thm (ths @ comp_arith @ @{thms simp_thms}); |
33 |
33 |
34 val mod_div_equality' = @{thm "mod_div_equality'"}; |
34 val div_mult_mod_eq' = @{thm "div_mult_mod_eq'"}; |
35 val mod_add_eq = @{thm "mod_add_eq"} RS sym; |
35 val mod_add_eq = @{thm "mod_add_eq"} RS sym; |
36 |
36 |
37 fun prepare_for_mir q fm = |
37 fun prepare_for_mir q fm = |
38 let |
38 let |
39 val ps = Logic.strip_params fm |
39 val ps = Logic.strip_params fm |
78 @{thm "div_by_1"}, @{thm "mod_by_1"}, @{thm "div_1"}, @{thm "mod_1"}, |
78 @{thm "div_by_1"}, @{thm "mod_by_1"}, @{thm "div_1"}, @{thm "mod_1"}, |
79 @{thm "Suc_eq_plus1"}] |
79 @{thm "Suc_eq_plus1"}] |
80 addsimps @{thms add.assoc add.commute add.left_commute} |
80 addsimps @{thms add.assoc add.commute add.left_commute} |
81 addsimprocs [@{simproc cancel_div_mod_nat}, @{simproc cancel_div_mod_int}] |
81 addsimprocs [@{simproc cancel_div_mod_nat}, @{simproc cancel_div_mod_int}] |
82 val simpset0 = put_simpset HOL_basic_ss ctxt |
82 val simpset0 = put_simpset HOL_basic_ss ctxt |
83 addsimps [mod_div_equality', @{thm Suc_eq_plus1}] |
83 addsimps [div_mult_mod_eq', @{thm Suc_eq_plus1}] |
84 addsimps comp_ths |
84 addsimps comp_ths |
85 |> fold Splitter.add_split |
85 |> fold Splitter.add_split |
86 [@{thm "split_zdiv"}, @{thm "split_zmod"}, @{thm "split_div'"}, |
86 [@{thm "split_zdiv"}, @{thm "split_zmod"}, @{thm "split_div'"}, |
87 @{thm "split_min"}, @{thm "split_max"}] |
87 @{thm "split_min"}, @{thm "split_max"}] |
88 (* Simp rules for changing (n::int) to int n *) |
88 (* Simp rules for changing (n::int) to int n *) |