镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Over the primes, a comparison settles past its root - #1590

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
a-comparison-over-the-primes-settles
Sep 29, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
a-comparison-over-the-primes-settles

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

forall p in PP : p = 1 (mod 4) or p = 3 (mod 4) or p = 2 was left as written. Over the primes (#1579), a statement was decided only where it repeats modulo some M past a lower bound set by a hypothesis, and p = 2 does not repeat.

A comparison linear in p keeps one truth value past its root. So the primes below the last root are now asked one by one, and from the last root on each comparison is the truth value it has there. What is left is decided by the prime factors and units of its modulus, as before. A comparison may stand anywhere in the statement, not only as a lower bound in a hypothesis:

  • forall p in PP : p = 1 (mod 4) or p = 3 (mod 4) or p = 2 is True, and without or p = 2 it is False, at 2.
  • forall p in PP : p = 2 or p = 3 or 6 divides p^2 - 1 is True.
  • forall p in PP : p < 10 implies p = 2 or 2 divides p + 1 is True, an upper bound.
  • exists p in PP : p < 3 and p = 2 (mod 3) is True.

Where a comparison settles is found exactly when its coefficients are rational. It was a decimal quotient, so a truth value depended on MathS.Settings.DecimalPrecisionContext. At 16 or 30 digits, 2/3 rounds up, the root of 2/3 n - 2 came out below 3, and forall n in ZZ* : 2/3 n - 2 <= 0 was True, though it fails at 4. The same happened to 5/9 n - 5 at 10. At the default 100 digits the answer was right. WhereAComparisonSettlesDoesNotDependOnThePrecision fails on master at 16 and 30 digits, and passes here at all three. The route came in with #1580 and has not been released.

Suite: 13,684 passed, 0 failed on net10.0, and every target framework builds. Gate: passed, with allocation as the baseline says on all 19 gated benchmarks.

BREAKING-CHANGES.md: the entry for the primes has a sentence and a row.

Part of #1409.

🤖 Generated with Claude Code

https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura

A comparison linear in p keeps one truth value past its root, so the primes below the last
root are asked one by one; from there each comparison is the truth value it has, and what is
left is decided by the modulus's prime factors and units as before. A comparison may stand
anywhere in the statement, not only as a lower bound in the hypothesis: every prime is 2, or
1 or 3 modulo 4.

Where a comparison with rational coefficients settles is found exactly. It was a decimal
quotient, so it depended on the decimal precision: at 16 or 30 digits 2/3 rounds up, the root
of 2/3 n - 2 came out below 3, and forall n in ZZ* : 2/3 n - 2 <= 0 was True, though it fails
at 4. At the default 100 digits it was right.

Part of #1409.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
@Rafael-SOWNet
Rafael-SOWNet merged commit 70ca79e into master Sep 29, 2026
31 checks passed
@Rafael-SOWNet
Rafael-SOWNet deleted the a-comparison-over-the-primes-settles branch October 29, 2026 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant