Landauer.lean

Lean 4 source, lean/DataMiningAsObservation/Landauer.lean at commit bccca4f. Appendix C, Machine-checked statements, says what each file proves. All Lean files.

/-
Landauer.lean. Equations 0.27 and 13.3, Landauer's principle.

Erasing one bit costs at least Boltzmann's constant times the absolute temperature times
the natural logarithm of two, which at 300 kelvin is 2.87 times ten to the minus twenty-one
joules to three significant figures. The reset bound of chapter 13 charges that price per
bit of the record's conditional entropy given what the consumer keeps, and since the
conditional entropy is at most the unconditional one, the consumer-relative bound is never
above the consumer-free one. The file checks the constant and the two monotonicities. The
entropies themselves are the ledger's measurements.
-/
import Mathlib

namespace DMO.Landauer

/-- Boltzmann's constant in joules per kelvin, the 2019 SI value. -/
def kB : ℝ := 1.380649e-23

/-- **Equation 0.27.** The minimum energy to erase one bit at temperature `T`. -/
noncomputable def eMin (T : ℝ) : ℝ := kB * T * Real.log 2

/-- **The number in the book.** At 300 kelvin the bound is 2.87 times ten to the minus
twenty-one joules to three significant figures. -/
theorem eMin_300 : |eMin 300 - 2.87e-21| < 0.005e-21 := by
  unfold eMin kB
  have h1 := Real.log_two_gt_d9
  have h2 := Real.log_two_lt_d9
  rw [abs_lt]
  constructor <;> nlinarith

/-- **Equation 13.3.** The reset work bound for a record of conditional entropy `H` bits. -/
noncomputable def resetBound (T H : ℝ) : ℝ := eMin T * H

/-- **The consumer-relative bound is never above the consumer-free one**, since conditioning
cannot raise entropy. -/
theorem resetBound_le (T hCond hFull : ℝ) (hT : 0 ≤ T) (h : hCond ≤ hFull) :
    resetBound T hCond ≤ resetBound T hFull := by
  unfold resetBound eMin kB
  have : 0 ≤ (1.380649e-23 : ℝ) * T * Real.log 2 := by
    have := Real.log_pos (by norm_num : (1 : ℝ) < 2)
    positivity
  exact mul_le_mul_of_nonneg_left h this

/-- The bound is linear in the bits, so a record that keeps no information about the erased
part costs nothing to reset. -/
theorem resetBound_zero (T : ℝ) : resetBound T 0 = 0 := by
  simp [resetBound]

end DMO.Landauer