left_distrib ~> distrib_right, right_distrib ~> distrib_left
authorfleury <Mathias.Fleury@mpi-inf.mpg.de>
Mon Sep 19 20:06:21 2016 +0200 (2016-09-19)
changeset 639186bf55e6e0b75
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
     1.1 --- a/NEWS	Mon Sep 19 12:53:30 2016 +0200
     1.2 +++ b/NEWS	Mon Sep 19 20:06:21 2016 +0200
     1.3 @@ -639,6 +639,11 @@
     1.4  one_step_implies_mult instead.
     1.5  INCOMPATIBILITY.
     1.6  
     1.7 +* The following theorems have been renamed:
     1.8 +  setsum_left_distrib ~> setsum_distrib_right
     1.9 +  setsum_right_distrib ~> setsum_distrib_left
    1.10 +INCOMPATIBILITY.
    1.11 +
    1.12  * Compound constants INFIMUM and SUPREMUM are mere abbreviations now.
    1.13  INCOMPATIBILITY.
    1.14  
     2.1 --- a/src/HOL/Analysis/Bounded_Linear_Function.thy	Mon Sep 19 12:53:30 2016 +0200
     2.2 +++ b/src/HOL/Analysis/Bounded_Linear_Function.thy	Mon Sep 19 20:06:21 2016 +0200
     2.3 @@ -352,7 +352,7 @@
     2.4    apply (rule norm_blinfun_bound)
     2.5     apply (simp add: setsum_nonneg)
     2.6    apply (subst euclidean_representation[symmetric, where 'a='a])
     2.7 -  apply (simp only: blinfun.bilinear_simps setsum_left_distrib)
     2.8 +  apply (simp only: blinfun.bilinear_simps setsum_distrib_right)
     2.9    apply (rule order.trans[OF norm_setsum setsum_mono])
    2.10    apply (simp add: abs_mult mult_right_mono ac_simps Basis_le_norm)
    2.11    done
    2.12 @@ -406,7 +406,7 @@
    2.13    "norm (blinfun_of_matrix a) \<le> (\<Sum>i\<in>Basis. \<Sum>j\<in>Basis. \<bar>a i j\<bar>)"
    2.14    apply (rule norm_blinfun_bound)
    2.15     apply (simp add: setsum_nonneg)
    2.16 -  apply (simp only: blinfun_of_matrix_apply setsum_left_distrib)
    2.17 +  apply (simp only: blinfun_of_matrix_apply setsum_distrib_right)
    2.18    apply (rule order_trans[OF norm_setsum setsum_mono])
    2.19    apply (rule order_trans[OF norm_setsum setsum_mono])
    2.20    apply (simp add: abs_mult mult_right_mono ac_simps Basis_le_norm)
     3.1 --- a/src/HOL/Analysis/Cartesian_Euclidean_Space.thy	Mon Sep 19 12:53:30 2016 +0200
     3.2 +++ b/src/HOL/Analysis/Cartesian_Euclidean_Space.thy	Mon Sep 19 20:06:21 2016 +0200
     3.3 @@ -119,8 +119,8 @@
     3.4    val ss1 =
     3.5      simpset_of (put_simpset HOL_basic_ss @{context}
     3.6        addsimps [@{thm setsum.distrib} RS sym,
     3.7 -      @{thm setsum_subtractf} RS sym, @{thm setsum_right_distrib},
     3.8 -      @{thm setsum_left_distrib}, @{thm setsum_negf} RS sym])
     3.9 +      @{thm setsum_subtractf} RS sym, @{thm setsum_distrib_left},
    3.10 +      @{thm setsum_distrib_right}, @{thm setsum_negf} RS sym])
    3.11    val ss2 =
    3.12      simpset_of (@{context} addsimps
    3.13               [@{thm plus_vec_def}, @{thm times_vec_def},
    3.14 @@ -326,7 +326,7 @@
    3.15  lemma setsum_cmul:
    3.16    fixes f:: "'c \<Rightarrow> ('a::semiring_1)^'n"
    3.17    shows "setsum (\<lambda>x. c *s f x) S = c *s setsum f S"
    3.18 -  by (simp add: vec_eq_iff setsum_right_distrib)
    3.19 +  by (simp add: vec_eq_iff setsum_distrib_left)
    3.20  
    3.21  lemma setsum_norm_allsubsets_bound_cart:
    3.22    fixes f:: "'a \<Rightarrow> real ^'n"
    3.23 @@ -517,14 +517,14 @@
    3.24    done
    3.25  
    3.26  lemma matrix_mul_assoc: "A ** (B ** C) = (A ** B) ** C"
    3.27 -  apply (vector matrix_matrix_mult_def setsum_right_distrib setsum_left_distrib mult.assoc)
    3.28 +  apply (vector matrix_matrix_mult_def setsum_distrib_left setsum_distrib_right mult.assoc)
    3.29    apply (subst setsum.commute)
    3.30    apply simp
    3.31    done
    3.32  
    3.33  lemma matrix_vector_mul_assoc: "A *v (B *v x) = (A ** B) *v x"
    3.34    apply (vector matrix_matrix_mult_def matrix_vector_mult_def
    3.35 -    setsum_right_distrib setsum_left_distrib mult.assoc)
    3.36 +    setsum_distrib_left setsum_distrib_right mult.assoc)
    3.37    apply (subst setsum.commute)
    3.38    apply simp
    3.39    done
    3.40 @@ -555,7 +555,7 @@
    3.41    by (simp add: matrix_vector_mult_def inner_vec_def)
    3.42  
    3.43  lemma dot_lmul_matrix: "((x::real ^_) v* A) \<bullet> y = x \<bullet> (A *v y)"
    3.44 -  apply (simp add: inner_vec_def matrix_vector_mult_def vector_matrix_mult_def setsum_left_distrib setsum_right_distrib ac_simps)
    3.45 +  apply (simp add: inner_vec_def matrix_vector_mult_def vector_matrix_mult_def setsum_distrib_right setsum_distrib_left ac_simps)
    3.46    apply (subst setsum.commute)
    3.47    apply simp
    3.48    done
    3.49 @@ -630,7 +630,7 @@
    3.50  
    3.51  lemma matrix_vector_mul_linear: "linear(\<lambda>x. A *v (x::real ^ _))"
    3.52    by (simp add: linear_iff matrix_vector_mult_def vec_eq_iff
    3.53 -      field_simps setsum_right_distrib setsum.distrib)
    3.54 +      field_simps setsum_distrib_left setsum.distrib)
    3.55  
    3.56  lemma matrix_works:
    3.57    assumes lf: "linear f"
    3.58 @@ -660,7 +660,7 @@
    3.59  lemma adjoint_matrix: "adjoint(\<lambda>x. (A::real^'n^'m) *v x) = (\<lambda>x. transpose A *v x)"
    3.60    apply (rule adjoint_unique)
    3.61    apply (simp add: transpose_def inner_vec_def matrix_vector_mult_def
    3.62 -    setsum_left_distrib setsum_right_distrib)
    3.63 +    setsum_distrib_right setsum_distrib_left)
    3.64    apply (subst setsum.commute)
    3.65    apply (auto simp add: ac_simps)
    3.66    done
     4.1 --- a/src/HOL/Analysis/Cauchy_Integral_Theorem.thy	Mon Sep 19 12:53:30 2016 +0200
     4.2 +++ b/src/HOL/Analysis/Cauchy_Integral_Theorem.thy	Mon Sep 19 20:06:21 2016 +0200
     4.3 @@ -6215,7 +6215,7 @@
     4.4          by (metis (no_types) dist_norm divide_eq_1_iff less_irrefl mem_ball norm_minus_commute r w)
     4.5        have "norm ((\<Sum>k<N. (w - z) ^ k * f u / (u - z) ^ Suc k) * (u - w) - f u)
     4.6              = norm ((\<Sum>k<N. (((w - z) / (u - z)) ^ k)) * f u * (u - w) / (u - z) - f u)"
     4.7 -        unfolding setsum_left_distrib setsum_divide_distrib power_divide by (simp add: algebra_simps)
     4.8 +        unfolding setsum_distrib_right setsum_divide_distrib power_divide by (simp add: algebra_simps)
     4.9        also have "... = norm ((((w - z) / (u - z)) ^ N - 1) * (u - w) / (((w - z) / (u - z) - 1) * (u - z)) - 1) * norm (f u)"
    4.10          using \<open>0 < B\<close>
    4.11          apply (auto simp: geometric_sum [OF wzu_not1])
     5.1 --- a/src/HOL/Analysis/Complex_Analysis_Basics.thy	Mon Sep 19 12:53:30 2016 +0200
     5.2 +++ b/src/HOL/Analysis/Complex_Analysis_Basics.thy	Mon Sep 19 20:06:21 2016 +0200
     5.3 @@ -951,7 +951,7 @@
     5.4        then have "cmod h * cmod ((\<Sum>i<n. f' i y) - g' y) \<le> cmod h * e"
     5.5          by (auto simp: antisym_conv2 mult_le_cancel_left norm_triangle_ineq2)
     5.6        then show "cmod ((\<Sum>i<n. h * f' i y) - g' y * h) \<le> e * cmod h"
     5.7 -        by (simp add: norm_mult [symmetric] field_simps setsum_right_distrib)
     5.8 +        by (simp add: norm_mult [symmetric] field_simps setsum_distrib_left)
     5.9      qed
    5.10    } note ** = this
    5.11    show ?thesis
     6.1 --- a/src/HOL/Analysis/Complex_Transcendental.thy	Mon Sep 19 12:53:30 2016 +0200
     6.2 +++ b/src/HOL/Analysis/Complex_Transcendental.thy	Mon Sep 19 20:06:21 2016 +0200
     6.3 @@ -597,7 +597,7 @@
     6.4  text\<open>32-bit Approximation to e\<close>
     6.5  lemma e_approx_32: "\<bar>exp(1) - 5837465777 / 2147483648\<bar> \<le> (inverse(2 ^ 32)::real)"
     6.6    using Taylor_exp [of 1 14] exp_le
     6.7 -  apply (simp add: setsum_left_distrib in_Reals_norm Re_exp atMost_nat_numeral fact_numeral)
     6.8 +  apply (simp add: setsum_distrib_right in_Reals_norm Re_exp atMost_nat_numeral fact_numeral)
     6.9    apply (simp only: pos_le_divide_eq [symmetric], linarith)
    6.10    done
    6.11  
     7.1 --- a/src/HOL/Analysis/Conformal_Mappings.thy	Mon Sep 19 12:53:30 2016 +0200
     7.2 +++ b/src/HOL/Analysis/Conformal_Mappings.thy	Mon Sep 19 20:06:21 2016 +0200
     7.3 @@ -2846,7 +2846,7 @@
     7.4          qed
     7.5      qed
     7.6    also have "... = c * (\<Sum>p\<in>pts. winding_number g p * residue f p)"
     7.7 -    by (simp add: setsum_right_distrib algebra_simps)
     7.8 +    by (simp add: setsum_distrib_left algebra_simps)
     7.9    finally show ?thesis unfolding c_def .
    7.10  qed
    7.11  
    7.12 @@ -3459,7 +3459,7 @@
    7.13              qed
    7.14          qed
    7.15        then have "(\<Sum>p\<in>zeros. w p * cont p) = c * (\<Sum>p\<in>zeros.  w p *  h p * zorder f p)"
    7.16 -        apply (subst setsum_right_distrib)
    7.17 +        apply (subst setsum_distrib_left)
    7.18          by (simp add:algebra_simps)
    7.19        moreover have "(\<Sum>p\<in>poles. w p * cont p) = (\<Sum>p\<in>poles.  - c * w p *  h p * porder f p)"
    7.20          proof (rule setsum.cong[of poles poles,simplified])
    7.21 @@ -3479,7 +3479,7 @@
    7.22              qed
    7.23          qed
    7.24        then have "(\<Sum>p\<in>poles. w p * cont p) = - c * (\<Sum>p\<in>poles. w p *  h p * porder f p)"
    7.25 -        apply (subst setsum_right_distrib)
    7.26 +        apply (subst setsum_distrib_left)
    7.27          by (simp add:algebra_simps)
    7.28        ultimately show ?thesis by (simp add: right_diff_distrib)
    7.29      qed
     8.1 --- a/src/HOL/Analysis/Convex_Euclidean_Space.thy	Mon Sep 19 12:53:30 2016 +0200
     8.2 +++ b/src/HOL/Analysis/Convex_Euclidean_Space.thy	Mon Sep 19 20:06:21 2016 +0200
     8.3 @@ -523,7 +523,7 @@
     8.4          qed auto
     8.5          then show ?thesis
     8.6            apply (rule_tac IA[of "s - {x}" "\<lambda>y. (inverse (1 - u x) * u y)"])
     8.7 -          unfolding setsum_right_distrib[symmetric]
     8.8 +          unfolding setsum_distrib_left[symmetric]
     8.9            using as and *** and True
    8.10            apply auto
    8.11            done
    8.12 @@ -536,7 +536,7 @@
    8.13          then show ?thesis
    8.14            using as(3)[THEN bspec[where x=a], THEN bspec[where x=b]]
    8.15            using *** *(2) and \<open>s \<subseteq> V\<close>
    8.16 -          unfolding setsum_right_distrib
    8.17 +          unfolding setsum_distrib_left
    8.18            by (auto simp add: setsum_clauses(2))
    8.19        qed
    8.20        then have "u x + (1 - u x) = 1 \<Longrightarrow>
    8.21 @@ -619,7 +619,7 @@
    8.22        unfolding scaleR_left_distrib setsum.distrib if_smult scaleR_zero_left
    8.23          ** setsum.inter_restrict[OF xy, symmetric]
    8.24        unfolding scaleR_scaleR[symmetric] Real_Vector_Spaces.scaleR_right.setsum [symmetric]
    8.25 -        and setsum_right_distrib[symmetric]
    8.26 +        and setsum_distrib_left[symmetric]
    8.27        unfolding x y
    8.28        using x(1-3) y(1-3) uv
    8.29        apply simp
    8.30 @@ -1323,7 +1323,7 @@
    8.31      apply (rule_tac x="s - {v}" in exI)
    8.32      apply (rule_tac x="\<lambda>x. - (1 / u v) * u x" in exI)
    8.33      unfolding scaleR_scaleR[symmetric] and scaleR_right.setsum [symmetric]
    8.34 -    unfolding setsum_right_distrib[symmetric] and setsum_diff1[OF as(1)]
    8.35 +    unfolding setsum_distrib_left[symmetric] and setsum_diff1[OF as(1)]
    8.36      using as
    8.37      apply auto
    8.38      done
    8.39 @@ -1793,7 +1793,7 @@
    8.40      apply rule
    8.41      unfolding * and setsum.If_cases[OF finite_atLeastAtMost[of 1 "k1 + k2"]] and
    8.42        setsum.reindex[OF inj] and o_def Collect_mem_eq
    8.43 -    unfolding scaleR_scaleR[symmetric] scaleR_right.setsum [symmetric] setsum_right_distrib[symmetric]
    8.44 +    unfolding scaleR_scaleR[symmetric] scaleR_right.setsum [symmetric] setsum_distrib_left[symmetric]
    8.45    proof -
    8.46      fix i
    8.47      assume i: "i \<in> {1..k1+k2}"
    8.48 @@ -1844,7 +1844,7 @@
    8.49    }
    8.50    moreover
    8.51    have "(\<Sum>x\<in>s. u * ux x + v * uy x) = 1"
    8.52 -    unfolding setsum.distrib and setsum_right_distrib[symmetric] and ux(2) uy(2)
    8.53 +    unfolding setsum.distrib and setsum_distrib_left[symmetric] and ux(2) uy(2)
    8.54      using uv(3) by auto
    8.55    moreover
    8.56    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)"
    8.57 @@ -3306,7 +3306,7 @@
    8.58      have *: "\<And>f. setsum f (s - {a}) = setsum f s - ((f a)::'b::ab_group_add)"
    8.59        unfolding setsum.remove[OF obt(1) \<open>a\<in>s\<close>] by auto
    8.60      have "(\<Sum>v\<in>s. u v + t * w v) = 1"
    8.61 -      unfolding setsum.distrib wv(1) setsum_right_distrib[symmetric] obt(5) by auto
    8.62 +      unfolding setsum.distrib wv(1) setsum_distrib_left[symmetric] obt(5) by auto
    8.63      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"
    8.64        unfolding setsum.distrib obt(6) scaleR_scaleR[symmetric] scaleR_right.setsum [symmetric] wv(4)
    8.65        using a(2) [THEN eq_neg_iff_add_eq_0 [THEN iffD2]] by simp
    8.66 @@ -5279,7 +5279,7 @@
    8.67      apply (rule_tac x="{v \<in> c. u v < 0}" in exI)
    8.68      apply (rule_tac x="\<lambda>y. inverse (setsum u {x\<in>c. u x > 0}) * - u y" in exI)
    8.69      using assms(1) unfolding scaleR_scaleR[symmetric] scaleR_right.setsum [symmetric] and z_def
    8.70 -    apply (auto simp add: setsum_negf setsum_right_distrib[symmetric])
    8.71 +    apply (auto simp add: setsum_negf setsum_distrib_left[symmetric])
    8.72      done
    8.73    moreover have "\<forall>x\<in>{v \<in> c. 0 < u v}. 0 \<le> inverse (setsum u {x \<in> c. 0 < u x}) * u x"
    8.74      apply rule
    8.75 @@ -5294,7 +5294,7 @@
    8.76      using assms(1)
    8.77      unfolding scaleR_scaleR[symmetric] scaleR_right.setsum [symmetric] and z_def
    8.78      using *
    8.79 -    apply (auto simp add: setsum_negf setsum_right_distrib[symmetric])
    8.80 +    apply (auto simp add: setsum_negf setsum_distrib_left[symmetric])
    8.81      done
    8.82    ultimately show ?thesis
    8.83      apply (rule_tac x="{v\<in>c. u v \<le> 0}" in exI)
    8.84 @@ -5683,7 +5683,7 @@
    8.85      unfolding convex_hull_indexed mem_Collect_eq by auto
    8.86    have "(\<Sum>i = 1..k. u i * f (v i)) \<le> b"
    8.87      using setsum_mono[of "{1..k}" "\<lambda>i. u i * f (v i)" "\<lambda>i. u i * b"]
    8.88 -    unfolding setsum_left_distrib[symmetric] obt(2) mult_1
    8.89 +    unfolding setsum_distrib_right[symmetric] obt(2) mult_1
    8.90      apply (drule_tac meta_mp)
    8.91      apply (rule mult_left_mono)
    8.92      using assms(2) obt(1)
    8.93 @@ -9200,9 +9200,9 @@
    8.94      have ge0: "\<forall>i\<in>I. e i \<ge> 0"
    8.95        using e_def xc yc uv by simp
    8.96      have "setsum (\<lambda>i. u * c i) I = u * setsum c I"
    8.97 -      by (simp add: setsum_right_distrib)
    8.98 +      by (simp add: setsum_distrib_left)
    8.99      moreover have "setsum (\<lambda>i. v * d i) I = v * setsum d I"
   8.100 -      by (simp add: setsum_right_distrib)
   8.101 +      by (simp add: setsum_distrib_left)
   8.102      ultimately have sum1: "setsum e I = 1"
   8.103        using e_def xc yc uv by (simp add: setsum.distrib)
   8.104      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)"
   8.105 @@ -11857,7 +11857,7 @@
   8.106    have sum_dd0: "setsum dd S = 0"
   8.107      unfolding dd_def  using S
   8.108      by (simp add: sumSS' comm_monoid_add_class.setsum.distrib setsum_subtractf
   8.109 -                  algebra_simps setsum_left_distrib [symmetric] b1)
   8.110 +                  algebra_simps setsum_distrib_right [symmetric] b1)
   8.111    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
   8.112      by (simp add: pth_5 real_vector.scale_setsum_right mult.commute)
   8.113    then have *: "(\<Sum>v\<in>S. (b v * x) *\<^sub>R v) = x *\<^sub>R a" for x
     9.1 --- a/src/HOL/Analysis/Derivative.thy	Mon Sep 19 12:53:30 2016 +0200
     9.2 +++ b/src/HOL/Analysis/Derivative.thy	Mon Sep 19 20:06:21 2016 +0200
     9.3 @@ -2244,7 +2244,7 @@
     9.4      {
     9.5        fix n :: nat and x h :: 'a assume nx: "n \<ge> N" "x \<in> s"
     9.6        have "norm ((\<Sum>i<n. f' i x * h) - g' x * h) = norm ((\<Sum>i<n. f' i x) - g' x) * norm h"
     9.7 -        by (simp add: norm_mult [symmetric] ring_distribs setsum_left_distrib)
     9.8 +        by (simp add: norm_mult [symmetric] ring_distribs setsum_distrib_right)
     9.9        also from N[OF nx] have "norm ((\<Sum>i<n. f' i x) - g' x) \<le> e" by simp
    9.10        hence "norm ((\<Sum>i<n. f' i x) - g' x) * norm h \<le> e * norm h"
    9.11          by (intro mult_right_mono) simp_all
    10.1 --- a/src/HOL/Analysis/Determinants.thy	Mon Sep 19 12:53:30 2016 +0200
    10.2 +++ b/src/HOL/Analysis/Determinants.thy	Mon Sep 19 20:06:21 2016 +0200
    10.3 @@ -226,7 +226,7 @@
    10.4    fixes A :: "'a::comm_ring_1^'n^'n"
    10.5    assumes p: "p permutes (UNIV :: 'n::finite set)"
    10.6    shows "det (\<chi> i. A$p i :: 'a^'n^'n) = of_int (sign p) * det A"
    10.7 -  apply (simp add: det_def setsum_right_distrib mult.assoc[symmetric])
    10.8 +  apply (simp add: det_def setsum_distrib_left mult.assoc[symmetric])
    10.9    apply (subst sum_permutations_compose_right[OF p])
   10.10  proof (rule setsum.cong)
   10.11    let ?U = "UNIV :: 'n set"
   10.12 @@ -372,7 +372,7 @@
   10.13    fixes a b :: "'n::finite \<Rightarrow> _ ^ 'n"
   10.14    shows "det((\<chi> i. if i = k then c *s a i else b i)::'a::comm_ring_1^'n^'n) =
   10.15      c * det((\<chi> i. if i = k then a i else b i)::'a::comm_ring_1^'n^'n)"
   10.16 -  unfolding det_def vec_lambda_beta setsum_right_distrib
   10.17 +  unfolding det_def vec_lambda_beta setsum_distrib_left
   10.18  proof (rule setsum.cong)
   10.19    let ?U = "UNIV :: 'n set"
   10.20    let ?pU = "{p. p permutes ?U}"
   10.21 @@ -645,7 +645,7 @@
   10.22  lemma det_rows_mul:
   10.23    "det((\<chi> i. c i *s a i)::'a::comm_ring_1^'n^'n) =
   10.24      setprod (\<lambda>i. c i) (UNIV:: 'n set) * det((\<chi> i. a i)::'a^'n^'n)"
   10.25 -proof (simp add: det_def setsum_right_distrib cong add: setprod.cong, rule setsum.cong)
   10.26 +proof (simp add: det_def setsum_distrib_left cong add: setprod.cong, rule setsum.cong)
   10.27    let ?U = "UNIV :: 'n set"
   10.28    let ?PU = "{p. p permutes ?U}"
   10.29    fix p
    11.1 --- a/src/HOL/Analysis/Finite_Cartesian_Product.thy	Mon Sep 19 12:53:30 2016 +0200
    11.2 +++ b/src/HOL/Analysis/Finite_Cartesian_Product.thy	Mon Sep 19 20:06:21 2016 +0200
    11.3 @@ -461,7 +461,7 @@
    11.4      by (simp add: inner_add_left setsum.distrib)
    11.5    show "inner (scaleR r x) y = r * inner x y"
    11.6      unfolding inner_vec_def
    11.7 -    by (simp add: setsum_right_distrib)
    11.8 +    by (simp add: setsum_distrib_left)
    11.9    show "0 \<le> inner x x"
   11.10      unfolding inner_vec_def
   11.11      by (simp add: setsum_nonneg)
    12.1 --- a/src/HOL/Analysis/Gamma_Function.thy	Mon Sep 19 12:53:30 2016 +0200
    12.2 +++ b/src/HOL/Analysis/Gamma_Function.thy	Mon Sep 19 20:06:21 2016 +0200
    12.3 @@ -450,7 +450,7 @@
    12.4        (\<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
    12.5        by (intro order.trans[OF norm_setsum setsum_mono[OF ln_Gamma_series_complex_converges_aux]]) simp_all
    12.6      also have "... \<le> 2 * (norm t + norm t^2) * (\<Sum>k=Suc m..n. 1 / (of_nat k)\<^sup>2)"
    12.7 -      by (simp add: setsum_right_distrib)
    12.8 +      by (simp add: setsum_distrib_left)
    12.9      also have "... < 2 * (norm t + norm t^2) * e'" using mn z t_nz
   12.10        by (intro mult_strict_left_mono N mult_pos_pos add_pos_pos) simp_all
   12.11      also from e''_pos have "... = e * ((cmod t + (cmod t)\<^sup>2) / e'')"
   12.12 @@ -543,7 +543,7 @@
   12.13        by (subst atLeast0LessThan [symmetric], subst setsum_shift_bounds_Suc_ivl [symmetric],
   12.14            subst atLeastLessThanSuc_atLeastAtMost) simp_all
   12.15      also have "\<dots> = z * of_real (harm n) - (\<Sum>k=1..n. ln (1 + z / of_nat k))"
   12.16 -      by (simp add: harm_def setsum_subtractf setsum_right_distrib divide_inverse)
   12.17 +      by (simp add: harm_def setsum_subtractf setsum_distrib_left divide_inverse)
   12.18      also from n have "\<dots> - ?g n = 0"
   12.19        by (simp add: ln_Gamma_series_def setsum_subtractf algebra_simps Ln_of_nat)
   12.20      finally show "(\<Sum>k<n. ?f k) - ?g n = 0" .
   12.21 @@ -944,7 +944,7 @@
   12.22        using z' n by (intro uniformly_convergent_mult Polygamma_converges) (simp_all add: n'_def)
   12.23      thus "uniformly_convergent_on (ball z d)
   12.24                (\<lambda>k z. \<Sum>i<k. - of_nat n' * inverse ((z + of_nat i :: 'a) ^ (n'+1)))"
   12.25 -      by (subst (asm) setsum_right_distrib) simp
   12.26 +      by (subst (asm) setsum_distrib_left) simp
   12.27    qed (insert Polygamma_converges'[OF z' n'] d, simp_all)
   12.28    also have "(\<Sum>k. - of_nat n' * inverse ((z + of_nat k) ^ (n' + 1))) =
   12.29                 (- of_nat n') * (\<Sum>k. inverse ((z + of_nat k) ^ (n' + 1)))"
   12.30 @@ -2573,7 +2573,7 @@
   12.31  proof -
   12.32    have "(\<Prod>k=1..n. exp (z * of_real (ln (1 + 1 / of_nat k)))) =
   12.33            exp (z * of_real (\<Sum>k = 1..n. ln (1 + 1 / real_of_nat k)))"
   12.34 -    by (subst exp_setsum [symmetric]) (simp_all add: setsum_right_distrib)
   12.35 +    by (subst exp_setsum [symmetric]) (simp_all add: setsum_distrib_left)
   12.36    also have "(\<Sum>k=1..n. ln (1 + 1 / of_nat k) :: real) = ln (\<Prod>k=1..n. 1 + 1 / real_of_nat k)"
   12.37      by (subst ln_setprod [symmetric]) (auto intro!: add_pos_nonneg)
   12.38    also have "(\<Prod>k=1..n. 1 + 1 / of_nat k :: real) = (\<Prod>k=1..n. (of_nat k + 1) / of_nat k)"
    13.1 --- a/src/HOL/Analysis/Henstock_Kurzweil_Integration.thy	Mon Sep 19 12:53:30 2016 +0200
    13.2 +++ b/src/HOL/Analysis/Henstock_Kurzweil_Integration.thy	Mon Sep 19 20:06:21 2016 +0200
    13.3 @@ -3756,7 +3756,7 @@
    13.4    have "norm (setsum (\<lambda>l. content l *\<^sub>R c) p) \<le> (\<Sum>i\<in>p. norm (content i *\<^sub>R c))"
    13.5      using norm_setsum by blast
    13.6    also have "...  \<le> e * (\<Sum>i\<in>p. \<bar>content i\<bar>)"
    13.7 -    by (simp add: setsum_right_distrib[symmetric] mult.commute assms(2) mult_right_mono setsum_nonneg)
    13.8 +    by (simp add: setsum_distrib_left[symmetric] mult.commute assms(2) mult_right_mono setsum_nonneg)
    13.9    also have "... \<le> e * content (cbox a b)"
   13.10      apply (rule mult_left_mono [OF _ e])
   13.11      apply (simp add: sumeq)
   13.12 @@ -3792,7 +3792,7 @@
   13.13      apply (rule order_trans[OF setsum_mono])
   13.14      apply (rule mult_left_mono[OF _ abs_ge_zero, of _ e])
   13.15      apply (metis norm)
   13.16 -    unfolding setsum_left_distrib[symmetric]
   13.17 +    unfolding setsum_distrib_right[symmetric]
   13.18      using con setsum_le
   13.19      apply (auto simp: mult.commute intro: mult_left_mono [OF _ e])
   13.20      done
   13.21 @@ -4697,7 +4697,7 @@
   13.22          done
   13.23        have "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - 0) \<le> setsum (\<lambda>i. (real i + 1) *
   13.24          norm (setsum (\<lambda>(x,k). content k *\<^sub>R indicator s x :: real) (q i))) {..N+1}"
   13.25 -        unfolding real_norm_def setsum_right_distrib abs_of_nonneg[OF *] diff_0_right
   13.26 +        unfolding real_norm_def setsum_distrib_left abs_of_nonneg[OF *] diff_0_right
   13.27          apply (rule order_trans)
   13.28          apply (rule norm_setsum)
   13.29          apply (subst sum_sum_product)
   13.30 @@ -4775,7 +4775,7 @@
   13.31            done
   13.32        qed
   13.33        also have "\<dots> < e * inverse 2 * 2"
   13.34 -        unfolding divide_inverse setsum_right_distrib[symmetric]
   13.35 +        unfolding divide_inverse setsum_distrib_left[symmetric]
   13.36          apply (rule mult_strict_left_mono)
   13.37          unfolding power_inverse [symmetric] lessThan_Suc_atMost[symmetric]
   13.38          apply (subst geometric_sum)
   13.39 @@ -5313,7 +5313,7 @@
   13.40      show "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f' x) - (f b - f a)) \<le> e * content (cbox a b)"
   13.41        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]
   13.42        unfolding additive_tagged_division_1[OF assms(1) as(1)[simplified box_real],of "\<lambda>x. x",symmetric]
   13.43 -      unfolding setsum_right_distrib
   13.44 +      unfolding setsum_distrib_left
   13.45        defer
   13.46        unfolding setsum_subtractf[symmetric]
   13.47      proof (rule setsum_norm_le,safe)
   13.48 @@ -6479,7 +6479,7 @@
   13.49        by arith
   13.50      show ?case
   13.51        unfolding content_real[OF assms(1)] and *[of "\<lambda>x. x"] *[of f] setsum_subtractf[symmetric] split_minus
   13.52 -      unfolding setsum_right_distrib
   13.53 +      unfolding setsum_distrib_left
   13.54        apply (subst(2) pA)
   13.55        apply (subst pA)
   13.56        unfolding setsum.union_disjoint[OF pA(2-)]
   13.57 @@ -6548,7 +6548,7 @@
   13.58          apply (unfold split_paired_all split_conv)
   13.59          defer
   13.60          unfolding setsum.union_disjoint[OF pA(2-),symmetric] pA(1)[symmetric]
   13.61 -        unfolding setsum_right_distrib[symmetric]
   13.62 +        unfolding setsum_distrib_left[symmetric]
   13.63          apply (subst additive_tagged_division_1[OF _ as(1)])
   13.64          apply (rule assms)
   13.65        proof -
   13.66 @@ -8856,7 +8856,7 @@
   13.67        apply rule
   13.68        apply (drule qq)
   13.69        defer
   13.70 -      unfolding divide_inverse setsum_left_distrib[symmetric]
   13.71 +      unfolding divide_inverse setsum_distrib_right[symmetric]
   13.72        unfolding divide_inverse[symmetric]
   13.73        using * apply (auto simp add: field_simps)
   13.74        done
   13.75 @@ -8976,7 +8976,7 @@
   13.76      done
   13.77    have th: "op ^ x \<circ> op + m = (\<lambda>i. x^m * x^i)"
   13.78      by (rule ext) (simp add: power_add power_mult)
   13.79 -  from setsum.reindex[OF i, of "op ^ x", unfolded f th setsum_right_distrib[symmetric]]
   13.80 +  from setsum.reindex[OF i, of "op ^ x", unfolded f th setsum_distrib_left[symmetric]]
   13.81    have "?lhs = x^m * ((1 - x) * setsum (op ^ x) {0..n - m})"
   13.82      by simp
   13.83    then show ?thesis
   13.84 @@ -9164,7 +9164,7 @@
   13.85            apply (rule norm_setsum)
   13.86            apply (rule setsum_mono)
   13.87            unfolding split_paired_all split_conv
   13.88 -          unfolding split_def setsum_left_distrib[symmetric] scaleR_diff_right[symmetric]
   13.89 +          unfolding split_def setsum_distrib_right[symmetric] scaleR_diff_right[symmetric]
   13.90            unfolding additive_content_tagged_division[OF p(1), unfolded split_def]
   13.91          proof -
   13.92            fix x k
   13.93 @@ -9201,7 +9201,7 @@
   13.94            proof
   13.95              show "(\<Sum>i = 0..s. e / 2 ^ (i + 2)) < e / 2"
   13.96                unfolding power_add divide_inverse inverse_mult_distrib
   13.97 -              unfolding setsum_right_distrib[symmetric] setsum_left_distrib[symmetric]
   13.98 +              unfolding setsum_distrib_left[symmetric] setsum_distrib_right[symmetric]
   13.99                unfolding power_inverse [symmetric] sum_gp
  13.100                apply(rule mult_strict_left_mono[OF _ e])
  13.101                unfolding power2_eq_square
  13.102 @@ -10350,7 +10350,7 @@
  13.103                by auto
  13.104            qed
  13.105            finally show "(\<Sum>i\<in>d. \<bar>content (l \<inter> i)\<bar> * norm (f x)) = content l *\<^sub>R norm (f x)"
  13.106 -            unfolding setsum_left_distrib[symmetric] real_scaleR_def
  13.107 +            unfolding setsum_distrib_right[symmetric] real_scaleR_def
  13.108              apply (subst(asm) additive_content_division[OF division_inter_1[OF d(1)]])
  13.109              using xl(2)[unfolded uv]
  13.110              unfolding uv
  13.111 @@ -10614,7 +10614,7 @@
  13.112    proof goal_cases
  13.113      case prems: (2 d)
  13.114      have "(\<Sum>k\<in>d. norm (integral k (h \<circ> f))) \<le> setsum (\<lambda>k. norm(integral k f)) d * b"
  13.115 -      unfolding setsum_left_distrib
  13.116 +      unfolding setsum_distrib_right
  13.117        apply (rule setsum_mono)
  13.118      proof goal_cases
  13.119        case (1 k)
    14.1 --- a/src/HOL/Analysis/Homeomorphism.thy	Mon Sep 19 12:53:30 2016 +0200
    14.2 +++ b/src/HOL/Analysis/Homeomorphism.thy	Mon Sep 19 20:06:21 2016 +0200
    14.3 @@ -1007,7 +1007,7 @@
    14.4    have gf[simp]: "g (f x) = x" for x
    14.5      apply (rule euclidean_eqI)
    14.6      apply (simp add: f_def g_def inner_setsum_left scaleR_setsum_left algebra_simps)
    14.7 -    apply (simp add: Groups_Big.setsum_right_distrib [symmetric] *)
    14.8 +    apply (simp add: Groups_Big.setsum_distrib_left [symmetric] *)
    14.9      done
   14.10    then have "inj f" by (metis injI)
   14.11    have gfU: "g ` f ` U = U"
    15.1 --- a/src/HOL/Analysis/L2_Norm.thy	Mon Sep 19 12:53:30 2016 +0200
    15.2 +++ b/src/HOL/Analysis/L2_Norm.thy	Mon Sep 19 20:06:21 2016 +0200
    15.3 @@ -58,7 +58,7 @@
    15.4    "0 \<le> r \<Longrightarrow> r * setL2 f A = setL2 (\<lambda>x. r * f x) A"
    15.5    unfolding setL2_def
    15.6    apply (simp add: power_mult_distrib)
    15.7 -  apply (simp add: setsum_right_distrib [symmetric])
    15.8 +  apply (simp add: setsum_distrib_left [symmetric])
    15.9    apply (simp add: real_sqrt_mult setsum_nonneg)
   15.10    done
   15.11  
   15.12 @@ -66,7 +66,7 @@
   15.13    "0 \<le> r \<Longrightarrow> setL2 f A * r = setL2 (\<lambda>x. f x * r) A"
   15.14    unfolding setL2_def
   15.15    apply (simp add: power_mult_distrib)
   15.16 -  apply (simp add: setsum_left_distrib [symmetric])
   15.17 +  apply (simp add: setsum_distrib_right [symmetric])
   15.18    apply (simp add: real_sqrt_mult setsum_nonneg)
   15.19    done
   15.20  
    16.1 --- a/src/HOL/Analysis/Lebesgue_Measure.thy	Mon Sep 19 12:53:30 2016 +0200
    16.2 +++ b/src/HOL/Analysis/Lebesgue_Measure.thy	Mon Sep 19 20:06:21 2016 +0200
    16.3 @@ -235,7 +235,7 @@
    16.4        by auto
    16.5      also have "... = (\<Sum>i \<in> S. F(r i) - F(l i)) +
    16.6          (epsilon / 4) * (\<Sum>i \<in> S. (1 / 2)^i)" (is "_ = ?t + _")
    16.7 -      by (subst setsum.distrib) (simp add: field_simps setsum_right_distrib)
    16.8 +      by (subst setsum.distrib) (simp add: field_simps setsum_distrib_left)
    16.9      also have "... \<le> ?t + (epsilon / 4) * (\<Sum> i < Suc n. (1 / 2)^i)"
   16.10        apply (rule add_left_mono)
   16.11        apply (rule mult_left_mono)
    17.1 --- a/src/HOL/Analysis/Linear_Algebra.thy	Mon Sep 19 12:53:30 2016 +0200
    17.2 +++ b/src/HOL/Analysis/Linear_Algebra.thy	Mon Sep 19 20:06:21 2016 +0200
    17.3 @@ -1960,7 +1960,7 @@
    17.4      qed
    17.5      from setsum_norm_le[of _ ?g, OF th]
    17.6      show "norm (f x) \<le> ?B * norm x"
    17.7 -      unfolding th0 setsum_left_distrib by metis
    17.8 +      unfolding th0 setsum_distrib_right by metis
    17.9    qed
   17.10  qed
   17.11  
   17.12 @@ -2021,7 +2021,7 @@
   17.13      unfolding bilinear_setsum[OF bh finite_Basis finite_Basis] ..
   17.14    finally have th: "norm (h x y) = \<dots>" .
   17.15    show "norm (h x y) \<le> (\<Sum>i\<in>Basis. \<Sum>j\<in>Basis. norm (h i j)) * norm x * norm y"
   17.16 -    apply (auto simp add: setsum_left_distrib th setsum.cartesian_product)
   17.17 +    apply (auto simp add: setsum_distrib_right th setsum.cartesian_product)
   17.18      apply (rule setsum_norm_le)
   17.19      apply simp
   17.20      apply (auto simp add: bilinear_rmul[OF bh] bilinear_lmul[OF bh]
    18.1 --- a/src/HOL/Analysis/Nonnegative_Lebesgue_Integration.thy	Mon Sep 19 12:53:30 2016 +0200
    18.2 +++ b/src/HOL/Analysis/Nonnegative_Lebesgue_Integration.thy	Mon Sep 19 20:06:21 2016 +0200
    18.3 @@ -550,7 +550,7 @@
    18.4    qed
    18.5    also have "\<dots> = (\<Sum>y\<in>f`space M. (\<Sum>z\<in>g`space M.
    18.6        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))"
    18.7 -    by (auto intro!: setsum.cong simp: setsum_right_distrib)
    18.8 +    by (auto intro!: setsum.cong simp: setsum_distrib_left)
    18.9    also have "\<dots> = ?r"
   18.10      by (subst setsum.commute)
   18.11         (auto intro!: setsum.cong simp: setsum.If_cases scaleR_setsum_right[symmetric] eq)
   18.12 @@ -592,7 +592,7 @@
   18.13      using f by (intro simple_function_partition) auto
   18.14    also have "\<dots> = c * integral\<^sup>S M f"
   18.15      using f unfolding simple_integral_def
   18.16 -    by (subst setsum_right_distrib) (auto simp: mult.assoc Int_def conj_commute)
   18.17 +    by (subst setsum_distrib_left) (auto simp: mult.assoc Int_def conj_commute)
   18.18    finally show ?thesis .
   18.19  qed
   18.20  
    19.1 --- a/src/HOL/Analysis/Poly_Roots.thy	Mon Sep 19 12:53:30 2016 +0200
    19.2 +++ b/src/HOL/Analysis/Poly_Roots.thy	Mon Sep 19 20:06:21 2016 +0200
    19.3 @@ -24,7 +24,7 @@
    19.4  lemma setsum_power_add:
    19.5    fixes x :: "'a::{comm_ring,monoid_mult}"
    19.6    shows "(\<Sum>i\<in>I. x^(m+i)) = x^m * (\<Sum>i\<in>I. x^i)"
    19.7 -  by (simp add: setsum_right_distrib power_add)
    19.8 +  by (simp add: setsum_distrib_left power_add)
    19.9  
   19.10  lemma setsum_power_shift:
   19.11    fixes x :: "'a::{comm_ring,monoid_mult}"
   19.12 @@ -32,7 +32,7 @@
   19.13    shows "(\<Sum>i=m..n. x^i) = x^m * (\<Sum>i\<le>n-m. x^i)"
   19.14  proof -
   19.15    have "(\<Sum>i=m..n. x^i) = x^m * (\<Sum>i=m..n. x^(i-m))"
   19.16 -    by (simp add: setsum_right_distrib power_add [symmetric])
   19.17 +    by (simp add: setsum_distrib_left power_add [symmetric])
   19.18    also have "(\<Sum>i=m..n. x^(i-m)) = (\<Sum>i\<le>n-m. x^i)"
   19.19      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
   19.20    finally show ?thesis .
   19.21 @@ -88,7 +88,7 @@
   19.22    also have "... = (\<Sum>i\<le>n. a i * (x - y) * (\<Sum>j<i. y^(i - Suc j) * x^j))"
   19.23      by (simp add: power_diff_sumr2 ac_simps)
   19.24    also have "... = (x - y) * (\<Sum>i\<le>n. (\<Sum>j<i. a i * y^(i - Suc j) * x^j))"
   19.25 -    by (simp add: setsum_right_distrib ac_simps)
   19.26 +    by (simp add: setsum_distrib_left ac_simps)
   19.27    also have "... = (x - y) * (\<Sum>j<n. (\<Sum>i=Suc j..n. a i * y^(i - Suc j) * x^j))"
   19.28      by (simp add: nested_setsum_swap')
   19.29    finally show ?thesis .
   19.30 @@ -115,7 +115,7 @@
   19.31    { fix z
   19.32      have "(\<Sum>i\<le>n. c i * z^i) - (\<Sum>i\<le>n. c i * a^i) =
   19.33            (z - a) * (\<Sum>j<n. (\<Sum>k = Suc j..n. c k * a^(k - Suc j)) * z^j)"
   19.34 -      by (simp add: sub_polyfun setsum_left_distrib)
   19.35 +      by (simp add: sub_polyfun setsum_distrib_right)
   19.36      then have "(\<Sum>i\<le>n. c i * z^i) =
   19.37            (z - a) * (\<Sum>j<n. (\<Sum>k = Suc j..n. c k * a^(k - Suc j)) * z^j)
   19.38            + (\<Sum>i\<le>n. c i * a^i)"
    20.1 --- a/src/HOL/Analysis/Polytope.thy	Mon Sep 19 12:53:30 2016 +0200
    20.2 +++ b/src/HOL/Analysis/Polytope.thy	Mon Sep 19 20:06:21 2016 +0200
    20.3 @@ -303,7 +303,7 @@
    20.4      have cge0: "\<And>i. i \<in> S \<Longrightarrow> 0 \<le> c i"
    20.5        using a b u01 by (simp add: c_def)
    20.6      have sumc1: "setsum c S = 1"
    20.7 -      by (simp add: c_def setsum.distrib setsum_right_distrib [symmetric] asum bsum)
    20.8 +      by (simp add: c_def setsum.distrib setsum_distrib_left [symmetric] asum bsum)
    20.9      have sumci_xy: "(\<Sum>i\<in>S. c i *\<^sub>R i) = (1 - u) *\<^sub>R x + u *\<^sub>R y"
   20.10        apply (simp add: c_def setsum.distrib scaleR_left_distrib)
   20.11        by (simp only: scaleR_scaleR [symmetric] Real_Vector_Spaces.scaleR_right.setsum [symmetric] aeqx beqy)
   20.12 @@ -357,7 +357,7 @@
   20.13            apply (rule_tac x="\<lambda>i. inverse (1-k) * c i" in exI)
   20.14            apply auto
   20.15            apply (metis sumcf cge0 inverse_nonnegative_iff_nonnegative mult_nonneg_nonneg S(2) setsum_nonneg subsetCE)
   20.16 -          apply (metis False mult.commute right_inverse right_minus_eq setsum_right_distrib sumcf)
   20.17 +          apply (metis False mult.commute right_inverse right_minus_eq setsum_distrib_left sumcf)
   20.18            by (metis (mono_tags, lifting) scaleR_right.setsum scaleR_scaleR setsum.cong)
   20.19          with \<open>0 < k\<close>  have "inverse(k) *\<^sub>R (w - setsum (\<lambda>i. c i *\<^sub>R i) T) \<in> affine hull T"
   20.20            by (simp add: affine_diff_divide [OF affine_affine_hull] False waff convex_hull_subset_affine_hull [THEN subsetD])
   20.21 @@ -365,7 +365,7 @@
   20.22            apply (simp add: weq_sumsum convex_hull_finite fin)
   20.23            apply (rule_tac x="\<lambda>i. inverse k * c i" in exI)
   20.24            using \<open>k > 0\<close> cge0
   20.25 -          apply (auto simp: scaleR_right.setsum setsum_right_distrib [symmetric] k_def [symmetric])
   20.26 +          apply (auto simp: scaleR_right.setsum setsum_distrib_left [symmetric] k_def [symmetric])
   20.27            done
   20.28          ultimately show ?thesis
   20.29            using disj by blast
    21.1 --- a/src/HOL/Analysis/Summation_Tests.thy	Mon Sep 19 12:53:30 2016 +0200
    21.2 +++ b/src/HOL/Analysis/Summation_Tests.thy	Mon Sep 19 20:06:21 2016 +0200
    21.3 @@ -288,7 +288,7 @@
    21.4      qed
    21.5      from this and A have "Bseq (\<lambda>n. \<Sum>k<n. 2^k * f (2^Suc k))" by (rule Bseq_eventually_mono)
    21.6      from Bseq_mult[OF Bfun_const[of 2] this] have "Bseq (\<lambda>n. \<Sum>k<n. 2^Suc k * f (2^Suc k))"
    21.7 -      by (simp add: setsum_right_distrib setsum_left_distrib mult_ac)
    21.8 +      by (simp add: setsum_distrib_left setsum_distrib_right mult_ac)
    21.9      hence "Bseq (\<lambda>n. (\<Sum>k=Suc 0..<Suc n. 2^k * f (2^k)) + f 1)"
   21.10        by (intro Bseq_add, subst setsum_shift_bounds_Suc_ivl) (simp add: atLeast0LessThan)
   21.11      hence "Bseq (\<lambda>n. (\<Sum>k=0..<Suc n. 2^k * f (2^k)))"
   21.12 @@ -424,7 +424,7 @@
   21.13      have n: "n > m" by (simp add: n_def)
   21.14  
   21.15      from r have "r * norm (\<Sum>k\<le>n. f k) = norm (\<Sum>k\<le>n. r * f k)"
   21.16 -      by (simp add: setsum_right_distrib[symmetric] abs_mult)
   21.17 +      by (simp add: setsum_distrib_left[symmetric] abs_mult)
   21.18      also from n have "{..n} = {..m} \<union> {Suc m..n}" by auto
   21.19      hence "(\<Sum>k\<le>n. r * f k) = (\<Sum>k\<in>{..m} \<union> {Suc m..n}. r * f k)" by (simp only:)
   21.20      also have "\<dots> = (\<Sum>k\<le>m. r * f k) + (\<Sum>k=Suc m..n. r * f k)"
    22.1 --- a/src/HOL/Analysis/Weierstrass_Theorems.thy	Mon Sep 19 12:53:30 2016 +0200
    22.2 +++ b/src/HOL/Analysis/Weierstrass_Theorems.thy	Mon Sep 19 20:06:21 2016 +0200
    22.3 @@ -38,7 +38,7 @@
    22.4  
    22.5  lemma sum_k_Bernstein [simp]: "(\<Sum>k = 0..n. real k * Bernstein n k x) = of_nat n * x"
    22.6    apply (subst binomial_deriv1 [of n x "1-x", simplified, symmetric])
    22.7 -  apply (simp add: setsum_left_distrib)
    22.8 +  apply (simp add: setsum_distrib_right)
    22.9    apply (auto simp: Bernstein_def algebra_simps realpow_num_eq_if intro!: setsum.cong)
   22.10    done
   22.11  
   22.12 @@ -46,7 +46,7 @@
   22.13  proof -
   22.14    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"
   22.15      apply (subst binomial_deriv2 [of n x "1-x", simplified, symmetric])
   22.16 -    apply (simp add: setsum_left_distrib)
   22.17 +    apply (simp add: setsum_distrib_right)
   22.18      apply (rule setsum.cong [OF refl])
   22.19      apply (simp add: Bernstein_def power2_eq_square algebra_simps)
   22.20      apply (rename_tac k)
   22.21 @@ -98,7 +98,7 @@
   22.22          by (simp add: algebra_simps power2_eq_square)
   22.23        have "(\<Sum> k = 0..n. (k - n * x)\<^sup>2 * Bernstein n k x) = n * x * (1 - x)"
   22.24          apply (simp add: * setsum.distrib)
   22.25 -        apply (simp add: setsum_right_distrib [symmetric] mult.assoc)
   22.26 +        apply (simp add: setsum_distrib_left [symmetric] mult.assoc)
   22.27          apply (simp add: algebra_simps power2_eq_square)
   22.28          done
   22.29        then have "(\<Sum> k = 0..n. (k - n * x)\<^sup>2 * Bernstein n k x)/n^2 = x * (1 - x) / n"
   22.30 @@ -138,14 +138,14 @@
   22.31          qed
   22.32      } note * = this
   22.33      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>"
   22.34 -      by (simp add: setsum_subtractf setsum_right_distrib [symmetric] algebra_simps)
   22.35 +      by (simp add: setsum_subtractf setsum_distrib_left [symmetric] algebra_simps)
   22.36      also have "... \<le> (\<Sum> k = 0..n. (e/2 + (2 * M / d\<^sup>2) * (x - k / n)\<^sup>2) * Bernstein n k x)"
   22.37        apply (rule order_trans [OF setsum_abs setsum_mono])
   22.38        using *
   22.39        apply (simp add: abs_mult Bernstein_nonneg x mult_right_mono)
   22.40        done
   22.41      also have "... \<le> e/2 + (2 * M) / (d\<^sup>2 * n)"
   22.42 -      apply (simp only: setsum.distrib Rings.semiring_class.distrib_right setsum_right_distrib [symmetric] mult.assoc sum_bern)
   22.43 +      apply (simp only: setsum.distrib Rings.semiring_class.distrib_right setsum_distrib_left [symmetric] mult.assoc sum_bern)
   22.44        using \<open>d>0\<close> x
   22.45        apply (simp add: divide_simps Mge0 mult_le_one mult_left_le)
   22.46        done
    23.1 --- a/src/HOL/Analysis/ex/Approximations.thy	Mon Sep 19 12:53:30 2016 +0200
    23.2 +++ b/src/HOL/Analysis/ex/Approximations.thy	Mon Sep 19 20:06:21 2016 +0200
    23.3 @@ -30,7 +30,7 @@
    23.4        by (subst atLeast0LessThan [symmetric], subst setsum_head_upt_Suc) simp_all
    23.5      also have "(\<Sum>k=Suc 0..<Suc m. f k * x^k) = (\<Sum>k<m. f (k+1) * x^k) * x"
    23.6        by (subst setsum_shift_bounds_Suc_ivl)
    23.7 -         (simp add: setsum_left_distrib algebra_simps atLeast0LessThan power_commutes)
    23.8 +         (simp add: setsum_distrib_right algebra_simps atLeast0LessThan power_commutes)
    23.9      finally have "(\<Sum>k<Suc m. f k * x ^ k) = f 0 + (\<Sum>k<m. f (k + 1) * x ^ k) * x" .
   23.10    }
   23.11    from this[of "pred_numeral n"]
   23.12 @@ -199,7 +199,7 @@
   23.13  lemma euler_approx_aux_Suc:
   23.14    "euler_approx_aux (Suc m) = 1 + Suc m * euler_approx_aux m"
   23.15    unfolding euler_approx_aux_def
   23.16 -  by (subst setsum_right_distrib) (simp add: atLeastAtMostSuc_conv)
   23.17 +  by (subst setsum_distrib_left) (simp add: atLeastAtMostSuc_conv)
   23.18  
   23.19  lemma eval_euler_approx_aux:
   23.20    "euler_approx_aux 0 = 1"
   23.21 @@ -209,7 +209,7 @@
   23.22  proof -
   23.23    have A: "euler_approx_aux (Suc m) = 1 + Suc m * euler_approx_aux m" for m :: nat
   23.24      unfolding euler_approx_aux_def
   23.25 -    by (subst setsum_right_distrib) (simp add: atLeastAtMostSuc_conv)
   23.26 +    by (subst setsum_distrib_left) (simp add: atLeastAtMostSuc_conv)
   23.27    show ?th by (subst numeral_eq_Suc, subst A, subst numeral_eq_Suc [symmetric]) simp
   23.28  qed (simp_all add: euler_approx_aux_def)
   23.29  
   23.30 @@ -281,7 +281,7 @@
   23.31                     y_def [symmetric] d_def [symmetric])
   23.32    also have "2 * y * (\<Sum>k<n. inverse (real (2 * k + 1)) * y\<^sup>2 ^ k) = 
   23.33                 (\<Sum>k<n. 2 * y^(2*k+1) / (real (2 * k + 1)))"
   23.34 -    by (subst setsum_right_distrib, simp, subst power_mult) 
   23.35 +    by (subst setsum_distrib_left, simp, subst power_mult) 
   23.36         (simp_all add: divide_simps mult_ac power_mult)
   23.37    finally show ?case by (simp only: d_def y_def approx_def) 
   23.38  qed
   23.39 @@ -380,7 +380,7 @@
   23.40    from sums_split_initial_segment[OF this, of n]
   23.41      have "(\<lambda>i. x * ((- x\<^sup>2) ^ (i + n) / real (2 * (i + n) + 1))) sums
   23.42              (arctan x - arctan_approx n x)"
   23.43 -    by (simp add: arctan_approx_def setsum_right_distrib)
   23.44 +    by (simp add: arctan_approx_def setsum_distrib_left)
   23.45    from sums_group[OF this, of 2] assms
   23.46      have sums: "(\<lambda>k. x * (x\<^sup>2)^n * (x^4)^k * c k) sums (arctan x - arctan_approx n x)"
   23.47      by (simp add: algebra_simps power_add power_mult [symmetric] c_def)
   23.48 @@ -423,7 +423,7 @@
   23.49        by (subst atLeast0LessThan [symmetric], subst setsum_head_upt_Suc) simp_all
   23.50      also have "(\<Sum>k=Suc 0..<Suc m. inverse (f k * x^k)) = (\<Sum>k<m. inverse (f (k+1) * x^k)) / x"
   23.51        by (subst setsum_shift_bounds_Suc_ivl)
   23.52 -         (simp add: setsum_right_distrib divide_inverse algebra_simps
   23.53 +         (simp add: setsum_distrib_left divide_inverse algebra_simps
   23.54                      atLeast0LessThan power_commutes)
   23.55      finally have "(\<Sum>k<Suc m. inverse (f k) * inverse (x ^ k)) =
   23.56                        inverse (f 0) + (\<Sum>k<m. inverse (f (k + 1)) * inverse (x ^ k)) / x" by simp
    24.1 --- a/src/HOL/Binomial.thy	Mon Sep 19 12:53:30 2016 +0200
    24.2 +++ b/src/HOL/Binomial.thy	Mon Sep 19 20:06:21 2016 +0200
    24.3 @@ -341,7 +341,7 @@
    24.4      by (rule distrib_right)
    24.5    also have "\<dots> = (\<Sum>k=0..n. of_nat (n choose k) * a^(k+1) * b^(n-k)) +
    24.6        (\<Sum>k=0..n. of_nat (n choose k) * a^k * b^(n - k + 1))"
    24.7 -    by (auto simp add: setsum_right_distrib ac_simps)
    24.8 +    by (auto simp add: setsum_distrib_left ac_simps)
    24.9    also have "\<dots> = (\<Sum>k=0..n. of_nat (n choose k) * a^k * b^(n + 1 - k)) +
   24.10        (\<Sum>k=1..n+1. of_nat (n choose (k - 1)) * a^k * b^(n + 1 - k))"
   24.11      by (simp add:setsum_shift_bounds_cl_Suc_ivl Suc_diff_le field_simps del: setsum_cl_ivl_Suc)
   24.12 @@ -463,7 +463,7 @@
   24.13    also have "\<dots> = (\<Sum>i\<le>n. of_nat (n choose i) + (-1) ^ i * of_nat (n choose i))"
   24.14      by (simp add: setsum.distrib)
   24.15    also have "\<dots> = 2 * (\<Sum>i\<le>n. if even i then of_nat (n choose i) else 0)"
   24.16 -    by (subst setsum_right_distrib, intro setsum.cong) simp_all
   24.17 +    by (subst setsum_distrib_left, intro setsum.cong) simp_all
   24.18    finally show ?thesis ..
   24.19  qed
   24.20  
   24.21 @@ -477,7 +477,7 @@
   24.22    also have "\<dots> = (\<Sum>i\<le>n. of_nat (n choose i) - (-1) ^ i * of_nat (n choose i))"
   24.23      by (simp add: setsum_subtractf)
   24.24    also have "\<dots> = 2 * (\<Sum>i\<le>n. if odd i then of_nat (n choose i) else 0)"
   24.25 -    by (subst setsum_right_distrib, intro setsum.cong) simp_all
   24.26 +    by (subst setsum_distrib_left, intro setsum.cong) simp_all
   24.27    finally show ?thesis ..
   24.28  qed
   24.29  
   24.30 @@ -914,7 +914,7 @@
   24.31    have "(\<Sum>i\<le>n. i * (n choose i)) = (\<Sum>i\<le>Suc m. i * (Suc m choose i))"
   24.32      by (simp add: Suc)
   24.33    also have "\<dots> = Suc m * 2 ^ m"
   24.34 -    by (simp only: setsum_atMost_Suc_shift Suc_times_binomial setsum_right_distrib[symmetric])
   24.35 +    by (simp only: setsum_atMost_Suc_shift Suc_times_binomial setsum_distrib_left[symmetric])
   24.36         (simp add: choose_row_sum')
   24.37    finally show ?thesis
   24.38      using Suc by simp
   24.39 @@ -934,9 +934,9 @@
   24.40        (\<Sum>i\<le>Suc m. (-1) ^ i * of_nat i * of_nat (Suc m choose i))"
   24.41      by (simp add: Suc)
   24.42    also have "\<dots> = (\<Sum>i\<le>m. (-1) ^ (Suc i) * of_nat (Suc i * (Suc m choose Suc i)))"
   24.43 -    by (simp only: setsum_atMost_Suc_shift setsum_right_distrib[symmetric] mult_ac of_nat_mult) simp
   24.44 +    by (simp only: setsum_atMost_Suc_shift setsum_distrib_left[symmetric] mult_ac of_nat_mult) simp
   24.45    also have "\<dots> = - of_nat (Suc m) * (\<Sum>i\<le>m. (-1) ^ i * of_nat (m choose i))"
   24.46 -    by (subst setsum_right_distrib, rule setsum.cong[OF refl], subst Suc_times_binomial)
   24.47 +    by (subst setsum_distrib_left, rule setsum.cong[OF refl], subst Suc_times_binomial)
   24.48         (simp add: algebra_simps)
   24.49    also have "(\<Sum>i\<le>m. (-1 :: 'a) ^ i * of_nat ((m choose i))) = 0"
   24.50      using choose_alternating_sum[OF \<open>m > 0\<close>] by simp
   24.51 @@ -978,7 +978,7 @@
   24.52      by (subst setsum_atMost_Suc_shift) (simp add: ring_distribs setsum.distrib)
   24.53    also have "(\<Sum>i\<le>n. of_nat (n choose i) * pochhammer a (Suc i) * pochhammer b (n - i)) =
   24.54        a * pochhammer ((a + 1) + b) n"
   24.55 -    by (subst Suc) (simp add: setsum_right_distrib pochhammer_rec mult_ac)
   24.56 +    by (subst Suc) (simp add: setsum_distrib_left pochhammer_rec mult_ac)
   24.57    also have "(\<Sum>i\<le>n. of_nat (n choose Suc i) * pochhammer a (Suc i) * pochhammer b (n - i)) +
   24.58          pochhammer b (Suc n) =
   24.59        (\<Sum>i=0..Suc n. of_nat (n choose i) * pochhammer a i * pochhammer b (Suc n - i))"
   24.60 @@ -992,7 +992,7 @@
   24.61    also have "\<dots> = (\<Sum>i\<le>n. of_nat (n choose i) * pochhammer a i * pochhammer b (Suc (n - i)))"
   24.62      by (intro setsum.cong) (simp_all add: Suc_diff_le)
   24.63    also have "\<dots> = b * pochhammer (a + (b + 1)) n"
   24.64 -    by (subst Suc) (simp add: setsum_right_distrib mult_ac pochhammer_rec)
   24.65 +    by (subst Suc) (simp add: setsum_distrib_left mult_ac pochhammer_rec)
   24.66    also have "a * pochhammer ((a + 1) + b) n + b * pochhammer (a + (b + 1)) n =
   24.67        pochhammer (a + b) (Suc n)"
   24.68      by (simp add: pochhammer_rec algebra_simps)
   24.69 @@ -1263,9 +1263,9 @@
   24.70        by (simp only:)
   24.71    qed
   24.72    also have "\<dots> + ?B = y * (\<Sum>k=1..mm. (G mm k)) + (of_nat mm + r gchoose (Suc mm)) * x^(Suc mm)"
   24.73 -    unfolding G_def by (subst setsum_right_distrib) (simp add: algebra_simps)
   24.74 +    unfolding G_def by (subst setsum_distrib_left) (simp add: algebra_simps)
   24.75    also have "(\<Sum>k=0..mm. (of_nat mm + r gchoose k) * x^(Suc k) * y^(mm - k)) = x * (S mm)"
   24.76 -    unfolding S_def by (subst setsum_right_distrib) (simp add: atLeast0AtMost algebra_simps)
   24.77 +    unfolding S_def by (subst setsum_distrib_left) (simp add: atLeast0AtMost algebra_simps)
   24.78    also have "(G (Suc mm) 0) = y * (G mm 0)"
   24.79      by (simp add: G_def)
   24.80    finally have "S (Suc mm) =
   24.81 @@ -1283,7 +1283,7 @@
   24.82    also have "(x + y) * S mm + \<dots> = (x + y) * ?rhs mm + (- r gchoose (Suc mm)) * (- x)^Suc mm"
   24.83      unfolding S_def by (subst Suc.IH) simp
   24.84    also have "(x + y) * ?rhs mm = (\<Sum>n\<le>mm. ((- r gchoose n) * (- x) ^ n * (x + y) ^ (Suc mm - n)))"
   24.85 -    by (subst setsum_right_distrib, rule setsum.cong) (simp_all add: Suc_diff_le)
   24.86 +    by (subst setsum_distrib_left, rule setsum.cong) (simp_all add: Suc_diff_le)
   24.87    also have "\<dots> + (-r gchoose (Suc mm)) * (-x)^Suc mm =
   24.88        (\<Sum>n\<le>Suc mm. (- r gchoose n) * (- x) ^ n * (x + y) ^ (Suc mm - n))"
   24.89      by simp
   24.90 @@ -1345,7 +1345,7 @@
   24.91      using gbinomial_partial_sum_poly_xpos[where x="1" and y="1" and r="of_nat m + 1" and m="m"]
   24.92      by (simp add: add_ac)
   24.93    also have "\<dots> = 2 ^ m * (\<Sum>k\<le>m. (of_nat (m + k) gchoose k) / 2 ^ k)"
   24.94 -    by (subst setsum_right_distrib) (simp add: algebra_simps power_diff)
   24.95 +    by (subst setsum_distrib_left) (simp add: algebra_simps power_diff)
   24.96    finally show ?thesis
   24.97      by (subst (asm) mult_left_cancel) simp_all
   24.98  qed
   24.99 @@ -1444,7 +1444,7 @@
  24.100      by simp
  24.101    also have "\<dots> = nat (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (\<Sum>_\<in>\<Inter>I. (- 1) ^ (card I + 1)))"
  24.102      (is "_ = nat ?rhs")
  24.103 -    by (subst setsum_right_distrib) simp
  24.104 +    by (subst setsum_distrib_left) simp
  24.105    also have "?rhs = (\<Sum>(I, _)\<in>Sigma {I. I \<subseteq> A \<and> I \<noteq> {}} Inter. (- 1) ^ (card I + 1))"
  24.106      using assms by (subst setsum.Sigma) auto
  24.107    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))"
  24.108 @@ -1474,7 +1474,7 @@
  24.109      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)))"
  24.110        using assms by (subst setsum.Sigma) auto
  24.111      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))"
  24.112 -      by (subst setsum_right_distrib) simp
  24.113 +      by (subst setsum_distrib_left) simp
  24.114      also have "\<dots> = (\<Sum>i=1..card K. (- 1) ^ (i + 1) * (\<Sum>I|I \<subseteq> K \<and> card I = i. 1))"
  24.115        (is "_ = ?rhs")
  24.116      proof (rule setsum.mono_neutral_cong_right[rule_format])
  24.117 @@ -1508,7 +1508,7 @@
  24.118      also have "\<dots> = (\<Sum>i = 0..card K. (- 1) * ((- 1) ^ i * int (card K choose i))) + 1"
  24.119        using K by (subst n_subsets[symmetric]) simp_all
  24.120      also have "\<dots> = - (\<Sum>i = 0..card K. (- 1) ^ i * int (card K choose i)) + 1"
  24.121 -      by (subst setsum_right_distrib[symmetric]) simp
  24.122 +      by (subst setsum_distrib_left[symmetric]) simp
  24.123      also have "\<dots> =  - ((-1 + 1) ^ card K) + 1"
  24.124        by (subst binomial_ring) (simp add: ac_simps)
  24.125      also have "\<dots> = 1"
    25.1 --- a/src/HOL/Decision_Procs/Approximation.thy	Mon Sep 19 12:53:30 2016 +0200
    25.2 +++ b/src/HOL/Decision_Procs/Approximation.thy	Mon Sep 19 20:06:21 2016 +0200
    25.3 @@ -31,7 +31,7 @@
    25.4    have shift_pow: "\<And>i. - (x * ((-1)^i * a (Suc i) * x ^ i)) = (-1)^(Suc i) * a (Suc i) * x ^ (Suc i)"
    25.5      by auto
    25.6    show ?thesis
    25.7 -    unfolding setsum_right_distrib shift_pow uminus_add_conv_diff [symmetric] setsum_negf[symmetric]
    25.8 +    unfolding setsum_distrib_left shift_pow uminus_add_conv_diff [symmetric] setsum_negf[symmetric]
    25.9      setsum_head_upt_Suc[OF zero_less_Suc]
   25.10      setsum.reindex[OF inj_Suc, unfolded comp_def, symmetric, of "\<lambda> n. (-1)^n  *a n * x^n"] by auto
   25.11  qed
   25.12 @@ -514,7 +514,7 @@
   25.13    proof -
   25.14      have "(sqrt y * lb_arctan_horner prec n 1 y) \<le> ?S n"
   25.15        using bounds(1) \<open>0 \<le> sqrt y\<close>
   25.16 -      apply (simp only: power_add power_one_right mult.assoc[symmetric] setsum_left_distrib[symmetric])
   25.17 +      apply (simp only: power_add power_one_right mult.assoc[symmetric] setsum_distrib_right[symmetric])
   25.18        apply (simp only: mult.commute[where 'a=real] mult.commute[of _ "2::nat"] power_mult)
   25.19        apply (auto intro!: mult_left_mono)
   25.20        done
   25.21 @@ -527,7 +527,7 @@
   25.22      have "arctan (sqrt y) \<le> ?S (Suc n)" using arctan_bounds ..
   25.23      also have "\<dots> \<le> (sqrt y * ub_arctan_horner prec (Suc n) 1 y)"
   25.24        using bounds(2)[of "Suc n"] \<open>0 \<le> sqrt y\<close>
   25.25 -      apply (simp only: power_add power_one_right mult.assoc[symmetric] setsum_left_distrib[symmetric])
   25.26 +      apply (simp only: power_add power_one_right mult.assoc[symmetric] setsum_distrib_right[symmetric])
   25.27        apply (simp only: mult.commute[where 'a=real] mult.commute[of _ "2::nat"] power_mult)
   25.28        apply (auto intro!: mult_left_mono)
   25.29        done
   25.30 @@ -1212,7 +1212,7 @@
   25.31    from horner_bounds[where lb="lb_sin_cos_aux prec" and ub="ub_sin_cos_aux prec" and j'=0,
   25.32      OF \<open>0 \<le> real_of_float (x * x)\<close> f_eq lb_sin_cos_aux.simps ub_sin_cos_aux.simps]
   25.33    show "?lb" and "?ub" using \<open>0 \<le> real_of_float x\<close>
   25.34 -    apply (simp_all only: power_add power_one_right mult.assoc[symmetric] setsum_left_distrib[symmetric])
   25.35 +    apply (simp_all only: power_add power_one_right mult.assoc[symmetric] setsum_distrib_right[symmetric])
   25.36      apply (simp_all only: mult.commute[where 'a=real] of_nat_fact)
   25.37      apply (auto intro!: mult_left_mono simp add: power_mult power2_eq_square[of "real_of_float x"])
   25.38      done
   25.39 @@ -2193,7 +2193,7 @@
   25.40    let "?s n" = "(- 1) ^ n * (1 / real (1 + n)) * (real_of_float x)^(Suc n)"
   25.41  
   25.42    have "?lb \<le> setsum ?s {0 ..< 2 * ev}"
   25.43 -    unfolding power_Suc2 mult.assoc[symmetric] times_float.rep_eq setsum_left_distrib[symmetric]
   25.44 +    unfolding power_Suc2 mult.assoc[symmetric] times_float.rep_eq setsum_distrib_right[symmetric]
   25.45      unfolding mult.commute[of "real_of_float x"] ev 
   25.46      using horner_bounds(1)[where G="\<lambda> i k. Suc k" and F="\<lambda>x. x" and f="\<lambda>x. x" 
   25.47                      and lb="\<lambda>n i k x. lb_ln_horner prec n k x" 
   25.48 @@ -2208,7 +2208,7 @@
   25.49    have "?ln \<le> setsum ?s {0 ..< 2 * od + 1}"
   25.50      using ln_bounds(2)[OF \<open>0 \<le> real_of_float x\<close> \<open>real_of_float x < 1\<close>] by auto
   25.51    also have "\<dots> \<le> ?ub"
   25.52 -    unfolding power_Suc2 mult.assoc[symmetric] times_float.rep_eq setsum_left_distrib[symmetric]
   25.53 +    unfolding power_Suc2 mult.assoc[symmetric] times_float.rep_eq setsum_distrib_right[symmetric]
   25.54      unfolding mult.commute[of "real_of_float x"] od
   25.55      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",
   25.56        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>
   25.57 @@ -4019,7 +4019,7 @@
   25.58                 inverse (real (\<Prod> j \<in> {k..<k+Suc n}. j)) * ?f (Suc n) t * (xs!x - c)^Suc n" (is "_ = ?T")
   25.59          unfolding funpow_Suc C_def[symmetric] setsum_move0 setprod_head_Suc
   25.60          by (auto simp add: algebra_simps)
   25.61 -          (simp only: mult.left_commute [of _ "inverse (real k)"] setsum_right_distrib [symmetric])
   25.62 +          (simp only: mult.left_commute [of _ "inverse (real k)"] setsum_distrib_left [symmetric])
   25.63        finally have "?T \<in> {l .. u}" .
   25.64      }
   25.65      thus ?thesis using DERIV by blast
    26.1 --- a/src/HOL/Deriv.thy	Mon Sep 19 12:53:30 2016 +0200
    26.2 +++ b/src/HOL/Deriv.thy	Mon Sep 19 20:06:21 2016 +0200
    26.3 @@ -368,7 +368,7 @@
    26.4      using insert by (intro has_derivative_mult) auto
    26.5    also have "?P = (\<lambda>y. \<Sum>i'\<in>insert i I. f' i' y * (\<Prod>j\<in>insert i I - {i'}. f j x))"
    26.6      using insert(1,2)
    26.7 -    by (auto simp add: setsum_right_distrib insert_Diff_if intro!: ext setsum.cong)
    26.8 +    by (auto simp add: setsum_distrib_left insert_Diff_if intro!: ext setsum.cong)
    26.9    finally show ?case
   26.10      using insert by simp
   26.11  qed
   26.12 @@ -845,7 +845,7 @@
   26.13    "(\<And> n. n \<in> S \<Longrightarrow> ((\<lambda>x. f x n) has_field_derivative (f' x n)) F) \<Longrightarrow>
   26.14      ((\<lambda>x. setsum (f x) S) has_field_derivative setsum (f' x) S) F"
   26.15    by (rule has_derivative_imp_has_field_derivative [OF has_derivative_setsum])
   26.16 -     (auto simp: setsum_right_distrib mult_commute_abs dest: has_field_derivative_imp_has_derivative)
   26.17 +     (auto simp: setsum_distrib_left mult_commute_abs dest: has_field_derivative_imp_has_derivative)
   26.18  
   26.19  lemma DERIV_inverse'[derivative_intros]:
   26.20    assumes "(f has_field_derivative D) (at x within s)"
    27.1 --- a/src/HOL/Groups_Big.thy	Mon Sep 19 12:53:30 2016 +0200
    27.2 +++ b/src/HOL/Groups_Big.thy	Mon Sep 19 20:06:21 2016 +0200
    27.3 @@ -729,7 +729,7 @@
    27.4    "finite F \<Longrightarrow> (setsum f F = 0) = (\<forall>a\<in>F. f a = 0)"
    27.5    by (intro ballI setsum_nonneg_eq_0_iff zero_le)
    27.6  
    27.7 -lemma setsum_right_distrib: "r * setsum f A = setsum (\<lambda>n. r * f n) A"
    27.8 +lemma setsum_distrib_left: "r * setsum f A = setsum (\<lambda>n. r * f n) A"
    27.9    for f :: "'a \<Rightarrow> 'b::semiring_0"
   27.10  proof (induct A rule: infinite_finite_induct)
   27.11    case infinite
   27.12 @@ -742,7 +742,7 @@
   27.13    then show ?case by (simp add: distrib_left)
   27.14  qed
   27.15  
   27.16 -lemma setsum_left_distrib: "setsum f A * r = (\<Sum>n\<in>A. f n * r)"
   27.17 +lemma setsum_distrib_right: "setsum f A * r = (\<Sum>n\<in>A. f n * r)"
   27.18    for r :: "'a::semiring_0"
   27.19  proof (induct A rule: infinite_finite_induct)
   27.20    case infinite
   27.21 @@ -811,7 +811,7 @@
   27.22  lemma setsum_product:
   27.23    fixes f :: "'a \<Rightarrow> 'b::semiring_0"
   27.24    shows "setsum f A * setsum g B = (\<Sum>i\<in>A. \<Sum>j\<in>B. f i * g j)"
   27.25 -  by (simp add: setsum_right_distrib setsum_left_distrib) (rule setsum.commute)
   27.26 +  by (simp add: setsum_distrib_left setsum_distrib_right) (rule setsum.commute)
   27.27  
   27.28  lemma setsum_mult_setsum_if_inj:
   27.29    fixes f :: "'a \<Rightarrow> 'b::semiring_0"
    28.1 --- a/src/HOL/Inequalities.thy	Mon Sep 19 12:53:30 2016 +0200
    28.2 +++ b/src/HOL/Inequalities.thy	Mon Sep 19 20:06:21 2016 +0200
    28.3 @@ -59,7 +59,7 @@
    28.4    let ?S = "(\<Sum>j=0..<n. (\<Sum>k=0..<n. (a j - a k) * (b j - b k)))"
    28.5    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"
    28.6      by (simp only: one_add_one[symmetric] algebra_simps)
    28.7 -      (simp add: algebra_simps setsum_subtractf setsum.distrib setsum.commute[of "\<lambda>i j. a i * b j"] setsum_right_distrib)
    28.8 +      (simp add: algebra_simps setsum_subtractf setsum.distrib setsum.commute[of "\<lambda>i j. a i * b j"] setsum_distrib_left)
    28.9    also
   28.10    { fix i j::nat assume "i<n" "j<n"
   28.11      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"
    29.1 --- a/src/HOL/Library/BigO.thy	Mon Sep 19 12:53:30 2016 +0200
    29.2 +++ b/src/HOL/Library/BigO.thy	Mon Sep 19 20:06:21 2016 +0200
    29.3 @@ -556,7 +556,7 @@
    29.4    apply (subst abs_of_nonneg) back back
    29.5     apply (rule setsum_nonneg)
    29.6     apply force
    29.7 -  apply (subst setsum_right_distrib)
    29.8 +  apply (subst setsum_distrib_left)
    29.9    apply (rule allI)
   29.10    apply (rule order_trans)
   29.11     apply (rule setsum_abs)
    30.1 --- a/src/HOL/Library/Convex.thy	Mon Sep 19 12:53:30 2016 +0200
    30.2 +++ b/src/HOL/Library/Convex.thy	Mon Sep 19 20:06:21 2016 +0200
    30.3 @@ -633,7 +633,7 @@
    30.4              OF asum_le less_imp_le[OF i0]], of "a i * f (y i)"]
    30.5        by simp
    30.6      also have "\<dots> = (\<Sum> j \<in> s. (1 - a i) * ?a j * f (y j)) + a i * f (y i)"
    30.7 -      unfolding setsum_right_distrib[of "1 - a i" "\<lambda> j. ?a j * f (y j)"]
    30.8 +      unfolding setsum_distrib_left[of "1 - a i" "\<lambda> j. ?a j * f (y j)"]
    30.9        using i0 by auto
   30.10      also have "\<dots> = (\<Sum> j \<in> s. a j * f (y j)) + a i * f (y i)"
   30.11        using i0 by auto
    31.1 --- a/src/HOL/Library/Extended_Real.thy	Mon Sep 19 12:53:30 2016 +0200
    31.2 +++ b/src/HOL/Library/Extended_Real.thy	Mon Sep 19 20:06:21 2016 +0200
    31.3 @@ -1098,7 +1098,7 @@
    31.4    "(\<And>i. i \<in> A \<Longrightarrow> 0 \<le> f i) \<Longrightarrow> setsum f A * r = (\<Sum>n\<in>A. f n * r :: ereal)"
    31.5    using setsum_ereal_right_distrib[of A f r] by (simp add: mult_ac)
    31.6  
    31.7 -lemma setsum_left_distrib_ereal:
    31.8 +lemma setsum_distrib_right_ereal:
    31.9    "c \<ge> 0 \<Longrightarrow> setsum f A * ereal c = (\<Sum>x\<in>A. f x * c :: ereal)"
   31.10  by(subst setsum_comp_morphism[where h="\<lambda>x. x * ereal c", symmetric])(simp_all add: distrib_left_ereal_nn)
   31.11  
    32.1 --- a/src/HOL/Library/Formal_Power_Series.thy	Mon Sep 19 12:53:30 2016 +0200
    32.2 +++ b/src/HOL/Library/Formal_Power_Series.thy	Mon Sep 19 20:06:21 2016 +0200
    32.3 @@ -141,7 +141,7 @@
    32.4            (\<Sum>j=0..n. \<Sum>i=0..n - j. a$j * b$i * c$(n - j - i))"
    32.5        by (rule fps_mult_assoc_lemma)
    32.6      then show "((a * b) * c) $ n = (a * (b * c)) $ n"
    32.7 -      by (simp add: fps_mult_nth setsum_right_distrib setsum_left_distrib mult.assoc)
    32.8 +      by (simp add: fps_mult_nth setsum_distrib_left setsum_distrib_right mult.assoc)
    32.9    qed
   32.10  qed
   32.11  
   32.12 @@ -1562,7 +1562,7 @@
   32.13      also have "\<dots> = (fps_deriv (f * g)) $ n"
   32.14        apply (simp only: fps_deriv_nth fps_mult_nth setsum.distrib)
   32.15        unfolding s0 s1
   32.16 -      unfolding setsum.distrib[symmetric] setsum_right_distrib
   32.17 +      unfolding setsum.distrib[symmetric] setsum_distrib_left
   32.18        apply (rule setsum.cong)
   32.19        apply (auto simp add: of_nat_diff field_simps)
   32.20        done
   32.21 @@ -2320,7 +2320,7 @@
   32.22        apply auto
   32.23        apply (rule setsum.cong)
   32.24        apply (rule refl)
   32.25 -      unfolding setsum_left_distrib
   32.26 +      unfolding setsum_distrib_right
   32.27        apply (rule sym)
   32.28        apply (rule_tac l = "\<lambda>xs. xs @ [n - x]" in setsum.reindex_cong)
   32.29        apply (simp add: inj_on_def)
   32.30 @@ -3082,7 +3082,7 @@
   32.31    have "(fps_deriv (a oo b))$n = (((fps_deriv a) oo b) * (fps_deriv b)) $n" for n
   32.32    proof -
   32.33      have "(fps_deriv (a oo b))$n = setsum (\<lambda>i. a $ i * (fps_deriv (b^i))$n) {0.. Suc n}"
   32.34 -      by (simp add: fps_compose_def field_simps setsum_right_distrib del: of_nat_Suc)
   32.35 +      by (simp add: fps_compose_def field_simps setsum_distrib_left del: of_nat_Suc)
   32.36      also have "\<dots> = setsum (\<lambda>i. a$i * ((fps_const (of_nat i)) * (fps_deriv b * (b^(i - 1))))$n) {0.. Suc n}"
   32.37        by (simp add: field_simps fps_deriv_power del: fps_mult_left_const_nth of_nat_Suc)
   32.38      also have "\<dots> = setsum (\<lambda>i. of_nat i * a$i * (((b^(i - 1)) * fps_deriv b))$n) {0.. Suc n}"
   32.39 @@ -3102,7 +3102,7 @@
   32.40      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}"
   32.41        unfolding fps_mult_nth by (simp add: ac_simps)
   32.42      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}"
   32.43 -      unfolding fps_deriv_nth fps_compose_nth setsum_right_distrib mult.assoc
   32.44 +      unfolding fps_deriv_nth fps_compose_nth setsum_distrib_left mult.assoc
   32.45        apply (rule setsum.cong)
   32.46        apply (rule refl)
   32.47        apply (rule setsum.mono_neutral_left)
   32.48 @@ -3114,7 +3114,7 @@
   32.49        apply simp
   32.50        done
   32.51      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}"
   32.52 -      unfolding setsum_right_distrib
   32.53 +      unfolding setsum_distrib_left
   32.54        apply (subst setsum.commute)
   32.55        apply (rule setsum.cong, rule refl)+
   32.56        apply simp
   32.57 @@ -3295,7 +3295,7 @@
   32.58      apply auto
   32.59      done
   32.60    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}"
   32.61 -    apply (simp add: fps_mult_nth setsum_right_distrib)
   32.62 +    apply (simp add: fps_mult_nth setsum_distrib_left)
   32.63      apply (subst setsum.commute)
   32.64      apply (rule setsum.cong)
   32.65      apply (auto simp add: field_simps)
   32.66 @@ -3377,7 +3377,7 @@
   32.67    assumes c0: "c $ 0 = (0::'a::idom)"
   32.68    shows "(a * b) oo c = (a oo c) * (b oo c)"
   32.69    apply (simp add: fps_eq_iff fps_compose_mult_distrib_lemma [OF c0])
   32.70 -  apply (simp add: fps_compose_nth fps_mult_nth setsum_left_distrib)
   32.71 +  apply (simp add: fps_compose_nth fps_mult_nth setsum_distrib_right)
   32.72    done
   32.73  
   32.74  lemma fps_compose_setprod_distrib:
   32.75 @@ -3498,7 +3498,7 @@
   32.76  qed
   32.77  
   32.78  lemma fps_const_mult_apply_left: "fps_const c * (a oo b) = (fps_const c * a) oo b"
   32.79 -  by (simp add: fps_eq_iff fps_compose_nth setsum_right_distrib mult.assoc)
   32.80 +  by (simp add: fps_eq_iff fps_compose_nth setsum_distrib_left mult.assoc)
   32.81  
   32.82  lemma fps_const_mult_apply_right:
   32.83    "(a oo b) * fps_const (c::'a::comm_semiring_1) = (fps_const c * a) oo b"
   32.84 @@ -3513,11 +3513,11 @@
   32.85    proof -
   32.86      have "?l$n = (setsum (\<lambda>i. (fps_const (a$i) * b^i) oo c) {0..n})$n"
   32.87        by (simp add: fps_compose_nth fps_compose_power[OF c0] fps_const_mult_apply_left
   32.88 -        setsum_right_distrib mult.assoc fps_setsum_nth)
   32.89 +        setsum_distrib_left mult.assoc fps_setsum_nth)
   32.90      also have "\<dots> = ((setsum (\<lambda>i. fps_const (a$i) * b^i) {0..n}) oo c)$n"
   32.91        by (simp add: fps_compose_setsum_distrib)
   32.92      also have "\<dots> = ?r$n"
   32.93 -      apply (simp add: fps_compose_nth fps_setsum_nth setsum_left_distrib mult.assoc)
   32.94 +      apply (simp add: fps_compose_nth fps_setsum_nth setsum_distrib_right mult.assoc)
   32.95        apply (rule setsum.cong)
   32.96        apply (rule refl)
   32.97        apply (rule setsum.mono_neutral_right)
   32.98 @@ -4224,7 +4224,7 @@
   32.99      apply (simp add: th00)
  32.100      unfolding gbinomial_pochhammer
  32.101      using bn0
  32.102 -    apply (simp add: setsum_left_distrib setsum_right_distrib field_simps)
  32.103 +    apply (simp add: setsum_distrib_right setsum_distrib_left field_simps)
  32.104      done
  32.105    finally show ?thesis by simp
  32.106  qed
  32.107 @@ -4253,7 +4253,7 @@
  32.108      by (simp add: pochhammer_eq_0_iff)
  32.109    from Vandermonde_pochhammer_lemma[where a = "?a" and b="?b" and n=n, OF h, unfolded th0 th1]
  32.110    show ?thesis
  32.111 -    using nz by (simp add: field_simps setsum_right_distrib)
  32.112 +    using nz by (simp add: field_simps setsum_distrib_left)
  32.113  qed
  32.114  
  32.115  
    33.1 --- a/src/HOL/Library/Groups_Big_Fun.thy	Mon Sep 19 12:53:30 2016 +0200
    33.2 +++ b/src/HOL/Library/Groups_Big_Fun.thy	Mon Sep 19 20:06:21 2016 +0200
    33.3 @@ -240,7 +240,7 @@
    33.4    note assms
    33.5    moreover have "{a. g a * r \<noteq> 0} \<subseteq> {a. g a \<noteq> 0}" by auto
    33.6    ultimately show ?thesis
    33.7 -    by (simp add: setsum_left_distrib Sum_any.expand_superset [of "{a. g a \<noteq> 0}"])
    33.8 +    by (simp add: setsum_distrib_right Sum_any.expand_superset [of "{a. g a \<noteq> 0}"])
    33.9  qed  
   33.10  
   33.11  lemma Sum_any_right_distrib:
   33.12 @@ -251,7 +251,7 @@
   33.13    note assms
   33.14    moreover have "{a. r * g a \<noteq> 0} \<subseteq> {a. g a \<noteq> 0}" by auto
   33.15    ultimately show ?thesis
   33.16 -    by (simp add: setsum_right_distrib Sum_any.expand_superset [of "{a. g a \<noteq> 0}"])
   33.17 +    by (simp add: setsum_distrib_left Sum_any.expand_superset [of "{a. g a \<noteq> 0}"])
   33.18  qed
   33.19  
   33.20  lemma Sum_any_product:
    34.1 --- a/src/HOL/Library/Polynomial.thy	Mon Sep 19 12:53:30 2016 +0200
    34.2 +++ b/src/HOL/Library/Polynomial.thy	Mon Sep 19 20:06:21 2016 +0200
    34.3 @@ -507,7 +507,7 @@
    34.4        also note pCons.IH
    34.5        also have "a + x * (\<Sum>i\<le>degree p. coeff p i * x ^ i) =
    34.6                   coeff ?p' 0 * x^0 + (\<Sum>i\<le>degree p. coeff ?p' (Suc i) * x^Suc i)"
    34.7 -          by (simp add: field_simps setsum_right_distrib coeff_pCons)
    34.8 +          by (simp add: field_simps setsum_distrib_left coeff_pCons)
    34.9        also note setsum_atMost_Suc_shift[symmetric]
   34.10        also note degree_pCons_eq[OF \<open>p \<noteq> 0\<close>, of a, symmetric]
   34.11        finally show ?thesis .
   34.12 @@ -3412,7 +3412,7 @@
   34.13        by (subst setprod.insert, insert insert, auto)
   34.14    } note id2 = this
   34.15    show ?case
   34.16 -    unfolding id pderiv_mult insert(3) setsum_right_distrib
   34.17 +    unfolding id pderiv_mult insert(3) setsum_distrib_left
   34.18      by (auto simp add: ac_simps id2 intro!: setsum.cong)
   34.19  qed auto
   34.20  
    35.1 --- a/src/HOL/Library/Stirling.thy	Mon Sep 19 12:53:30 2016 +0200
    35.2 +++ b/src/HOL/Library/Stirling.thy	Mon Sep 19 20:06:21 2016 +0200
    35.3 @@ -110,7 +110,7 @@
    35.4      also have "\<dots> = Suc n * (\<Sum>k=1..n. fact n div k) + Suc n * fact n div Suc n"
    35.5        by (metis nat.distinct(1) nonzero_mult_divide_cancel_left)
    35.6      also have "\<dots> = (\<Sum>k=1..n. fact (Suc n) div k) + fact (Suc n) div Suc n"
    35.7 -      by (simp add: setsum_right_distrib div_mult_swap dvd_fact)
    35.8 +      by (simp add: setsum_distrib_left div_mult_swap dvd_fact)
    35.9      also have "\<dots> = (\<Sum>k=1..Suc n. fact (Suc n) div k)"
   35.10        by simp
   35.11      finally show ?thesis .
   35.12 @@ -162,7 +162,7 @@
   35.13    also have "\<dots> = (\<Sum>k\<le>n. n * stirling n (Suc k) + stirling n k)"
   35.14      by simp
   35.15    also have "\<dots> = n * (\<Sum>k\<le>n. stirling n (Suc k)) + (\<Sum>k\<le>n. stirling n k)"
   35.16 -    by (simp add: setsum.distrib setsum_right_distrib)
   35.17 +    by (simp add: setsum.distrib setsum_distrib_left)
   35.18    also have "\<dots> = n * fact n + fact n"
   35.19    proof -
   35.20      have "n * (\<Sum>k\<le>n. stirling n (Suc k)) = n * ((\<Sum>k\<le>Suc n. stirling n k) - stirling n 0)"
   35.21 @@ -195,7 +195,7 @@
   35.22      by (subst setsum_atMost_Suc_shift) (simp add: setsum.distrib ring_distribs)
   35.23    also have "\<dots> = pochhammer x (Suc n)"
   35.24      by (subst setsum_atMost_Suc_shift [symmetric])
   35.25 -      (simp add: algebra_simps setsum.distrib setsum_right_distrib pochhammer_Suc Suc [symmetric])
   35.26 +      (simp add: algebra_simps setsum.distrib setsum_distrib_left pochhammer_Suc Suc [symmetric])
   35.27    finally show ?case .
   35.28  qed
   35.29  
    36.1 --- a/src/HOL/Metis_Examples/Big_O.thy	Mon Sep 19 12:53:30 2016 +0200
    36.2 +++ b/src/HOL/Metis_Examples/Big_O.thy	Mon Sep 19 20:06:21 2016 +0200
    36.3 @@ -499,7 +499,7 @@
    36.4  apply (subst abs_of_nonneg) back back
    36.5   apply (rule setsum_nonneg)
    36.6   apply force
    36.7 -apply (subst setsum_right_distrib)
    36.8 +apply (subst setsum_distrib_left)
    36.9  apply (rule allI)
   36.10  apply (rule order_trans)
   36.11   apply (rule setsum_abs)
    37.1 --- a/src/HOL/Nonstandard_Analysis/HSeries.thy	Mon Sep 19 12:53:30 2016 +0200
    37.2 +++ b/src/HOL/Nonstandard_Analysis/HSeries.thy	Mon Sep 19 20:06:21 2016 +0200
    37.3 @@ -59,7 +59,7 @@
    37.4  
    37.5  lemma sumhr_mult:
    37.6    "!!m n. hypreal_of_real r * sumhr(m,n,f) = sumhr(m,n,%n. r * f n)"
    37.7 -unfolding sumhr_app by transfer (rule setsum_right_distrib)
    37.8 +unfolding sumhr_app by transfer (rule setsum_distrib_left)
    37.9  
   37.10  lemma sumhr_split_add:
   37.11    "!!n p. n < p ==> sumhr(0,n,f) + sumhr(n,p,f) = sumhr(0,p,f)"
    38.1 --- a/src/HOL/Probability/Distributions.thy	Mon Sep 19 12:53:30 2016 +0200
    38.2 +++ b/src/HOL/Probability/Distributions.thy	Mon Sep 19 20:06:21 2016 +0200
    38.3 @@ -149,7 +149,7 @@
    38.4    assume "0 \<le> x"
    38.5    have "(\<Sum>n\<le>k. (l * x) ^ n * exp (- (l * x)) / fact n) =
    38.6      exp (- (l * x)) * (\<Sum>n\<le>k. (l * x) ^ n / fact n)"
    38.7 -    unfolding setsum_right_distrib by (intro setsum.cong) (auto simp: field_simps)
    38.8 +    unfolding setsum_distrib_left by (intro setsum.cong) (auto simp: field_simps)
    38.9    also have "\<dots> = (\<Sum>n\<le>k. (l * x) ^ n / fact n) / exp (l * x)"
   38.10      by (simp add: exp_minus field_simps)
   38.11    also have "\<dots> \<le> 1"
    39.1 --- a/src/HOL/Probability/Probability_Mass_Function.thy	Mon Sep 19 12:53:30 2016 +0200
    39.2 +++ b/src/HOL/Probability/Probability_Mass_Function.thy	Mon Sep 19 20:06:21 2016 +0200
    39.3 @@ -1610,7 +1610,7 @@
    39.4  
    39.5  lemma nn_integral_pmf_of_set: "nn_integral (measure_pmf pmf_of_set) f = setsum f S / card S"
    39.6    by (subst nn_integral_measure_pmf_finite)
    39.7 -     (simp_all add: setsum_left_distrib[symmetric] card_gt_0_iff S_not_empty S_finite divide_ennreal_def
    39.8 +     (simp_all add: setsum_distrib_right[symmetric] card_gt_0_iff S_not_empty S_finite divide_ennreal_def
    39.9                  divide_ennreal[symmetric] ennreal_of_nat_eq_real_of_nat[symmetric] ennreal_times_divide)
   39.10  
   39.11  lemma integral_pmf_of_set: "integral\<^sup>L (measure_pmf pmf_of_set) f = setsum f S / card S"
    40.1 --- a/src/HOL/Probability/Projective_Limit.thy	Mon Sep 19 12:53:30 2016 +0200
    40.2 +++ b/src/HOL/Probability/Projective_Limit.thy	Mon Sep 19 20:06:21 2016 +0200
    40.3 @@ -290,7 +290,7 @@
    40.4        finally show "\<mu>G (Z i - Z' i) \<le> (2 powr - real i) * ?a" .
    40.5      qed
    40.6      also have "\<dots> = ennreal ((\<Sum> i\<in>{1..n}. (2 powr -enn2real i)) * enn2real ?a)"
    40.7 -      using r by (simp add: setsum_left_distrib ennreal_mult[symmetric])
    40.8 +      using r by (simp add: setsum_distrib_right ennreal_mult[symmetric])
    40.9      also have "\<dots> < ennreal (1 * enn2real ?a)"
   40.10      proof (intro ennreal_lessI mult_strict_right_mono)
   40.11        have "(\<Sum>i = 1..n. 2 powr - real i) = (\<Sum>i = 1..<Suc n. (1/2) ^ i)"
    41.1 --- a/src/HOL/Probability/ex/Koepf_Duermuth_Countermeasure.thy	Mon Sep 19 12:53:30 2016 +0200
    41.2 +++ b/src/HOL/Probability/ex/Koepf_Duermuth_Countermeasure.thy	Mon Sep 19 20:06:21 2016 +0200
    41.3 @@ -100,7 +100,7 @@
    41.4    show ?case unfolding *
    41.5      using Suc[of "\<lambda>i. P (Suc i)"]
    41.6      by (simp add: setsum.reindex split_conv setsum_cartesian_product'
    41.7 -      lessThan_Suc_eq_insert_0 setprod.reindex setsum_left_distrib[symmetric] setsum_right_distrib[symmetric])
    41.8 +      lessThan_Suc_eq_insert_0 setprod.reindex setsum_distrib_right[symmetric] setsum_distrib_left[symmetric])
    41.9  qed
   41.10  
   41.11  declare space_point_measure[simp]
   41.12 @@ -158,8 +158,8 @@
   41.13  
   41.14    have [simp]: "\<And>A. inj_on (\<lambda>(xs, n). n # xs) A" by (force intro!: inj_onI)
   41.15  
   41.16 -  note setsum_right_distrib[symmetric, simp]
   41.17 -  note setsum_left_distrib[symmetric, simp]
   41.18 +  note setsum_distrib_left[symmetric, simp]
   41.19 +  note setsum_distrib_right[symmetric, simp]
   41.20    note setsum_cartesian_product'[simp]
   41.21  
   41.22    have "(\<Sum>ms | set ms \<subseteq> messages \<and> length ms = n. \<Prod>x<length ms. M (ms ! x)) = 1"
   41.23 @@ -256,7 +256,7 @@
   41.24      apply (simp add: * P_def)
   41.25      apply (simp add: setsum_cartesian_product')
   41.26      using setprod_setsum_distrib_lists[OF M.finite_space, of M n "\<lambda>x x. True"] \<open>k \<in> keys\<close>
   41.27 -    by (auto simp add: setsum_right_distrib[symmetric] subset_eq setprod.neutral_const)
   41.28 +    by (auto simp add: setsum_distrib_left[symmetric] subset_eq setprod.neutral_const)
   41.29  qed
   41.30  
   41.31  lemma fst_image_msgs[simp]: "fst`msgs = keys"
   41.32 @@ -323,7 +323,7 @@
   41.33    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}))))"
   41.34      by (subst setsum.commute) rule
   41.35    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}))))"
   41.36 -    by (auto simp add: setsum_right_distrib vimage_def intro!: setsum.cong prob_conj_imp1)
   41.37 +    by (auto simp add: setsum_distrib_left vimage_def intro!: setsum.cong prob_conj_imp1)
   41.38    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}))) =
   41.39      -(\<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}))))" .
   41.40  qed simp_all
   41.41 @@ -402,7 +402,7 @@
   41.42      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'}) =
   41.43        \<P>(OB | fst) {(obs, k)} * \<P>(fst) {k} / (\<Sum>k'\<in>keys. \<P>(OB|fst) {(obs, k')} * \<P>(fst) {k'})"
   41.44        using CP_t_K[OF \<open>k\<in>keys\<close> obs] CP_t_K[OF _ obs] \<open>real (card ?S) \<noteq> 0\<close>
   41.45 -      by (simp only: setsum_right_distrib[symmetric] ac_simps
   41.46 +      by (simp only: setsum_distrib_left[symmetric] ac_simps
   41.47            mult_divide_mult_cancel_left[OF \<open>real (card ?S) \<noteq> 0\<close>]
   41.48          cong: setsum.cong)
   41.49      also have "(\<Sum>k'\<in>keys. \<P>(OB|fst) {(obs, k')} * \<P>(fst) {k'}) = \<P>(OB) {obs}"
   41.50 @@ -450,7 +450,7 @@
   41.51      apply (safe intro!: setsum.cong)
   41.52      using P_t_sum_P_O
   41.53      by (simp add: setsum_divide_distrib[symmetric] field_simps **
   41.54 -                  setsum_right_distrib[symmetric] setsum_left_distrib[symmetric])
   41.55 +                  setsum_distrib_left[symmetric] setsum_distrib_right[symmetric])
   41.56    also have "\<dots> = \<H>(fst | t\<circ>OB)"
   41.57      unfolding conditional_entropy_eq_ce_with_hypothesis
   41.58      by (simp add: comp_def image_image[symmetric])
    42.1 --- a/src/HOL/Set_Interval.thy	Mon Sep 19 12:53:30 2016 +0200
    42.2 +++ b/src/HOL/Set_Interval.thy	Mon Sep 19 20:06:21 2016 +0200
    42.3 @@ -1889,7 +1889,7 @@
    42.4    also have "... = (x - y) * (y * (\<Sum>p<Suc n. (x ^ p) * y ^ (n - p))) + (x - y) * (x * x^n)"
    42.5      by (simp only: mult.left_commute)
    42.6    also have "... = (x - y) * (\<Sum>p<Suc (Suc n). x ^ p * y ^ (Suc n - p))"
    42.7 -    by (simp add: field_simps Suc_diff_le setsum_left_distrib setsum_right_distrib)
    42.8 +    by (simp add: field_simps Suc_diff_le setsum_distrib_right setsum_distrib_left)
    42.9    finally show ?case .
   42.10  qed simp
   42.11  
   42.12 @@ -1944,7 +1944,7 @@
   42.13    also from ngt1 have "\<dots> = ?n*a + (\<Sum>i\<in>{..<n}. ?I i*d)" by simp
   42.14    also from ngt1 have "\<dots> = (?n*a + d*(\<Sum>i\<in>{1..<n}. ?I i))"
   42.15      unfolding One_nat_def
   42.16 -    by (simp add: setsum_right_distrib atLeast0LessThan[symmetric] setsum_shift_lb_Suc0_0_upt ac_simps)
   42.17 +    by (simp add: setsum_distrib_left atLeast0LessThan[symmetric] setsum_shift_lb_Suc0_0_upt ac_simps)
   42.18    also have "2*\<dots> = 2*?n*a + d*2*(\<Sum>i\<in>{1..<n}. ?I i)"
   42.19      by (simp add: algebra_simps)
   42.20    also from ngt1 have "{1..<n} = {1..n - 1}"
    43.1 --- a/src/HOL/Transcendental.thy	Mon Sep 19 12:53:30 2016 +0200
    43.2 +++ b/src/HOL/Transcendental.thy	Mon Sep 19 20:06:21 2016 +0200
    43.3 @@ -639,11 +639,11 @@
    43.4    apply (subst lemma_realpow_rev_sumr)
    43.5    apply (subst sumr_diff_mult_const2)
    43.6    apply simp
    43.7 -  apply (simp only: lemma_termdiff1 setsum_right_distrib)
    43.8 +  apply (simp only: lemma_termdiff1 setsum_distrib_left)
    43.9    apply (rule setsum.cong [OF refl])
   43.10    apply (simp add: less_iff_Suc_add)
   43.11    apply clarify
   43.12 -  apply (simp add: setsum_right_distrib diff_power_eq_setsum ac_simps
   43.13 +  apply (simp add: setsum_distrib_left diff_power_eq_setsum ac_simps
   43.14        del: setsum_lessThan_Suc power_Suc)
   43.15    apply (subst mult.assoc [symmetric], subst power_add [symmetric])
   43.16    apply (simp add: ac_simps)
   43.17 @@ -1448,7 +1448,7 @@
   43.18    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))"
   43.19      by (rule distrib_right)
   43.20    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))"
   43.21 -    by (simp add: setsum_right_distrib ac_simps S_comm)
   43.22 +    by (simp add: setsum_distrib_left ac_simps S_comm)
   43.23    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)))"
   43.24      by (simp add: ac_simps)
   43.25    also have "\<dots> = (\<Sum>i\<le>n. real (Suc i) *\<^sub>R (S x (Suc i) * S y (n - i))) +
   43.26 @@ -3340,7 +3340,7 @@
   43.27         (if even p
   43.28          then of_real ((-1) ^ (p div 2) / (fact p)) * (\<Sum>n\<le>p. (p choose n) *\<^sub>R (x^n) * y^(p-n))
   43.29          else 0)"
   43.30 -      by (auto simp: setsum_right_distrib field_simps scaleR_conv_of_real nonzero_of_real_divide)
   43.31 +      by (auto simp: setsum_distrib_left field_simps scaleR_conv_of_real nonzero_of_real_divide)
   43.32      also have "\<dots> = cos_coeff p *\<^sub>R ((x + y) ^ p)"
   43.33        by (simp add: cos_coeff_def binomial_ring [of x y]  scaleR_conv_of_real atLeast0AtMost)
   43.34      finally show ?thesis .
   43.35 @@ -5835,7 +5835,7 @@
   43.36      by (auto simp: pairs_le_eq_Sigma setsum.Sigma)
   43.37    also have "\<dots> = (\<Sum>r\<le>m + n. (\<Sum>k\<le>r. (a k) * (b (r - k))) * x ^ r)"
   43.38      apply (subst setsum_triangle_reindex_eq)
   43.39 -    apply (auto simp: algebra_simps setsum_right_distrib intro!: setsum.cong)
   43.40 +    apply (auto simp: algebra_simps setsum_distrib_left intro!: setsum.cong)
   43.41      apply (metis le_add_diff_inverse power_add)
   43.42      done
   43.43    finally show ?thesis .
   43.44 @@ -5864,7 +5864,7 @@
   43.45    also have "\<dots> = (\<Sum>i\<le>n. a i * (x - y) * (\<Sum>j<i. y^(i - Suc j) * x^j))"
   43.46      by (simp add: power_diff_sumr2 mult.assoc)
   43.47    also have "\<dots> = (\<Sum>i\<le>n. \<Sum>j<i. a i * (x - y) * (y^(i - Suc j) * x^j))"
   43.48 -    by (simp add: setsum_right_distrib)
   43.49 +    by (simp add: setsum_distrib_left)
   43.50    also have "\<dots> = (\<Sum>(i,j) \<in> (SIGMA i : atMost n. lessThan i). a i * (x - y) * (y^(i - Suc j) * x^j))"
   43.51      by (simp add: setsum.Sigma)
   43.52    also have "\<dots> = (\<Sum>(j,i) \<in> (SIGMA j : lessThan n. {Suc j..n}). a i * (x - y) * (y^(i - Suc j) * x^j))"
   43.53 @@ -5872,7 +5872,7 @@
   43.54    also have "\<dots> = (\<Sum>j<n. \<Sum>i=Suc j..n. a i * (x - y) * (y^(i - Suc j) * x^j))"
   43.55      by (simp add: setsum.Sigma)
   43.56    also have "\<dots> = (x - y) * (\<Sum>j<n. (\<Sum>i=Suc j..n. a i * y^(i - j - 1)) * x^j)"
   43.57 -    by (simp add: setsum_right_distrib mult_ac)
   43.58 +    by (simp add: setsum_distrib_left mult_ac)
   43.59    finally show ?thesis .
   43.60  qed
   43.61  
   43.62 @@ -5894,7 +5894,7 @@
   43.63        by (auto simp add: setsum.reindex_bij_betw [OF h, symmetric] intro: setsum.strong_cong)
   43.64    qed
   43.65    then show ?thesis
   43.66 -    by (simp add: polyfun_diff [OF assms] setsum_left_distrib)
   43.67 +    by (simp add: polyfun_diff [OF assms] setsum_distrib_right)
   43.68  qed
   43.69  
   43.70  lemma polyfun_linear_factor:  (*COMPLEX_POLYFUN_LINEAR_FACTOR in HOL Light*)
   43.71 @@ -5949,7 +5949,7 @@
   43.72        unfolding Set_Interval.setsum_atMost_Suc_shift
   43.73        by simp
   43.74      also have "\<dots> = w * (\<Sum>i\<le>n. c (Suc i) * w^i)"
   43.75 -      by (simp add: setsum_right_distrib ac_simps)
   43.76 +      by (simp add: setsum_distrib_left ac_simps)
   43.77      finally show ?thesis .
   43.78    qed
   43.79    then have w: "\<And>w. w \<noteq> 0 \<Longrightarrow> (\<Sum>i\<le>n. c (Suc i) * w^i) = 0"
    44.1 --- a/src/HOL/ex/Sum_of_Powers.thy	Mon Sep 19 12:53:30 2016 +0200
    44.2 +++ b/src/HOL/ex/Sum_of_Powers.thy	Mon Sep 19 20:06:21 2016 +0200
    44.3 @@ -110,7 +110,7 @@
    44.4      unfolding bernpoly_def by (rule DERIV_cong) (fast intro!: derivative_intros, simp)
    44.5    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"
    44.6      unfolding bernpoly_def
    44.7 -    by (auto intro: setsum.cong simp add: setsum_right_distrib real_binomial_eq_mult_binomial_Suc[of _ n] Suc_eq_plus1 of_nat_diff)
    44.8 +    by (auto intro: setsum.cong simp add: setsum_distrib_left real_binomial_eq_mult_binomial_Suc[of _ n] Suc_eq_plus1 of_nat_diff)
    44.9    ultimately show ?thesis by auto
   44.10  qed
   44.11  
   44.12 @@ -135,7 +135,7 @@
   44.13  lemma sum_of_powers: "(\<Sum>k\<le>n::nat. (real k) ^ m) = (bernpoly (Suc m) (n + 1) - bernpoly (Suc m) 0) / (m + 1)"
   44.14  proof -
   44.15    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))"
   44.16 -    by (auto simp add: setsum_right_distrib intro!: setsum.cong)
   44.17 +    by (auto simp add: setsum_distrib_left intro!: setsum.cong)
   44.18    also have "... = (\<Sum>k\<le>n. bernpoly (Suc m) (real (k + 1)) - bernpoly (Suc m) (real k))"
   44.19      by simp
   44.20    also have "... = bernpoly (Suc m) (n + 1) - bernpoly (Suc m) 0"
    45.1 --- a/src/HOL/ex/ThreeDivides.thy	Mon Sep 19 12:53:30 2016 +0200
    45.2 +++ b/src/HOL/ex/ThreeDivides.thy	Mon Sep 19 20:06:21 2016 +0200
    45.3 @@ -193,7 +193,7 @@
    45.4        "m = 10*(\<Sum>x<nd. m div 10 div 10^x mod 10 * 10^x) + c" by simp
    45.5      also have
    45.6        "\<dots> = (\<Sum>x<nd. m div 10 div 10^x mod 10 * 10^(x+1)) + c"
    45.7 -      by (subst setsum_right_distrib) (simp add: ac_simps)
    45.8 +      by (subst setsum_distrib_left) (simp add: ac_simps)
    45.9      also have
   45.10        "\<dots> = (\<Sum>x<nd. m div 10^(Suc x) mod 10 * 10^(Suc x)) + c"
   45.11        by (simp add: div_mult2_eq[symmetric])