The binomial coefficient's identities as rules, and its sums in closed form - #1444
Merged
Merged
Conversation
…d form Item 7 of the reference's docket (#1409), the identities of §8.4. Pascal's rule, the chairperson identity and the symmetry are three rules in the factorial-gathering set, each in the direction that collects -- binomial(n - 1, k) + binomial(n - 1, k - 1) is binomial(n, k), n binomial(n - 1, k - 1) is k binomial(n, k), binomial(n, n - k) is binomial(n, k) where the complement is the smaller expression -- so that the identities are True as statements of symbols (Props 8.4.1-8.4.3, which the reference proves by counting in two ways). A binomial coefficient is three factorials, and the simplifier now runs the factorial sets on an expression that holds one. The binomial-sum evaluator reads the coefficient written as the node, binomial(N, k) or binomial(N, N - k), beside the factorial spelling it read already: sum(binomial(n, k) x^k y^(n - k), k, 0, n) is (x + y)^n (Thm 8.4.8), 2^n and 3^n (Prop 8.4.4, Try 3). A wrong answer fixed on the way, in both spellings: the alternating sum (Ex 8.4.9) is 0^n, which is 1 at n = 0 and 0 above it, and written as the power it carried a condition the piecewise read as no value, so sum(n!/(k!(n - k)!) (-1)^k, k, 0, n) was 0 at n = 0 where it is 1. The base that is zero is said outright now. #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.
Item 7 of the docket on #1409, the identities of §8.4 (Sullivan and Mackey).
Three rules in the factorial-gathering set, each in the direction that collects, so the book's identities are
Trueas statements of symbols (Props 8.4.1–8.4.3, which the book proves by counting in two ways; here they are identities of the falling factorial for a whole lower index and of the gamma function elsewhere):Simplifybinomial(n - 1, k) + binomial(n - 1, k - 1)→binomial(n, k)(either order, the lower index one less found by simplifying the difference)binomial(n + 1, k + 1) = binomial(n, k + 1) + binomial(n, k)→Truen binomial(n - 1, k - 1)→k binomial(n, k)k binomial(n, k) = n binomial(n - 1, k - 1)→Truebinomial(n, n - k)→binomial(n, k)where the complement is the smaller expression (binomial(n, 2)stays)binomial(n, k) = binomial(n, n - k)→TrueA binomial coefficient is three factorials, and the simplifier runs the factorial sets on an expression holding one (it gated them on
Factorialfalone). The binomial-sum evaluator reads the coefficient written as the node,binomial(N, k)orbinomial(N, N - k), beside the factorial spelling it read already:sum(binomial(n, k), k, 0, n)is2^n, with2^(n-k)it is3^n(Try 3), withx^k y^(n-k)it is(x + y)^n(Thm 8.4.8), eachprovided n >= 0.Wrong answer fixed on the way, in both spellings (Ex 8.4.9): the alternating sum is
0^n, which is1atn = 0and0above it; written as the power it carried a condition that the piecewise read as "no value", sosum(n!/(k!(n − k)!) (−1)^k, k, 0, n)waspiecewise(0 provided True)—0atn = 0where it is1. A base that simplifies to zero is said outright:piecewise(1 provided n = 0, 0 provided True).Counts: 335 rules, 306 names, 332 identities, 149 conditional, 126 at Unknown growth (the three are code replacements that fire on a condition the helper decides), 969 subsumption claims.
BinomialIdentityTest, 20 rows. BREAKING-CHANGES.md rows measured on a v2.5.0 build. Full suite 12246 passed, 0 failed; benchmark gate PASSED (SimplifyHard and SimplifyEasy the same bytes as the baseline).One thing left open, by design:
k binomial(n, k) − n binomial(n − 1, k − 1)as a difference simplifies to0in one order of the two terms and not the other (a tie-break in the candidate ranking); the identity as an equality decides either way, which is what the book states.Part of #1409.
🤖 Generated with Claude Code
https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura