Basic properties of Sprague–Grundy values
Lax689614.GrundyProperties · concepts/Lax689614/GrundyProperties.lean · lax-689614
No public endorsements yet.
Loading review…
Sign in with ORCIDNatural Language Statement
Theorem
Observation 2 and Lemma 3: every smaller value is reachable, the current value is not reachable, and a position is losing exactly when its value is zero. Lemma 4: on a disjoint union, the value is the bitwise exclusive-or of the component values. The binary formula gives the finite-family formula by iteration.
Concept map
Evidence
Lean source view on GitHub
| 1 | import Lax689614.Grundy |
| 2 | import Mathlib.Data.Nat.Bitwise |
| 3 | |
| 4 | /-! |
| 5 | --- |
| 6 | title: Basic properties of Sprague–Grundy values |
| 7 | type: theorem |
| 8 | --- |
| 9 | Observation 2 and Lemma 3: every smaller value is reachable, the current |
| 10 | value is not reachable, and a position is losing exactly when its value is |
| 11 | zero. Lemma 4: on a disjoint union, the value is the bitwise exclusive-or |
| 12 | of the component values. The binary formula gives the finite-family formula |
| 13 | by iteration. |
| 14 | -/ |
| 15 | |
| 16 | namespace Lax689614.GrundyProperties |
| 17 | |
| 18 | open ArcKayles Grundy |
| 19 | |
| 20 | axiom smaller_reachable {V : Type} [DecidableEq V] (G : SimpleGraph V) |
| 21 | (S : Finset V) (i : ℕ) (h : i < value G S) : |
| 22 | ∃ u ∈ S, ∃ v ∈ S, G.Adj u v ∧ value G (remove S u v) = i |
| 23 | |
| 24 | axiom value_not_reachable {V : Type} [DecidableEq V] (G : SimpleGraph V) |
| 25 | (S : Finset V) (u v : V) (hu : u ∈ S) (hv : v ∈ S) (he : G.Adj u v) : |
| 26 | value G (remove S u v) ≠ value G S |
| 27 | |
| 28 | axiom losing_iff_zero {V : Type} [DecidableEq V] (G : SimpleGraph V) (S : Finset V) : |
| 29 | ¬ Winning G S ↔ value G S = 0 |
| 30 | |
| 31 | axiom disjoint_union {V : Type} [DecidableEq V] (G : SimpleGraph V) |
| 32 | (S T : Finset V) (hd : Disjoint S T) |
| 33 | (hn : ∀ u ∈ S, ∀ v ∈ T, ¬ G.Adj u v) : |
| 34 | value G (S ∪ T) = Nat.xor (value G S) (value G T) |
| 35 | |
| 36 | end Lax689614.GrundyProperties |
| 37 |
Discussion
Ask a question or add context. Endorsements and structured flags are kept in the review panel above.
0 comments