Parity-game valuations with repeated priorities
Definitionfriedmann_multiplicityPriority-occurrence-count ordering of parity-game play valuations, constrained minimum over legal opponent strategies, and improving switches. Repeated priorities are allowed; the minimum fallback is an explicit validity obligation.
import Definitions.Def_friedmann_parity
set_option autoImplicit false
/-! The repeated-priority valuation of Avis–Friedmann §2.2. Unlike the
injective-priority specialization, this compares PRIORITY OCCURRENCE COUNTS,
not which tied vertex happens to be selected from a symmetric difference. -/
namespace FriedmannMultiplicity
open FriedmannParity
variable {V : Type} [Fintype V] [DecidableEq V]
noncomputable def count (G : Game V) (A : Finset V) (p : ℕ) : ℕ := by
classical
exact (A.filter (fun v => G.priority v = p)).card
def SetLT (G : Game V) (A B : Finset V) : Prop :=
∃ p : ℕ, count G A p ≠ count G B p ∧
(∀ q : ℕ, p < q → count G A q = count G B q) ∧
((p % 2 = 0 ∧ count G A p < count G B p) ∨
(p % 2 = 1 ∧ count G B p < count G A p))
def SetEquivalent (G : Game V) (A B : Finset V) : Prop :=
∀ p, count G A p = count G B p
def ValueLT (G : Game V) (a b : Valuation V) : Prop :=
reward a.cyclePriority < reward b.cyclePriority ∨
(a.cyclePriority = b.cyclePriority ∧ SetLT G a.path b.path) ∨
(a.cyclePriority = b.cyclePriority ∧ SetEquivalent G a.path b.path ∧
((a.cyclePriority % 2 = 1 ∧ a.length < b.length) ∨
(a.cyclePriority % 2 = 0 ∧ b.length < a.length)))
/-- Equivalent paths may consist of different vertices with identical counts. -/
def ValueLE (G : Game V) (a b : Valuation V) : Prop := ¬ValueLT G b a
def IsMinimum (G : Game V) (σ : V → V) (v : V) (a : Valuation V) : Prop :=
(∃ τ, Legal G true τ ∧ playValue G σ τ v = a) ∧
∀ τ, Legal G true τ → ValueLE G a (playValue G σ τ v)
noncomputable def value (G : Game V) (σ : V → V) (v : V) : Valuation V := by
classical
exact if h : ∃ a, IsMinimum G σ v a then Classical.choose h else ⟨0, ∅, 0⟩
def Improving (G : Game V) (σ : V → V) (v w : V) : Prop :=
G.owner v = false ∧ G.edge v w ∧
ValueLT G (value G σ (σ v)) (value G σ w)
def Improvable (G : Game V) (σ : V → V) : Prop := ∃ v w, Improving G σ v w
end FriedmannMultiplicity
Read-back
What the Lean code literally says, in plain math · Codex independent auditor (model identifier unavailable)
count. For any type , a game , a finite vertex set , and a natural priority , the count is . Distinct vertices of equal priority are counted separately; repeated visits to one vertex do not enter this set count.
SetLT. For any type , a game and finite vertex sets , is less than exactly when there exists a natural priority for which , for every , and either is even with or is odd with , where counts vertices in with priority . If all counts agree, neither direction of this strict comparison holds.
SetEquivalent. For any type , a game and finite vertex sets , equivalence means that for every natural priority , the number of vertices of having priority equals the number of vertices of having priority . The sets themselves need not be equal.
ValueLT. For any type , a game and arbitrary valuation triples , Write and for even , for odd . A set is less than a set if there is a priority with unequal counts, equal counts at every larger priority, and either even with or odd with . Triples and are strictly compared by: , or and the preceding strict set comparison, or and equal counts at every priority and either odd with or even with . Their weak comparison means that the reverse strict comparison does not hold. The declaration defines exactly that strict comparison, without requiring the triples to arise from actual plays or requiring priorities to be distinct.
ValueLE. For any type , a game and arbitrary valuation triples , Write and for even , for odd . A set is less than a set if there is a priority with unequal counts, equal counts at every larger priority, and either even with or odd with . Triples and are strictly compared by: , or and the preceding strict set comparison, or and equal counts at every priority and either odd with or even with . Their weak comparison means that the reverse strict comparison does not hold. This declaration defines exactly the weak comparison as the negation of the reverse strict comparison; it does not require equality of the triples, so different path sets with identical priority counts are permitted.
IsMinimum. For a finite type with decidable equality, a game , a total function , a start , and a valuation triple , For strategies and a start , the play is , where when the owner is false and otherwise. Let be the set of vertices occurring at arbitrarily late times and , with empty maximum . Choose an arbitrary vertex of priority if one exists, and otherwise set . Let be the least time with , with fallback if that vertex never occurs. The play valuation is , where is a set, so repeated visits are collapsed. Write and for even , for odd . A set is less than a set if there is a priority with unequal counts, equal counts at every larger priority, and either even with or odd with . Triples and are strictly compared by: , or and the preceding strict set comparison, or and equal counts at every priority and either odd with or even with . Their weak comparison means that the reverse strict comparison does not hold. The predicate says that some true-player legal function has play valuation from , and, for every true-player legal function , the valuation for is not strictly below in the specified comparison. Neither legality of nor existence of a minimum is assumed outside this predicate.
value. For a finite type with decidable equality, a game , a total function , and a start , For strategies and a start , the play is , where when the owner is false and otherwise. Let be the set of vertices occurring at arbitrarily late times and , with empty maximum . Choose an arbitrary vertex of priority if one exists, and otherwise set . Let be the least time with , with fallback if that vertex never occurs. The play valuation is , where is a set, so repeated visits are collapsed. Write and for even , for odd . A set is less than a set if there is a priority with unequal counts, equal counts at every larger priority, and either even with or odd with . Triples and are strictly compared by: , or and the preceding strict set comparison, or and equal counts at every priority and either odd with or even with . Their weak comparison means that the reverse strict comparison does not hold. The value is an arbitrarily selected attained minimum among play valuations from over all true-player legal functions, where minimum means no competing attained valuation is strictly below it. If no attained minimum exists, including the possibility of no legal opponent, the fallback is . The selection is made separately at each vertex and need not come from one common opponent strategy.
Improving. For a finite type with decidable equality, a game , a total function , and vertices , For strategies and a start , the play is , where when the owner is false and otherwise. Let be the set of vertices occurring at arbitrarily late times and , with empty maximum . Choose an arbitrary vertex of priority if one exists, and otherwise set . Let be the least time with , with fallback if that vertex never occurs. The play valuation is , where is a set, so repeated visits are collapsed. Write and for even , for odd . A set is less than a set if there is a priority with unequal counts, equal counts at every larger priority, and either even with or odd with . Triples and are strictly compared by: , or and the preceding strict set comparison, or and equal counts at every priority and either odd with or even with . Their weak comparison means that the reverse strict comparison does not hold. At each vertex, select an attained minimum over legal true-player opponents if it exists and use otherwise. The edge is improving exactly when is false-owned, the game has that edge, and the selected value at the current successor is strictly below the selected value at under this multiplicity comparison. The predicate does not assume legal.
Improvable. For a finite type with decidable equality, a game and a total function , For strategies and a start , the play is , where when the owner is false and otherwise. Let be the set of vertices occurring at arbitrarily late times and , with empty maximum . Choose an arbitrary vertex of priority if one exists, and otherwise set . Let be the least time with , with fallback if that vertex never occurs. The play valuation is , where is a set, so repeated visits are collapsed. Write and for even , for odd . A set is less than a set if there is a priority with unequal counts, equal counts at every larger priority, and either even with or odd with . Triples and are strictly compared by: , or and the preceding strict set comparison, or and equal counts at every priority and either odd with or even with . Their weak comparison means that the reverse strict comparison does not hold. Select a minimum over legal true-player opponents independently at each vertex, with fallback if none exists. The predicate means that some false-owned vertex has an edge to a vertex whose selected value is strictly above the selected value at . It is false for an empty vertex type.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.