op2130_setup_finite_gadgets
A 96-request prefix, a repeatable 185-request block, and a 41-request ending perform the exact finite greedy discrepancy transformations displayed in the Lean statement.
Statement
theorem op2130_setup_finite_gadgets :
op2130_setup_replay (List.replicate 23 0) op2130_setup_pre = [-3, 3, 5, 3, 2, 1, 0, -1, -2, -3, -4, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] ∧
op2130_setup_replay [3, 2, 1, 0, -1, -2, -3, -4, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] op2130_setup_block = [-4, -4, 3, 5, 3, 2, 1, 0, -1, -2, -3, -4, -1, 0, 0, 0, 0, 0, 0, 0] ∧
op2130_setup_replay [3, 2, 1, 0, -1, -2, -3, -4, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] op2130_setup_finish = [-3, -1, 0, 1, 2, 3, -2, -4, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]- Source
- OP-2130, repeatable preparation of decision-list height profiles
- Verified
- 24 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 4
- op2130_interval_marginal_recursive_counterexampleFor an explicit 33-request six-vertex path schedule, the recursively enumerated fair-coin greedy process in the list-state representation…
- TotalPreorderA total preorder: a preorder where
≤is total (complete). This is weaker thanLinearOrder— it does NOT require antisymmetry or… - LinearOrder.toTotalPreorderEvery
LinearOrderis aTotalPreorder. - cFor a group $G$ and an element $s \in G$, the local count $c_G(s)$ is the cardinality of the set of elements $g \in G$ such that…
- Used by 5
- op2130_setup_replay_shiftA fixed local discrepancy schedule acts identically on a suffix when all its edge indices are shifted by the length of an untouched prefix.
- op2130_setup_replay_matches_carpoolFor every valid list of path-edge indices and coin bits, replaying the list-state greedy updates from zero agrees with the repository…
- op2130_setup_odd_prefixFor every k, the explicit zero-start greedy schedule prepares discrepancy prefix [-3,3,5], followed by k copies of [-4,-4,3,5], followed…
- op2130_setup_replay_appendA local discrepancy schedule whose request endpoints lie inside a list leaves any appended suffix untouched.
- op2130_setup_gadgets_safeIn the fixed prefix, repeatable block, and final block that prepare the decision circuit, every intermediate discrepancy coordinate lies…
The proof, explained
The theorem establishes that simulating a finite greedy discrepancy balancing process across three explicit sequences of requests—a prefix of length 96, a repeatable block of length 185, and a finishing sequence of length 41—transforms the given integer vectors into their exact target states. Because the sequences, state updates, and lists are completely finite and computable, this main result is proved by direct computational evaluation via `decide`. The snippet also establishes two quadratic energy inequalities showing that elementary balancing steps decrease or preserve shifted quadratic energies, proved via `nlinarith`.
For any integers $a, b, j$ with $a \le b$, the leftward shifted quadratic energy satisfies $(a+1+j)^2 + (b-1+(j+1))^2 \le (a+j)^2 + (b+(j+1))^2$. automation
Expanding the squares on both sides and taking their difference gives $((a+j)^2 + (b+j+1)^2) - ((a+j+1)^2 + (b+j)^2) = 2(b - a)$, which is nonnegative since $a \le b$. The `nlinarith` tactic handles the polynomial expansion and nonlinear integer arithmetic automatically.
theorem op2130_suffix_energy_left (a b j : ℤ) (hab : a ≤ b) : (a+1+j)^2 + (b-1+(j+1))^2 ≤ (a+j)^2 + (b+(j+1))^2 := by nlinarith
For any integers $a, b, j$ with $b \le a$, the rightward shifted quadratic energy satisfies $(a-1-j)^2 + (b+1-(j+1))^2 \le (a-j)^2 + (b-(j+1))^2$. automation
Expanding the squares and taking the difference between the right-hand side and the left-hand side yields $2(a - b)$, which is nonnegative by the assumption $b \le a$. The tactic `nlinarith` confirms this inequality.
theorem op2130_suffix_energy_right (a b j : ℤ) (hab : b ≤ a) : (a-1-j)^2 + (b+1-(j+1))^2 ≤ (a-j)^2 + (b-(j+1))^2 := by nlinarith
Replaying the 96-step prefix, the 185-step block, and the 41-step finishing sequence transforms the specified initial configurations into the exact target discrepancy vectors. automation
The statement is a conjunction of three concrete equalities: replaying `op2130_setup_pre` on a list of 23 zeros produces the 23-element target vector, replaying `op2130_setup_block` on the 20-element intermediate state produces the expected shifted block, and replaying `op2130_setup_finish` produces the final target list. Because all list operations and the step transition function `op2130_mc_step` are completely finite and computable, the `decide` tactic evaluates each fold directly and confirms that both sides match.
theorem op2130_setup_finite_gadgets : op2130_setup_replay (List.replicate 23 0) op2130_setup_pre = [-3, 3, 5, 3, 2, 1, 0, -1, -2, -3, -4, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] ∧ op2130_setup_replay [3, 2, 1, 0, -1, -2, -3, -4, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] op2130_setup_block = [-4, -4, 3, 5, 3, 2, 1, 0, -1, -2, -3, -4, -1, 0, 0, 0, 0, 0, 0, 0] ∧ op2130_setup_replay [3, 2, 1, 0, -1, -2, -3, -4, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] op2130_setup_finish = [-3, -1, 0, 1, 2, 3, -2, -4, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] := by decide
- The verification of the finite gadget transitions in `op2130_setup_finite_gadgets` is performed entirely by computational reflection in the Lean kernel using `decide`.
- The two energy lemmas rely on `nlinarith` to expand polynomials and deduce nonnegativity from linear bounds.
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
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
set_option maxRecDepth 10000set_option maxHeartbeats 2000000def op2130_setup_pre : List (ℕ × Bool) := [(0, false), (1, false), (2, false), (1, false), (0, false), (2, false), (1, false), (3, false), (2, false), (3, false), (4, false), (3, false), (2, false), (1, false), (0, false), (1, true), (2, true), (1, true), (2, true), (3, true), (2, true), (1, true), (3, true), (2, true), (3, true), (4, true), (3, true), (2, true), (1, true), (4, true), (3, true), (2, true), (4, true), (3, true), (5, true), (4, true), (5, true), (6, true), (5, true), (4, true), (3, true), (2, true), (6, true), (5, true), (4, true), (3, true), (6, true), (5, true), (4, true), (7, true), (6, true), (5, true), (7, true), (6, true), (7, true), (8, true), (7, true), (6, true), (5, true), (4, true), (3, true), (2, true), (8, true), (7, true), (6, true), (5, true), (4, true), (3, true), (8, true), (7, true), (6, true), (5, true), (4, true), (8, true), (7, true), (6, true), (5, true), (9, true), (8, true), (7, true), (6, true), (9, true), (8, true), (7, true), (9, true), (8, true), (9, true), (10, true), (9, true), (8, true), (7, true), (6, true), (5, true), (4, true), (3, true), (2, true)]def op2130_setup_block : List (ℕ × Bool) := [(0, false), (1, false), (0, false), (1, false), (2, false), (1, false), (0, false), (2, false), (1, false), (2, false), (3, false), (2, false), (1, false), (0, false), (3, false), (2, false), (1, false), (3, false), (2, false), (3, false), (4, false), (3, false), (2, false), (1, false), (0, false), (4, false), (3, false), (2, false), (1, false), (4, false), (3, false), (2, false), (4, false), (3, false), (4, false), (5, false), (4, false), (3, false), (2, false), (1, false), (0, false), (5, false), (4, false), (3, false), (2, false), (1, false), (5, false), (4, false), (3, false), (2, false), (5, false), (4, false), (3, false), (5, false), (4, false), (5, false), (6, false), (5, false), (4, false), (3, false), (2, false), (1, false), (0, false), (6, false), (5, false), (4, false), (3, false), (2, false), (1, false), (6, false), (5, false), (4, false), (3, false), (2, false), (6, false), (5, false), (4, false), (3, false), (6, false), (5, false), (4, false), (6, false), (5, false), (6, false), (7, false), (6, false), (5, false), (4, false), (3, false), (2, false), (1, false), (2, true), (3, true), (2, true), (3, true), (4, true), (3, true), (2, true), (4, true), (3, true), (4, true), (5, true), (4, true), (3, true), (2, true), (5, true), (4, true), (3, true), (5, true), (4, true), (5, true), (6, true), (5, true), (4, true), (3, true), (2, true), (6, true), (5, true), (4, true), (3, true), (6, true), (5, true), (4, true), (6, true), (5, true), (6, true), (7, true), (6, true), (5, true), (4, true), (3, true), (7, true), (6, true), (5, true), (4, true), (7, true), (6, true), (5, true), (8, true), (7, true), (6, true), (8, true), (7, true), (8, true), (9, true), (8, true), (7, true), (6, true), (5, true), (4, true), (3, true), (9, true), (8, true), (7, true), (6, true), (5, true), (4, true), (9, true), (8, true), (7, true), (6, true), (5, true), (9, true), (8, true), (7, true), (6, true), (10, true), (9, true), (8, true), (7, true), (10, true), (9, true), (8, true), (10, true), (9, true), (10, true), (11, true), (10, true), (9, true), (8, true), (7, true), (6, true), (5, true), (4, true), (3, true)]def op2130_setup_finish : List (ℕ × Bool) := [(0, false), (1, false), (0, false), (1, false), (2, false), (1, false), (0, false), (2, false), (1, false), (2, false), (3, false), (2, false), (1, false), (0, false), (3, false), (2, false), (1, false), (3, false), (2, false), (3, false), (4, false), (3, false), (2, false), (1, false), (0, false), (4, false), (3, false), (2, false), (1, false), (4, false), (3, false), (2, false), (4, false), (3, false), (4, false), (5, false), (4, false), (3, false), (2, false), (1, false), (0, false)]def op2130_setup_replay (d : List ℤ) (es : List (ℕ × Bool)) : List ℤ := es.foldl (fun v (j,c) => op2130_mc_step v j c) dtheorem op2130_suffix_energy_left (a b j : ℤ) (hab : a ≤ b) : (a+1+j)^2 + (b-1+(j+1))^2 ≤ (a+j)^2 + (b+(j+1))^2 := by nlinariththeorem op2130_suffix_energy_right (a b j : ℤ) (hab : b ≤ a) : (a-1-j)^2 + (b+1-(j+1))^2 ≤ (a-j)^2 + (b-(j+1))^2 := by nlinariththeorem op2130_setup_finite_gadgets : op2130_setup_replay (List.replicate 23 0) op2130_setup_pre = [-3, 3, 5, 3, 2, 1, 0, -1, -2, -3, -4, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] ∧ op2130_setup_replay [3, 2, 1, 0, -1, -2, -3, -4, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] op2130_setup_block = [-4, -4, 3, 5, 3, 2, 1, 0, -1, -2, -3, -4, -1, 0, 0, 0, 0, 0, 0, 0] ∧ op2130_setup_replay [3, 2, 1, 0, -1, -2, -3, -4, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] op2130_setup_finish = [-3, -1, 0, 1, 2, 3, -2, -4, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] := by decide