Documentation

HexNumberFieldMathlib.Nearest

A point of a ball is within the radius of the centre.

A ball with a point has nonnegative radius.

theorem Hex.DyadicComplexBall.meets_of_mem_set {b₁ b₂ : DyadicComplexBall} {z : } (h₁ : z b₁.set) (h₂ : z b₂.set) :
b₁.meets b₂ = true

Two balls with a common point meet.

theorem Hex.DyadicComplexBall.dist_le_of_meets {b₁ b₂ : DyadicComplexBall} {z w : } (h : b₁.meets b₂ = true) (hz : z b₁.set) (hw : w b₂.set) :
dist z w 2 * (b₁.realRadius + b₂.realRadius)

Points of two balls that meet are within twice the radius sum of each other.

The mirror ball contains the conjugates of the ball's points.

At separationPrec p, the ball radius is at most a quarter of the separation guaranteed by mahlerPrec p, in the form the proofs use.

theorem Hex.AlgebraicNumber.eq_of_meets {p : ZPoly} (hp : p 0) {a b : AlgebraicNumber} (ha : (HexRootsMathlib.toPolyℂ p).IsRoot a.toComplex) (hb : (HexRootsMathlib.toPolyℂ p).IsRoot b.toComplex) {ballA ballB : DyadicComplexBall} (hA : a.toComplex ballA.set) (hB : b.toComplex ballB.set) (hrA : ballA.realRadius 2 ^ (-(mahlerPrec p)) / 4) (hrB : ballB.realRadius 2 ^ (-(mahlerPrec p)) / 4) (hmeets : ballA.meets ballB = true) :

Two roots of p whose balls at separationPrec p meet are equal.

A root of the product of two minimal polynomials.

The product of two minimal polynomials is nonzero.

The real part of a number is within the ball radius of the centre's.

realCompare is the order of the real parts.

mahlerPrec is at least three.

A root of X² + 1 has a stored isolation centre in the upper half plane exactly when it is the imaginary unit.

theorem Hex.AlgebraicNumber.ofPoint_toComplex (re im : ) :
(ofPoint re im).toComplex = re + im * Complex.I

The complex value of a rational point.

The conjugate of a rational point.

theorem Hex.AlgebraicNumber.distSqTo_toComplex (a : AlgebraicNumber) (re im : ) :
(a.distSqTo re im).toComplex = ↑(a.toComplex - (re + im * Complex.I) ^ 2)

distSqTo is the squared distance to the point.

distSqTo is real.

@[reducible, inline]
noncomputable abbrev Hex.AlgebraicNumber.point (re im : ) :

The point named by two rationals.

Equations
Instances For

    The squared distance from the point to the centre, as a real.

    The centre distance is at most the coordinate bound.

    theorem Hex.AlgebraicNumber.sq_norm_le_ballUpper {b : DyadicComplexBall} {z : } (hz : z b.set) (re im : ) :
    z - point re im ^ 2 (ballUpper b re im)

    The squared distance from the point to any point of a ball is at most ballUpper.

    theorem Hex.AlgebraicNumber.ballLower_le_sq_norm {b : DyadicComplexBall} {z : } (hz : z b.set) (re im : ) :
    (ballLower b re im) z - point re im ^ 2

    The squared distance from the point to any point of a ball is at least ballLower.

    The exact comparison of squared distances decides the strict order of distances.

    theorem Hex.AlgebraicNumber.certifiedNearest_sound {roots : Array AlgebraicNumber} {a : AlgebraicNumber} {prec : } {re im : } (h : certifiedNearest roots a prec re im = true) (c : AlgebraicNumber) :
    c rootsa.toComplex - point re im c.toComplex - point re im

    A certified nearest root is nearest.

    theorem Hex.AlgebraicNumber.foldl_exactStep (re im : ) (l : List AlgebraicNumber) (acc : Option AlgebraicNumber) :
    match List.foldl (exactStep re im) acc l with | none => l = [] acc = none | some r => (r l acc = some r) (∀ cl, r.toComplex - point re im c.toComplex - point re im) ∀ (b : AlgebraicNumber), acc = some br.toComplex - point re im b.toComplex - point re im

    The fold behind exactNearest, on lists.

    theorem Hex.AlgebraicNumber.exactNearest_spec (roots : Array AlgebraicNumber) (re im : ) :
    match exactNearest roots re im with | none => roots = #[] | some r => r roots croots, r.toComplex - point re im c.toComplex - point re im

    exactNearest on a nonempty array is a nearest root.

    A polynomial of positive degree has a root in algebraicRoots.

    theorem Hex.ZPoly.rootNear_mem (p : ZPoly) (hp : 0 < DensePoly.natDegree p) (re im : ) :

    rootNear returns a root.

    theorem Hex.ZPoly.rootNear_of_close (a : AlgebraicNumber) (re im : ) (h : AlgebraicNumber.point re im - a.toComplex < 2 * (2 ^ (-(mahlerPrec a.p)) * (1449 / 1024))) :
    a.p.rootNear re im = a

    A point within half the guaranteed separation of a number names it.