left_distrib ~> distrib_right, right_distrib ~> distrib_left
authorfleury <Mathias.Fleury@mpi-inf.mpg.de>
Mon, 19 Sep 2016 20:06:21 +0200
changeset 63918 6bf55e6e0b75
parent 63917 40d1c5e7f407
child 63919 9aed2da07200
left_distrib ~> distrib_right, right_distrib ~> distrib_left
NEWS
src/HOL/Analysis/Bounded_Linear_Function.thy
src/HOL/Analysis/Cartesian_Euclidean_Space.thy
src/HOL/Analysis/Cauchy_Integral_Theorem.thy
src/HOL/Analysis/Complex_Analysis_Basics.thy
src/HOL/Analysis/Complex_Transcendental.thy
src/HOL/Analysis/Conformal_Mappings.thy
src/HOL/Analysis/Convex_Euclidean_Space.thy
src/HOL/Analysis/Derivative.thy
src/HOL/Analysis/Determinants.thy
src/HOL/Analysis/Finite_Cartesian_Product.thy
src/HOL/Analysis/Gamma_Function.thy
src/HOL/Analysis/Henstock_Kurzweil_Integration.thy
src/HOL/Analysis/Homeomorphism.thy
src/HOL/Analysis/L2_Norm.thy
src/HOL/Analysis/Lebesgue_Measure.thy
src/HOL/Analysis/Linear_Algebra.thy
src/HOL/Analysis/Nonnegative_Lebesgue_Integration.thy
src/HOL/Analysis/Poly_Roots.thy
src/HOL/Analysis/Polytope.thy
src/HOL/Analysis/Summation_Tests.thy
src/HOL/Analysis/Weierstrass_Theorems.thy
src/HOL/Analysis/ex/Approximations.thy
src/HOL/Binomial.thy
src/HOL/Decision_Procs/Approximation.thy
src/HOL/Deriv.thy
src/HOL/Groups_Big.thy
src/HOL/Inequalities.thy
src/HOL/Library/BigO.thy
src/HOL/Library/Convex.thy
src/HOL/Library/Extended_Real.thy
src/HOL/Library/Formal_Power_Series.thy
src/HOL/Library/Groups_Big_Fun.thy
src/HOL/Library/Polynomial.thy
src/HOL/Library/Stirling.thy
src/HOL/Metis_Examples/Big_O.thy
src/HOL/Nonstandard_Analysis/HSeries.thy
src/HOL/Probability/Distributions.thy
src/HOL/Probability/Probability_Mass_Function.thy
src/HOL/Probability/Projective_Limit.thy
src/HOL/Probability/ex/Koepf_Duermuth_Countermeasure.thy
src/HOL/Set_Interval.thy
src/HOL/Transcendental.thy
src/HOL/ex/Sum_of_Powers.thy
src/HOL/ex/ThreeDivides.thy
--- a/NEWS	Mon Sep 19 12:53:30 2016 +0200
+++ b/NEWS	Mon Sep 19 20:06:21 2016 +0200
@@ -639,6 +639,11 @@
 one_step_implies_mult instead.
 INCOMPATIBILITY.
 
+* The following theorems have been renamed:
+  setsum_left_distrib ~> setsum_distrib_right
+  setsum_right_distrib ~> setsum_distrib_left
+INCOMPATIBILITY.
+
 * Compound constants INFIMUM and SUPREMUM are mere abbreviations now.
 INCOMPATIBILITY.
 
--- a/src/HOL/Analysis/Bounded_Linear_Function.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Analysis/Bounded_Linear_Function.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -352,7 +352,7 @@
   apply (rule norm_blinfun_bound)
    apply (simp add: setsum_nonneg)
   apply (subst euclidean_representation[symmetric, where 'a='a])
-  apply (simp only: blinfun.bilinear_simps setsum_left_distrib)
+  apply (simp only: blinfun.bilinear_simps setsum_distrib_right)
   apply (rule order.trans[OF norm_setsum setsum_mono])
   apply (simp add: abs_mult mult_right_mono ac_simps Basis_le_norm)
   done
@@ -406,7 +406,7 @@
   "norm (blinfun_of_matrix a) \<le> (\<Sum>i\<in>Basis. \<Sum>j\<in>Basis. \<bar>a i j\<bar>)"
   apply (rule norm_blinfun_bound)
    apply (simp add: setsum_nonneg)
-  apply (simp only: blinfun_of_matrix_apply setsum_left_distrib)
+  apply (simp only: blinfun_of_matrix_apply setsum_distrib_right)
   apply (rule order_trans[OF norm_setsum setsum_mono])
   apply (rule order_trans[OF norm_setsum setsum_mono])
   apply (simp add: abs_mult mult_right_mono ac_simps Basis_le_norm)
--- a/src/HOL/Analysis/Cartesian_Euclidean_Space.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Analysis/Cartesian_Euclidean_Space.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -119,8 +119,8 @@
   val ss1 =
     simpset_of (put_simpset HOL_basic_ss @{context}
       addsimps [@{thm setsum.distrib} RS sym,
-      @{thm setsum_subtractf} RS sym, @{thm setsum_right_distrib},
-      @{thm setsum_left_distrib}, @{thm setsum_negf} RS sym])
+      @{thm setsum_subtractf} RS sym, @{thm setsum_distrib_left},
+      @{thm setsum_distrib_right}, @{thm setsum_negf} RS sym])
   val ss2 =
     simpset_of (@{context} addsimps
              [@{thm plus_vec_def}, @{thm times_vec_def},
@@ -326,7 +326,7 @@
 lemma setsum_cmul:
   fixes f:: "'c \<Rightarrow> ('a::semiring_1)^'n"
   shows "setsum (\<lambda>x. c *s f x) S = c *s setsum f S"
-  by (simp add: vec_eq_iff setsum_right_distrib)
+  by (simp add: vec_eq_iff setsum_distrib_left)
 
 lemma setsum_norm_allsubsets_bound_cart:
   fixes f:: "'a \<Rightarrow> real ^'n"
@@ -517,14 +517,14 @@
   done
 
 lemma matrix_mul_assoc: "A ** (B ** C) = (A ** B) ** C"
-  apply (vector matrix_matrix_mult_def setsum_right_distrib setsum_left_distrib mult.assoc)
+  apply (vector matrix_matrix_mult_def setsum_distrib_left setsum_distrib_right mult.assoc)
   apply (subst setsum.commute)
   apply simp
   done
 
 lemma matrix_vector_mul_assoc: "A *v (B *v x) = (A ** B) *v x"
   apply (vector matrix_matrix_mult_def matrix_vector_mult_def
-    setsum_right_distrib setsum_left_distrib mult.assoc)
+    setsum_distrib_left setsum_distrib_right mult.assoc)
   apply (subst setsum.commute)
   apply simp
   done
@@ -555,7 +555,7 @@
   by (simp add: matrix_vector_mult_def inner_vec_def)
 
 lemma dot_lmul_matrix: "((x::real ^_) v* A) \<bullet> y = x \<bullet> (A *v y)"
-  apply (simp add: inner_vec_def matrix_vector_mult_def vector_matrix_mult_def setsum_left_distrib setsum_right_distrib ac_simps)
+  apply (simp add: inner_vec_def matrix_vector_mult_def vector_matrix_mult_def setsum_distrib_right setsum_distrib_left ac_simps)
   apply (subst setsum.commute)
   apply simp
   done
@@ -630,7 +630,7 @@
 
 lemma matrix_vector_mul_linear: "linear(\<lambda>x. A *v (x::real ^ _))"
   by (simp add: linear_iff matrix_vector_mult_def vec_eq_iff
-      field_simps setsum_right_distrib setsum.distrib)
+      field_simps setsum_distrib_left setsum.distrib)
 
 lemma matrix_works:
   assumes lf: "linear f"
@@ -660,7 +660,7 @@
 lemma adjoint_matrix: "adjoint(\<lambda>x. (A::real^'n^'m) *v x) = (\<lambda>x. transpose A *v x)"
   apply (rule adjoint_unique)
   apply (simp add: transpose_def inner_vec_def matrix_vector_mult_def
-    setsum_left_distrib setsum_right_distrib)
+    setsum_distrib_right setsum_distrib_left)
   apply (subst setsum.commute)
   apply (auto simp add: ac_simps)
   done
--- a/src/HOL/Analysis/Cauchy_Integral_Theorem.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Analysis/Cauchy_Integral_Theorem.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -6215,7 +6215,7 @@
         by (metis (no_types) dist_norm divide_eq_1_iff less_irrefl mem_ball norm_minus_commute r w)
       have "norm ((\<Sum>k<N. (w - z) ^ k * f u / (u - z) ^ Suc k) * (u - w) - f u)
             = norm ((\<Sum>k<N. (((w - z) / (u - z)) ^ k)) * f u * (u - w) / (u - z) - f u)"
-        unfolding setsum_left_distrib setsum_divide_distrib power_divide by (simp add: algebra_simps)
+        unfolding setsum_distrib_right setsum_divide_distrib power_divide by (simp add: algebra_simps)
       also have "... = norm ((((w - z) / (u - z)) ^ N - 1) * (u - w) / (((w - z) / (u - z) - 1) * (u - z)) - 1) * norm (f u)"
         using \<open>0 < B\<close>
         apply (auto simp: geometric_sum [OF wzu_not1])
--- a/src/HOL/Analysis/Complex_Analysis_Basics.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Analysis/Complex_Analysis_Basics.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -951,7 +951,7 @@
       then have "cmod h * cmod ((\<Sum>i<n. f' i y) - g' y) \<le> cmod h * e"
         by (auto simp: antisym_conv2 mult_le_cancel_left norm_triangle_ineq2)
       then show "cmod ((\<Sum>i<n. h * f' i y) - g' y * h) \<le> e * cmod h"
-        by (simp add: norm_mult [symmetric] field_simps setsum_right_distrib)
+        by (simp add: norm_mult [symmetric] field_simps setsum_distrib_left)
     qed
   } note ** = this
   show ?thesis
--- a/src/HOL/Analysis/Complex_Transcendental.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Analysis/Complex_Transcendental.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -597,7 +597,7 @@
 text\<open>32-bit Approximation to e\<close>
 lemma e_approx_32: "\<bar>exp(1) - 5837465777 / 2147483648\<bar> \<le> (inverse(2 ^ 32)::real)"
   using Taylor_exp [of 1 14] exp_le
-  apply (simp add: setsum_left_distrib in_Reals_norm Re_exp atMost_nat_numeral fact_numeral)
+  apply (simp add: setsum_distrib_right in_Reals_norm Re_exp atMost_nat_numeral fact_numeral)
   apply (simp only: pos_le_divide_eq [symmetric], linarith)
   done
 
--- a/src/HOL/Analysis/Conformal_Mappings.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Analysis/Conformal_Mappings.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -2846,7 +2846,7 @@
         qed
     qed
   also have "... = c * (\<Sum>p\<in>pts. winding_number g p * residue f p)"
-    by (simp add: setsum_right_distrib algebra_simps)
+    by (simp add: setsum_distrib_left algebra_simps)
   finally show ?thesis unfolding c_def .
 qed
 
@@ -3459,7 +3459,7 @@
             qed
         qed
       then have "(\<Sum>p\<in>zeros. w p * cont p) = c * (\<Sum>p\<in>zeros.  w p *  h p * zorder f p)"
-        apply (subst setsum_right_distrib)
+        apply (subst setsum_distrib_left)
         by (simp add:algebra_simps)
       moreover have "(\<Sum>p\<in>poles. w p * cont p) = (\<Sum>p\<in>poles.  - c * w p *  h p * porder f p)"
         proof (rule setsum.cong[of poles poles,simplified])
@@ -3479,7 +3479,7 @@
             qed
         qed
       then have "(\<Sum>p\<in>poles. w p * cont p) = - c * (\<Sum>p\<in>poles. w p *  h p * porder f p)"
-        apply (subst setsum_right_distrib)
+        apply (subst setsum_distrib_left)
         by (simp add:algebra_simps)
       ultimately show ?thesis by (simp add: right_diff_distrib)
     qed
--- a/src/HOL/Analysis/Convex_Euclidean_Space.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Analysis/Convex_Euclidean_Space.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -523,7 +523,7 @@
         qed auto
         then show ?thesis
           apply (rule_tac IA[of "s - {x}" "\<lambda>y. (inverse (1 - u x) * u y)"])
-          unfolding setsum_right_distrib[symmetric]
+          unfolding setsum_distrib_left[symmetric]
           using as and *** and True
           apply auto
           done
