fact
stringlengths
6
3.84k
type
stringclasses
11 values
library
stringclasses
32 values
imports
listlengths
1
14
filename
stringlengths
20
95
symbolic_name
stringlengths
1
90
docstring
stringlengths
7
20k
mulOption_neg_neg {x} (y) {i j} : mulOption x y i j = mulOption x (-(-y)) i (toLeftMovesNeg <| toRightMovesNeg j) := by simp [mulOption]
lemma
SetTheory
[ "Mathlib.Algebra.Order.Monoid.Defs", "Mathlib.SetTheory.PGame.Algebra", "Mathlib.Tactic.Abel", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Basic.lean
mulOption_neg_neg
Any left option of `x * y` of the first kind is also a left option of `x * -(-y)` of the first kind.
mulOption_symm (x y) {i j} : ⟦mulOption x y i j⟧ = (⟦mulOption y x j i⟧ : Game) := by dsimp only [mulOption, quot_sub, quot_add] rw [add_comm] congr 1 on_goal 1 => congr 1 all_goals rw [quot_mul_comm]
lemma
SetTheory
[ "Mathlib.Algebra.Order.Monoid.Defs", "Mathlib.SetTheory.PGame.Algebra", "Mathlib.Tactic.Abel", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Basic.lean
mulOption_symm
The left options of `x * y` agree with that of `y * x` up to equivalence.
leftMoves_mul_iff {x y : PGame} (P : Game → Prop) : (∀ k, P ⟦(x * y).moveLeft k⟧) ↔ (∀ i j, P ⟦mulOption x y i j⟧) ∧ (∀ i j, P ⟦mulOption (-x) (-y) i j⟧) := by cases x; cases y constructor <;> intro h on_goal 1 => constructor <;> intro i j · exact h (Sum.inl (i, j)) convert h (Sum.inr (i, j)) using 1 on_goal 2 => rintro (⟨i, j⟩ | ⟨i, j⟩) · exact h.1 i j convert h.2 i j using 1 all_goals dsimp only [mk_mul_moveLeft_inr, quot_sub, quot_add, neg_def, mulOption, moveLeft_mk] rw [← neg_def, ← neg_def] congr 1 on_goal 1 => congr 1 all_goals rw [quot_neg_mul_neg]
lemma
SetTheory
[ "Mathlib.Algebra.Order.Monoid.Defs", "Mathlib.SetTheory.PGame.Algebra", "Mathlib.Tactic.Abel", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Basic.lean
leftMoves_mul_iff
The left options of `x * y` of the second kind are the left options of `(-x) * (-y)` of the first kind, up to equivalence.
rightMoves_mul_iff {x y : PGame} (P : Game → Prop) : (∀ k, P ⟦(x * y).moveRight k⟧) ↔ (∀ i j, P (-⟦mulOption x (-y) i j⟧)) ∧ (∀ i j, P (-⟦mulOption (-x) y i j⟧)) := by cases x; cases y constructor <;> intro h on_goal 1 => constructor <;> intro i j on_goal 1 => convert h (Sum.inl (i, j)) on_goal 2 => convert h (Sum.inr (i, j)) on_goal 3 => rintro (⟨i, j⟩ | ⟨i, j⟩) on_goal 1 => convert h.1 i j using 1 on_goal 2 => convert h.2 i j using 1 all_goals dsimp [mulOption] rw [neg_sub', neg_add, ← neg_def] congr 1 on_goal 1 => congr 1 any_goals rw [quot_neg_mul, neg_neg] iterate 6 rw [quot_mul_neg, neg_neg]
lemma
SetTheory
[ "Mathlib.Algebra.Order.Monoid.Defs", "Mathlib.SetTheory.PGame.Algebra", "Mathlib.Tactic.Abel", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Basic.lean
rightMoves_mul_iff
The right options of `x * y` are the left options of `x * (-y)` and of `(-x) * y` of the first kind, up to equivalence.
InvTy (l r : Type u) : Bool → Type u | zero : InvTy l r false | left₁ : r → InvTy l r false → InvTy l r false | left₂ : l → InvTy l r true → InvTy l r false | right₁ : l → InvTy l r false → InvTy l r true | right₂ : r → InvTy l r true → InvTy l r true
inductive
SetTheory
[ "Mathlib.Algebra.Order.Monoid.Defs", "Mathlib.SetTheory.PGame.Algebra", "Mathlib.Tactic.Abel", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Basic.lean
InvTy
Because the two halves of the definition of `inv` produce more elements on each side, we have to define the two families inductively. This is the indexing set for the function, and `invVal` is the function part.
InvTy.instInhabited (l r : Type u) : Inhabited (InvTy l r false) := ⟨InvTy.zero⟩
instance
SetTheory
[ "Mathlib.Algebra.Order.Monoid.Defs", "Mathlib.SetTheory.PGame.Algebra", "Mathlib.Tactic.Abel", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Basic.lean
InvTy.instInhabited
null
uniqueInvTy (l r : Type u) [IsEmpty l] [IsEmpty r] : Unique (InvTy l r false) := { InvTy.instInhabited l r with uniq := by rintro (a | a | a) · rfl all_goals exact isEmptyElim a }
instance
SetTheory
[ "Mathlib.Algebra.Order.Monoid.Defs", "Mathlib.SetTheory.PGame.Algebra", "Mathlib.Tactic.Abel", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Basic.lean
uniqueInvTy
null
invVal {l r} (L : l → PGame) (R : r → PGame) (IHl : l → PGame) (IHr : r → PGame) (x : PGame) : ∀ {b}, InvTy l r b → PGame | _, InvTy.zero => 0 | _, InvTy.left₁ i j => (1 + (R i - x) * invVal L R IHl IHr x j) * IHr i | _, InvTy.left₂ i j => (1 + (L i - x) * invVal L R IHl IHr x j) * IHl i | _, InvTy.right₁ i j => (1 + (L i - x) * invVal L R IHl IHr x j) * IHl i | _, InvTy.right₂ i j => (1 + (R i - x) * invVal L R IHl IHr x j) * IHr i @[simp]
def
SetTheory
[ "Mathlib.Algebra.Order.Monoid.Defs", "Mathlib.SetTheory.PGame.Algebra", "Mathlib.Tactic.Abel", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Basic.lean
invVal
Because the two halves of the definition of `inv` produce more elements of each side, we have to define the two families inductively. This is the function part, defined by recursion on `InvTy`.
invVal_isEmpty {l r : Type u} {b} (L R IHl IHr) (i : InvTy l r b) (x) [IsEmpty l] [IsEmpty r] : invVal L R IHl IHr x i = 0 := by obtain - | a | a | a | a := i · rfl all_goals exact isEmptyElim a
theorem
SetTheory
[ "Mathlib.Algebra.Order.Monoid.Defs", "Mathlib.SetTheory.PGame.Algebra", "Mathlib.Tactic.Abel", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Basic.lean
invVal_isEmpty
null
inv' : PGame → PGame | ⟨l, r, L, R⟩ => let l' := { i // 0 < L i } let L' : l' → PGame := fun i => L i.1 let IHl' : l' → PGame := fun i => inv' (L i.1) let IHr i := inv' (R i) let x := mk l r L R ⟨InvTy l' r false, InvTy l' r true, invVal L' R IHl' IHr x, invVal L' R IHl' IHr x⟩
def
SetTheory
[ "Mathlib.Algebra.Order.Monoid.Defs", "Mathlib.SetTheory.PGame.Algebra", "Mathlib.Tactic.Abel", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Basic.lean
inv'
The inverse of a positive surreal number `x = {L | R}` is given by `x⁻¹ = {0, (1 + (R - x) * x⁻¹L) * R, (1 + (L - x) * x⁻¹R) * L | (1 + (L - x) * x⁻¹L) * L, (1 + (R - x) * x⁻¹R) * R}`. Because the two halves `x⁻¹L, x⁻¹R` of `x⁻¹` are used in their own definition, the sets and elements are inductively generated.
zero_lf_inv' : ∀ x : PGame, 0 ⧏ inv' x | ⟨xl, xr, xL, xR⟩ => by convert lf_mk _ _ InvTy.zero rfl
theorem
SetTheory
[ "Mathlib.Algebra.Order.Monoid.Defs", "Mathlib.SetTheory.PGame.Algebra", "Mathlib.Tactic.Abel", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Basic.lean
zero_lf_inv'
null
inv'Zero : inv' 0 ≡r 1 := by change mk _ _ _ _ ≡r 1 refine ⟨?_, ?_, fun i => ?_, IsEmpty.elim ?_⟩ · apply Equiv.equivPUnit (InvTy _ _ _) · apply Equiv.equivPEmpty (InvTy _ _ _) · -- Porting note: we added `rfl` after the `simp` simp; rfl · dsimp infer_instance
def
SetTheory
[ "Mathlib.Algebra.Order.Monoid.Defs", "Mathlib.SetTheory.PGame.Algebra", "Mathlib.Tactic.Abel", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Basic.lean
inv'Zero
`inv' 0` has exactly the same moves as `1`.
inv'_zero_equiv : inv' 0 ≈ 1 := inv'Zero.equiv
theorem
SetTheory
[ "Mathlib.Algebra.Order.Monoid.Defs", "Mathlib.SetTheory.PGame.Algebra", "Mathlib.Tactic.Abel", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Basic.lean
inv'_zero_equiv
null
inv'_one : inv' 1 ≡ 1 := by rw [Identical.ext_iff] constructor · simp [memₗ_def, inv', isEmpty_subtype] · simp [memᵣ_def, inv', isEmpty_subtype]
lemma
SetTheory
[ "Mathlib.Algebra.Order.Monoid.Defs", "Mathlib.SetTheory.PGame.Algebra", "Mathlib.Tactic.Abel", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Basic.lean
inv'_one
`inv' 1` has exactly the same moves as `1`.
inv'One : inv' 1 ≡r (1 : PGame.{u}) := by change Relabelling (mk _ _ _ _) 1 have : IsEmpty { _i : PUnit.{u + 1} // (0 : PGame.{u}) < 0 } := by rw [lt_self_iff_false] infer_instance refine ⟨?_, ?_, fun i => ?_, IsEmpty.elim ?_⟩ <;> dsimp · apply Equiv.equivPUnit · apply Equiv.equivOfIsEmpty · -- Porting note: had to add `rfl`, because `simp` only uses the built-in `rfl`. simp; rfl · infer_instance
def
SetTheory
[ "Mathlib.Algebra.Order.Monoid.Defs", "Mathlib.SetTheory.PGame.Algebra", "Mathlib.Tactic.Abel", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Basic.lean
inv'One
`inv' 1` has exactly the same moves as `1`.
inv'_one_equiv : inv' 1 ≈ 1 := inv'_one.equiv
theorem
SetTheory
[ "Mathlib.Algebra.Order.Monoid.Defs", "Mathlib.SetTheory.PGame.Algebra", "Mathlib.Tactic.Abel", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Basic.lean
inv'_one_equiv
null
inv_one : 1⁻¹ ≡ 1 := by rw [inv_eq_of_pos PGame.zero_lt_one] exact inv'_one
lemma
SetTheory
[ "Mathlib.Algebra.Order.Monoid.Defs", "Mathlib.SetTheory.PGame.Algebra", "Mathlib.Tactic.Abel", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Basic.lean
inv_one
The inverse of a pre-game in terms of the inverse on positive pre-games. -/ noncomputable instance : Inv PGame := ⟨by classical exact fun x => if x ≈ 0 then 0 else if 0 < x then inv' x else -inv' (-x)⟩ noncomputable instance : Div PGame := ⟨fun x y => x * y⁻¹⟩ theorem inv_eq_of_equiv_zero {x : PGame} (h : x ≈ 0) : x⁻¹ = 0 := by classical exact if_pos h @[simp] theorem inv_zero : (0 : PGame)⁻¹ = 0 := inv_eq_of_equiv_zero (equiv_refl _) theorem inv_eq_of_pos {x : PGame} (h : 0 < x) : x⁻¹ = inv' x := by classical exact (if_neg h.lf.not_equiv').trans (if_pos h) theorem inv_eq_of_lf_zero {x : PGame} (h : x ⧏ 0) : x⁻¹ = -inv' (-x) := by classical exact (if_neg h.not_equiv).trans (if_neg h.not_gt) /-- `1⁻¹` has exactly the same moves as `1`.
invOne : 1⁻¹ ≡r 1 := by rw [inv_eq_of_pos PGame.zero_lt_one] exact inv'One
def
SetTheory
[ "Mathlib.Algebra.Order.Monoid.Defs", "Mathlib.SetTheory.PGame.Algebra", "Mathlib.Tactic.Abel", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Basic.lean
invOne
`1⁻¹` has exactly the same moves as `1`.
inv_one_equiv : (1⁻¹ : PGame) ≈ 1 := inv_one.equiv
theorem
SetTheory
[ "Mathlib.Algebra.Order.Monoid.Defs", "Mathlib.SetTheory.PGame.Algebra", "Mathlib.Tactic.Abel", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Basic.lean
inv_one_equiv
null
noncomputable birthday : PGame.{u} → Ordinal.{u} | ⟨_, _, xL, xR⟩ => max (lsub.{u, u} fun i => birthday (xL i)) (lsub.{u, u} fun i => birthday (xR i))
def
SetTheory
[ "Mathlib.Algebra.Order.Group.OrderIso", "Mathlib.SetTheory.Game.Ordinal", "Mathlib.SetTheory.Ordinal.NaturalOps", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Birthday.lean
birthday
The birthday of a pre-game is inductively defined as the least strict upper bound of the birthdays of its left and right games. It may be thought as the "step" in which a certain game is constructed.
birthday_def (x : PGame) : birthday x = max (lsub.{u, u} fun i => birthday (x.moveLeft i)) (lsub.{u, u} fun i => birthday (x.moveRight i)) := by cases x; rw [birthday]; rfl
theorem
SetTheory
[ "Mathlib.Algebra.Order.Group.OrderIso", "Mathlib.SetTheory.Game.Ordinal", "Mathlib.SetTheory.Ordinal.NaturalOps", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Birthday.lean
birthday_def
null
birthday_moveLeft_lt {x : PGame} (i : x.LeftMoves) : (x.moveLeft i).birthday < x.birthday := by cases x; rw [birthday]; exact lt_max_of_lt_left (lt_lsub _ i)
theorem
SetTheory
[ "Mathlib.Algebra.Order.Group.OrderIso", "Mathlib.SetTheory.Game.Ordinal", "Mathlib.SetTheory.Ordinal.NaturalOps", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Birthday.lean
birthday_moveLeft_lt
null
birthday_moveRight_lt {x : PGame} (i : x.RightMoves) : (x.moveRight i).birthday < x.birthday := by cases x; rw [birthday]; exact lt_max_of_lt_right (lt_lsub _ i)
theorem
SetTheory
[ "Mathlib.Algebra.Order.Group.OrderIso", "Mathlib.SetTheory.Game.Ordinal", "Mathlib.SetTheory.Ordinal.NaturalOps", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Birthday.lean
birthday_moveRight_lt
null
lt_birthday_iff {x : PGame} {o : Ordinal} : o < x.birthday ↔ (∃ i : x.LeftMoves, o ≤ (x.moveLeft i).birthday) ∨ ∃ i : x.RightMoves, o ≤ (x.moveRight i).birthday := by constructor · rw [birthday_def] intro h rcases lt_max_iff.1 h with h' | h' · left rwa [lt_lsub_iff] at h' · right rwa [lt_lsub_iff] at h' · rintro (⟨i, hi⟩ | ⟨i, hi⟩) · exact hi.trans_lt (birthday_moveLeft_lt i) · exact hi.trans_lt (birthday_moveRight_lt i)
theorem
SetTheory
[ "Mathlib.Algebra.Order.Group.OrderIso", "Mathlib.SetTheory.Game.Ordinal", "Mathlib.SetTheory.Ordinal.NaturalOps", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Birthday.lean
lt_birthday_iff
null
Relabelling.birthday_congr : ∀ {x y : PGame.{u}}, x ≡r y → birthday x = birthday y | ⟨xl, xr, xL, xR⟩, ⟨yl, yr, yL, yR⟩, r => by unfold birthday congr 1 all_goals apply lsub_eq_of_range_eq.{u, u, u} ext i; constructor all_goals rintro ⟨j, rfl⟩ · exact ⟨_, (r.moveLeft j).birthday_congr.symm⟩ · exact ⟨_, (r.moveLeftSymm j).birthday_congr⟩ · exact ⟨_, (r.moveRight j).birthday_congr.symm⟩ · exact ⟨_, (r.moveRightSymm j).birthday_congr⟩ @[simp]
theorem
SetTheory
[ "Mathlib.Algebra.Order.Group.OrderIso", "Mathlib.SetTheory.Game.Ordinal", "Mathlib.SetTheory.Ordinal.NaturalOps", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Birthday.lean
Relabelling.birthday_congr
null
birthday_eq_zero {x : PGame} : birthday x = 0 ↔ IsEmpty x.LeftMoves ∧ IsEmpty x.RightMoves := by rw [birthday_def, max_eq_zero, lsub_eq_zero_iff, lsub_eq_zero_iff] @[simp]
theorem
SetTheory
[ "Mathlib.Algebra.Order.Group.OrderIso", "Mathlib.SetTheory.Game.Ordinal", "Mathlib.SetTheory.Ordinal.NaturalOps", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Birthday.lean
birthday_eq_zero
null
birthday_zero : birthday 0 = 0 := by simp [inferInstanceAs (IsEmpty PEmpty)] @[simp]
theorem
SetTheory
[ "Mathlib.Algebra.Order.Group.OrderIso", "Mathlib.SetTheory.Game.Ordinal", "Mathlib.SetTheory.Ordinal.NaturalOps", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Birthday.lean
birthday_zero
null
birthday_one : birthday 1 = 1 := by rw [birthday_def]; simp @[simp]
theorem
SetTheory
[ "Mathlib.Algebra.Order.Group.OrderIso", "Mathlib.SetTheory.Game.Ordinal", "Mathlib.SetTheory.Ordinal.NaturalOps", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Birthday.lean
birthday_one
null
birthday_star : birthday star = 1 := by rw [birthday_def]; simp @[simp]
theorem
SetTheory
[ "Mathlib.Algebra.Order.Group.OrderIso", "Mathlib.SetTheory.Game.Ordinal", "Mathlib.SetTheory.Ordinal.NaturalOps", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Birthday.lean
birthday_star
null
birthday_neg : ∀ x : PGame, (-x).birthday = x.birthday | ⟨xl, xr, xL, xR⟩ => by rw [birthday_def, birthday_def, max_comm] congr <;> funext <;> apply birthday_neg @[simp]
theorem
SetTheory
[ "Mathlib.Algebra.Order.Group.OrderIso", "Mathlib.SetTheory.Game.Ordinal", "Mathlib.SetTheory.Ordinal.NaturalOps", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Birthday.lean
birthday_neg
null
birthday_ordinalToPGame (o : Ordinal) : o.toPGame.birthday = o := by induction o using Ordinal.induction with | _ o IH rw [toPGame, PGame.birthday] simp only [lsub_empty, max_zero_right] conv_rhs => rw [← lsub_typein o] congr with x exact IH _ (typein_lt_self x)
theorem
SetTheory
[ "Mathlib.Algebra.Order.Group.OrderIso", "Mathlib.SetTheory.Game.Ordinal", "Mathlib.SetTheory.Ordinal.NaturalOps", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Birthday.lean
birthday_ordinalToPGame
null
le_birthday : ∀ x : PGame, x ≤ x.birthday.toPGame | ⟨xl, _, xL, _⟩ => le_def.2 ⟨fun i => Or.inl ⟨toLeftMovesToPGame ⟨_, birthday_moveLeft_lt i⟩, by simp [le_birthday (xL i)]⟩, isEmptyElim⟩ variable (x : PGame.{u})
theorem
SetTheory
[ "Mathlib.Algebra.Order.Group.OrderIso", "Mathlib.SetTheory.Game.Ordinal", "Mathlib.SetTheory.Ordinal.NaturalOps", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Birthday.lean
le_birthday
null
neg_birthday_le : -x.birthday.toPGame ≤ x := by simpa only [birthday_neg, ← neg_le_iff] using le_birthday (-x) @[simp]
theorem
SetTheory
[ "Mathlib.Algebra.Order.Group.OrderIso", "Mathlib.SetTheory.Game.Ordinal", "Mathlib.SetTheory.Ordinal.NaturalOps", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Birthday.lean
neg_birthday_le
null
birthday_add : ∀ x y : PGame.{u}, (x + y).birthday = x.birthday ♯ y.birthday | ⟨xl, xr, xL, xR⟩, ⟨yl, yr, yL, yR⟩ => by rw [birthday_def, nadd, lsub_sum, lsub_sum] simp only [mk_add_moveLeft_inl, mk_add_moveLeft_inr, mk_add_moveRight_inl, mk_add_moveRight_inr, moveLeft_mk, moveRight_mk] conv_lhs => left; left; right; intro a; rw [birthday_add (xL a) ⟨yl, yr, yL, yR⟩] conv_lhs => left; right; right; intro b; rw [birthday_add ⟨xl, xr, xL, xR⟩ (yL b)] conv_lhs => right; left; right; intro a; rw [birthday_add (xR a) ⟨yl, yr, yL, yR⟩] conv_lhs => right; right; right; intro b; rw [birthday_add ⟨xl, xr, xL, xR⟩ (yR b)] rw [max_max_max_comm] congr <;> apply le_antisymm any_goals refine max_le_iff.2 ⟨?_, ?_⟩ all_goals refine lsub_le_iff.2 fun i ↦ ?_ rw [← Order.succ_le_iff] refine Ordinal.le_iSup (fun _ : Set.Iio _ ↦ _) ⟨_, ?_⟩ apply_rules [birthday_moveLeft_lt, birthday_moveRight_lt] all_goals rw [Ordinal.iSup_le_iff] rintro ⟨i, hi⟩ obtain ⟨j, hj⟩ | ⟨j, hj⟩ := lt_birthday_iff.1 hi <;> rw [Order.succ_le_iff] · exact lt_max_of_lt_left ((nadd_le_nadd_right hj _).trans_lt (lt_lsub _ _)) · exact lt_max_of_lt_right ((nadd_le_nadd_right hj _).trans_lt (lt_lsub _ _)) · exact lt_max_of_lt_left ((nadd_le_nadd_left hj _).trans_lt (lt_lsub _ _)) · exact lt_max_of_lt_right ((nadd_le_nadd_left hj _).trans_lt (lt_lsub _ _)) termination_by a b => (a, b) @[simp]
theorem
SetTheory
[ "Mathlib.Algebra.Order.Group.OrderIso", "Mathlib.SetTheory.Game.Ordinal", "Mathlib.SetTheory.Ordinal.NaturalOps", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Birthday.lean
birthday_add
null
birthday_sub (x y : PGame) : (x - y).birthday = x.birthday ♯ y.birthday := by apply (birthday_add x _).trans rw [birthday_neg] @[simp]
theorem
SetTheory
[ "Mathlib.Algebra.Order.Group.OrderIso", "Mathlib.SetTheory.Game.Ordinal", "Mathlib.SetTheory.Ordinal.NaturalOps", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Birthday.lean
birthday_sub
null
birthday_natCast : ∀ n : ℕ, birthday n = n | 0 => birthday_zero | n + 1 => by simp [birthday_natCast]
theorem
SetTheory
[ "Mathlib.Algebra.Order.Group.OrderIso", "Mathlib.SetTheory.Game.Ordinal", "Mathlib.SetTheory.Ordinal.NaturalOps", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Birthday.lean
birthday_natCast
null
noncomputable birthday (x : Game.{u}) : Ordinal.{u} := sInf (PGame.birthday '' (Quotient.mk' ⁻¹' {x}))
def
SetTheory
[ "Mathlib.Algebra.Order.Group.OrderIso", "Mathlib.SetTheory.Game.Ordinal", "Mathlib.SetTheory.Ordinal.NaturalOps", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Birthday.lean
birthday
The birthday of a game is defined as the least birthday among all pre-games that define it.
birthday_eq_pGameBirthday (x : Game) : ∃ y : PGame.{u}, ⟦y⟧ = x ∧ y.birthday = birthday x := by refine csInf_mem (Set.image_nonempty.2 ?_) exact ⟨_, x.out_eq⟩
theorem
SetTheory
[ "Mathlib.Algebra.Order.Group.OrderIso", "Mathlib.SetTheory.Game.Ordinal", "Mathlib.SetTheory.Ordinal.NaturalOps", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Birthday.lean
birthday_eq_pGameBirthday
null
birthday_quot_le_pGameBirthday (x : PGame) : birthday ⟦x⟧ ≤ x.birthday := csInf_le' ⟨x, rfl, rfl⟩ @[simp]
theorem
SetTheory
[ "Mathlib.Algebra.Order.Group.OrderIso", "Mathlib.SetTheory.Game.Ordinal", "Mathlib.SetTheory.Ordinal.NaturalOps", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Birthday.lean
birthday_quot_le_pGameBirthday
null
birthday_zero : birthday 0 = 0 := by rw [← Ordinal.le_zero, ← PGame.birthday_zero] exact birthday_quot_le_pGameBirthday _ @[simp]
theorem
SetTheory
[ "Mathlib.Algebra.Order.Group.OrderIso", "Mathlib.SetTheory.Game.Ordinal", "Mathlib.SetTheory.Ordinal.NaturalOps", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Birthday.lean
birthday_zero
null
birthday_eq_zero {x : Game} : birthday x = 0 ↔ x = 0 := by constructor · intro h let ⟨y, hy₁, hy₂⟩ := birthday_eq_pGameBirthday x rw [← hy₁] rw [h, PGame.birthday_eq_zero] at hy₂ exact PGame.game_eq (@PGame.Equiv.isEmpty _ hy₂.1 hy₂.2) · rintro rfl exact birthday_zero @[simp]
theorem
SetTheory
[ "Mathlib.Algebra.Order.Group.OrderIso", "Mathlib.SetTheory.Game.Ordinal", "Mathlib.SetTheory.Ordinal.NaturalOps", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Birthday.lean
birthday_eq_zero
null
birthday_ordinalToGame (o : Ordinal) : birthday o.toGame = o := by apply le_antisymm · conv_rhs => rw [← PGame.birthday_ordinalToPGame o] apply birthday_quot_le_pGameBirthday · let ⟨x, hx₁, hx₂⟩ := birthday_eq_pGameBirthday o.toGame rw [← hx₂, ← toPGame_le_iff] rw [← mk_toPGame, ← PGame.equiv_iff_game_eq] at hx₁ exact hx₁.2.trans (PGame.le_birthday x) @[simp, norm_cast]
theorem
SetTheory
[ "Mathlib.Algebra.Order.Group.OrderIso", "Mathlib.SetTheory.Game.Ordinal", "Mathlib.SetTheory.Ordinal.NaturalOps", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Birthday.lean
birthday_ordinalToGame
null
birthday_natCast (n : ℕ) : birthday n = n := by rw [← toGame_natCast] exact birthday_ordinalToGame _ @[simp]
theorem
SetTheory
[ "Mathlib.Algebra.Order.Group.OrderIso", "Mathlib.SetTheory.Game.Ordinal", "Mathlib.SetTheory.Ordinal.NaturalOps", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Birthday.lean
birthday_natCast
null
birthday_ofNat (n : ℕ) [n.AtLeastTwo] : birthday ofNat(n) = OfNat.ofNat n := birthday_natCast n @[simp]
theorem
SetTheory
[ "Mathlib.Algebra.Order.Group.OrderIso", "Mathlib.SetTheory.Game.Ordinal", "Mathlib.SetTheory.Ordinal.NaturalOps", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Birthday.lean
birthday_ofNat
null
birthday_one : birthday 1 = 1 := by rw [← Nat.cast_one, birthday_natCast, Nat.cast_one] @[simp]
theorem
SetTheory
[ "Mathlib.Algebra.Order.Group.OrderIso", "Mathlib.SetTheory.Game.Ordinal", "Mathlib.SetTheory.Ordinal.NaturalOps", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Birthday.lean
birthday_one
null
birthday_star : birthday ⟦PGame.star⟧ = 1 := by apply le_antisymm · rw [← PGame.birthday_star] exact birthday_quot_le_pGameBirthday _ · rw [Ordinal.one_le_iff_ne_zero, ne_eq, birthday_eq_zero, Game.zero_def, ← PGame.equiv_iff_game_eq] exact PGame.star_fuzzy_zero.not_equiv
theorem
SetTheory
[ "Mathlib.Algebra.Order.Group.OrderIso", "Mathlib.SetTheory.Game.Ordinal", "Mathlib.SetTheory.Ordinal.NaturalOps", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Birthday.lean
birthday_star
null
private birthday_neg' (x : Game) : (-x).birthday ≤ x.birthday := by let ⟨y, hy₁, hy₂⟩ := birthday_eq_pGameBirthday x rw [← hy₂, ← PGame.birthday_neg y] conv_lhs => rw [← hy₁] apply birthday_quot_le_pGameBirthday @[simp]
theorem
SetTheory
[ "Mathlib.Algebra.Order.Group.OrderIso", "Mathlib.SetTheory.Game.Ordinal", "Mathlib.SetTheory.Ordinal.NaturalOps", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Birthday.lean
birthday_neg'
null
birthday_neg (x : Game) : (-x).birthday = x.birthday := by apply le_antisymm (birthday_neg' x) conv_lhs => rw [← neg_neg x] exact birthday_neg' _
theorem
SetTheory
[ "Mathlib.Algebra.Order.Group.OrderIso", "Mathlib.SetTheory.Game.Ordinal", "Mathlib.SetTheory.Ordinal.NaturalOps", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Birthday.lean
birthday_neg
null
le_birthday (x : Game) : x ≤ x.birthday.toGame := by let ⟨y, hy₁, hy₂⟩ := birthday_eq_pGameBirthday x rw [← hy₁] apply (y.le_birthday).trans rw [toPGame_le_iff, hy₁, hy₂]
theorem
SetTheory
[ "Mathlib.Algebra.Order.Group.OrderIso", "Mathlib.SetTheory.Game.Ordinal", "Mathlib.SetTheory.Ordinal.NaturalOps", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Birthday.lean
le_birthday
null
neg_birthday_le (x : Game) : -x.birthday.toGame ≤ x := by rw [neg_le, ← birthday_neg] exact le_birthday _
theorem
SetTheory
[ "Mathlib.Algebra.Order.Group.OrderIso", "Mathlib.SetTheory.Game.Ordinal", "Mathlib.SetTheory.Ordinal.NaturalOps", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Birthday.lean
neg_birthday_le
null
birthday_add_le (x y : Game) : (x + y).birthday ≤ x.birthday ♯ y.birthday := by let ⟨a, ha₁, ha₂⟩ := birthday_eq_pGameBirthday x let ⟨b, hb₁, hb₂⟩ := birthday_eq_pGameBirthday y rw [← ha₂, ← hb₂, ← ha₁, ← hb₁, ← PGame.birthday_add] exact birthday_quot_le_pGameBirthday _
theorem
SetTheory
[ "Mathlib.Algebra.Order.Group.OrderIso", "Mathlib.SetTheory.Game.Ordinal", "Mathlib.SetTheory.Ordinal.NaturalOps", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Birthday.lean
birthday_add_le
null
birthday_sub_le (x y : Game) : (x - y).birthday ≤ x.birthday ♯ y.birthday := by apply (birthday_add_le x _).trans_eq rw [birthday_neg] /- The bound `(x * y).birthday ≤ x.birthday ⨳ y.birthday` is currently an open problem. See https://mathoverflow.net/a/476829/147705. -/
theorem
SetTheory
[ "Mathlib.Algebra.Order.Group.OrderIso", "Mathlib.SetTheory.Game.Ordinal", "Mathlib.SetTheory.Ordinal.NaturalOps", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Birthday.lean
birthday_sub_le
null
small_setOf_birthday_lt (o : Ordinal) : Small.{u} {x : Game.{u} // birthday x < o} := by induction o using Ordinal.induction with | h o IH => let S := ⋃ a ∈ Set.Iio o, {x : Game.{u} | birthday x < a} let H : Small.{u} S := @small_biUnion _ _ _ _ _ IH obtain rfl | ⟨a, rfl⟩ | ho := zero_or_succ_or_isSuccLimit o · simp_rw [Ordinal.not_lt_zero] exact small_empty · simp_rw [Order.lt_succ_iff, le_iff_lt_or_eq] convert small_union.{u} {x | birthday x < a} {x | birthday x = a} · exact IH _ (Order.lt_succ a) · let f (g : Set S × Set S) : Game := ⟦PGame.mk _ _ (fun x ↦ ((equivShrink g.1).symm x).1.1.out) (fun x ↦ ((equivShrink g.2).symm x).1.1.out)⟧ suffices {x | x.birthday = a} ⊆ Set.range f from small_subset this rintro x rfl obtain ⟨y, rfl, hy'⟩ := birthday_eq_pGameBirthday x refine ⟨⟨{z | ∃ i, ⟦y.moveLeft i⟧ = z.1}, {z | ∃ i, ⟦y.moveRight i⟧ = z.1}⟩, ?_⟩ apply PGame.game_eq <| PGame.Equiv.of_exists _ _ _ _ <;> intro i · obtain ⟨j, hj⟩ := ((equivShrink _).symm i).2 exact ⟨j, by simp [PGame.equiv_iff_game_eq, hj]⟩ · obtain ⟨j, hj⟩ := ((equivShrink _).symm i).2 exact ⟨j, by simp [PGame.equiv_iff_game_eq, hj]⟩ · refine ⟨equivShrink _ ⟨⟨⟦y.moveLeft i⟧, ?_⟩, i, rfl⟩, by simpa using Quotient.mk_out _⟩ suffices ∃ b ≤ y.birthday, birthday ⟦y.moveLeft i⟧ < b by simpa [S, hy'] using this refine ⟨_, le_rfl, ?_⟩ exact (birthday_quot_le_pGameBirthday _).trans_lt (PGame.birthday_moveLeft_lt i) · refine ⟨equivShrink _ ⟨⟨⟦y.moveRight i⟧, ?_⟩, i, rfl⟩, by simpa using Quotient.mk_out _⟩ suffices ∃ b ≤ y.birthday, birthday ⟦y.moveRight i⟧ < b by simpa [S, hy'] using this refine ⟨_, le_rfl, ?_⟩ exact (birthday_quot_le_pGameBirthday _).trans_lt (PGame.birthday_moveRight_lt i) · convert H change birthday _ < o ↔ ∃ a, _ simpa using ho.lt_iff_exists_lt
theorem
SetTheory
[ "Mathlib.Algebra.Order.Group.OrderIso", "Mathlib.SetTheory.Game.Ordinal", "Mathlib.SetTheory.Ordinal.NaturalOps", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Birthday.lean
small_setOf_birthday_lt
Games with bounded birthday are a small set.
@[simps!] shiftUp : ℤ × ℤ ≃ ℤ × ℤ := (Equiv.refl ℤ).prodCongr (Equiv.addRight (1 : ℤ))
def
SetTheory
[ "Mathlib.SetTheory.Game.State", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Domineering.lean
shiftUp
The equivalence `(x, y) ↦ (x, y+1)`.
@[simps!] shiftRight : ℤ × ℤ ≃ ℤ × ℤ := (Equiv.addRight (1 : ℤ)).prodCongr (Equiv.refl ℤ)
def
SetTheory
[ "Mathlib.SetTheory.Game.State", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Domineering.lean
shiftRight
The equivalence `(x, y) ↦ (x+1, y)`.
left (b : Board) : Finset (ℤ × ℤ) := b ∩ b.map shiftUp
def
SetTheory
[ "Mathlib.SetTheory.Game.State", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Domineering.lean
left
A Domineering board is an arbitrary finite subset of `ℤ × ℤ`. -/ -- Porting note: reducibility cannot be `local`. For now there are no dependents of this file so -- being globally reducible is fine. abbrev Board := Finset (ℤ × ℤ) /-- Left can play anywhere that a square and the square below it are open.
right (b : Board) : Finset (ℤ × ℤ) := b ∩ b.map shiftRight
def
SetTheory
[ "Mathlib.SetTheory.Game.State", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Domineering.lean
right
Right can play anywhere that a square and the square to the left are open.
mem_left {b : Board} (x : ℤ × ℤ) : x ∈ left b ↔ x ∈ b ∧ (x.1, x.2 - 1) ∈ b := Finset.mem_inter.trans (and_congr Iff.rfl Finset.mem_map_equiv)
theorem
SetTheory
[ "Mathlib.SetTheory.Game.State", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Domineering.lean
mem_left
null
mem_right {b : Board} (x : ℤ × ℤ) : x ∈ right b ↔ x ∈ b ∧ (x.1 - 1, x.2) ∈ b := Finset.mem_inter.trans (and_congr Iff.rfl Finset.mem_map_equiv)
theorem
SetTheory
[ "Mathlib.SetTheory.Game.State", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Domineering.lean
mem_right
null
moveLeft (b : Board) (m : ℤ × ℤ) : Board := (b.erase m).erase (m.1, m.2 - 1)
def
SetTheory
[ "Mathlib.SetTheory.Game.State", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Domineering.lean
moveLeft
After Left moves, two vertically adjacent squares are removed from the board.
moveRight (b : Board) (m : ℤ × ℤ) : Board := (b.erase m).erase (m.1 - 1, m.2)
def
SetTheory
[ "Mathlib.SetTheory.Game.State", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Domineering.lean
moveRight
After Left moves, two horizontally adjacent squares are removed from the board.
fst_pred_mem_erase_of_mem_right {b : Board} {m : ℤ × ℤ} (h : m ∈ right b) : (m.1 - 1, m.2) ∈ b.erase m := by rw [mem_right] at h apply Finset.mem_erase_of_ne_of_mem _ h.2 exact ne_of_apply_ne Prod.fst (pred_ne_self m.1)
theorem
SetTheory
[ "Mathlib.SetTheory.Game.State", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Domineering.lean
fst_pred_mem_erase_of_mem_right
null
snd_pred_mem_erase_of_mem_left {b : Board} {m : ℤ × ℤ} (h : m ∈ left b) : (m.1, m.2 - 1) ∈ b.erase m := by rw [mem_left] at h apply Finset.mem_erase_of_ne_of_mem _ h.2 exact ne_of_apply_ne Prod.snd (pred_ne_self m.2)
theorem
SetTheory
[ "Mathlib.SetTheory.Game.State", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Domineering.lean
snd_pred_mem_erase_of_mem_left
null
card_of_mem_left {b : Board} {m : ℤ × ℤ} (h : m ∈ left b) : 2 ≤ Finset.card b := by have w₁ : m ∈ b := (Finset.mem_inter.1 h).1 have w₂ : (m.1, m.2 - 1) ∈ b.erase m := snd_pred_mem_erase_of_mem_left h have i₁ := Finset.card_erase_lt_of_mem w₁ have i₂ := Nat.lt_of_le_of_lt (Nat.zero_le _) (Finset.card_erase_lt_of_mem w₂) exact Nat.lt_of_le_of_lt i₂ i₁
theorem
SetTheory
[ "Mathlib.SetTheory.Game.State", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Domineering.lean
card_of_mem_left
null
card_of_mem_right {b : Board} {m : ℤ × ℤ} (h : m ∈ right b) : 2 ≤ Finset.card b := by have w₁ : m ∈ b := (Finset.mem_inter.1 h).1 have w₂ := fst_pred_mem_erase_of_mem_right h have i₁ := Finset.card_erase_lt_of_mem w₁ have i₂ := Nat.lt_of_le_of_lt (Nat.zero_le _) (Finset.card_erase_lt_of_mem w₂) exact Nat.lt_of_le_of_lt i₂ i₁
theorem
SetTheory
[ "Mathlib.SetTheory.Game.State", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Domineering.lean
card_of_mem_right
null
moveLeft_card {b : Board} {m : ℤ × ℤ} (h : m ∈ left b) : Finset.card (moveLeft b m) + 2 = Finset.card b := by dsimp only [moveLeft] rw [Finset.card_erase_of_mem (snd_pred_mem_erase_of_mem_left h)] rw [Finset.card_erase_of_mem (Finset.mem_of_mem_inter_left h)] exact tsub_add_cancel_of_le (card_of_mem_left h)
theorem
SetTheory
[ "Mathlib.SetTheory.Game.State", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Domineering.lean
moveLeft_card
null
moveRight_card {b : Board} {m : ℤ × ℤ} (h : m ∈ right b) : Finset.card (moveRight b m) + 2 = Finset.card b := by dsimp only [moveRight] rw [Finset.card_erase_of_mem (fst_pred_mem_erase_of_mem_right h)] rw [Finset.card_erase_of_mem (Finset.mem_of_mem_inter_left h)] exact tsub_add_cancel_of_le (card_of_mem_right h)
theorem
SetTheory
[ "Mathlib.SetTheory.Game.State", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Domineering.lean
moveRight_card
null
moveLeft_smaller {b : Board} {m : ℤ × ℤ} (h : m ∈ left b) : Finset.card (moveLeft b m) / 2 < Finset.card b / 2 := by simp [← moveLeft_card h]
theorem
SetTheory
[ "Mathlib.SetTheory.Game.State", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Domineering.lean
moveLeft_smaller
null
moveRight_smaller {b : Board} {m : ℤ × ℤ} (h : m ∈ right b) : Finset.card (moveRight b m) / 2 < Finset.card b / 2 := by simp [← moveRight_card h]
theorem
SetTheory
[ "Mathlib.SetTheory.Game.State", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Domineering.lean
moveRight_smaller
null
state : State Board where turnBound s := s.card / 2 l s := (left s).image (moveLeft s) r s := (right s).image (moveRight s) left_bound m := by simp only [Finset.mem_image, Prod.exists] at m rcases m with ⟨_, _, ⟨h, rfl⟩⟩ exact moveLeft_smaller h right_bound m := by simp only [Finset.mem_image, Prod.exists] at m rcases m with ⟨_, _, ⟨h, rfl⟩⟩ exact moveRight_smaller h
instance
SetTheory
[ "Mathlib.SetTheory.Game.State", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Domineering.lean
state
The instance describing allowed moves on a Domineering board.
domineering (b : Domineering.Board) : PGame := PGame.ofState b
def
SetTheory
[ "Mathlib.SetTheory.Game.State", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Domineering.lean
domineering
Construct a pre-game from a Domineering board.
shortDomineering (b : Domineering.Board) : Short (domineering b) := by dsimp only [domineering] infer_instance
instance
SetTheory
[ "Mathlib.SetTheory.Game.State", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Domineering.lean
shortDomineering
All games of Domineering are short, because each move removes two squares.
domineering.one := domineering [(0, 0), (0, 1)].toFinset
def
SetTheory
[ "Mathlib.SetTheory.Game.State", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Domineering.lean
domineering.one
The Domineering board with two squares arranged vertically, in which Left has the only move.
domineering.L := domineering [(0, 2), (0, 1), (0, 0), (1, 0)].toFinset
def
SetTheory
[ "Mathlib.SetTheory.Game.State", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Domineering.lean
domineering.L
The `L` shaped Domineering board, in which Left is exactly half a move ahead.
shortOne : Short domineering.one := by dsimp [domineering.one]; infer_instance
instance
SetTheory
[ "Mathlib.SetTheory.Game.State", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Domineering.lean
shortOne
null
shortL : Short domineering.L := by dsimp [domineering.L]; infer_instance
instance
SetTheory
[ "Mathlib.SetTheory.Game.State", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Domineering.lean
shortL
null
private ImpartialAux (G : PGame) : Prop := (G ≈ -G) ∧ (∀ i, ImpartialAux (G.moveLeft i)) ∧ ∀ j, ImpartialAux (G.moveRight j) termination_by G
def
SetTheory
[ "Mathlib.SetTheory.Game.Basic", "Mathlib.Tactic.NthRewrite", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Impartial.lean
ImpartialAux
null
Impartial (G : PGame) : Prop where out : ImpartialAux G
class
SetTheory
[ "Mathlib.SetTheory.Game.Basic", "Mathlib.Tactic.NthRewrite", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Impartial.lean
Impartial
An impartial game is one that's equivalent to its negative, such that each left and right move is also impartial. Note that this is a slightly more general definition than the one that's usually in the literature, as we don't require `G ≡ -G`. Despite this, the Sprague-Grundy theorem still holds: see `SetTheory.PGame.equiv_nim_grundyValue`. In such a game, both players have the same payoffs at any subposition.
private impartial_iff_aux {G : PGame} : G.Impartial ↔ G.ImpartialAux := ⟨fun h => h.1, fun h => ⟨h⟩⟩
theorem
SetTheory
[ "Mathlib.SetTheory.Game.Basic", "Mathlib.Tactic.NthRewrite", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Impartial.lean
impartial_iff_aux
null
impartial_def {G : PGame} : G.Impartial ↔ G ≈ -G ∧ (∀ i, Impartial (G.moveLeft i)) ∧ ∀ j, Impartial (G.moveRight j) := by simp_rw [impartial_iff_aux] rw [ImpartialAux]
theorem
SetTheory
[ "Mathlib.SetTheory.Game.Basic", "Mathlib.Tactic.NthRewrite", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Impartial.lean
impartial_def
null
impartial_zero : Impartial 0 := by rw [impartial_def] simp
instance
SetTheory
[ "Mathlib.SetTheory.Game.Basic", "Mathlib.Tactic.NthRewrite", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Impartial.lean
impartial_zero
null
impartial_star : Impartial star := by rw [impartial_def] simpa using Impartial.impartial_zero
instance
SetTheory
[ "Mathlib.SetTheory.Game.Basic", "Mathlib.Tactic.NthRewrite", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Impartial.lean
impartial_star
null
neg_equiv_self (G : PGame) [h : G.Impartial] : G ≈ -G := (impartial_def.1 h).1 @[simp]
theorem
SetTheory
[ "Mathlib.SetTheory.Game.Basic", "Mathlib.Tactic.NthRewrite", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Impartial.lean
neg_equiv_self
null
mk'_neg_equiv_self (G : PGame) [G.Impartial] : -(⟦G⟧ : Game) = ⟦G⟧ := game_eq (Equiv.symm (neg_equiv_self G))
theorem
SetTheory
[ "Mathlib.SetTheory.Game.Basic", "Mathlib.Tactic.NthRewrite", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Impartial.lean
mk'_neg_equiv_self
null
moveLeft_impartial {G : PGame} [h : G.Impartial] (i : G.LeftMoves) : (G.moveLeft i).Impartial := (impartial_def.1 h).2.1 i
instance
SetTheory
[ "Mathlib.SetTheory.Game.Basic", "Mathlib.Tactic.NthRewrite", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Impartial.lean
moveLeft_impartial
null
moveRight_impartial {G : PGame} [h : G.Impartial] (j : G.RightMoves) : (G.moveRight j).Impartial := (impartial_def.1 h).2.2 j
instance
SetTheory
[ "Mathlib.SetTheory.Game.Basic", "Mathlib.Tactic.NthRewrite", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Impartial.lean
moveRight_impartial
null
impartial_congr {G H : PGame} (e : G ≡r H) [G.Impartial] : H.Impartial := impartial_def.2 ⟨Equiv.trans e.symm.equiv (Equiv.trans (neg_equiv_self G) (neg_equiv_neg_iff.2 e.equiv)), fun i => impartial_congr (e.moveLeftSymm i), fun j => impartial_congr (e.moveRightSymm j)⟩ termination_by G
theorem
SetTheory
[ "Mathlib.SetTheory.Game.Basic", "Mathlib.Tactic.NthRewrite", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Impartial.lean
impartial_congr
null
impartial_add (G H : PGame) [G.Impartial] [H.Impartial] : (G + H).Impartial := by rw [impartial_def] refine ⟨Equiv.trans (add_congr (neg_equiv_self G) (neg_equiv_self _)) (Equiv.symm (negAddRelabelling _ _).equiv), fun k => ?_, fun k => ?_⟩ · apply leftMoves_add_cases k all_goals intro i; simp only [add_moveLeft_inl, add_moveLeft_inr] apply impartial_add · apply rightMoves_add_cases k all_goals intro i; simp only [add_moveRight_inl, add_moveRight_inr] apply impartial_add termination_by (G, H)
instance
SetTheory
[ "Mathlib.SetTheory.Game.Basic", "Mathlib.Tactic.NthRewrite", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Impartial.lean
impartial_add
null
impartial_neg (G : PGame) [G.Impartial] : (-G).Impartial := by rw [impartial_def] refine ⟨?_, fun i => ?_, fun i => ?_⟩ · rw [neg_neg] exact Equiv.symm (neg_equiv_self G) · rw [moveLeft_neg] exact impartial_neg _ · rw [moveRight_neg] exact impartial_neg _ termination_by G variable (G : PGame) [Impartial G]
instance
SetTheory
[ "Mathlib.SetTheory.Game.Basic", "Mathlib.Tactic.NthRewrite", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Impartial.lean
impartial_neg
null
nonpos : ¬0 < G := by apply (lt_asymm · ?_) rwa [← neg_lt_neg_iff, neg_zero, ← lt_congr_right (neg_equiv_self G)]
theorem
SetTheory
[ "Mathlib.SetTheory.Game.Basic", "Mathlib.Tactic.NthRewrite", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Impartial.lean
nonpos
null
nonneg : ¬G < 0 := by simpa using nonpos (-G)
theorem
SetTheory
[ "Mathlib.SetTheory.Game.Basic", "Mathlib.Tactic.NthRewrite", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Impartial.lean
nonneg
null
equiv_or_fuzzy_zero : G ≈ 0 ∨ G ‖ 0 := by rcases lt_or_equiv_or_gt_or_fuzzy G 0 with (h | h | h | h) · exact ((nonneg G) h).elim · exact Or.inl h · exact ((nonpos G) h).elim · exact Or.inr h @[simp]
theorem
SetTheory
[ "Mathlib.SetTheory.Game.Basic", "Mathlib.Tactic.NthRewrite", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Impartial.lean
equiv_or_fuzzy_zero
In an impartial game, either the first player always wins, or the second player always wins.
not_equiv_zero_iff : ¬ G ≈ 0 ↔ G ‖ 0 := ⟨(equiv_or_fuzzy_zero G).resolve_left, Fuzzy.not_equiv⟩ @[simp]
theorem
SetTheory
[ "Mathlib.SetTheory.Game.Basic", "Mathlib.Tactic.NthRewrite", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Impartial.lean
not_equiv_zero_iff
null
not_fuzzy_zero_iff : ¬ G ‖ 0 ↔ G ≈ 0 := ⟨(equiv_or_fuzzy_zero G).resolve_right, Equiv.not_fuzzy⟩
theorem
SetTheory
[ "Mathlib.SetTheory.Game.Basic", "Mathlib.Tactic.NthRewrite", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Impartial.lean
not_fuzzy_zero_iff
null
add_self : G + G ≈ 0 := Equiv.trans (add_congr_left (neg_equiv_self G)) (neg_add_cancel_equiv G) @[simp]
theorem
SetTheory
[ "Mathlib.SetTheory.Game.Basic", "Mathlib.Tactic.NthRewrite", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Impartial.lean
add_self
null
mk'_add_self : (⟦G⟧ : Game) + ⟦G⟧ = 0 := game_eq (add_self G)
theorem
SetTheory
[ "Mathlib.SetTheory.Game.Basic", "Mathlib.Tactic.NthRewrite", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Impartial.lean
mk'_add_self
null
equiv_iff_add_equiv_zero (H : PGame) : H ≈ G ↔ H + G ≈ 0 := by rw [equiv_iff_game_eq, ← add_right_cancel_iff (a := ⟦G⟧), mk'_add_self, ← quot_add, equiv_iff_game_eq, quot_zero]
theorem
SetTheory
[ "Mathlib.SetTheory.Game.Basic", "Mathlib.Tactic.NthRewrite", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Impartial.lean
equiv_iff_add_equiv_zero
This lemma doesn't require `H` to be impartial.
equiv_iff_add_equiv_zero' (H : PGame) : G ≈ H ↔ G + H ≈ 0 := by rw [equiv_iff_game_eq, ← add_left_cancel_iff, mk'_add_self, ← quot_add, equiv_iff_game_eq, Eq.comm, quot_zero]
theorem
SetTheory
[ "Mathlib.SetTheory.Game.Basic", "Mathlib.Tactic.NthRewrite", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Impartial.lean
equiv_iff_add_equiv_zero'
This lemma doesn't require `H` to be impartial.
le_zero_iff {G : PGame} [G.Impartial] : G ≤ 0 ↔ 0 ≤ G := by rw [← zero_le_neg_iff, le_congr_right (neg_equiv_self G)]
theorem
SetTheory
[ "Mathlib.SetTheory.Game.Basic", "Mathlib.Tactic.NthRewrite", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Impartial.lean
le_zero_iff
null
lf_zero_iff {G : PGame} [G.Impartial] : G ⧏ 0 ↔ 0 ⧏ G := by rw [← zero_lf_neg_iff, lf_congr_right (neg_equiv_self G)]
theorem
SetTheory
[ "Mathlib.SetTheory.Game.Basic", "Mathlib.Tactic.NthRewrite", "Mathlib.Tactic.Linter.DeprecatedModule" ]
Mathlib/SetTheory/Game/Impartial.lean
lf_zero_iff
null