AFTD Auto-Formalizing Theoretical Domains

prioritized_borel_forward_deterministic_one_state_reduction

theoremverified

Fix a prioritized Borel game, any priority count k, and a memory bound b. Suppose that at each node and state, any two legal edges with the same branch direction have the same target state. If every one-state game with k priorities has a winning strategy with at most b memory states, then the given game also has a winning strategy with at most b memory states. The original state type may live in any universe.

Statement

theorem prioritized_borel_forward_deterministic_one_state_reduction {Q : Type*} {k : ℕ}
    (G : PrioritizedBorelGame Q k) (b : ℕ)
    (hforward : ∀ e ∈ G.edges, ∀ e' ∈ G.edges,
      e.source_node = e'.source_node → e.source_state = e'.source_state →
      e.dir = e'.dir → e.target_state = e'.target_state)
    (hone : ∀ H : PrioritizedBorelGame Unit k, HasWinningStrategyInMem H b) :
    HasWinningStrategyInMem G b
Source
Forward-deterministic special case of the finite-memory question in arXiv:2611.10136, Conjecture 19.
Verified
17 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 5
  • 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…
  • FiniteMemoryStrategyA structure FiniteMemoryStrategy {Q : Type*} {k : ℕ} (G : PrioritizedBorelGame Q k) (pl : BorelGamePlayer) (M : Type*) representing a…
  • HasWinningStrategyInMemThe proposition HasWinningStrategyInMem G m_bound asserts that for a prioritized Borel game G with state space Q and k priorities, there…
  • BorelGamePlayerThe two players in a prioritized Borel game, Eve and Adam.
Used by 1

The proof, explained

