Documentation

Mathlib.Algebra.Tropical.Basic

Tropical algebraic structures #

This file defines algebraic structures of the (min-)tropical numbers, up to the tropical semiring. Some basic lemmas about conversion from the base type R to Tropical R are provided, as well as the expected implementations of tropical addition and tropical multiplication.

Main declarations #

Implementation notes #

The tropical structure relies on Top and min. For the max-tropical numbers, use OrderDual R.

Inspiration was drawn from the implementation of Additive/Multiplicative/Opposite, where a type synonym is created with some barebones API, and quickly made irreducible.

Algebraic structures are provided with as few typeclass assumptions as possible, even though most references rely on Semiring (Tropical R) for building up the whole theory.

References followed #

@[irreducible]
def Tropical (R : Type u) :

The tropicalization of a type R.

Instances For
    def Tropical.trop {R : Type u} :
    R โ†’ Tropical R

    Reinterpret x : R as an element of Tropical R. See Tropical.tropEquiv for the equivalence.

    Instances For
      def Tropical.untrop {R : Type u} :
      Tropical R โ†’ R

      Reinterpret x : Tropical R as an element of R. See Tropical.tropEquiv for the equivalence.

      Instances For
        theorem Tropical.trop_injective {R : Type u} :
        Function.Injective trop
        theorem Tropical.untrop_injective {R : Type u} :
        Function.Injective untrop
        @[simp]
        theorem Tropical.trop_inj_iff {R : Type u} (x y : R) :
        trop x = trop y โ†” x = y
        @[simp]
        theorem Tropical.untrop_inj_iff {R : Type u} (x y : Tropical R) :
        untrop x = untrop y โ†” x = y
        @[simp]
        theorem Tropical.trop_untrop {R : Type u} (x : Tropical R) :
        trop (untrop x) = x
        @[simp]
        theorem Tropical.untrop_trop {R : Type u} (x : R) :
        untrop (trop x) = x
        theorem Tropical.leftInverse_trop {R : Type u} :
        Function.LeftInverse trop untrop
        theorem Tropical.rightInverse_trop {R : Type u} :
        Function.RightInverse trop untrop

        Reinterpret x : R as an element of Tropical R. See Tropical.tropOrderIso for the order-preserving equivalence.

        Instances For
          theorem Tropical.trop_eq_iff_eq_untrop {R : Type u} {x : R} {y : Tropical R} :
          trop x = y โ†” x = untrop y
          theorem Tropical.untrop_eq_iff_eq_trop {R : Type u} {x : Tropical R} {y : R} :
          untrop x = y โ†” x = trop y
          theorem Tropical.injective_trop {R : Type u} :
          Function.Injective trop
          theorem Tropical.injective_untrop {R : Type u} :
          Function.Injective untrop
          theorem Tropical.surjective_trop {R : Type u} :
          Function.Surjective trop
          theorem Tropical.surjective_untrop {R : Type u} :
          Function.Surjective untrop
          @[implicit_reducible]
          instance Tropical.instInhabited {R : Type u} [Inhabited R] :
          Inhabited (Tropical R)
          def Tropical.tropRec {R : Type u} {F : Tropical R โ†’ Sort v} (h : (X : R) โ†’ F (trop X)) (X : Tropical R) :
          F X

          Recursing on an x' : Tropical R is the same as recursing on an x : R reinterpreted as a term of Tropical R via trop x.

          Instances For
            @[implicit_reducible]
            instance Tropical.instDecidableEq {R : Type u} [DecidableEq R] :
            DecidableEq (Tropical R)
            @[implicit_reducible]
            instance Tropical.instLETropical {R : Type u} [LE R] :
            LE (Tropical R)
            @[simp]
            theorem Tropical.untrop_le_iff {R : Type u} [LE R] {x y : Tropical R} :
            untrop x โ‰ค untrop y โ†” x โ‰ค y
            @[implicit_reducible]
            instance Tropical.decidableLE {R : Type u} [LE R] [DecidableLE R] :
            DecidableLE (Tropical R)
            @[implicit_reducible]
            instance Tropical.instLTTropical {R : Type u} [LT R] :
            LT (Tropical R)
            @[simp]
            theorem Tropical.untrop_lt_iff {R : Type u} [LT R] {x y : Tropical R} :
            untrop x < untrop y โ†” x < y
            @[implicit_reducible]
            instance Tropical.decidableLT {R : Type u} [LT R] [DecidableLT R] :
            DecidableLT (Tropical R)

            Reinterpret x : R as an element of Tropical R, preserving the order.

            Instances For
              @[implicit_reducible]
              instance Tropical.instZeroTropical {R : Type u} [Top R] :
              Zero (Tropical R)
              @[implicit_reducible]
              instance Tropical.instTopTropical {R : Type u} [Top R] :
              @[simp]
              theorem Tropical.trop_coe_ne_zero {R : Type u} (x : R) :
              trop โ†‘x โ‰  0
              @[simp]
              theorem Tropical.zero_ne_trop_coe {R : Type u} (x : R) :
              0 โ‰  trop โ†‘x
              @[simp]
              theorem Tropical.le_zero {R : Type u} [LE R] [OrderTop R] (x : Tropical R) :
              @[implicit_reducible]
              instance Tropical.instOrderTop {R : Type u} [LE R] [OrderTop R] :
              @[implicit_reducible]
              instance Tropical.instAdd {R : Type u} [LinearOrder R] :
              Add (Tropical R)

              Tropical addition is the minimum of two underlying elements of R.

              @[simp]
              theorem Tropical.untrop_add {R : Type u} [LinearOrder R] (x y : Tropical R) :
              untrop (x + y) = min (untrop x) (untrop y)
              @[simp]
              theorem Tropical.trop_min {R : Type u} [LinearOrder R] (x y : R) :
              trop (min x y) = trop x + trop y
              @[simp]
              theorem Tropical.trop_inf {R : Type u} [LinearOrder R] (x y : R) :
              trop (min x y) = trop x + trop y
              theorem Tropical.trop_add_def {R : Type u} [LinearOrder R] (x y : Tropical R) :
              x + y = trop (min (untrop x) (untrop y))
              @[simp]
              theorem Tropical.untrop_sup {R : Type u} [LinearOrder R] (x y : Tropical R) :
              untrop (max x y) = max (untrop x) (untrop y)
              @[simp]
              theorem Tropical.untrop_max {R : Type u} [LinearOrder R] (x y : Tropical R) :
              untrop (max x y) = max (untrop x) (untrop y)
              @[simp]
              theorem Tropical.min_eq_add {R : Type u} [LinearOrder R] :
              min = fun (x1 x2 : Tropical R) => x1 + x2
              @[simp]
              theorem Tropical.inf_eq_add {R : Type u} [LinearOrder R] :
              (fun (x1 x2 : Tropical R) => min x1 x2) = fun (x1 x2 : Tropical R) => x1 + x2
              @[simp]
              theorem Tropical.add_eq_left {R : Type u} [LinearOrder R] โฆƒx y : Tropical Rโฆ„ (h : x โ‰ค y) :
              x + y = x
              @[simp]
              theorem Tropical.add_eq_right {R : Type u} [LinearOrder R] โฆƒx y : Tropical Rโฆ„ (h : y โ‰ค x) :
              x + y = y
              theorem Tropical.add_eq_left_iff {R : Type u} [LinearOrder R] {x y : Tropical R} :
              x + y = x โ†” x โ‰ค y
              theorem Tropical.add_eq_right_iff {R : Type u} [LinearOrder R] {x y : Tropical R} :
              x + y = y โ†” y โ‰ค x
              theorem Tropical.add_self {R : Type u} [LinearOrder R] (x : Tropical R) :
              x + x = x
              theorem Tropical.add_eq_iff {R : Type u} [LinearOrder R] {x y z : Tropical R} :
              x + y = z โ†” x = z โˆง x โ‰ค y โˆจ y = z โˆง y โ‰ค x
              @[simp]
              theorem Tropical.add_eq_zero_iff {R : Type u} [LinearOrder R] {a b : Tropical (WithTop R)} :
              a + b = 0 โ†” a = 0 โˆง b = 0
              @[implicit_reducible]
              instance Tropical.instMulOfAdd {R : Type u} [Add R] :
              Mul (Tropical R)

              Tropical multiplication is the addition in the underlying R.

              @[simp]
              theorem Tropical.trop_add {R : Type u} [Add R] (x y : R) :
              trop (x + y) = trop x * trop y
              @[simp]
              theorem Tropical.untrop_mul {R : Type u} [Add R] (x y : Tropical R) :
              untrop (x * y) = untrop x + untrop y
              theorem Tropical.trop_mul_def {R : Type u} [Add R] (x y : Tropical R) :
              x * y = trop (untrop x + untrop y)
              @[implicit_reducible]
              instance Tropical.instOneTropical {R : Type u} [Zero R] :
              One (Tropical R)
              @[simp]
              theorem Tropical.trop_zero {R : Type u} [Zero R] :
              trop 0 = 1
              @[simp]
              theorem Tropical.untrop_one {R : Type u} [Zero R] :
              untrop 1 = 0
              @[implicit_reducible]
              instance Tropical.instInvOfNeg {R : Type u} [Neg R] :
              Inv (Tropical R)
              @[implicit_reducible]
              instance Tropical.instDivOfSub {R : Type u} [Sub R] :
              Div (Tropical R)
              @[simp]
              theorem Tropical.untrop_div {R : Type u} [Sub R] (x y : Tropical R) :
              untrop (x / y) = untrop x - untrop y
              @[implicit_reducible]
              instance Tropical.instPowOfSMul {R : Type u} {ฮฑ : Type u_1} [SMul ฮฑ R] :
              Pow (Tropical R) ฮฑ
              @[simp]
              theorem Tropical.untrop_pow {R : Type u} {ฮฑ : Type u_1} [SMul ฮฑ R] (x : Tropical R) (n : ฮฑ) :
              untrop (x ^ n) = n โ€ข untrop x
              @[simp]
              theorem Tropical.trop_smul {R : Type u} {ฮฑ : Type u_1} [SMul ฮฑ R] (x : R) (n : ฮฑ) :
              trop (n โ€ข x) = trop x ^ n
              @[implicit_reducible]
              @[simp]
              theorem Tropical.trop_nsmul {R : Type u} [AddMonoid R] (x : R) (n : โ„•) :
              trop (n โ€ข x) = trop x ^ n
              @[implicit_reducible]
              @[simp]
              theorem Tropical.untrop_zpow {R : Type u} [AddGroup R] (x : Tropical R) (n : โ„ค) :
              untrop (x ^ n) = n โ€ข untrop x
              @[simp]
              theorem Tropical.trop_zsmul {R : Type u} [AddGroup R] (x : R) (n : โ„ค) :
              trop (n โ€ข x) = trop x ^ n
              @[implicit_reducible]
              @[simp]
              theorem Tropical.add_pow {R : Type u} [LinearOrder R] [AddMonoid R] [AddLeftMono R] [AddRightMono R] (x y : Tropical R) (n : โ„•) :
              (x + y) ^ n = x ^ n + y ^ n
              @[simp]
              theorem Tropical.succ_nsmul {R : Type u_1} [LinearOrder R] [OrderTop R] (x : Tropical R) (n : โ„•) :
              (n + 1) โ€ข x = x
              theorem Tropical.mul_eq_zero_iff {R : Type u_1} [AddCommMonoid R] {a b : Tropical (WithTop R)} :
              a * b = 0 โ†” a = 0 โˆจ b = 0