Alphabeta Math
TheoremStatement: Literature-sourcedProof: AI-adaptedPipeline-generatedjudge pass (gpt-6-luna)
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.

Correctness and bit cost of the modular inverse recurrence

Statement

For n≥2 and 0≤c<n, Extended-Euclidean modular inverse with bounded bit cost returns NO_INVERSE exactly when c is not a unit modulo n, and otherwise returns the unique u∈{0,…,n−1} with cu≡1(modn). With B=⌈log⁡2(n+1)⌉, the algorithm uses O(B3) bit operations.

Facts & Assumptions

Given: Integers n≥2, 0≤c<n, Euclidean division, and binary schoolbook arithmetic.

[F1]

Each division has unique quotient and remainder ri−1=airi+ri+1 with 0≤ri+1<ri (Division with remainder in Z: for a∈Z and b>0 there are unique q,r∈Z with a=qb+r and 0≤r<b).

[F3]

A residue class is a unit modulo n exactly when its representative is coprime to n (For n≥1, [a]n is a unit if and only if gcd⁡(a,n)=1).

[F4]

The recurrence, initialization, and return rule are those of Extended-Euclidean modular inverse with bounded bit cost.

Proof

1.1givenF4algebra

First handle c=0: since n≥2, gcd⁡(n,0)=n≠1, so the algorithm returns NO_INVERSE, correctly. Suppose c>0. The initialized coefficients satisfy r−1≡s−1c(modn) and r0=c≡s0c(modn).

1.2F1F4step 1.1inductionalgebra

If ri−1≡si−1c and ri≡sic modulo n, the division identity and update give

ri+1=ri−1−airi≡(si−1−aisi)c≡si+1c(modn).

Replacing a coefficient by its least residue preserves this congruence. Induction proves ri≡sic(modn) for every generated index.

2.1F1F2F3step 1.2algebra

By [F1], each positive remainder is strictly smaller than its predecessor, so the divisions terminate. By [F2], the last nonzero remainder is d=gcd⁡(n,c). The algorithm returns an si exactly when d=1; by [F3], this is exactly the unit case. If it returns, the invariant at the last nonzero index says sic≡d=1(modn), hence the returned least residue is an inverse. If d≠1, [F3] says no inverse exists, so NO_INVERSE is correct.

3.1F1step 2.1algebra

Let B=⌈log⁡2(n+1)⌉. There are O(B) divisions: in two consecutive Euclidean divisions the remainder falls below half its earlier positive value. Indeed, if ri+1≤ri/2 this already holds; otherwise ri+1>ri/2, so the next quotient is 1 and ri+2=ri−ri+1<ri/2. Thus at most two steps halve a positive remainder, which has at most B bits.

4.1step 3.1algebra∎

Every quotient, remainder, and coefficient residue has O(B) bits; each Euclidean quotient is found by binary long division in O(B2) bit operations. Each product aisi and reduction modulo n also costs O(B2) by schoolbook multiplication and division. With O(B) iterations from step 3.1, the total is O(B3).

Depends on

Used by

Dependency tree · two levels

31 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