AFTD Auto-Formalizing Theoretical Domains

op2130_interval_marginal_recursive_counterexample

theoremverified

For an explicit 33-request six-vertex path schedule, the recursively enumerated fair-coin greedy process in the list-state representation has interval {0,1} counts 2904555520, 2780823552, 2904555520 at discrepancies -2, 0, 2 respectively, so its interval marginal is not log-concave.

Statement

theorem op2130_interval_marginal_recursive_counterexample :
    let f : ℤ → List ℤ → ℕ := fun z d =>
      if d.getD 0 0 + d.getD 1 0 = z then 1 else 0
    let cnt := fun z => op2130_mc_back op2130_mc_example_edges (f z) [0,0,0,0,0,0]
    cnt (-2) = 2904555520 ∧ cnt 0 = 2780823552 ∧ cnt 2 = 2904555520
Source
OP-2130, counterexample to interval marginal log-concavity
Verified
24 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 7
  • 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_finite_gadgetsA 96-request prefix, a repeatable 185-request block, and a 41-request ending perform the exact finite greedy discrepancy transformations…
  • 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…
  • op2130_mc_step_agrees_generalFor any list of n discrepancies and any valid path edge j,j+1, the list-state greedy update agrees coordinatewise with the existing…

The proof, explained

test sketch

  1. Evaluation is additive under insertion

    We induct on dist.

    lines 31–41

      induction dist with
      | nil => simp [op2130_mc_insert, op2130_mc_eval]
      | cons p ps ih =>
          rcases p with ⟨a,b⟩
          by_cases h : a = s
          · subst a
            simp [op2130_mc_insert, op2130_mc_eval, Nat.add_mul]
            omega
          · simp [op2130_mc_insert, op2130_mc_eval, h] at *
            omega
    
  2. Evaluation is additive under folding over distributions

    We induct on dist.

    lines 50–57

      induction dist generalizing acc with
      | nil => simp [op2130_mc_eval]
      | cons p ps ih =>
          rcases p with ⟨s,v⟩
          simp only [List.foldl_cons, ih, op2130_mc_eval_insert]
          simp [op2130_mc_eval, Nat.mul_add]
          omega
    
  3. Evaluation commutes with next-step transition

    We specialize fold.

    lines 62–63

      simpa [op2130_mc_next, op2130_mc_eval] using op2130_mc_eval_fold dist [] e f
    
  4. Forward evaluation equals backward evaluation

    Induction on edges.

    lines 75–79

      induction edges generalizing dist with
      | nil => rfl
      | cons e es ih =>
          simp only [List.foldl_cons, ih, op2130_mc_eval_next, op2130_mc_back]
    
  5. Generic backward count equals evaluation

    Rewrite forward-backward.

    lines 86–90

      rw [op2130_mc_forward_backward]
      change 1 * op2130_mc_back edges
        (fun d => if d.getD 0 0 + d.getD 1 0 = z then 1 else 0) [0,0,0,0,0,0] + 0 = _
      simp only [Nat.one_mul, Nat.add_zero]
    
  6. Compressed evaluation gives the exact counts automation

    Decide closes the finite computation.

    lines 98–99

      decide
    
  7. List representation matches the abstract carpool step automation

    Exhaustive case analysis on finite coordinates and linear arithmetic.

    lines 108–115

        let x : Fin 6 := ⟨i.val, by omega⟩
        let y : Fin 6 := ⟨i.val + 1, by omega⟩
        let d0 : Fin 6 → ℤ := fun k => s.getD k.val 0
        (op2130_mc_step s i.val coin).getD v.val 0 =
          carpool_step 6 d0 (x,y)
            (if d0 x < d0 y then true else if d0 y < d0 x then false else coin) v := by
      fin_cases i <;> fin_cases v <;> simp [op2130_mc_step, carpool_step] <;> split_ifs <;> simp_all <;> omega
    
  8. The recursive backward evaluation computes the exact counts

    Combine compressed evaluation with equivalence.

    lines 121–124

      have h := op2130_interval_marginal_compressed_counterexample
      exact ⟨(op2130_mc_count_back (-2)).symm.trans h.1,
        (op2130_mc_count_back 0).symm.trans h.2.1,
        (op2130_mc_count_back 2).symm.trans h.2.2⟩

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

