Documentation

Provenance.Semirings.Tropical

Tropical m-semiring #

This file shows that the tropicalization of any linearly ordered additive commutative monoid with an absorbing top element (e.g., ℕ ∪ {∞}, ℚ ∪ {∞}, ℝ ∪ {∞}) is a commutative m-semiring. Addition is min (inherited from the tropical structure in Mathlib), multiplication is the original addition of the monoid, zero is , and one is 0.

The tropical semiring is absorptive and idempotent, and satisfies left-distributivity of multiplication over monus.

The tropical semiring is used as a provenance semiring in Green, Karvounarakis & Tannen, Provenance Semirings.

Note: Geerts & Poggi, On database query languages for K-relations, Example 4 claims that the tropical semiring cannot be extended to an m-semiring. That claim is incorrect: the paper gives a wrong definition of the monus operator.

References #

@[implicit_reducible]
Equations
@[implicit_reducible]
Equations
theorem tropical_order_ge {α : Type u_1} [LinearOrder α] (a b : Tropical α) :

In the tropicalization of a linear order, a ≥ b if and only if a+b = b.

@[implicit_reducible]

The tropical semiring is an m-semiring. The natural order of the semiring is the reverse of the usual order. The monus a-b is defined as if a≥b (for the usual order, not the natural semiring order), and as a otherwise.

Equations
  • One or more equations did not get rendered due to their size.
@[implicit_reducible]

The tropical semiring over ℕ ∪ {∞} is a semiring with monus.

Equations
@[implicit_reducible]

The tropical semiring over ℚ ∪ {∞} is a semiring with monus.

Equations
@[implicit_reducible]

The tropical semiring over ℝ ∪ {∞} is a semiring with monus. Note that this contradicts Geerts & Poggi, On database query languages for K-relations, Example 4 which claims this semiring cannot be extended to a semiring with monus: indeed, that paper gives a wrong definition of the monus operator in the tropical semiring.

Equations

The tropical semiring is absorptive, as long as the order in the addition monoid corresponds to a canonical order (e.g., as in ℕ) -

Times distributes over monus on tropical semirings made of an order strictly compatible with addition, with an additional top element.

The tropical semiring is idempotent -

The tropical semiring over WithTop R (for any R with Zero R) has characteristic 0 in the CharP sense: it is idempotent, and (0 : Tropical (WithTop R)) = trop ⊤ differs from (1 : Tropical (WithTop R)) = trop 0 since ⊤ ≠ 0 in WithTop R.

The tropical semiring over ℕ ∪ {∞} does not have idempotent multiplication: Tropical.trop 1 * Tropical.trop 1 = Tropical.trop 2 ≠ Tropical.trop 1. (Tropical multiplication is the original additive monoid operation, which is not idempotent on .)

theorem TropicalN.no_hom_from_BoolFunc {Y : Type} [Inhabited Y] :
∃ (ν : YTropical (WithTop )), ¬∃ (φ : BoolFunc Y →+* Tropical (WithTop )), ∀ (i : Y), φ (BoolFunc.var i) = ν i

There is no semiring homomorphism from BoolFunc Y to the tropical semiring over ℕ ∪ {∞} sending the variables to arbitrary values: tropical multiplication is not idempotent, contradicting var i * var i = var i in BoolFunc Y.

Counterexample to Having.F_eq_S without absorptivity #

Unlike Tropical (WithTop ℕ) (canonically ordered, hence absorptive via Tropical.absorptive), Tropical (WithTop ℝ) is not absorptive: with a = trop (-1) we have 1 + a = trop (min 0 (-1)) = trop (-1) ≠ trop 0 = 1.

The tropical m-semiring over is still idempotent and satisfies mul_sub_left_distributive, so it satisfies the "idempotent + ⊗-over-⊖ distributive" hypotheses one might hope to suffice for Having.F_eq_S. The witness below shows that the strengthened hypothesis (absorptivity) is genuinely required: on U = {true, false} ⊆ Bool and α ≡ trop (-1) we have S_1(U) = trop (-1) but F_1(U) = trop (-2).

Tropical (WithTop ℝ) is not absorptive: 1 + trop (-1) = trop (-1) ≠ 1. The proof goes through tropical_order_ge: a + 1 = 1 would force untrop a ≥ untrop 1 = 0, but with a = trop (-1) we have untrop a = -1.

The HAVING-count identity F_C(U) = S_C(U) from Having.F_eq_S fails in Tropical (WithTop ℝ): with U = Finset.univ : Finset Bool, α ≡ trop (-1), and C = 1, we have F_1(U) = trop (-2) while S_1(U) = trop (-1). This shows that Having.F_eq_S genuinely needs the absorptivity hypothesis (cf. TropicalR.not_absorptive): the weaker "idempotent + mul_sub_left_distributive" combination satisfied by Tropical (WithTop ℝ) (and likewise by Tropical (WithTop ℚ)) is insufficient.