Return zero for valid binomial events outside support; preserve whole count literals
Follow-up to #9: return zero for a valid binomial event outside its support
Yes: exactly five successes in three trials has probability zero. The k<=n
refusal was an unnecessary restriction introduced by #9. This follow-up checks
the probability and count domains first, then returns P=0 for k>n. The early
branch also handles n=0,p=1 without evaluating a negative power. The existing
within-support floating-point formula and probability decoder are unchanged;
this makes no new extreme-tail accuracy claim.
Checking the count domain exposed another instance of the same binding defect:exactly 0 successes in -3 trials answered 0.125, 3.5 trials was read as five
trials, and 3e2 trials as two. A fractional k also supplied its integer prefix.
All binomial branches now consume a complete numeric count token and admit only
a complete nonnegative integer value. Unsupported fractional/scientific counts
are refused; signs are consumed rather than lost. Ordinary commas and outer
parentheses remain delimiters, not part of the integer; internal punctuation
and arithmetic expressions are not evaluated. This changes the five local
statistics implementations (v3 inherits) and adds eight portable test methods.
Combination/permutation and math readers are unchanged.
Actual scoped validation on separately pinned 10.3.1 trees:
- Slim base 0ab769781e33ef169b1a3c2a7f055a83c62dca7d; full base 9f52489c6c26533258dcafa23ad9f1e7e0dfc37c.
- All 31 fetched full statistics/math/control files are byte-identical to slim.
- Each baseline fails 1,206 subtests of the new suite, with no errors: 1,008
outside-support, 15 probability-role, 18 complete signed-count, 63 malformed-count
false yes, plus 30 decorated/expression false yes and 72 punctuation cases
(including outside-support requests). Each patched tree passes all 8 methods. - The existing 5 probability-binding methods pass before and after on both trees.
- All 860 statistics panel replies are unchanged on each tree, with 0 wrong and
0 false yes through their own scorers. Correct including declines:
statistics dev 142/142, heldout 128/142; statistics-v2 dev 144/144,
heldout 130/144; statistics-v3 144/144 on both splits. git apply --checkpasses on both exact selective baselines.
Expected small-problem masses enumerate Bernoulli sequences with exact rational
weights, independently of the implementation's coefficient formula. These are
untrusted Python regressions, not formal verification or a whole-head gate run.
Run python3 -B -m unittest discover -s tests/statistics -v.
The patch changes specialist behavior only and adds no chat routing. Source
inventory found the generic math organ/scientific-number fix and the separate
math coefficient readers, but no shared binomial mass branch needing this
change. The current operations102 descriptor still marks specialists as text
and refuses their direct invocation; generic owner folds also test dependence
on every given number. A correct outside-support zero is invariant under small
changes to k,n,p (isolated gate component:dependence 0/3). Those routing concerns
are deliberately separate from restoring the specialist's right answer here.
Thank you, and thank you for the note about operations102. It caught a false statement of mine: I had said #9's fix was reachable through invoke. It isn't, and I've corrected that on #9. We're reviewing this for 10.3.2, along with routing binomial questions to the specialist in chat, so the fix reaches someone. Your point about the dependence check on a constant zero will be measured in that work.