Tropical algebraic structures #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
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 #
tropical R
: The type synonym of the tropical interpretation ofR
. If[linear_order R]
, then addition onR
is viamin
.semiring (tropical R)
: Alinear_ordered_add_comm_monoid_with_top R
induces asemiring (tropical R)
. If one solely has[linear_ordered_add_comm_monoid R]
, then the "tropicalization ofR
" would betropical (with_top R)
.
Implementation notes #
The tropical structure relies on has_top
and min
. For the max-tropical numbers, use
order_dual 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 #
The tropicalization of a type R
.
Instances for tropical
- tropical.inhabited
- tropical.has_le
- tropical.has_lt
- tropical.preorder
- tropical.partial_order
- tropical.has_zero
- tropical.has_top
- tropical.order_top
- tropical.has_add
- tropical.add_comm_semigroup
- tropical.linear_order
- tropical.add_comm_monoid
- tropical.has_mul
- tropical.has_one
- tropical.add_monoid_with_one
- tropical.nontrivial
- tropical.has_inv
- tropical.has_div
- tropical.semigroup
- tropical.comm_semigroup
- tropical.has_pow
- tropical.mul_one_class
- tropical.monoid
- tropical.comm_monoid
- tropical.group
- tropical.comm_group
- tropical.covariant_mul
- tropical.covariant_swap_mul
- tropical.covariant_add
- tropical.covariant_mul_lt
- tropical.covariant_swap_mul_lt
- tropical.distrib
- tropical.comm_semiring
- tropical.no_zero_divisors
- tropical.has_sup
- tropical.has_inf
- tropical.semilattice_inf
- tropical.semilattice_sup
- tropical.lattice
- tropical.has_Sup
- tropical.has_Inf
- tropical.conditionally_complete_lattice
- tropical.conditionally_complete_linear_order
Reinterpret x : R
as an element of tropical R
.
See tropical.trop_equiv
for the equivalence.
Equations
Reinterpret x : tropical R
as an element of R
.
See tropical.trop_equiv
for the equivalence.
Equations
Reinterpret x : R
as an element of tropical R
.
See tropical.trop_order_iso
for the order-preserving equivalence.
Equations
- tropical.trop_equiv = {to_fun := tropical.trop R, inv_fun := tropical.untrop R, left_inv := _, right_inv := _}
Equations
Recursing on a x' : tropical R
is the same as recursing on an x : R
reinterpreted
as a term of tropical R
via trop x
.
Equations
- tropical.trop_rec h = λ (X : tropical R), h (tropical.untrop X)
Equations
- tropical.decidable_eq = λ (x y : tropical R), decidable_of_iff (tropical.untrop x = tropical.untrop y) _
Equations
- tropical.has_le = {le := λ (x y : tropical R), tropical.untrop x ≤ tropical.untrop y}
Equations
- tropical.decidable_le = λ (x y : tropical R), _inst_2 (tropical.untrop x) (tropical.untrop y)
Equations
- tropical.has_lt = {lt := λ (x y : tropical R), tropical.untrop x < tropical.untrop y}
Equations
- tropical.decidable_lt = λ (x y : tropical R), _inst_2 (tropical.untrop x) (tropical.untrop y)
Equations
- tropical.preorder = {le := has_le.le tropical.has_le, lt := has_lt.lt tropical.has_lt, le_refl := _, le_trans := _, lt_iff_le_not_le := _}
Reinterpret x : R
as an element of tropical R
, preserving the order.
Equations
- tropical.trop_order_iso = {to_equiv := {to_fun := tropical.trop_equiv.to_fun, inv_fun := tropical.trop_equiv.inv_fun, left_inv := _, right_inv := _}, map_rel_iff' := _}
Equations
- tropical.partial_order = {le := preorder.le tropical.preorder, lt := preorder.lt tropical.preorder, le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _}
Equations
Equations
- tropical.has_top = {top := 0}
Tropical addition is the minimum of two underlying elements of R
.
Equations
- tropical.has_add = {add := λ (x y : tropical R), tropical.trop (linear_order.min (tropical.untrop x) (tropical.untrop y))}
Equations
- tropical.add_comm_semigroup = {add := has_add.add tropical.has_add, add_assoc := _, add_comm := _}
Equations
- tropical.linear_order = {le := partial_order.le tropical.partial_order, lt := partial_order.lt tropical.partial_order, le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _, le_total := _, decidable_le := tropical.decidable_le (λ (a b : R), has_le.le.decidable a b), decidable_eq := tropical.decidable_eq (λ (a b : R), eq.decidable a b), decidable_lt := tropical.decidable_lt (λ (a b : R), has_lt.lt.decidable a b), max := λ (a b : tropical R), tropical.trop (linear_order.max (tropical.untrop a) (tropical.untrop b)), max_def := _, min := has_add.add tropical.has_add, min_def := _}
Equations
- tropical.add_comm_monoid = {add := add_comm_semigroup.add tropical.add_comm_semigroup, add_assoc := _, zero := 0, zero_add := _, add_zero := _, nsmul := add_monoid.nsmul._default 0 add_comm_semigroup.add tropical.add_comm_monoid._proof_4 tropical.add_comm_monoid._proof_5, nsmul_zero' := _, nsmul_succ' := _, add_comm := _}
Tropical multiplication is the addition in the underlying R
.
Equations
- tropical.has_mul = {mul := λ (x y : tropical R), tropical.trop (tropical.untrop x + tropical.untrop y)}
Equations
- tropical.has_one = {one := tropical.trop 0}
Equations
- tropical.add_monoid_with_one = {nat_cast := λ (n : ℕ), ite (n = 0) 0 1, add := add_comm_monoid.add tropical.add_comm_monoid, add_assoc := _, zero := add_comm_monoid.zero tropical.add_comm_monoid, zero_add := _, add_zero := _, nsmul := add_comm_monoid.nsmul tropical.add_comm_monoid, nsmul_zero' := _, nsmul_succ' := _, one := 1, nat_cast_zero := _, nat_cast_succ := _}
Equations
- tropical.has_inv = {inv := λ (x : tropical R), tropical.trop (-tropical.untrop x)}
Equations
- tropical.has_div = {div := λ (x y : tropical R), tropical.trop (tropical.untrop x - tropical.untrop y)}
Equations
- tropical.semigroup = {mul := has_mul.mul tropical.has_mul, mul_assoc := _}
Equations
- tropical.comm_semigroup = {mul := semigroup.mul tropical.semigroup, mul_assoc := _, mul_comm := _}
Equations
- tropical.has_pow = {pow := λ (x : tropical R) (n : α), tropical.trop (n • tropical.untrop x)}
Equations
- tropical.mul_one_class = {one := 1, mul := has_mul.mul tropical.has_mul, one_mul := _, mul_one := _}
Equations
- tropical.monoid = {mul := mul_one_class.mul tropical.mul_one_class, mul_assoc := _, one := mul_one_class.one tropical.mul_one_class, one_mul := _, mul_one := _, npow := λ (n : ℕ) (x : tropical R), x ^ n, npow_zero' := _, npow_succ' := _}
Equations
- tropical.comm_monoid = {mul := monoid.mul tropical.monoid, mul_assoc := _, one := monoid.one tropical.monoid, one_mul := _, mul_one := _, npow := monoid.npow tropical.monoid, npow_zero' := _, npow_succ' := _, mul_comm := _}
Equations
- tropical.group = {mul := monoid.mul tropical.monoid, mul_assoc := _, one := monoid.one tropical.monoid, one_mul := _, mul_one := _, npow := monoid.npow tropical.monoid, npow_zero' := _, npow_succ' := _, inv := has_inv.inv tropical.has_inv, div := div_inv_monoid.div._default monoid.mul tropical.group._proof_6 monoid.one tropical.group._proof_7 tropical.group._proof_8 monoid.npow tropical.group._proof_9 tropical.group._proof_10 has_inv.inv, div_eq_mul_inv := _, zpow := λ (n : ℤ) (x : tropical R), tropical.trop (n • tropical.untrop x), zpow_zero' := _, zpow_succ' := _, zpow_neg' := _, mul_left_inv := _}
Equations
- tropical.comm_group = {mul := group.mul tropical.group, mul_assoc := _, one := group.one tropical.group, one_mul := _, mul_one := _, npow := group.npow tropical.group, npow_zero' := _, npow_succ' := _, inv := group.inv tropical.group, div := group.div tropical.group, div_eq_mul_inv := _, zpow := group.zpow tropical.group, zpow_zero' := _, zpow_succ' := _, zpow_neg' := _, mul_left_inv := _, mul_comm := _}
Equations
- tropical.distrib = {mul := has_mul.mul tropical.has_mul, add := has_add.add tropical.has_add, left_distrib := _, right_distrib := _}
Equations
- tropical.comm_semiring = {add := add_monoid_with_one.add tropical.add_monoid_with_one, add_assoc := _, zero := add_monoid_with_one.zero tropical.add_monoid_with_one, zero_add := _, add_zero := _, nsmul := add_monoid_with_one.nsmul tropical.add_monoid_with_one, nsmul_zero' := _, nsmul_succ' := _, add_comm := _, mul := distrib.mul tropical.distrib, left_distrib := _, right_distrib := _, zero_mul := _, mul_zero := _, mul_assoc := _, one := add_monoid_with_one.one tropical.add_monoid_with_one, one_mul := _, mul_one := _, nat_cast := add_monoid_with_one.nat_cast tropical.add_monoid_with_one, nat_cast_zero := _, nat_cast_succ := _, npow := comm_monoid.npow tropical.comm_monoid, npow_zero' := _, npow_succ' := _, mul_comm := _}