AFTD Auto-Formalizing Theoretical Domains

prioritized_borel_encoding_replay_block_legal

theoremverified

The complete encoded block of any legal original edge consists of legal phase-game edges when replayed from the matching block boundary.

Statement

theorem prioritized_borel_encoding_replay_block_legal {Q : Type} [Fintype Q] (G : PrioritizedBorelGame Q 3) (node v : List Bool) (q : Q) (e : TreeGameEdge Q 3) (he : e ∈ G.edges) (hv : e.source_node = v) (hq : e.source_state = q) : ∀ f ∈ enc1385ReplayEdges G node ⟨v,q,[]⟩ (enc1385BlockMoves e), f ∈ (enc1385Game G).edges
Source
Opponent-block simulation for arXiv:2611.10136, Conjecture 19.
Verified
18 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 6
  • enc1385GameGiven a finite-state three-priority tree game, construct a phase-state game that encodes each original direction followed by a one-hot…
  • enc1385BlockMovesThe phase-game actions for one original edge, with the original priority on the final bit and priority zero on preceding bits.
  • enc1385ReplayEdgesConstruct the phase-game edge sequence generated by replaying a finite sequence of direction-priority actions from a given phase position.
  • prioritized_borel_encoding_state_code_lengthThe one-hot code of a state has length equal to the number of states.
  • PrioritizedBorelGameA structure PrioritizedBorelGame (Q : Type*) (k : ℕ) representing a prioritized Borel game with state space Q and k priorities, with…
  • TreeGameEdgeA structure TreeGameEdge (Q : Type*) (k : ℕ) representing an edge in a binary tree game arena with state space Q and k priorities, with…

The proof, explained