set_option maxRecDepth 100000set_option maxHeartbeats 2000000/- Weighted forward evaluation merges equal configurations after every request.   This keeps the number of states small instead of enumerating 2^57 tapes. -/def op2130_mc_step (d : List ℤ) (e : ℕ) (coin : Bool) : List ℤ :=  let x := d.getD e 0  let y := d.getD (e + 1) 0  let a : ℤ := if x < y then 1 else if y < x then -1 else if coin then 1 else -1  (d.set e (x + a)).set (e + 1) (y - a)def op2130_mc_insert (s : List ℤ) (v : ℕ) : List (List ℤ × ℕ) → List (List ℤ × ℕ)  | [] => [(s,v)]  | (a,b)::xs => if a = s then (a,b+v)::xs else (a,b)::op2130_mc_insert s v xsdef op2130_mc_next (dist : List (List ℤ × ℕ)) (e : ℕ) : List (List ℤ × ℕ) :=  dist.foldl (fun acc (s, v) =>    op2130_mc_insert (op2130_mc_step s e true) v      (op2130_mc_insert (op2130_mc_step s e false) v acc)) []def op2130_mc_example_edges : List ℕ :=  [2,3,1,0,4, 2,3,1,0,4, 2,3,1,0,4, 2,3,1,0,4, 2,3,1,0,4, 2,3,1,0,2,1,0,1]def op2130_mc_eval (dist : List (List ℤ × ℕ)) (f : List ℤ → ℕ) : ℕ :=  (dist.map fun (s, v) => v * f s).sumtheorem op2130_mc_eval_insert (s : List ℤ) (v : ℕ)    (dist : List (List ℤ × ℕ)) (f : List ℤ → ℕ) :    op2130_mc_eval (op2130_mc_insert s v dist) f =      op2130_mc_eval dist f + v * f s := by  induction dist with  | nil => simp [op2130_mc_insert, op2130_mc_eval]  | cons p ps ih =>      rcases p with ⟨a,b⟩      by_cases h : a = s      · subst a        simp [op2130_mc_insert, op2130_mc_eval, Nat.add_mul]        omega      · simp [op2130_mc_insert, op2130_mc_eval, h] at *        omegatheorem op2130_mc_eval_fold (dist acc : List (List ℤ × ℕ))    (e : ℕ) (f : List ℤ → ℕ) :    op2130_mc_eval      (dist.foldl (fun acc (s,v) =>        op2130_mc_insert (op2130_mc_step s e true) v          (op2130_mc_insert (op2130_mc_step s e false) v acc)) acc) f =    op2130_mc_eval acc f +      op2130_mc_eval dist (fun s => f (op2130_mc_step s e false) + f (op2130_mc_step s e true)) := by  induction dist generalizing acc with  | nil => simp [op2130_mc_eval]  | cons p ps ih =>      rcases p with ⟨s,v⟩      simp only [List.foldl_cons, ih, op2130_mc_eval_insert]      simp [op2130_mc_eval, Nat.mul_add]      omegatheorem op2130_mc_eval_next (dist : List (List ℤ × ℕ))    (e : ℕ) (f : List ℤ → ℕ) :    op2130_mc_eval (op2130_mc_next dist e) f =      op2130_mc_eval dist (fun s => f (op2130_mc_step s e false) + f (op2130_mc_step s e true)) := by  simpa [op2130_mc_next, op2130_mc_eval] using op2130_mc_eval_fold dist [] e fdef op2130_mc_back (edges : List ℕ) (f : List ℤ → ℕ) : List ℤ → ℕ :=  match edges with  | [] => f  | e::es => fun s =>      op2130_mc_back es f (op2130_mc_step s e false) +      op2130_mc_back es f (op2130_mc_step s e true)theorem op2130_mc_forward_backward (edges : List ℕ) (dist : List (List ℤ × ℕ))    (f : List ℤ → ℕ) :    op2130_mc_eval (edges.foldl op2130_mc_next dist) f =      op2130_mc_eval dist (op2130_mc_back edges f) := by  induction edges generalizing dist with  | nil => rfl  | cons e es ih =>      simp only [List.foldl_cons, ih, op2130_mc_eval_next, op2130_mc_back]theorem op2130_mc_count_back_generic (edges : List ℕ) (z : ℤ) :    op2130_mc_eval (edges.foldl op2130_mc_next [([0,0,0,0,0,0],1)])      (fun d => if d.getD 0 0 + d.getD 1 0 = z then 1 else 0) =    op2130_mc_back edges (fun d => if d.getD 0 0 + d.getD 1 0 = z then 1 else 0)      [0,0,0,0,0,0] := by  rw [op2130_mc_forward_backward]  change 1 * op2130_mc_back edges    (fun d => if d.getD 0 0 + d.getD 1 0 = z then 1 else 0) [0,0,0,0,0,0] + 0 = _  simp only [Nat.one_mul, Nat.add_zero]def op2130_mc_count (z : ℤ) : ℕ :=  op2130_mc_eval (op2130_mc_example_edges.foldl op2130_mc_next [([0,0,0,0,0,0],1)])    (fun d => if d.getD 0 0 + d.getD 1 0 = z then 1 else 0)theorem op2130_interval_marginal_compressed_counterexample :    op2130_mc_count (-2) = 2904555520 ∧ op2130_mc_count 0 = 2780823552 ∧      op2130_mc_count 2 = 2904555520 := by  decidetheorem op2130_mc_count_back (z : ℤ) :    op2130_mc_count z = op2130_mc_back op2130_mc_example_edges      (fun d => if d.getD 0 0 + d.getD 1 0 = z then 1 else 0) [0,0,0,0,0,0] :=  op2130_mc_count_back_generic op2130_mc_example_edges ztheorem op2130_mc_step_agrees (a b c d e f : ℤ) (i : Fin 5) (coin : Bool) (v : Fin 6) :    let s : List ℤ := [a,b,c,d,e,f]    let x : Fin 6 := ⟨i.val, by omega⟩    let y : Fin 6 := ⟨i.val + 1, by omega⟩    let d0 : Fin 6 → ℤ := fun k => s.getD k.val 0    (op2130_mc_step s i.val coin).getD v.val 0 =      carpool_step 6 d0 (x,y)        (if d0 x < d0 y then true else if d0 y < d0 x then false else coin) v := by  fin_cases i <;> fin_cases v <;> simp [op2130_mc_step, carpool_step] <;> split_ifs <;> simp_all <;> omegatheorem op2130_interval_marginal_recursive_counterexample :    let f : ℤ → List ℤ → ℕ := fun z d =>      if d.getD 0 0 + d.getD 1 0 = z then 1 else 0    let cnt := fun z => op2130_mc_back op2130_mc_example_edges (f z) [0,0,0,0,0,0]    cnt (-2) = 2904555520 ∧ cnt 0 = 2780823552 ∧ cnt 2 = 2904555520 := by  have h := op2130_interval_marginal_compressed_counterexample  exact ⟨(op2130_mc_count_back (-2)).symm.trans h.1,    (op2130_mc_count_back 0).symm.trans h.2.1,    (op2130_mc_count_back 2).symm.trans h.2.2⟩
See it in the graphDiscuss this resultChallenge it