From the integer checker to the Ising Hamiltonian #
The kernel checks of Checker.lean and Chunked.lean work on Nat basis indices s < 2^L
(bit j of s is the spin at site j) and on integer vectors packed into one Nat. This
file identifies them with the matrix IsingLongitudinal.model (1/4) (1/20):
encode σis the index of a configuration (finFunctionFinEquiv); flipping spinjisxor 2^j(encode_flipAt);20 E(σ)isdiagonal L (encode σ)(diagonal_encode), and20 (H x)(σ)isapplyH L v (encode σ)forx = vec v(applyH_encode);- the
foldlsums of the checker are sums over all configurations, so the Gram entry and the residual are the squared normsSpectral.nsqofvec vand ofH x - θ x(dot_self_eq,residualSq_eq).
Folds as sums #
theorem SeedKernel.Ising.foldl_add_eq_sum {β : Type u_1} [AddCommMonoid β] (f : ℕ → β) (b : β) (N : ℕ) :
Encoding configurations as integers #
The index ∑ⱼ σⱼ 2ʲ of a configuration.
Equations
Instances For
Sums over configurations are sums over indices s < 2^L.
The classical energies and the Hamiltonian #
theorem SeedKernel.Ising.applyH_encode {L : ℕ} (v : ℕ) (σ : Fin L → Fin 2) :
↑(applyH L v (encode σ)) = 20 * ((CertifiedGaps.IsingLongitudinal.model (1 / 4) (1 / 20)).hamiltonian L).mulVec (vec v) σ
20 (H x)(σ) = applyH L v (encode σ) at g = 1/4, h = 1/20.
The checker's sums #
The checker's Gram entry dot L v v is the squared norm ‖x‖² of x = vec v.
theorem SeedKernel.Ising.residualSq_eq {L : ℕ} (v : ℕ) (lam : ℤ) :
↑(residualSq L v lam) = (20 * ↑scale) ^ 2 * CertifiedGaps.Spectral.nsq
(((CertifiedGaps.IsingLongitudinal.model (1 / 4) (1 / 20)).hamiltonian L).mulVec (vec v) - ↑(↑lam / (20 * ↑scale)) • vec v)
The residual of vec v against θ = lam / (20 S): ‖H x - θ x‖² = residualSq / (20 S)².