AFTD Auto-Formalizing Theoretical Domains

prioritized_borel_follow_actions_replay

theoremverified

If each of the first n selected phase-game moves is legal at its selected position, replaying their direction and priority actions produces the same final memory and position as following the strategy.

Statement

theorem prioritized_borel_follow_actions_replay {Q M : Type} [Fintype Q] (G : PrioritizedBorelGame Q 3) (pl : BorelGamePlayer) (σ : FiniteMemoryStrategy (enc1385Game G) pl M) (m : M) (node : List Bool) (s : Enc1385State Q) (n : ℕ) (hlegal : ∀ i < n, let st := enc1385Follow G pl σ m node s i; let e := σ.choice st.1 st.2.1 st.2.2; e ∈ (enc1385Game G).edges ∧ e.source_node = st.2.1 ∧ e.source_state = st.2.2) : (enc1385FollowActions G pl σ m node s n).foldl (enc1385ReplayStep G pl σ) (m,node,s) = enc1385Follow G pl σ m node s n
Source
Block replay for arXiv:2611.10136, Conjecture 19.
Verified
17 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 8
  • enc1385GameGiven a finite-state three-priority tree game, construct a phase-state game that encodes each original direction followed by a one-hot…
  • enc1385ReplayReplay the bit-and-priority block of an original edge from a phase-game node, state, and strategy memory, returning the resulting memory,…
  • enc1385FollowStarting with a phase-game memory and position, follow a fixed strategy for a specified number of phase steps, returning the resulting…
  • enc1385FollowActionsThe sequence of public bits and priorities selected by a phase-game strategy in its first n steps from a specified memory and position.
  • TreeGameEdgeA structure TreeGameEdge (Q : Type*) (k : ℕ) representing an edge in a binary tree game arena with state space Q and k priorities, with…
  • FiniteMemoryStrategyA structure FiniteMemoryStrategy {Q : Type*} {k : ℕ} (G : PrioritizedBorelGame Q k) (pl : BorelGamePlayer) (M : Type*) representing a…
  • BorelGamePlayerThe two players in a prioritized Borel game, Eve and Adam.
  • PrioritizedBorelGameA structure PrioritizedBorelGame (Q : Type*) (k : ℕ) representing a prioritized Borel game with state space Q and k priorities, with…
Used by 2

The proof, explained

