AFTD Auto-Formalizing Theoretical Domains

op_2130_centered_path_potential_right_step

theoremverified

Moving one unit from vertex i to its right neighbor increases the centered weighted path potential by two.

Statement

theorem op_2130_centered_path_potential_right_step (D : ℕ) (hD : 1 ≤ D) (d : Fin (2 * D) → ℤ) (i : Fin (2 * D - 1)) : (∑ v : Fin (2 * D), (2 * (v.val : ℤ) + 1 - 2 * (D : ℤ)) * carpool_step (2 * D) d (⟨i.val, by omega⟩, ⟨i.val + 1, by omega⟩) false v) = (∑ v : Fin (2 * D), (2 * (v.val : ℤ) + 1 - 2 * (D : ℤ)) * d v) + 2
Source
OP-2130: exact increment of the centered weighted path potential
Verified
22 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 1
  • carpool_stepIn online carpooling on n vertices, given an edge e joining two distinct vertices and an orientation bit b, the discrepancy vector d…
Used by 2
  • op_2130_path_cascade_witnessFor every D ≥ 1 there is an edge sequence on SimpleGraph.pathGraph (2*D) of length at most D^3 and one coin tape whose greedy run reaches…
  • op_2130_terminal_path_cascade_witnessFor every positive D, there is a fixed sequence of at most D³ requests on the 2D-vertex path and a fixed coin tape for which the terminal…

The proof, explained

The centered weighted path potential assigns each vertex $v \in \{0, \dots, 2D - 1\}$ the weight $2v + 1 - 2D$. Moving one unit of load from vertex $i$ to its right neighbor $i + 1$ decreases the load at $i$ by 1 and increases the load at $i + 1$ by 1, leaving all other vertices unaffected. The net change in potential is therefore the difference between the weights of $i + 1$ and $i$, which is $(2(i+1) + 1 - 2D) - (2i + 1 - 2D) = 2$.

  1. The edge endpoints $i$ and $i+1$ are valid vertices in $\mathrm{Fin}(2D)$. automation

    Because $i \in \mathrm{Fin}(2D - 1)$, we have $i < 2D - 1$. Linear integer arithmetic (`omega`) verifies both $i < 2D$ and $i + 1 < 2D$, ensuring that the endpoints $\langle i, \dots \rangle$ and $\langle i + 1, \dots \rangle$ are well-formed elements of $\mathrm{Fin}(2D)$.

    line 1

    theorem op_2130_centered_path_potential_right_step (D : ℕ) (hD : 1 ≤ D) (d : Fin (2 * D) → ℤ) (i : Fin (2 * D - 1)) : (∑ v : Fin (2 * D), (2 * (v.val : ℤ) + 1 - 2 * (D : ℤ)) * carpool_step (2 * D) d (⟨i.val, by omega⟩, ⟨i.val + 1, by omega⟩) false v) = (∑ v : Fin (2 * D), (2 * (v.val : ℤ) + 1 - 2 * (D : ℤ)) * d v) + 2 := by
  2. Moving one unit from vertex $i$ to $i + 1$ increases the centered path potential by 2.

    Unfolding `carpool_step` with orientation `false` shows that the state $d$ decreases by 1 at vertex $i$ and increases by 1 at vertex $i + 1$, remaining unchanged everywhere else. Distributing the vertex weights $2v + 1 - 2D$ and splitting the sum with `Finset.sum_add_distrib`, `mul_add`, and `mul_ite` isolates the change as $-(2i + 1 - 2D) + (2(i + 1) + 1 - 2D)$. Ring arithmetic (`ring`) then simplifies this difference of weights to $+2$.

    line 2

    uses carpool_step, mul_add, mul_ite, Finset.sum_add_distrib

      simp [carpool_step, mul_add, mul_ite, Finset.sum_add_distrib] <;> ring
carpool_step
The operation updating a load vector $d$ along a directed edge $e = (u, v)$ by subtracting 1 at $u$ and adding 1 at $v$ when the orientation boolean is false (and the reverse when true), leaving other vertices unchanged.
mul_add
Left distributivity of multiplication over addition: $a(b + c) = ab + ac$.
mul_ite
Distributivity of multiplication over an if-then-else branch: $a \cdot (\text{if } P \text{ then } b \text{ else } c) = \text{if } P \text{ then } ab \text{ else } ac$.
Finset.sum_add_distrib
Distributivity of finite sums over addition: $\sum_{x \in s} (f(x) + g(x)) = \sum_{x \in s} f(x) + \sum_{x \in s} g(x)$.

Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.

Lean source view module on GitHub

theorem op_2130_centered_path_potential_right_step (D : ℕ) (hD : 1 ≤ D) (d : Fin (2 * D) → ℤ) (i : Fin (2 * D - 1)) : (∑ v : Fin (2 * D), (2 * (v.val : ℤ) + 1 - 2 * (D : ℤ)) * carpool_step (2 * D) d (⟨i.val, by omega⟩, ⟨i.val + 1, by omega⟩) false v) = (∑ v : Fin (2 * D), (2 * (v.val : ℤ) + 1 - 2 * (D : ℤ)) * d v) + 2 := by  simp [carpool_step, mul_add, mul_ite, Finset.sum_add_distrib] <;> ring
See it in the graphDiscuss this resultChallenge it