AFTD Auto-Formalizing Theoretical Domains

op869_bounded_game_sequential_compose

theoremverified

If an adversary can force a chosen intermediate state property within fuel₁ moves, and can then force K colors within fuel₂ further moves from every such state, it can force K colors within fuel₁+fuel₂ moves.

Statement

theorem op869_bounded_game_sequential_compose {n : ℕ} (k t K D : ℕ) (goal : Op869SequentialState n → Prop)
    (fuel₁ fuel₂ i : ℕ) (P : Fin n → Finset (Fin n)) (C : Fin n → Finset ℕ)
    (hfirst : op869_sequential_goal_game goal (op869_sequential_legal k D) (op869_sequential_valid t)
      op869_sequential_next fuel₁ ⟨i,P,C⟩)
    (hsecond : ∀ s : Op869SequentialState n, goal s →
      op869_bounded_adversary_forces k t K D fuel₂ s.i s.P s.C) :
    op869_bounded_adversary_forces k t K D (fuel₁+fuel₂) i P C
Source
Sequential composition for the finite adversary game of arXiv:2610.41516 Section 2.
Verified
18 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 3
  • op869_bounded_adversary_forcesThe bounded t-fold adversary game is the t-fold game where, after each move, every vertex has post-degree at most D.
  • op869_graph_from_predecessorsThe simple graph on the ordered vertices Fin n whose edge from an earlier vertex a to a later vertex b exists exactly when a is in the…
  • op869_predecessor_postdegreeThe post-degree of a vertex in an ordered predecessor presentation is the number of later vertices that list it as a predecessor.
Used by 6
  • op869_one_sided_bipartite_gadgetA t-fold adversary can build a bipartite graph in at most 2^(j+1)-1 vertices with one side containing at least t+j ceil(t/2) colors.
  • op869_fold_macro_step_implies_forcingA bounded q-fold coloring strategy transfers to a bounded t-fold strategy whenever a related target state can simulate each source move in…
  • op869_disjoint_interval_game_liftA local k-colorable online strategy can be played on a fresh disconnected interval after any k-colorable earlier graph, without changing…
  • op869_game_maintains_prefixA bounded online-coloring strategy preserves graph colorability, the board-size bound, and empty predecessor and color sets at all future…
  • op869_macro_step_strategy_simulationA strategy in one finite game transfers to another if each source move can be simulated by at most B target moves, preserving a state…
  • op869_goal_game_strategy_simulationA winning finite-game strategy transfers through a relation when legal moves can be simulated, every response can be matched, and related…

The proof, explained

