feat(arithmetic): add verified real-quadratic order - #1287
Conversation
71f01b3 to
af07ceb
Compare
Refresh #1287 while preserving its provider-independent exact value and checker.
AttributionThe independently verified real-quadratic order capability originated in #993, authored by @kaoru0822-kitauji. This PR ports that mathematical and verification work onto the current ownership model; the original credit remains theirs. |
Coverage ReportTotal coverage: 78% (threshold: 50%) |
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b707620585
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| difference=RealQuadraticValue( | ||
| rational_part=CanonicalRational.from_fraction(a), | ||
| radical_coefficient=CanonicalRational.from_fraction(b), |
There was a problem hiding this comment.
Keep valid input subtraction within the result contract
When two individually valid 256-digit rationals have large coprime denominators, subtracting them can produce a denominator approaching 512 digits. Constructing difference as another RealQuadraticValue then reapplies the 256-digit input bound and raises after execution, so math.run reports ADAPTER_EXECUTION_FAILED for an input accepted by RealQuadraticOrderRequest. Use a result bound closed under subtraction, or reject the cross-field size relationship during request validation before computation.
AGENTS.md reference: AGENTS.md:L203-L210
Useful? React with 👍 / 👎.
| def real_quadratic_order( | ||
| request: RealQuadraticOrderRequest, | ||
| ) -> RealQuadraticOrderValue: |
There was a problem hiding this comment.
Expose native values instead of wire contract models
This public jacobian.math function requires a ContractModel request containing wire-format CanonicalRational values and returns another capability-bound contract model. Native callers therefore cannot compose it directly with Fraction or other computational values without constructing wire objects, contrary to the native API boundary; keep the typed kernel native and perform request/result projection in the arithmetic capability adapter.
AGENTS.md reference: AGENTS.md:L65-L72
Useful? React with 👍 / 👎.
Summary
Supersedes #993 with a clean post-#1276 semantic port.
a+b*sqrt(d)underjacobian.math.real_quadratic;Ownership
The public math layer owns the value and order semantics; it has no SymPy dependency. The arithmetic domain publishes one thin operation and checker declaration. A dedicated clean-process checker uses only
fractions.Fractionand integer square-free tests.No general algebraic-field framework, matrix spectral helper, reciprocal relationship graph, generic assurance metadata, or workflow policy is introduced.
Validation
The branch is based directly on
195c4c1ddcb836206fcc759d602d3cf77eb2d7cf. Its port workflow compiled every changed source/test file and removed itself before committing. Tests reproduce the3*sqrt(3)/8 > 1/2+sqrt(3)/20comparison and reject a forged order.Credit
This is a clean post-#1276 port of the original implementation in #993 by @kaoru0822-kitauji. Their original investigation, reproduction, and implementation work are the basis for this replacement.