@@ -536,7 +536,7 @@
         then show ?thesis
           using as(3)[THEN bspec[where x=a], THEN bspec[where x=b]]
           using *** *(2) and \<open>s \<subseteq> V\<close>
-          unfolding setsum_right_distrib
+          unfolding setsum_distrib_left
           by (auto simp add: setsum_clauses(2))
       qed
       then have "u x + (1 - u x) = 1 \<Longrightarrow>
@@ -619,7 +619,7 @@
       unfolding scaleR_left_distrib setsum.distrib if_smult scaleR_zero_left
         ** setsum.inter_restrict[OF xy, symmetric]
       unfolding scaleR_scaleR[symmetric] Real_Vector_Spaces.scaleR_right.setsum [symmetric]
-        and setsum_right_distrib[symmetric]
+        and setsum_distrib_left[symmetric]
       unfolding x y
       using x(1-3) y(1-3) uv
       apply simp
@@ -1323,7 +1323,7 @@
     apply (rule_tac x="s - {v}" in exI)
     apply (rule_tac x="\<lambda>x. - (1 / u v) * u x" in exI)
     unfolding scaleR_scaleR[symmetric] and scaleR_right.setsum [symmetric]
-    unfolding setsum_right_distrib[symmetric] and setsum_diff1[OF as(1)]
+    unfolding setsum_distrib_left[symmetric] and setsum_diff1[OF as(1)]
     using as
     apply auto
     done
@@ -1793,7 +1793,7 @@
     apply rule
     unfolding * and setsum.If_cases[OF finite_atLeastAtMost[of 1 "k1 + k2"]] and
       setsum.reindex[OF inj] and o_def Collect_mem_eq
-    unfolding scaleR_scaleR[symmetric] scaleR_right.setsum [symmetric] setsum_right_distrib[symmetric]
+    unfolding scaleR_scaleR[symmetric] scaleR_right.setsum [symmetric] setsum_distrib_left[symmetric]
   proof -
     fix i
     assume i: "i \<in> {1..k1+k2}"
@@ -1844,7 +1844,7 @@
   }
   moreover
   have "(\<Sum>x\<in>s. u * ux x + v * uy x) = 1"
-    unfolding setsum.distrib and setsum_right_distrib[symmetric] and ux(2) uy(2)
+    unfolding setsum.distrib and setsum_distrib_left[symmetric] and ux(2) uy(2)
     using uv(3) by auto
   moreover
   have "(\<Sum>x\<in>s. (u * ux x + v * uy x) *\<^sub>R x) = u *\<^sub>R (\<Sum>x\<in>s. ux x *\<^sub>R x) + v *\<^sub>R (\<Sum>x\<in>s. uy x *\<^sub>R x)"
@@ -3306,7 +3306,7 @@
     have *: "\<And>f. setsum f (s - {a}) = setsum f s - ((f a)::'b::ab_group_add)"
       unfolding setsum.remove[OF obt(1) \<open>a\<in>s\<close>] by auto
     have "(\<Sum>v\<in>s. u v + t * w v) = 1"
-      unfolding setsum.distrib wv(1) setsum_right_distrib[symmetric] obt(5) by auto
+      unfolding setsum.distrib wv(1) setsum_distrib_left[symmetric] obt(5) by auto
     moreover have "(\<Sum>v\<in>s. u v *\<^sub>R v + (t * w v) *\<^sub>R v) - (u a *\<^sub>R a + (t * w a) *\<^sub>R a) = y"
       unfolding setsum.distrib obt(6) scaleR_scaleR[symmetric] scaleR_right.setsum [symmetric] wv(4)
       using a(2) [THEN eq_neg_iff_add_eq_0 [THEN iffD2]] by simp
@@ -5279,7 +5279,7 @@
     apply (rule_tac x="{v \<in> c. u v < 0}" in exI)
     apply (rule_tac x="\<lambda>y. inverse (setsum u {x\<in>c. u x > 0}) * - u y" in exI)
     using assms(1) unfolding scaleR_scaleR[symmetric] scaleR_right.setsum [symmetric] and z_def
-    apply (auto simp add: setsum_negf setsum_right_distrib[symmetric])
+    apply (auto simp add: setsum_negf setsum_distrib_left[symmetric])
     done
   moreover have "\<forall>x\<in>{v \<in> c. 0 < u v}. 0 \<le> inverse (setsum u {x \<in> c. 0 < u x}) * u x"
     apply rule
@@ -5294,7 +5294,7 @@
     using assms(1)
     unfolding scaleR_scaleR[symmetric] scaleR_right.setsum [symmetric] and z_def
     using *
-    apply (auto simp add: setsum_negf setsum_right_distrib[symmetric])
+    apply (auto simp add: setsum_negf setsum_distrib_left[symmetric])
     done
   ultimately show ?thesis
     apply (rule_tac x="{v\<in>c. u v \<le> 0}" in exI)
@@ -5683,7 +5683,7 @@
     unfolding convex_hull_indexed mem_Collect_eq by auto
   have "(\<Sum>i = 1..k. u i * f (v i)) \<le> b"
     using setsum_mono[of "{1..k}" "\<lambda>i. u i * f (v i)" "\<lambda>i. u i * b"]
-    unfolding setsum_left_distrib[symmetric] obt(2) mult_1
+    unfolding setsum_distrib_right[symmetric] obt(2) mult_1
     apply (drule_tac meta_mp)
     apply (rule mult_left_mono)
     using assms(2) obt(1)
@@ -9200,9 +9200,9 @@
     have ge0: "\<forall>i\<in>I. e i \<ge> 0"
       using e_def xc yc uv by simp
     have "setsum (\<lambda>i. u * c i) I = u * setsum c I"
-      by (simp add: setsum_right_distrib)
+      by (simp add: setsum_distrib_left)
     moreover have "setsum (\<lambda>i. v * d i) I = v * setsum d I"
-      by (simp add: setsum_right_distrib)
+      by (simp add: setsum_distrib_left)
     ultimately have sum1: "setsum e I = 1"
       using e_def xc yc uv by (simp add: setsum.distrib)
     define q where "q i = (if e i = 0 then p i else (u * c i / e i) *\<^sub>R s i + (v * d i / e i) *\<^sub>R t i)"
@@ -11857,7 +11857,7 @@
   have sum_dd0: "setsum dd S = 0"
     unfolding dd_def  using S
     by (simp add: sumSS' comm_monoid_add_class.setsum.distrib setsum_subtractf
-                  algebra_simps setsum_left_distrib [symmetric] b1)
+                  algebra_simps setsum_distrib_right [symmetric] b1)
   have "(\<Sum>v\<in>S. (b v * x) *\<^sub>R v) = x *\<^sub>R (\<Sum>v\<in>S. b v *\<^sub>R v)" for x
     by (simp add: pth_5 real_vector.scale_setsum_right mult.commute)
   then have *: "(\<Sum>v\<in>S. (b v * x) *\<^sub>R v) = x *\<^sub>R a" for x
--- a/src/HOL/Analysis/Derivative.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Analysis/Derivative.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -2244,7 +2244,7 @@
     {
       fix n :: nat and x h :: 'a assume nx: "n \<ge> N" "x \<in> s"
       have "norm ((\<Sum>i<n. f' i x * h) - g' x * h) = norm ((\<Sum>i<n. f' i x) - g' x) * norm h"
-        by (simp add: norm_mult [symmetric] ring_distribs setsum_left_distrib)
+        by (simp add: norm_mult [symmetric] ring_distribs setsum_distrib_right)
       also from N[OF nx] have "norm ((\<Sum>i<n. f' i x) - g' x) \<le> e" by simp
       hence "norm ((\<Sum>i<n. f' i x) - g' x) * norm h \<le> e * norm h"
         by (intro mult_right_mono) simp_all
--- a/src/HOL/Analysis/Determinants.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Analysis/Determinants.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -226,7 +226,7 @@
   fixes A :: "'a::comm_ring_1^'n^'n"
   assumes p: "p permutes (UNIV :: 'n::finite set)"
   shows "det (\<chi> i. A$p i :: 'a^'n^'n) = of_int (sign p) * det A"
-  apply (simp add: det_def setsum_right_distrib mult.assoc[symmetric])
+  apply (simp add: det_def setsum_distrib_left mult.assoc[symmetric])
   apply (subst sum_permutations_compose_right[OF p])
 proof (rule setsum.cong)
   let ?U = "UNIV :: 'n set"
@@ -372,7 +372,7 @@
   fixes a b :: "'n::finite \<Rightarrow> _ ^ 'n"
   shows "det((\<chi> i. if i = k then c *s a i else b i)::'a::comm_ring_1^'n^'n) =
     c * det((\<chi> i. if i = k then a i else b i)::'a::comm_ring_1^'n^'n)"
-  unfolding det_def vec_lambda_beta setsum_right_distrib
+  unfolding det_def vec_lambda_beta setsum_distrib_left
 proof (rule setsum.cong)
   let ?U = "UNIV :: 'n set"
   let ?pU = "{p. p permutes ?U}"
@@ -645,7 +645,7 @@
 lemma det_rows_mul:
   "det((\<chi> i. c i *s a i)::'a::comm_ring_1^'n^'n) =
     setprod (\<lambda>i. c i) (UNIV:: 'n set) * det((\<chi> i. a i)::'a^'n^'n)"
-proof (simp add: det_def setsum_right_distrib cong add: setprod.cong, rule setsum.cong)
+proof (simp add: det_def setsum_distrib_left cong add: setprod.cong, rule setsum.cong)
   let ?U = "UNIV :: 'n set"
   let ?PU = "{p. p permutes ?U}"
   fix p
--- a/src/HOL/Analysis/Finite_Cartesian_Product.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Analysis/Finite_Cartesian_Product.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -461,7 +461,7 @@
     by (simp add: inner_add_left setsum.distrib)
   show "inner (scaleR r x) y = r * inner x y"
     unfolding inner_vec_def
-    by (simp add: setsum_right_distrib)
+    by (simp add: setsum_distrib_left)
   show "0 \<le> inner x x"
     unfolding inner_vec_def
     by (simp add: setsum_nonneg)
--- a/src/HOL/Analysis/Gamma_Function.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Analysis/Gamma_Function.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -450,7 +450,7 @@
       (\<Sum>k=Suc m..n. 2 * (norm t + (norm t)\<^sup>2) / (real_of_nat k)\<^sup>2)" using t_nz N(2) mn norm_t
       by (intro order.trans[OF norm_setsum setsum_mono[OF ln_Gamma_series_complex_converges_aux]]) simp_all
     also have "... \<le> 2 * (norm t + norm t^2) * (\<Sum>k=Suc m..n. 1 / (of_nat k)\<^sup>2)"
-      by (simp add: setsum_right_distrib)
+      by (simp add: setsum_distrib_left)
     also have "... < 2 * (norm t + norm t^2) * e'" using mn z t_nz
       by (intro mult_strict_left_mono N mult_pos_pos add_pos_pos) simp_all
     also from e''_pos have "... = e * ((cmod t + (cmod t)\<^sup>2) / e'')"
@@ -543,7 +543,7 @@
       by (subst atLeast0LessThan [symmetric], subst setsum_shift_bounds_Suc_ivl [symmetric],
           subst atLeastLessThanSuc_atLeastAtMost) simp_all
     also have "\<dots> = z * of_real (harm n) - (\<Sum>k=1..n. ln (1 + z / of_nat k))"
-      by (simp add: harm_def setsum_subtractf setsum_right_distrib divide_inverse)
+      by (simp add: harm_def setsum_subtractf setsum_distrib_left divide_inverse)
     also from n have "\<dots> - ?g n = 0"
       by (simp add: ln_Gamma_series_def setsum_subtractf algebra_simps Ln_of_nat)
     finally show "(\<Sum>k<n. ?f k) - ?g n = 0" .
@@ -944,7 +944,7 @@
       using z' n by (intro uniformly_convergent_mult Polygamma_converges) (simp_all add: n'_def)
     thus "uniformly_convergent_on (ball z d)
               (\<lambda>k z. \<Sum>i<k. - of_nat n' * inverse ((z + of_nat i :: 'a) ^ (n'+1)))"
-      by (subst (asm) setsum_right_distrib) simp
+      by (subst (asm) setsum_distrib_left) simp
   qed (insert Polygamma_converges'[OF z' n'] d, simp_all)
   also have "(\<Sum>k. - of_nat n' * inverse ((z + of_nat k) ^ (n' + 1))) =
                (- of_nat n') * (\<Sum>k. inverse ((z + of_nat k) ^ (n' + 1)))"
@@ -2573,7 +2573,7 @@
 proof -
   have "(\<Prod>k=1..n. exp (z * of_real (ln (1 + 1 / of_nat k)))) =
           exp (z * of_real (\<Sum>k = 1..n. ln (1 + 1 / real_of_nat k)))"
-    by (subst exp_setsum [symmetric]) (simp_all add: setsum_right_distrib)
+    by (subst exp_setsum [symmetric]) (simp_all add: setsum_distrib_left)
   also have "(\<Sum>k=1..n. ln (1 + 1 / of_nat k) :: real) = ln (\<Prod>k=1..n. 1 + 1 / real_of_nat k)"
     by (subst ln_setprod [symmetric]) (auto intro!: add_pos_nonneg)
   also have "(\<Prod>k=1..n. 1 + 1 / of_nat k :: real) = (\<Prod>k=1..n. (of_nat k + 1) / of_nat k)"
--- a/src/HOL/Analysis/Henstock_Kurzweil_Integration.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Analysis/Henstock_Kurzweil_Integration.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -3756,7 +3756,7 @@
   have "norm (setsum (\<lambda>l. content l *\<^sub>R c) p) \<le> (\<Sum>i\<in>p. norm (content i *\<^sub>R c))"
     using norm_setsum by blast
   also have "...  \<le> e * (\<Sum>i\<in>p. \<bar>content i\<bar>)"
-    by (simp add: setsum_right_distrib[symmetric] mult.commute assms(2) mult_right_mono setsum_nonneg)
+    by (simp add: setsum_distrib_left[symmetric] mult.commute assms(2) mult_right_mono setsum_nonneg)
   also have "... \<le> e * content (cbox a b)"
     apply (rule mult_left_mono [OF _ e])
     apply (simp add: sumeq)
@@ -3792,7 +3792,7 @@
     apply (rule order_trans[OF setsum_mono])
     apply (rule mult_left_mono[OF _ abs_ge_zero, of _ e])
     apply (metis norm)
-    unfolding setsum_left_distrib[symmetric]
+    unfolding setsum_distrib_right[symmetric]
     using con setsum_le
     apply (auto simp: mult.commute intro: mult_left_mono [OF _ e])
     done
@@ -4697,7 +4697,7 @@
         done
       have "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - 0) \<le> setsum (\<lambda>i. (real i + 1) *
         norm (setsum (\<lambda>(x,k). content k *\<^sub>R indicator s x :: real) (q i))) {..N+1}"
