1641 val less = @{term "op < :: int \<Rightarrow> int \<Rightarrow> bool"} |
1641 val less = @{term "op < :: int \<Rightarrow> int \<Rightarrow> bool"} |
1642 val le = @{term "op \<le> :: int \<Rightarrow> int \<Rightarrow> bool"} |
1642 val le = @{term "op \<le> :: int \<Rightarrow> int \<Rightarrow> bool"} |
1643 val simps = @{thms arith_simps} @ @{thms rel_simps} @ |
1643 val simps = @{thms arith_simps} @ @{thms rel_simps} @ |
1644 map (fn th => th RS sym) [@{thm numeral_1_eq_1}] |
1644 map (fn th => th RS sym) [@{thm numeral_1_eq_1}] |
1645 fun prove ctxt goal = Goal.prove ctxt [] [] (HOLogic.mk_Trueprop goal) |
1645 fun prove ctxt goal = Goal.prove ctxt [] [] (HOLogic.mk_Trueprop goal) |
1646 (K (ALLGOALS (full_simp_tac (HOL_basic_ss addsimps simps)))); |
1646 (K (ALLGOALS (full_simp_tac (put_simpset HOL_basic_ss ctxt addsimps simps)))); |
1647 fun binary_proc proc ss ct = |
1647 fun binary_proc proc ctxt ct = |
1648 (case Thm.term_of ct of |
1648 (case Thm.term_of ct of |
1649 _ $ t $ u => |
1649 _ $ t $ u => |
1650 (case try (pairself (`(snd o HOLogic.dest_number))) (t, u) of |
1650 (case try (pairself (`(snd o HOLogic.dest_number))) (t, u) of |
1651 SOME args => proc (Simplifier.the_context ss) args |
1651 SOME args => proc ctxt args |
1652 | NONE => NONE) |
1652 | NONE => NONE) |
1653 | _ => NONE); |
1653 | _ => NONE); |
1654 in |
1654 in |
1655 fun divmod_proc posrule negrule = |
1655 fun divmod_proc posrule negrule = |
1656 binary_proc (fn ctxt => fn ((a, t), (b, u)) => |
1656 binary_proc (fn ctxt => fn ((a, t), (b, u)) => |