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.

@[inline, reducible]
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.

Instances For

    Negation of games.

    Instances For

      The less or fuzzy relation on games.

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

      Instances For
        @[simp]

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

        @[simp]

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

        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.

        The fuzzy, confused, or incomparable relation on games.

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

        Instances For

          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, x*yL + xR*y - xR*yL }.

          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.

          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.

            Instances For
              @[simp]
              theorem SetTheory.PGame.mk_mul_moveLeft_inl {xl : Type u_1} {xr : Type u_1} {yl : Type u_1} {yr : Type u_1} {xL : xlSetTheory.PGame} {xR : xrSetTheory.PGame} {yL : ylSetTheory.PGame} {yR : yrSetTheory.PGame} {i : xl} {j : yl} :
              SetTheory.PGame.moveLeft (SetTheory.PGame.mk xl xr xL xR * SetTheory.PGame.mk yl yr yL yR) (Sum.inl (i, j)) = xL i * SetTheory.PGame.mk yl yr yL yR + SetTheory.PGame.mk xl xr xL xR * yL j - xL i * yL j
              @[simp]
              theorem SetTheory.PGame.mk_mul_moveLeft_inr {xl : Type u_1} {xr : Type u_1} {yl : Type u_1} {yr : Type u_1} {xL : xlSetTheory.PGame} {xR : xrSetTheory.PGame} {yL : ylSetTheory.PGame} {yR : yrSetTheory.PGame} {i : xr} {j : yr} :
              SetTheory.PGame.moveLeft (SetTheory.PGame.mk xl xr xL xR * SetTheory.PGame.mk yl yr yL yR) (Sum.inr (i, j)) = xR i * SetTheory.PGame.mk yl yr yL yR + SetTheory.PGame.mk xl xr xL xR * yR j - xR i * yR j
              @[simp]
              theorem SetTheory.PGame.mk_mul_moveRight_inl {xl : Type u_1} {xr : Type u_1} {yl : Type u_1} {yr : Type u_1} {xL : xlSetTheory.PGame} {xR : xrSetTheory.PGame} {yL : ylSetTheory.PGame} {yR : yrSetTheory.PGame} {i : xl} {j : yr} :
              SetTheory.PGame.moveRight (SetTheory.PGame.mk xl xr xL xR * SetTheory.PGame.mk yl yr yL yR) (Sum.inl (i, j)) = xL i * SetTheory.PGame.mk yl yr yL yR + SetTheory.PGame.mk xl xr xL xR * yR j - xL i * yR j
              @[simp]
              theorem SetTheory.PGame.mk_mul_moveRight_inr {xl : Type u_1} {xr : Type u_1} {yl : Type u_1} {yr : Type u_1} {xL : xlSetTheory.PGame} {xR : xrSetTheory.PGame} {yL : ylSetTheory.PGame} {yR : yrSetTheory.PGame} {i : xr} {j : yl} :
              SetTheory.PGame.moveRight (SetTheory.PGame.mk xl xr xL xR * SetTheory.PGame.mk yl yr yL yR) (Sum.inr (i, j)) = xR i * SetTheory.PGame.mk yl yr yL yR + SetTheory.PGame.mk xl xr xL xR * yL j - xR i * yL j
              theorem SetTheory.PGame.neg_mk_mul_moveLeft_inl {xl : Type u_1} {xr : Type u_1} {yl : Type u_1} {yr : Type u_1} {xL : xlSetTheory.PGame} {xR : xrSetTheory.PGame} {yL : ylSetTheory.PGame} {yR : yrSetTheory.PGame} {i : xl} {j : yr} :
              SetTheory.PGame.moveLeft (-(SetTheory.PGame.mk xl xr xL xR * SetTheory.PGame.mk yl yr yL yR)) (Sum.inl (i, j)) = -(xL i * SetTheory.PGame.mk yl yr yL yR + SetTheory.PGame.mk xl xr xL xR * yR j - xL i * yR j)
              theorem SetTheory.PGame.neg_mk_mul_moveLeft_inr {xl : Type u_1} {xr : Type u_1} {yl : Type u_1} {yr : Type u_1} {xL : xlSetTheory.PGame} {xR : xrSetTheory.PGame} {yL : ylSetTheory.PGame} {yR : yrSetTheory.PGame} {i : xr} {j : yl} :
              SetTheory.PGame.moveLeft (-(SetTheory.PGame.mk xl xr xL xR * SetTheory.PGame.mk yl yr yL yR)) (Sum.inr (i, j)) = -(xR i * SetTheory.PGame.mk yl yr yL yR + SetTheory.PGame.mk xl xr xL xR * yL j - xR i * yL j)
              theorem SetTheory.PGame.neg_mk_mul_moveRight_inl {xl : Type u_1} {xr : Type u_1} {yl : Type u_1} {yr : Type u_1} {xL : xlSetTheory.PGame} {xR : xrSetTheory.PGame} {yL : ylSetTheory.PGame} {yR : yrSetTheory.PGame} {i : xl} {j : yl} :
              SetTheory.PGame.moveRight (-(SetTheory.PGame.mk xl xr xL xR * SetTheory.PGame.mk yl yr yL yR)) (Sum.inl (i, j)) = -(xL i * SetTheory.PGame.mk yl yr yL yR + SetTheory.PGame.mk xl xr xL xR * yL j - xL i * yL j)
              theorem SetTheory.PGame.neg_mk_mul_moveRight_inr {xl : Type u_1} {xr : Type u_1} {yl : Type u_1} {yr : Type u_1} {xL : xlSetTheory.PGame} {xR : xrSetTheory.PGame} {yL : ylSetTheory.PGame} {yR : yrSetTheory.PGame} {i : xr} {j : yr} :
              SetTheory.PGame.moveRight (-(SetTheory.PGame.mk xl xr xL xR * SetTheory.PGame.mk yl yr yL yR)) (Sum.inr (i, j)) = -(xR i * SetTheory.PGame.mk yl yr yL yR + SetTheory.PGame.mk xl xr xL xR * yR j - xR i * yR j)
              theorem SetTheory.PGame.leftMoves_mul_cases {x : SetTheory.PGame} {y : SetTheory.PGame} (k : SetTheory.PGame.LeftMoves (x * y)) {P : SetTheory.PGame.LeftMoves (x * y)Prop} (hl : (ix : SetTheory.PGame.LeftMoves x) → (iy : SetTheory.PGame.LeftMoves y) → P (SetTheory.PGame.toLeftMovesMul (Sum.inl (ix, iy)))) (hr : (jx : SetTheory.PGame.RightMoves x) → (jy : SetTheory.PGame.RightMoves y) → P (SetTheory.PGame.toLeftMovesMul (Sum.inr (jx, jy)))) :
              P k
              theorem SetTheory.PGame.rightMoves_mul_cases {x : SetTheory.PGame} {y : SetTheory.PGame} (k : SetTheory.PGame.RightMoves (x * y)) {P : SetTheory.PGame.RightMoves (x * y)Prop} (hl : (ix : SetTheory.PGame.LeftMoves x) → (jy : SetTheory.PGame.RightMoves y) → P (SetTheory.PGame.toRightMovesMul (Sum.inl (ix, jy)))) (hr : (jx : SetTheory.PGame.RightMoves x) → (iy : SetTheory.PGame.LeftMoves y) → P (SetTheory.PGame.toRightMovesMul (Sum.inr (jx, iy)))) :
              P k

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

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For

                x * y is equivalent to y * x.

                x * 0 has exactly the same moves as 0.

                Instances For

                  x * 0 is equivalent to 0.

                  0 * x has exactly the same moves as 0.

                  Instances For

                    0 * x is equivalent to 0.

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

                    Instances For

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

                      Instances For

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

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

                        x * 1 has the same moves as x.

                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For

                          x * 1 is equivalent to x.

                          1 * x has the same moves as x.

                          Instances For

                            1 * x is equivalent to x.

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

                            inductive SetTheory.PGame.InvTy (l : Type u) (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
                              def SetTheory.PGame.invVal {l : Type u_1} {r : Type u_1} (L : lSetTheory.PGame) (R : rSetTheory.PGame) (IHl : lSetTheory.PGame) (IHr : rSetTheory.PGame) {b : Bool} :

                              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 : Type u} {r : Type u} {b : Bool} (L : lSetTheory.PGame) (R : rSetTheory.PGame) (IHl : lSetTheory.PGame) (IHr : rSetTheory.PGame) (i : SetTheory.PGame.InvTy l r b) [IsEmpty l] [IsEmpty r] :
                                SetTheory.PGame.invVal L R IHl IHr 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
                                • One or more equations did not get rendered due to their size.
                                Instances For

                                  inv' 0 has exactly the same moves as 1.

                                  Instances For

                                    inv' 1 has exactly the same moves as 1.

                                    Instances For

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

                                      1⁻¹ has exactly the same moves as 1.

                                      Instances For