Skip to content

Commit 711980b

Browse files
hwatheoderic-wieser
andcommitted
feat(SetTheory/Game/PGame): inserting an option a game (#14517)
inserting an option into a game Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
1 parent 548ca52 commit 711980b

File tree

2 files changed

+101
-0
lines changed

2 files changed

+101
-0
lines changed

Mathlib/SetTheory/Game/PGame.lean

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1904,6 +1904,87 @@ theorem lt_iff_sub_pos {x y : PGame} : x < y ↔ 0 < y - x :=
19041904
19051905
#align pgame.lt_iff_sub_pos SetTheory.PGame.lt_iff_sub_pos
19061906

1907+
/-! ### Inserting an option -/
1908+
1909+
/-- The pregame constructed by inserting `x'` as a new left option into x. -/
1910+
def insertLeft (x x' : PGame.{u}) : PGame :=
1911+
match x with
1912+
| mk xl xr xL xR => mk (xl ⊕ PUnit) xr (Sum.elim xL fun _ => x') xR
1913+
1914+
/-- A new left option cannot hurt Left. -/
1915+
lemma le_insertLeft (x x' : PGame) : x ≤ insertLeft x x' := by
1916+
rw [le_def]
1917+
constructor
1918+
· intro i
1919+
left
1920+
rcases x with ⟨xl, xr, xL, xR⟩
1921+
simp only [insertLeft, leftMoves_mk, moveLeft_mk, Sum.exists, Sum.elim_inl]
1922+
left
1923+
use i
1924+
· intro j
1925+
right
1926+
rcases x with ⟨xl, xr, xL, xR⟩
1927+
simp only [rightMoves_mk, moveRight_mk, insertLeft]
1928+
use j
1929+
1930+
/-- Adding a gift horse left option does not change the value of `x`. A gift horse left option is
1931+
a game `x'` with `x' ⧏ x`. It is called "gift horse" because it seems like Left has gotten the
1932+
"gift" of a new option, but actually the value of the game did not change. -/
1933+
lemma insertLeft_equiv_of_lf {x x' : PGame} (h : x' ⧏ x) : insertLeft x x' ≈ x := by
1934+
rw [equiv_def]
1935+
constructor
1936+
· rw [le_def]
1937+
constructor
1938+
· intro i
1939+
rcases x with ⟨xl, xr, xL, xR⟩
1940+
simp only [insertLeft, leftMoves_mk, moveLeft_mk] at i ⊢
1941+
rcases i with i | _
1942+
· simp only [Sum.elim_inl]
1943+
left
1944+
use i
1945+
· simp only [Sum.elim_inr]
1946+
rw [lf_iff_exists_le] at h
1947+
simp only [leftMoves_mk, moveLeft_mk] at h
1948+
exact h
1949+
· intro j
1950+
right
1951+
rcases x with ⟨xl, xr, xL, xR⟩
1952+
simp only [insertLeft, rightMoves_mk, moveRight_mk]
1953+
use j
1954+
· apply le_insertLeft
1955+
1956+
/-- The pregame constructed by inserting `x'` as a new right option into x. -/
1957+
def insertRight (x x' : PGame.{u}) : PGame :=
1958+
match x with
1959+
| mk xl xr xL xR => mk xl (xr ⊕ PUnit) xL (Sum.elim xR fun _ => x')
1960+
1961+
theorem neg_insertRight_neg (x x' : PGame.{u}) : (-x).insertRight (-x') = -x.insertLeft x' := by
1962+
cases x
1963+
cases x'
1964+
dsimp [insertRight, insertLeft]
1965+
congr! with (i | j)
1966+
1967+
theorem neg_insertLeft_neg (x x' : PGame.{u}) : (-x).insertLeft (-x') = -x.insertRight x' := by
1968+
rw [← neg_eq_iff_eq_neg, ← neg_insertRight_neg, neg_neg, neg_neg]
1969+
1970+
/-- A new right option cannot hurt Right. -/
1971+
lemma insertRight_le (x x' : PGame) : insertRight x x' ≤ x := by
1972+
rw [← neg_le_neg_iff, ← neg_insertLeft_neg]
1973+
exact le_insertLeft _ _
1974+
1975+
/-- Adding a gift horse right option does not change the value of `x`. A gift horse right option is
1976+
a game `x'` with `x ⧏ x'`. It is called "gift horse" because it seems like Right has gotten the
1977+
"gift" of a new option, but actually the value of the game did not change. -/
1978+
lemma insertRight_equiv_of_lf {x x' : PGame} (h : x ⧏ x') : insertRight x x' ≈ x := by
1979+
rw [← neg_equiv_neg_iff, ← neg_insertLeft_neg]
1980+
exact insertLeft_equiv_of_lf (neg_lf_neg_iff.mpr h)
1981+
1982+
/-- Inserting on the left and right commutes. -/
1983+
theorem insertRight_insertLeft {x x' x'' : PGame} :
1984+
insertRight (insertLeft x x') x'' = insertLeft (insertRight x x'') x' := by
1985+
cases x; cases x'; cases x''
1986+
dsimp [insertLeft, insertRight]
1987+
19071988
/-! ### Special pre-games -/
19081989

19091990

Mathlib/SetTheory/Surreal/Basic.lean

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,26 @@ theorem Numeric.neg : ∀ {x : PGame} (_ : Numeric x), Numeric (-x)
215215
fun j i => neg_lt_neg_iff.2 (o.1 i j), fun j => (o.2.2 j).neg, fun i => (o.2.1 i).neg⟩
216216
#align pgame.numeric.neg SetTheory.PGame.Numeric.neg
217217

218+
/-- Inserting a smaller numeric left option into a numeric game results in a numeric game. -/
219+
theorem insertLeft_numeric {x x' : PGame} (x_num : x.Numeric) (x'_num : x'.Numeric)
220+
(h : x' ≤ x) : (insertLeft x x').Numeric := by
221+
rw [le_iff_forall_lt x'_num x_num] at h
222+
unfold Numeric at x_num ⊢
223+
rcases x with ⟨xl, xr, xL, xR⟩
224+
simp only [insertLeft, Sum.forall, forall_const, Sum.elim_inl, Sum.elim_inr] at x_num ⊢
225+
constructor
226+
· simp only [x_num.1, implies_true, true_and]
227+
simp only [rightMoves_mk, moveRight_mk] at h
228+
exact h.2
229+
· simp only [x_num, implies_true, x'_num, and_self]
230+
231+
/-- Inserting a larger numeric right option into a numeric game results in a numeric game. -/
232+
theorem insertRight_numeric {x x' : PGame} (x_num : x.Numeric) (x'_num : x'.Numeric)
233+
(h : x ≤ x') : (insertRight x x').Numeric := by
234+
rw [← neg_neg (x.insertRight x'), ← neg_insertLeft_neg]
235+
apply Numeric.neg
236+
exact insertLeft_numeric (Numeric.neg x_num) (Numeric.neg x'_num) (neg_le_neg_iff.mpr h)
237+
218238
namespace Numeric
219239

220240
theorem moveLeft_lt {x : PGame} (o : Numeric x) (i) : x.moveLeft i < x :=

0 commit comments

Comments
 (0)