Documentation

Mathlib.Algebra.Tropical.Basic

Tropical algebraic structures #

This file defines algebraic structures of the min/max-tropical numbers, up to the tropical semiring. All declarations about MinTropical are translated to MaxTropical using to_dual. Some basic lemmas about conversion from the base type R to MinTropical R/MaxTropical R are provided, as well as the expected implementations of tropical addition and tropical multiplication.

Main declarations #

Implementation notes #

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 (MinTropical R) for building up the whole theory.

References followed #

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

The min-tropicalization of a type R.

Instances For
    @[irreducible]
    def MaxTropical (R : Type u) :

    The max-tropicalization of a type R.

    Instances For
      @[deprecated MinTropical (since := "2026-07-24")]
      def Tropical (R : Type u) :

      The min-tropicalization of a type R.

      Instances For
        def MinTropical.trop {R : Type u} :
        RMinTropical R

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

        Instances For
          def MaxTropical.trop {R : Type u} :
          RMaxTropical R

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

          Instances For
            def MinTropical.untrop {R : Type u} :
            MinTropical RR

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

            Instances For
              def MaxTropical.untrop {R : Type u} :
              MaxTropical RR

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

              Instances For
                @[simp]
                theorem MinTropical.trop_inj_iff {R : Type u} (x y : R) :
                trop x = trop y x = y
                @[simp]
                theorem MaxTropical.trop_inj_iff {R : Type u} (x y : R) :
                trop x = trop y x = y
                @[simp]
                theorem MinTropical.untrop_inj_iff {R : Type u} (x y : MinTropical R) :
                untrop x = untrop y x = y
                @[simp]
                theorem MaxTropical.untrop_inj_iff {R : Type u} (x y : MaxTropical R) :
                untrop x = untrop y x = y
                @[simp]
                theorem MinTropical.trop_untrop {R : Type u} (x : MinTropical R) :
                trop (untrop x) = x
                @[simp]
                theorem MaxTropical.trop_untrop {R : Type u} (x : MaxTropical R) :
                trop (untrop x) = x
                @[simp]
                theorem MinTropical.untrop_trop {R : Type u} (x : R) :
                untrop (trop x) = x
                @[simp]
                theorem MaxTropical.untrop_trop {R : Type u} (x : R) :
                untrop (trop x) = x

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

                Instances For

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

                  Instances For
                    theorem MinTropical.trop_eq_iff_eq_untrop {R : Type u} {x : R} {y : MinTropical R} :
                    trop x = y x = untrop y
                    theorem MaxTropical.trop_eq_iff_eq_untrop {R : Type u} {x : R} {y : MaxTropical R} :
                    trop x = y x = untrop y
                    theorem MinTropical.untrop_eq_iff_eq_trop {R : Type u} {x : MinTropical R} {y : R} :
                    untrop x = y x = trop y
                    theorem MaxTropical.untrop_eq_iff_eq_trop {R : Type u} {x : MaxTropical R} {y : R} :
                    untrop x = y x = trop y
                    @[instance_reducible]
                    @[instance_reducible]
                    def MinTropical.tropRec {R : Type u} {F : MinTropical RSort v} (h : (X : R) → F (trop X)) (X : MinTropical R) :
                    F X

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

                    Instances For
                      def MaxTropical.tropRec {R : Type u} {F : MaxTropical RSort v} (h : (X : R) → F (trop X)) (X : MaxTropical R) :
                      F X

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

                      Instances For
                        @[instance_reducible]
                        @[instance_reducible]
                        @[instance_reducible]
                        instance MinTropical.instLE {R : Type u} [LE R] :
                        @[instance_reducible]
                        instance MaxTropical.instLE {R : Type u} [LE R] :
                        @[simp]
                        theorem MinTropical.untrop_le_iff {R : Type u} [LE R] {x y : MinTropical R} :
                        @[simp]
                        theorem MaxTropical.untrop_le_iff {R : Type u} [LE R] {x y : MaxTropical R} :
                        @[instance_reducible]
                        @[instance_reducible]
                        @[instance_reducible]
                        instance MinTropical.instLT {R : Type u} [LT R] :
                        @[instance_reducible]
                        instance MaxTropical.instLT {R : Type u} [LT R] :
                        @[simp]
                        theorem MinTropical.untrop_lt_iff {R : Type u} [LT R] {x y : MinTropical R} :
                        untrop x < untrop y x < y
                        @[simp]
                        theorem MaxTropical.untrop_lt_iff {R : Type u} [LT R] {x y : MaxTropical R} :
                        untrop y < untrop x y < x
                        @[instance_reducible]
                        @[instance_reducible]
                        @[instance_reducible]
                        @[instance_reducible]

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

                        Instances For

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

                          Instances For
                            @[instance_reducible]
                            @[instance_reducible]
                            @[instance_reducible]
                            @[instance_reducible]
                            @[instance_reducible]
                            instance MinTropical.instTop {R : Type u} [Top R] :
                            @[instance_reducible]
                            instance MaxTropical.instBot {R : Type u} [Bot R] :
                            @[simp]
                            theorem MinTropical.untrop_zero {R : Type u} [Top R] :
                            @[simp]
                            theorem MaxTropical.untrop_zero {R : Type u} [Bot R] :
                            @[simp]
                            theorem MinTropical.trop_top {R : Type u} [Top R] :
                            @[simp]
                            theorem MaxTropical.trop_bot {R : Type u} [Bot R] :
                            @[simp]
                            theorem MinTropical.trop_coe_ne_zero {R : Type u} (x : R) :
                            trop x 0
                            @[simp]
                            theorem MaxTropical.trop_coe_ne_zero {R : Type u} (x : R) :
                            trop x 0
                            @[simp]
                            theorem MinTropical.zero_ne_trop_coe {R : Type u} (x : R) :
                            0 trop x
                            @[simp]
                            theorem MaxTropical.zero_ne_trop_coe {R : Type u} (x : R) :
                            0 trop x
                            @[simp]
                            theorem MinTropical.le_zero {R : Type u} [LE R] [OrderTop R] (x : MinTropical R) :
                            x 0
                            @[simp]
                            theorem MaxTropical.le_zero {R : Type u} [LE R] [OrderBot R] (x : MaxTropical R) :
                            0 x
                            @[instance_reducible]
                            @[instance_reducible]
                            @[instance_reducible]

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

                            @[instance_reducible]

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

                            @[simp]
                            theorem MinTropical.untrop_add {R : Type u} [LinearOrder R] (x y : MinTropical R) :
                            untrop (x + y) = min (untrop x) (untrop y)
                            @[simp]
                            theorem MaxTropical.untrop_add {R : Type u} [LinearOrder R] (x y : MaxTropical R) :
                            untrop (x + y) = max (untrop x) (untrop y)
                            @[simp]
                            theorem MinTropical.trop_min {R : Type u} [LinearOrder R] (x y : R) :
                            trop (min x y) = trop x + trop y
                            @[simp]
                            theorem MaxTropical.trop_max {R : Type u} [LinearOrder R] (x y : R) :
                            trop (max x y) = trop x + trop y
                            @[simp]
                            theorem MinTropical.trop_inf {R : Type u} [LinearOrder R] (x y : R) :
                            trop (min x y) = trop x + trop y
                            @[simp]
                            theorem MaxTropical.trop_sup {R : Type u} [LinearOrder R] (x y : R) :
                            trop (max x y) = trop x + trop y
                            theorem MinTropical.trop_add_def {R : Type u} [LinearOrder R] (x y : MinTropical R) :
                            x + y = trop (min (untrop x) (untrop y))
                            theorem MaxTropical.trop_add_def {R : Type u} [LinearOrder R] (x y : MaxTropical R) :
                            x + y = trop (max (untrop x) (untrop y))
                            @[instance_reducible]
                            @[instance_reducible]
                            @[simp]
                            theorem MinTropical.untrop_sup {R : Type u} [LinearOrder R] (x y : MinTropical R) :
                            untrop (max x y) = max (untrop x) (untrop y)
                            @[simp]
                            theorem MaxTropical.untrop_inf {R : Type u} [LinearOrder R] (x y : MaxTropical R) :
                            untrop (min x y) = min (untrop x) (untrop y)
                            @[simp]
                            theorem MinTropical.untrop_max {R : Type u} [LinearOrder R] (x y : MinTropical R) :
                            untrop (max x y) = max (untrop x) (untrop y)
                            @[simp]
                            theorem MaxTropical.untrop_min {R : Type u} [LinearOrder R] (x y : MaxTropical R) :
                            untrop (min x y) = min (untrop x) (untrop y)
                            @[simp]
                            theorem MinTropical.min_eq_add {R : Type u} [LinearOrder R] :
                            min = fun (x1 x2 : MinTropical R) => x1 + x2
                            @[simp]
                            theorem MaxTropical.max_eq_add {R : Type u} [LinearOrder R] :
                            max = fun (x1 x2 : MaxTropical R) => x1 + x2
                            @[simp]
                            theorem MinTropical.inf_eq_add {R : Type u} [LinearOrder R] :
                            (fun (x1 x2 : MinTropical R) => min x1 x2) = fun (x1 x2 : MinTropical R) => x1 + x2
                            @[simp]
                            theorem MaxTropical.sup_eq_add {R : Type u} [LinearOrder R] :
                            (fun (x1 x2 : MaxTropical R) => max x1 x2) = fun (x1 x2 : MaxTropical R) => x1 + x2
                            theorem MinTropical.trop_max_def {R : Type u} [LinearOrder R] (x y : MinTropical R) :
                            max x y = trop (max (untrop x) (untrop y))
                            theorem MaxTropical.trop_min_def {R : Type u} [LinearOrder R] (x y : MaxTropical R) :
                            min x y = trop (min (untrop x) (untrop y))
                            theorem MinTropical.trop_sup_def {R : Type u} [LinearOrder R] (x y : MinTropical R) :
                            max x y = trop (max (untrop x) (untrop y))
                            theorem MaxTropical.trop_inf_def {R : Type u} [LinearOrder R] (x y : MaxTropical R) :
                            min x y = trop (min (untrop x) (untrop y))
                            @[simp]
                            theorem MinTropical.add_eq_left {R : Type u} [LinearOrder R] x y : MinTropical R (h : x y) :
                            x + y = x
                            @[simp]
                            theorem MaxTropical.add_eq_left {R : Type u} [LinearOrder R] x y : MaxTropical R (h : y x) :
                            x + y = x
                            @[simp]
                            theorem MinTropical.add_eq_right {R : Type u} [LinearOrder R] x y : MinTropical R (h : y x) :
                            x + y = y
                            @[simp]
                            theorem MaxTropical.add_eq_right {R : Type u} [LinearOrder R] x y : MaxTropical R (h : x y) :
                            x + y = y
                            theorem MinTropical.add_eq_left_iff {R : Type u} [LinearOrder R] {x y : MinTropical R} :
                            x + y = x x y
                            theorem MaxTropical.add_eq_left_iff {R : Type u} [LinearOrder R] {x y : MaxTropical R} :
                            x + y = x y x
                            theorem MinTropical.add_eq_right_iff {R : Type u} [LinearOrder R] {x y : MinTropical R} :
                            x + y = y y x
                            theorem MaxTropical.add_eq_right_iff {R : Type u} [LinearOrder R] {x y : MaxTropical R} :
                            x + y = y x y
                            theorem MinTropical.add_self {R : Type u} [LinearOrder R] (x : MinTropical R) :
                            x + x = x
                            theorem MaxTropical.add_self {R : Type u} [LinearOrder R] (x : MaxTropical R) :
                            x + x = x
                            theorem MinTropical.add_eq_iff {R : Type u} [LinearOrder R] {x y z : MinTropical R} :
                            x + y = z x = z x y y = z y x
                            theorem MaxTropical.add_eq_iff {R : Type u} [LinearOrder R] {x y z : MaxTropical R} :
                            x + y = z x = z y x y = z x y
                            @[simp]
                            theorem MinTropical.add_eq_zero_iff {R : Type u} [LinearOrder R] {a b : MinTropical (WithTop R)} :
                            a + b = 0 a = 0 b = 0
                            @[simp]
                            theorem MaxTropical.add_eq_zero_iff {R : Type u} [LinearOrder R] {a b : MaxTropical (WithBot R)} :
                            a + b = 0 a = 0 b = 0
                            @[instance_reducible]
                            instance MinTropical.instMulOfAdd {R : Type u} [Add R] :

                            Tropical multiplication is the addition in the underlying R.

                            @[instance_reducible]
                            instance MaxTropical.instMulOfAdd {R : Type u} [Add R] :

                            Tropical multiplication is the addition in the underlying R.

                            @[simp]
                            theorem MinTropical.trop_add {R : Type u} [Add R] (x y : R) :
                            trop (x + y) = trop x * trop y
                            @[simp]
                            theorem MaxTropical.trop_add {R : Type u} [Add R] (x y : R) :
                            trop (x + y) = trop x * trop y
                            @[simp]
                            theorem MinTropical.untrop_mul {R : Type u} [Add R] (x y : MinTropical R) :
                            untrop (x * y) = untrop x + untrop y
                            @[simp]
                            theorem MaxTropical.untrop_mul {R : Type u} [Add R] (x y : MaxTropical R) :
                            untrop (x * y) = untrop x + untrop y
                            theorem MinTropical.trop_mul_def {R : Type u} [Add R] (x y : MinTropical R) :
                            x * y = trop (untrop x + untrop y)
                            theorem MaxTropical.trop_mul_def {R : Type u} [Add R] (x y : MaxTropical R) :
                            x * y = trop (untrop x + untrop y)

                            The ring structure on MinTropical R is the same as on MaxTropical Rᵒᵈ.

                            Instances For

                              The ring structure on MaxTropical R is the same as on MinTropical Rᵒᵈ.

                              Instances For
                                @[instance_reducible]
                                @[instance_reducible]
                                @[simp]
                                theorem MinTropical.trop_zero {R : Type u} [Zero R] :
                                trop 0 = 1
                                @[simp]
                                theorem MaxTropical.trop_zero {R : Type u} [Zero R] :
                                trop 0 = 1
                                @[simp]
                                theorem MinTropical.untrop_one {R : Type u} [Zero R] :
                                untrop 1 = 0
                                @[simp]
                                theorem MaxTropical.untrop_one {R : Type u} [Zero R] :
                                untrop 1 = 0
                                @[instance_reducible]
                                instance MinTropical.instInvOfNeg {R : Type u} [Neg R] :
                                @[instance_reducible]
                                instance MaxTropical.instInvOfNeg {R : Type u} [Neg R] :
                                @[simp]
                                @[simp]
                                @[instance_reducible]
                                instance MinTropical.instDivOfSub {R : Type u} [Sub R] :
                                @[instance_reducible]
                                instance MaxTropical.instDivOfSub {R : Type u} [Sub R] :
                                @[simp]
                                theorem MinTropical.untrop_div {R : Type u} [Sub R] (x y : MinTropical R) :
                                untrop (x / y) = untrop x - untrop y
                                @[simp]
                                theorem MaxTropical.untrop_div {R : Type u} [Sub R] (x y : MaxTropical R) :
                                untrop (x / y) = untrop x - untrop y
                                @[instance_reducible]
                                instance MinTropical.instPowOfSMul {R : Type u} {α : Type u_1} [SMul α R] :
                                @[instance_reducible]
                                instance MaxTropical.instPowOfSMul {R : Type u} {α : Type u_1} [SMul α R] :
                                @[simp]
                                theorem MinTropical.untrop_pow {R : Type u} {α : Type u_1} [SMul α R] (x : MinTropical R) (n : α) :
                                untrop (x ^ n) = n untrop x
                                @[simp]
                                theorem MaxTropical.untrop_pow {R : Type u} {α : Type u_1} [SMul α R] (x : MaxTropical R) (n : α) :
                                untrop (x ^ n) = n untrop x
                                @[simp]
                                theorem MinTropical.trop_smul {R : Type u} {α : Type u_1} [SMul α R] (x : R) (n : α) :
                                trop (n x) = trop x ^ n
                                @[simp]
                                theorem MaxTropical.trop_smul {R : Type u} {α : Type u_1} [SMul α R] (x : R) (n : α) :
                                trop (n x) = trop x ^ n
                                @[instance_reducible]
                                @[instance_reducible]
                                @[simp]
                                theorem MinTropical.trop_nsmul {R : Type u} [AddMonoid R] (x : R) (n : ) :
                                trop (n x) = trop x ^ n
                                @[simp]
                                theorem MaxTropical.trop_nsmul {R : Type u} [AddMonoid R] (x : R) (n : ) :
                                trop (n x) = trop x ^ n
                                @[instance_reducible]
                                @[instance_reducible]
                                @[simp]
                                theorem MinTropical.untrop_zpow {R : Type u} [AddGroup R] (x : MinTropical R) (n : ) :
                                untrop (x ^ n) = n untrop x
                                @[simp]
                                theorem MaxTropical.untrop_zpow {R : Type u} [AddGroup R] (x : MaxTropical R) (n : ) :
                                untrop (x ^ n) = n untrop x
                                @[simp]
                                theorem MinTropical.trop_zsmul {R : Type u} [AddGroup R] (x : R) (n : ) :
                                trop (n x) = trop x ^ n
                                @[simp]
                                theorem MaxTropical.trop_zsmul {R : Type u} [AddGroup R] (x : R) (n : ) :
                                trop (n x) = trop x ^ n
                                @[simp]
                                theorem MinTropical.add_pow {R : Type u} [LinearOrder R] [AddMonoid R] [AddLeftMono R] [AddRightMono R] (x y : MinTropical R) (n : ) :
                                (x + y) ^ n = x ^ n + y ^ n
                                @[simp]
                                theorem MaxTropical.add_pow {R : Type u} [LinearOrder R] [AddMonoid R] [AddLeftMono R] [AddRightMono R] (x y : MaxTropical R) (n : ) :
                                (x + y) ^ n = x ^ n + y ^ n
                                @[simp]
                                theorem MinTropical.succ_nsmul {R : Type u_1} [LinearOrder R] [OrderTop R] (x : MinTropical R) (n : ) :
                                (n + 1) x = x
                                theorem MinTropical.mul_eq_zero_iff {R : Type u_1} [AddCommMonoid R] {a b : MinTropical (WithTop R)} :
                                a * b = 0 a = 0 b = 0