-        unfolding real_norm_def setsum_right_distrib abs_of_nonneg[OF *] diff_0_right
+        unfolding real_norm_def setsum_distrib_left abs_of_nonneg[OF *] diff_0_right
         apply (rule order_trans)
         apply (rule norm_setsum)
         apply (subst sum_sum_product)
@@ -4775,7 +4775,7 @@
           done
       qed
       also have "\<dots> < e * inverse 2 * 2"
-        unfolding divide_inverse setsum_right_distrib[symmetric]
+        unfolding divide_inverse setsum_distrib_left[symmetric]
         apply (rule mult_strict_left_mono)
         unfolding power_inverse [symmetric] lessThan_Suc_atMost[symmetric]
         apply (subst geometric_sum)
@@ -5313,7 +5313,7 @@
     show "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f' x) - (f b - f a)) \<le> e * content (cbox a b)"
       unfolding content_real[OF assms(1), simplified box_real[symmetric]] additive_tagged_division_1[OF assms(1) as(1)[simplified box_real],of f,symmetric]
       unfolding additive_tagged_division_1[OF assms(1) as(1)[simplified box_real],of "\<lambda>x. x",symmetric]
-      unfolding setsum_right_distrib
+      unfolding setsum_distrib_left
       defer
       unfolding setsum_subtractf[symmetric]
     proof (rule setsum_norm_le,safe)
@@ -6479,7 +6479,7 @@
       by arith
     show ?case
       unfolding content_real[OF assms(1)] and *[of "\<lambda>x. x"] *[of f] setsum_subtractf[symmetric] split_minus
-      unfolding setsum_right_distrib
+      unfolding setsum_distrib_left
       apply (subst(2) pA)
       apply (subst pA)
       unfolding setsum.union_disjoint[OF pA(2-)]
@@ -6548,7 +6548,7 @@
         apply (unfold split_paired_all split_conv)
         defer
         unfolding setsum.union_disjoint[OF pA(2-),symmetric] pA(1)[symmetric]
-        unfolding setsum_right_distrib[symmetric]
+        unfolding setsum_distrib_left[symmetric]
         apply (subst additive_tagged_division_1[OF _ as(1)])
         apply (rule assms)
       proof -
@@ -8856,7 +8856,7 @@
       apply rule
       apply (drule qq)
       defer
-      unfolding divide_inverse setsum_left_distrib[symmetric]
+      unfolding divide_inverse setsum_distrib_right[symmetric]
       unfolding divide_inverse[symmetric]
       using * apply (auto simp add: field_simps)
       done
@@ -8976,7 +8976,7 @@
     done
   have th: "op ^ x \<circ> op + m = (\<lambda>i. x^m * x^i)"
     by (rule ext) (simp add: power_add power_mult)
-  from setsum.reindex[OF i, of "op ^ x", unfolded f th setsum_right_distrib[symmetric]]
+  from setsum.reindex[OF i, of "op ^ x", unfolded f th setsum_distrib_left[symmetric]]
   have "?lhs = x^m * ((1 - x) * setsum (op ^ x) {0..n - m})"
     by simp
   then show ?thesis
@@ -9164,7 +9164,7 @@
           apply (rule norm_setsum)
           apply (rule setsum_mono)
           unfolding split_paired_all split_conv
-          unfolding split_def setsum_left_distrib[symmetric] scaleR_diff_right[symmetric]
+          unfolding split_def setsum_distrib_right[symmetric] scaleR_diff_right[symmetric]
           unfolding additive_content_tagged_division[OF p(1), unfolded split_def]
         proof -
           fix x k
@@ -9201,7 +9201,7 @@
           proof
             show "(\<Sum>i = 0..s. e / 2 ^ (i + 2)) < e / 2"
               unfolding power_add divide_inverse inverse_mult_distrib
-              unfolding setsum_right_distrib[symmetric] setsum_left_distrib[symmetric]
+              unfolding setsum_distrib_left[symmetric] setsum_distrib_right[symmetric]
               unfolding power_inverse [symmetric] sum_gp
               apply(rule mult_strict_left_mono[OF _ e])
               unfolding power2_eq_square
@@ -10350,7 +10350,7 @@
               by auto
           qed
           finally show "(\<Sum>i\<in>d. \<bar>content (l \<inter> i)\<bar> * norm (f x)) = content l *\<^sub>R norm (f x)"
-            unfolding setsum_left_distrib[symmetric] real_scaleR_def
+            unfolding setsum_distrib_right[symmetric] real_scaleR_def
             apply (subst(asm) additive_content_division[OF division_inter_1[OF d(1)]])
             using xl(2)[unfolded uv]
             unfolding uv
@@ -10614,7 +10614,7 @@
   proof goal_cases
     case prems: (2 d)
     have "(\<Sum>k\<in>d. norm (integral k (h \<circ> f))) \<le> setsum (\<lambda>k. norm(integral k f)) d * b"
-      unfolding setsum_left_distrib
+      unfolding setsum_distrib_right
       apply (rule setsum_mono)
     proof goal_cases
       case (1 k)
--- a/src/HOL/Analysis/Homeomorphism.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Analysis/Homeomorphism.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -1007,7 +1007,7 @@
   have gf[simp]: "g (f x) = x" for x
     apply (rule euclidean_eqI)
     apply (simp add: f_def g_def inner_setsum_left scaleR_setsum_left algebra_simps)
-    apply (simp add: Groups_Big.setsum_right_distrib [symmetric] *)
+    apply (simp add: Groups_Big.setsum_distrib_left [symmetric] *)
     done
   then have "inj f" by (metis injI)
   have gfU: "g ` f ` U = U"
--- a/src/HOL/Analysis/L2_Norm.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Analysis/L2_Norm.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -58,7 +58,7 @@
   "0 \<le> r \<Longrightarrow> r * setL2 f A = setL2 (\<lambda>x. r * f x) A"
   unfolding setL2_def
   apply (simp add: power_mult_distrib)
-  apply (simp add: setsum_right_distrib [symmetric])
+  apply (simp add: setsum_distrib_left [symmetric])
   apply (simp add: real_sqrt_mult setsum_nonneg)
   done
 
@@ -66,7 +66,7 @@
   "0 \<le> r \<Longrightarrow> setL2 f A * r = setL2 (\<lambda>x. f x * r) A"
   unfolding setL2_def
   apply (simp add: power_mult_distrib)
-  apply (simp add: setsum_left_distrib [symmetric])
+  apply (simp add: setsum_distrib_right [symmetric])
   apply (simp add: real_sqrt_mult setsum_nonneg)
   done
 
--- a/src/HOL/Analysis/Lebesgue_Measure.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Analysis/Lebesgue_Measure.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -235,7 +235,7 @@
       by auto
     also have "... = (\<Sum>i \<in> S. F(r i) - F(l i)) +
         (epsilon / 4) * (\<Sum>i \<in> S. (1 / 2)^i)" (is "_ = ?t + _")
-      by (subst setsum.distrib) (simp add: field_simps setsum_right_distrib)
+      by (subst setsum.distrib) (simp add: field_simps setsum_distrib_left)
     also have "... \<le> ?t + (epsilon / 4) * (\<Sum> i < Suc n. (1 / 2)^i)"
       apply (rule add_left_mono)
       apply (rule mult_left_mono)
--- a/src/HOL/Analysis/Linear_Algebra.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Analysis/Linear_Algebra.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -1960,7 +1960,7 @@
     qed
     from setsum_norm_le[of _ ?g, OF th]
     show "norm (f x) \<le> ?B * norm x"
-      unfolding th0 setsum_left_distrib by metis
+      unfolding th0 setsum_distrib_right by metis
   qed
 qed
 
@@ -2021,7 +2021,7 @@
     unfolding bilinear_setsum[OF bh finite_Basis finite_Basis] ..
   finally have th: "norm (h x y) = \<dots>" .
   show "norm (h x y) \<le> (\<Sum>i\<in>Basis. \<Sum>j\<in>Basis. norm (h i j)) * norm x * norm y"
-    apply (auto simp add: setsum_left_distrib th setsum.cartesian_product)
+    apply (auto simp add: setsum_distrib_right th setsum.cartesian_product)
     apply (rule setsum_norm_le)
     apply simp
     apply (auto simp add: bilinear_rmul[OF bh] bilinear_lmul[OF bh]
--- a/src/HOL/Analysis/Nonnegative_Lebesgue_Integration.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Analysis/Nonnegative_Lebesgue_Integration.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -550,7 +550,7 @@
   qed
   also have "\<dots> = (\<Sum>y\<in>f`space M. (\<Sum>z\<in>g`space M.
       if \<exists>x\<in>space M. y = f x \<and> z = g x then y * emeasure M {x\<in>space M. g x = z} else 0))"
-    by (auto intro!: setsum.cong simp: setsum_right_distrib)
+    by (auto intro!: setsum.cong simp: setsum_distrib_left)
   also have "\<dots> = ?r"
     by (subst setsum.commute)
        (auto intro!: setsum.cong simp: setsum.If_cases scaleR_setsum_right[symmetric] eq)
@@ -592,7 +592,7 @@
     using f by (intro simple_function_partition) auto
   also have "\<dots> = c * integral\<^sup>S M f"
     using f unfolding simple_integral_def
-    by (subst setsum_right_distrib) (auto simp: mult.assoc Int_def conj_commute)
+    by (subst setsum_distrib_left) (auto simp: mult.assoc Int_def conj_commute)
   finally show ?thesis .
 qed
 
--- a/src/HOL/Analysis/Poly_Roots.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Analysis/Poly_Roots.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -24,7 +24,7 @@
 lemma setsum_power_add:
   fixes x :: "'a::{comm_ring,monoid_mult}"
   shows "(\<Sum>i\<in>I. x^(m+i)) = x^m * (\<Sum>i\<in>I. x^i)"
-  by (simp add: setsum_right_distrib power_add)
+  by (simp add: setsum_distrib_left power_add)
 
 lemma setsum_power_shift:
   fixes x :: "'a::{comm_ring,monoid_mult}"
@@ -32,7 +32,7 @@
   shows "(\<Sum>i=m..n. x^i) = x^m * (\<Sum>i\<le>n-m. x^i)"
 proof -
   have "(\<Sum>i=m..n. x^i) = x^m * (\<Sum>i=m..n. x^(i-m))"
