Documentation

Mathlib.SetTheory.Game.Basic

Combinatorial games. #

In this file we construct an instance OrderedAddCommGroup SetTheory.Game.

Multiplication on pre-games #

We define the operations of multiplication and inverse on pre-games, and prove a few basic theorems about them. Multiplication is not well-behaved under equivalence of pre-games i.e. x ≈ y does not imply x * z ≈ y * z. Hence, multiplication is not a well-defined operation on games. Nevertheless, the abelian group structure on games allows us to simplify many proofs for pre-games.

@[reducible, inline]
abbrev SetTheory.Game :
Type (u_1 + 1)

The type of combinatorial games. In ZFC, a combinatorial game is constructed from two sets of combinatorial games that have been constructed at an earlier stage. To do this in type theory, we say that a combinatorial pre-game is built inductively from two families of combinatorial games indexed over any type in Type u. The resulting type PGame.{u} lives in Type (u+1), reflecting that it is a proper class in ZFC. A combinatorial game is then constructed by quotienting by the equivalence x ≈ y ↔ x ≤ y ∧ y ≤ x.

Equations
    Instances For

      Negation of games.

      Equations

        The less or fuzzy relation on games.

        If 0 ⧏ x (less or fuzzy with), then Left can win x as the first player.

        Equations
          Instances For
            @[simp]
            theorem SetTheory.Game.not_le {x y : Game} :
            ¬x y y.LF x

            On Game, simp-normal inequalities should use as few negations as possible.

            @[simp]
            theorem SetTheory.Game.not_lf {x y : Game} :
            ¬x.LF y y x

            On Game, simp-normal inequalities should use as few negations as possible.

            The fuzzy, confused, or incomparable relation on games.

            If x ‖ 0, then the first player can always win x.

            Equations
              Instances For

                It can be useful to use these lemmas to turn PGame inequalities into Game inequalities, as the AddCommGroup structure on Game often simplifies many proofs.

                theorem SetTheory.PGame.game_eq {x y : PGame} :
                x yx = y

                Alias of the forward direction of SetTheory.PGame.equiv_iff_game_eq.

                theorem SetTheory.Game.add_lf_add_right {b c : Game} :
                b.LF c∀ (a : Game), (b + a).LF (c + a)
                theorem SetTheory.Game.add_lf_add_left {b c : Game} :
                b.LF c∀ (a : Game), (a + b).LF (a + c)

                A small family of games is bounded above.

                A small set of games is bounded above.

                A small family of games is bounded below.

                A small set of games is bounded below.

                @[simp]
                theorem SetTheory.PGame.quot_natCast (n : ) :
                n = n

                Multiplicative operations can be defined at the level of pre-games, but to prove their properties we need to use the abelian group structure of games. Hence we define them here.

                The product of x = {xL | xR} and y = {yL | yR} is {xL*y + x*yL - xL*yL, xR*y + x*yR - xR*yR | xL*y + x*yR - xL*yR, xR*y + x*yL - xR*yL}.

                Equations

                  Turns two left or right moves for x and y into a left move for x * y and vice versa.

                  Even though these types are the same (not definitionally so), this is the preferred way to convert between them.

                  Equations
                    Instances For

                      Turns a left and a right move for x and y into a right move for x * y and vice versa.

                      Even though these types are the same (not definitionally so), this is the preferred way to convert between them.

                      Equations
                        Instances For
                          @[simp]
                          theorem SetTheory.PGame.mk_mul_moveLeft_inl {xl xr yl yr : Type u_1} {xL : xlPGame} {xR : xrPGame} {yL : ylPGame} {yR : yrPGame} {i : xl} {j : yl} :
                          (mk xl xr xL xR * mk yl yr yL yR).moveLeft (Sum.inl (i, j)) = xL i * mk yl yr yL yR + mk xl xr xL xR * yL j - xL i * yL j
                          @[simp]
                          theorem SetTheory.PGame.mul_moveLeft_inl {x y : PGame} {i : x.LeftMoves} {j : y.LeftMoves} :
                          @[simp]
                          theorem SetTheory.PGame.mk_mul_moveLeft_inr {xl xr yl yr : Type u_1} {xL : xlPGame} {xR : xrPGame} {yL : ylPGame} {yR : yrPGame} {i : xr} {j : yr} :
                          (mk xl xr xL xR * mk yl yr yL yR).moveLeft (Sum.inr (i, j)) = xR i * mk yl yr yL yR + mk xl xr xL xR * yR j - xR i * yR j
                          @[simp]
                          @[simp]
                          theorem SetTheory.PGame.mk_mul_moveRight_inl {xl xr yl yr : Type u_1} {xL : xlPGame} {xR : xrPGame} {yL : ylPGame} {yR : yrPGame} {i : xl} {j : yr} :
                          (mk xl xr xL xR * mk yl yr yL yR).moveRight (Sum.inl (i, j)) = xL i * mk yl yr yL yR + mk xl xr xL xR * yR j - xL i * yR j
                          @[simp]
                          @[simp]
                          theorem SetTheory.PGame.mk_mul_moveRight_inr {xl xr yl yr : Type u_1} {xL : xlPGame} {xR : xrPGame} {yL : ylPGame} {yR : yrPGame} {i : xr} {j : yl} :
                          (mk xl xr xL xR * mk yl yr yL yR).moveRight (Sum.inr (i, j)) = xR i * mk yl yr yL yR + mk xl xr xL xR * yL j - xR i * yL j
                          @[simp]
                          @[simp]
                          theorem SetTheory.PGame.neg_mk_mul_moveLeft_inl {xl xr yl yr : Type u_1} {xL : xlPGame} {xR : xrPGame} {yL : ylPGame} {yR : yrPGame} {i : xl} {j : yr} :
                          (-(mk xl xr xL xR * mk yl yr yL yR)).moveLeft (Sum.inl (i, j)) = -(xL i * mk yl yr yL yR + mk xl xr xL xR * yR j - xL i * yR j)
                          @[simp]
                          theorem SetTheory.PGame.neg_mk_mul_moveLeft_inr {xl xr yl yr : Type u_1} {xL : xlPGame} {xR : xrPGame} {yL : ylPGame} {yR : yrPGame} {i : xr} {j : yl} :
                          (-(mk xl xr xL xR * mk yl yr yL yR)).moveLeft (Sum.inr (i, j)) = -(xR i * mk yl yr yL yR + mk xl xr xL xR * yL j - xR i * yL j)
                          @[simp]
                          theorem SetTheory.PGame.neg_mk_mul_moveRight_inl {xl xr yl yr : Type u_1} {xL : xlPGame} {xR : xrPGame} {yL : ylPGame} {yR : yrPGame} {i : xl} {j : yl} :
                          (-(mk xl xr xL xR * mk yl yr yL yR)).moveRight (Sum.inl (i, j)) = -(xL i * mk yl yr yL yR + mk xl xr xL xR * yL j - xL i * yL j)
                          @[simp]
                          theorem SetTheory.PGame.neg_mk_mul_moveRight_inr {xl xr yl yr : Type u_1} {xL : xlPGame} {xR : xrPGame} {yL : ylPGame} {yR : yrPGame} {i : xr} {j : yr} :
                          (-(mk xl xr xL xR * mk yl yr yL yR)).moveRight (Sum.inr (i, j)) = -(xR i * mk yl yr yL yR + mk xl xr xL xR * yR j - xR i * yR j)
                          theorem SetTheory.PGame.leftMoves_mul_cases {x y : PGame} (k : (x * y).LeftMoves) {P : (x * y).LeftMovesProp} (hl : ∀ (ix : x.LeftMoves) (iy : y.LeftMoves), P (toLeftMovesMul (Sum.inl (ix, iy)))) (hr : ∀ (jx : x.RightMoves) (jy : y.RightMoves), P (toLeftMovesMul (Sum.inr (jx, jy)))) :
                          P k
                          theorem SetTheory.PGame.rightMoves_mul_cases {x y : PGame} (k : (x * y).RightMoves) {P : (x * y).RightMovesProp} (hl : ∀ (ix : x.LeftMoves) (jy : y.RightMoves), P (toRightMovesMul (Sum.inl (ix, jy)))) (hr : ∀ (jx : x.RightMoves) (iy : y.LeftMoves), P (toRightMovesMul (Sum.inr (jx, iy)))) :
                          P k
                          @[irreducible]
                          theorem SetTheory.PGame.mul_comm (x y : PGame) :
                          (x * y).Identical (y * x)

                          x * y and y * x have the same moves.

                          @[irreducible]

                          x * y and y * x have the same moves.

                          Equations
                            Instances For
                              theorem SetTheory.PGame.mul_comm_equiv (x y : PGame) :
                              x * y y * x

                              x * y is equivalent to y * x.

                              theorem SetTheory.PGame.mul_zero (x : PGame) :
                              (x * 0).Identical 0

                              x * 0 has exactly the same moves as 0.

                              x * 0 has exactly the same moves as 0.

                              Equations
                                Instances For

                                  x * 0 is equivalent to 0.

                                  @[simp]
                                  theorem SetTheory.PGame.zero_mul (x : PGame) :
                                  (0 * x).Identical 0

                                  0 * x has exactly the same moves as 0.

                                  0 * x has exactly the same moves as 0.

                                  Equations
                                    Instances For

                                      0 * x is equivalent to 0.

                                      @[simp]
                                      @[irreducible]

                                      -x * y and -(x * y) have the same moves.

                                      Equations
                                        Instances For
                                          @[simp, irreducible]
                                          theorem SetTheory.PGame.mul_neg (x y : PGame) :
                                          x * -y = -(x * y)

                                          x * -y and -(x * y) have the same moves.

                                          theorem SetTheory.PGame.neg_mul (x y : PGame) :
                                          (-x * y).Identical (-(x * y))

                                          -x * y and -(x * y) have the same moves.

                                          x * -y and -(x * y) have the same moves.

                                          Equations
                                            Instances For
                                              @[simp, irreducible]
                                              theorem SetTheory.PGame.quot_left_distrib (x y z : PGame) :
                                              x * (y + z) = x * y + x * z
                                              theorem SetTheory.PGame.left_distrib_equiv (x y z : PGame) :
                                              x * (y + z) x * y + x * z

                                              x * (y + z) is equivalent to x * y + x * z.

                                              @[simp]
                                              @[simp]
                                              theorem SetTheory.PGame.quot_right_distrib (x y z : PGame) :
                                              (x + y) * z = x * z + y * z
                                              theorem SetTheory.PGame.right_distrib_equiv (x y z : PGame) :
                                              (x + y) * z x * z + y * z

                                              (x + y) * z is equivalent to x * z + y * z.

                                              @[simp]

                                              x * 1 has the same moves as x.

                                              Equations
                                                Instances For
                                                  theorem SetTheory.PGame.one_mul (x : PGame) :
                                                  (1 * x).Identical x

                                                  1 * x has the same moves as x.

                                                  theorem SetTheory.PGame.mul_one (x : PGame) :
                                                  (x * 1).Identical x

                                                  x * 1 has the same moves as x.

                                                  x * 1 is equivalent to x.

                                                  1 * x has the same moves as x.

                                                  Equations
                                                    Instances For

                                                      1 * x is equivalent to x.

                                                      @[irreducible]
                                                      theorem SetTheory.PGame.quot_mul_assoc (x y z : PGame) :
                                                      x * y * z = x * (y * z)
                                                      theorem SetTheory.PGame.mul_assoc_equiv (x y z : PGame) :
                                                      x * y * z x * (y * z)

                                                      x * y * z is equivalent to x * (y * z).

                                                      The left options of x * y of the first kind, i.e. of the form xL * y + x * yL - xL * yL.

                                                      Equations
                                                        Instances For

                                                          Any left option of x * y of the first kind is also a left option of x * -(-y) of the first kind.

                                                          The left options of x * y agree with that of y * x up to equivalence.

                                                          theorem SetTheory.PGame.leftMoves_mul_iff {x y : PGame} (P : GameProp) :
                                                          (∀ (k : (x * y).LeftMoves), P (x * y).moveLeft k) (∀ (i : x.LeftMoves) (j : y.LeftMoves), P x.mulOption y i j) ∀ (i : (-x).LeftMoves) (j : (-y).LeftMoves), P (-x).mulOption (-y) i j

                                                          The left options of x * y of the second kind are the left options of (-x) * (-y) of the first kind, up to equivalence.

                                                          theorem SetTheory.PGame.rightMoves_mul_iff {x y : PGame} (P : GameProp) :
                                                          (∀ (k : (x * y).RightMoves), P (x * y).moveRight k) (∀ (i : x.LeftMoves) (j : (-y).LeftMoves), P (-x.mulOption (-y) i j)) ∀ (i : (-x).LeftMoves) (j : y.LeftMoves), P (-(-x).mulOption y i j)

                                                          The right options of x * y are the left options of x * (-y) and of (-x) * y of the first kind, up to equivalence.

                                                          inductive SetTheory.PGame.InvTy (l r : Type u) :
                                                          BoolType u

                                                          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.

                                                          Instances For
                                                            Equations
                                                              def SetTheory.PGame.invVal {l r : Type u_1} (L : lPGame) (R : rPGame) (IHl : lPGame) (IHr : rPGame) (x : PGame) {b : Bool} :
                                                              InvTy l r bPGame

                                                              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.

                                                              Equations
                                                                Instances For
                                                                  @[simp]
                                                                  theorem SetTheory.PGame.invVal_isEmpty {l r : Type u} {b : Bool} (L : lPGame) (R : rPGame) (IHl : lPGame) (IHr : rPGame) (i : InvTy l r b) (x : PGame) [IsEmpty l] [IsEmpty r] :
                                                                  invVal L R IHl IHr x i = 0

                                                                  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.

                                                                  Equations
                                                                    Instances For

                                                                      inv' 0 has exactly the same moves as 1.

                                                                      Equations
                                                                        Instances For

                                                                          inv' 1 has exactly the same moves as 1.

                                                                          inv' 1 has exactly the same moves as 1.

                                                                          Equations
                                                                            Instances For
                                                                              noncomputable instance SetTheory.PGame.instInv :

                                                                              The inverse of a pre-game in terms of the inverse on positive pre-games.

                                                                              Equations
                                                                                noncomputable instance SetTheory.PGame.instDiv :
                                                                                Equations

                                                                                  1⁻¹ has exactly the same moves as 1.

                                                                                  1⁻¹ has exactly the same moves as 1.

                                                                                  Equations
                                                                                    Instances For