Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

§7, Choosing the Prime — Sampling a prime in the dyadic interval

Proved
GenericGroupWE.Main.sec_7_prime

by mikedeng1 · Nov 8, 2026 · Mathlib 0df444a (Lean v4.33.1)

complexity-theorycryptographygeneric-groupsp2o-batch-stoc27ap2o-gran-per-chapterp2o-plan-paperp2o-strengthenedp2o-v1

There is an absolute positive integer CCC and one bounded polynomial-time probabilistic program implementing the specified independent uniform dyadic sampler. For every m≥1m\ge1m≥1 and n≥0n\ge0n≥0, it uses Cm(n+2)Cm(n+2)Cm(n+2) trials, returns a prime in [2m,2m+1)[2^m,2^{m+1})[2m,2m+1) on success, and otherwise returns the common abort symbol, with

Pr⁡[abort]≤2−n−2.\Pr[\text{abort}]\le2^{-n-2}.Pr[abort]≤2−n−2.

The program's actual Turing transition time is polynomial. Sampling has no message-bit input, so its failure event is bit independent.

Differences from the source:

  • generalization: the application uses m>=16n and n>=2 → every m>=1 and n>=0; reason: dyadic prime density admits one absolute constant on this larger domain; m=0 would instead give the prime-free interval [1,2) and is excluded
  • encoding: ceil(C m(n+2)) for an absolute real constant → C is chosen as a positive integer and the trial count is exactly C m(n+2); reason: enlarging the constant to an integer preserves the bound and makes the ceiling redundant
  • encoding: polynomial-time algorithms on encoded data → a single CookLevin polynomial-step implementation for each length-faithful encoded map; reason: the time predicate bounds actual Turing steps; clocks also bound rounds and state length
Preamble
import Definitions.Def_GenericGroupWE_Main_PrimeSampling
import Definitions.Def_GenericGroupWE_Main_Complexity
Formal statement
namespace GenericGroupWE.Main

theorem sec_7_prime :
    ∃ C : ℕ, 0 < C ∧ ∃ P : OracleProgram,
      CookLevin.IsPolyTimeComputable P.next ∧ ∀ (m n : ℕ), 1 ≤ m →
        P.run false (primeSamplingInput m n) none =
          (dyadicPrimeSampler m (C*m*(n+2))).map primeSamplingOutput ∧
        probability (dyadicPrimeSampler m (C*m*(n+2))) (· = none) ≤
          (2 : ℝ)^(-(n : ℝ)-2) ∧
        ∀ p : PrimeOrder, some p ∈ (dyadicPrimeSampler m (C*m*(n+2))).support →
          2^m ≤ p.val ∧ p.val < 2^(m+1) := by sorry

end GenericGroupWE.Main
Source
Hair and Sahai, Witness Encryption via Prime-Order Generic Groups, STOC 2027 submission #47 (PDF built 2026-11-02; SHA-256 0b7f14e2db9bb3e199883ab907f854b7b5884c7c9f3d1e4c306bb71e89b659cb), https://github.com/sigact-stoc/stoc2027/releases/download/papers-1/47.pdf, §7, Choosing the Prime, PDF p. 30 (printed p. 29).
Human review
  • Endorsed by Shuze Chen · Nov 8, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Nov 8, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me