Documentation

HexPrimality.Table

Exclusive upper bound of the committed prime table. The accepted 100000 policy is the largest measured candidate inside the fresh-replay build budget; primeTable lists every prime below it.

Equations
Instances For

    Every prime below primeTableBound, ascending. A committed literal; mem_primeTable_prime and mem_primeTable_of_prime are the two membership directions, so the generator that produced the literal is untrusted.

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

      Adjacent strict ascent of a list, structurally: true iff consecutive entries strictly increase.

      Equations
      Instances For
        theorem Hex.Nat.primeTable_sorted :
        List.Pairwise (fun (x1 x2 : Nat) => x1 < x2) primeTable.toList

        The committed table is strictly ascending.

        def Hex.Nat.binSearchGo (a : Array Nat) (n : Nat) :
        Nat → Nat → Nat → Bool

        Fuel-bounded binary search for n in the sorted array a over the half-open index range [lo, hi).

        Equations
        Instances For

          Membership in the committed prime table, by binary search.

          Equations
          Instances For

            The final verified sieve state underlying the committed prime table.

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

              Membership in the committed prime table. Kernel reduction reads a bit from the already verified final sieve state; compiled code uses binary search through isTablePrime_eq_tableSearch.

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

                A lookup succeeds exactly on members of the committed table.

                @[csimp]

                Compiled lookup retains binary search; the equality protects both successful and unsuccessful lookups at every input.

                Every table entry is prime: the committed literal read back through the verified sieve run.

                Every prime below the bound is a table entry: completeness through the sieve's completeness direction, which is what lets a caller conclude anything from a failed lookup.

                def Hex.Nat.primesIn (lo hi : Nat) :

                The primes in [lo, hi), ascending. Runtime decision through the isPrimeTrial-backed Decidable instance; the committed table plays no role, so the range is unrestricted.

                Equations
                Instances For
                  theorem Hex.Nat.mem_primesIn {lo hi n : Nat} :
                  n ∈ primesIn lo hi ↔ lo ≤ n ∧ n < hi ∧ Prime n

                  Membership in primesIn lo hi is exactly primality in the half-open interval [lo, hi).