AFTD Auto-Formalizing Theoretical Domains

op_2130_unbounded_pathwise_influence_example

theoremverified

A fixed nine-request prefix and ten-request path block have the following property: for any numbers of blocks before and after, changing only the first tie coin of one block changes the final discrepancy of vertex 2 from 0 to 2. Hence one tape can have arbitrarily many individually influential coins at a single vertex.

Statement

theorem op_2130_unbounded_pathwise_influence_example (k j : ℕ) :
    let update := fun (d : Fin 4 → ℤ) (p : Fin 3 × Bool) =>
      let a : Fin 4 := ⟨p.1.val, by omega⟩
      let b : Fin 4 := ⟨p.1.val + 1, by omega⟩
      let sign := if d a < d b then true else if d b < d a then false else p.2
      carpool_step 4 d (a,b) sign
    let run := fun (d : Fin 4 → ℤ) (w : List (Fin 3 × Bool)) => w.foldl update d
    let start : List (Fin 3 × Bool) :=
      [(0,false),(1,false),(2,false),(1,true),(0,false),(2,true),(1,false),(1,false),(0,false)]
    let block : List (Fin 3 × Bool) :=
      [(2,false),(0,false),(1,false),(0,false),(1,true),(0,false),(2,true),(1,false),(1,false),(0,false)]
    let flipped : List (Fin 3 × Bool) :=
      [(2,true),(0,false),(1,false),(0,false),(1,true),(0,false),(2,true),(1,false),(1,false),(0,false)]
    run (fun _ => 0) (start ++ (List.replicate k block).flatten ++ flipped ++ (List.replicate j block).flatten) 2 = 2 ∧
    run (fun _ => 0) (start ++ (List.replicate (k + 1 + j) block).flatten) 2 = 0
Source
OP-2130, exact recurrent influence cycle on a four-vertex path, experiments 37049 and 37051
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…

The proof, explained

