prioritized_borel_encoding_trace_extend
Extending a state history by an edge extends its encoded node by the edge's direction-and-target block.
Statement
theorem prioritized_borel_encoding_trace_extend {Q : Type} [Fintype Q] (v : List Bool) (h : Fin (v.length + 1) → Q) (e : TreeGameEdge Q 3) (h' : Fin ((v ++ [e.dir]).length + 1) → Q) (hpre : ∀ i : Fin (v.length + 1), h' ⟨i.val, by simp⟩ = h i) (hlast : h' (Fin.last (v ++ [e.dir]).length) = e.target_state) : enc1385Trace (v ++ [e.dir]) h' = enc1385Trace v h ++ enc1385Block e
- Source
- Phase-state encoding for arXiv:2611.10136, Conjecture 19.
- Verified
- 17 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 3
- enc1385TraceEncode a visible node and its state history as successive blocks, each containing the visible direction followed by the one-hot code of…
- enc1385GameGiven a finite-state three-priority tree game, construct a phase-state game that encodes each original direction followed by a one-hot…
- 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 1
- prioritized_borel_bounded_history_trace_trackerIf at most d legal state histories reach each position, an index in Fin d recovers the accumulated encoded branch from the visible…
The proof, explained
The trace encoding `enc1385Trace` flattens a list of direction-and-state blocks. Using `List.flatten_concat` and congruence, the equality of flattened traces reduces to equality of the underlying block lists, which is established elementwise via `List.ext_getElem`. For indices i < |v|, the blocks match because the state history h' extends h on the prefix by hypothesis `hpre`; for the final index i = |v|, the block extracts the new edge's direction and target state by hypothesis `hlast`.
The traces are equal if the unflattened list of blocks for the extended trace equals the original list of blocks with the new edge block appended.
Unfolding the definitions of `enc1385Trace` and `enc1385Block` expresses each trace as the flattening of a list of direction-and-state blocks. Using `List.flatten_concat`, appending the new block to the original trace is rewritten as the flattening of the concatenated list of blocks. Congruence (`congr 1`) then reduces equality of the flattened traces to showing that the unflattened block lists are equal. (The inline `simp` on line 1 verifies that indices in Fin (v.length + 1) embed into Fin ((v ++ [e.dir]).length + 1).)
uses
List.flatten_concattheorem prioritized_borel_encoding_trace_extend {Q : Type} [Fintype Q] (v : List Bool) (h : Fin (v.length + 1) → Q) (e : TreeGameEdge Q 3) (h' : Fin ((v ++ [e.dir]).length + 1) → Q) (hpre : ∀ i : Fin (v.length + 1), h' ⟨i.val, by simp⟩ = h i) (hlast : h' (Fin.last (v ++ [e.dir]).length) = e.target_state) : enc1385Trace (v ++ [e.dir]) h' = enc1385Trace v h ++ enc1385Block e := by dsimp [enc1385Trace, enc1385Block] rw [← List.flatten_concat] congr 1
The two block lists have equal lengths, leaving their elements to be checked index by index.
By list extensionality (`List.ext_getElem`), two lists are equal if their lengths match and their elements agree at each index. The length equality is verified immediately by simplification (`simp`), as both lists have length |v| + 1.
uses
List.ext_getElemapply List.ext_getElem · simp
For an arbitrary index i, the i-th block of the extended trace is (v ++ [e.dir])[i] :: enc1385StateCode (h' (i + 1)).
We introduce the index i and its validity bounds. Rewriting with `List.getElem_ofFn` evaluates the generator function of `List.ofFn` at index i.
uses
List.getElem_ofFn· intro i hi1 hi2 rw [List.getElem_ofFn]
For any index i < |v|, the i-th block of the extended trace equals the i-th block of the original trace.
We split into cases on whether i < |v|. When i < |v|, indexing into v ++ [e.dir] extracts v[i] by `List.getElem_append_left`, and indexing into the right-hand side concatenation similarly extracts the i-th block of the original trace by `List.getElem_append_left`. Unfolding `List.ofFn` on the right with `List.getElem_ofFn` and peeling off the common constructors reduces the goal to h' (i + 1) = h (i + 1). This is supplied directly by the prefix hypothesis `hpre`, since i + 1 < |v| + 1 follows from i < |v| via `Nat.succ_lt_succ`.
uses
List.getElem_append_left,List.getElem_ofFn,Nat.succ_lt_succby_cases hi : i < v.length · rw [List.getElem_append_left hi] rw [List.getElem_append_left (by simp [hi])] rw [List.getElem_ofFn] congr 2 exact hpre ⟨i + 1, Nat.succ_lt_succ hi⟩
When i is not strictly less than |v|, i must equal |v|.
From the hypothesis that i < |v| + 1 and the negation of i < |v|, linear arithmetic (`omega`) deduces that i = |v|. We substitute this equality throughout the goal.
· have hlt : i < v.length + 1 := by simpa using hi1 have hieq : i = v.length := by omega subst hieq
Evaluating both sides at index |v| simplifies to e.dir :: enc1385StateCode (h' (|v| + 1)) on the left and e.dir :: enc1385StateCode e.target_state on the right.
Since the index is |v| and the original list has length |v|, `List.getElem_append_right` (using `le_refl` for the left side and simplification for the right) shifts the lookup index to |v| - |v|. Simplifying |v| - |v| to 0 using `tsub_self` and extracting the unique element of the singleton lists via `List.getElem_singleton` leaves e.dir consed onto the corresponding encoded state on each side.
uses
List.getElem_append_right,le_refl,tsub_self,List.getElem_singletonrw [List.getElem_append_right (le_refl _)] rw [List.getElem_append_right (by simp)] simp only [tsub_self] rw [List.getElem_singleton] rw [List.getElem_singleton]
The state encoding at index |v| + 1 matches e.target_state, concluding the proof.
Removing the matching prefix e.dir :: enc1385StateCode by congruence leaves h' (|v| + 1) = e.target_state. Rewriting e.target_state with the hypothesis `hlast` transforms this into h' (|v| + 1) = h' (Fin.last (v ++ [e.dir]).length). Peeling off h' by congruence leaves an equality of indices in Fin ((v ++ [e.dir]).length + 1), which extensionality (`ext`) and simplification confirm since both indices represent |v| + 1.
congr 2 rw [← hlast] congr 1 ext simp
List.flatten_concat- Concatenating a singleton list of lists [l] to L and flattening is the same as concatenating l to the flattening of L: (L ++ [l]).flatten = L.flatten ++ l.
List.ext_getElem- Two lists are equal if and only if they have the same length and their elements agree at every valid index.
List.getElem_ofFn- The i-th element of a list formed by tabulating a function f over Fin n is f evaluated at index i.
List.getElem_append_left- For an index i strictly less than the length of as, the i-th element of as ++ bs is as[i].
Nat.succ_lt_succ- If n < m, then n + 1 < m + 1.
List.getElem_append_right- For an index i at least the length of as, the i-th element of as ++ bs is bs[i - as.length].
le_refl- Every element in a preorder is less than or equal to itself: a ≤ a.
tsub_self- Subtracting any number from itself yields zero: a - a = 0.
List.getElem_singleton- Accessing index 0 of a singleton list [a] yields a.
- Line 1 contains an inline `by simp` proof within the theorem statement to verify that indices in the domain of h embed into the domain of h'.
- In Step 5 (lines 15–18), the deduction that i = |v| from i < |v| + 1 and ¬(i < |v|) is handled by the `omega` decision procedure for linear integer arithmetic.
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
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
theorem prioritized_borel_encoding_trace_extend {Q : Type} [Fintype Q] (v : List Bool) (h : Fin (v.length + 1) → Q) (e : TreeGameEdge Q 3) (h' : Fin ((v ++ [e.dir]).length + 1) → Q) (hpre : ∀ i : Fin (v.length + 1), h' ⟨i.val, by simp⟩ = h i) (hlast : h' (Fin.last (v ++ [e.dir]).length) = e.target_state) : enc1385Trace (v ++ [e.dir]) h' = enc1385Trace v h ++ enc1385Block e := by dsimp [enc1385Trace, enc1385Block] rw [← List.flatten_concat] congr 1 apply List.ext_getElem · simp · intro i hi1 hi2 rw [List.getElem_ofFn] by_cases hi : i < v.length · rw [List.getElem_append_left hi] rw [List.getElem_append_left (by simp [hi])] rw [List.getElem_ofFn] congr 2 exact hpre ⟨i + 1, Nat.succ_lt_succ hi⟩ · have hlt : i < v.length + 1 := by simpa using hi1 have hieq : i = v.length := by omega subst hieq rw [List.getElem_append_right (le_refl _)] rw [List.getElem_append_right (by simp)] simp only [tsub_self] rw [List.getElem_singleton] rw [List.getElem_singleton] congr 2 rw [← hlast] congr 1 ext simp