-    by (simp add: setsum_right_distrib power_add [symmetric])
+    by (simp add: setsum_distrib_left power_add [symmetric])
   also have "(\<Sum>i=m..n. x^(i-m)) = (\<Sum>i\<le>n-m. x^i)"
     using \<open>m \<le> n\<close> by (intro setsum.reindex_bij_witness[where j="\<lambda>i. i - m" and i="\<lambda>i. i + m"]) auto
   finally show ?thesis .
@@ -88,7 +88,7 @@
   also have "... = (\<Sum>i\<le>n. a i * (x - y) * (\<Sum>j<i. y^(i - Suc j) * x^j))"
     by (simp add: power_diff_sumr2 ac_simps)
   also have "... = (x - y) * (\<Sum>i\<le>n. (\<Sum>j<i. a i * y^(i - Suc j) * x^j))"
-    by (simp add: setsum_right_distrib ac_simps)
+    by (simp add: setsum_distrib_left ac_simps)
   also have "... = (x - y) * (\<Sum>j<n. (\<Sum>i=Suc j..n. a i * y^(i - Suc j) * x^j))"
     by (simp add: nested_setsum_swap')
   finally show ?thesis .
@@ -115,7 +115,7 @@
   { fix z
     have "(\<Sum>i\<le>n. c i * z^i) - (\<Sum>i\<le>n. c i * a^i) =
           (z - a) * (\<Sum>j<n. (\<Sum>k = Suc j..n. c k * a^(k - Suc j)) * z^j)"
-      by (simp add: sub_polyfun setsum_left_distrib)
+      by (simp add: sub_polyfun setsum_distrib_right)
     then have "(\<Sum>i\<le>n. c i * z^i) =
           (z - a) * (\<Sum>j<n. (\<Sum>k = Suc j..n. c k * a^(k - Suc j)) * z^j)
           + (\<Sum>i\<le>n. c i * a^i)"
--- a/src/HOL/Analysis/Polytope.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Analysis/Polytope.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -303,7 +303,7 @@
     have cge0: "\<And>i. i \<in> S \<Longrightarrow> 0 \<le> c i"
       using a b u01 by (simp add: c_def)
     have sumc1: "setsum c S = 1"
-      by (simp add: c_def setsum.distrib setsum_right_distrib [symmetric] asum bsum)
+      by (simp add: c_def setsum.distrib setsum_distrib_left [symmetric] asum bsum)
     have sumci_xy: "(\<Sum>i\<in>S. c i *\<^sub>R i) = (1 - u) *\<^sub>R x + u *\<^sub>R y"
       apply (simp add: c_def setsum.distrib scaleR_left_distrib)
       by (simp only: scaleR_scaleR [symmetric] Real_Vector_Spaces.scaleR_right.setsum [symmetric] aeqx beqy)
@@ -357,7 +357,7 @@
           apply (rule_tac x="\<lambda>i. inverse (1-k) * c i" in exI)
           apply auto
           apply (metis sumcf cge0 inverse_nonnegative_iff_nonnegative mult_nonneg_nonneg S(2) setsum_nonneg subsetCE)
-          apply (metis False mult.commute right_inverse right_minus_eq setsum_right_distrib sumcf)
+          apply (metis False mult.commute right_inverse right_minus_eq setsum_distrib_left sumcf)
           by (metis (mono_tags, lifting) scaleR_right.setsum scaleR_scaleR setsum.cong)
         with \<open>0 < k\<close>  have "inverse(k) *\<^sub>R (w - setsum (\<lambda>i. c i *\<^sub>R i) T) \<in> affine hull T"
           by (simp add: affine_diff_divide [OF affine_affine_hull] False waff convex_hull_subset_affine_hull [THEN subsetD])
@@ -365,7 +365,7 @@
           apply (simp add: weq_sumsum convex_hull_finite fin)
           apply (rule_tac x="\<lambda>i. inverse k * c i" in exI)
           using \<open>k > 0\<close> cge0
-          apply (auto simp: scaleR_right.setsum setsum_right_distrib [symmetric] k_def [symmetric])
+          apply (auto simp: scaleR_right.setsum setsum_distrib_left [symmetric] k_def [symmetric])
           done
         ultimately show ?thesis
           using disj by blast
--- a/src/HOL/Analysis/Summation_Tests.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Analysis/Summation_Tests.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -288,7 +288,7 @@
     qed
     from this and A have "Bseq (\<lambda>n. \<Sum>k<n. 2^k * f (2^Suc k))" by (rule Bseq_eventually_mono)
     from Bseq_mult[OF Bfun_const[of 2] this] have "Bseq (\<lambda>n. \<Sum>k<n. 2^Suc k * f (2^Suc k))"
-      by (simp add: setsum_right_distrib setsum_left_distrib mult_ac)
+      by (simp add: setsum_distrib_left setsum_distrib_right mult_ac)
     hence "Bseq (\<lambda>n. (\<Sum>k=Suc 0..<Suc n. 2^k * f (2^k)) + f 1)"
       by (intro Bseq_add, subst setsum_shift_bounds_Suc_ivl) (simp add: atLeast0LessThan)
     hence "Bseq (\<lambda>n. (\<Sum>k=0..<Suc n. 2^k * f (2^k)))"
@@ -424,7 +424,7 @@
     have n: "n > m" by (simp add: n_def)
 
     from r have "r * norm (\<Sum>k\<le>n. f k) = norm (\<Sum>k\<le>n. r * f k)"
-      by (simp add: setsum_right_distrib[symmetric] abs_mult)
+      by (simp add: setsum_distrib_left[symmetric] abs_mult)
     also from n have "{..n} = {..m} \<union> {Suc m..n}" by auto
     hence "(\<Sum>k\<le>n. r * f k) = (\<Sum>k\<in>{..m} \<union> {Suc m..n}. r * f k)" by (simp only:)
     also have "\<dots> = (\<Sum>k\<le>m. r * f k) + (\<Sum>k=Suc m..n. r * f k)"
--- a/src/HOL/Analysis/Weierstrass_Theorems.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Analysis/Weierstrass_Theorems.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -38,7 +38,7 @@
 
 lemma sum_k_Bernstein [simp]: "(\<Sum>k = 0..n. real k * Bernstein n k x) = of_nat n * x"
   apply (subst binomial_deriv1 [of n x "1-x", simplified, symmetric])
-  apply (simp add: setsum_left_distrib)
+  apply (simp add: setsum_distrib_right)
   apply (auto simp: Bernstein_def algebra_simps realpow_num_eq_if intro!: setsum.cong)
   done
 
@@ -46,7 +46,7 @@
 proof -
   have "(\<Sum> k = 0..n. real k * (real k - 1) * Bernstein n k x) = real_of_nat n * real_of_nat (n - Suc 0) * x\<^sup>2"
     apply (subst binomial_deriv2 [of n x "1-x", simplified, symmetric])
-    apply (simp add: setsum_left_distrib)
+    apply (simp add: setsum_distrib_right)
     apply (rule setsum.cong [OF refl])
     apply (simp add: Bernstein_def power2_eq_square algebra_simps)
     apply (rename_tac k)
@@ -98,7 +98,7 @@
         by (simp add: algebra_simps power2_eq_square)
       have "(\<Sum> k = 0..n. (k - n * x)\<^sup>2 * Bernstein n k x) = n * x * (1 - x)"
         apply (simp add: * setsum.distrib)
-        apply (simp add: setsum_right_distrib [symmetric] mult.assoc)
+        apply (simp add: setsum_distrib_left [symmetric] mult.assoc)
         apply (simp add: algebra_simps power2_eq_square)
         done
       then have "(\<Sum> k = 0..n. (k - n * x)\<^sup>2 * Bernstein n k x)/n^2 = x * (1 - x) / n"
@@ -138,14 +138,14 @@
         qed
     } note * = this
     have "\<bar>f x - (\<Sum> k = 0..n. f(k / n) * Bernstein n k x)\<bar> \<le> \<bar>\<Sum> k = 0..n. (f x - f(k / n)) * Bernstein n k x\<bar>"
-      by (simp add: setsum_subtractf setsum_right_distrib [symmetric] algebra_simps)
+      by (simp add: setsum_subtractf setsum_distrib_left [symmetric] algebra_simps)
     also have "... \<le> (\<Sum> k = 0..n. (e/2 + (2 * M / d\<^sup>2) * (x - k / n)\<^sup>2) * Bernstein n k x)"
       apply (rule order_trans [OF setsum_abs setsum_mono])
       using *
       apply (simp add: abs_mult Bernstein_nonneg x mult_right_mono)
       done
     also have "... \<le> e/2 + (2 * M) / (d\<^sup>2 * n)"
-      apply (simp only: setsum.distrib Rings.semiring_class.distrib_right setsum_right_distrib [symmetric] mult.assoc sum_bern)
+      apply (simp only: setsum.distrib Rings.semiring_class.distrib_right setsum_distrib_left [symmetric] mult.assoc sum_bern)
       using \<open>d>0\<close> x
       apply (simp add: divide_simps Mge0 mult_le_one mult_left_le)
       done
--- a/src/HOL/Analysis/ex/Approximations.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Analysis/ex/Approximations.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -30,7 +30,7 @@
       by (subst atLeast0LessThan [symmetric], subst setsum_head_upt_Suc) simp_all
     also have "(\<Sum>k=Suc 0..<Suc m. f k * x^k) = (\<Sum>k<m. f (k+1) * x^k) * x"
       by (subst setsum_shift_bounds_Suc_ivl)
-         (simp add: setsum_left_distrib algebra_simps atLeast0LessThan power_commutes)
+         (simp add: setsum_distrib_right algebra_simps atLeast0LessThan power_commutes)
     finally have "(\<Sum>k<Suc m. f k * x ^ k) = f 0 + (\<Sum>k<m. f (k + 1) * x ^ k) * x" .
   }
   from this[of "pred_numeral n"]
@@ -199,7 +199,7 @@
 lemma euler_approx_aux_Suc:
   "euler_approx_aux (Suc m) = 1 + Suc m * euler_approx_aux m"
   unfolding euler_approx_aux_def
-  by (subst setsum_right_distrib) (simp add: atLeastAtMostSuc_conv)
+  by (subst setsum_distrib_left) (simp add: atLeastAtMostSuc_conv)
 
 lemma eval_euler_approx_aux:
   "euler_approx_aux 0 = 1"
@@ -209,7 +209,7 @@
 proof -
   have A: "euler_approx_aux (Suc m) = 1 + Suc m * euler_approx_aux m" for m :: nat
     unfolding euler_approx_aux_def
-    by (subst setsum_right_distrib) (simp add: atLeastAtMostSuc_conv)
+    by (subst setsum_distrib_left) (simp add: atLeastAtMostSuc_conv)
   show ?th by (subst numeral_eq_Suc, subst A, subst numeral_eq_Suc [symmetric]) simp
 qed (simp_all add: euler_approx_aux_def)
 
@@ -281,7 +281,7 @@
                    y_def [symmetric] d_def [symmetric])
   also have "2 * y * (\<Sum>k<n. inverse (real (2 * k + 1)) * y\<^sup>2 ^ k) = 
                (\<Sum>k<n. 2 * y^(2*k+1) / (real (2 * k + 1)))"
-    by (subst setsum_right_distrib, simp, subst power_mult) 
+    by (subst setsum_distrib_left, simp, subst power_mult) 
        (simp_all add: divide_simps mult_ac power_mult)
   finally show ?case by (simp only: d_def y_def approx_def) 
 qed
@@ -380,7 +380,7 @@
   from sums_split_initial_segment[OF this, of n]
     have "(\<lambda>i. x * ((- x\<^sup>2) ^ (i + n) / real (2 * (i + n) + 1))) sums
             (arctan x - arctan_approx n x)"
-    by (simp add: arctan_approx_def setsum_right_distrib)
+    by (simp add: arctan_approx_def setsum_distrib_left)
   from sums_group[OF this, of 2] assms
     have sums: "(\<lambda>k. x * (x\<^sup>2)^n * (x^4)^k * c k) sums (arctan x - arctan_approx n x)"
     by (simp add: algebra_simps power_add power_mult [symmetric] c_def)
@@ -423,7 +423,7 @@
       by (subst atLeast0LessThan [symmetric], subst setsum_head_upt_Suc) simp_all
     also have "(\<Sum>k=Suc 0..<Suc m. inverse (f k * x^k)) = (\<Sum>k<m. inverse (f (k+1) * x^k)) / x"
       by (subst setsum_shift_bounds_Suc_ivl)
