Documentation

HexECPP.Search

The work limit or unsuccessful search stage reported when certificate search cannot complete a primality proof.

Instances For
    Equations
    Instances For
      @[instance_reducible]
      Equations

      Limits for finding an elliptic curve primality certificate. The counters bound the entire search, including recursive proofs of auxiliary primes; trying another curve does not restore work already spent. Retry limits also bound the number of choices tried on each curve. Neither a bit-length limit nor the other allowances guarantee that search succeeds for every prime.

      • maxBits : Nat

        Maximum subject bit length.

      • maxDepth : Nat

        Maximum recursive certificate depth.

      • maxCandidates : Nat

        Shared discriminant and order candidate allowance.

      • maxRoots : Nat

        Shared modular-root call allowance.

      • maxNonresidues : Nat

        Shared nonresidue-draw allowance.

      • maxPoints : Nat

        Shared point-draw allowance.

      • maxFactorWork : Nat

        Shared reserved factor-attempt packages.

      • maxScalarWork : Nat

        Shared maximum scalar additions, including checker replays.

      • maxOutputBits : Nat

        Maximum literal bits per retained certificate.

      • maxMemo : Nat

        Maximum retained successful certificates.

      • pointRetries : Nat

        Local retries are also charged to the shared allocations.

      • nonresidueRetries : Nat

        Local nonresidue draws, also charged to the shared allowance.

      • Select a finite terminal package; omission retains the 256-bit policy.

      • Select a finite order package; its attempt limit must be explicit.

      • maxRows : Option Nat

        Public output limits include ancestral rows and embedded terminal nodes.

      • maxNodes : Option Nat

        Total nodes include the ECPP base wrapper.

      • backtrackOutput : Bool

        Reject oversized candidates locally, retaining all charged work.

      • extendedCM : Bool

        Opt in to the attributed fixed linear/quadratic class polynomial table.

      • maxPolynomialWork : Nat

        Shared reserved polynomial-root modular operations.

      • maxRootWork : Nat

        Per-call modular-operation ceiling; closed-form roots need no splits.

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

          Fixed per-attempt ceiling for terminal construction. It is deliberately smaller than the full primality? route used by capability comparisons.

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

            Fixed partial-factor package for one CM order.

            Equations
            • Hex.ECPP.orderBudget = { primeBudget := { rhoRestarts := 1, rhoSteps := 2048 }, primeFuel := 1, factorFuel := 16, smoothBounds := [64, 512], smoothBases := [2], attemptLimit := some 4 }
            Instances For

              Larger search policy for integers through 512 bits, with additional fixed complex multiplication class polynomials. Select it explicitly; produce defaults to the 256-bit policy. Search can still fail within this size range. Use public512Budget when the result must fit the public proof commands' certificate limits.

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

                The 512-bit search policy used by the public tactic and export command. It restricts output to 20 elliptic rows and 32 total certificate nodes, including the wrapper and all nodes of the last HexPrimality certificate.

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

                  Explicit output-bounded 256-bit allocation for mixed factor completion. The ordinary producer and existing Native 256-bit policy retain their defaults.

                  Equations
                  Instances For

                    An integer whose primality certificate was not found, together with the work limit or search stage that stopped the attempt.

                    • subject : Nat

                      Integer whose primality certificate remains unfound.

                    • resource : Resource

                      Work limit or search stage responsible for stopping the search.

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

                        Cumulative charged work and backtracking diagnostics.

                        • candidates : Nat

                          Charged discriminant and order candidates.

                        • roots : Nat

                          Charged modular-root calls.

                        • nonresidues : Nat

                          Charged nonresidue draws.

                        • points : Nat

                          Charged point draws.

                        • factorWork : Nat

                          Reserved factor-work units, never refunded.

                        • scalarWork : Nat

                          Reserved scalar additions, never refunded.

                        • backtracks : Nat

                          Checked proposals rejected when their recursive child could not be built.

                        • terminalCalls : Nat

                          Terminal package invocations and their checked successes.

                        • terminalSuccesses : Nat
                        • terminalBitRejects : Nat

                          Terminal calls outside the selected package's subject limit.

                        • terminalObligation : Option Nat

                          Last unproved terminal obligation, distinct from CM child failures.

                        • norms : Nat

                          Successful norm equations, orders and eligible large prime factors.

                        • orders : Nat
                        • largeFactors : Nat
                        • proposals : Nat

                          Checked elliptic step proposals, before recursive child construction.

                        • outputRejects : Nat

                          Output candidates rejected after their search work was charged.

                        • outputBits : Option Nat

                          Actual last literal-bit count; none records traversal exhaustion.

                        • polynomialWork : Nat

                          Reserved modular-operation bounds for class polynomial roots.

                        • polynomialRoots : Nat

                          Checked j-roots admitted from the class polynomial table.

                        • unresolved : Option SearchError

                          Retained failure. Smaller unresolved children and complete portfolios supersede local retries.

                        • lastRetry : Option SearchError

                          Last local retry exhaustion, retained even when the final diagnosis is portfolio exhaustion.

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

                            The advanced random stream, cumulative counters and checked success memo.

                            • rand : Rand

                              Advanced deterministic random stream.

                            • stats : SearchStats

                              Cumulative counters and diagnostics; stateful callers can reset them independently of the memo.

                            • memo : List Cert

                              Only successes are cached; a failed branch may depend on remaining depth.

                            Instances For
                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                @[reducible, inline]
                                abbrev Hex.ECPP.SearchM (α : Type) :

                                Search errors preserve the advanced random stream, memo and charged work.

                                Equations
                                Instances For
                                  def Hex.ECPP.charge (budget : SearchBudget) (n : Nat) (resource : Resource) (amount : Nat := 1) :

                                  Charge before running any work; no backtracking restores counters.

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

                                    Count terminal literal bits under an explicit traversal fuel. Exhaustion is explicit and cannot bypass a caller's larger output allocation.

                                    Equations
                                    Instances For
                                      def Hex.ECPP.certBitsAt (terminalFuel : Nat) :

                                      Count raw chain bits, including a terminal within the fixed leaf-depth profile. Reject deeper supplied terminals instead of undercounting them.

                                      Equations
                                      Instances For

                                        Literal bits under the original terminal profile.

                                        Equations
                                        Instances For

                                          Embedded terminal node count and height; exhaustion rejects the candidate.

                                          Equations
                                          Instances For
                                            def Hex.ECPP.certShape (terminalFuel : Nat) :

                                            Rows, total nodes (including the base wrapper), and terminal height.

                                            Equations
                                            Instances For

                                              Maximum scalar additions performed by a complete checker replay.

                                              Equations
                                              Instances For

                                                Structurally bounded recursion; failure of a child resumes the parent's remaining CM orders, without resetting any allocation or random state. This stateful worker requires a memo of previously checked successes admitted under the same allocations and sufficient remaining depth. Caller-supplied states are not validated here; produce starts fresh and checks its result.

                                                Equations
                                                Instances For

                                                  The outcome of certificate search, together with its final random state and statistics. An error reports an unsuccessful attempt, not a proof that the input is composite.

                                                  • A complete checked primality certificate, or the integer and reason for which the search stopped.

                                                  • state : SearchState

                                                    Final random stream, counters and successful memo.

                                                  Instances For
                                                    Equations
                                                    • One or more equations did not get rendered due to their size.
                                                    Instances For
                                                      def Hex.ECPP.produce (n seed : Nat) (budget : SearchBudget := { }) :

                                                      Search for a primality certificate for n, using seed to choose the deterministic random sequence and budget to limit the work. Return a certificate and search statistics, or an error explaining why search stopped. Every .ok c result satisfies checkAt n c = true; failure to find a certificate does not imply that n is composite.

                                                      The default policy admits inputs through 256 bits. native512Budget and public512Budget explicitly select 512-bit search. For a theorem of Mathlib's Nat.Prime n, use HexECPPTheory.Native or apply the companion's soundness theorem to a kernel-checked checker equation.

                                                      Equations
                                                      • One or more equations did not get rendered due to their size.
                                                      Instances For
                                                        theorem Hex.ECPP.produce_ok {n seed : Nat} {budget : SearchBudget} {c : Cert} (h : (produce n seed budget).result = Except.ok c) :

                                                        Every successful production result is accepted at the requested subject, independently of seed, allocation and arithmetic proposals.

                                                        Freeze only replay inputs. Each row uses the already found q-order point and cofactor one, so conversion need not repeat any CM or factor search. The stored t = n + 1 - q is an encoding field, not a Frobenius trace.

                                                        Equations
                                                        Instances For