merged
authorwenzelm
Fri, 20 Mar 2015 16:18:28 +0100
changeset 59764 4ebf2276f58a
parent 59758 66fc7122f51a (diff)
parent 59763 56d2c357e6b5 (current diff)
child 59766 9c99e5f9fb5e
merged
--- a/src/HOL/Numeral_Simprocs.thy	Fri Mar 20 14:48:04 2015 +0100
+++ b/src/HOL/Numeral_Simprocs.thy	Fri Mar 20 16:18:28 2015 +0100
@@ -99,6 +99,10 @@
   shows "(k * m) div (k * n) = (if k = 0 then 0 else m div n)"
   by (fact div_mult_mult1_if)
 
+lemma numeral_times_minus_swap:
+  fixes x:: "'a::comm_ring_1" shows  "numeral w * -x = x * - numeral w"
+  by (simp add: mult.commute)
+
 ML_file "Tools/numeral_simprocs.ML"
 
 simproc_setup semiring_assoc_fold
--- a/src/HOL/Tools/numeral_simprocs.ML	Fri Mar 20 14:48:04 2015 +0100
+++ b/src/HOL/Tools/numeral_simprocs.ML	Fri Mar 20 16:18:28 2015 +0100
@@ -227,7 +227,7 @@
 
 (*combine unary minus with numeric literals, however nested within a product*)
 val mult_minus_simps =
-    [@{thm mult.assoc}, @{thm minus_mult_right}, @{thm minus_mult_commute}];
+    [@{thm mult.assoc}, @{thm minus_mult_right}, @{thm minus_mult_commute}, @{thm numeral_times_minus_swap}];
 
 val norm_ss1 =
   simpset_of (put_simpset num_ss @{context}
@@ -381,7 +381,7 @@
   val norm_ss2 =
     simpset_of (put_simpset HOL_basic_ss @{context} addsimps simps @ mult_minus_simps)
   val norm_ss3 =
-    simpset_of (put_simpset HOL_basic_ss @{context} addsimps @{thms ac_simps minus_mult_commute})
+    simpset_of (put_simpset HOL_basic_ss @{context} addsimps @{thms ac_simps minus_mult_commute numeral_times_minus_swap})
   fun norm_tac ctxt =
     ALLGOALS (simp_tac (put_simpset norm_ss1 ctxt))
     THEN ALLGOALS (simp_tac (put_simpset norm_ss2 ctxt))