The proof constructs two discrepancy vectors x and y on a 4-vertex path graph such that a 10-request block leaves both x and y invariant, but a single coin flip in the first request of the block causes a transition from x to y. By induction on the number of repetitions, any number of blocks before the flipped coin preserves x, and any number of blocks after preserves y. Consequently, starting from zero, running the prefix, k blocks, the flipped block, and j blocks results in state y (where vertex 2 has discrepancy 2), whereas running k + 1 + j unflipped blocks results in state x (where vertex 2 has discrepancy 0), demonstrating that an individual coin arbitrarily far into the request stream has persistent influence.

  1. The edge endpoint indices p.1 and p.1 + 1 are valid vertices in Fin 4. automation

    In the definition of the update step, a request on edge index p.1 ∈ Fin 3 connects vertices p.1 and p.1 + 1. Since p.1 < 3, linear arithmetic (omega) verifies that both p.1 < 4 and p.1 + 1 < 4.

    lines 1–5

    private def op2130i_update (d : Fin 4 → ℤ) (p : Fin 3 × Bool) : Fin 4 → ℤ :=
      let a : Fin 4 := ⟨p.1.val, by omega⟩
      let b : Fin 4 := ⟨p.1.val + 1, by omega⟩
      let sign := if d a < d b then true else if d b < d a then false else p.2
      carpool_step 4 d (a,b) sign
  2. The start sequence, the block, and the flipped block effect the expected base transitions between states x and y. automation

    By exhaustive evaluation of the 4-vertex carpool dynamics (decide), the 9-request prefix maps the all-zero discrepancy vector to x = ![-1, 1, 0, 0], the 10-request block fixes both x and y = ![-1, 1, 2, -2], and the flipped block (which differs only in its first coin) transitions x to y.

    lines 19–22

    private lemma op2130i_base : op2130i_run (fun _ => 0) op2130i_start = op2130i_x := by decide
    private lemma op2130i_stable_x : op2130i_run op2130i_x op2130i_block = op2130i_x := by decide
    private lemma op2130i_stable_y : op2130i_run op2130i_y op2130i_block = op2130i_y := by decide
    private lemma op2130i_switch : op2130i_run op2130i_x op2130i_flipped = op2130i_y := by decide
  3. Any fixed point of the block remains invariant under arbitrarily many block repetitions.

    Given a discrepancy vector d satisfying run d block = d, induction on k establishes that running k concatenated copies of block leaves d invariant. The base case k = 0 is empty (rfl). The inductive step decomposes k + 1 copies into one block followed by k copies using List.replicate_succ, List.flatten_cons, and List.foldl_append; applying the fixed-point hypothesis simplifies the first block to d, and the induction hypothesis completes the step.

    lines 23–32

    uses List.replicate_succ, List.flatten_cons, List.foldl_append

    private lemma op2130i_fixed_repeat (d : Fin 4 → ℤ) (h : op2130i_run d op2130i_block = d) :
        ∀ k, op2130i_run d (List.flatten (List.replicate k op2130i_block)) = d := by
      intro k
      induction k with
      | zero => rfl
      | succ k ih =>
        simp only [List.replicate_succ, List.flatten_cons, op2130i_run, List.foldl_append] at *
        rw [h]
        exact ih
    
  4. The main cycle property splits into evaluating the flipped trajectory and the unflipped trajectory.

    We specialize the repetition invariance lemma (op2130i_fixed_repeat) to states x and y using op2130i_stable_x and op2130i_stable_y, obtaining invariance under k and j block repetitions. Combining these with the base evaluation (op2130i_base) and the switch evaluation (op2130i_switch), constructor splits the goal into two branches.

    lines 33–44

    uses op2130i_fixed_repeat, op2130i_stable_x, op2130i_stable_y, op2130i_base, op2130i_switch

    private theorem op2130i_influence_cycle (k j : ℕ) :
        op2130i_run (fun _ => 0)
          (op2130i_start ++ (List.replicate k op2130i_block).flatten ++
            op2130i_flipped ++ (List.replicate j op2130i_block).flatten) 2 = 2 ∧
        op2130i_run (fun _ => 0)
          (op2130i_start ++ (List.replicate (k + 1 + j) op2130i_block).flatten) 2 = 0 := by
      have hx := op2130i_fixed_repeat op2130i_x op2130i_stable_x
      have hy := op2130i_fixed_repeat op2130i_y op2130i_stable_y
      have hbase := op2130i_base
      have hs := op2130i_switch
      simp only [op2130i_run] at hbase hs
      constructor
  5. Executing k blocks, the flipped block, and j blocks after the prefix results in discrepancy 2 at vertex 2.

    Decomposing the fold over the concatenated request sequence with List.foldl_append, the state begins at 0, transitions to x via the prefix (op2130i_base), remains x through k blocks (hx k), switches from x to y across the flipped block (op2130i_switch), and remains y through j blocks (hy j). The final state is y, whose component at vertex 2 is 2 by definition.

    lines 45–47

    uses List.foldl_append

      · simp only [op2130i_run, List.foldl_append] at *
        rw [hbase, hx k, hs, hy j]
        rfl
  6. Executing k + 1 + j unflipped blocks after the prefix results in discrepancy 0 at vertex 2.

    Decomposing the fold over the concatenated request sequence with List.foldl_append, the state transitions from 0 to x via the prefix (op2130i_base) and remains x throughout all k + 1 + j copies of the block (hx (k + 1 + j)). The final state is x, whose component at vertex 2 is 0 by definition.

    lines 48–51

    uses List.foldl_append

      · simp only [op2130i_run, List.foldl_append] at *
        rw [hbase, hx (k + 1 + j)]
        rfl
    
  7. The edge endpoint indices in the public theorem statement are valid vertices in Fin 4. automation

    The local definition of the update step in the theorem statement requires proving that p.1 < 4 and p.1 + 1 < 4 for p.1 ∈ Fin 3, which is closed by linear arithmetic (omega).

    lines 52–57

    theorem op_2130_unbounded_pathwise_influence_example (k j : ℕ) :
        let update := fun (d : Fin 4 → ℤ) (p : Fin 3 × Bool) =>
          let a : Fin 4 := ⟨p.1.val, by omega⟩
          let b : Fin 4 := ⟨p.1.val + 1, by omega⟩
          let sign := if d a < d b then true else if d b < d a then false else p.2
          carpool_step 4 d (a,b) sign
  8. The main theorem follows directly from the private cycle lemma.

    The statement of the theorem is definitionally identical to op2130i_influence_cycle k j, so applying that lemma concludes the proof.

    lines 58–67

    uses op2130i_influence_cycle

        let run := fun (d : Fin 4 → ℤ) (w : List (Fin 3 × Bool)) => w.foldl update d
        let start : List (Fin 3 × Bool) :=
          [(0,false),(1,false),(2,false),(1,true),(0,false),(2,true),(1,false),(1,false),(0,false)]
        let block : List (Fin 3 × Bool) :=
          [(2,false),(0,false),(1,false),(0,false),(1,true),(0,false),(2,true),(1,false),(1,false),(0,false)]
        let flipped : List (Fin 3 × Bool) :=
          [(2,true),(0,false),(1,false),(0,false),(1,true),(0,false),(2,true),(1,false),(1,false),(0,false)]
        run (fun _ => 0) (start ++ (List.replicate k block).flatten ++ flipped ++ (List.replicate j block).flatten) 2 = 2 ∧
        run (fun _ => 0) (start ++ (List.replicate (k + 1 + j) block).flatten) 2 = 0 := by
      exact op2130i_influence_cycle k j
List.foldl_append
Folding an operation across the concatenation of two lists is equal to folding across the first list and then folding across the second list with the intermediate accumulator.
List.replicate_succ
Replicating an element n + 1 times is equal to that element consed onto n replications of the element.
List.flatten_cons
Flattening a list of lists whose head is l is equal to l concatenated with the flattening of the tail of the list.
op2130i_base
Running the 9-request prefix from the all-zero discrepancy vector reaches discrepancy vector x = ![-1, 1, 0, 0].
op2130i_stable_x
Running the 10-request block from discrepancy vector x leaves x invariant.
op2130i_stable_y
Running the 10-request block from discrepancy vector y = ![-1, 1, 2, -2] leaves y invariant.
op2130i_switch
Running the flipped block from discrepancy vector x transitions the state to y.
op2130i_fixed_repeat
If a discrepancy vector d is a fixed point of the block, then running any number k of copies of the block also leaves d unchanged.
op2130i_influence_cycle
For any numbers k and j of blocks, running the prefix, k blocks, the flipped block, and j blocks produces discrepancy 2 at vertex 2, whereas running the prefix and k + 1 + j unflipped blocks produces discrepancy 0 at vertex 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

