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 #

@[instance_reducible]
Equations
Dependency graph
@[instance_reducible]
Equations
Dependency graph
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.

Dependency graph
@[instance_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.
Dependency graph
Dependency graph
@[instance_reducible]

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

Equations
Dependency graph
Dependency graph
@[instance_reducible]

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

Equations
Dependency graph
Dependency graph
@[instance_reducible]

The tropical semiring over ℤ ∪ {∞} is a semiring with monus. Like the and variants it is idempotent and -over- distributive but not absorptive; unlike them its carrier is kernel-computable, which makes it the tropical semiring of choice for decide-checked counterexamples.

Equations
Dependency graph
Dependency graph
Dependency graph
@[instance_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
Dependency graph
Dependency graph

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

Dependency graph
Dependency graph

On the tropical semiring over ℕ ∪ {∞} the identity is not an admissible δ, even though this semiring is absorptive (TropicalN.absorptive): what delta_absorb asks of δ := id is the lattice law a ⊗ (a ⊕ b) = a, i.e., a + min(a, b) = a in , and at a = b = trop 1 it reads trop 2 ≠ trop 1. This is why the instance takes the support indicator (ProvSQL's Tropical::delta).

Dependency graph

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

Dependency graph
Dependency graph
Dependency graph
Dependency graph

The tropical semiring is idempotent -

Dependency graph

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.

Dependency graph
Dependency graph
Dependency graph

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 .)

Dependency graph
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.

Dependency graph

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.

Dependency graph

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.

Dependency graph

The MIN-scan collapse (Having.minScan_correct) fails in Tropical (WithTop ℝ): on U = {true, false} with α ≡ trop (-1), t ≡ 0 and the predicate MIN(t) ≥ 0, the possible-world provenance is trop (-2) while the scan returns trop (-1). This is the same instance as TropicalR.F_ne_S, and shows that the absorptivity hypothesis of Having.minScan_correct (and, by symmetry, of Having.maxScan_correct and Having.firstScan_correct) is genuinely required: the weaker “idempotent + mul_sub_left_distributive” combination satisfied by Tropical (WithTop ℝ) is insufficient.

Dependency graph