-         (simp add: setsum_right_distrib divide_inverse algebra_simps
+         (simp add: setsum_distrib_left divide_inverse algebra_simps
                     atLeast0LessThan power_commutes)
     finally have "(\<Sum>k<Suc m. inverse (f k) * inverse (x ^ k)) =
                       inverse (f 0) + (\<Sum>k<m. inverse (f (k + 1)) * inverse (x ^ k)) / x" by simp
--- a/src/HOL/Binomial.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Binomial.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -341,7 +341,7 @@
     by (rule distrib_right)
   also have "\<dots> = (\<Sum>k=0..n. of_nat (n choose k) * a^(k+1) * b^(n-k)) +
       (\<Sum>k=0..n. of_nat (n choose k) * a^k * b^(n - k + 1))"
-    by (auto simp add: setsum_right_distrib ac_simps)
+    by (auto simp add: setsum_distrib_left ac_simps)
   also have "\<dots> = (\<Sum>k=0..n. of_nat (n choose k) * a^k * b^(n + 1 - k)) +
       (\<Sum>k=1..n+1. of_nat (n choose (k - 1)) * a^k * b^(n + 1 - k))"
     by (simp add:setsum_shift_bounds_cl_Suc_ivl Suc_diff_le field_simps del: setsum_cl_ivl_Suc)
@@ -463,7 +463,7 @@
   also have "\<dots> = (\<Sum>i\<le>n. of_nat (n choose i) + (-1) ^ i * of_nat (n choose i))"
     by (simp add: setsum.distrib)
   also have "\<dots> = 2 * (\<Sum>i\<le>n. if even i then of_nat (n choose i) else 0)"
-    by (subst setsum_right_distrib, intro setsum.cong) simp_all
+    by (subst setsum_distrib_left, intro setsum.cong) simp_all
   finally show ?thesis ..
 qed
 
@@ -477,7 +477,7 @@
   also have "\<dots> = (\<Sum>i\<le>n. of_nat (n choose i) - (-1) ^ i * of_nat (n choose i))"
     by (simp add: setsum_subtractf)
   also have "\<dots> = 2 * (\<Sum>i\<le>n. if odd i then of_nat (n choose i) else 0)"
-    by (subst setsum_right_distrib, intro setsum.cong) simp_all
+    by (subst setsum_distrib_left, intro setsum.cong) simp_all
   finally show ?thesis ..
 qed
 
@@ -914,7 +914,7 @@
   have "(\<Sum>i\<le>n. i * (n choose i)) = (\<Sum>i\<le>Suc m. i * (Suc m choose i))"
     by (simp add: Suc)
   also have "\<dots> = Suc m * 2 ^ m"
-    by (simp only: setsum_atMost_Suc_shift Suc_times_binomial setsum_right_distrib[symmetric])
+    by (simp only: setsum_atMost_Suc_shift Suc_times_binomial setsum_distrib_left[symmetric])
        (simp add: choose_row_sum')
   finally show ?thesis
     using Suc by simp
@@ -934,9 +934,9 @@
       (\<Sum>i\<le>Suc m. (-1) ^ i * of_nat i * of_nat (Suc m choose i))"
     by (simp add: Suc)
   also have "\<dots> = (\<Sum>i\<le>m. (-1) ^ (Suc i) * of_nat (Suc i * (Suc m choose Suc i)))"
-    by (simp only: setsum_atMost_Suc_shift setsum_right_distrib[symmetric] mult_ac of_nat_mult) simp
+    by (simp only: setsum_atMost_Suc_shift setsum_distrib_left[symmetric] mult_ac of_nat_mult) simp
   also have "\<dots> = - of_nat (Suc m) * (\<Sum>i\<le>m. (-1) ^ i * of_nat (m choose i))"
-    by (subst setsum_right_distrib, rule setsum.cong[OF refl], subst Suc_times_binomial)
+    by (subst setsum_distrib_left, rule setsum.cong[OF refl], subst Suc_times_binomial)
        (simp add: algebra_simps)
   also have "(\<Sum>i\<le>m. (-1 :: 'a) ^ i * of_nat ((m choose i))) = 0"
     using choose_alternating_sum[OF \<open>m > 0\<close>] by simp
@@ -978,7 +978,7 @@
     by (subst setsum_atMost_Suc_shift) (simp add: ring_distribs setsum.distrib)
   also have "(\<Sum>i\<le>n. of_nat (n choose i) * pochhammer a (Suc i) * pochhammer b (n - i)) =
       a * pochhammer ((a + 1) + b) n"
-    by (subst Suc) (simp add: setsum_right_distrib pochhammer_rec mult_ac)
+    by (subst Suc) (simp add: setsum_distrib_left pochhammer_rec mult_ac)
   also have "(\<Sum>i\<le>n. of_nat (n choose Suc i) * pochhammer a (Suc i) * pochhammer b (n - i)) +
         pochhammer b (Suc n) =
       (\<Sum>i=0..Suc n. of_nat (n choose i) * pochhammer a i * pochhammer b (Suc n - i))"
@@ -992,7 +992,7 @@
   also have "\<dots> = (\<Sum>i\<le>n. of_nat (n choose i) * pochhammer a i * pochhammer b (Suc (n - i)))"
     by (intro setsum.cong) (simp_all add: Suc_diff_le)
   also have "\<dots> = b * pochhammer (a + (b + 1)) n"
-    by (subst Suc) (simp add: setsum_right_distrib mult_ac pochhammer_rec)
+    by (subst Suc) (simp add: setsum_distrib_left mult_ac pochhammer_rec)
   also have "a * pochhammer ((a + 1) + b) n + b * pochhammer (a + (b + 1)) n =
       pochhammer (a + b) (Suc n)"
     by (simp add: pochhammer_rec algebra_simps)
@@ -1263,9 +1263,9 @@
       by (simp only:)
   qed
   also have "\<dots> + ?B = y * (\<Sum>k=1..mm. (G mm k)) + (of_nat mm + r gchoose (Suc mm)) * x^(Suc mm)"
-    unfolding G_def by (subst setsum_right_distrib) (simp add: algebra_simps)
+    unfolding G_def by (subst setsum_distrib_left) (simp add: algebra_simps)
   also have "(\<Sum>k=0..mm. (of_nat mm + r gchoose k) * x^(Suc k) * y^(mm - k)) = x * (S mm)"
-    unfolding S_def by (subst setsum_right_distrib) (simp add: atLeast0AtMost algebra_simps)
+    unfolding S_def by (subst setsum_distrib_left) (simp add: atLeast0AtMost algebra_simps)
   also have "(G (Suc mm) 0) = y * (G mm 0)"
     by (simp add: G_def)
   finally have "S (Suc mm) =
@@ -1283,7 +1283,7 @@
   also have "(x + y) * S mm + \<dots> = (x + y) * ?rhs mm + (- r gchoose (Suc mm)) * (- x)^Suc mm"
     unfolding S_def by (subst Suc.IH) simp
   also have "(x + y) * ?rhs mm = (\<Sum>n\<le>mm. ((- r gchoose n) * (- x) ^ n * (x + y) ^ (Suc mm - n)))"
-    by (subst setsum_right_distrib, rule setsum.cong) (simp_all add: Suc_diff_le)
+    by (subst setsum_distrib_left, rule setsum.cong) (simp_all add: Suc_diff_le)
   also have "\<dots> + (-r gchoose (Suc mm)) * (-x)^Suc mm =
       (\<Sum>n\<le>Suc mm. (- r gchoose n) * (- x) ^ n * (x + y) ^ (Suc mm - n))"
     by simp
@@ -1345,7 +1345,7 @@
     using gbinomial_partial_sum_poly_xpos[where x="1" and y="1" and r="of_nat m + 1" and m="m"]
     by (simp add: add_ac)
   also have "\<dots> = 2 ^ m * (\<Sum>k\<le>m. (of_nat (m + k) gchoose k) / 2 ^ k)"
-    by (subst setsum_right_distrib) (simp add: algebra_simps power_diff)
+    by (subst setsum_distrib_left) (simp add: algebra_simps power_diff)
   finally show ?thesis
     by (subst (asm) mult_left_cancel) simp_all
 qed
@@ -1444,7 +1444,7 @@
     by simp
   also have "\<dots> = nat (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (\<Sum>_\<in>\<Inter>I. (- 1) ^ (card I + 1)))"
     (is "_ = nat ?rhs")
-    by (subst setsum_right_distrib) simp
+    by (subst setsum_distrib_left) simp
   also have "?rhs = (\<Sum>(I, _)\<in>Sigma {I. I \<subseteq> A \<and> I \<noteq> {}} Inter. (- 1) ^ (card I + 1))"
     using assms by (subst setsum.Sigma) auto
   also have "\<dots> = (\<Sum>(x, I)\<in>(SIGMA x:UNIV. {I. I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter>I}). (- 1) ^ (card I + 1))"
@@ -1474,7 +1474,7 @@
     also have "\<dots> = (\<Sum>i=1..card A. (\<Sum>I|I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter>I. (- 1) ^ (i + 1)))"
       using assms by (subst setsum.Sigma) auto
     also have "\<dots> = (\<Sum>i=1..card A. (- 1) ^ (i + 1) * (\<Sum>I|I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter>I. 1))"
-      by (subst setsum_right_distrib) simp
+      by (subst setsum_distrib_left) simp
     also have "\<dots> = (\<Sum>i=1..card K. (- 1) ^ (i + 1) * (\<Sum>I|I \<subseteq> K \<and> card I = i. 1))"
       (is "_ = ?rhs")
     proof (rule setsum.mono_neutral_cong_right[rule_format])
@@ -1508,7 +1508,7 @@
     also have "\<dots> = (\<Sum>i = 0..card K. (- 1) * ((- 1) ^ i * int (card K choose i))) + 1"
       using K by (subst n_subsets[symmetric]) simp_all
     also have "\<dots> = - (\<Sum>i = 0..card K. (- 1) ^ i * int (card K choose i)) + 1"
-      by (subst setsum_right_distrib[symmetric]) simp
+      by (subst setsum_distrib_left[symmetric]) simp
     also have "\<dots> =  - ((-1 + 1) ^ card K) + 1"
       by (subst binomial_ring) (simp add: ac_simps)
     also have "\<dots> = 1"
--- a/src/HOL/Decision_Procs/Approximation.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Decision_Procs/Approximation.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -31,7 +31,7 @@
   have shift_pow: "\<And>i. - (x * ((-1)^i * a (Suc i) * x ^ i)) = (-1)^(Suc i) * a (Suc i) * x ^ (Suc i)"
     by auto
   show ?thesis
-    unfolding setsum_right_distrib shift_pow uminus_add_conv_diff [symmetric] setsum_negf[symmetric]
+    unfolding setsum_distrib_left shift_pow uminus_add_conv_diff [symmetric] setsum_negf[symmetric]
     setsum_head_upt_Suc[OF zero_less_Suc]
     setsum.reindex[OF inj_Suc, unfolded comp_def, symmetric, of "\<lambda> n. (-1)^n  *a n * x^n"] by auto
 qed
@@ -514,7 +514,7 @@
   proof -
     have "(sqrt y * lb_arctan_horner prec n 1 y) \<le> ?S n"
       using bounds(1) \<open>0 \<le> sqrt y\<close>
-      apply (simp only: power_add power_one_right mult.assoc[symmetric] setsum_left_distrib[symmetric])
+      apply (simp only: power_add power_one_right mult.assoc[symmetric] setsum_distrib_right[symmetric])
       apply (simp only: mult.commute[where 'a=real] mult.commute[of _ "2::nat"] power_mult)
       apply (auto intro!: mult_left_mono)
       done
@@ -527,7 +527,7 @@
     have "arctan (sqrt y) \<le> ?S (Suc n)" using arctan_bounds ..
     also have "\<dots> \<le> (sqrt y * ub_arctan_horner prec (Suc n) 1 y)"
       using bounds(2)[of "Suc n"] \<open>0 \<le> sqrt y\<close>
-      apply (simp only: power_add power_one_right mult.assoc[symmetric] setsum_left_distrib[symmetric])
+      apply (simp only: power_add power_one_right mult.assoc[symmetric] setsum_distrib_right[symmetric])
       apply (simp only: mult.commute[where 'a=real] mult.commute[of _ "2::nat"] power_mult)
       apply (auto intro!: mult_left_mono)
       done
@@ -1212,7 +1212,7 @@
   from horner_bounds[where lb="lb_sin_cos_aux prec" and ub="ub_sin_cos_aux prec" and j'=0,
     OF \<open>0 \<le> real_of_float (x * x)\<close> f_eq lb_sin_cos_aux.simps ub_sin_cos_aux.simps]
   show "?lb" and "?ub" using \<open>0 \<le> real_of_float x\<close>
-    apply (simp_all only: power_add power_one_right mult.assoc[symmetric] setsum_left_distrib[symmetric])
+    apply (simp_all only: power_add power_one_right mult.assoc[symmetric] setsum_distrib_right[symmetric])
     apply (simp_all only: mult.commute[where 'a=real] of_nat_fact)
     apply (auto intro!: mult_left_mono simp add: power_mult power2_eq_square[of "real_of_float x"])
     done
@@ -2193,7 +2193,7 @@
   let "?s n" = "(- 1) ^ n * (1 / real (1 + n)) * (real_of_float x)^(Suc n)"
 
   have "?lb \<le> setsum ?s {0 ..< 2 * ev}"
-    unfolding power_Suc2 mult.assoc[symmetric] times_float.rep_eq setsum_left_distrib[symmetric]
+    unfolding power_Suc2 mult.assoc[symmetric] times_float.rep_eq setsum_distrib_right[symmetric]
     unfolding mult.commute[of "real_of_float x"] ev 
     using horner_bounds(1)[where G="\<lambda> i k. Suc k" and F="\<lambda>x. x" and f="\<lambda>x. x" 
                     and lb="\<lambda>n i k x. lb_ln_horner prec n k x" 
@@ -2208,7 +2208,7 @@
   have "?ln \<le> setsum ?s {0 ..< 2 * od + 1}"
     using ln_bounds(2)[OF \<open>0 \<le> real_of_float x\<close> \<open>real_of_float x < 1\<close>] by auto
   also have "\<dots> \<le> ?ub"
-    unfolding power_Suc2 mult.assoc[symmetric] times_float.rep_eq setsum_left_distrib[symmetric]
+    unfolding power_Suc2 mult.assoc[symmetric] times_float.rep_eq setsum_distrib_right[symmetric]
     unfolding mult.commute[of "real_of_float x"] od
     using horner_bounds(2)[where G="\<lambda> i k. Suc k" and F="\<lambda>x. x" and f="\<lambda>x. x" and lb="\<lambda>n i k x. lb_ln_horner prec n k x" and ub="\<lambda>n i k x. ub_ln_horner prec n k x" and j'=1 and n="2*od+1",
       OF \<open>0 \<le> real_of_float x\<close> refl lb_ln_horner.simps ub_ln_horner.simps] \<open>0 \<le> real_of_float x\<close>
@@ -4019,7 +4019,7 @@
                inverse (real (\<Prod> j \<in> {k..<k+Suc n}. j)) * ?f (Suc n) t * (xs!x - c)^Suc n" (is "_ = ?T")
         unfolding funpow_Suc C_def[symmetric] setsum_move0 setprod_head_Suc
         by (auto simp add: algebra_simps)
-          (simp only: mult.left_commute [of _ "inverse (real k)"] setsum_right_distrib [symmetric])
+          (simp only: mult.left_commute [of _ "inverse (real k)"] setsum_distrib_left [symmetric])
       finally have "?T \<in> {l .. u}" .
     }
     thus ?thesis using DERIV by blast
--- a/src/HOL/Deriv.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Deriv.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -368,7 +368,7 @@
     using insert by (intro has_derivative_mult) auto
   also have "?P = (\<lambda>y. \<Sum>i'\<in>insert i I. f' i' y * (\<Prod>j\<in>insert i I - {i'}. f j x))"
     using insert(1,2)
-    by (auto simp add: setsum_right_distrib insert_Diff_if intro!: ext setsum.cong)
+    by (auto simp add: setsum_distrib_left insert_Diff_if intro!: ext setsum.cong)
   finally show ?case
     using insert by simp
 qed
@@ -845,7 +845,7 @@
   "(\<And> n. n \<in> S \<Longrightarrow> ((\<lambda>x. f x n) has_field_derivative (f' x n)) F) \<Longrightarrow>
     ((\<lambda>x. setsum (f x) S) has_field_derivative setsum (f' x) S) F"
   by (rule has_derivative_imp_has_field_derivative [OF has_derivative_setsum])
-     (auto simp: setsum_right_distrib mult_commute_abs dest: has_field_derivative_imp_has_derivative)
+     (auto simp: setsum_distrib_left mult_commute_abs dest: has_field_derivative_imp_has_derivative)
 
 lemma DERIV_inverse'[derivative_intros]:
   assumes "(f has_field_derivative D) (at x within s)"
--- a/src/HOL/Groups_Big.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Groups_Big.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -729,7 +729,7 @@
   "finite F \<Longrightarrow> (setsum f F = 0) = (\<forall>a\<in>F. f a = 0)"
   by (intro ballI setsum_nonneg_eq_0_iff zero_le)
 
-lemma setsum_right_distrib: "r * setsum f A = setsum (\<lambda>n. r * f n) A"
+lemma setsum_distrib_left: "r * setsum f A = setsum (\<lambda>n. r * f n) A"
   for f :: "'a \<Rightarrow> 'b::semiring_0"
 proof (induct A rule: infinite_finite_induct)
   case infinite
@@ -742,7 +742,7 @@
   then show ?case by (simp add: distrib_left)
 qed
 
-lemma setsum_left_distrib: "setsum f A * r = (\<Sum>n\<in>A. f n * r)"
+lemma setsum_distrib_right: "setsum f A * r = (\<Sum>n\<in>A. f n * r)"
   for r :: "'a::semiring_0"
 proof (induct A rule: infinite_finite_induct)
   case infinite
@@ -811,7 +811,7 @@
 lemma setsum_product:
   fixes f :: "'a \<Rightarrow> 'b::semiring_0"
   shows "setsum f A * setsum g B = (\<Sum>i\<in>A. \<Sum>j\<in>B. f i * g j)"
-  by (simp add: setsum_right_distrib setsum_left_distrib) (rule setsum.commute)
+  by (simp add: setsum_distrib_left setsum_distrib_right) (rule setsum.commute)
 
 lemma setsum_mult_setsum_if_inj:
   fixes f :: "'a \<Rightarrow> 'b::semiring_0"
--- a/src/HOL/Inequalities.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Inequalities.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -59,7 +59,7 @@
   let ?S = "(\<Sum>j=0..<n. (\<Sum>k=0..<n. (a j - a k) * (b j - b k)))"
   have "2 * (of_nat n * (\<Sum>j=0..<n. (a j * b j)) - (\<Sum>j=0..<n. b j) * (\<Sum>k=0..<n. a k)) = ?S"
     by (simp only: one_add_one[symmetric] algebra_simps)
-      (simp add: algebra_simps setsum_subtractf setsum.distrib setsum.commute[of "\<lambda>i j. a i * b j"] setsum_right_distrib)
+      (simp add: algebra_simps setsum_subtractf setsum.distrib setsum.commute[of "\<lambda>i j. a i * b j"] setsum_distrib_left)
   also
   { fix i j::nat assume "i<n" "j<n"
     hence "a i - a j \<le> 0 \<and> b i - b j \<ge> 0 \<or> a i - a j \<ge> 0 \<and> b i - b j \<le> 0"
--- a/src/HOL/Library/BigO.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Library/BigO.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -556,7 +556,7 @@
   apply (subst abs_of_nonneg) back back
    apply (rule setsum_nonneg)
    apply force
-  apply (subst setsum_right_distrib)
+  apply (subst setsum_distrib_left)
   apply (rule allI)
   apply (rule order_trans)
    apply (rule setsum_abs)
--- a/src/HOL/Library/Convex.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Library/Convex.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -633,7 +633,7 @@
             OF asum_le less_imp_le[OF i0]], of "a i * f (y i)"]
       by simp
     also have "\<dots> = (\<Sum> j \<in> s. (1 - a i) * ?a j * f (y j)) + a i * f (y i)"
-      unfolding setsum_right_distrib[of "1 - a i" "\<lambda> j. ?a j * f (y j)"]
+      unfolding setsum_distrib_left[of "1 - a i" "\<lambda> j. ?a j * f (y j)"]
       using i0 by auto
     also have "\<dots> = (\<Sum> j \<in> s. a j * f (y j)) + a i * f (y i)"
       using i0 by auto
--- a/src/HOL/Library/Extended_Real.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Library/Extended_Real.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -1098,7 +1098,7 @@
   "(\<And>i. i \<in> A \<Longrightarrow> 0 \<le> f i) \<Longrightarrow> setsum f A * r = (\<Sum>n\<in>A. f n * r :: ereal)"
   using setsum_ereal_right_distrib[of A f r] by (simp add: mult_ac)
 
-lemma setsum_left_distrib_ereal:
+lemma setsum_distrib_right_ereal:
   "c \<ge> 0 \<Longrightarrow> setsum f A * ereal c = (\<Sum>x\<in>A. f x * c :: ereal)"
 by(subst setsum_comp_morphism[where h="\<lambda>x. x * ereal c", symmetric])(simp_all add: distrib_left_ereal_nn)
 
--- a/src/HOL/Library/Formal_Power_Series.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Library/Formal_Power_Series.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -141,7 +141,7 @@
           (\<Sum>j=0..n. \<Sum>i=0..n - j. a$j * b$i * c$(n - j - i))"
       by (rule fps_mult_assoc_lemma)
     then show "((a * b) * c) $ n = (a * (b * c)) $ n"
-      by (simp add: fps_mult_nth setsum_right_distrib setsum_left_distrib mult.assoc)
+      by (simp add: fps_mult_nth setsum_distrib_left setsum_distrib_right mult.assoc)
   qed
 qed
 
@@ -1562,7 +1562,7 @@
     also have "\<dots> = (fps_deriv (f * g)) $ n"
       apply (simp only: fps_deriv_nth fps_mult_nth setsum.distrib)
       unfolding s0 s1
-      unfolding setsum.distrib[symmetric] setsum_right_distrib
+      unfolding setsum.distrib[symmetric] setsum_distrib_left
       apply (rule setsum.cong)
       apply (auto simp add: of_nat_diff field_simps)
       done
@@ -2320,7 +2320,7 @@
       apply auto
       apply (rule setsum.cong)
       apply (rule refl)
-      unfolding setsum_left_distrib
+      unfolding setsum_distrib_right
       apply (rule sym)
       apply (rule_tac l = "\<lambda>xs. xs @ [n - x]" in setsum.reindex_cong)
       apply (simp add: inj_on_def)
@@ -3082,7 +3082,7 @@
   have "(fps_deriv (a oo b))$n = (((fps_deriv a) oo b) * (fps_deriv b)) $n" for n
   proof -
     have "(fps_deriv (a oo b))$n = setsum (\<lambda>i. a $ i * (fps_deriv (b^i))$n) {0.. Suc n}"
-      by (simp add: fps_compose_def field_simps setsum_right_distrib del: of_nat_Suc)
+      by (simp add: fps_compose_def field_simps setsum_distrib_left del: of_nat_Suc)
     also have "\<dots> = setsum (\<lambda>i. a$i * ((fps_const (of_nat i)) * (fps_deriv b * (b^(i - 1))))$n) {0.. Suc n}"
       by (simp add: field_simps fps_deriv_power del: fps_mult_left_const_nth of_nat_Suc)
     also have "\<dots> = setsum (\<lambda>i. of_nat i * a$i * (((b^(i - 1)) * fps_deriv b))$n) {0.. Suc n}"
@@ -3102,7 +3102,7 @@
     have "(((fps_deriv a) oo b) * (fps_deriv b))$n = setsum (\<lambda>i. (fps_deriv b)$ (n - i) * ((fps_deriv a) oo b)$i) {0..n}"
       unfolding fps_mult_nth by (simp add: ac_simps)
     also have "\<dots> = setsum (\<lambda>i. setsum (\<lambda>j. of_nat (n - i +1) * b$(n - i + 1) * of_nat (j + 1) * a$(j+1) * (b^j)$i) {0..n}) {0..n}"
-      unfolding fps_deriv_nth fps_compose_nth setsum_right_distrib mult.assoc
+      unfolding fps_deriv_nth fps_compose_nth setsum_distrib_left mult.assoc
       apply (rule setsum.cong)
       apply (rule refl)
       apply (rule setsum.mono_neutral_left)
@@ -3114,7 +3114,7 @@
       apply simp
       done
     also have "\<dots> = setsum (\<lambda>i. of_nat (i + 1) * a$(i+1) * (setsum (\<lambda>j. (b^ i)$j * of_nat (n - j + 1) * b$(n - j + 1)) {0..n})) {0.. n}"
-      unfolding setsum_right_distrib
+      unfolding setsum_distrib_left
       apply (subst setsum.commute)
       apply (rule setsum.cong, rule refl)+
       apply simp
@@ -3295,7 +3295,7 @@
     apply auto
     done
   have "?r =  setsum (\<lambda>i. setsum (\<lambda>(k,m). a$k * (c^k)$i * b$m * (d^m) $ (n - i)) {(k,m). k + m \<le> n}) {0..n}"
-    apply (simp add: fps_mult_nth setsum_right_distrib)
+    apply (simp add: fps_mult_nth setsum_distrib_left)
     apply (subst setsum.commute)
     apply (rule setsum.cong)
     apply (auto simp add: field_simps)
@@ -3377,7 +3377,7 @@
   assumes c0: "c $ 0 = (0::'a::idom)"
   shows "(a * b) oo c = (a oo c) * (b oo c)"
   apply (simp add: fps_eq_iff fps_compose_mult_distrib_lemma [OF c0])
-  apply (simp add: fps_compose_nth fps_mult_nth setsum_left_distrib)
+  apply (simp add: fps_compose_nth fps_mult_nth setsum_distrib_right)
   done
 
 lemma fps_compose_setprod_distrib:
@@ -3498,7 +3498,7 @@
 qed
 
 lemma fps_const_mult_apply_left: "fps_const c * (a oo b) = (fps_const c * a) oo b"
-  by (simp add: fps_eq_iff fps_compose_nth setsum_right_distrib mult.assoc)
+  by (simp add: fps_eq_iff fps_compose_nth setsum_distrib_left mult.assoc)
 
 lemma fps_const_mult_apply_right:
   "(a oo b) * fps_const (c::'a::comm_semiring_1) = (fps_const c * a) oo b"
@@ -3513,11 +3513,11 @@
   proof -
     have "?l$n = (setsum (\<lambda>i. (fps_const (a$i) * b^i) oo c) {0..n})$n"
       by (simp add: fps_compose_nth fps_compose_power[OF c0] fps_const_mult_apply_left
-        setsum_right_distrib mult.assoc fps_setsum_nth)
+        setsum_distrib_left mult.assoc fps_setsum_nth)
     also have "\<dots> = ((setsum (\<lambda>i. fps_const (a$i) * b^i) {0..n}) oo c)$n"
       by (simp add: fps_compose_setsum_distrib)
     also have "\<dots> = ?r$n"
-      apply (simp add: fps_compose_nth fps_setsum_nth setsum_left_distrib mult.assoc)
+      apply (simp add: fps_compose_nth fps_setsum_nth setsum_distrib_right mult.assoc)
       apply (rule setsum.cong)
       apply (rule refl)
       apply (rule setsum.mono_neutral_right)
@@ -4224,7 +4224,7 @@
     apply (simp add: th00)
     unfolding gbinomial_pochhammer
     using bn0
-    apply (simp add: setsum_left_distrib setsum_right_distrib field_simps)
+    apply (simp add: setsum_distrib_right setsum_distrib_left field_simps)
     done
   finally show ?thesis by simp
 qed
@@ -4253,7 +4253,7 @@
     by (simp add: pochhammer_eq_0_iff)
   from Vandermonde_pochhammer_lemma[where a = "?a" and b="?b" and n=n, OF h, unfolded th0 th1]
   show ?thesis
-    using nz by (simp add: field_simps setsum_right_distrib)
+    using nz by (simp add: field_simps setsum_distrib_left)
 qed
 
 
--- a/src/HOL/Library/Groups_Big_Fun.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Library/Groups_Big_Fun.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -240,7 +240,7 @@
   note assms
   moreover have "{a. g a * r \<noteq> 0} \<subseteq> {a. g a \<noteq> 0}" by auto
   ultimately show ?thesis
-    by (simp add: setsum_left_distrib Sum_any.expand_superset [of "{a. g a \<noteq> 0}"])
+    by (simp add: setsum_distrib_right Sum_any.expand_superset [of "{a. g a \<noteq> 0}"])
 qed  
 
 lemma Sum_any_right_distrib:
@@ -251,7 +251,7 @@
   note assms
   moreover have "{a. r * g a \<noteq> 0} \<subseteq> {a. g a \<noteq> 0}" by auto
   ultimately show ?thesis
-    by (simp add: setsum_right_distrib Sum_any.expand_superset [of "{a. g a \<noteq> 0}"])
+    by (simp add: setsum_distrib_left Sum_any.expand_superset [of "{a. g a \<noteq> 0}"])
 qed
 
 lemma Sum_any_product:
--- a/src/HOL/Library/Polynomial.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Library/Polynomial.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -507,7 +507,7 @@
       also note pCons.IH
       also have "a + x * (\<Sum>i\<le>degree p. coeff p i * x ^ i) =
                  coeff ?p' 0 * x^0 + (\<Sum>i\<le>degree p. coeff ?p' (Suc i) * x^Suc i)"
-          by (simp add: field_simps setsum_right_distrib coeff_pCons)
+          by (simp add: field_simps setsum_distrib_left coeff_pCons)
       also note setsum_atMost_Suc_shift[symmetric]
       also note degree_pCons_eq[OF \<open>p \<noteq> 0\<close>, of a, symmetric]
       finally show ?thesis .
@@ -3412,7 +3412,7 @@
       by (subst setprod.insert, insert insert, auto)
   } note id2 = this
   show ?case
-    unfolding id pderiv_mult insert(3) setsum_right_distrib
+    unfolding id pderiv_mult insert(3) setsum_distrib_left
     by (auto simp add: ac_simps id2 intro!: setsum.cong)
 qed auto
 
--- a/src/HOL/Library/Stirling.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Library/Stirling.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -110,7 +110,7 @@
     also have "\<dots> = Suc n * (\<Sum>k=1..n. fact n div k) + Suc n * fact n div Suc n"
       by (metis nat.distinct(1) nonzero_mult_divide_cancel_left)
     also have "\<dots> = (\<Sum>k=1..n. fact (Suc n) div k) + fact (Suc n) div Suc n"
-      by (simp add: setsum_right_distrib div_mult_swap dvd_fact)
+      by (simp add: setsum_distrib_left div_mult_swap dvd_fact)
     also have "\<dots> = (\<Sum>k=1..Suc n. fact (Suc n) div k)"
       by simp
     finally show ?thesis .
@@ -162,7 +162,7 @@
   also have "\<dots> = (\<Sum>k\<le>n. n * stirling n (Suc k) + stirling n k)"
     by simp
   also have "\<dots> = n * (\<Sum>k\<le>n. stirling n (Suc k)) + (\<Sum>k\<le>n. stirling n k)"
-    by (simp add: setsum.distrib setsum_right_distrib)
+    by (simp add: setsum.distrib setsum_distrib_left)
   also have "\<dots> = n * fact n + fact n"
   proof -
     have "n * (\<Sum>k\<le>n. stirling n (Suc k)) = n * ((\<Sum>k\<le>Suc n. stirling n k) - stirling n 0)"
@@ -195,7 +195,7 @@
     by (subst setsum_atMost_Suc_shift) (simp add: setsum.distrib ring_distribs)
   also have "\<dots> = pochhammer x (Suc n)"
     by (subst setsum_atMost_Suc_shift [symmetric])
-      (simp add: algebra_simps setsum.distrib setsum_right_distrib pochhammer_Suc Suc [symmetric])
+      (simp add: algebra_simps setsum.distrib setsum_distrib_left pochhammer_Suc Suc [symmetric])
   finally show ?case .
 qed
 
--- a/src/HOL/Metis_Examples/Big_O.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Metis_Examples/Big_O.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -499,7 +499,7 @@
 apply (subst abs_of_nonneg) back back
  apply (rule setsum_nonneg)
  apply force
-apply (subst setsum_right_distrib)
+apply (subst setsum_distrib_left)
 apply (rule allI)
 apply (rule order_trans)
  apply (rule setsum_abs)
--- a/src/HOL/Nonstandard_Analysis/HSeries.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Nonstandard_Analysis/HSeries.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -59,7 +59,7 @@
 
 lemma sumhr_mult:
   "!!m n. hypreal_of_real r * sumhr(m,n,f) = sumhr(m,n,%n. r * f n)"
-unfolding sumhr_app by transfer (rule setsum_right_distrib)
+unfolding sumhr_app by transfer (rule setsum_distrib_left)
 
 lemma sumhr_split_add:
   "!!n p. n < p ==> sumhr(0,n,f) + sumhr(n,p,f) = sumhr(0,p,f)"
--- a/src/HOL/Probability/Distributions.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Probability/Distributions.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -149,7 +149,7 @@
   assume "0 \<le> x"
   have "(\<Sum>n\<le>k. (l * x) ^ n * exp (- (l * x)) / fact n) =
     exp (- (l * x)) * (\<Sum>n\<le>k. (l * x) ^ n / fact n)"
-    unfolding setsum_right_distrib by (intro setsum.cong) (auto simp: field_simps)
+    unfolding setsum_distrib_left by (intro setsum.cong) (auto simp: field_simps)
   also have "\<dots> = (\<Sum>n\<le>k. (l * x) ^ n / fact n) / exp (l * x)"
     by (simp add: exp_minus field_simps)
   also have "\<dots> \<le> 1"
--- a/src/HOL/Probability/Probability_Mass_Function.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Probability/Probability_Mass_Function.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -1610,7 +1610,7 @@
 
 lemma nn_integral_pmf_of_set: "nn_integral (measure_pmf pmf_of_set) f = setsum f S / card S"
   by (subst nn_integral_measure_pmf_finite)
-     (simp_all add: setsum_left_distrib[symmetric] card_gt_0_iff S_not_empty S_finite divide_ennreal_def
+     (simp_all add: setsum_distrib_right[symmetric] card_gt_0_iff S_not_empty S_finite divide_ennreal_def
                 divide_ennreal[symmetric] ennreal_of_nat_eq_real_of_nat[symmetric] ennreal_times_divide)
 
 lemma integral_pmf_of_set: "integral\<^sup>L (measure_pmf pmf_of_set) f = setsum f S / card S"
--- a/src/HOL/Probability/Projective_Limit.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Probability/Projective_Limit.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -290,7 +290,7 @@
       finally show "\<mu>G (Z i - Z' i) \<le> (2 powr - real i) * ?a" .
     qed
     also have "\<dots> = ennreal ((\<Sum> i\<in>{1..n}. (2 powr -enn2real i)) * enn2real ?a)"
-      using r by (simp add: setsum_left_distrib ennreal_mult[symmetric])
+      using r by (simp add: setsum_distrib_right ennreal_mult[symmetric])
     also have "\<dots> < ennreal (1 * enn2real ?a)"
     proof (intro ennreal_lessI mult_strict_right_mono)
       have "(\<Sum>i = 1..n. 2 powr - real i) = (\<Sum>i = 1..<Suc n. (1/2) ^ i)"
--- a/src/HOL/Probability/ex/Koepf_Duermuth_Countermeasure.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Probability/ex/Koepf_Duermuth_Countermeasure.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -100,7 +100,7 @@
   show ?case unfolding *
     using Suc[of "\<lambda>i. P (Suc i)"]
     by (simp add: setsum.reindex split_conv setsum_cartesian_product'
-      lessThan_Suc_eq_insert_0 setprod.reindex setsum_left_distrib[symmetric] setsum_right_distrib[symmetric])
+      lessThan_Suc_eq_insert_0 setprod.reindex setsum_distrib_right[symmetric] setsum_distrib_left[symmetric])
 qed
 
 declare space_point_measure[simp]
@@ -158,8 +158,8 @@
 
   have [simp]: "\<And>A. inj_on (\<lambda>(xs, n). n # xs) A" by (force intro!: inj_onI)
 
-  note setsum_right_distrib[symmetric, simp]
-  note setsum_left_distrib[symmetric, simp]
+  note setsum_distrib_left[symmetric, simp]
+  note setsum_distrib_right[symmetric, simp]
   note setsum_cartesian_product'[simp]
 
   have "(\<Sum>ms | set ms \<subseteq> messages \<and> length ms = n. \<Prod>x<length ms. M (ms ! x)) = 1"
@@ -256,7 +256,7 @@
     apply (simp add: * P_def)
     apply (simp add: setsum_cartesian_product')
     using setprod_setsum_distrib_lists[OF M.finite_space, of M n "\<lambda>x x. True"] \<open>k \<in> keys\<close>
-    by (auto simp add: setsum_right_distrib[symmetric] subset_eq setprod.neutral_const)
+    by (auto simp add: setsum_distrib_left[symmetric] subset_eq setprod.neutral_const)
 qed
 
 lemma fst_image_msgs[simp]: "fst`msgs = keys"
@@ -323,7 +323,7 @@
   also have "\<dots> = - (\<Sum>y\<in>Y`msgs. (\<Sum>x\<in>X`msgs. (\<P>(X ; Y) {(x, y)}) * log b ((\<P>(X ; Y) {(x, y)}) / (\<P>(Y) {y}))))"
     by (subst setsum.commute) rule
   also have "\<dots> = -(\<Sum>y\<in>Y`msgs. (\<P>(Y) {y}) * (\<Sum>x\<in>X`msgs. (\<P>(X ; Y) {(x,y)}) / (\<P>(Y) {y}) * log b ((\<P>(X ; Y) {(x,y)}) / (\<P>(Y) {y}))))"
-    by (auto simp add: setsum_right_distrib vimage_def intro!: setsum.cong prob_conj_imp1)
+    by (auto simp add: setsum_distrib_left vimage_def intro!: setsum.cong prob_conj_imp1)
   finally show "- (\<Sum>(x, y)\<in>(\<lambda>x. (X x, Y x)) ` msgs. (\<P>(X ; Y) {(x, y)}) * log b ((\<P>(X ; Y) {(x, y)}) / (\<P>(Y) {y}))) =
     -(\<Sum>y\<in>Y`msgs. (\<P>(Y) {y}) * (\<Sum>x\<in>X`msgs. (\<P>(X ; Y) {(x,y)}) / (\<P>(Y) {y}) * log b ((\<P>(X ; Y) {(x,y)}) / (\<P>(Y) {y}))))" .
 qed simp_all
@@ -402,7 +402,7 @@
     also have "\<P>(t\<circ>OB | fst) {(t obs, k)} * \<P>(fst) {k} / (\<Sum>k'\<in>keys. \<P>(t\<circ>OB|fst) {(t obs, k')} * \<P>(fst) {k'}) =
       \<P>(OB | fst) {(obs, k)} * \<P>(fst) {k} / (\<Sum>k'\<in>keys. \<P>(OB|fst) {(obs, k')} * \<P>(fst) {k'})"
       using CP_t_K[OF \<open>k\<in>keys\<close> obs] CP_t_K[OF _ obs] \<open>real (card ?S) \<noteq> 0\<close>
-      by (simp only: setsum_right_distrib[symmetric] ac_simps
+      by (simp only: setsum_distrib_left[symmetric] ac_simps
           mult_divide_mult_cancel_left[OF \<open>real (card ?S) \<noteq> 0\<close>]
         cong: setsum.cong)
     also have "(\<Sum>k'\<in>keys. \<P>(OB|fst) {(obs, k')} * \<P>(fst) {k'}) = \<P>(OB) {obs}"
@@ -450,7 +450,7 @@
     apply (safe intro!: setsum.cong)
     using P_t_sum_P_O
     by (simp add: setsum_divide_distrib[symmetric] field_simps **
-                  setsum_right_distrib[symmetric] setsum_left_distrib[symmetric])
+                  setsum_distrib_left[symmetric] setsum_distrib_right[symmetric])
   also have "\<dots> = \<H>(fst | t\<circ>OB)"
     unfolding conditional_entropy_eq_ce_with_hypothesis
     by (simp add: comp_def image_image[symmetric])
--- a/src/HOL/Set_Interval.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Set_Interval.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -1889,7 +1889,7 @@
   also have "... = (x - y) * (y * (\<Sum>p<Suc n. (x ^ p) * y ^ (n - p))) + (x - y) * (x * x^n)"
     by (simp only: mult.left_commute)
   also have "... = (x - y) * (\<Sum>p<Suc (Suc n). x ^ p * y ^ (Suc n - p))"
-    by (simp add: field_simps Suc_diff_le setsum_left_distrib setsum_right_distrib)
+    by (simp add: field_simps Suc_diff_le setsum_distrib_right setsum_distrib_left)
   finally show ?case .
 qed simp
 
@@ -1944,7 +1944,7 @@
   also from ngt1 have "\<dots> = ?n*a + (\<Sum>i\<in>{..<n}. ?I i*d)" by simp
   also from ngt1 have "\<dots> = (?n*a + d*(\<Sum>i\<in>{1..<n}. ?I i))"
     unfolding One_nat_def
-    by (simp add: setsum_right_distrib atLeast0LessThan[symmetric] setsum_shift_lb_Suc0_0_upt ac_simps)
+    by (simp add: setsum_distrib_left atLeast0LessThan[symmetric] setsum_shift_lb_Suc0_0_upt ac_simps)
   also have "2*\<dots> = 2*?n*a + d*2*(\<Sum>i\<in>{1..<n}. ?I i)"
     by (simp add: algebra_simps)
   also from ngt1 have "{1..<n} = {1..n - 1}"
--- a/src/HOL/Transcendental.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/Transcendental.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -639,11 +639,11 @@
   apply (subst lemma_realpow_rev_sumr)
   apply (subst sumr_diff_mult_const2)
   apply simp
-  apply (simp only: lemma_termdiff1 setsum_right_distrib)
+  apply (simp only: lemma_termdiff1 setsum_distrib_left)
   apply (rule setsum.cong [OF refl])
   apply (simp add: less_iff_Suc_add)
   apply clarify
-  apply (simp add: setsum_right_distrib diff_power_eq_setsum ac_simps
+  apply (simp add: setsum_distrib_left diff_power_eq_setsum ac_simps
       del: setsum_lessThan_Suc power_Suc)
   apply (subst mult.assoc [symmetric], subst power_add [symmetric])
   apply (simp add: ac_simps)
@@ -1448,7 +1448,7 @@
   also have "\<dots> = x * (\<Sum>i\<le>n. S x i * S y (n - i)) + y * (\<Sum>i\<le>n. S x i * S y (n - i))"
     by (rule distrib_right)
   also have "\<dots> = (\<Sum>i\<le>n. x * S x i * S y (n - i)) + (\<Sum>i\<le>n. S x i * y * S y (n - i))"
-    by (simp add: setsum_right_distrib ac_simps S_comm)
+    by (simp add: setsum_distrib_left ac_simps S_comm)
   also have "\<dots> = (\<Sum>i\<le>n. x * S x i * S y (n - i)) + (\<Sum>i\<le>n. S x i * (y * S y (n - i)))"
     by (simp add: ac_simps)
   also have "\<dots> = (\<Sum>i\<le>n. real (Suc i) *\<^sub>R (S x (Suc i) * S y (n - i))) +
@@ -3340,7 +3340,7 @@
        (if even p
         then of_real ((-1) ^ (p div 2) / (fact p)) * (\<Sum>n\<le>p. (p choose n) *\<^sub>R (x^n) * y^(p-n))
         else 0)"
-      by (auto simp: setsum_right_distrib field_simps scaleR_conv_of_real nonzero_of_real_divide)
+      by (auto simp: setsum_distrib_left field_simps scaleR_conv_of_real nonzero_of_real_divide)
     also have "\<dots> = cos_coeff p *\<^sub>R ((x + y) ^ p)"
       by (simp add: cos_coeff_def binomial_ring [of x y]  scaleR_conv_of_real atLeast0AtMost)
     finally show ?thesis .
@@ -5835,7 +5835,7 @@
     by (auto simp: pairs_le_eq_Sigma setsum.Sigma)
   also have "\<dots> = (\<Sum>r\<le>m + n. (\<Sum>k\<le>r. (a k) * (b (r - k))) * x ^ r)"
     apply (subst setsum_triangle_reindex_eq)
-    apply (auto simp: algebra_simps setsum_right_distrib intro!: setsum.cong)
+    apply (auto simp: algebra_simps setsum_distrib_left intro!: setsum.cong)
     apply (metis le_add_diff_inverse power_add)
     done
   finally show ?thesis .
@@ -5864,7 +5864,7 @@
   also have "\<dots> = (\<Sum>i\<le>n. a i * (x - y) * (\<Sum>j<i. y^(i - Suc j) * x^j))"
     by (simp add: power_diff_sumr2 mult.assoc)
   also have "\<dots> = (\<Sum>i\<le>n. \<Sum>j<i. a i * (x - y) * (y^(i - Suc j) * x^j))"
-    by (simp add: setsum_right_distrib)
+    by (simp add: setsum_distrib_left)
   also have "\<dots> = (\<Sum>(i,j) \<in> (SIGMA i : atMost n. lessThan i). a i * (x - y) * (y^(i - Suc j) * x^j))"
     by (simp add: setsum.Sigma)
   also have "\<dots> = (\<Sum>(j,i) \<in> (SIGMA j : lessThan n. {Suc j..n}). a i * (x - y) * (y^(i - Suc j) * x^j))"
@@ -5872,7 +5872,7 @@
   also have "\<dots> = (\<Sum>j<n. \<Sum>i=Suc j..n. a i * (x - y) * (y^(i - Suc j) * x^j))"
     by (simp add: setsum.Sigma)
   also have "\<dots> = (x - y) * (\<Sum>j<n. (\<Sum>i=Suc j..n. a i * y^(i - j - 1)) * x^j)"
-    by (simp add: setsum_right_distrib mult_ac)
+    by (simp add: setsum_distrib_left mult_ac)
   finally show ?thesis .
 qed
 
@@ -5894,7 +5894,7 @@
       by (auto simp add: setsum.reindex_bij_betw [OF h, symmetric] intro: setsum.strong_cong)
   qed
   then show ?thesis
-    by (simp add: polyfun_diff [OF assms] setsum_left_distrib)
+    by (simp add: polyfun_diff [OF assms] setsum_distrib_right)
 qed
 
 lemma polyfun_linear_factor:  (*COMPLEX_POLYFUN_LINEAR_FACTOR in HOL Light*)
@@ -5949,7 +5949,7 @@
       unfolding Set_Interval.setsum_atMost_Suc_shift
       by simp
     also have "\<dots> = w * (\<Sum>i\<le>n. c (Suc i) * w^i)"
-      by (simp add: setsum_right_distrib ac_simps)
+      by (simp add: setsum_distrib_left ac_simps)
     finally show ?thesis .
   qed
   then have w: "\<And>w. w \<noteq> 0 \<Longrightarrow> (\<Sum>i\<le>n. c (Suc i) * w^i) = 0"
--- a/src/HOL/ex/Sum_of_Powers.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/ex/Sum_of_Powers.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -110,7 +110,7 @@
     unfolding bernpoly_def by (rule DERIV_cong) (fast intro!: derivative_intros, simp)
   moreover have "(\<Sum>k\<le>n. real (Suc n - k) * x ^ (n - k) * (real (Suc n choose k) * bernoulli k)) = (n + 1) * bernpoly n x"
     unfolding bernpoly_def
-    by (auto intro: setsum.cong simp add: setsum_right_distrib real_binomial_eq_mult_binomial_Suc[of _ n] Suc_eq_plus1 of_nat_diff)
+    by (auto intro: setsum.cong simp add: setsum_distrib_left real_binomial_eq_mult_binomial_Suc[of _ n] Suc_eq_plus1 of_nat_diff)
   ultimately show ?thesis by auto
 qed
 
@@ -135,7 +135,7 @@
 lemma sum_of_powers: "(\<Sum>k\<le>n::nat. (real k) ^ m) = (bernpoly (Suc m) (n + 1) - bernpoly (Suc m) 0) / (m + 1)"
 proof -
   from diff_bernpoly[of "Suc m", simplified] have "(m + (1::real)) * (\<Sum>k\<le>n. (real k) ^ m) = (\<Sum>k\<le>n. bernpoly (Suc m) (real k + 1) - bernpoly (Suc m) (real k))"
-    by (auto simp add: setsum_right_distrib intro!: setsum.cong)
+    by (auto simp add: setsum_distrib_left intro!: setsum.cong)
   also have "... = (\<Sum>k\<le>n. bernpoly (Suc m) (real (k + 1)) - bernpoly (Suc m) (real k))"
     by simp
   also have "... = bernpoly (Suc m) (n + 1) - bernpoly (Suc m) 0"
--- a/src/HOL/ex/ThreeDivides.thy	Mon Sep 19 12:53:30 2016 +0200
+++ b/src/HOL/ex/ThreeDivides.thy	Mon Sep 19 20:06:21 2016 +0200
@@ -193,7 +193,7 @@
       "m = 10*(\<Sum>x<nd. m div 10 div 10^x mod 10 * 10^x) + c" by simp
     also have
       "\<dots> = (\<Sum>x<nd. m div 10 div 10^x mod 10 * 10^(x+1)) + c"
-      by (subst setsum_right_distrib) (simp add: ac_simps)
+      by (subst setsum_distrib_left) (simp add: ac_simps)
     also have
       "\<dots> = (\<Sum>x<nd. m div 10^(Suc x) mod 10 * 10^(Suc x)) + c"
       by (simp add: div_mult2_eq[symmetric])