AFTD Auto-Formalizing Theoretical Domains

prioritized_borel_encoding_replay_boundary

theoremverified

Replaying an edge block from a block boundary appends its encoded bits to the phase-game node and ends at the original child node and target state with an empty pending prefix, regardless of the strategy's memory updates.

Statement

theorem prioritized_borel_encoding_replay_boundary {Q M : Type} [Fintype Q] (G : PrioritizedBorelGame Q 3) (pl : BorelGamePlayer) (σ : FiniteMemoryStrategy (enc1385Game G) pl M) (m : M) (node v : List Bool) (q : Q) (e : TreeGameEdge Q 3) : (enc1385Replay G pl σ m node ⟨v,q,[]⟩ e).2.1 = node ++ enc1385Block e ∧ (enc1385Replay G pl σ m node ⟨v,q,[]⟩ e).2.2 = ⟨v ++ [e.dir], e.target_state, []⟩
Source
Block replay for arXiv:2611.10136, Conjecture 19.
Verified
18 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 9
  • 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,…
  • enc1385BlockMovesThe phase-game actions for one original edge, with the original priority on the final bit and priority zero on preceding bits.
  • prioritized_borel_encoding_state_code_lengthThe one-hot code of a state has length equal to the number of states.
  • prioritized_borel_encoding_decode_stateDecoding a valid one-hot state code recovers the original state.
  • PrioritizedBorelGameA structure PrioritizedBorelGame (Q : Type*) (k : ℕ) representing a prioritized Borel game with state space Q and k priorities, with…
  • BorelGamePlayerThe two players in a prioritized Borel game, Eve and Adam.
  • FiniteMemoryStrategyA structure FiniteMemoryStrategy {Q : Type*} {k : ℕ} (G : PrioritizedBorelGame Q k) (pl : BorelGamePlayer) (M : Type*) representing a…
  • TreeGameEdgeA structure TreeGameEdge (Q : Type*) (k : ℕ) representing an edge in a binary tree game arena with state space Q and k priorities, with…
Used by 2

The proof, explained

