Skip to content

Natural division bug #5704

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
etorreborre opened this issue May 16, 2025 · 0 comments
Open

Natural division bug #5704

etorreborre opened this issue May 16, 2025 · 0 comments
Labels

Comments

@etorreborre
Copy link
Contributor

The following property does not hold when the Natural n is 17621823851506098539

n ^ 2 / n == n

This can be shown by uncommenting the ensureWith comment currently in base:

lib.base.math.Natural.pow.tests.quotient : [Result]
  lib.base.math.Natural.pow.tests.quotient = 
    base.test.prop 10 cases
      n ->
        use Nat -
        use Natural + pow
        use Random natIn
        x = Random.natural() + Natural.one
        b = natIn 1 3
        a = natIn b 3
        xa = pow x a
        xb = pow x b
        match toOptional! do div.aborting xa xb with
          None -> ensureWith "failed division" false
          Some lhs ->
            rhs = pow x (a - b)
            _ =
              "this test does not pass for now: ensureWith (x, a, b, xa, xb, lhs, rhs) (lhs == rhs)"
            ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant