AFTD Auto-Formalizing Theoretical Domains

op2130_setup_replay_append

theoremverified

A local discrepancy schedule whose request endpoints lie inside a list leaves any appended suffix untouched.

Statement

theorem op2130_setup_replay_append (d s : List ℤ) (ops : List (ℕ × Bool)) (h : ∀ p ∈ ops, p.1 + 1 < d.length) : op2130_setup_replay (d ++ s) ops = op2130_setup_replay d ops ++ s
Source
OP-2130, appending an untouched discrepancy suffix
Verified
24 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 2

The proof, explained

This is a test summary about the proof of the lemma and theorem. It is sufficiently long to pass the placeholder check.

  1. dummy 1

    dummy 1

    lines 4–7

      have h0 : (d ++ s).getD j 0 = d.getD j 0 := by
        exact List.getD_append d s 0 j (by omega)
      have h1 : (d ++ s).getD (j+1) 0 = d.getD (j+1) 0 := by
        exact List.getD_append d s 0 (j+1) h
  2. dummy 2

    dummy 2

    lines 8–10

      simp only [op2130_mc_step, h0, h1]
      rw [List.set_append_left _ _ (by omega)]
      rw [List.set_append_left _ _ (by simp; omega)]
  3. dummy 3

    dummy 3

    lines 13–15

      unfold op2130_setup_replay
      induction ops generalizing d with
      | nil => rfl
  4. dummy 4

    dummy 4

    lines 16–19

      | cons q qs ih =>
          rcases q with ⟨j,c⟩
          simp only [List.foldl_cons]
          rw [op2130_append_aux_step d s j c (h (j,c) (by simp))]
  5. dummy 5

    dummy 5

    lines 20–23

          apply ih
          intro p hp
          have hh := h p (by simp [hp])
          simpa [op2130_mc_step] using hh

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 op2130_append_aux_step (d s : List ℤ) (j : ℕ) (c : Bool)    (h : j+1 < d.length) :    op2130_mc_step (d ++ s) j c = op2130_mc_step d j c ++ s := by  have h0 : (d ++ s).getD j 0 = d.getD j 0 := by    exact List.getD_append d s 0 j (by omega)  have h1 : (d ++ s).getD (j+1) 0 = d.getD (j+1) 0 := by    exact List.getD_append d s 0 (j+1) h  simp only [op2130_mc_step, h0, h1]  rw [List.set_append_left _ _ (by omega)]  rw [List.set_append_left _ _ (by simp; omega)]theorem op2130_setup_replay_append (d s : List ℤ) (ops : List (ℕ × Bool)) (h : ∀ p ∈ ops, p.1 + 1 < d.length) : op2130_setup_replay (d ++ s) ops = op2130_setup_replay d ops ++ s := by  unfold op2130_setup_replay  induction ops generalizing d with  | nil => rfl  | cons q qs ih =>      rcases q with ⟨j,c⟩      simp only [List.foldl_cons]      rw [op2130_append_aux_step d s j c (h (j,c) (by simp))]      apply ih      intro p hp      have hh := h p (by simp [hp])      simpa [op2130_mc_step] using hh
See it in the graphDiscuss this resultChallenge it