To replay an edge block of length |Q| + 1 from a boundary state, the proof first shows by induction that the first |Q| moves accumulate bits into the pending buffer and the phase node without changing the original node or state. The final move at index |Q| completes the block, which triggers the step transition: the edge direction is appended to the original node, the target state is decoded from the remaining bits, and the pending buffer is cleared.

  1. For n = 0, replaying zero moves leaves the node, the pending buffer, and the strategy memory unchanged.

    We induct on n. When n = 0, taking 0 moves from enc1385BlockMoves e yields an empty list. Folding the replay step over an empty list leaves the initial state (m, node, ⟨v, q, []⟩) unchanged, matching the claim with m' = m.

    lines 13–15

      intro n
      induction n with
      | zero => intro _; exact ⟨m, by simp⟩
  2. In the inductive step, the block and moves lists have length |Q| + 1, so the n-th move has index within bounds, carries priority 0, and extends the prefix of length n to length n + 1.

    Assume the induction hypothesis for n, and assume n + 1 ≤ |Q|. Since the encoded state code has length |Q|, the block enc1385Block e and its move sequence have length |Q| + 1. Therefore n < |Q| + 1. Evaluating the n-th move shows its bit is the n-th block bit and its priority is 0 (as n < |Q|). Concatenating this n-th bit to the prefix of length n gives the prefix of length n + 1.

    lines 16–31

    uses prioritized_borel_encoding_state_code_length, List.getElem_map, List.getElem_range, List.getD_eq_getElem, List.take_concat_get'

      | succ n ih =>
        intro hn
        obtain ⟨m', hm'⟩ := ih (by omega)
        have hcode := prioritized_borel_encoding_state_code_length (Q := Q) e.target_state
        have hlenB : (enc1385Block e).length = Fintype.card Q + 1 := by
          simp [enc1385Block, hcode]
        have hlenm : (enc1385BlockMoves e).length = Fintype.card Q + 1 := by
          simp [enc1385BlockMoves]
        have hlt : n < (enc1385BlockMoves e).length := by rw [hlenm]; omega
        have hnltB : n < (enc1385Block e).length := by rw [hlenB]; omega
        have hbit : (enc1385BlockMoves e)[n]
            = ((enc1385Block e).getD n false, (if n = Fintype.card Q then e.prio else 0)) := by
          simp [enc1385BlockMoves, List.getElem_map, List.getElem_range]
        have htake : (enc1385Block e).take n ++ [(enc1385Block e).getD n false]
            = (enc1385Block e).take (n + 1) := by
          rw [List.getD_eq_getElem _ _ hnltB, List.take_concat_get' _ _ hnltB]
  3. The single replay step at index n appends the bit to pending without completing the block, completing the inductive step for n + 1.

    Because n + 1 ≤ |Q| < |Q| + 1, the pending buffer with the new bit does not reach length |Q| + 1, so enc1385Step does not trigger block completion and simply appends the bit to pending. Splitting the first n + 1 moves into the first n moves followed by the n-th move, folding over the concatenation rewrites by the induction hypothesis and evaluates the final step, establishing the inductive claim for n + 1.

    lines 32–46

    uses List.length_append, List.length_take, List.length_singleton, Nat.min_eq_left, if_neg, List.take_concat_get', List.foldl_append, List.foldl_cons, List.foldl_nil, List.append_assoc

        have hstep : enc1385Step G (⟨v, q, (enc1385Block e).take n⟩ : Enc1385State Q)
            ((enc1385Block e).getD n false) = ⟨v, q, (enc1385Block e).take (n + 1)⟩ := by
          have hlen : ¬ ((enc1385Block e).take n
              ++ [(enc1385Block e).getD n false]).length = Fintype.card Q + 1 := by
            rw [List.length_append, List.length_take, hlenB, List.length_singleton]
            have hmin : min n (Fintype.card Q + 1) = n := Nat.min_eq_left (by omega)
            omega
          simp only [enc1385Step]
          rw [if_neg hlen, htake]
        have h1 : (enc1385BlockMoves e).take (n + 1)
            = (enc1385BlockMoves e).take n ++ [(enc1385BlockMoves e)[n]] :=
          (List.take_concat_get' (enc1385BlockMoves e) n hlt).symm
        rw [h1, List.foldl_append, hm']
        simp only [List.foldl_cons, List.foldl_nil, enc1385ReplayStep, hbit, hstep]
        exact ⟨_, by rw [List.append_assoc, htake]⟩
  4. Replaying the first |Q| moves appends the first |Q| bits to the node and accumulates them into pending while keeping origNode = v and origState = q.

    We instantiate the auxiliary lemma prioritized_borel_encoding_replay_boundary_aux with n = |Q| using reflexivity |Q| ≤ |Q|. This provides an intermediate strategy memory m' and establishes that the replay state after |Q| moves has pending buffer equal to the first |Q| bits of the block.

    lines 48–50

    uses prioritized_borel_encoding_replay_boundary_aux, le_rfl

    theorem prioritized_borel_encoding_replay_boundary {Q M : Type} [Fintype Q] (G : PrioritizedBorelGame Q 3) (pl : BorelGamePlayer) (σ : FiniteMemoryStrategy (enc1385Game G) pl M) (m : M) (node v : List Bool) (q : Q) (e : TreeGameEdge Q 3) : (enc1385Replay G pl σ m node ⟨v,q,[]⟩ e).2.1 = node ++ enc1385Block e ∧ (enc1385Replay G pl σ m node ⟨v,q,[]⟩ e).2.2 = ⟨v ++ [e.dir], e.target_state, []⟩ := by
      obtain ⟨m', hm'⟩ :=
        prioritized_borel_encoding_replay_boundary_aux G pl σ m node v q e (Fintype.card Q) le_rfl
  5. The final move at index |Q| carries the edge priority e.prio, and appending its bit to the prefix of length |Q| completes the entire block enc1385Block e with head e.dir and tail enc1385StateCode e.target_state.

    Because the block length is |Q| + 1, the index |Q| is strictly within bounds and corresponds to the last move. By definition of enc1385BlockMoves, this move has priority e.prio. Appending the final bit completes the entire block. Its head is the edge direction e.dir and its tail is the target state code enc1385StateCode e.target_state.

    lines 51–66

    uses prioritized_borel_encoding_state_code_length, List.getElem_map, List.getElem_range, List.getD_eq_getElem, List.take_concat_get', List.take_of_length_le

      have hcode := prioritized_borel_encoding_state_code_length (Q := Q) e.target_state
      have hlenB : (enc1385Block e).length = Fintype.card Q + 1 := by
        simp [enc1385Block, hcode]
      have hlenm : (enc1385BlockMoves e).length = Fintype.card Q + 1 := by simp [enc1385BlockMoves]
      have hlt : Fintype.card Q < (enc1385BlockMoves e).length := by rw [hlenm]; omega
      have hnltB : Fintype.card Q < (enc1385Block e).length := by rw [hlenB]; omega
      have hbit : (enc1385BlockMoves e)[Fintype.card Q]
          = ((enc1385Block e).getD (Fintype.card Q) false, e.prio) := by
        simp [enc1385BlockMoves, List.getElem_map, List.getElem_range]
      have htake : (enc1385Block e).take (Fintype.card Q)
            ++ [(enc1385Block e).getD (Fintype.card Q) false] = enc1385Block e := by
        rw [List.getD_eq_getElem _ _ hnltB, List.take_concat_get' _ _ hnltB,
          List.take_of_length_le (by rw [hlenB])]
      have hhead : (enc1385Block e).headD false = e.dir := by simp [enc1385Block]
      have htail : (enc1385Block e).tail = enc1385StateCode e.target_state := by
        simp [enc1385Block]
  6. The final replay step completes the block: the node gains the full block, origNode advances to v ++ [e.dir], origState decodes to e.target_state, and pending resets to [].

    We decompose the moves list into the prefix of length |Q| and the single final move. On the final step, the pending buffer reaches length |Q| + 1. Thus enc1385Step takes the then branch: it appends the block head e.dir to origNode, decodes the tail to e.target_state via prioritized_borel_encoding_decode_state, and empties pending. Evaluating the replay foldl yields node ++ enc1385Block e for the phase node and ⟨v ++ [e.dir], e.target_state, []⟩ for the phase state.

    lines 67–84

    uses prioritized_borel_encoding_decode_state, if_pos, List.take_concat_get', List.take_of_length_le, List.foldl_append, List.foldl_cons, List.foldl_nil, List.append_assoc

      have hstep : enc1385Step G (⟨v, q, (enc1385Block e).take (Fintype.card Q)⟩ : Enc1385State Q)
          ((enc1385Block e).getD (Fintype.card Q) false) = ⟨v ++ [e.dir], e.target_state, []⟩ := by
        have hlen : ((enc1385Block e).take (Fintype.card Q)
            ++ [(enc1385Block e).getD (Fintype.card Q) false]).length = Fintype.card Q + 1 := by
          rw [htake, hlenB]
        simp only [enc1385Step]
        rw [if_pos hlen, htake, hhead, htail, prioritized_borel_encoding_decode_state]
      have h1 : enc1385BlockMoves e
          = (enc1385BlockMoves e).take (Fintype.card Q) ++ [(enc1385BlockMoves e)[Fintype.card Q]] := by
        rw [List.take_concat_get' (enc1385BlockMoves e) (Fintype.card Q) hlt,
          List.take_of_length_le (by rw [hlenm])]
      unfold enc1385Replay
      rw [h1, List.foldl_append, hm']
      simp only [List.foldl_cons, List.foldl_nil]
      rw [hbit]
      unfold enc1385ReplayStep
      rw [hstep]
      exact ⟨by rw [List.append_assoc, htake], rfl⟩
prioritized_borel_encoding_state_code_length
The length of the binary encoding of any state q is |Q|.
prioritized_borel_encoding_decode_state
Decoding the binary state code of q recovers q.
prioritized_borel_encoding_replay_boundary_aux
Replaying the first n phase moves of an edge block from an empty pending state accumulates the first n bits into pending and the node.
le_rfl
In any preorder, a ≤ a.
List.getElem_map
Mapping a function f over a list and getting the i-th element equals f applied to the i-th element.
List.getElem_range
The j-th element of List.range n is j.
List.getD_eq_getElem
Getting an element with a default value equals indexing into the list when the index is within bounds.
List.take_concat_get'
Taking i elements from a list and appending the i-th element equals taking i + 1 elements.
List.take_of_length_le
Taking i elements from a list of length at most i yields the entire list.
List.length_append
The length of the concatenation of two lists is the sum of their lengths.
List.length_take
The length of List.take i l is the minimum of i and the length of l.
List.length_singleton
The length of a singleton list is 1.
Nat.min_eq_left
If a ≤ b, then min a b = a.
if_neg
If a proposition c is false, then (if c then t else e) = e.
if_pos
If a proposition c is true, then (if c then t else e) = t.
List.foldl_append
Folding a function over the concatenation of two lists equals folding over the first and then folding the result over the second.
List.foldl_cons
Folding over a cons list a :: l applies the function to the accumulator and a, then folds over l.
List.foldl_nil
Folding over an empty list returns the initial accumulator.
List.append_assoc
List concatenation is associative.

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

set_option maxHeartbeats 800000 in/-- After replaying the first `n` phase moves of an edge block from a state with emptypending prefix, the node has gained exactly the first `n` block bits and the phase statestores exactly those bits as its pending prefix. -/private theorem prioritized_borel_encoding_replay_boundary_aux {Q M : Type} [Fintype Q]    (G : PrioritizedBorelGame Q 3) (pl : BorelGamePlayer)    (σ : FiniteMemoryStrategy (enc1385Game G) pl M) (m : M) (node v : List Bool) (q : Q)    (e : TreeGameEdge Q 3) :    ∀ n : ℕ, n ≤ Fintype.card Q →    ∃ m' : M, List.foldl (enc1385ReplayStep G pl σ) (m, node, (⟨v, q, []⟩ : Enc1385State Q))        ((enc1385BlockMoves e).take n)      = (m', node ++ (enc1385Block e).take n, (⟨v, q, (enc1385Block e).take n⟩ : Enc1385State Q)) := by  intro n  induction n with  | zero => intro _; exact ⟨m, by simp⟩  | succ n ih =>    intro hn    obtain ⟨m', hm'⟩ := ih (by omega)    have hcode := prioritized_borel_encoding_state_code_length (Q := Q) e.target_state    have hlenB : (enc1385Block e).length = Fintype.card Q + 1 := by      simp [enc1385Block, hcode]    have hlenm : (enc1385BlockMoves e).length = Fintype.card Q + 1 := by      simp [enc1385BlockMoves]    have hlt : n < (enc1385BlockMoves e).length := by rw [hlenm]; omega    have hnltB : n < (enc1385Block e).length := by rw [hlenB]; omega    have hbit : (enc1385BlockMoves e)[n]        = ((enc1385Block e).getD n false, (if n = Fintype.card Q then e.prio else 0)) := by      simp [enc1385BlockMoves, List.getElem_map, List.getElem_range]    have htake : (enc1385Block e).take n ++ [(enc1385Block e).getD n false]        = (enc1385Block e).take (n + 1) := by      rw [List.getD_eq_getElem _ _ hnltB, List.take_concat_get' _ _ hnltB]    have hstep : enc1385Step G (⟨v, q, (enc1385Block e).take n⟩ : Enc1385State Q)        ((enc1385Block e).getD n false) = ⟨v, q, (enc1385Block e).take (n + 1)⟩ := by      have hlen : ¬ ((enc1385Block e).take n          ++ [(enc1385Block e).getD n false]).length = Fintype.card Q + 1 := by        rw [List.length_append, List.length_take, hlenB, List.length_singleton]        have hmin : min n (Fintype.card Q + 1) = n := Nat.min_eq_left (by omega)        omega      simp only [enc1385Step]      rw [if_neg hlen, htake]    have h1 : (enc1385BlockMoves e).take (n + 1)        = (enc1385BlockMoves e).take n ++ [(enc1385BlockMoves e)[n]] :=      (List.take_concat_get' (enc1385BlockMoves e) n hlt).symm    rw [h1, List.foldl_append, hm']    simp only [List.foldl_cons, List.foldl_nil, enc1385ReplayStep, hbit, hstep]    exact ⟨_, by rw [List.append_assoc, htake]⟩theorem prioritized_borel_encoding_replay_boundary {Q M : Type} [Fintype Q] (G : PrioritizedBorelGame Q 3) (pl : BorelGamePlayer) (σ : FiniteMemoryStrategy (enc1385Game G) pl M) (m : M) (node v : List Bool) (q : Q) (e : TreeGameEdge Q 3) : (enc1385Replay G pl σ m node ⟨v,q,[]⟩ e).2.1 = node ++ enc1385Block e ∧ (enc1385Replay G pl σ m node ⟨v,q,[]⟩ e).2.2 = ⟨v ++ [e.dir], e.target_state, []⟩ := by  obtain ⟨m', hm'⟩ :=    prioritized_borel_encoding_replay_boundary_aux G pl σ m node v q e (Fintype.card Q) le_rfl  have hcode := prioritized_borel_encoding_state_code_length (Q := Q) e.target_state  have hlenB : (enc1385Block e).length = Fintype.card Q + 1 := by    simp [enc1385Block, hcode]  have hlenm : (enc1385BlockMoves e).length = Fintype.card Q + 1 := by simp [enc1385BlockMoves]  have hlt : Fintype.card Q < (enc1385BlockMoves e).length := by rw [hlenm]; omega  have hnltB : Fintype.card Q < (enc1385Block e).length := by rw [hlenB]; omega  have hbit : (enc1385BlockMoves e)[Fintype.card Q]      = ((enc1385Block e).getD (Fintype.card Q) false, e.prio) := by    simp [enc1385BlockMoves, List.getElem_map, List.getElem_range]  have htake : (enc1385Block e).take (Fintype.card Q)        ++ [(enc1385Block e).getD (Fintype.card Q) false] = enc1385Block e := by    rw [List.getD_eq_getElem _ _ hnltB, List.take_concat_get' _ _ hnltB,      List.take_of_length_le (by rw [hlenB])]  have hhead : (enc1385Block e).headD false = e.dir := by simp [enc1385Block]  have htail : (enc1385Block e).tail = enc1385StateCode e.target_state := by    simp [enc1385Block]  have hstep : enc1385Step G (⟨v, q, (enc1385Block e).take (Fintype.card Q)⟩ : Enc1385State Q)      ((enc1385Block e).getD (Fintype.card Q) false) = ⟨v ++ [e.dir], e.target_state, []⟩ := by    have hlen : ((enc1385Block e).take (Fintype.card Q)        ++ [(enc1385Block e).getD (Fintype.card Q) false]).length = Fintype.card Q + 1 := by      rw [htake, hlenB]    simp only [enc1385Step]    rw [if_pos hlen, htake, hhead, htail, prioritized_borel_encoding_decode_state]  have h1 : enc1385BlockMoves e      = (enc1385BlockMoves e).take (Fintype.card Q) ++ [(enc1385BlockMoves e)[Fintype.card Q]] := by    rw [List.take_concat_get' (enc1385BlockMoves e) (Fintype.card Q) hlt,      List.take_of_length_le (by rw [hlenm])]  unfold enc1385Replay  rw [h1, List.foldl_append, hm']  simp only [List.foldl_cons, List.foldl_nil]  rw [hbit]  unfold enc1385ReplayStep  rw [hstep]  exact ⟨by rw [List.append_assoc, htake], rfl⟩
See it in the graphDiscuss this resultChallenge it