Documentation

CombinatorialGames.SignExpansion.Basic

Sign expansions #

In this repository we define the type of Surreal numbers following Conway's theory of games. A popular alternative is to instead define the surreals as potentially infinite "expansions of signs", setting for instance + = 1, - = -1, +- = ½, etc.

This file defines the type SignExpansion and constructs its basic instances. We do not yet link it to the development of surreal numbers.

For Mathlib #

theorem Set.preimage_neg {α : Type u_1} {ι : Type u_2} [InvolutiveNeg α] (f : ια) {s : Set α} :
f ⁻¹' (-s) = (-f) ⁻¹' s
@[simp]
theorem Pi.Lex.neg_apply {α : Type u_1} {β : Type u_2} [Neg β] (x : Lex (αβ)) (i : α) :
(-x) i = -x i
theorem Pi.Lex.neg_lt_neg {α : Type u_1} [LinearOrder α] [WellFoundedLT α] {x y : Lex (αSignType)} (h : x < y) :
-y < -x
@[simp]
theorem Pi.Lex.neg_lt_neg_iff {α : Type u_1} [LinearOrder α] [WellFoundedLT α] {x y : Lex (αSignType)} :
-x < -y y < x
@[simp]
theorem Pi.Lex.neg_le_neg_iff {α : Type u_1} [LinearOrder α] [WellFoundedLT α] {x y : Lex (αSignType)} :
-x -y y x
theorem Pi.Lex.neg_lt_iff {α : Type u_1} [LinearOrder α] [WellFoundedLT α] {x y : Lex (αSignType)} :
-x < y -y < x
theorem Pi.Lex.lt_neg_iff {α : Type u_1} [LinearOrder α] [WellFoundedLT α] {x y : Lex (αSignType)} :
x < -y y < -x
theorem Pi.Lex.neg_le_iff {α : Type u_1} [LinearOrder α] [WellFoundedLT α] {x y : Lex (αSignType)} :
-x y -y x
theorem Pi.Lex.le_neg_iff {α : Type u_1} [LinearOrder α] [WellFoundedLT α] {x y : Lex (αSignType)} :
x -y y -x

Sign expansions #

structure SignExpansion :
Type (u + 1)

A sign expansion is a an ordinal indexed sequence of 1s and -1s, followed by 0s.

