Shor's algorithm — factoring capstone (ties GOOD ⟹ nontrivial factor of N) #
Category: 3-Local (QM-validity), pure finite number theory.
This file closes the Shor classical-reduction chain by connecting the GOOD success predicate
(Even (orderOf a) ∧ a ^ (orderOf a / 2) ≠ -1, in the units group (ZMod N)ˣ, the object the
random-a probability bound shor_success_prob_ge_general counts) to an actual nontrivial
divisor of N (the object the factoring reduction shor_factor_of_even_order /
nontrivial_factor produces).
Two results:
shor_random_a_yields_factor— pointwise: a GOOD unitayields a proper nontrivial factorgcd(x - 1, N)ofN, wherexliftsa ^ (orderOf a / 2). Bridges the units-group≠ ±1conditions of the GOOD predicate to theZMod-coercion≠ ±1hypotheses ofshor_factor_of_even_order.shor_factor_prob_ge— probability capstone: a uniformly random unitamodN(odd, with≥ 2distinct prime factors) yields a proper nontrivial factor with probability≥ 1/2. The GOOD filter is contained in the factor-yielding filter (shor_random_a_yields_factor), so the≥ 1/2bound on the GOOD frequency (shor_success_prob_ge_general) transports to the factor frequency byFinsetcardinality monotonicity andℚdivision monotonicity.
Both are foundational-triple-only (no busch_effect_gleason, no measure axioms): the content is
elementary finite number theory composed on top of the already-verified S6 reduction and the S7
counting bound.
Pointwise: a GOOD unit yields a nontrivial factor.
For a : (ZMod N)ˣ satisfying the Shor GOOD predicate (Even (orderOf a) and
a ^ (orderOf a / 2) ≠ -1 in the units group) and any integer x lifting
a ^ (orderOf a / 2), the natural number gcd(x - 1, N) is a proper nontrivial divisor of N.
Bridges the units-group ≠ -1 condition (and the derived ≠ 1) to the ZMod-coercion
hypotheses of shor_factor_of_even_order (S6). The ≠ 1 side is derived from
0 < orderOf a / 2 < orderOf a (so orderOf a ∤ orderOf a / 2, hence a ^ (orderOf a / 2) ≠ 1
by orderOf_dvd_iff_pow_eq_one); both ±1 units conditions are pushed to the coercion via
Units.val_inj (Units.val_eq_one for 1, Units.val_neg/Units.val_one for -1).
Probability capstone: a random unit yields a nontrivial factor with probability ≥ 1/2.
For odd N with at least two distinct prime factors, the fraction of units a : (ZMod N)ˣ for
which the canonical integer representative of a ^ (orderOf a / 2) yields a proper nontrivial
divisor gcd(· - 1, N) of N is at least 1/2.
The canonical representative is xrep a := (((a ^ (orderOf a / 2) : (ZMod N)ˣ) : ZMod N).val : ℤ),
which lifts a ^ (orderOf a / 2) (hxrep below, via Int.cast_natCast + ZMod.natCast_val +
ZMod.cast_id). By shor_random_a_yields_factor every GOOD unit lands in the factor-yielding
filter, so the GOOD filter is ⊆ the factor filter; cardinality monotonicity
(Finset.card_le_card) and ℚ division monotonicity (gcongr) then transport the ≥ 1/2 GOOD
frequency bound (shor_success_prob_ge_general) to the factor frequency.