Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Native electron–photon support from SpacetimeCycleTrace

Definition
MarkovScatteringJoint_NativeSupport_13

by jleeg · Nov 30, 2026 · Mathlib 0df444a (Lean v4.33.1)

markov-scattering

Source context for the measured electron–photon line, carrying these native mathematical modules and their certified helper results: SpacetimeCycleTrace.

Definition code
import Definitions.Def_MarkovScatteringJoint_NativeSupport_12

section

/-!
# Uniform decimation of the biased cycle

The next distinct observed move exits the interval between the adjacent retained
sites. The first-hit Dirichlet problem has a unique solution with slopes in a
geometric progression. Evaluating it at the middle retained site identifies the
jump chain with the original cycle family at the scaled rapidity.
-/

namespace MarkovScattering.Spacetime

noncomputable section

open scoped BigOperators

def cycleForward (η : ℝ) : ℝ := Real.exp η / cycleEnergy η

def cycleBackward (η : ℝ) : ℝ := Real.exp (-η) / cycleEnergy η

def cycleStepRatio (η : ℝ) : ℝ := Real.exp (-(2 * η))

private theorem cycleForward_pos (η : ℝ) : 0 < cycleForward η :=
  div_pos (Real.exp_pos _) (cycleEnergy_pos η)

theorem cycleForward_add_backward (η : ℝ) :
    cycleForward η + cycleBackward η = 1 := by
  unfold cycleForward cycleBackward
  rw [← add_div, ← cycleEnergy, div_self (cycleEnergy_pos η).ne']

theorem cycleForward_sub_backward (η : ℝ) :
    cycleForward η - cycleBackward η = Real.tanh η := by
  obtain ⟨hp, hm⟩ := cycleKernel_neighbors 3 (by decide) η 0
  have h := cycleDrift_eq_tanh 3 (by decide) η 0
  rwa [cycleDrift, hp, hm] at h

private theorem cycleForward_mul_ratio (η : ℝ) :
    cycleForward η * cycleStepRatio η = cycleBackward η := by
  unfold cycleForward cycleStepRatio cycleBackward
  rw [div_mul_eq_mul_div, ← Real.exp_add, show η + -(2 * η) = -η by ring]

private def cycleHarmonicSum (η : ℝ) (n : ℕ) : ℝ :=
  ∑ i ∈ Finset.range n, cycleStepRatio η ^ i

private theorem cycleHarmonicSum_pos (η : ℝ) {n : ℕ} (hn : 0 < n) :
    0 < cycleHarmonicSum η n := by
  unfold cycleHarmonicSum
  apply Finset.sum_pos _
  · exact ⟨0, Finset.mem_range.mpr hn⟩
  · intro i hi
    exact pow_pos (Real.exp_pos _) _

private theorem cycleHarmonicSum_add (η : ℝ) (a b : ℕ) :
    cycleHarmonicSum η (a + b) =
      cycleHarmonicSum η a + cycleStepRatio η ^ a * cycleHarmonicSum η b := by
  induction b with
  | zero => simp [cycleHarmonicSum]
  | succ b ih =>
    rw [show a + (b + 1) = (a + b) + 1 by omega]
    unfold cycleHarmonicSum at ih ⊢
    rw [Finset.sum_range_succ (n := a + b), Finset.sum_range_succ (n := b), ih, pow_add]
    ring

/-- Probability of first reaching the right boundary in the interval [0,L]. -/
def cycleHitRight (η : ℝ) (L i : ℕ) : ℝ :=
  cycleHarmonicSum η i / cycleHarmonicSum η L

/-- Harmonicity on the interior of the nearest-neighbor interval. -/
def CycleHarmonic (η : ℝ) (L : ℕ) (g : ℕ → ℝ) : Prop :=
  ∀ i, i + 1 < L → g (i + 1) = cycleForward η * g (i + 2) + cycleBackward η * g i

/-- The first-hit Dirichlet problem, with boundary values zero and one. -/
def IsCycleHitRight (η : ℝ) (L : ℕ) (g : ℕ → ℝ) : Prop :=
  g 0 = 0 ∧ g L = 1 ∧ CycleHarmonic η L g

theorem cycleHitRight_isHarmonic (η : ℝ) {L : ℕ} (hL : 0 < L) :
    IsCycleHitRight η L (cycleHitRight η L) := by
  refine ⟨by simp [cycleHitRight, cycleHarmonicSum],
    div_self (cycleHarmonicSum_pos η hL).ne', ?_⟩
  intro i hi
  have hstep (j : ℕ) : cycleHarmonicSum η (j + 1) =
      cycleHarmonicSum η j + cycleStepRatio η ^ j := Finset.sum_range_succ _ _
  unfold cycleHitRight
  rw [← mul_div_assoc, ← mul_div_assoc, ← add_div]
  congr 1
  rw [show i + 2 = (i + 1) + 1 by omega, hstep (i + 1), hstep i, pow_succ]
  have hp := cycleForward_add_backward η
  have hr := cycleForward_mul_ratio η
  rw [mul_add, show cycleForward η * (cycleStepRatio η ^ i * cycleStepRatio η) =
      cycleBackward η * cycleStepRatio η ^ i by rw [← hr]; ring]
  linear_combination -(cycleHarmonicSum η i + cycleStepRatio η ^ i) * hp

private theorem cycleHitRight_slope {η : ℝ} {L : ℕ} {g : ℕ → ℝ}
    (hg : CycleHarmonic η L g) :
    ∀ i < L, g (i + 1) - g i = cycleStepRatio η ^ i * (g 1 - g 0) := by
  intro i
  induction i with
  | zero => intro hi; simp
  | succ i ih =>
    intro hi
    have hrec := hg i hi
    have hweights := cycleForward_add_backward η
    have hprod : cycleForward η * (g (i + 2) - g (i + 1)) =
        cycleBackward η * (g (i + 1) - g i) := by
      linear_combination -hrec - g (i + 1) * hweights
    have hs := ih (by omega)
    apply mul_left_cancel₀ (cycleForward_pos η).ne'
    change cycleForward η * (g (i + 2) - g (i + 1)) = _
    rw [hprod, hs, pow_succ, ← cycleForward_mul_ratio η]
    ring

/-- The interior solution is the first-hit interpolation of the endpoint values. -/
theorem cycleHarmonic_eq {η : ℝ} {L : ℕ} (hL : 0 < L) {g : ℕ → ℝ}
    (hg : CycleHarmonic η L g) {i : ℕ} (hi : i ≤ L) :
    g i = g 0 + (g L - g 0) * cycleHitRight η L i := by
  have hsum : ∀ j ≤ L, g j = g 0 + cycleHarmonicSum η j * (g 1 - g 0) := by
    intro j
    induction j with
    | zero => intro hj; simp [cycleHarmonicSum]
    | succ j ih =>
      intro hj
      have hs := cycleHitRight_slope hg j (by omega)
      have hprev := ih (by omega)
      unfold cycleHarmonicSum at hprev ⊢
      rw [Finset.sum_range_succ]
      linarith only [hs, hprev, add_mul
        (∑ i ∈ Finset.range j, cycleStepRatio η ^ i) (cycleStepRatio η ^ j) (g 1 - g 0)]
  have hnormal := hsum L le_rfl
  have hn := (cycleHarmonicSum_pos η hL).ne'
  have hs : g 1 - g 0 = (g L - g 0) / cycleHarmonicSum η L := by
    rw [eq_div_iff hn, mul_comm]
    linarith only [hnormal]
  nth_rw 1 [hsum i hi]
  rw [hs]
  unfold cycleHitRight
  rw [← mul_div_assoc, ← mul_div_assoc, mul_comm (cycleHarmonicSum η i)]

/-- Any first-hit probability solving these boundary equations equals the formula
on the physical interval, including the drift-free case. -/
theorem cycleHitRight_unique {η : ℝ} {L : ℕ} (hL : 0 < L) {g : ℕ → ℝ}
    (hg : IsCycleHitRight η L g) {i : ℕ} (hi : i ≤ L) :
    g i = cycleHitRight η L i := by
  simpa only [hg.1, hg.2.1, sub_zero, one_mul, zero_add] using cycleHarmonic_eq hL hg.2.2 hi

/-- At the midpoint, first-hit odds are the original edge odds raised to the
number of parent edges between retained sites. -/
theorem cycleHitRight_midpoint (η : ℝ) {k : ℕ} (hk : 0 < k) :
    cycleHitRight η (2 * k) k = cycleForward ((k : ℝ) * η) := by
  have hsum := (cycleHarmonicSum_pos η hk).ne'
  have hplus : 0 < 1 + cycleStepRatio η ^ k := by
    have hr := pow_pos (Real.exp_pos (-(2 * η))) k
    change 0 < cycleStepRatio η ^ k at hr
    linarith only [hr]
  have hp : cycleStepRatio η ^ k =
      Real.exp (-((k : ℝ) * η)) / Real.exp ((k : ℝ) * η) := by
    unfold cycleStepRatio
    rw [← Real.exp_nat_mul, div_eq_mul_inv, ← Real.exp_neg, ← Real.exp_add]
    congr 1
    ring
  unfold cycleHitRight cycleForward
  rw [two_mul, cycleHarmonicSum_add, ← one_add_mul]
  rw [div_mul_cancel_right₀ hsum]
  rw [hp, cycleEnergy]
  have he := (Real.exp_pos ((k : ℝ) * η)).ne'
  have htotal := (cycleEnergy_pos ((k : ℝ) * η)).ne'
  unfold cycleEnergy at htotal
  field_simp [he, htotal]

/-- The parent cycle operator acts by its two nearest-neighbor transitions. -/
theorem cycleKernel_apply (n : ℕ) [NeZero n] (η : ℝ) (x : ZMod n)
    (f : ZMod n → ℝ) :
    ∑ y : ZMod n, cycleKernel n η x y * f y =
      cycleForward η * f (x + 1) + cycleBackward η * f (x - 1) := by
  classical
  simp_rw [cycleKernel, cycleWeight, add_div, add_mul, ite_div, ite_mul, zero_div, zero_mul]
  rw [Finset.sum_add_distrib]
  simp [cycleForward, cycleBackward]

/-- The unwrapped local interval from x-k to x+k, centered at x. -/
def cycleTraceInterval (n k : ℕ) (x : ZMod n) (i : ℕ) : ZMod n :=
  x + (i : ZMod n) - (k : ZMod n)

private theorem cycleTraceInterval_step (n k : ℕ) (x : ZMod n) (i : ℕ) :
    cycleTraceInterval n k x (i + 1) = cycleTraceInterval n k x i + 1 := by
  simp only [cycleTraceInterval, Nat.cast_add, Nat.cast_one]
  abel

/-- The local interval chart has distinct vertices when it fits inside the ring. -/
theorem cycleTraceInterval_injective (n k : ℕ) (hsize : 2 * k < n) (x : ZMod n)
    {i j : ℕ} (hi : i ≤ 2 * k) (hj : j ≤ 2 * k)
    (h : cycleTraceInterval n k x i = cycleTraceInterval n k x j) : i = j := by
  have hz : (i : ZMod n) = (j : ZMod n) := by
    unfold cycleTraceInterval at h
    exact add_left_cancel (sub_left_inj.mp h)
  have hmod := (ZMod.natCast_eq_natCast_iff' i j n).mp hz
  simpa only [Nat.mod_eq_of_lt (hi.trans_lt hsize), Nat.mod_eq_of_lt (hj.trans_lt hsize)] using hmod

/-- For the actual parent cycle kernel, interpolation at the retained center
weights the two adjacent retained endpoints by the effective jump probabilities. -/
theorem cycleTrace_harmonic_midpoint (m : ℕ) (hm : 3 ≤ m)
    {k : ℕ} (hk : 0 < k) (η : ℝ) (x : ZMod (k * m)) (g : ZMod (k * m) → ℝ)
    (hharmonic : letI : NeZero (k * m) := ⟨by positivity⟩
      ∀ i, i + 1 < 2 * k →
      g (cycleTraceInterval (k * m) k x (i + 1)) =
        ∑ y : ZMod (k * m), cycleKernel (k * m) η (cycleTraceInterval (k * m) k x (i + 1)) y *
          g y) :
    g x = g (cycleTraceInterval (k * m) k x 0) +
      (g (cycleTraceInterval (k * m) k x (2 * k)) - g (cycleTraceInterval (k * m) k x 0)) *
        cycleForward ((k : ℝ) * η) := by
  let f : ℕ → ℝ := g ∘ cycleTraceInterval (k * m) k x
  have hf : CycleHarmonic η (2 * k) f := by
    intro i hi
    change g (cycleTraceInterval (k * m) k x (i + 1)) =
      cycleForward η * g (cycleTraceInterval (k * m) k x (i + 2)) +
        cycleBackward η * g (cycleTraceInterval (k * m) k x i)
    have hback : cycleTraceInterval (k * m) k x (i + 1) - 1 =
        cycleTraceInterval (k * m) k x i := by
      rw [cycleTraceInterval_step, add_sub_cancel_right]
    rw [show i + 2 = (i + 1) + 1 by omega,
      cycleTraceInterval_step (k * m) k x (i + 1), ← hback]
    letI : NeZero (k * m) := ⟨by positivity⟩
    simpa only [cycleKernel_apply] using hharmonic i hi
  have hvalue := cycleHarmonic_eq (show 0 < 2 * k by omega) hf (i := k) (by omega)
  have hcenter : f k = g x := by simp [f, cycleTraceInterval]
  rw [hcenter, cycleHitRight_midpoint η hk] at hvalue
  simpa only [f, Function.comp_apply] using hvalue

/-- The loop-free observer kernel based on exits to the neighboring retained sites. -/
def cycleTraceJumpKernel (m k : ℕ) (η : ℝ) (x y : ZMod m) : ℝ :=
  (if y = x + 1 then cycleHitRight η (2 * k) k else 0) +
  (if y = x - 1 then 1 - cycleHitRight η (2 * k) k else 0)

theorem cycleTraceJumpKernel_eq (m : ℕ) {k : ℕ} (hk : 0 < k) (η : ℝ) (x y : ZMod m) :
    cycleTraceJumpKernel m k η x y = cycleKernel m ((k : ℝ) * η) x y := by
  have hb : 1 - cycleForward ((k : ℝ) * η) = cycleBackward ((k : ℝ) * η) := by
    linarith only [cycleForward_add_backward ((k : ℝ) * η)]
  unfold cycleTraceJumpKernel cycleKernel cycleWeight
  rw [cycleHitRight_midpoint η hk, hb]
  unfold cycleForward cycleBackward
  split <;> split <;> ring

/-- The log circulation per directed cycle is the site count times the log edge odds. -/
def cycleLogAffinity (n : ℕ) (η : ℝ) (x : ZMod n) : ℝ :=
  (n : ℝ) * Real.log (cycleKernel n η x (x + 1) / cycleKernel n η x (x - 1))

theorem cycleLogAffinity_eq (n : ℕ) (hn : 3 ≤ n) (η : ℝ) (x : ZMod n) :
    cycleLogAffinity n η x = 2 * (n : ℝ) * η := by
  obtain ⟨hp, hm⟩ := cycleKernel_neighbors n hn η x
  unfold cycleLogAffinity
  rw [hp, hm, div_div_div_cancel_right₀ (cycleEnergy_pos η).ne', div_eq_mul_inv,
    ← Real.exp_neg, neg_neg, ← Real.exp_add, Real.log_exp]
  ring

/-- Under weak bias the rescaled rapidity is exactly half the parent affinity. -/
theorem cycleWeakScaling_affinity (n : ℕ) (hn : 3 ≤ n) (β : ℝ) (x : ZMod n) :
    cycleLogAffinity n (β / (n : ℝ)) x = 2 * β := by
  rw [cycleLogAffinity_eq n hn]
  have hn' : (n : ℝ) ≠ 0 := by
    exact_mod_cast (show n ≠ 0 by omega)
  field_simp [hn']

/-- Uniform decimation preserves the log circulation of the parent cycle. -/
theorem cycleTraceJumpKernel_preserves_affinity (m : ℕ) (hm : 3 ≤ m)
    {k : ℕ} (hk : 0 < k) (η : ℝ) (x : ZMod (k * m)) (y : ZMod m) :
    (m : ℝ) * Real.log
        (cycleTraceJumpKernel m k η y (y + 1) / cycleTraceJumpKernel m k η y (y - 1)) =
      cycleLogAffinity (k * m) η x := by
  rw [cycleTraceJumpKernel_eq m hk, cycleTraceJumpKernel_eq m hk]
  change cycleLogAffinity m ((k : ℝ) * η) y = cycleLogAffinity (k * m) η x
  have hparent : 3 ≤ k * m := by
    exact hm.trans (by simpa using Nat.mul_le_mul_right m (Nat.succ_le_of_lt hk))
  rw [cycleLogAffinity_eq m hm, cycleLogAffinity_eq (k * m) hparent, Nat.cast_mul]
  ring

end

end MarkovScattering.Spacetime

end
Source
https://github.com/gahljust/markov-scattering-proofs/blob/18240441a036a321cbd5009628ec1ff3f990ac4f/original-lean-4.24/MarkovScattering/SpacetimeCycleTrace.lean

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me