Empirical/CSD: Shor's period finding as a flow on Σ #
Category: 3-Local (CSD-side twin of Empirical/QM/Algorithms/ShorCore.lean).
ShorCore.lean proves the order-finding circuit on the QM side: on the joint register
Fin T × ZMod N, the modular-exponentiation oracle followed by the inverse Fourier transform on
the counting register sends the prepared state uniformCount ⊗ |1⟩ to a state whose counting
register reads each multiple s·(T/r) of the order's phase with probability 1/r, and nothing
else (shor_order_distribution, shor_order_distribution_zero, the ideal case r ∣ T). This
file is the same circuit on the CSD side: the oracle is the permutation matrix of
(c, y) ↦ (c, (a^c)⁻¹ y), the inverse Fourier transform is the Kronecker factor (qftMatrix T)ᴴ ⊗ 1,
their product is a Circuit and hence a flow on the joint register's sector, and the readout
of the counting register is the union of the record basins of the joint outcomes (c, y) over
the work register.
modexpPerm a,modexpMatrix a— the oracle as a permutation and its matrix, withtoEuclideanLin_modexpMatrix(it acts asjointModexp) andpermMatrix_conjTranspose_mul(a permutation matrix is unitary);qftInvJoint— the inverse Fourier transform on the counting register as a matrix on the joint register, withtoEuclideanLin_qftInvJoint(it acts asqftInvCount) andqftInvJoint_conjTranspose_mul;shorCircuit a : Circuit (Fin T × ZMod N)— period finding as a circuit, hence(shorCircuit a).flowis period finding as aΣ-flow;shorReady, the prepared state as a point of the sector (initialState_norm);- ★★
shor_flow_born_count— Shor onΣ: at the point reached from the ready point by the flow, the counting-register readouts·(T/r)— the union over the work register of the record basins of the joint outcomes — has Born weight1/r; and ★shor_flow_born_count_zero, the other counting outcomes have weight0.
⚠️ Honest scope. The QM-side theorems carry the mathematics, in the ideal case r ∣ T; this
file adds the ontic reading and no new analysis. The circuit is one unitary; no gate
decomposition of the modular exponentiation and no Hamiltonian generating it is modelled
(R-015). The classical post-processing (continued fractions, the random base) is
ShorRecovery.lean / ShorCapstone.lean on the QM side and is not restated here.
References: Empirical/QM/Algorithms/ShorCore.lean; Empirical/CSD/Algorithms/CircuitFlow.lean;
specs/BACKLOG.md #34; specs/future-work.md.
Permutation matrices are unitary #
The conjugate transpose of a permutation matrix is its transpose (its entries are 0 and
1).
The transpose of a permutation matrix is the matrix of the inverse permutation.
A permutation matrix is unitary.
The oracle and the inverse Fourier transform as matrices #
The permutation (c, y) ↦ (c, (a^c)⁻¹ · y) whose pullback is the modular-exponentiation
oracle jointModexp.
Equations
- CSD.Empirical.CSDBridge.Algorithms.modexpPerm T a = (Equiv.refl (Fin T)).prodShear fun (c : Fin T) => (a ^ ↑c)⁻¹.mulLeft
Instances For
The oracle as a matrix: the permutation matrix of modexpPerm.
Equations
Instances For
The inverse Fourier transform on the counting register as a matrix on the joint
register: (qftMatrix T)ᴴ ⊗ 1.
Equations
- CSD.Empirical.CSDBridge.Algorithms.qftInvJoint T = Matrix.kroneckerMap (fun (x1 x2 : ℂ) => x1 * x2) (QuantumInfo.qftMatrix T).conjTranspose 1
Instances For
The joint inverse-Fourier matrix acts as qftInvCount.
The joint inverse-Fourier matrix is unitary.
Period finding as a circuit and as a flow #
Period finding as a circuit on the joint register.
Equations
- CSD.Empirical.CSDBridge.Algorithms.shorCircuit T a = { U := CSD.Empirical.CSDBridge.Algorithms.shorMatrix T a, conjTranspose_mul := ⋯ }
Instances For
The prepared state uniformCount ⊗ |1⟩ is a unit vector.
The prepared state, enumerated.
Equations
Instances For
The ready point: the prepared state uniformCount ⊗ |1⟩ as a point of the sector.
Equations
Instances For
The Born weight of the joint outcome (c, y)'s basin at the flowed ready point is the
circuit's output amplitude squared.
★★ Shor on Σ. In the ideal case r ∣ T, at the point reached from the ready point by
the flow, the counting-register outcome s·(T/r) — the union over the work register of the
record basins of the joint outcomes (s·(T/r), y) — has Born weight 1/r.
★ The other counting outcomes have weight zero on Σ.