Documentation

LeanPool.ConwaySoifer.Certificates.Checker

The contact-sensitive exclusion checker (computable part) #

All data are integer polynomials in one real parameter x (the offset s - lo of the covering parameter from the left end of a certificate interval), lowest degree first. A point P : IPoint denotes the real point (1/den) • (P.1(x), P.2(x)). A Cap records a contact constraint: the real point p/den is a full ray endpoint with exit direction dv (strict = false) or a forbidden point on a positive ray from a mandatory point (strict = true).

excluded Ps den caps ord a b d fuel depth decides, for the parameter piece [a/d, b/d], whether no equilateral triangle of side < 1 can contain all points of Ps while satisfying the caps and (for ord = some i) the non-overfull condition of side owner i. Its structure mirrors tools/proto_checker.py (the untrusted Python reference model):

Only the leaf tests (nonnegOn, posOn) and the chain structure are used by the soundness proofs in CheckerSound.lean; everything else (choice of nodes, triples, knots) is untrusted search executed inside the checker.

@[reducible, inline]

A point whose two coordinates are integer polynomials in the interval parameter.

Equations
Instances For
    @[reducible, inline]

    Indices of the three mandatory points used by a support bound.

    Equations
    Instances For

      An endpoint or forbidden-point constraint, with an exit direction and strictness flag.

      • p : IPoint

        The polynomial contact point.

      • dv : IPoint

        The positive exit direction at the contact point.

      • strict : Bool

        Whether the contact point is forbidden rather than a closed endpoint.

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

            Polynomial geometry #

            The determinant polynomial of two polynomial points.

            Equations
            Instances For

              The squared Euclidean norm polynomial in triangular coordinates.

              Equations
              Instances For

                Rotation through 120 degrees in polynomial triangular coordinates.

                Equations
                Instances For

                  Coordinatewise subtraction of polynomial points.

                  Equations
                  Instances For

                    Coordinatewise addition of polynomial points.

                    Equations
                    Instances For

                      The constant east direction in polynomial coordinates.

                      Equations
                      Instances For

                        The constant direction obtained by rotating east through 120 degrees.

                        Equations
                        Instances For

                          The sum of support determinants for three successive orientation normals.

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            def ConwaySoifer.Certificates.gapP (den : ℤ) (u P₀ P₁ P₂ : IPoint) :

                            N² - den² |u|²: nonnegative together with N ≥ 0 iff the side bound is at least one.

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

                              A structural, optional lookup used by the verified support checker.

                              Equations
                              Instances For

                                Trusted leaf tests #

                                def ConwaySoifer.Certificates.supportOK (Ps : List IPoint) (den : ℤ) (u : IPoint) (T : Triple) (a b d : ℤ) (fuel : ℕ) :

                                Check a supplied support triple over the complete rational parameter interval.

                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For
                                  def ConwaySoifer.Certificates.badFace (Ps : List IPoint) (e : IPoint) (c : Cap) (a b d : ℤ) (fuel : ℕ) :

                                  Face e cannot be the contact face of cap c anywhere on the piece.

                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For
                                    def ConwaySoifer.Certificates.badFaceCone (Ps : List IPoint) (eu ev : IPoint) (c : Cap) (a b d : ℤ) (fuel : ℕ) :

                                    Faces a • eu + b • ev (a, b > 0) cannot be the contact face of cap c.

                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Instances For
                                      def ConwaySoifer.Certificates.capNode (Ps : List IPoint) (caps : List Cap) (u : IPoint) (a b d : ℤ) (fuel : ℕ) :

                                      Check that one cap rejects all three contact faces at one orientation direction.

                                      Equations
                                      • One or more equations did not get rendered due to their size.
                                      Instances For
                                        def ConwaySoifer.Certificates.capCone (Ps : List IPoint) (caps : List Cap) (u v : IPoint) (a b d : ℤ) (fuel : ℕ) :

                                        Check that one cap rejects all contact faces throughout a positive orientation cone.

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

                                          Untrusted search helpers #

                                          The maximum coefficient-list length among all polynomial point coordinates.

                                          Equations
                                          Instances For

                                            Track the first largest value while scanning values with their indices.

                                            Equations
                                            Instances For

                                              The first index attaining the largest value, or zero for an empty list.

                                              Equations
                                              Instances For
                                                def ConwaySoifer.Certificates.maxIndex (Ps : List IPoint) (l : IPoint) (num den : ℤ) (N2 : ℕ) :

                                                Select a point with the largest exact support determinant at a rational parameter.

                                                Equations
                                                • One or more equations did not get rendered due to their size.
                                                Instances For
                                                  def ConwaySoifer.Certificates.tripleAt (Ps : List IPoint) (N : ℕ) (u : IPoint) (num den : ℤ) :

                                                  The maximising triple for direction u at the parameter num/den.

                                                  Equations
                                                  • One or more equations did not get rendered due to their size.
                                                  Instances For
                                                    def ConwaySoifer.Certificates.supportNode (Ps : List IPoint) (den : ℤ) (N : ℕ) (u : IPoint) (a b d : ℤ) (fuel : ℕ) :

                                                    Try support triples selected at the midpoint and endpoints of one interval.

                                                    Equations
                                                    • One or more equations did not get rendered due to their size.
                                                    Instances For
                                                      def ConwaySoifer.Certificates.supportCone (Ps : List IPoint) (den : ℤ) (N : ℕ) (u v : IPoint) (a b d : ℤ) (fuel : ℕ) :

                                                      Try one common support triple at both endpoints of an orientation cone.

                                                      Equations
                                                      • One or more equations did not get rendered due to their size.
                                                      Instances For
                                                        def ConwaySoifer.Certificates.nodeCheck (Ps : List IPoint) (den : ℤ) (caps : List Cap) (N : ℕ) (u : IPoint) (a b d : ℤ) (fuel : ℕ) :

                                                        Reject a direction using either a support bound or a cap.

                                                        Equations
                                                        Instances For
                                                          def ConwaySoifer.Certificates.coneCheck (Ps : List IPoint) (den : ℤ) (caps : List Cap) (N : ℕ) (u v : IPoint) (a b d : ℤ) (fuel : ℕ) :

                                                          Reject a positive orientation cone using a common support triple or a cap.

                                                          Equations
                                                          Instances For
                                                            def ConwaySoifer.Certificates.nodeCond (u : IPoint) (a b d : ℤ) (fuel : ℕ) :

                                                            A node must be nonzero and lie in the closed cone from east to rot east on the piece.

                                                            Equations
                                                            • One or more equations did not get rendered due to their size.
                                                            Instances For
                                                              def ConwaySoifer.Certificates.nodesOK (Ps : List IPoint) (den : ℤ) (caps : List Cap) (N : ℕ) (a b d : ℤ) (fuel : ℕ) :

                                                              nodesOK … u ns: the consecutive cones (u, v₁), (v₁, v₂), … up to rot east all pass, consecutive determinants are nonnegative on the piece, and every intermediate node satisfies nodeCond.

                                                              Equations
                                                              Instances For

                                                                Candidate nodes (untrusted) #

                                                                The six rotations and opposite rays generated by a polynomial direction.

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

                                                                  Candidate fan directions obtained from point differences and cap constraints.

                                                                  Equations
                                                                  • One or more equations did not get rendered due to their size.
                                                                  Instances For
                                                                    @[reducible, inline]

                                                                    A polynomial direction paired with its exact integer evaluation.

                                                                    Equations
                                                                    Instances For
                                                                      def ConwaySoifer.Certificates.evalRay (num den : ℤ) (N : ℕ) (r : IPoint) :

                                                                      Pair a polynomial ray with its scaled rational-coordinate evaluation.

                                                                      Equations
                                                                      Instances For

                                                                        The determinant of two integer coordinate vectors.

                                                                        Equations
                                                                        Instances For
                                                                          def ConwaySoifer.Certificates.merge {α : Type} (lt : α → α → Bool) :
                                                                          ℕ → List α → List α → List α

                                                                          Fuel-bounded merge of two lists using a Boolean ordering test.

                                                                          Equations
                                                                          Instances For
                                                                            def ConwaySoifer.Certificates.msort {α : Type} (lt : α → α → Bool) :
                                                                            ℕ → List α → List α

                                                                            Fuel-bounded merge sort used only to propose certificate data.

                                                                            Equations
                                                                            Instances For

                                                                              Remove consecutive parallel evaluated directions.

                                                                              Equations
                                                                              Instances For

                                                                                Keep a node only when the trusted conditions with the previously kept node hold.

                                                                                Equations
                                                                                Instances For
                                                                                  def ConwaySoifer.Certificates.quadNodes (Ps : List IPoint) (caps : List Cap) (N : ℕ) (a b d : ℤ) (fuel : ℕ) :

                                                                                  Propose ordered fan nodes from exact midpoint evaluations and interval tests.

                                                                                  Equations
                                                                                  • One or more equations did not get rendered due to their size.
                                                                                  Instances For
                                                                                    def ConwaySoifer.Certificates.fanCheck (Ps : List IPoint) (den : ℤ) (caps : List Cap) (a b d : ℤ) (fuel : ℕ) :

                                                                                    Check the proposed fan across the closed 120-degree orientation arc.

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

                                                                                      Non-overfull owners #

                                                                                      den • vertex i.

                                                                                      Equations
                                                                                      Instances For
                                                                                        def ConwaySoifer.Certificates.crossesRay (v dvec A B : IPoint) (a b d : ℤ) (fuel : ℕ) :

                                                                                        The segment [A, B] crosses the ray from v in direction dvec (all conditions on the piece): dd > 0, 0 ≤ mu ≤ dd (crossing parameter inside the segment) and nm ≥ 0 (nonnegative ray parameter nm/dd).

                                                                                        Equations
                                                                                        • One or more equations did not get rendered due to their size.
                                                                                        Instances For
                                                                                          def ConwaySoifer.Certificates.rayBounds (Ps : List IPoint) (v dvec : IPoint) (a b d : ℤ) (fuel : ℕ) :

                                                                                          Candidate crossing pairs (untrusted pruning; everything is re-verified in rayBoundsSum).

                                                                                          Equations
                                                                                          • One or more equations did not get rendered due to their size.
                                                                                          Instances For
                                                                                            def ConwaySoifer.Certificates.rayBoundsSum (Ps : List IPoint) (v dv₁ dv₂ : IPoint) (L R : List (IPoint × IPoint)) (a b d : ℤ) (fuel : ℕ) :

                                                                                            Trusted: two crossing pairs (points of Ps) whose lower bounds nm₁/dd₁ + nm₂/dd₂ reach 1 on the whole piece.

                                                                                            Equations
                                                                                            • One or more equations did not get rendered due to their size.
                                                                                            Instances For
                                                                                              def ConwaySoifer.Certificates.bestBounds (v dvec : IPoint) (bs : List (IPoint × IPoint)) (num dd : ℤ) (N2 : ℕ) :

                                                                                              Best four pairs by the value of the bound at the midpoint (untrusted pruning).

                                                                                              Equations
                                                                                              • One or more equations did not get rendered due to their size.
                                                                                              Instances For
                                                                                                def ConwaySoifer.Certificates.ordinaryExclusion (Ps : List IPoint) (den : ℤ) (i : Fin 6) (a b d : ℤ) (fuel : ℕ) :

                                                                                                Check an exclusion using the side-owner non-overfull condition.

                                                                                                Equations
                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                Instances For
                                                                                                  def ConwaySoifer.Certificates.ordinaryCheck (Ps : List IPoint) (den : ℤ) (ord : Option (Fin 6)) (a b d : ℤ) (fuel : ℕ) :

                                                                                                  Apply the non-overfull exclusion when an owner flag is present.

                                                                                                  Equations
                                                                                                  Instances For

                                                                                                    Diameter #

                                                                                                    def ConwaySoifer.Certificates.diamCheck (Ps : List IPoint) (den a b d : ℤ) (fuel : ℕ) :

                                                                                                    Search for a pair whose certified separation excludes a subunit triangle.

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

                                                                                                      Rational split points (untrusted) #

                                                                                                      A rational as a pair with positive denominator.

                                                                                                      Equations
                                                                                                      Instances For

                                                                                                        Remove trailing zero coefficients from an integer polynomial.

                                                                                                        Equations
                                                                                                        Instances For

                                                                                                          Differentiate successive coefficients starting at a specified degree.

                                                                                                          Equations
                                                                                                          Instances For

                                                                                                            Remove trailing zeros from a rational coefficient list.

                                                                                                            Equations
                                                                                                            Instances For

                                                                                                              One Euclidean step a - c x ^ k b where c = lead a / lead b, k = deg a - deg b.

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

                                                                                                                Fuel-bounded polynomial remainder calculation over rational coefficients.

                                                                                                                Equations
                                                                                                                Instances For

                                                                                                                  A proposed rational polynomial remainder, with a degree-based fuel bound.

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

                                                                                                                    Fuel-bounded rational polynomial Euclidean algorithm used by the untrusted search.

                                                                                                                    Equations
                                                                                                                    Instances For

                                                                                                                      All rational roots of a polynomial of degree at most two (integer square root test), and the rational roots of gcd(p, p') for higher degrees (double roots). Fuel-bounded.

                                                                                                                      Equations
                                                                                                                      Instances For

                                                                                                                        Propose rational roots using a degree-based recursion budget.

                                                                                                                        Equations
                                                                                                                        Instances For

                                                                                                                          Rational comparison n₁/m₁ < n₂/m₂ for positive denominators.

                                                                                                                          Equations
                                                                                                                          Instances For

                                                                                                                            Compare rational pairs by cross multiplication; denominators are assumed positive.

                                                                                                                            Equations
                                                                                                                            Instances For

                                                                                                                              Roots strictly inside (a/d, b/d).

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

                                                                                                                                Keep the first occurrence of each cross-multiplication equivalence class.

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

                                                                                                                                  Candidate knots: switch parameters of support values, sign changes of contact polynomials and crossings of candidate directions.

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

                                                                                                                                    Split point: the knot closest to the midpoint, else the midpoint.

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

                                                                                                                                      The exclusion decision #

                                                                                                                                      Split [a/d, b/d] at n/m (with a/d < n/m < b/d) into two pieces.

                                                                                                                                      Equations
                                                                                                                                      Instances For
                                                                                                                                        def ConwaySoifer.Certificates.excluded (Ps : List IPoint) (den : ℤ) (caps : List Cap) (ord : Option (Fin 6)) (fuel : ℕ) :
                                                                                                                                        ℕ → ℤ → ℤ → ℤ → Bool

                                                                                                                                        Try geometric exclusions and recursively proposed rational interval splits.

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

                                                                                                                                          Point sets: the ordered-field thinning of the reference verifier #

                                                                                                                                          The sign of the first nonzero coefficient, or zero for a zero coefficient list.

                                                                                                                                          Equations
                                                                                                                                          Instances For

                                                                                                                                            Compare polynomial points lexicographically by the first nonzero coefficient difference.

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

                                                                                                                                              Sort polynomial points using their coefficient comparison.

                                                                                                                                              Equations
                                                                                                                                              Instances For

                                                                                                                                                Retain the first point in each coefficient-comparison equivalence class.

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

                                                                                                                                                  Stack scan with a structural recursion budget. Each transition decreases out.length + 2 * rest.length, so that measure suffices for the complete scan.

                                                                                                                                                  Equations
                                                                                                                                                  Instances For

                                                                                                                                                    Complete half-hull scan; the budget bounds stack transitions, not input size.

                                                                                                                                                    Equations
                                                                                                                                                    Instances For

                                                                                                                                                      The subset selection of exact_polynomials.thin_hull (a weakening; never a hull claim).

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

                                                                                                                                                        Certificate replay #

                                                                                                                                                        One forced step: point q (scaled by the common denominator) is forced into owner owner.

                                                                                                                                                        • owner : Fin 10

                                                                                                                                                          The owner forced to contain the new point.

                                                                                                                                                        • q : IPoint

                                                                                                                                                          The newly assigned polynomial point.

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

                                                                                                                                                            The replay state: mandatory point lists, caps and ordinary flags per owner.

                                                                                                                                                            • B : Fin 10 → List IPoint

                                                                                                                                                              The mandatory polynomial points for each owner.

                                                                                                                                                            • caps : Fin 10 → List Cap

                                                                                                                                                              The contact constraints for each owner.

                                                                                                                                                            • ord : Fin 10 → Option (Fin 6)

                                                                                                                                                              Optional non-overfull side-owner indices.

                                                                                                                                                            Instances For
                                                                                                                                                              def ConwaySoifer.Certificates.inTarget (q : IPoint) (den a b d : ℤ) (fuel : ℕ) :

                                                                                                                                                              q lies in the target triangle a ≤ 1, b ≤ 1, -1 ≤ a + b (scaled by den).

                                                                                                                                                              Equations
                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                              Instances For
                                                                                                                                                                def ConwaySoifer.Certificates.stepCheck (M : Model) (den : ℤ) (st : Step) (a b d : ℤ) (fuel depth : ℕ) :

                                                                                                                                                                Check target membership and exclusion from every owner except the proposed owner.

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

                                                                                                                                                                  The thinned list, filtered to elements of the original list (so that membership is a syntactic fact and no property of the hull heuristic is needed).

                                                                                                                                                                  Equations
                                                                                                                                                                  Instances For

                                                                                                                                                                    Insert a forced point into its owner set and retain only a checked hull subset.

                                                                                                                                                                    Equations
                                                                                                                                                                    Instances For
                                                                                                                                                                      def ConwaySoifer.Certificates.replay (M : Model) (den a b d : ℤ) (fuel depth : ℕ) :
                                                                                                                                                                      List Step → Fin 10 → Bool

                                                                                                                                                                      Check the forced assignments in order and a final owner contradiction.

                                                                                                                                                                      Equations
                                                                                                                                                                      Instances For