The lines of the Lean statement that state the theorem, then the definitions in the file that it uses.
Local definitions the statement names, followed through the definitions they name in turn. The match is by name in the source text, so a name reached only through notation can be missed; the full file is below.
structure OAI.MeanPayoff.Game line 6
structure Game where n : ℕ positive : 0 < n m : ℕ tail : Fin m → Fin n head : Fin m → Fin n maxOwner : Fin n → Bool weight : Fin m → ℤ total : ∀ v : Fin n, ∃ e : Fin m, tail e = v
definition OAI.MeanPayoff.Strategy line 16
def Strategy (G : Game) := List (Fin G.m) → (v : Fin G.n) → {e : Fin G.m // G.tail e = v}
definition OAI.MeanPayoff.move line 19
def move (G : Game) (σ τ : Strategy G) (v : Fin G.n) (history : List (Fin G.m)) : Fin G.m := if G.maxOwner v then (σ history v).val else (τ history v).val
definition OAI.MeanPayoff.position line 23
def position (G : Game) (σ τ : Strategy G) (start : Fin G.n) : ℕ → Fin G.n × List (Fin G.m) | 0 => (start, []) | t + 1 => let p := position G σ τ start t let e := move G σ τ p.1 p.2 (G.head e, p.2 ++ [e])
definition OAI.MeanPayoff.play line 31
def play (G : Game) (σ τ : Strategy G) (start : Fin G.n) (t : ℕ) : Fin G.m := let p := position G σ τ start t move G σ τ p.1 p.2
definition OAI.MeanPayoff.meanPayoff line 35
noncomputable def meanPayoff (G : Game) (π : ℕ → Fin G.m) : ℝ := Filter.liminf (fun T : ℕ => (∑ j ∈ Finset.range T, (G.weight (π j) : ℝ)) / (T : ℝ)) Filter.atTop
definition OAI.MeanPayoff.Winning line 39
def Winning (G : Game) (v : Fin G.n) : Prop := ∃ σ : Strategy G, ∀ τ : Strategy G, 0 ≤ meanPayoff G (play G σ τ v)
definition OAI.MeanPayoff.encodeNat line 42
def encodeNat (n : ℕ) : List Bool := let bits := Nat.bits (n + 1) List.replicate bits.length true ++ [false] ++ bits
definition OAI.MeanPayoff.encodeInt line 46
def encodeInt (z : ℤ) : List Bool := decide (z < 0) :: encodeNat z.natAbs
definition OAI.MeanPayoff.input line 49
def input (G : Game) : List Bool := encodeNat G.n ++ encodeNat G.m ++ List.ofFn G.maxOwner ++ (List.ofFn (fun e : Fin G.m => encodeNat ((G.tail e).val + 1) ++ encodeNat ((G.head e).val + 1) ++ encodeInt (G.weight e))).flatten
abbreviation OAI.MeanPayoff.Symbol line 55
abbrev Symbol := Option Bool
inductive type OAI.MeanPayoff.Direction line 57
inductive Direction where | left | stay | right deriving DecidableEq
definition OAI.MeanPayoff.Direction.offset line 61
def Direction.offset : Direction → ℤ | .left => -1 | .stay => 0 | .right => 1
structure OAI.MeanPayoff.Action line 66
structure Action (q : ℕ) where next : Fin q write : Fin 3 → Symbol shift : Fin 3 → Direction
structure OAI.MeanPayoff.Machine line 71
structure Machine where states : ℕ start : Fin states transition : Fin states → (Fin 3 → Symbol) → Bool → Option (Action states)
structure OAI.MeanPayoff.Configuration line 76
structure Configuration (M : Machine) where control : Option (Fin M.states) head : Fin 3 → ℤ tape : Fin 3 → ℤ → Symbol
definition OAI.MeanPayoff.initial line 81
def initial (M : Machine) (code : List Bool) : Configuration M where control := some M.start head := fun _ => 0 tape := fun k j => if k = 0 ∧ 0 ≤ j then code[j.toNat]? else none
definition OAI.MeanPayoff.step line 86
def step (M : Machine) (c : Configuration M) (bit : Bool) : Configuration M := match c.control with | none => c | some s => match M.transition s (fun k => c.tape k (c.head k)) bit with | none => { c with control := none } | some a => { control := some a.next head := fun k => c.head k + (a.shift k).offset tape := fun k => Function.update (c.tape k) (c.head k) (a.write k) }
definition OAI.MeanPayoff.run line 97
def run (M : Machine) (code : List Bool) (random : ℕ → Bool) : ℕ → Configuration M | 0 => initial M code | t + 1 => step M (run M code random t) (random t)
definition OAI.MeanPayoff.padBits line 101
def padBits {T : ℕ} (bits : Fin T → Bool) (j : ℕ) : Bool := if h : j < T then bits ⟨j, h⟩ else false
definition OAI.MeanPayoff.result line 104
def result (M : Machine) (G : Game) (T : ℕ) (bits : Fin T → Bool) : Configuration M := run M (input G) (padBits bits) T
definition OAI.MeanPayoff.CorrectOutput line 107
def CorrectOutput (G : Game) {M : Machine} (c : Configuration M) : Prop := c.control = none ∧ (∀ v : Fin G.n, c.tape 2 (v.val : ℤ) = some true ↔ Winning G v) ∧ (∀ v : Fin G.n, c.tape 2 (v.val : ℤ) = some false ↔ ¬ Winning G v) ∧ ∀ j : ℤ, (j < 0 ∨ (G.n : ℤ) ≤ j) → c.tape 2 j = none