Documentation

HexRoots.Refine

The fixed give-up margin above separationDepth used by stopDepth. Overshooting costs only a few extra subdivision rounds in the rare case certification had not already happened, and nothing else. The globally normalized prefix ends three levels before this bound.

Equations
Instances For
    def Hex.stopDepth (p : ZPoly) (target : Int) :

    The depth at which the drivers give up, max target (separationDepth p) + stopSlack. A none from a driver means that its full emission condition was not reached within this fuel bound.

    Equations
    Instances For
      def Hex.completenessDepth (p : ZPoly) (target : Int) :

      The depth through which the Cauchy-started driver uses globally glued, uniform subdivision rounds. Two levels pay for encSquare; the other three cover the quadrupled Pellet base (or doubled NK base) with one strict margin level.

      Equations
      Instances For

        The common prec of a component's squares (0 for the empty component, which the drivers never produce).

        Equations
        Instances For

          The stored square of a certification result: the atom's square, or the cluster's enclosing square. The separation check and the emission precision test read this.

          Equations
          Instances For

            Re-enter a certification result into the worklist as a component.

            The retained square must cover the certified region, not merely be certified: refinement preserves exactly the roots that lie in the retained squares themselves (children partition the square, and the T₀ discard is sound), while a Pellet certificate counts roots in the stored square's circumscribed disc. A root in the disc but outside the square would be silently lost by the next subdivision; with repeated Newton-jump adoptions this loses far roots of a many-root cluster (the certified disc shrinks toward the cluster's Newton centroid while still counting every root). Retaining the doubled stored square (half-width 2·2^{−prec} ≥ the disc radius √2·2^{−prec}) restores the cover for both certificate forms, at the cost of one precision level, which the strictly-finer adoption guard in isolateLoop still absorbs (a Newton jump gains at least two levels).

            Equations
            Instances For

              All stored squares' circumscribed discs are pairwise disjoint, i.e. !discsMeet holds for every pair. One exact dyadic comparison per pair, as in the SimpleRoot intersection test.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                def Hex.fuelFor (p : ZPoly) (target start : Int) :

                Fuel for isolateLoop: the laggard's climb from the worklist's coarsest prec to stopDepth, plus a second climb from target to stopDepth for a held component forced back into refinement by a late-certifying overlapping sibling (see isolateLoop).

                Equations
                Instances For

                  Every component has reached the globally normalized completeness depth.

                  Equations
                  Instances For

                    Attempt certification on every component in a worklist.

                    Equations
                    Instances For
                      def Hex.IsolationLoop.allReady {p : ZPoly} (target : Int) (tried : Array (Component × Option (Certified p))) :

                      Every attempted component certified at the requested stored precision.

                      Equations
                      Instances For

                        The successful certificates in an attempts array.

                        Equations
                        Instances For

                          Every attempted component certified as an atom. This stronger form is also the guard for leaving global reglue early: failures and cluster results must remain in the globally normalized subdivision path.

                          Equations
                          Instances For

                            The stored squares of successful attempts are pairwise disjoint.

                            Equations
                            Instances For
                              def Hex.IsolationLoop.overlaps {p : ZPoly} (tried : Array (Component × Option (Certified p))) (i : Nat) (res : Certified p) :

                              Whether a successful result overlaps another successful result in the attempts array.

                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                def Hex.IsolationLoop.step (p : ZPoly) (target : Int) (tried : Array (Component × Option (Certified p))) (i : Nat) :

                                The contribution of one attempted component to a non-emitting round.

                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For

                                  Worklist for a non-emitting round. Ready certificates disjoint from all other successful certificates hold their input component; other successes adopt a strictly finer doubled result or refine, and failures refine.

                                  Equations
                                  Instances For

                                    Worklist for a non-emitting full-isolation round. Before normalization, all squares refine and reglue globally; afterwards this is nextLocal.

                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Instances For
                                      def Hex.refineLoop (p : ZPoly) (target : Int) (strategy : AtomStrategy) :

                                      Refinement loop for one already-isolated atom. Bisection can split even one starting component into several surviving pieces, so up to the fixed completeness depth this re-splits and re-merges components exactly as the full driver does. A result is emitted only when it is the single atom at the target precision that refineAtom? requires.

                                      Equations
                                      • One or more equations did not get rendered due to their size.
                                      • Hex.refineLoop p target strategy 0 x✝ = none
                                      Instances For

                                        Budget for the fast lineage-local pass, tried before the full driver. A successful Newton adoption normally needs only logarithmically many rounds; failure just restarts from the original atom on refineLoop.

                                        Equations
                                        Instances For
                                          def Hex.refineFastLoop (p : ZPoly) (target : Int) (strategy : AtomStrategy) :

                                          Opportunistic refinement along one atom's lineage. This loop is only a fast path: its result is accepted under the same singleton-atom guard as refineLoop, and any failure falls back to the full driver, which re-splits and re-merges components across the whole search.

                                          Equations
                                          Instances For

                                            Bounded speculative refinement of one atom. A rejected or exhausted run returns none, so callers can fall back without trusting this optimization.

                                            Equations
                                            • One or more equations did not get rendered due to their size.
                                            Instances For
                                              def Hex.refineAtom? {p : ZPoly} (iso : DyadicRootIsolation p) (target : Int) (strategy : AtomStrategy) :

                                              Atom refiner shared by the local one-root search and the all-atoms fast path in the full isolation driver.

                                              Equations
                                              • One or more equations did not get rendered due to their size.
                                              Instances For
                                                def Hex.firstRefinedAtom? {p : ZPoly} (target : Int) (strategy : AtomStrategy) (tried : Array (Component × Option (Certified p))) :

                                                Find and refine the first atom among a round's certification attempts. Array order makes the choice deterministic; clusters, failed certifications, and atoms that fail to refine are skipped.

                                                Equations
                                                • One or more equations did not get rendered due to their size.
                                                Instances For

                                                  Refine every component of a one-atom search round. A certified cluster is re-entered through its tighter certified region when that makes progress; otherwise it, and every failed component, is subdivided locally.

                                                  Equations
                                                  • One or more equations did not get rendered due to their size.
                                                  Instances For
                                                    def Hex.findAtomLoop (p : ZPoly) (target : Int) (strategy : AtomStrategy) :

                                                    Search a caller-selected region for one certified simple root, then refine that atom to target. Unlike isolateLoop, this loop does not construct a complete, pairwise-disjoint family: an atom certificate already states that its own region contains exactly one simple root. Consequently a successful result is sound without examining or refining any other root. none means the region was exhausted or no atom was found within fuel.

                                                    Equations
                                                    • One or more equations did not get rendered due to their size.
                                                    • Hex.findAtomLoop p target strategy 0 x✝ = none
                                                    Instances For

                                                      Refine the atom returned by one successful component attempt. Use the bounded lineage-local loop first, then fall back to complete normalized refinement when the local attempt cannot finish.

                                                      Equations
                                                      • One or more equations did not get rendered due to their size.
                                                      Instances For

                                                        Strategy-parametric implementation of the all-atoms finishing pass.

                                                        Equations
                                                        • One or more equations did not get rendered due to their size.
                                                        Instances For
                                                          def Hex.IsolationLoop.finishAtoms? (p : ZPoly) (target : Int) (strategy : AtomStrategy) (tried : Array (Component × Option (Certified p))) :

                                                          Opportunistically refine every successful atom to the requested target. The nested work starts only when every attempt is an atom and the current discs are pairwise disjoint; the result is accepted only when every local refinement succeeds and the refined discs remain pairwise disjoint. The NK-only strategy keeps its existing proof-specialized loop path.

                                                          Equations
                                                          Instances For
                                                            def Hex.IsolationLoop.emitReady {p : ZPoly} (target : Int) (strategy : AtomStrategy) (tried : Array (Component × Option (Certified p))) :

                                                            Ordinary output guard after the optional local finisher. Normalized worklists may emit any ready, disjoint certificates. The NK-only strategy also retains its historical early all-atoms emission; Pellet-bearing strategies use the stronger local finisher above.

                                                            Equations
                                                            • One or more equations did not get rendered due to their size.
                                                            Instances For
                                                              def Hex.isolateLoop (p : ZPoly) (target : Int) (strategy : AtomStrategy) :

                                                              The shared driver loop over the worklist. It may emit before completenessDepth when every result is already an atom and target-ready, with pairwise-disjoint discs. Before that depth, every non-emitting round globally refines and reglues the retained squares, irrespective of attempted certificates. At and beyond that depth, ready and disjoint cluster results may emit too. Otherwise: a component already certified at target whose disc is disjoint from every other certified disc holds its position; every other surviving component subdivides one level, except that one adopting a strictly finer certified result keeps that result as a one-square component instead. Each post-normalization non-emitting round strictly increases every non-held component's prec, and held components sit at target, so the laggard's prec reaches stopDepth within (stopDepth − min prec) rounds. A held component can be forced back into refinement late, when a slow sibling finally certifies with an overlapping disc, so fuelFor budgets a second climb on top: past separationDepth every certified disc is below sep/4 and distinct roots' discs are disjoint, so (stopDepth − target) further rounds suffice. fuel = 0 returns none (up to a harmless constant of overshoot). The recursion is structural on the fuel Nat.

                                                              Equations
                                                              • One or more equations did not get rendered due to their size.
                                                              • Hex.isolateLoop p target strategy 0 x✝ = none
                                                              Instances For

                                                                Refine to target precision. A bounded pass along the atom's own lineage keeps the usual Newton path, which roughly doubles the correct bits per step. If that pass does not produce exactly one atom at the target precision, refinement starts again from the input under the full driver, which re-splits and re-merges components across the whole search.

                                                                Equations
                                                                • One or more equations did not get rendered due to their size.
                                                                Instances For