The theorem is proved by induction on the number of steps n in the auxiliary lemma `enc1385LocalFollowReplay`. The base case n = 0 is trivial since replaying an empty action sequence leaves the initial state unchanged. For the inductive step, the sequence of n + 1 actions splits into the first n actions followed by the final action; the induction hypothesis evaluates the replay of the first n actions to the n-th state, and legality guarantees that the edge reconstructed in the replay step matches the transition step taken by the strategy. The main theorem `prioritized_borel_follow_actions_replay` is an immediate application of this lemma.

  1. The result holds for the base case n = 0.

    We proceed by induction on n. When n = 0, no actions have been taken, so the action sequence is empty. Folding `enc1385ReplayStep` over the empty list returns the initial tuple (m, node, s) unchanged, which is definitionally equal to following the strategy for 0 steps.

    lines 9–13

      intro n
      induction n with
      | zero =>
        intro _
        rfl
  2. In the inductive step, the legality condition holds for all step indices strictly less than n.

    Assuming all moves up to step n are legal, any index i < n also satisfies i < n + 1. Thus the legality hypothesis restricts immediately to the first n steps, allowing the induction hypothesis to be applied.

    lines 14–20

      | succ n ih =>
        intro hlegal
        have hlegaln : ∀ i < n, let st := enc1385Follow G pl σ m node s i
            let e := σ.choice st.1 st.2.1 st.2.2
            e ∈ (enc1385Game G).edges ∧ e.source_node = st.2.1 ∧ e.source_state = st.2.2 := by
          intro i hi
          exact hlegal i (by omega)
  3. The move selected by the strategy at step n is a valid game edge whose target state is given by the transition function.

    Let st be the configuration after n steps and e be the edge chosen by σ. By the legality hypothesis at step n, e is in the game's edge set with source node st.2.1 and source state st.2.2. By definition of edges in the encoded game, its target state satisfies e.target_state = enc1385Step G e.source_state e.dir.

    lines 21–25

        let st := enc1385Follow G pl σ m node s n
        let e := σ.choice st.1 st.2.1 st.2.2
        have hv : e ∈ (enc1385Game G).edges ∧ e.source_node = st.2.1 ∧ e.source_state = st.2.2 :=
          hlegal n (by omega)
        have ht : e.target_state = enc1385Step G e.source_state e.dir := hv.1.1
  4. The edge reconstructed from the replay step coincides with the strategy's chosen edge e.

    The replay step constructs an edge from the current position and action (e.dir, e.prio). Since e.source_node = st.2.1, e.source_state = st.2.2, and e.target_state = enc1385Step G e.source_state e.dir, every field of the reconstructed edge matches e, and its target state is e.target_state.

    lines 26–31

        have heq : (⟨st.2.1, st.2.2, e.dir, e.prio, enc1385Step G st.2.2 e.dir⟩ :
            TreeGameEdge (Enc1385State Q) 3) = e := by
          rw [← hv.2.1, ← hv.2.2, ← ht]
        have ht' : enc1385Step G st.2.2 e.dir = e.target_state := by
          rw [← hv.2.2]
          exact ht.symm
  5. Replaying n + 1 actions produces the same configuration as following the strategy for n + 1 steps.

    The sequence of n + 1 actions is the concatenation of the first n actions with the single action (e.dir, e.prio). Rewriting with `List.foldl_append`, `List.foldl_cons`, and `List.foldl_nil` simplifies the fold into replaying the first n actions followed by a single replay step. By the induction hypothesis, the replay of the first n actions yields st. Expanding `enc1385ReplayStep` and substituting the reconstructed edge identity shows that the resulting configuration matches `enc1385Follow` at step n + 1.

    lines 32–37

    uses List.foldl_append, List.foldl_cons, List.foldl_nil

        simp only [enc1385FollowActions, List.foldl_append, List.foldl_cons, List.foldl_nil]
        rw [ih hlegaln]
        change enc1385ReplayStep G pl σ st (e.dir,e.prio) =
          (σ.update st.1 e, st.2.1 ++ [e.dir], e.target_state)
        simp only [enc1385ReplayStep]
        rw [heq, ht']
  6. The main theorem follows immediately from `enc1385LocalFollowReplay`.

    The theorem statement is identical to the conclusion of lemma `enc1385LocalFollowReplay`, so applying the lemma with the given parameters and legality hypothesis completes the proof.

    line 40

    uses enc1385LocalFollowReplay

      exact enc1385LocalFollowReplay G pl σ m node s n hlegal
List.foldl_append
Folding an operation over the concatenation of two lists equals folding over the first list and then folding over the second list using the intermediate result as the accumulator.
List.foldl_cons
Folding an operation over a list with head a and tail l equals folding over l with the accumulator updated by a.
List.foldl_nil
Folding an operation over the empty list returns the initial accumulator unchanged.
enc1385LocalFollowReplay
In the encoded 3-priority Borel game, if all moves selected by the strategy up to step n are legal, replaying the sequence of direction and priority actions starting from the initial configuration produces the exact memory and position reached by following the strategy for n steps.

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

lemma enc1385LocalFollowReplay {Q M : Type} [Fintype Q] (G : PrioritizedBorelGame Q 3)    (pl : BorelGamePlayer) (σ : FiniteMemoryStrategy (enc1385Game G) pl M)    (m : M) (node : List Bool) (s : Enc1385State Q) :    ∀ n, (∀ i < n, let st := enc1385Follow G pl σ m node s i      let e := σ.choice st.1 st.2.1 st.2.2      e ∈ (enc1385Game G).edges ∧ e.source_node = st.2.1 ∧ e.source_state = st.2.2) →      (enc1385FollowActions G pl σ m node s n).foldl (enc1385ReplayStep G pl σ) (m,node,s) =        enc1385Follow G pl σ m node s n := by  intro n  induction n with  | zero =>    intro _    rfl  | succ n ih =>    intro hlegal    have hlegaln : ∀ i < n, let st := enc1385Follow G pl σ m node s i        let e := σ.choice st.1 st.2.1 st.2.2        e ∈ (enc1385Game G).edges ∧ e.source_node = st.2.1 ∧ e.source_state = st.2.2 := by      intro i hi      exact hlegal i (by omega)    let st := enc1385Follow G pl σ m node s n    let e := σ.choice st.1 st.2.1 st.2.2    have hv : e ∈ (enc1385Game G).edges ∧ e.source_node = st.2.1 ∧ e.source_state = st.2.2 :=      hlegal n (by omega)    have ht : e.target_state = enc1385Step G e.source_state e.dir := hv.1.1    have heq : (⟨st.2.1, st.2.2, e.dir, e.prio, enc1385Step G st.2.2 e.dir⟩ :        TreeGameEdge (Enc1385State Q) 3) = e := by      rw [← hv.2.1, ← hv.2.2, ← ht]    have ht' : enc1385Step G st.2.2 e.dir = e.target_state := by      rw [← hv.2.2]      exact ht.symm    simp only [enc1385FollowActions, List.foldl_append, List.foldl_cons, List.foldl_nil]    rw [ih hlegaln]    change enc1385ReplayStep G pl σ st (e.dir,e.prio) =      (σ.update st.1 e, st.2.1 ++ [e.dir], e.target_state)    simp only [enc1385ReplayStep]    rw [heq, ht']theorem prioritized_borel_follow_actions_replay {Q M : Type} [Fintype Q] (G : PrioritizedBorelGame Q 3) (pl : BorelGamePlayer) (σ : FiniteMemoryStrategy (enc1385Game G) pl M) (m : M) (node : List Bool) (s : Enc1385State Q) (n : ℕ) (hlegal : ∀ i < n, let st := enc1385Follow G pl σ m node s i; let e := σ.choice st.1 st.2.1 st.2.2; e ∈ (enc1385Game G).edges ∧ e.source_node = st.2.1 ∧ e.source_state = st.2.2) : (enc1385FollowActions G pl σ m node s n).foldl (enc1385ReplayStep G pl σ) (m,node,s) = enc1385Follow G pl σ m node s n := by  exact enc1385LocalFollowReplay G pl σ m node s n hlegal
See it in the graphDiscuss this resultChallenge it