private def op2130i_update (d : Fin 4 → ℤ) (p : Fin 3 × Bool) : Fin 4 → ℤ :=  let a : Fin 4 := ⟨p.1.val, by omega⟩  let b : Fin 4 := ⟨p.1.val + 1, by omega⟩  let sign := if d a < d b then true else if d b < d a then false else p.2  carpool_step 4 d (a,b) signprivate def op2130i_run (d : Fin 4 → ℤ) (w : List (Fin 3 × Bool)) : Fin 4 → ℤ :=  w.foldl op2130i_update dprivate def op2130i_start : List (Fin 3 × Bool) :=  [(0,false),(1,false),(2,false),(1,true),(0,false),(2,true),(1,false),(1,false),(0,false)]private def op2130i_block : List (Fin 3 × Bool) :=  [(2,false),(0,false),(1,false),(0,false),(1,true),(0,false),(2,true),(1,false),(1,false),(0,false)]private def op2130i_flipped : List (Fin 3 × Bool) :=  [(2,true),(0,false),(1,false),(0,false),(1,true),(0,false),(2,true),(1,false),(1,false),(0,false)]private def op2130i_x : Fin 4 → ℤ := ![-1,1,0,0]private def op2130i_y : Fin 4 → ℤ := ![-1,1,2,-2]private lemma op2130i_base : op2130i_run (fun _ => 0) op2130i_start = op2130i_x := by decideprivate lemma op2130i_stable_x : op2130i_run op2130i_x op2130i_block = op2130i_x := by decideprivate lemma op2130i_stable_y : op2130i_run op2130i_y op2130i_block = op2130i_y := by decideprivate lemma op2130i_switch : op2130i_run op2130i_x op2130i_flipped = op2130i_y := by decideprivate lemma op2130i_fixed_repeat (d : Fin 4 → ℤ) (h : op2130i_run d op2130i_block = d) :    ∀ k, op2130i_run d (List.flatten (List.replicate k op2130i_block)) = d := by  intro k  induction k with  | zero => rfl  | succ k ih =>    simp only [List.replicate_succ, List.flatten_cons, op2130i_run, List.foldl_append] at *    rw [h]    exact ihprivate theorem op2130i_influence_cycle (k j : ℕ) :    op2130i_run (fun _ => 0)      (op2130i_start ++ (List.replicate k op2130i_block).flatten ++        op2130i_flipped ++ (List.replicate j op2130i_block).flatten) 2 = 2 ∧    op2130i_run (fun _ => 0)      (op2130i_start ++ (List.replicate (k + 1 + j) op2130i_block).flatten) 2 = 0 := by  have hx := op2130i_fixed_repeat op2130i_x op2130i_stable_x  have hy := op2130i_fixed_repeat op2130i_y op2130i_stable_y  have hbase := op2130i_base  have hs := op2130i_switch  simp only [op2130i_run] at hbase hs  constructor  · simp only [op2130i_run, List.foldl_append] at *    rw [hbase, hx k, hs, hy j]    rfl  · simp only [op2130i_run, List.foldl_append] at *    rw [hbase, hx (k + 1 + j)]    rfltheorem op_2130_unbounded_pathwise_influence_example (k j : ℕ) :    let update := fun (d : Fin 4 → ℤ) (p : Fin 3 × Bool) =>      let a : Fin 4 := ⟨p.1.val, by omega⟩      let b : Fin 4 := ⟨p.1.val + 1, by omega⟩      let sign := if d a < d b then true else if d b < d a then false else p.2      carpool_step 4 d (a,b) sign    let run := fun (d : Fin 4 → ℤ) (w : List (Fin 3 × Bool)) => w.foldl update d    let start : List (Fin 3 × Bool) :=      [(0,false),(1,false),(2,false),(1,true),(0,false),(2,true),(1,false),(1,false),(0,false)]    let block : List (Fin 3 × Bool) :=      [(2,false),(0,false),(1,false),(0,false),(1,true),(0,false),(2,true),(1,false),(1,false),(0,false)]    let flipped : List (Fin 3 × Bool) :=      [(2,true),(0,false),(1,false),(0,false),(1,true),(0,false),(2,true),(1,false),(1,false),(0,false)]    run (fun _ => 0) (start ++ (List.replicate k block).flatten ++ flipped ++ (List.replicate j block).flatten) 2 = 2 ∧    run (fun _ => 0) (start ++ (List.replicate (k + 1 + j) block).flatten) 2 = 0 := by  exact op2130i_influence_cycle k j
See it in the graphDiscuss this resultChallenge it