AFTD Auto-Formalizing Theoretical Domains

prioritized_borel_state_history_extend

theoremverified

Any legal state history to a node and state extends along a legal outgoing edge to a legal state history at the child and target state, retaining all previously recorded states.

Statement

theorem prioritized_borel_state_history_extend {Q : Type} {k : ℕ} (G : PrioritizedBorelGame Q k) (v : List Bool) (q : Q) (h : Fin (v.length + 1) → Q) (hh : h ∈ op1385StateHistories G v q) (e : TreeGameEdge Q k) (he : e ∈ G.edges) (hv : e.source_node = v) (hq : e.source_state = q) : ∃ h' ∈ op1385StateHistories G (v ++ [e.dir]) e.target_state, ∀ i : Fin (v.length + 1), h' ⟨i.val, by simp⟩ = h i
Source
History update in the bounded-state-history reduction for arXiv:2611.10136, Conjecture 19.
Verified
17 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 3
  • 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…
  • prioritized_borel_reverse_state_histories_uniqueIf a tree-game edge is reverse-deterministic in the state at each fixed parent node and child direction, then at most one state history…
Used by 1

The proof, explained

We extend the valid state history h to the extended node v ++ [e.dir] by defining h' piecewise: on all indices corresponding to the prefix v, h' preserves the states recorded by h, and at the final new index, h' records the target state of the outgoing edge e. We then verify the four defining conditions of a legal state history. The initial state is preserved because 0 < |v| + 1, the final state is e.target_state by construction, and previous history entries are retained. For transitions along the prefix v, legality is inherited directly from the original history h, while the newly appended transition is witnessed by the edge e.

  1. Define the candidate extended history h', establish its values on indices, and provide it as the witness, reducing the theorem to the four defining properties of a legal state history.

    We define the extended state history `h' : Fin ((v ++ [e.dir]).length + 1) → Q` by cases: for any index j whose numerical value is strictly less than `v.length + 1`, `h' j` evaluates to `h ⟨j.val, hj⟩`; otherwise, it evaluates to `e.target_state`. Applying `dif_pos` and `dif_neg` establishes these two rules as local lemmas: `h'_lt` asserts that `h' j = h ⟨j.val, hj⟩` when `j.val < v.length + 1`, and `h'_ge` asserts that `h' j = e.target_state` otherwise. Finally, `refine` instantiates the existential goal with `h'` and decomposes the requirement `h' ∈ op1385StateHistories ...` into four obligations: the initial state condition, the final state condition, the step transition conditions, and the requirement that `h'` extends `h`.

    lines 1–8

    uses dif_pos, dif_neg

    theorem prioritized_borel_state_history_extend {Q : Type} {k : ℕ} (G : PrioritizedBorelGame Q k) (v : List Bool) (q : Q) (h : Fin (v.length + 1) → Q) (hh : h ∈ op1385StateHistories G v q) (e : TreeGameEdge Q k) (he : e ∈ G.edges) (hv : e.source_node = v) (hq : e.source_state = q) : ∃ h' ∈ op1385StateHistories G (v ++ [e.dir]) e.target_state, ∀ i : Fin (v.length + 1), h' ⟨i.val, by simp⟩ = h i := by
      let h' : Fin ((v ++ [e.dir]).length + 1) → Q := fun j =>
        if hj : j.val < v.length + 1 then h ⟨j.val, hj⟩ else e.target_state
      have h'_lt : ∀ (j : Fin ((v ++ [e.dir]).length + 1)) (hj : j.val < v.length + 1),
          h' j = h ⟨j.val, hj⟩ := fun j hj => dif_pos hj
      have h'_ge : ∀ (j : Fin ((v ++ [e.dir]).length + 1)) (hj : ¬ (j.val < v.length + 1)),
          h' j = e.target_state := fun j hj => dif_neg hj
      refine ⟨h', ⟨?_h_init, ?_h_last, ?_h_step⟩, ?_h_rest⟩
  2. The extended history h' starts at the game's initial state: h' 0 = G.init_state.

    Because `0 < v.length + 1` by `Nat.succ_pos`, rule `h'_lt` rewrites `h' 0` to `h 0`. Since `h` is a valid state history for `v`, its initial state `h 0` is indeed `G.init_state`.

    lines 9–11

    uses Nat.succ_pos

      case _h_init =>
        rw [h'_lt 0 (Nat.succ_pos _)]
        exact hh.1
  3. The extended history h' ends at e.target_state.

    The final index `Fin.last (v ++ [e.dir]).length` has numerical value `v.length + 1`. Since this value is not strictly less than `v.length + 1`, rule `h'_ge` applies directly to show that `h'` evaluated at this last index equals `e.target_state`.

    lines 12–14

      case _h_last =>
        apply h'_ge
        simp
  4. The extended history h' agrees with h on all original indices: h' i = h i for each i < v.length + 1.

    For an arbitrary index `i : Fin (v.length + 1)`, its numerical value is strictly less than `v.length + 1` by definition (`i.is_lt`). Applying rule `h'_lt` immediately yields `h' ⟨i.val, ...⟩ = h i`.

    lines 15–17

      case _h_rest =>
        intro i
        apply h'_lt ⟨i.val, by simp⟩ i.is_lt
  5. For every step index i < v.length, the transition under h' is valid and witnessed by the edge from h.

    We fix an arbitrary step index `i : Fin (v ++ [e.dir]).length` and assume `i.val < v.length`. This gives an index `i₀ : Fin v.length`. Since `h` is a valid history on `v`, there is an edge `e' ∈ G.edges` with the appropriate endpoints and label. We check that `e'` also validates step `i` for `h'`: its source node matches because `take i (v ++ [e.dir]) = take i v` by `List.take_append_of_le_length`; its source state matches because `h' i.castSucc = h i₀.castSucc` by `h'_lt`; its direction matches because `(v ++ [e.dir]).get i = v.get i₀` by `List.get_eq_getElem` and `List.getElem_append_left`; and its target state matches because `h' i.succ = h i₀.succ` by `h'_lt`.

    lines 18–35

    uses List.take_append_of_le_length, List.get_eq_getElem, List.getElem_append_left

      case _h_step =>
        intro i
        by_cases hi : i.val < v.length
        · let i₀ : Fin v.length := ⟨i.val, hi⟩
          obtain ⟨e', he', hnode, hsrc, hdir, htgt⟩ := hh.2.2 i₀
          refine ⟨e', he', ?_, ?_, ?_, ?_⟩
          · rw [hnode]
            exact (List.take_append_of_le_length (by omega)).symm
          · rw [hsrc]
            have h1 : i.castSucc.val < v.length + 1 := by simp; omega
            rw [h'_lt i.castSucc h1]
            congr 1
          · rw [hdir]
            rw [List.get_eq_getElem, List.get_eq_getElem, List.getElem_append_left hi]
          · rw [htgt]
            have h2 : i.succ.val < v.length + 1 := by simp; omega
            rw [h'_lt i.succ h2]
            congr 1
  6. For the final step index i = v.length, the transition under h' is valid and witnessed by the edge e.

    In the remaining case where `¬ (i.val < v.length)`, since `i.val < v.length + 1`, linear arithmetic forces `i.val = v.length`, so `i = ⟨v.length, ...⟩` by `Fin.ext`. We witness this step with the incoming edge `e ∈ G.edges`: its source node is `e.source_node = v`, which equals `take (v.length) (v ++ [e.dir])`; its source state is `e.source_state = q`, which equals the final state of `h` and thus `h' i.castSucc` by `h'_lt`; its direction is `e.dir`, which is the element at index `v.length` in `v ++ [e.dir]` by `List.get_eq_getElem`; and its target state is `e.target_state`, which equals `h' i.succ` by `h'_ge` since `i.succ.val = v.length + 1`.

    lines 36–51

    uses Fin.ext, List.get_eq_getElem

        · have hi_le : i.val ≤ v.length := by
            have := i.is_lt
            simp at this
            exact this
          have hi_eq : i.val = v.length := by omega
          have hi_fin : i = ⟨v.length, by simp⟩ := Fin.ext hi_eq
          subst hi_fin
          refine ⟨e, he, ?_, ?_, ?_, ?_⟩
          · rw [hv]
            simp
          · rw [hq, ← hh.2.1]
            have h1 : (⟨v.length, by simp⟩ : Fin (v ++ [e.dir]).length).castSucc.val < v.length + 1 := by simp
            rw [h'_lt _ h1]
            congr 1
          · simp [List.get_eq_getElem]
          · rw [h'_ge _ (by simp)]
dif_pos
In a dependent conditional expression `if c then t else e`, if the condition `c` holds, the expression reduces to `t`.
dif_neg
In a dependent conditional expression `if c then t else e`, if the condition `c` is false, the expression reduces to `e`.
Nat.succ_pos
For any natural number n, its successor n + 1 is strictly positive.
List.take_append_of_le_length
Taking the prefix of length i of a concatenated list l₁ ++ l₂ is equal to taking the prefix of length i of l₁, provided i ≤ |l₁|.
List.get_eq_getElem
Indexing a list using `get` on a `Fin` index is equal to the element indexing operation `l[i]`.
List.getElem_append_left
The i-th element of a concatenated list as ++ bs is equal to the i-th element of as, provided i < |as|.
Fin.ext
Two elements of `Fin n` are equal if and only if their underlying natural values are equal.

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_state_history_extend {Q : Type} {k : ℕ} (G : PrioritizedBorelGame Q k) (v : List Bool) (q : Q) (h : Fin (v.length + 1) → Q) (hh : h ∈ op1385StateHistories G v q) (e : TreeGameEdge Q k) (he : e ∈ G.edges) (hv : e.source_node = v) (hq : e.source_state = q) : ∃ h' ∈ op1385StateHistories G (v ++ [e.dir]) e.target_state, ∀ i : Fin (v.length + 1), h' ⟨i.val, by simp⟩ = h i := by  let h' : Fin ((v ++ [e.dir]).length + 1) → Q := fun j =>    if hj : j.val < v.length + 1 then h ⟨j.val, hj⟩ else e.target_state  have h'_lt : ∀ (j : Fin ((v ++ [e.dir]).length + 1)) (hj : j.val < v.length + 1),      h' j = h ⟨j.val, hj⟩ := fun j hj => dif_pos hj  have h'_ge : ∀ (j : Fin ((v ++ [e.dir]).length + 1)) (hj : ¬ (j.val < v.length + 1)),      h' j = e.target_state := fun j hj => dif_neg hj  refine ⟨h', ⟨?_h_init, ?_h_last, ?_h_step⟩, ?_h_rest⟩  case _h_init =>    rw [h'_lt 0 (Nat.succ_pos _)]    exact hh.1  case _h_last =>    apply h'_ge    simp  case _h_rest =>    intro i    apply h'_lt ⟨i.val, by simp⟩ i.is_lt  case _h_step =>    intro i    by_cases hi : i.val < v.length    · let i₀ : Fin v.length := ⟨i.val, hi⟩      obtain ⟨e', he', hnode, hsrc, hdir, htgt⟩ := hh.2.2 i₀      refine ⟨e', he', ?_, ?_, ?_, ?_⟩      · rw [hnode]        exact (List.take_append_of_le_length (by omega)).symm      · rw [hsrc]        have h1 : i.castSucc.val < v.length + 1 := by simp; omega        rw [h'_lt i.castSucc h1]        congr 1      · rw [hdir]        rw [List.get_eq_getElem, List.get_eq_getElem, List.getElem_append_left hi]      · rw [htgt]        have h2 : i.succ.val < v.length + 1 := by simp; omega        rw [h'_lt i.succ h2]        congr 1    · have hi_le : i.val ≤ v.length := by        have := i.is_lt        simp at this        exact this      have hi_eq : i.val = v.length := by omega      have hi_fin : i = ⟨v.length, by simp⟩ := Fin.ext hi_eq      subst hi_fin      refine ⟨e, he, ?_, ?_, ?_, ?_⟩      · rw [hv]        simp      · rw [hq, ← hh.2.1]        have h1 : (⟨v.length, by simp⟩ : Fin (v ++ [e.dir]).length).castSucc.val < v.length + 1 := by simp        rw [h'_lt _ h1]        congr 1      · simp [List.get_eq_getElem]      · rw [h'_ge _ (by simp)]
See it in the graphDiscuss this resultChallenge it