1 00:00:01,000 --> 00:00:09,300 [Hal Turing] Alrighty! Thanks for tuning in! Hello AI world! I am your host, Hal Turing, and my co-host is Dr. Ada Shannon. 2 00:00:09,300 --> 00:00:53,299 [Hal Turing] Today's paper is Formalized Hopfield Networks and Boltzmann Machines, by Matteo Cipollina at Axiomatic AI in Barcelona, with Michail Karatarakis and Freek Wiedijk at Radboud University in Nijmegen. It's arXiv 2512.07766, and the version we have is a September 2026 revision. It's about sixteen thousand new lines of Lean 4 on top of mathlib. The authors claim it's the first formalization of either model in any proof assistant. The question is whether the convergence of Hopfield networks, the correctness of Hebbian learning, and the ergodicity of Boltzmann machines can be machine-checked, and what that exposes. 3 00:00:53,299 --> 00:01:05,899 [Dr. Ada Shannon] The short version: it can be done, and the proof effort shows that a textbook theorem was missing a hypothesis. Also, "ergodicity" here covers less than the word suggests. We'll get to that. 4 00:01:05,899 --> 00:01:10,899 [Hal Turing] Why prove any of this? Neural net verification already exists. 5 00:01:10,899 --> 00:01:44,199 [Dr. Ada Shannon] Mostly for feedforward networks. The usual question is whether the output stays stable for inputs in a bounded region. Recurrent and stochastic models need global statements instead: does the dynamics terminate, is there a unique stationary distribution. The authors also point to hardware. Minimizing a Hopfield energy is a QUBO problem, which is the input format for annealers and Ising machines. That's their motivation, not something they demonstrate. The prize context matters less than the math: Hopfield and Hinton got the 2024 Nobel in Physics for models borrowed from statistical mechanics. 6 00:01:44,199 --> 00:01:48,574 [Hal Turing] Start with Hopfield. What is the 1982 network? 7 00:01:48,574 --> 00:02:10,774 [Dr. Ada Shannon] The paper is Hopfield's "Neural networks and physical systems with emergent collective computational abilities," in PNAS. Take n neurons, each plus or minus one, with symmetric weights and no self-connections. There are no hidden units. Each state has a scalar energy. Update one neuron at a time to match the sign of its weighted input, and the energy never goes up. The state space is finite, so the network has to settle into a stable pattern. 8 00:02:10,774 --> 00:02:13,299 [Hal Turing] Give me a tiny example. 9 00:02:13,299 --> 00:02:34,974 [Dr. Ada Shannon] Store one pattern: plus, plus, minus, plus. The weights are the outer product of the pattern with itself, with the diagonal zeroed. Now flip the first bit of the state. Neuron one looks at the other three. Each of them agrees with the pattern, so their weighted input is plus three and points the original way. Neuron one flips back, the energy drops, and the stored pattern is restored. That's associative memory: you recover the whole pattern from a corrupted cue. 10 00:02:34,974 --> 00:02:38,974 [Hal Turing] That outer-product recipe is the Hebbian rule? 11 00:02:38,974 --> 00:03:00,099 [Dr. Ada Shannon] Yes. With m patterns, the weight matrix is the sum of each pattern's outer product, minus m times the identity to clear the diagonal. If the patterns are orthogonal, then applying the matrix to stored pattern j gives n minus m times that pattern. It's scaled down but keeps its sign, so it's stable, and that's why you need m less than n. If the patterns aren't orthogonal, the other patterns add a cross-talk term, usually called the disturbance term. 12 00:03:00,099 --> 00:03:03,500 [Hal Turing] So now add noise. Boltzmann machines? 13 00:03:03,500 --> 00:03:27,050 [Dr. Ada Shannon] Ackley, Hinton and Sejnowski, "A Learning Algorithm for Boltzmann Machines," Cognitive Science, 1985. It has the same kind of energy, but the units are zero or one and the updates are random. A state's probability is proportional to e to the minus energy over temperature. Each unit turns on with a logistic probability set by the energy gap its flip would cause. Take the temperature to zero and you get the Hopfield rule back. The paper proves that as Lemma 4.4. 14 00:03:27,050 --> 00:03:30,775 [Hal Turing] And the sampling procedure is Gibbs sampling. 15 00:03:30,775 --> 00:04:05,875 [Dr. Ada Shannon] Right. Pick one unit at random and resample it from its exact conditional given all the others. Averaging over the choice of unit gives what the paper calls the random-scan kernel. That kernel is a Markov chain on the states. Three terms matter next. Detailed balance is a local flow condition: probability flowing from state x to y equals the flow back. It implies the Boltzmann distribution is stationary. Ergodicity means the chain is irreducible, so every state can reach every other, and aperiodic. Together those give one stationary distribution that the chain converges to from any starting point. 16 00:04:05,875 --> 00:04:13,525 [Hal Turing] Here's what I'd want to pin down. Boltzmann machines are famous for hidden units. Does the formalization cover them? 17 00:04:13,525 --> 00:04:34,774 [Dr. Ada Shannon] No. Their Boltzmann machine is fully visible, so there are no hidden units. A hidden unit is a latent feature the network equilibrates over, while visible units are clamped to data. With clamping, the chain runs only over hidden configurations and targets a conditional distribution, not the free-running one. The paper formalizes only the case with none of that. So the question to hold onto is what "ergodicity is formalized" actually covers. 18 00:04:34,774 --> 00:04:41,849 [Hal Turing] One more piece. Asynchronous updates, where one neuron changes at a time. Is that a detail? 19 00:04:41,849 --> 00:05:01,524 [Dr. Ada Shannon] It's the most concrete finding. Formalizing convergence required that every neuron be updated infinitely often, which they call fairness. Without it, a schedule could starve a neuron that needs to change. Cyclic update orders satisfy it. The authors say the textbook theorem they follow leaves that hypothesis implicit. 20 00:05:01,524 --> 00:05:07,699 [Hal Turing] Where does this sit relative to the modern work? There's the transformer link in the intro. 21 00:05:07,699 --> 00:05:35,875 [Dr. Ada Shannon] Ramsauer and colleagues, out of Sepp Hochreiter's group in 2020, in "Hopfield Networks is All You Need," showed that the update rule of continuous Hopfield networks matches softmax attention. Krotov and Hopfield's 2016 "Dense Associative Memory for Pattern Recognition" raised capacity well beyond the classical limit of roughly 0.14 n patterns. Both are context. This paper formalizes only the binary classical case, and none of the continuous or dense results. 22 00:05:35,875 --> 00:05:41,850 [Hal Turing] So the claim is narrower than the headline, and the interesting part is how they got there. 23 00:05:41,850 --> 00:05:47,025 [Dr. Ada Shannon] That's right. Next is how the pieces are built and what each theorem actually says. 24 00:05:47,025 --> 00:05:55,325 [Hal Turing] Start with the framework. Why does a paper about Hopfield networks begin with a general definition of neural networks? 25 00:05:55,325 --> 00:06:23,875 [Dr. Ada Shannon] Because the authors wanted feedforward and recurrent networks in one definition. A network is a directed graph whose nodes are split into input, output and hidden neurons. Architecture and parameters are separate objects, so the graph says who connects to whom, and a different structure holds the weights, thresholds and activation functions. They built the graph on mathlib's Quiver, a directed multigraph. A typeclass for two-state neurons lets the same machinery handle either {0,1} or ±1 units. 26 00:06:23,875 --> 00:06:28,325 [Hal Turing] Did they check that the framework behaves like a real network? 27 00:06:28,325 --> 00:06:47,725 [Dr. Ada Shannon] Yes. They took a three-neuron recurrent example from the Kruse textbook. Under one update order it settles to the all-zero state. Under another it oscillates forever. So in a general recurrent network the answer depends on the update schedule. The Hopfield theorem says that can't happen once you add symmetry and asynchronous updates. 28 00:06:47,725 --> 00:06:50,550 [Hal Turing] Then walk me through that theorem. 29 00:06:50,550 --> 00:07:12,449 [Dr. Ada Shannon] Update one neuron, and every term in the energy that doesn't involve it cancels. What's left is the old activation minus the new one, times the neuron's net input minus its threshold. There are two cases. If the net input is below the threshold and the neuron flips, it goes from plus one to minus one, and the energy strictly drops. If the net input is at or above the threshold and it flips, it goes from minus one to plus one, and the energy drops or stays equal. 30 00:07:12,449 --> 00:07:18,649 [Hal Turing] Equal energy is the awkward case. Couldn't the network cycle through equal-energy states? 31 00:07:18,649 --> 00:07:37,524 [Dr. Ada Shannon] That's what the proof rules out. In the equal-energy case the flip is always minus one to plus one, so the count of plus-one units strictly rises. A state can't repeat if energy strictly falls, and it can't repeat if the plus-one count strictly rises. The state space is finite, so you eventually reach a stable state. 32 00:07:37,524 --> 00:07:40,149 [Hal Turing] And fairness comes in where? 33 00:07:40,149 --> 00:08:05,774 [Dr. Ada Shannon] It comes in at the claim that you get there from any schedule. If the schedule never touches some neuron, energy stops falling while that neuron still wants to flip. The network is stuck and not stable. So the formal statement requires every neuron to be updated infinitely often. Cyclic orders satisfy that automatically, and for those the paper proves a bound of n times 2 to the n updates. That bound is loose and exponential in the worst case. It says convergence is guaranteed, not that it's quick. 34 00:08:05,774 --> 00:08:09,649 [Hal Turing] Now Hebbian correctness. What do they actually prove? 35 00:08:09,649 --> 00:08:40,375 [Dr. Ada Shannon] Zero thresholds, and W equals the sum of the outer products minus m times the identity. Apply W to a stored pattern. If the patterns are orthogonal, you get n minus m times that pattern, which is a positive multiple, so the pattern is stable. If they aren't orthogonal, an extra disturbance term appears. The paper writes that term out. It doesn't state a theorem bounding it. The executable check is a four-neuron network with two orthogonal patterns. So what's demonstrated is the orthogonal case, and stability under non-orthogonal patterns isn't a theorem in the text. 36 00:08:40,375 --> 00:08:44,500 [Hal Turing] Moving to the stochastic side. How do they set it up? 37 00:08:44,500 --> 00:09:05,674 [Dr. Ada Shannon] The Gibbs update is a single-site kernel: pick a neuron, resample it from its exact conditional given the others. Detailed balance holds by construction, which is Theorem 4.2. Reversibility implies the Boltzmann distribution is invariant. The random-scan kernel picks a neuron uniformly and applies its kernel, so it's an average of reversible kernels and inherits that. 38 00:09:05,674 --> 00:09:09,799 [Hal Turing] But invariant isn't unique, as you said earlier. 39 00:09:09,799 --> 00:09:39,099 [Dr. Ada Shannon] Right, and Theorem 4.3 closes that gap. Four parts. The kernel is reversible with respect to the Boltzmann distribution. Every state has strictly positive self-transition probability, so the chain is aperiodic. The transition matrix is irreducible. And there's exactly one probability vector fixed by the matrix, which must be the Boltzmann distribution. The scope is exact: fully visible, no hidden units, {0,1} units, random-scan Gibbs, finite space, positive temperature. 40 00:09:39,099 --> 00:09:42,624 [Hal Turing] Why is that chain easy to see as ergodic? 41 00:09:42,624 --> 00:10:11,349 [Dr. Ada Shannon] The conditionals are strictly positive. Any single bit can flip, so you can walk from any state to any other. Any unit can also keep its value, which gives the self-loop. The paper's work is turning that picture into a formal proof, and that's where Perron–Frobenius enters. For an irreducible non-negative matrix, there's a positive real top eigenvalue with a unique strictly positive eigenvector. For a stochastic matrix that eigenvalue is one, and the eigenvector, normalized, is the unique stationary distribution. 42 00:10:11,349 --> 00:10:14,949 [Hal Turing] How do they prove Perron–Frobenius in Lean? 43 00:10:14,949 --> 00:10:51,599 [Dr. Ada Shannon] They use the Collatz–Wielandt function. Take a non-negative vector, look at the ratio of each entry of Tx to the matching entry of x, and take the smallest ratio. The Perron root is the largest value that minimum can reach. The function is discontinuous where entries vanish, so they prove upper semicontinuity on the simplex. An extreme-value theorem then gives a maximizer, and they show that maximizer is the Perron eigenvector. Irreducibility is defined by positive matrix powers, so they bridge it to graph paths. A positive entry in the k-th power means a path of length k exists. That's the lemma pow_apply_pos_iff_nonempty_path. 44 00:10:51,599 --> 00:10:55,649 [Hal Turing] Is there a prior formalization to compare against? 45 00:10:55,649 --> 00:11:17,974 [Dr. Ada Shannon] Thiemann and coauthors did one in Isabelle/HOL. It's topological, using Brouwer's fixed-point theorem. The authors claim theirs is the first analytic one. The cost is real. Perron–Frobenius is about 5,400 of the roughly 16,000 lines. Around 7,100 lines are reusable probability and Perron–Frobenius infrastructure, and about 9,000 are the neural-network development. 46 00:11:17,974 --> 00:11:19,800 [Hal Turing] What about learning? 47 00:11:19,800 --> 00:11:52,750 [Dr. Ada Shannon] The setting is narrower than the usual formulation. They take a single presented pattern and its negative log-likelihood. Theorem 4.5 shows the gradient is beta times the data correlation minus the equilibrium correlation. They prove that loss is convex, and that a step along the learning direction strictly decreases it when data and model statistics differ. Ergodicity matters because it makes the equilibrium average well defined. Contrastive divergence with k sweeps converges to the exact direction as k goes to infinity. That's a limit statement, with no rate for finite k. 48 00:11:52,750 --> 00:11:55,150 [Hal Turing] So what's not formalized? 49 00:11:55,150 --> 00:12:14,500 [Dr. Ada Shannon] The KL objective over a data distribution, and a real positive phase. Here it's a point mass at one pattern. The Physlib link maps the energy to a Hamiltonian and the network to a canonical ensemble. Optlib is only a recorded interface, not imported, so no multi-step learning convergence is proved. 50 00:12:14,500 --> 00:12:21,250 [Hal Turing] Let's pin down the headline. Ergodicity is formalized. For which Boltzmann machines is that true? 51 00:12:21,250 --> 00:12:47,750 [Dr. Ada Shannon] For fully visible ones: no hidden units, zero-one units, random-scan Gibbs on a finite space, positive temperature. There the paper proves reversibility, aperiodicity, irreducibility, and a unique stationary distribution, which must be the Boltzmann distribution. It does not cover hidden units, restricted Boltzmann machines, deep Boltzmann machines, or sequential-scan and block-Gibbs kernels. The authors list those as future work. So it doesn't yet verify the Boltzmann machines people actually train. 52 00:12:47,750 --> 00:12:54,650 [Hal Turing] Would the argument transfer if you clamp the visible units and let only the hidden ones equilibrate? 53 00:12:54,650 --> 00:13:32,750 [Dr. Ada Shannon] Plausibly, and that's our analysis, not the paper's. The hidden-only chain still has strictly positive conditionals, single flips still connect every hidden configuration, and every unit can keep its value. So the same irreducibility and self-loop argument should apply on the hidden configuration space. But the target changes to the conditional of the hidden units given the data, not the free-running distribution. Learning needs two chains, one clamped to data and one free. Also, the Lean proof assumes no hidden units, so lifting it is new work. No formal statement exists. And an RBM's block Gibbs alternates whole layers, which is a different kernel needing its own reversibility and aperiodicity proofs. 54 00:13:32,750 --> 00:13:38,925 [Hal Turing] Then the Perron–Frobenius question. Was five thousand four hundred lines the right price? 55 00:13:38,925 --> 00:14:08,850 [Dr. Ada Shannon] For this theorem alone, no. A finite irreducible chain with a detailed-balance distribution has that distribution as its unique stationary one. A positivity or Dobrushin coupling argument gets uniqueness too, and Dobrushin would add an explicit geometric rate. The paper doesn't compare against that route, and I won't claim it does. The defense is that the authors frame it as reusable infrastructure for general nonnegative matrices and future chains. As a library investment that's defensible. As a justification for this one result, it's heavy. 56 00:14:08,850 --> 00:14:11,400 [Hal Turing] And the missing rate matters? 57 00:14:11,400 --> 00:14:34,900 [Dr. Ada Shannon] It's the practical gap. Uniqueness says the chain converges eventually. It says nothing about how many sweeps you need. Levin, Peres and Wilmer's Markov Chains and Mixing Times, 2009, is the standard source for the quantitative layer: spectral gap, coupling. At low temperature the chain becomes nearly reducible and mixing can be very slow, and the paper's zero-temperature lemma is only pointwise convergence of the kernel. So the word ergodicity oversells what the theorem gives in practice. 58 00:14:34,900 --> 00:14:40,200 [Hal Turing] Fairness is the finding I keep returning to. Is it a real correction? 59 00:14:40,200 --> 00:15:01,226 [Dr. Ada Shannon] Modest but real. The paper's gap claim is about textbook statements, following Kruse. It doesn't compare the wording of Hopfield's 1982 paper, which assumes random asynchronous updates at some mean rate per neuron. That is close to fairness in spirit, but the paper doesn't say so. What it adds is a precise, easy-to-check hypothesis: every neuron updated infinitely often. 60 00:15:01,226 --> 00:15:03,526 [Hal Turing] What about the memory side? 61 00:15:03,526 --> 00:15:37,376 [Dr. Ada Shannon] The Hebbian analysis is the classical binary case with fewer patterns than neurons. Krotov and Hopfield's Dense Associative Memory for Pattern Recognition, 2016, uses higher-order energies to raise capacity well past roughly 0.14 n, which is where the disturbance-term analysis matters least. And Ramsauer and colleagues' Hopfield Networks is All You Need, 2020, ties continuous Hopfield updates to softmax attention. Formalizing that would need the continuous energy, its convergence and its capacity, none of which is here. So the attention link is motivation, not content. 62 00:15:37,376 --> 00:15:40,226 [Hal Turing] Other boundaries worth naming? 63 00:15:40,226 --> 00:16:00,652 [Dr. Ada Shannon] Four. Definitions are noncomputable over mathlib reals, so there's no executable verified sampler. The cyclic bound of n times two to the n is a loose worst case. Boltzmann learning is proved for a single pattern, and the Optlib piece is only an interface. And the text doesn't state a theorem for non-orthogonal Hebbian stability. 64 00:16:00,652 --> 00:16:07,427 [Hal Turing] The paper pitches hardware verification: annealers, Ising machines. Is that supported? 65 00:16:07,427 --> 00:16:36,577 [Dr. Ada Shannon] It's a motivation, not a demonstration. Hardware like probabilistic bits, the p-bit work of Camsari and colleagues, uses finite-precision noise and quantized weights. Rounding can push a probability to zero, and strict positivity is exactly the hypothesis the ergodicity proof depends on. A real specification would need a refinement proof from the real-valued kernel to that arithmetic. Nobody has done it here. Annealing is also time-inhomogeneous, so the stationary-distribution theory doesn't directly apply. 66 00:16:36,577 --> 00:16:38,652 [Hal Turing] Who should care today? 67 00:16:38,652 --> 00:17:10,852 [Dr. Ada Shannon] Formal-methods people get a finite-state Perron–Frobenius library and a template for stating recurrent and stochastic models. Practitioners shouldn't change anything. If you train RBMs, nothing here tells you about mixing or contrastive divergence bias at small k. The convergence result as k goes to infinity is close to a corollary of ergodicity. The authors' own next steps are hidden units, RBMs, the KL objective, Metropolis–Hastings, simulated annealing, and the fundamental theorem of Markov chains. 68 00:17:10,852 --> 00:17:18,678 [Hal Turing] One more boundary, the one that applies to any formalization. The proof only certifies the model as stated. 69 00:17:18,678 --> 00:17:39,578 [Dr. Ada Shannon] Yes. Zero-one versus plus-minus-one states, the tie-breaking rule, the temperature convention, the single-pattern positive phase: someone has to check that the Lean statement says what practitioners believe. The fairness discovery shows that formalization changes statements, but the paper gives no systematic list of other definitions it restricted along the way. 70 00:17:39,578 --> 00:18:06,103 [Hal Turing] So, takeaways. Hopfield convergence is now machine-checked, with the fairness hypothesis made explicit. Fully visible Boltzmann machines have a proven unique stationary distribution under random-scan Gibbs. And there's a new analytic Perron–Frobenius library in Lean. The boundary is that hidden units, mixing rates and hardware arithmetic remain unproved, so the Boltzmann machines people actually train aren't verified yet. 71 00:18:06,103 --> 00:18:07,953 [Dr. Ada Shannon] That's the right summary. 72 00:18:07,953 --> 00:18:11,903 [Hal Turing] Thanks for listening, everyone. Until next time.