Instances For

    Every sign after the first 0 is also 0.

    def SignExpansion.copy (x : SignExpansion) (sign : NatOrdinalSignType) (h : sign = x) :

    Adjust definitional equalities of a sign expansion.

    Equations
    • x.copy sign h = { sign := sign, isUpperSet_preimage_singleton_zero' := }
    Instances For
      @[simp]
      theorem SignExpansion.copy_eq (x : SignExpansion) (sign : NatOrdinalSignType) (h : sign = x) :
      x.copy sign h = x
      @[simp]
      theorem SignExpansion.coe_mk (f : NatOrdinalSignType) (h : IsUpperSet (f ⁻¹' {0})) :
      { sign := f, isUpperSet_preimage_singleton_zero' := h } = f
      @[simp]
      theorem SignExpansion.ext {x y : SignExpansion} (hxy : ∀ (o : NatOrdinal), x o = y o) :
      x = y
      theorem SignExpansion.ext_iff {x y : SignExpansion} :
      x = y ∀ (o : NatOrdinal), x o = y o
      @[simp]
      theorem SignExpansion.mk_eq_mk {f g : NatOrdinalSignType} {h₁ : IsUpperSet (f ⁻¹' {0})} {h₂ : IsUpperSet (g ⁻¹' {0})} :
      { sign := f, isUpperSet_preimage_singleton_zero' := h₁ } = { sign := g, isUpperSet_preimage_singleton_zero' := h₂ } f = g
      theorem SignExpansion.apply_eq_zero_of_le {x : SignExpansion} {o o' : Ordinal.{u_1}} (hoo' : o o') (ho : x o = 0) :
      x o' = 0

      The length of a sign expansion is the smallest ordinal at which it equals zero, or is no such ordinal exists.

      Equations
      Instances For

        Basic sign expansions #

        @[simp]
        theorem SignExpansion.coe_zero :
        0 = 0
        @[simp]
        theorem SignExpansion.coe_bot :
        = -1
        @[simp]
        Equations
        @[simp]
        theorem SignExpansion.coe_neg (x : SignExpansion) :
        ⇑(-x) = -x
        @[simp]
        theorem SignExpansion.neg_mk (f : NatOrdinalSignType) (h : IsUpperSet (f ⁻¹' {0})) :
        -{ sign := f, isUpperSet_preimage_singleton_zero' := h } = { sign := -f, isUpperSet_preimage_singleton_zero' := }
        @[simp]

        Cut off the part of a sign expansion after an ordinal o, by filling it in with zeros.

        Equations
        Instances For

          Cut off the part of a sign expansion after an ordinal o, by filling it in with zeros.

          Conventions for notations in identifiers:

          • The recommended spelling of in identifiers is restrict.
          Equations
          Instances For
            theorem SignExpansion.coe_restrict (x : SignExpansion) (o : WithTop NatOrdinal) :
            (x.restrict o) = fun (i : NatOrdinal) => if i < o then x i else 0
            theorem SignExpansion.restrict_apply_of_coe_lt {x : SignExpansion} {o₁ : WithTop NatOrdinal} {o₂ : NatOrdinal} (h : o₂ < o₁) :
            (x.restrict o₁) o₂ = x o₂
            theorem SignExpansion.restrict_apply_of_le_coe {x : SignExpansion} {o₁ : WithTop NatOrdinal} {o₂ : NatOrdinal} (h : o₁ o₂) :
            (x.restrict o₁) o₂ = 0

            Order structure #

            Equations
            • One or more equations did not get rendered due to their size.
            theorem SignExpansion.neg_lt_neg {x y : SignExpansion} (h : x < y) :
            -y < -x
            @[simp]

            Floor function #

            The floor function on a function NatOrdinalSignType "rounds" it downwards to the nearest valid SignExpansion.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              theorem SignExpansion.floor_of_isUpperSet {f : NatOrdinalSignType} (hf : IsUpperSet (f ⁻¹' {0})) :
              floor f = { sign := f, isUpperSet_preimage_singleton_zero' := hf }
              @[simp]

              floor as a Galois coinsertion.

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

                Ceiling function #

                The ceiling function on a function NatOrdinalSignType "rounds" it upwards to the nearest valid SignExpansion.

                Equations
                Instances For
                  theorem SignExpansion.ceil_of_isUpperSet {f : NatOrdinalSignType} (hf : IsUpperSet (f ⁻¹' {0})) :
                  ceil f = { sign := f, isUpperSet_preimage_singleton_zero' := hf }
                  @[simp]
                  theorem SignExpansion.ceil_apply_of_lt_sInf {f : NatOrdinalSignType} {a : NatOrdinal} (hf : a < sInf (f ⁻¹' {0})) :
                  (ceil f) a = f a

                  ceil as a Galois insertion.

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

                    Complete linear order instance #

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Equations
                    • One or more equations did not get rendered due to their size.
                    theorem SignExpansion.coe_sInf (s : Set SignExpansion) :
                    (sInf s) = ofLex (sInf ((fun (x : SignExpansion) => toLex x) '' s))
                    theorem SignExpansion.coe_iInf {ι : Sort u_1} (f : ιSignExpansion) :
                    (⨅ (i : ι), f i) = ofLex (⨅ (i : ι), toLex (f i))
                    theorem SignExpansion.sInf_apply (s : Set SignExpansion) (i : NatOrdinal) :
                    (sInf s) i = ⨅ (x : { x : SignExpansion // x s j < i, x j = (sInf s) j }), x i
                    theorem SignExpansion.coe_sSup (s : Set SignExpansion) :
                    (sSup s) = ofLex (sSup ((fun (x : SignExpansion) => toLex x) '' s))
                    theorem SignExpansion.coe_iSup {ι : Sort u_1} (f : ιSignExpansion) :
                    (⨆ (i : ι), f i) = ofLex (⨆ (i : ι), toLex (f i))
                    theorem SignExpansion.sSup_apply (s : Set SignExpansion) (i : NatOrdinal) :
                    (sSup s) i = ⨆ (x : { x : SignExpansion // x s j < i, x j = (sSup s) j }), x i