In a forward-deterministic prioritized Borel game on a tree, the state reached along any play from the root is uniquely determined by the node path alone. By folding the deterministic transition step along tree paths, the proof defines a canonical node state function and collapses the game to an equivalent one-state game with state type Unit. Using the hypothesis, this one-state game admits a winning strategy with at most b memory states, which is pulled back to a strategy on the original game that makes identical directional choices. Since canonical states are invariant along legal plays, the pullback strategy preserves validity and winning conditions, transferring the memory bound to the original game.

  1. The transition function op1385NextState selects the target state of any edge exiting (v, q) in direction b, and agrees with every valid edge in forward-deterministic games.

    op1385NextState uses classical choice to find an edge in G.edges with source node v, source state q, and direction b, returning its target state (or G.init_state if none exists). Under the forward-determinism hypothesis hforward, lemma op1385_next_state_of_edge shows that any chosen edge matching e on source and direction must reach the same target state as e, so rewriting with dif_pos and Classical.choose_spec proves that op1385NextState equals e.target_state.

    lines 1–20

    uses Classical.choose_spec, dif_pos

    noncomputable def op1385NextState {Q : Type*} {k : ℕ} (G : PrioritizedBorelGame Q k)
        (v : List Bool) (q : Q) (b : Bool) : Q := by
      classical
      exact if h : ∃ e ∈ G.edges, e.source_node = v ∧ e.source_state = q ∧ e.dir = b
        then (Classical.choose h).target_state else G.init_state
    
    lemma op1385_next_state_of_edge {Q : Type*} {k : ℕ} (G : PrioritizedBorelGame Q k)
        (hforward : ∀ e ∈ G.edges, ∀ e' ∈ G.edges,
          e.source_node = e'.source_node → e.source_state = e'.source_state →
          e.dir = e'.dir → e.target_state = e'.target_state)
        (e : TreeGameEdge Q k) (he : e ∈ G.edges) :
        op1385NextState G e.source_node e.source_state e.dir = e.target_state := by
      classical
      have hex : ∃ a ∈ G.edges, a.source_node = e.source_node ∧
          a.source_state = e.source_state ∧ a.dir = e.dir := ⟨e, he, rfl, rfl, rfl⟩
      have hs := Classical.choose_spec hex
      have ht := hforward (Classical.choose hex) hs.1 e he hs.2.1 hs.2.2.1 hs.2.2.2
      unfold op1385NextState
      simp only [dif_pos hex, ht]
    
  2. Tracing transitions from the root along a node path v uniquely determines the path v and the corresponding state op1385NodeState G v, satisfying a step recursion.

    op1385StateStep pairs node concatenation with state transitions, and op1385StatePair folds this step over a path v starting from ([], G.init_state). By reverse list induction using List.foldl_append, op1385_state_pair_node confirms that the accumulated path is v itself. Defining op1385NodeState as the second component, op1385_node_state_snoc unwinds the fold to show that appending b updates the state via op1385NextState.

    lines 21–51

    uses List.foldl_append, op1385_state_pair_node

    noncomputable def op1385StateStep {Q : Type*} {k : ℕ} (G : PrioritizedBorelGame Q k)
        (st : List Bool × Q) (b : Bool) : List Bool × Q :=
      (st.1 ++ [b], op1385NextState G st.1 st.2 b)
    
    noncomputable def op1385StatePair {Q : Type*} {k : ℕ} (G : PrioritizedBorelGame Q k)
        (v : List Bool) : List Bool × Q :=
      v.foldl (op1385StateStep G) ([], G.init_state)
    
    lemma op1385_state_pair_node {Q : Type*} {k : ℕ} (G : PrioritizedBorelGame Q k)
        (v : List Bool) : (op1385StatePair G v).1 = v := by
      induction v using List.reverseRecOn with
      | nil => rfl
      | @append_singleton v b ih =>
        unfold op1385StatePair
        rw [List.foldl_append]
        change (op1385StateStep G (op1385StatePair G v) b).1 = v ++ [b]
        simp [op1385StateStep, ih]
    
    noncomputable def op1385NodeState {Q : Type*} {k : ℕ} (G : PrioritizedBorelGame Q k)
        (v : List Bool) : Q := (op1385StatePair G v).2
    
    lemma op1385_node_state_snoc {Q : Type*} {k : ℕ} (G : PrioritizedBorelGame Q k)
        (v : List Bool) (b : Bool) :
        op1385NodeState G (v ++ [b]) = op1385NextState G v (op1385NodeState G v) b := by
      unfold op1385NodeState op1385StatePair
      rw [List.foldl_append]
      change (op1385StateStep G (op1385StatePair G v) b).2 = _
      change op1385NextState G (op1385StatePair G v).1 (op1385StatePair G v).2 b =
        op1385NextState G v (op1385StatePair G v).2 b
      rw [op1385_state_pair_node]
    
  3. There exists a state-recovery function on tree nodes starting at the initial state and consistent with all legal transitions.

    Theorem op1385_forward_state_recovered exhibits op1385NodeState G as the desired function: at the empty node [] it evaluates to G.init_state by definition, and whenever an edge originates at the canonical state, op1385_node_state_snoc and op1385_next_state_of_edge show that the state at the target node equals the edge's target state.

    lines 52–64

    uses op1385_node_state_snoc, op1385_next_state_of_edge

    theorem op1385_forward_state_recovered {Q : Type*} {k : ℕ} (G : PrioritizedBorelGame Q k)
        (hforward : ∀ e ∈ G.edges, ∀ e' ∈ G.edges,
          e.source_node = e'.source_node → e.source_state = e'.source_state →
          e.dir = e'.dir → e.target_state = e'.target_state) :
        ∃ s : List Bool → Q, s [] = G.init_state ∧
          ∀ e ∈ G.edges, e.source_state = s e.source_node →
            s (e.source_node ++ [e.dir]) = e.target_state := by
      refine ⟨op1385NodeState G, rfl, ?_⟩
      intro e he hs
      rw [op1385_node_state_snoc, ← hs]
      exact op1385_next_state_of_edge G hforward e he
    
    
  4. The one-state reduction game fwdGame G is well-defined on the state space Unit.

    fwdErase replaces an edge's source and target states with the unit value (), preserving nodes, directions, and priorities. The game fwdGame G assigns turn ownership at (v, ()) by querying G.owner at the canonical state (v, op1385NodeState G v), and takes as edges the erasures of edges in G originating at canonical states. Outgoing edges are obtained by taking an outgoing edge from (v, op1385NodeState G v) in G and erasing it.

    lines 65–85

    noncomputable def fwdErase {Q : Type*} {k : ℕ} (e : TreeGameEdge Q k) : TreeGameEdge Unit k where
      source_node := e.source_node
      source_state := ()
      dir := e.dir
      prio := e.prio
      target_state := ()
    
    noncomputable def fwdGame {Q : Type*} {k : ℕ} (G : PrioritizedBorelGame Q k) : PrioritizedBorelGame Unit k where
      owner := fun vq => G.owner (vq.1, op1385NodeState G vq.1)
      init_state := ()
      edges := {e | ∃ a ∈ G.edges, a.source_state = op1385NodeState G a.source_node ∧ fwdErase a = e}
      edges_outgoing := by
        intro v q
        obtain ⟨e, he, hv, hq⟩ := G.edges_outgoing v (op1385NodeState G v)
        refine ⟨fwdErase e, ⟨e, he, ?_, rfl⟩, ?_, ?_⟩
        · simpa [hv] using hq
        · exact hv
        · cases q; rfl
      winning_sets := G.winning_sets
      winning_measurable := G.winning_measurable
    
  5. The edge choice function fwdBackChoice pulls moves in fwdGame G back to valid edges of G.

    fwdBackChoice chooses an edge in G from (v, q) that erases to the strategy's prescribed move in fwdGame G if such an edge exists, and otherwise defaults to an arbitrary outgoing edge from (v, q). Case analysis in fwd_back_choice_valid confirms that in either case, Classical.choose_spec ensures the resulting edge belongs to G.edges with source node v and source state q.

    lines 86–106

    uses Classical.choose_spec

    noncomputable def fwdBackChoice {Q : Type*} {M : Type} {k : ℕ} (G : PrioritizedBorelGame Q k)
        (pl : BorelGamePlayer) (σ : FiniteMemoryStrategy (fwdGame G) pl M)
        (m : M) (v : List Bool) (q : Q) : TreeGameEdge Q k := by
      classical
      exact if h : ∃ e ∈ G.edges, e.source_node = v ∧ e.source_state = q ∧
          fwdErase e = σ.choice m v () then Classical.choose h
        else Classical.choose (G.edges_outgoing v q)
    
    lemma fwd_back_choice_valid {Q : Type*} {M : Type} {k : ℕ} (G : PrioritizedBorelGame Q k)
        (pl : BorelGamePlayer) (σ : FiniteMemoryStrategy (fwdGame G) pl M)
        (m : M) (v : List Bool) (q : Q) :
        fwdBackChoice G pl σ m v q ∈ G.edges ∧
          (fwdBackChoice G pl σ m v q).source_node = v ∧
          (fwdBackChoice G pl σ m v q).source_state = q := by
      classical
      unfold fwdBackChoice
      split
      · rename_i h
        exact ⟨(Classical.choose_spec h).1, (Classical.choose_spec h).2.1, (Classical.choose_spec h).2.2.1⟩
      · exact Classical.choose_spec (G.edges_outgoing v q)
    
  6. At canonical node states owned by the player, erasing the pulled-back edge reproduces the one-state strategy's move.

    When q = op1385NodeState G v and G.owner (v, q) = pl, the one-state game node (v, ()) is owned by pl, so the strategy's chosen edge is an erasure of some legal edge in G from (v, q). Evaluating fwdBackChoice on this state satisfies the existence condition, so rewriting with dif_pos and Classical.choose_spec shows that erasing the chosen edge returns σ.choice m v ().

    lines 107–122

    uses congrArg, dif_pos, Classical.choose_spec

    lemma fwd_back_choice_erases {Q : Type*} {M : Type} {k : ℕ} (G : PrioritizedBorelGame Q k)
        (pl : BorelGamePlayer) (σ : FiniteMemoryStrategy (fwdGame G) pl M)
        (m : M) (v : List Bool) (q : Q) (hq : q = op1385NodeState G v)
        (ho : G.owner (v,q) = pl) : fwdErase (fwdBackChoice G pl σ m v q) = σ.choice m v () := by
      classical
      have hH : (fwdGame G).owner (v,()) = pl := by simpa [fwdGame, ← hq] using ho
      have hs := σ.choice_edge m v () hH
      obtain ⟨e, he, hstate, herase⟩ := hs.1
      have hv : e.source_node = v := by
        simpa [fwdErase, hs.2.1] using congrArg TreeGameEdge.source_node herase
      have heq : ∃ e ∈ G.edges, e.source_node = v ∧ e.source_state = q ∧
          fwdErase e = σ.choice m v () := ⟨e, he, hv, by simpa [hv, hq] using hstate, herase⟩
      unfold fwdBackChoice
      rw [dif_pos heq]
      exact (Classical.choose_spec heq).2.2.2
    
  7. fwdBackStrategy defines a valid finite-memory strategy for G using the same memory type M.

    fwdBackStrategy retains the initial memory and state update rule of σ (passing erased edges to update), while using fwdBackChoice for edge selection. The required validity of chosen edges is provided by fwd_back_choice_valid.

    lines 123–131

    uses fwd_back_choice_valid

    noncomputable def fwdBackStrategy {Q : Type*} {M : Type} {k : ℕ} (G : PrioritizedBorelGame Q k)
        (pl : BorelGamePlayer) (σ : FiniteMemoryStrategy (fwdGame G) pl M) : FiniteMemoryStrategy G pl M where
      init_mem := σ.init_mem
      update := fun m e => σ.update m (fwdErase e)
      choice := fwdBackChoice G pl σ
      choice_edge := by
        intro m v q _
        exact fwd_back_choice_valid G pl σ m v q
    
  8. To transfer a winning strategy from fwdGame G to G, it suffices to analyze an arbitrary play consistent with fwdBackStrategy.

    Given a winning strategy σ for fwdGame G with at most b memory states, we define τ = fwdBackStrategy G pl σ with the same memory type M. We then consider an arbitrary infinite play π in G that is legal, starts at the initial node and state, connects consecutive steps, and follows τ.

    lines 132–140

    theorem fwd_strategy_transfer {Q : Type*} {k : ℕ} (G : PrioritizedBorelGame Q k)
        (hforward : ∀ e ∈ G.edges, ∀ e' ∈ G.edges,
          e.source_node = e'.source_node → e.source_state = e'.source_state →
          e.dir = e'.dir → e.target_state = e'.target_state)
        (b : ℕ) (hwin : HasWinningStrategyInMem (fwdGame G) b) : HasWinningStrategyInMem G b := by
      obtain ⟨pl, M, inst, hcard, σ, hσ⟩ := hwin
      letI : Fintype M := inst
      let τ := fwdBackStrategy G pl σ
      refine ⟨pl, M, inst, hcard, τ, ?_⟩
  9. Along any play π, the source state at step n is always the canonical state op1385NodeState G (π n).source_node.

    This is proved by induction on n. At n = 0, the play starts at node [] in state G.init_state, matching op1385NodeState G []. In the inductive step, the successor node appends the direction of edge π n, and by op1385_node_state_snoc and op1385_next_state_of_edge together with the induction hypothesis, the canonical state updates to the target state of π n.

    lines 141–150

    uses op1385_node_state_snoc, op1385_next_state_of_edge

      intro π hlegal hinit hnext hfollow
      have hstate : ∀ n, (π n).source_state = op1385NodeState G (π n).source_node := by
        intro n
        induction n with
        | zero =>
          rw [hinit.1, hinit.2]
          rfl
        | succ n ih =>
          rw [(hnext n).1, (hnext n).2, op1385_node_state_snoc, ← ih]
          exact (op1385_next_state_of_edge G hforward (π n) (hlegal n)).symm
  10. The erased play fwdErase ∘ π is a legal play in fwdGame G starting from the initial configuration.

    Because every step of π begins at the canonical state, each erased edge belongs to (fwdGame G).edges by definition. Moreover, the erased play starts at node [] with state () and maintains step-to-step node concatenation and target-to-source unit state matching.

    lines 151–161

      have hHlegal : ∀ n, fwdErase (π n) ∈ (fwdGame G).edges := by
        intro n
        exact ⟨π n, hlegal n, hstate n, rfl⟩
      have hHinit : (fwdErase (π 0)).source_node = [] ∧
          (fwdErase (π 0)).source_state = (fwdGame G).init_state := by
        exact ⟨hinit.1, rfl⟩
      have hHnext : ∀ n, (fwdErase (π (n+1))).source_node =
          (fwdErase (π n)).source_node ++ [(fwdErase (π n)).dir] ∧
          (fwdErase (π (n+1))).source_state = (fwdErase (π n)).target_state := by
        intro n
        exact ⟨(hnext n).1, rfl⟩
  11. The erased play follows the strategy σ in fwdGame G at all player turns.

    The memory sequence along π mirrors the update rule of σ. Whenever player pl owns a turn in fwdGame G, the canonical state equality implies that pl also owns the turn in G, and fwd_back_choice_erases ensures that the erased edge matches σ.choice.

    lines 162–173

    uses congrArg, fwd_back_choice_erases

      have hHfollow : ∃ mem : ℕ → M, mem 0 = σ.init_mem ∧
          (∀ n, mem (n+1) = σ.update (mem n) (fwdErase (π n))) ∧
          (∀ n, (fwdGame G).owner ((fwdErase (π n)).source_node, (fwdErase (π n)).source_state) = pl →
            fwdErase (π n) = σ.choice (mem n) (fwdErase (π n)).source_node (fwdErase (π n)).source_state) := by
        obtain ⟨mem, hm0, hmupdate, hmchoice⟩ := hfollow
        refine ⟨mem, hm0, hmupdate, ?_⟩
        intro n ho
        have ho' : G.owner ((π n).source_node, (π n).source_state) = pl := by
          simpa [fwdGame, fwdErase, ← hstate n] using ho
        have hc := hmchoice n ho'
        change π n = fwdBackChoice G pl σ (mem n) (π n).source_node (π n).source_state at hc
        exact (congrArg fwdErase hc).trans (fwd_back_choice_erases G pl σ (mem n) (π n).source_node (π n).source_state (hstate n) ho')
  12. The original play π satisfies the winning condition in G for player pl. automation

    Since σ is winning for pl in fwdGame G, the erased play satisfies the parity condition and belongs to the corresponding winning set. Because fwdErase preserves edge priorities and directions, and winning sets in fwdGame G and G are identical, pl also wins the play π in G.

    lines 174–176

      have hw := hσ (fun n => fwdErase (π n)) hHlegal hHinit hHnext hHfollow
      cases pl <;> simpa [fwdGame, fwdErase] using hw
    
  13. Every forward-deterministic prioritized Borel game has a winning strategy with memory bound b whenever all one-state games do.

    Applying the hypothesis hone to the one-state reduction fwdGame G yields a winning strategy of size at most b, and invoking fwd_strategy_transfer transfers this strategy to G while preserving the memory bound.

    lines 177–184

    uses fwd_strategy_transfer

    theorem prioritized_borel_forward_deterministic_one_state_reduction {Q : Type*} {k : ℕ}
        (G : PrioritizedBorelGame Q k) (b : ℕ)
        (hforward : ∀ e ∈ G.edges, ∀ e' ∈ G.edges,
          e.source_node = e'.source_node → e.source_state = e'.source_state →
          e.dir = e'.dir → e.target_state = e'.target_state)
        (hone : ∀ H : PrioritizedBorelGame Unit k, HasWinningStrategyInMem H b) :
        HasWinningStrategyInMem G b := by
      exact fwd_strategy_transfer G hforward b (hone (fwdGame G))
Classical.choose_spec
Given an existence proof h : ∃ x, p x, the chosen element Classical.choose h satisfies the property p.
dif_pos
If a proposition c holds, then the dependent if-then-else dite c t e evaluates to the then-branch t hc.
List.foldl_append
Folding a function over the concatenation of two lists l ++ l' equals folding over l first, then folding over l' starting from the accumulated result.
op1385_state_pair_node
For any tree node v, the first component of the state pair accumulated by op1385StatePair G v is the node path v itself.
op1385_node_state_snoc
Extending a tree path v by a direction b updates the node state via op1385NextState applied to v, the current node state, and b.
op1385_next_state_of_edge
In a forward-deterministic game, evaluating op1385NextState at the source node, source state, and direction of any legal edge yields that edge's target state.
congrArg
Applying a function to equal inputs yields equal outputs: if a₁ = a₂, then f a₁ = f a₂.
fwd_back_choice_valid
The pulled-back move fwdBackChoice belongs to G.edges and has the required source node v and source state q.
fwd_back_choice_erases
At any canonical node state owned by player pl, erasing the edge chosen by fwdBackChoice matches the one-state strategy's choice.
fwd_strategy_transfer
If a prioritized Borel game is forward-deterministic, any finite-memory winning strategy with bound b for fwdGame G transfers to a winning strategy for G with the same memory bound b.

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

noncomputable def op1385NextState {Q : Type*} {k : ℕ} (G : PrioritizedBorelGame Q k)    (v : List Bool) (q : Q) (b : Bool) : Q := by  classical  exact if h : ∃ e ∈ G.edges, e.source_node = v ∧ e.source_state = q ∧ e.dir = b    then (Classical.choose h).target_state else G.init_statelemma op1385_next_state_of_edge {Q : Type*} {k : ℕ} (G : PrioritizedBorelGame Q k)    (hforward : ∀ e ∈ G.edges, ∀ e' ∈ G.edges,      e.source_node = e'.source_node → e.source_state = e'.source_state →      e.dir = e'.dir → e.target_state = e'.target_state)    (e : TreeGameEdge Q k) (he : e ∈ G.edges) :    op1385NextState G e.source_node e.source_state e.dir = e.target_state := by  classical  have hex : ∃ a ∈ G.edges, a.source_node = e.source_node ∧      a.source_state = e.source_state ∧ a.dir = e.dir := ⟨e, he, rfl, rfl, rfl⟩  have hs := Classical.choose_spec hex  have ht := hforward (Classical.choose hex) hs.1 e he hs.2.1 hs.2.2.1 hs.2.2.2  unfold op1385NextState  simp only [dif_pos hex, ht]noncomputable def op1385StateStep {Q : Type*} {k : ℕ} (G : PrioritizedBorelGame Q k)    (st : List Bool × Q) (b : Bool) : List Bool × Q :=  (st.1 ++ [b], op1385NextState G st.1 st.2 b)noncomputable def op1385StatePair {Q : Type*} {k : ℕ} (G : PrioritizedBorelGame Q k)    (v : List Bool) : List Bool × Q :=  v.foldl (op1385StateStep G) ([], G.init_state)lemma op1385_state_pair_node {Q : Type*} {k : ℕ} (G : PrioritizedBorelGame Q k)    (v : List Bool) : (op1385StatePair G v).1 = v := by  induction v using List.reverseRecOn with  | nil => rfl  | @append_singleton v b ih =>    unfold op1385StatePair    rw [List.foldl_append]    change (op1385StateStep G (op1385StatePair G v) b).1 = v ++ [b]    simp [op1385StateStep, ih]noncomputable def op1385NodeState {Q : Type*} {k : ℕ} (G : PrioritizedBorelGame Q k)    (v : List Bool) : Q := (op1385StatePair G v).2lemma op1385_node_state_snoc {Q : Type*} {k : ℕ} (G : PrioritizedBorelGame Q k)    (v : List Bool) (b : Bool) :    op1385NodeState G (v ++ [b]) = op1385NextState G v (op1385NodeState G v) b := by  unfold op1385NodeState op1385StatePair  rw [List.foldl_append]  change (op1385StateStep G (op1385StatePair G v) b).2 = _  change op1385NextState G (op1385StatePair G v).1 (op1385StatePair G v).2 b =    op1385NextState G v (op1385StatePair G v).2 b  rw [op1385_state_pair_node]theorem op1385_forward_state_recovered {Q : Type*} {k : ℕ} (G : PrioritizedBorelGame Q k)    (hforward : ∀ e ∈ G.edges, ∀ e' ∈ G.edges,      e.source_node = e'.source_node → e.source_state = e'.source_state →      e.dir = e'.dir → e.target_state = e'.target_state) :    ∃ s : List Bool → Q, s [] = G.init_state ∧      ∀ e ∈ G.edges, e.source_state = s e.source_node →        s (e.source_node ++ [e.dir]) = e.target_state := by  refine ⟨op1385NodeState G, rfl, ?_⟩  intro e he hs  rw [op1385_node_state_snoc, ← hs]  exact op1385_next_state_of_edge G hforward e henoncomputable def fwdErase {Q : Type*} {k : ℕ} (e : TreeGameEdge Q k) : TreeGameEdge Unit k where  source_node := e.source_node  source_state := ()  dir := e.dir  prio := e.prio  target_state := ()noncomputable def fwdGame {Q : Type*} {k : ℕ} (G : PrioritizedBorelGame Q k) : PrioritizedBorelGame Unit k where  owner := fun vq => G.owner (vq.1, op1385NodeState G vq.1)  init_state := ()  edges := {e | ∃ a ∈ G.edges, a.source_state = op1385NodeState G a.source_node ∧ fwdErase a = e}  edges_outgoing := by    intro v q    obtain ⟨e, he, hv, hq⟩ := G.edges_outgoing v (op1385NodeState G v)    refine ⟨fwdErase e, ⟨e, he, ?_, rfl⟩, ?_, ?_⟩    · simpa [hv] using hq    · exact hv    · cases q; rfl  winning_sets := G.winning_sets  winning_measurable := G.winning_measurablenoncomputable def fwdBackChoice {Q : Type*} {M : Type} {k : ℕ} (G : PrioritizedBorelGame Q k)    (pl : BorelGamePlayer) (σ : FiniteMemoryStrategy (fwdGame G) pl M)    (m : M) (v : List Bool) (q : Q) : TreeGameEdge Q k := by  classical  exact if h : ∃ e ∈ G.edges, e.source_node = v ∧ e.source_state = q ∧      fwdErase e = σ.choice m v () then Classical.choose h    else Classical.choose (G.edges_outgoing v q)lemma fwd_back_choice_valid {Q : Type*} {M : Type} {k : ℕ} (G : PrioritizedBorelGame Q k)    (pl : BorelGamePlayer) (σ : FiniteMemoryStrategy (fwdGame G) pl M)    (m : M) (v : List Bool) (q : Q) :    fwdBackChoice G pl σ m v q ∈ G.edges ∧      (fwdBackChoice G pl σ m v q).source_node = v ∧      (fwdBackChoice G pl σ m v q).source_state = q := by  classical  unfold fwdBackChoice  split  · rename_i h    exact ⟨(Classical.choose_spec h).1, (Classical.choose_spec h).2.1, (Classical.choose_spec h).2.2.1⟩  · exact Classical.choose_spec (G.edges_outgoing v q)lemma fwd_back_choice_erases {Q : Type*} {M : Type} {k : ℕ} (G : PrioritizedBorelGame Q k)    (pl : BorelGamePlayer) (σ : FiniteMemoryStrategy (fwdGame G) pl M)    (m : M) (v : List Bool) (q : Q) (hq : q = op1385NodeState G v)    (ho : G.owner (v,q) = pl) : fwdErase (fwdBackChoice G pl σ m v q) = σ.choice m v () := by  classical  have hH : (fwdGame G).owner (v,()) = pl := by simpa [fwdGame, ← hq] using ho  have hs := σ.choice_edge m v () hH  obtain ⟨e, he, hstate, herase⟩ := hs.1  have hv : e.source_node = v := by    simpa [fwdErase, hs.2.1] using congrArg TreeGameEdge.source_node herase  have heq : ∃ e ∈ G.edges, e.source_node = v ∧ e.source_state = q ∧      fwdErase e = σ.choice m v () := ⟨e, he, hv, by simpa [hv, hq] using hstate, herase⟩  unfold fwdBackChoice  rw [dif_pos heq]  exact (Classical.choose_spec heq).2.2.2noncomputable def fwdBackStrategy {Q : Type*} {M : Type} {k : ℕ} (G : PrioritizedBorelGame Q k)    (pl : BorelGamePlayer) (σ : FiniteMemoryStrategy (fwdGame G) pl M) : FiniteMemoryStrategy G pl M where  init_mem := σ.init_mem  update := fun m e => σ.update m (fwdErase e)  choice := fwdBackChoice G pl σ  choice_edge := by    intro m v q _    exact fwd_back_choice_valid G pl σ m v qtheorem fwd_strategy_transfer {Q : Type*} {k : ℕ} (G : PrioritizedBorelGame Q k)    (hforward : ∀ e ∈ G.edges, ∀ e' ∈ G.edges,      e.source_node = e'.source_node → e.source_state = e'.source_state →      e.dir = e'.dir → e.target_state = e'.target_state)    (b : ℕ) (hwin : HasWinningStrategyInMem (fwdGame G) b) : HasWinningStrategyInMem G b := by  obtain ⟨pl, M, inst, hcard, σ, hσ⟩ := hwin  letI : Fintype M := inst  let τ := fwdBackStrategy G pl σ  refine ⟨pl, M, inst, hcard, τ, ?_⟩  intro π hlegal hinit hnext hfollow  have hstate : ∀ n, (π n).source_state = op1385NodeState G (π n).source_node := by    intro n    induction n with    | zero =>      rw [hinit.1, hinit.2]      rfl    | succ n ih =>      rw [(hnext n).1, (hnext n).2, op1385_node_state_snoc, ← ih]      exact (op1385_next_state_of_edge G hforward (π n) (hlegal n)).symm  have hHlegal : ∀ n, fwdErase (π n) ∈ (fwdGame G).edges := by    intro n    exact ⟨π n, hlegal n, hstate n, rfl⟩  have hHinit : (fwdErase (π 0)).source_node = [] ∧      (fwdErase (π 0)).source_state = (fwdGame G).init_state := by    exact ⟨hinit.1, rfl⟩  have hHnext : ∀ n, (fwdErase (π (n+1))).source_node =      (fwdErase (π n)).source_node ++ [(fwdErase (π n)).dir] ∧      (fwdErase (π (n+1))).source_state = (fwdErase (π n)).target_state := by    intro n    exact ⟨(hnext n).1, rfl⟩  have hHfollow : ∃ mem : ℕ → M, mem 0 = σ.init_mem ∧      (∀ n, mem (n+1) = σ.update (mem n) (fwdErase (π n))) ∧      (∀ n, (fwdGame G).owner ((fwdErase (π n)).source_node, (fwdErase (π n)).source_state) = pl →        fwdErase (π n) = σ.choice (mem n) (fwdErase (π n)).source_node (fwdErase (π n)).source_state) := by    obtain ⟨mem, hm0, hmupdate, hmchoice⟩ := hfollow    refine ⟨mem, hm0, hmupdate, ?_⟩    intro n ho    have ho' : G.owner ((π n).source_node, (π n).source_state) = pl := by      simpa [fwdGame, fwdErase, ← hstate n] using ho    have hc := hmchoice n ho'    change π n = fwdBackChoice G pl σ (mem n) (π n).source_node (π n).source_state at hc    exact (congrArg fwdErase hc).trans (fwd_back_choice_erases G pl σ (mem n) (π n).source_node (π n).source_state (hstate n) ho')  have hw := hσ (fun n => fwdErase (π n)) hHlegal hHinit hHnext hHfollow  cases pl <;> simpa [fwdGame, fwdErase] using hwtheorem prioritized_borel_forward_deterministic_one_state_reduction {Q : Type*} {k : ℕ}    (G : PrioritizedBorelGame Q k) (b : ℕ)    (hforward : ∀ e ∈ G.edges, ∀ e' ∈ G.edges,      e.source_node = e'.source_node → e.source_state = e'.source_state →      e.dir = e'.dir → e.target_state = e'.target_state)    (hone : ∀ H : PrioritizedBorelGame Unit k, HasWinningStrategyInMem H b) :    HasWinningStrategyInMem G b := by  exact fwd_strategy_transfer G hforward b (hone (fwdGame G))
See it in the graphDiscuss this resultChallenge it