To prove that replaying the encoded block of an edge e produces only legal phase-game edges, we analyze the sequence of N + 1 intermediate moves L and states s(m) = ⟨v, q, block.take m⟩, where N = |Q|. For each intermediate step m < N, the pending buffer has length m < N + 1, so enc1385Step simply accumulates the m-th bit to reach s(m + 1). Each move in L matches the prefix of e's encoding and assigns priority 0 (or e.prio at the final step m = N), making every move real and therefore allowed. An induction on the remaining suffix length d = (N + 1) - m then shows that every edge produced during the replay belongs to the encoded game.

  1. Let f be an edge in the replay of enc1385BlockMoves e, define N = |Q|, and let block be the encoded bit sequence of e, which has length N + 1.

    We assume classical logic and introduce an arbitrary edge f in the replay sequence. We define N as the cardinality of Q and block as enc1385Block e. Since the encoded block consists of the edge's direction bit followed by an encoded state of length N (by prioritized_borel_encoding_state_code_length), its total length is N + 1.

    lines 2–7

    uses enc1385Block, prioritized_borel_encoding_state_code_length

      classical
      intro f hf
      set N := Fintype.card Q with hN
      set block : List Bool := enc1385Block e with hblock
      have hblock_len : block.length = N + 1 := by
        simp [hblock, hN, enc1385Block, prioritized_borel_encoding_state_code_length]
  2. The block moves coincide with an explicit list L of N + 1 moves, and we define the sequence of intermediate states s(m) = ⟨v, q, block.take m⟩.

    We define L as the list of length N + 1 pairing each bit of block with priority e.prio at index N and 0 elsewhere. By definition of enc1385BlockMoves, the move list for e is exactly L, so L has length N + 1. We rewrite the membership hypothesis for f in terms of L and define the intermediate state s(m) with original node v, state q, and pending buffer given by the first m bits of block.

    lines 8–14

    uses enc1385BlockMoves

      set L : List (Bool × Fin 3) :=
        (List.range (N+1)).map (fun i => (block.getD i false, if i = N then e.prio else 0)) with hLdef
      have hL : enc1385BlockMoves e = L := by
        simp [hLdef, hblock, hN, enc1385BlockMoves]
      have hL_len : L.length = N + 1 := by simp [hLdef]
      rw [hL] at hf
      set s : ℕ → Enc1385State Q := fun m => ⟨v, q, block.take m⟩ with hs
  3. For each index m < N + 1, the m-th element of L consists of the m-th bit of block and the corresponding priority (e.prio at m = N and 0 otherwise).

    Because L is defined by mapping over List.range (N + 1), evaluating the element at index m reduces to applying the mapping to m via List.getElem_map and List.getElem_range.

    lines 15–18

    uses List.getElem_map, List.getElem_range

      have hgetL : ∀ m (hm : m < L.length),
          L[m] = ((block.getD m false, if m = N then e.prio else 0) : Bool × Fin 3) := by
        intro m hm
        simp [hLdef, List.getElem_map, List.getElem_range]
  4. For any m < block.length, appending the m-th bit of block to its prefix of length m produces the prefix of length m + 1.

    Since m is strictly less than block.length, the default lookup block.getD m false is the actual element block[m] by List.getD_eq_getElem. Appending this element to block.take m is list concatenation by List.concat_eq_append, which equals block.take (m + 1) by List.take_concat_get.

    lines 19–24

    uses List.getD_eq_getElem, List.concat_eq_append, List.take_concat_get

      have hcat : ∀ m, m < block.length →
          block.take m ++ [block.getD m false] = block.take (m+1) := by
        intro m hm
        have hgetD : block.getD m false = block[m] := List.getD_eq_getElem block false hm
        rw [hgetD, ← List.concat_eq_append]
        exact List.take_concat_get hm
  5. For any m < N, executing enc1385Step from state s(m) with the direction bit of move L[m] transitions to state s(m + 1).

    When m < N, the buffer in s(m) has length m. Appending the m-th bit yields a buffer of length m + 1 < N + 1. In enc1385Step, because this length does not equal N + 1, the else branch of the conditional is taken (using if_neg): the original node and state are preserved, and the pending buffer becomes block.take (m + 1). Thus the step on block.getD m false produces s(m + 1), and since the direction of L[m] is this bit, the transition along L[m].1 yields s(m + 1).

    lines 25–42

    uses List.length_take, enc1385Step, if_neg

      have hstep_block : ∀ m, m < N → enc1385Step G (s m) (block.getD m false) = s (m+1) := by
        intro m hmN
        have hmblock : m < block.length := by omega
        have hc := hcat m hmblock
        have hlen : (block.take m ++ [block.getD m false]).length = m + 1 := by
          rw [hc]; simp [List.length_take]; omega
        have hne : (block.take m ++ [block.getD m false]).length ≠ Fintype.card Q + 1 := by
          rw [hlen, ← hN]; omega
        simp only [enc1385Step, hs]
        rw [if_neg hne]
        rw [hc]
      have hstep : ∀ m (hm : m < L.length), m < N →
          enc1385Step G (s m) (L[m]'hm).1 = s (m+1) := by
        intro m hm hmN
        have hml := hgetL m hm
        have hb1 : (L[m]'hm).1 = block.getD m false := by rw [hml]
        rw [hb1]
        exact hstep_block m hmN
  6. For each m < N + 1, the move L[m] played from state s(m) is real (enc1385Real), witnessed by the original game edge e.

    We check the conditions of enc1385Real with e ∈ G.edges as the witness. Its source node v and state q match those in s(m). Appending the bit L[m].1 to the pending buffer of s(m) produces block.take (m + 1), which is a prefix of enc1385Block e by List.take_prefix. If m = N, the buffer length is N + 1 and the priority is e.prio; if m < N, the length is not N + 1 and the priority is 0, matching the definition of enc1385Real.

    lines 43–62

    uses List.length_take, List.take_prefix, enc1385Block

      have hreal : ∀ m (hm : m < L.length), enc1385Real G (s m) (L[m]'hm).1 (L[m]'hm).2 := by
        intro m hm
        have hmblock : m < block.length := by omega
        have hml := hgetL m hm
        have hb1 : (L[m]'hm).1 = block.getD m false := by rw [hml]
        have hb2 : (L[m]'hm).2 = (if m = N then e.prio else 0) := by rw [hml]
        have hc := hcat m hmblock
        have hlen : (block.take (m+1)).length = m + 1 := by
          simp [List.length_take]; omega
        refine ⟨e, he, ?_, ?_, ?_, ?_⟩
        · simp only [hs]; exact hv
        · simp only [hs]; exact hq
        · simp only [hs, hb1]
          rw [hc]
          exact List.take_prefix (m+1) (enc1385Block e)
        · simp only [hs, hb1, hb2]
          rw [hc, hlen, ← hN]
          by_cases h : m = N
          · simp [h]
          · simp [h]
  7. An edge belongs to (enc1385Game G).edges if and only if its target state matches enc1385Step and its move is allowed (enc1385Allowed).

    This restates the definition of edge membership in enc1385Game G, which requires both the step transition and the allowed move condition.

    lines 63–68

    uses enc1385Game

      have mem_iff : ∀ E : TreeGameEdge (Enc1385State Q) 3,
          E ∈ (enc1385Game G).edges ↔
            E.target_state = enc1385Step G E.source_state E.dir ∧
              enc1385Allowed G E.source_state E.dir E.prio := by
        intro E
        simp [enc1385Game]
  8. By induction on remaining length d, whenever m + d = N + 1, every edge generated by replaying the suffix L.drop m from state s(m) belongs to (enc1385Game G).edges.

    We induct on d. For d = 0, m = N + 1, so L.drop m is empty by List.drop_eq_nil_of_le, producing an empty list of edges by enc1385ReplayEdges.eq_1 (vacuously true). For d + 1, we split L.drop m into head L[m] and tail L.drop (m + 1) using List.drop_eq_getElem_cons. By enc1385ReplayEdges.eq_2, any edge g generated is either the head edge or in the tail replay. If g is the head edge, its target matches enc1385Step and its move is allowed (as it is real, using Or.inl), so g is legal by mem_iff. If g is in the tail replay, either m < N, where the next state is s(m + 1) by hstep and the induction hypothesis applies, or m = N, in which case L.drop (m + 1) is empty and yields no edges.

    lines 69–96

    uses List.drop_eq_nil_of_le, enc1385ReplayEdges.eq_1, List.drop_eq_getElem_cons, enc1385ReplayEdges.eq_2, List.mem_cons.mp, Or.inl

      have key : ∀ d m, m + d = N + 1 → ∀ (nd : List Bool) (g : TreeGameEdge (Enc1385State Q) 3),
          g ∈ enc1385ReplayEdges G nd (s m) (L.drop m) → g ∈ (enc1385Game G).edges := by
        intro d
        induction d with
        | zero =>
          intro m hm nd g hg
          have hdrop : L.drop m = [] := by
            apply List.drop_eq_nil_of_le
            rw [hL_len]; omega
          rw [hdrop, enc1385ReplayEdges.eq_1] at hg
          simp at hg
        | succ d ih =>
          intro m hm nd g hg
          have hmlt : m < L.length := by rw [hL_len]; omega
          have hdrop : L.drop m = L[m] :: L.drop (m+1) := List.drop_eq_getElem_cons hmlt
          rw [hdrop, enc1385ReplayEdges.eq_2] at hg
          rcases List.mem_cons.mp hg with rfl | hg'
          · rw [mem_iff]
            exact ⟨rfl, Or.inl (hreal m hmlt)⟩
          · by_cases hmN : m < N
            · have hsm : enc1385Step G (s m) (L[m]'hmlt).1 = s (m+1) := hstep m hmlt hmN
              rw [hsm] at hg'
              exact ih (m+1) (by omega) (nd ++ [(L[m]'hmlt).1]) g hg'
            · have hnil : L.drop (m+1) = [] := by
                apply List.drop_eq_nil_of_le
                rw [hL_len]; omega
              rw [hnil, enc1385ReplayEdges.eq_1] at hg'
              simp at hg'
  9. The chosen edge f is an edge of enc1385Game G.

    Specializing the inductive result with m = 0 and d = N + 1 (where L.drop 0 = L) shows that every edge generated by replaying L from s(0) = ⟨v, q, []⟩ is legal, which directly implies f ∈ (enc1385Game G).edges.

    line 97

      exact key (N+1) 0 (by omega) node f hf
enc1385Block
The bit block encoding an edge, formed by prefixing the encoded target state with the edge's direction bit.
enc1385BlockMoves
The sequence of N + 1 moves corresponding to an edge e, pairing each bit of the encoded block with priority 0, except for the last move which receives e's priority.
enc1385Game
The definition of the encoded prioritized Borel game, whose legal edges require that the target state matches enc1385Step and the move is allowed.
enc1385Step
The state transition function of the phase game, which buffers bits until N + 1 bits are accumulated, at which point it commits the transition to the decoded state.
enc1385ReplayEdges.eq_1
Replaying an empty list of moves yields an empty list of edges.
enc1385ReplayEdges.eq_2
Replaying a non-empty list of moves yields the edge for the first move followed recursively by replaying the remaining moves from the updated state and node.
if_neg
An if-then-else expression evaluates to its else branch when the condition is false.
List.concat_eq_append
Appending an element a to the end of a list is equivalent to concatenating with the singleton list [a].
List.drop_eq_getElem_cons
When i < l.length, dropping i elements from l gives the element l[i] followed by dropping i + 1 elements.
List.drop_eq_nil_of_le
Dropping at least as many elements as the length of a list results in the empty list.
List.getD_eq_getElem
The default get operation l.getD n d equals l[n] whenever n < l.length.
List.getElem_map
Accessing the i-th element of a mapped list List.map f l gives f applied to l[i].
List.getElem_range
The j-th element of List.range n is j.
List.length_take
The length of the prefix of length i of a list l is min(i, l.length).
List.mem_cons.mp
An element belongs to a :: l if and only if it equals a or belongs to l.
List.take_prefix
The prefix of length i of a list is always a prefix of the entire list.
List.take_concat_get
Appending the i-th element of a list to its prefix of length i yields the prefix of length i + 1.
Or.inl
A proposition a implies the disjunction a ∨ b.
prioritized_borel_encoding_state_code_length
The binary code for any state q has length equal to the cardinality of Q.

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 prioritized_borel_encoding_replay_block_legal {Q : Type} [Fintype Q] (G : PrioritizedBorelGame Q 3) (node v : List Bool) (q : Q) (e : TreeGameEdge Q 3) (he : e ∈ G.edges) (hv : e.source_node = v) (hq : e.source_state = q) : ∀ f ∈ enc1385ReplayEdges G node ⟨v,q,[]⟩ (enc1385BlockMoves e), f ∈ (enc1385Game G).edges := by  classical  intro f hf  set N := Fintype.card Q with hN  set block : List Bool := enc1385Block e with hblock  have hblock_len : block.length = N + 1 := by    simp [hblock, hN, enc1385Block, prioritized_borel_encoding_state_code_length]  set L : List (Bool × Fin 3) :=    (List.range (N+1)).map (fun i => (block.getD i false, if i = N then e.prio else 0)) with hLdef  have hL : enc1385BlockMoves e = L := by    simp [hLdef, hblock, hN, enc1385BlockMoves]  have hL_len : L.length = N + 1 := by simp [hLdef]  rw [hL] at hf  set s : ℕ → Enc1385State Q := fun m => ⟨v, q, block.take m⟩ with hs  have hgetL : ∀ m (hm : m < L.length),      L[m] = ((block.getD m false, if m = N then e.prio else 0) : Bool × Fin 3) := by    intro m hm    simp [hLdef, List.getElem_map, List.getElem_range]  have hcat : ∀ m, m < block.length →      block.take m ++ [block.getD m false] = block.take (m+1) := by    intro m hm    have hgetD : block.getD m false = block[m] := List.getD_eq_getElem block false hm    rw [hgetD, ← List.concat_eq_append]    exact List.take_concat_get hm  have hstep_block : ∀ m, m < N → enc1385Step G (s m) (block.getD m false) = s (m+1) := by    intro m hmN    have hmblock : m < block.length := by omega    have hc := hcat m hmblock    have hlen : (block.take m ++ [block.getD m false]).length = m + 1 := by      rw [hc]; simp [List.length_take]; omega    have hne : (block.take m ++ [block.getD m false]).length ≠ Fintype.card Q + 1 := by      rw [hlen, ← hN]; omega    simp only [enc1385Step, hs]    rw [if_neg hne]    rw [hc]  have hstep : ∀ m (hm : m < L.length), m < N →      enc1385Step G (s m) (L[m]'hm).1 = s (m+1) := by    intro m hm hmN    have hml := hgetL m hm    have hb1 : (L[m]'hm).1 = block.getD m false := by rw [hml]    rw [hb1]    exact hstep_block m hmN  have hreal : ∀ m (hm : m < L.length), enc1385Real G (s m) (L[m]'hm).1 (L[m]'hm).2 := by    intro m hm    have hmblock : m < block.length := by omega    have hml := hgetL m hm    have hb1 : (L[m]'hm).1 = block.getD m false := by rw [hml]    have hb2 : (L[m]'hm).2 = (if m = N then e.prio else 0) := by rw [hml]    have hc := hcat m hmblock    have hlen : (block.take (m+1)).length = m + 1 := by      simp [List.length_take]; omega    refine ⟨e, he, ?_, ?_, ?_, ?_⟩    · simp only [hs]; exact hv    · simp only [hs]; exact hq    · simp only [hs, hb1]      rw [hc]      exact List.take_prefix (m+1) (enc1385Block e)    · simp only [hs, hb1, hb2]      rw [hc, hlen, ← hN]      by_cases h : m = N      · simp [h]      · simp [h]  have mem_iff : ∀ E : TreeGameEdge (Enc1385State Q) 3,      E ∈ (enc1385Game G).edges ↔        E.target_state = enc1385Step G E.source_state E.dir ∧          enc1385Allowed G E.source_state E.dir E.prio := by    intro E    simp [enc1385Game]  have key : ∀ d m, m + d = N + 1 → ∀ (nd : List Bool) (g : TreeGameEdge (Enc1385State Q) 3),      g ∈ enc1385ReplayEdges G nd (s m) (L.drop m) → g ∈ (enc1385Game G).edges := by    intro d    induction d with    | zero =>      intro m hm nd g hg      have hdrop : L.drop m = [] := by        apply List.drop_eq_nil_of_le        rw [hL_len]; omega      rw [hdrop, enc1385ReplayEdges.eq_1] at hg      simp at hg    | succ d ih =>      intro m hm nd g hg      have hmlt : m < L.length := by rw [hL_len]; omega      have hdrop : L.drop m = L[m] :: L.drop (m+1) := List.drop_eq_getElem_cons hmlt      rw [hdrop, enc1385ReplayEdges.eq_2] at hg      rcases List.mem_cons.mp hg with rfl | hg'      · rw [mem_iff]        exact ⟨rfl, Or.inl (hreal m hmlt)⟩      · by_cases hmN : m < N        · have hsm : enc1385Step G (s m) (L[m]'hmlt).1 = s (m+1) := hstep m hmlt hmN          rw [hsm] at hg'          exact ih (m+1) (by omega) (nd ++ [(L[m]'hmlt).1]) g hg'        · have hnil : L.drop (m+1) = [] := by            apply List.drop_eq_nil_of_le            rw [hL_len]; omega          rw [hnil, enc1385ReplayEdges.eq_1] at hg'          simp at hg'  exact key (N+1) 0 (by omega) node f hf
See it in the graphDiscuss this resultChallenge it