Cornacchia’s sum-of-two-squares algorithm — Exact Proof Explorer

Construct the square root of −1, run a genuine finite quotient/remainder trace, and prove that its first square-bounded stopping state represents every prime congruent to one modulo four.

30 theorem bodies · 112 proof edges · 1190 tactic lines · 8 layers

Alpha v34 checked-use · first admitted v27 · independently kernel and Lean verified; not Stable

Current library: Alpha v34, 4,223 checked-use theorems; Stable remains 432. Historical first admissions, original proof editions, and non-admitted aliases are preserved. Exact original first-admission records.

30 theorems
01234567
CN0001 · cornacchia_prime_not_square

No natural square equals a prime, constructively and without factorization search.

layer 0 · 23 lines · Alpha v34 independently verified · alpha_closed; checked-use authorized; not Stable
CN0003 · cornacchia_prime_square_comparison

The square-root stopping test has exactly two constructive branches at a prime: strictly below or strictly above.

layer 1 · 24 lines · Alpha v34 independently verified · alpha_closed; checked-use authorized; not Stable
CN0005 · cornacchia_coprime_euclidean_step

Euclidean remainder transport preserves the exact common-divisor coprimality invariant.

layer 0 · 20 lines · Alpha v34 independently verified · alpha_closed; checked-use authorized; not Stable
CN0007 · cornacchia_coefficient_step_nonzero

The absolute coefficient recurrence preserves positivity without signed natural subtraction.

layer 0 · 20 lines · Alpha v34 independently verified · alpha_closed; checked-use authorized; not Stable
CN0008 · cornacchia_coefficient_step_exists

The next absolute coefficient is an actual natural witness of the multiplication-and-addition recurrence.

layer 0 · 5 lines · Alpha v34 independently verified · alpha_closed; checked-use authorized; not Stable
CN0009 · cornacchia_cross_identity_step

The actual remainder and coefficient recurrences preserve p=a*t+r*u exactly.

layer 0 · 15 lines · Alpha v34 independently verified · alpha_closed; checked-use authorized; not Stable
CN000A · cornacchia_coefficient_square_below_prime

The cross identity and the previous remainder's square bound force the current positive coefficient's square below p.

layer 0 · 46 lines · Alpha v34 independently verified · alpha_closed; checked-use authorized; not Stable
CN000B · cornacchia_mod_subtraction_transport

Balanced congruence transports an actual natural difference without introducing integer subtraction.

layer 0 · 39 lines · Alpha v34 independently verified · alpha_closed; checked-use authorized; not Stable
CN000C · cornacchia_signed_step_direct

One Euclidean step turns a positive/negative root-coefficient pair into the next positive coefficient congruence.

layer 1 · 56 lines · Alpha v34 independently verified · alpha_closed; checked-use authorized; not Stable
CN000D · cornacchia_signed_step_opposite

The other alternating sign branch yields the next opposite coefficient congruence with actual natural witnesses.

layer 1 · 51 lines · Alpha v34 independently verified · alpha_closed; checked-use authorized; not Stable
CN000E · cornacchia_alternating_congruences_step

Successive actual Euclidean states toggle the two explicit root-coefficient sign patterns.

layer 2 · 49 lines · Alpha v34 independently verified · alpha_closed; checked-use authorized; not Stable
CN0010 · cornacchia_stopping_state_represents_prime

At the first positive remainder below sqrt(p), the actual Euclidean coefficient completes an exact two-square representation of p.

layer 1 · 48 lines · Alpha v34 independently verified · alpha_closed; checked-use authorized; not Stable
CN0011 · cornacchia_root_nonzero

A genuine root of minus one modulo a prime is nonzero.

layer 0 · 16 lines · Alpha v34 independently verified · alpha_closed; checked-use authorized; not Stable
CN0012 · cornacchia_root_coprime

The bounded nonzero root is coprime to its prime, with the bounded-divisibility contradiction checked explicitly.

layer 0 · 17 lines · Alpha v34 independently verified · alpha_closed; checked-use authorized; not Stable
CN0013 · cornacchia_root_exists

Every prime one modulo four constructively supplies an actual positive bounded root of minus one for the algorithm.

layer 1 · 37 lines · Alpha v34 independently verified · alpha_closed; checked-use authorized; not Stable
CN0015 · cornacchia_initial_invariant

A constructed root initializes all arithmetic, coprimality, sign, and threshold invariants of Cornacchia's actual state.

layer 1 · 32 lines · Alpha v34 independently verified · alpha_closed; checked-use authorized; not Stable
CN0016 · cornacchia_invariant_euclidean_step

Every actual Euclidean/coefficient transition above the stopping threshold preserves the full rooted invariant and keeps the next remainder positive.

layer 3 · 100 lines · Alpha v34 independently verified · alpha_closed; checked-use authorized; not Stable
CN0017 · cornacchia_invariant_stop_correct

A halted state of the rooted Cornacchia invariant is an exact two-square representation, not just a divisible norm.

layer 2 · 32 lines · Alpha v34 independently verified · alpha_closed; checked-use authorized; not Stable
CN0018 · cornacchia_stopped_trace

A below-threshold positive state is a complete zero-transition Cornacchia run with stored terminal quotient zero.

layer 0 · 31 lines · Alpha v34 independently verified · alpha_closed; checked-use authorized; not Stable
CN0019 · cornacchia_stopped_trace_exists

The actual stopped state can always be encoded in the established beta history without an external coding oracle.

layer 1 · 29 lines · Alpha v34 independently verified · alpha_closed; checked-use authorized; not Stable
CN001A · cornacchia_trace_extend

A genuine above-threshold Euclidean division prepends its full remainder/coefficient/quotient state to the same stopped history, preserving every earlier encoded state and transition.

layer 0 · 142 lines · Alpha v34 independently verified · alpha_closed; checked-use authorized; not Stable
CN001B · cornacchia_complete_from_invariant_up_to

Bounded natural induction on the positive current remainder constructs the entire first-stop history with actual quotients and coefficients and proves its final exact two-square norm.

layer 4 · 164 lines · Alpha v34 independently verified · alpha_closed; checked-use authorized; not Stable
CN001C · cornacchia_complete_from_invariant

Every rooted valid Cornacchia state terminates constructively at its first square-root crossing and returns its actual two-square coordinates.

layer 5 · 20 lines · Alpha v34 independently verified · alpha_closed; checked-use authorized; not Stable
CN001D · cornacchia_from_any_bounded_negative_one_root

Every positive bounded root of minus one at a prime produces a genuine complete Cornacchia execution and its returned exact representation; no successful trace is supplied.

layer 6 · 31 lines · Alpha v34 independently verified · alpha_closed; checked-use authorized; not Stable
CN001E · cornacchia_prime_two_squares_complete

Full G107: every prime one modulo four yields an actual root of minus one, a complete first-stop Euclidean/coefficient/quotient history from (p,root,0,1), and exactly the two-square representation returned by that history.

layer 7 · 14 lines · Alpha v34 independently verified · alpha_closed; checked-use authorized; not Stable

Exactly 30 displayed theorems have independently verified Alpha checked-use authority; none is admitted to Stable. Body-only enrollment never grants checked theorem use.