src/HOL/Numeral_Simprocs.thy
changeset 45436 62bc9474d04b
parent 45435 d660c4b9daa6
child 45462 aba629d6cee5
--- a/src/HOL/Numeral_Simprocs.thy	Wed Nov 09 10:58:08 2011 +0100
+++ b/src/HOL/Numeral_Simprocs.thy	Wed Nov 09 11:44:42 2011 +0100
@@ -202,6 +202,30 @@
 
 use "Tools/nat_numeral_simprocs.ML"
 
+simproc_setup nateq_cancel_numerals
+  ("(l::nat) + m = n" | "(l::nat) = m + n" |
+   "(l::nat) * m = n" | "(l::nat) = m * n" |
+   "Suc m = n" | "m = Suc n") =
+  {* fn phi => Nat_Numeral_Simprocs.eq_cancel_numerals *}
+
+simproc_setup natless_cancel_numerals
+  ("(l::nat) + m < n" | "(l::nat) < m + n" |
+   "(l::nat) * m < n" | "(l::nat) < m * n" |
+   "Suc m < n" | "m < Suc n") =
+  {* fn phi => Nat_Numeral_Simprocs.less_cancel_numerals *}
+
+simproc_setup natle_cancel_numerals
+  ("(l::nat) + m \<le> n" | "(l::nat) \<le> m + n" |
+   "(l::nat) * m \<le> n" | "(l::nat) \<le> m * n" |
+   "Suc m \<le> n" | "m \<le> Suc n") =
+  {* fn phi => Nat_Numeral_Simprocs.le_cancel_numerals *}
+
+simproc_setup natdiff_cancel_numerals
+  ("((l::nat) + m) - n" | "(l::nat) - (m + n)" |
+   "(l::nat) * m - n" | "(l::nat) - m * n" |
+   "Suc m - n" | "m - Suc n") =
+  {* fn phi => Nat_Numeral_Simprocs.diff_cancel_numerals *}
+
 declaration {* 
   K (Lin_Arith.add_simps (@{thms neg_simps} @ [@{thm Suc_nat_number_of}, @{thm int_nat_number_of}])
   #> Lin_Arith.add_simps (@{thms ring_distribs} @ [@{thm Let_number_of}, @{thm Let_0}, @{thm Let_1},
@@ -222,7 +246,12 @@
        @{simproc inteq_cancel_numerals},
        @{simproc intless_cancel_numerals},
        @{simproc intle_cancel_numerals}]
-  #> Lin_Arith.add_simprocs (Nat_Numeral_Simprocs.combine_numerals :: Nat_Numeral_Simprocs.cancel_numerals))
+  #> Lin_Arith.add_simprocs
+      [Nat_Numeral_Simprocs.combine_numerals,
+       @{simproc nateq_cancel_numerals},
+       @{simproc natless_cancel_numerals},
+       @{simproc natle_cancel_numerals},
+       @{simproc natdiff_cancel_numerals}])
 *}
 
 end