A sum of a polynomial times a power of the index is answered in closed form, and a quantified piecewise is decided by cases on a parameter - #1458
Merged
Conversation
…d form, and a quantified piecewise is decided by cases on a parameter `sum(k 2^k, k, 1, n)` was left as written. PolynomialGeometricSeries reads the summand as p(k) C b^(m k + s), finds the polynomial q of the same degree with q(k + 1) r - q(k) = p(k) by one division by r - 1 per coefficient, and answers q(b + 1) r^(b + 1) - q(a) r^a; a symbolic ratio carries the case r = 1 as the polynomial reader's answer, and to +oo the series converges for |r| < 1. §5.3.4 Try 6 of Sullivan and Mackey's An Introduction to Proofs, sum((-1)^(k - 1) k^2, k, 1, n) = (-1)^(n - 1) n (n + 1)/2, is the row that asked for it. A quantified statement whose body is a piecewise with a case on a parameter beside one that holds at every member -- q = 1 and n >= 0, which is how the sum with a symbolic ratio comes -- is decided under the hypothesis and under its negation, and holds provided the hypothesis where it holds there alone: their Ex 5.2.6, forall n in ZZ+ : sum(q^i, i, 0, n - 1) = (q^n - 1)/(q - 1), is True provided not q = 1, which is the book's own remark on why q = 1 is excluded. The exclusions a condition repeats in several spellings are written once. Suite 12543 passed; the kernel gate passed on all 19 gated benchmarks. Part of #1409. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two things from chapter 5 of Sullivan and Mackey's An Introduction to Proofs (#1409), re-measured against master today: §5.3.4 Try 6,
sum((-1)^(k - 1) k^2, k, 1, n) = (-1)^(n - 1) n (n + 1)/2, whose sum had no closed form, and Ex 5.2.6, the geometric sum withq = 1set aside, which the induction route pinned as "left as written" because the closed form has a case on a free parameter.PolynomialGeometricSeries— a summand that is a polynomial in the index times a power with the index in the exponent,p(k) C b^(m k + s), read the wayGeometricSeriesreads its own with the polynomial beside it. For a ratior ≠ 1there is a polynomialqof the same degree withq(k + 1) r − q(k) = p(k), soq(k) r^kis a discrete antiderivative and the sum fromatobisq(b + 1) r^(b + 1) − q(a) r^a; the coefficients come highest first by one division byr − 1each (Gosper specialised to a constant-denominator term ratio). A symbolic ratio carries the caser = 1as the polynomial reader's answer over the same range; to+oothe series converges for|r| < 1.sum(k 2^k, k, 1, n)is(n − 1) 2^(n + 1) + 2,sum(k / 2^k, k, 1, +oo)is2,sum(k x^k, k, 0, +oo)isx/(1 − x)^2 provided |x| < 1.A quantified piecewise decided by cases on a parameter — the sum with a symbolic ratio comes as
piecewise(… provided (q = 1 and n >= 0), … provided (n >= 0), 0 provided True), and the decider's piecewise route could take a case only where its whole condition held at every member. A case whose condition is a hypothesis about a parameter beside a part that holds throughout is now decided under the hypothesis (withq := 1substituted where it is an equation) and under its negation, and the statement holds provided the hypothesis where it holds there alone:forall n in ZZ+ : sum(q^i, i, 0, n − 1) = (q^n − 1)/(q − 1)isTrue provided not q = 1— the book's own remark on whyq = 1is excluded.WithoutRepeatedExclusionswritesnot q = 1 and not 1 − q = 0 and not q − 1 = 0once, by the root each excludes.Two pinned verdicts move with it, both in
InductionTest:forall n in ZZ+ : sum(k x^k, k, 1, n) = x(1 − (n + 1)x^n + n x^(n + 1))/(1 − x)^2is nowTrue provided not x = 1(wasTrue provided not (1 − x)^2 = 0, from the induction route's denominator; the sum's own case is the condition now), and the geometric-sum row leavesLeftAsWritten.GeometricSeriesTestlosessum(k (1/2)^k, k, 0, +oo)from its "not this reader's" rows, since it is summed now.Syntax.mdandBREAKING-CHANGES.mdupdated (2.5.0 column measured: all three sums as written there; the quantifier did not parse).Tests:
PolynomialGeometricSeriesTest— closed forms checked against the expanded sum at six bounds including one past the hundred-term expansion, an empty range, four convergent series, the symbolic ratio with itsq = 1case, and the two book identities decided from the closed form. Full suite 12543 passed, 0 failed; the kernel gate PASSED on all 19 gated benchmarks.Part of #1409.
🤖 Generated with Claude Code
https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura