Documentation

SeedKernel.Ising.Bridge

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):

Folds as sums #

theorem SeedKernel.Ising.foldl_add_eq_sum {β : Type u_1} [AddCommMonoid β] (f : ℕ → β) (b : β) (N : ℕ) :
List.foldl (fun (a : β) (s : ℕ) => a + f s) b (List.range N) = b + ∑ s ∈ Finset.range N, f s

Encoding configurations as integers #

def SeedKernel.Ising.encode {L : ℕ} (σ : Fin L → Fin 2) :

The index ∑ⱼ σⱼ 2ʲ of a configuration.

Equations
Instances For
    theorem SeedKernel.Ising.encode_lt {L : ℕ} (σ : Fin L → Fin 2) :
    encode σ < 2 ^ L
    theorem SeedKernel.Ising.encode_div_mod {L : ℕ} (σ : Fin L → Fin 2) (j : Fin L) :
    encode σ / 2 ^ ↑j % 2 = ↑(σ j)
    theorem SeedKernel.Ising.testBit_encode {L : ℕ} (σ : Fin L → Fin 2) (i : ℕ) :
    (encode σ).testBit i = decide (∃ (h : i < L), σ ⟨i, h⟩ = 1)
    theorem SeedKernel.Ising.encode_flipAt {L : ℕ} (j : Fin L) (σ : Fin L → Fin 2) :
    encode (flipAt j σ) = encode σ ^^^ 1 <<< ↑j

    Flipping spin j is xor 2ʲ on indices.

    theorem SeedKernel.Ising.sum_encode {L : ℕ} {β : Type u_1} [AddCommMonoid β] (F : ℕ → β) :
    ∑ σ : Fin L → Fin 2, F (encode σ) = ∑ s ∈ Finset.range (2 ^ L), F s

    Sums over configurations are sums over indices s < 2^L.

    The classical energies and the Hamiltonian #

    theorem SeedKernel.Ising.z_encode {L : ℕ} (σ : Fin L → Fin 2) (j : Fin L) :
    ↑(z (encode σ) ↑j) = zR (σ j)
    theorem SeedKernel.Ising.diagonal_encode {L : ℕ} (σ : Fin L → Fin 2) :
    ↑(diagonal L (encode σ)) = 20 * diagE (1 / 20) σ
    def SeedKernel.Ising.vec {L : ℕ} (v : ℕ) (σ : Fin L → Fin 2) :

    The integer vector stored in the packed Nat v, as a vector on configurations.

    Equations
    Instances For
      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)².