How statement and proof provenance work
The first chip identifies the source of the statement or construction; the second identifies the source of its local proof or verification.
- Literature-sourced: the exact statement appears in a cited source; only wording and notation differ.
- AI-adapted: a semantically identical restatement of literature-sourced material, modulo indexing, notation, and boundary cases adopted by the library.
- AI-generated: a genuinely novel statement formulated by AI, with no source for the claim itself.
These labels describe origin, not correctness: citations and verification chips remain separate evidence.
Exact randomized modular square roots in expected polynomial time
Statement
Given a prime integer and an integer , there is an exact randomized algorithm that returns a square root of modulo or correctly reports that none exists. With ordinary binary integers, schoolbook arithmetic and independent unbiased random bits, its expected bit cost is polynomial in the input length; after reducing modulo , it is . Every returned answer is correct, and the algorithm terminates with probability one. The input promise that is prime is not a primality test.
Facts & Assumptions
Given: A prime and an integer in binary; random bits are independent and unbiased.
Euler's criterion gives modulo an odd prime (Euler's criterion: ).
Exactly half the nonzero classes modulo an odd prime are nonsquares (An odd prime has nonzero quadratic residues and as many nonresidues).
The residue ring modulo a prime is a field (For every prime , the two operations on make it a field).
Proof
Reduce modulo . If , return its residue; if , return zero. Otherwise [F1] rejects exactly the nonsquares by testing . In the remaining case write with odd and . Repeatedly sample uniformly from until . Uniform sampling is implemented by drawing bits and rejecting zero and integers at least . Each draw is accepted with probability at least , and each accepted is a nonsquare with probability by [F2]; thus this search has bounded expected trials and terminates almost surely.
Set , , and , all modulo . Then , has exact multiplicative order , and by the tests in step 1.1. While , find the least with by successive squaring; it satisfies . Put and replace by . The identity is preserved. The old has order exactly , so : in a field, the only roots of are by factorization. Likewise has order and its -st power is . Therefore the new has order dividing , while the new has order . The invariants are maintained and strictly decreases. After at most iterations, and . Return .
Put . Every modular integer has bits. Schoolbook multiplication and division use bit operations; binary repeated squaring computes a power with -bit exponent in modular multiplications. These bounds follow directly by forming at most shifted rows for multiplication and eliminating at most quotient digits for division. Step 1.1 uses an expected bounded number of such powers. Each of the at most iterations in step 2.1 uses at most modular multiplications to find and compute . Its total cost is . Initial reduction has cost polynomial in the original length of and . Thus the algorithm has the asserted expected bit bound; only the nonsquare search is randomized, and its outcome never changes the correctness of the final answer.
Depends on
Used by
Dependency tree · two levels
21 results within two dependency steps of this one, each drawn at its shortest distance from it. An arrow runs from a result to what uses it, so the chart reads left to right and ends at this result, which carries a heavier outline. Every node is a link to that result. Click elsewhere on the chart to enlarge it.
Sources
- Ross and Selinger, Optimal ancilla-free Clifford+T approximation of z-rotations, Appendix C, Lemma C.12 and Remark C.22 (standard reference, not scraped)