The theorem establishes that the bounded online-coloring adversary game enjoys sequential composition: an adversary that forces an intermediate property in fuel₁ moves and then forces K colors in fuel₂ further moves can force K colors in fuel₁ + fuel₂ moves. The proof first develops an abstract framework for sequential 2-player games with fuel budget, proving by induction on fuel that winning is monotone in fuel (`op869_sequential_fuel_mono_internal`) and that abstract games compose sequentially (`op869_sequential_compose_internal`). It then proves by induction on fuel that the concrete bounded online-coloring game is logically equivalent to this abstract formulation (`op869_bounded_sequential_equiv_internal`). Finally, `op869_bounded_game_sequential_compose` translates the concrete game into the abstract sequential game, applies the abstract composition theorem, and translates the conclusion back.

  1. The fuel monotonicity lemma holds in the base case where fuel is zero.

    We induct on the fuel budget n. When n = 0, the hypothesis that the adversary forces the goal with 0 fuel is false by definition of the game, so the base case holds vacuously.

    lines 12–13

      induction n generalizing n' s with
      | zero => simp [op869_sequential_goal_game] at h
  2. In the inductive step with fuel n + 1, the target fuel n' cannot be zero.

    We perform a case split on the target fuel n'. If n' = 0, the assumption n + 1 ≤ n' would imply n + 1 ≤ 0, which is impossible by linear arithmetic (`omega`).

    lines 15–16

        cases n' with
        | zero => omega
  3. When n' = succ m, the adversary can play the same legal move in the game with fuel n' + 1 as in the game with fuel n + 1.

    Unfolding the game definition, the hypothesis for n + 1 fuel provides a legal move such that all valid opponent responses either immediately satisfy the goal or leave a winning state with n fuel. The adversary chooses this exact move for the n' + 1 game.

    lines 18–20

          simp only [op869_sequential_goal_game] at h ⊢
          obtain ⟨move, hm, hnext⟩ := h
          refine ⟨move, hm, ?_⟩
  4. For any valid response, the adversary either achieves the goal immediately or wins within n' moves.

    Given any valid response, we case-split on whether the goal was achieved immediately or a game with n fuel remains. If the goal was achieved, the winning condition is satisfied directly via `Or.inl`. If the game continues with n fuel, since n ≤ n' (by linear arithmetic from n + 1 ≤ n' + 1), the induction hypothesis ensures the adversary wins with n' fuel, providing the `Or.inr` alternative.

    lines 21–24

    uses Or.inl, Or.inr

          intro r hr
          rcases hnext r hr with hgoal | hgame
          · exact Or.inl hgoal
          · exact Or.inr (ih n' _ (by omega) hgame)
  5. The sequential composition theorem holds vacuously when the first phase has zero fuel.

    We induct on the fuel budget n of the first phase. When n = 0, the hypothesis that the adversary forces the intermediate goal g₁ with 0 fuel is false by definition of the game, so the claim holds vacuously.

    lines 31–32

      induction n generalizing s with
      | zero => simp [op869_sequential_goal_game] at hfirst
  6. In the inductive step with fuel n + 1, the adversary plays the first move guaranteed by the first phase.

    Rewriting (n + 1) + m as (n + m) + 1 using `Nat.succ_add` and unfolding the definition of the sequential game, the hypothesis for the first phase provides a legal move. The adversary plays this move and considers an arbitrary valid response from the opponent.

    lines 34–38

    uses Nat.succ_add

        simp only [op869_sequential_goal_game] at hfirst
        simp only [Nat.succ_add, op869_sequential_goal_game]
        obtain ⟨move, hm, hnext⟩ := hfirst
        refine ⟨move, hm, ?_⟩
        intro r hr
  7. If the response satisfies the intermediate goal g₁, the adversary can force the final goal g₂ within n + m moves.

    When the next state satisfies g₁, the hypothesis for the second phase guarantees that the adversary can force g₂ within m moves. Since m ≤ n + m, applying fuel monotonicity (`op869_sequential_fuel_mono_internal`) ensures the adversary can force g₂ within n + m moves.

    lines 39–41

    uses op869_sequential_fuel_mono_internal

        rcases hnext r hr with hgoal | hgame
        · right
          exact op869_sequential_fuel_mono_internal g₂ legal valid next m (n+m) _ (by omega) (hsecond _ hgoal)
  8. If the response leaves a state where g₁ can be forced in n moves, the adversary can force g₂ within n + m moves.

    By the induction hypothesis, if the adversary can force g₁ in n moves from this next state, it can force g₂ in n + m moves from that same state.

    lines 42–43

        · right
          exact ih _ hgame
  9. The concrete bounded adversary game is equivalent to the abstract sequential game when fuel is zero.

    We proceed by induction on fuel budget, enabling classical logic. At fuel 0, both the abstract sequential game and the bounded adversary forcing relation evaluate to `False` by definition, so the equivalence holds trivially.

    lines 72–74

      classical
      induction fuel generalizing i P C with
      | zero => simp [op869_sequential_goal_game, op869_bounded_adversary_forces]
  10. When the current vertex index i satisfies i < n, the concrete game with fuel + 1 is equivalent to the abstract game with fuel + 1. automation

    Assuming i < n, we unfold the game definitions and the definitions of legal moves, valid responses, and state transitions using `dif_pos` and `Nat.lt_succ_iff`. After rewriting with the induction hypothesis for the remaining fuel, `aesop` verifies that the existential and universal quantifiers defining moves and responses match between the two formulations.

    lines 76–81

    uses dif_pos, Nat.lt_succ_iff

        by_cases hi : i < n
        · simp only [op869_sequential_goal_game, op869_bounded_adversary_forces, dif_pos hi]
          simp only [op869_sequential_legal, op869_sequential_valid, op869_sequential_next, op869_sequential_goal_internal,
            dif_pos hi, Nat.lt_succ_iff, Op869SequentialState.i, Op869SequentialState.P, Op869SequentialState.C]
          simp only [ih]
          aesop
  11. When i ≥ n, both the concrete and abstract games evaluate to false.

    If ¬(i < n), no legal move exists in the abstract game (as legality requires an index strictly less than n), and the concrete game's definition branches to `False`, making both sides false.

    line 82

        · simp [op869_sequential_goal_game, op869_bounded_adversary_forces, op869_sequential_legal, hi]
  12. To show the adversary forces K colors within fuel₁ + fuel₂ moves in the concrete bounded game, it suffices to show it in the abstract sequential game.

    We apply the forward direction of `op869_bounded_sequential_equiv_internal`, transforming the goal from the concrete relation `op869_bounded_adversary_forces` to the abstract sequential game `op869_sequential_goal_game`.

    line 92

    uses op869_bounded_sequential_equiv_internal

      apply (op869_bounded_sequential_equiv_internal k t K D (fuel₁+fuel₂) i P C).mp
  13. The abstract game goal reduces to showing that from any state satisfying the intermediate goal, the adversary can force K colors in fuel₂ moves.

    We apply the abstract sequential composition theorem `op869_sequential_compose_internal` with the hypothesis `hfirst` that the adversary reaches the intermediate goal within fuel₁ moves.

    lines 93–94

    uses op869_sequential_compose_internal

      apply op869_sequential_compose_internal goal (op869_sequential_goal_internal K) (op869_sequential_legal k D)
        (op869_sequential_valid t) op869_sequential_next fuel₁ fuel₂ ⟨i,P,C⟩ hfirst
  14. From any intermediate state satisfying the goal, the adversary can force K colors in fuel₂ moves in the abstract game.

    Given an arbitrary state s satisfying the intermediate goal, hypothesis `hsecond` ensures the adversary forces K colors in fuel₂ moves in the concrete game. Applying the backward direction of `op869_bounded_sequential_equiv_internal` translates this into the required abstract game win, completing the proof.

    lines 95–96

    uses op869_bounded_sequential_equiv_internal

      intro s hs
      exact (op869_bounded_sequential_equiv_internal k t K D fuel₂ s.i s.P s.C).mpr (hsecond s hs)
Or.inl
For propositions a and b, if a holds, then the disjunction a ∨ b holds.
Or.inr
For propositions a and b, if b holds, then the disjunction a ∨ b holds.
Nat.succ_add
For natural numbers n and m, (n + 1) + m = (n + m) + 1.
op869_sequential_fuel_mono_internal
In an abstract sequential game, if the adversary can force the goal within n moves and n ≤ n', then it can also force the goal within n' moves.
dif_pos
If a decidable condition c is true with proof hc, the dependent if-then-else expression `if c then t else e` reduces to the then-branch `t hc`.
Nat.lt_succ_iff
For natural numbers m and n, m < n + 1 if and only if m ≤ n.
op869_bounded_sequential_equiv_internal
The concrete bounded adversary forcing relation `op869_bounded_adversary_forces` is logically equivalent to the abstract sequential game `op869_sequential_goal_game` instantiated with the online-coloring rules and target K.
op869_sequential_compose_internal
In an abstract sequential game, if an adversary can force an intermediate goal g₁ within n moves, and from every state satisfying g₁ can force a goal g₂ within m moves, then it can force g₂ within n + m moves.

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

def op869_sequential_goal_game {S M R : Type} (goal : S → Prop) (legal : S → M → Prop)    (valid : S → M → R → Prop) (next : S → M → R → S) : ℕ → S → Prop  | 0, _ => False  | fuel+1, state =>      ∃ move, legal state move ∧ ∀ response, valid state move response →        goal (next state move response) ∨ op869_sequential_goal_game goal legal valid next fuel (next state move response)lemma op869_sequential_fuel_mono_internal {S M R : Type} (goal : S → Prop) (legal : S → M → Prop)    (valid : S → M → R → Prop) (next : S → M → R → S) (n n' : ℕ) (s : S)    (hn : n ≤ n') (h : op869_sequential_goal_game goal legal valid next n s) :    op869_sequential_goal_game goal legal valid next n' s := by  induction n generalizing n' s with  | zero => simp [op869_sequential_goal_game] at h  | succ n ih =>    cases n' with    | zero => omega    | succ n' =>      simp only [op869_sequential_goal_game] at h ⊢      obtain ⟨move, hm, hnext⟩ := h      refine ⟨move, hm, ?_⟩      intro r hr      rcases hnext r hr with hgoal | hgame      · exact Or.inl hgoal      · exact Or.inr (ih n' _ (by omega) hgame)theorem op869_sequential_compose_internal {S M R : Type} (g₁ g₂ : S → Prop) (legal : S → M → Prop)    (valid : S → M → R → Prop) (next : S → M → R → S) (n m : ℕ) (s : S)    (hfirst : op869_sequential_goal_game g₁ legal valid next n s)    (hsecond : ∀ s, g₁ s → op869_sequential_goal_game g₂ legal valid next m s) :    op869_sequential_goal_game g₂ legal valid next (n+m) s := by  induction n generalizing s with  | zero => simp [op869_sequential_goal_game] at hfirst  | succ n ih =>    simp only [op869_sequential_goal_game] at hfirst    simp only [Nat.succ_add, op869_sequential_goal_game]    obtain ⟨move, hm, hnext⟩ := hfirst    refine ⟨move, hm, ?_⟩    intro r hr    rcases hnext r hr with hgoal | hgame    · right      exact op869_sequential_fuel_mono_internal g₂ legal valid next m (n+m) _ (by omega) (hsecond _ hgoal)    · right      exact ih _ hgamestructure Op869SequentialState (n : ℕ) where  i : ℕ  P : Fin n → Finset (Fin n)  C : Fin n → Finset ℕdef op869_sequential_goal_internal {n : ℕ} (K : ℕ) (s : Op869SequentialState n) : Prop :=  K ≤ ((Finset.univ.filter (fun a : Fin n => a.val < s.i)).biUnion s.C).carddef op869_sequential_legal {n : ℕ} (k D : ℕ) (s : Op869SequentialState n) (S : Finset (Fin n)) : Prop :=  ∃ hi : s.i < n, (∀ a ∈ S, a.val < s.i) ∧    let P' := Function.update s.P (⟨s.i, hi⟩ : Fin n) S    (op869_graph_from_predecessors P').Colorable k ∧      ∀ a, op869_predecessor_postdegree P' a ≤ Ddef op869_sequential_valid {n : ℕ} (t : ℕ) (s : Op869SequentialState n)    (S : Finset (Fin n)) (c : Finset ℕ) : Prop :=  c.card = t ∧ ∀ a ∈ S, Disjoint (s.C a) cdef op869_sequential_next {n : ℕ} (s : Op869SequentialState n) (S : Finset (Fin n))    (c : Finset ℕ) : Op869SequentialState n :=  if hi : s.i < n then ⟨s.i+1, Function.update s.P (⟨s.i,hi⟩ : Fin n) S,    Function.update s.C (⟨s.i,hi⟩ : Fin n) c⟩ else stheorem op869_bounded_sequential_equiv_internal {n : ℕ} (k t K D fuel i : ℕ) (P : Fin n → Finset (Fin n)) (C : Fin n → Finset ℕ) :    op869_sequential_goal_game (op869_sequential_goal_internal K) (op869_sequential_legal k D)      (op869_sequential_valid t) op869_sequential_next fuel ⟨i,P,C⟩ ↔    op869_bounded_adversary_forces k t K D fuel i P C := by  classical  induction fuel generalizing i P C with  | zero => simp [op869_sequential_goal_game, op869_bounded_adversary_forces]  | succ fuel ih =>    by_cases hi : i < n    · simp only [op869_sequential_goal_game, op869_bounded_adversary_forces, dif_pos hi]      simp only [op869_sequential_legal, op869_sequential_valid, op869_sequential_next, op869_sequential_goal_internal,        dif_pos hi, Nat.lt_succ_iff, Op869SequentialState.i, Op869SequentialState.P, Op869SequentialState.C]      simp only [ih]      aesop    · simp [op869_sequential_goal_game, op869_bounded_adversary_forces, op869_sequential_legal, hi]/-- Sequential composition for the bounded online-coloring adversary game. -/theorem op869_bounded_game_sequential_compose {n : ℕ} (k t K D : ℕ) (goal : Op869SequentialState n → Prop)    (fuel₁ fuel₂ i : ℕ) (P : Fin n → Finset (Fin n)) (C : Fin n → Finset ℕ)    (hfirst : op869_sequential_goal_game goal (op869_sequential_legal k D) (op869_sequential_valid t)      op869_sequential_next fuel₁ ⟨i,P,C⟩)    (hsecond : ∀ s : Op869SequentialState n, goal s →      op869_bounded_adversary_forces k t K D fuel₂ s.i s.P s.C) :    op869_bounded_adversary_forces k t K D (fuel₁+fuel₂) i P C := by  apply (op869_bounded_sequential_equiv_internal k t K D (fuel₁+fuel₂) i P C).mp  apply op869_sequential_compose_internal goal (op869_sequential_goal_internal K) (op869_sequential_legal k D)    (op869_sequential_valid t) op869_sequential_next fuel₁ fuel₂ ⟨i,P,C⟩ hfirst  intro s hs  exact (op869_bounded_sequential_equiv_internal k t K D fuel₂ s.i s.P s.C).mpr (hsecond s hs)
See it in the graphDiscuss this resultChallenge it