AFTD Auto-Formalizing Theoretical Domains

parity_game_encode

deforiginal

For a natural number n, an owner map own : Fin n → Bool, a priority map prio : Fin n → ℕ, an edge relation E : Fin n → Fin n → Bool and a vertex v : Fin n (arguments in this order: n, own, prio, E, v), parity_game_encode n own prio E v is the list of Booleans obtained by concatenating: n copies of true followed by one false; then v copies of true (v as a number) followed by one false; then, for each vertex u = 0, 1, ..., n−1 in increasing order, the block consisting of the bit own u, then prio u copies of true followed by one false, then the n bits E u 0, E u 1, ..., E u (n−1).

Statement

def parity_game_encode (n : ℕ) (own : Fin n → Bool) (prio : Fin n → ℕ) (E : Fin n → Fin n → Bool)
    (v : Fin n) : List Bool
Related work
Encoding chosen here for stating OP-37 (parity games in polynomial time); unary numbers and the adjacency matrix, of length polynomial in |V| + |E| when priorities are at most |V|.
Verified
19 Nov 2026
Axioms
none listed
Used by 1

Read back from the Lean

A definition parity_game_encode that takes: - a natural number n, - an ownership function own : Fin n → Bool, - a priority function prio : Fin n → ℕ, - an adjacency relation E : Fin n → Fin n → Bool, and - a vertex v : Fin n, and produces a List Bool formed by concatenating: 1. n copies of true followed by false, 2. v.val copies of true followed by false, and 3. for each vertex u : Fin n in List.finRange n (in order from 0 to n - 1), the concatenation of: - [own u], - prio u copies of true followed by false, and - the list of booleans [E u 0, E u 1, ..., E u (n - 1)] obtained by mapping w ↦ E u w over List.finRange n.

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

Lean source view module on GitHub

/-- A binary encoding of a parity game on `Fin n` with a start vertex: `n` in unary, the start vertex in unary, then for each vertex its owner bit, its priority in unary and its row of the adjacency matrix. Its length is polynomial in the number of vertices and edges when priorities are at most `n`. -/
def parity_game_encode (n : ℕ) (own : Fin n → Bool) (prio : Fin n → ℕ) (E : Fin n → Fin n → Bool)
    (v : Fin n) : List Bool :=
  List.replicate n true ++ [false] ++ (List.replicate v.val true ++ [false]) ++
    (List.finRange n).flatMap (fun u =>
      [own u] ++ (List.replicate (prio u) true ++ [false]) ++ (List.finRange n).map (fun w => E u w))
See it in the graphDiscuss this resultChallenge it