As mentioned in the comments, there might be a reason why this is not already implemented. In particular, when the sums are divergent this might be risky.
However, if the sums are finite the following rules should be fine (I used [FormalK] to make it unlikely that the user would use that specific variable as an upper bound in the sum or that it would appear in the expression to be summed) :
sumrule = {Sum[a_ + b_, c_] :> Sum[a, c] + Sum[b, c],
Sum[a_*b_, {c1_, c2_, c3_}] /; FreeQ[b, c1] :>
b*Sum[a, {c1, c2, c3}],
Sum[a_, {b1_, b2_, b3_}] :>
Sum[ReplaceAll[a, b1 -> \[FormalK]], {\[FormalK], 1, b3}] -
Sum[ReplaceAll[a, b1 -> \[FormalK]], {\[FormalK], 1, b2 - 1}]};
Using [FormalK] as a "canonical" iterator has the advantage that the the dummy indices do not need to be the same in each sum for the simplification to work.
Examples:
Sum[ar[j], {j, 1, k}] + Sum[-ar[j], {j, 2, k}] //. sumrule
Output: (* ar[1] *)
Sum[2*ar[j] + br[j], {j, 4, h}] - 2*Sum[ar[j], {j, 3, h}] +
Sum[-br[p], {p, 5, h}] //. sumrule // Simplify
Output: (* -2 ar[3] + br[4] *)
Edit:
In an attempt to fit the case with a symbolic upper bound I ended up making the code above quite longer. Maybe not the best method but I will leave it here in case it is of use.
First, we may consider an auxiliary function that scans the expression for the largest upper bound and the smallest lower bound.
The function below will probably work even when there is no clear upper bound as it uses Sort which can sort symbols based on there names. I should add a bunch off error catching scenarios but instead I will trust that the user only uses the function below when there is a clear maximal upper bound or lower bound.
scanbounds[expr_] :=
Module[{ilist, a, b, maxupper,
minlower, upperlist, lowerlist,
upperlistsymbols, lowerlistsymbols},
ilist = Cases[expr, Sum[a_, b_] -> b, Infinity];
upperlist = Last /@ ilist;
lowerlist = (#[[2]] &) /@ ilist;
(* add different error possibilities here *)
maxupper = Last@Sort[upperlist];
minlower = First@Sort[lowerlist];
{minlower, maxupper}]
The simplifying function (I recall that I used [FormalK] to make it unlikely that the user would use that specific variable as an upper bound in the sum or that it would appear in the expression to be summed):
simpsum[s_, maxtimes_ : 1000] :=
Module[{lower, upper, sumrule, a, b, c, c1, c2, c3, b1, b3, b2},
{lower, upper} = scanbounds[s];
sumrule = {Sum[a_ + b_, c_] :> Sum[a, c] + Sum[b, c],
Sum[a_*b_, {c1_, c2_, c3_}] /; FreeQ[b, c1] :>
b*Sum[a, {c1, c2, c3}],
Sum[a_, {b1_, b2_, b3_}] :>
Sum[ReplaceAll[a, b1 -> \[FormalK]], {\[FormalK], lower,
upper}] -
Sum[ReplaceAll[a, b1 -> \[FormalK]], {\[FormalK], lower,
b2 - 1}] -
Sum[ReplaceAll[a, b1 -> \[FormalK]], {\[FormalK], b3 + 1,
upper}]};
ReplaceRepeated[s, sumrule, MaxIterations -> maxtimes] // Simplify
]
Examples:
Sum[ar[j], {j, 1, k}] + Sum[-ar[j], {j, 1, k + 1}] // simpsum
Output: (* -ar[1 + k] *)
simpsum[Sum[2*ar[j] + br[j], {j, 4, h + 1}] -
2*Sum[ar[j], {j, 3, h}] + Sum[-br[p], {p, 5, h - 1}]]
Output: (* -2 ar[3] + 2 ar[1 + h] + br[4] + br[h] + br[1 + h] *)
If the terms do not completely simplify then simpsum might get lost applying the rules over and over again. In that case one may specify the maximal number of times that the rules are applied using the second option of simpsum. When the second argument is not specified, the rule is applied at most 1000 times. This can be lowered by changing the default value in the definition of the function. In cases where everything simplifies the program should stop before reaching that limit.
In the example below the rule is applied at most 11 times
simpsum[Sum[2*ar[j] + br[j], {j, 4, h + 1}] -
2*Sum[ar[j], {j, 3, h}] + Sum[-br[p], {p, 5, h - 1}] +
Sum[cr[p], {p, 2, g}], 11]
But depending on which phase/period the iteration is on different results may be obtained. A nicer result is obtained by decreasing (or increasing) the maximum number by one in this case.
simpsum[Sum[2*ar[j] + br[j], {j, 4, h + 1}] -
2*Sum[ar[j], {j, 3, h}] + Sum[-br[p], {p, 5, h - 1}] +
Sum[cr[p], {p, 2, g}], 10]
Sum
s apart. I am guessing that is because of the many strange things that can happen when k turns out to be infinite and/or some ofar[j]
turn out to be infinite or undefined or ... Think of the most malicious sums, things REALLY evil, and imagine what those borderline cases might do to a relatively mindless piece of software trying to follow a vast list of generic rules $\endgroup$Sum[ar[j], { j, 1, k}] + Sum[- ar[j], { j, 2, k}] /. Sum[-a_, b_] :> - Sum[a, b] /. Sum[a_, {b1_, b2_, b3_}] :> Sum[a, {b1, 1, b3}] - Sum[a, {b1, 1, b2 - 1}]
. That replacement rule usesSum[ar[j], {j, 1, 0}]=0
in the first sum of your example. $\endgroup$