A precision at which the approximation balls of two distinct roots of p
are disjoint: mahlerPrec p separates the roots by more than four ball radii
at mahlerPrec p, and two more bits leave room for the centre errors.
Equations
Instances For
The imaginary unit: the root of X² + 1 whose stored isolation lies in
the upper half plane.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The mirror image of a ball in the real axis.
Instances For
Complex conjugation. A real number is its own conjugate. Otherwise the
conjugate is a root of the same minimal polynomial, and at separationPrec
it is the unique root whose approximation ball meets the mirror image of this
number's ball.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Exact comparison of two real algebraic numbers. Equal numbers compare
equal; distinct ones are distinct roots of the product of their minimal
polynomials, whose approximation balls at separationPrec of that product are
disjoint, so the order of the ball centres is the order of the numbers.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The rational point re + im·i as an algebraic number.
Equations
Instances For
The squared distance from re + im·i to a, as an exact real algebraic
number: (a − z)(ā − z̄).
Equations
- a.distSqTo re im = (a - Hex.AlgebraicNumber.ofPoint re im) * (a.conj - Hex.AlgebraicNumber.ofPoint re (-im))
Instances For
A square-root-free upper bound on the distance from re + im·i to a
ball's centre: the sum of the absolute coordinate differences.
Equations
- Hex.AlgebraicNumber.ballDistBound b re im = Hex.AlgebraicNumber.absRat (b.re.toRat - re) + Hex.AlgebraicNumber.absRat (b.im.toRat - im)
Instances For
Upper bound on the squared distance from re + im·i to a ball's points:
d + 2rl + r² with d the squared centre distance, r the radius and l
the centre distance bound.
Equations
- Hex.AlgebraicNumber.ballUpper b re im = Hex.AlgebraicNumber.ballDistSq b re im + 2 * b.radius.toRat * Hex.AlgebraicNumber.ballDistBound b re im + b.radius.toRat * b.radius.toRat
Instances For
Lower bound on the squared distance from re + im·i to a ball's points:
d − 2rl + r² when the ball does not reach the point (r² ≤ d), else 0.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Whether a is certified nearer to re + im·i than every other listed
root, by ball bounds alone.
Equations
- One or more equations did not get rendered due to their size.
Instances For
One step of the exact choice: keep the incumbent unless the candidate is strictly nearer.
Equations
- Hex.AlgebraicNumber.exactStep re im none c = some c
- Hex.AlgebraicNumber.exactStep re im (some b) c = if ((c.distSqTo re im).realCompare (b.distSqTo re im) == Ordering.lt) = true then some c else some b
Instances For
The exact choice: the first root in the array order whose squared distance to the point is minimal.
Equations
- Hex.AlgebraicNumber.exactNearest roots re im = Array.foldl (Hex.AlgebraicNumber.exactStep re im) none roots
Instances For
The root of p nearest to re + im·i; among roots at the same distance,
the first in algebraicRoots order. The fast path certifies a nearest root
from approximation balls at AlgebraicNumber.separationPrec p; when that
fails, because two roots are nearly or exactly equidistant, the exact squared
distances decide. A constant polynomial has no roots and yields 0.
Irreducible, like algebraicRoots: a type such as QAdjoin (rootNear p re)
is reduced by #eval while it looks for a printing instance, and must not
run the root search symbolically. Proofs unfold it explicitly.
Equations
- One or more equations did not get rendered due to their size.
Instances For
q truncated toward zero to digits decimal places, as a Lean literal:
an integer when the fraction is zero, otherwise d.ddd, negatives in
parentheses. A display helper; it carries no contract.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Decimal places at which a truncated isolation centre still names its
root: 10 ^ -digits ≤ 2 ^ -mahlerPrec, so the printed point is within
(1 + √2) · 2 ^ -mahlerPrec of the root, less than half the root
separation.
Equations
- Hex.AlgebraicNumber.Display.digitsFor mahler = mahler / 3 + 1
Instances For
A canonical number prints as the expression that rebuilds it:
ZPoly.rootNear p re for a real number and ZPoly.rootNear p re im
otherwise, with re and im the stored isolation centre truncated to
digitsFor (mahlerPrec p) decimals, few enough to read and enough that the
printed point is nearer to this root than to any other
(rootNear_of_close).
Equations
- One or more equations did not get rendered due to their size.
An element of ℚ(a) prints as the expression that rebuilds it: the
generating number, which prints round-trippably itself, and the reduced
coordinates. This is why QAdjoin is a def rather than an abbrev: the
PolyQuot instance would otherwise win, and that one can only name the root
by its isolating square. Carrying the number instead of a square, this form
also leaves no decide side conditions to discharge when it is pasted back.
Equations
- One or more equations did not get rendered due to their size.