Introduction
This page lists the OSCAR features for tropical geometry, which are still at the very beginning of their development. For notation we refer to Diane Maclagan, Bernd Sturmfels (2015) and Michael Joswig (2021).
Contact
Please direct questions about this part of OSCAR to the following people:
You can ask questions in the OSCAR Slack.
Alternatively, you can raise an issue on github.
Tropical semirings
TropicalSemiring
— TypeTropicalSemiring(M::Union{typeof(min),typeof(max)}=min)
The tropical semiring with min (default) or max.
There is no subtraction in the tropical semiring. Any subtraction of two tropical numbers will yield an error.
Examples (basic arithmetic)
julia> T = TropicalSemiring() # = TropicalSemiring(min)
Tropical semiring (min)
julia> T = TropicalSemiring(max)
Tropical semiring (max)
julia> 0*T(3) + 1*T(1)^2 + inf(T) # = max(0+3,1+2*1,-∞)
(3)
julia> T(0) == 0 # checks whether the tropical number is 0
true
julia> iszero(T(0)) # checks whether the tropical number is neutral element of addition
false
Examples (polynomials)
julia> T = TropicalSemiring()
Tropical semiring (min)
julia> Tx,(x1,x2) = polynomial_ring(T,3)
(Multivariate polynomial ring in 3 variables over tropical semiring (min), AbstractAlgebra.Generic.MPoly{Oscar.TropicalSemiringElem{typeof(min)}}[x1, x2, x3])
julia> f = x1 + -1*x2 + 0
x1 + (-1)*x2 + (0)
julia> evaluate(f,[T(-1//2),T(1//2)]) # warning: omitting T(0) gives an error
(-1//2)
Examples (matrices)
julia> T = TropicalSemiring()
Tropical semiring (min)
julia> A = [T(0) inf(T); inf(T) T(0)] # = tropical identity matrix
2×2 Matrix{Oscar.TropicalSemiringElem{typeof(min)}}:
(0) ∞
∞ (0)
julia> 2*A
2×2 Matrix{Oscar.TropicalSemiringElem{typeof(min)}}:
(2) ∞
∞ (2)
julia> A*A
2×2 Matrix{Oscar.TropicalSemiringElem{typeof(min)}}:
(0) ∞
∞ (0)
julia> det(A)
(0)
TropicalSemiringMap
— TypeTropicalSemiringMap(K,p,M::Union{typeof(min),typeof(max)}=min)
Constructs a map val
from K
to the min tropical semiring T
(default) or the max tropical semiring that:
- is a semigroup homomorphism
(K,*) -> (T,+)
, - preserves the ordering on both sides.
In other words, val
is either a valuation on K
with image in TropicalSemiring(min)
or the negative of a valuation on K
with image in TropicalSemiring(max)
.
The role of val
is to encode with respect to which valuation on K
and under which convention (min or max) tropical computations should take place.
Currently, the only supported valuations are:
- the $t$-adic valuation on $\mathbb{Q}(t)$
- the $p$-adic valuations on $\mathbb{Q}$
- the trivial valuation on any field
Examples
\[p\]
-adic valuation on $\mathbb{Q}$:
julia> val_2 = TropicalSemiringMap(QQ,2); # = TropicalSemiringMap(QQ,2,min)
julia> val_2(4)
(2)
julia> val_2(1//4)
(-2)
julia> val_2 = TropicalSemiringMap(QQ,2,max);
julia> val_2(4)
(-2)
julia> val_2(1//4)
(2)
\[t\]
-adic valuation on $\mathbb{Q}(t)$:
julia> Kt,t = RationalFunctionField(QQ,"t");
julia> val_t = TropicalSemiringMap(Kt,t);
julia> val_t(t^2)
(2)
julia> val_t(1//t^2)
(-2)
Trivial valuation on $\mathbb{Q}$:
julia> val = TropicalSemiringMap(QQ);
julia> val(4)
(0)
julia> val(1//4)
(0)
julia> val(0)
∞
tropical_polynomial
— Functiontropical_polynomial(f::MPolyRingElem,M::Union{typeof(min),typeof(max)}=min)
Given a polynomial f
over a field with an intrinsic valuation (i.e., a field on which a function valuation
is defined such as PadicField(7,2)
), returns the tropicalization of f
as a polynomial over the min tropical semiring (default) or the max tropical semiring.
Examples
julia> K = PadicField(7, 2)
Field of 7-adic numbers
julia> Kxy, (x,y) = K["x", "y"]
(Multivariate polynomial ring in 2 variables over QQ_7, AbstractAlgebra.Generic.MPoly{padic}[x, y])
julia> f = 7*x+y+49
(7^1 + O(7^3))*x + y + 7^2 + O(7^4)
julia> tropical_polynomial(f,min)
(1)*x + y + (2)
julia> tropical_polynomial(f,max)
(-1)*x + y + (-2)
tropical_polynomial(f::MPolyRingElem,val::TropicalSemiringMap)
Given a polynomial f
and a tropical semiring map val
, returns the tropicalization of f
as a polynomial over the tropical semiring.
Examples
julia> R, (x,y) = polynomial_ring(QQ,["x", "y"])
(Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[x, y])
julia> val = TropicalSemiringMap(QQ,7)
The 7-adic valuation on Rational field
julia> f = 7*x+y+49
7*x + y + 49
julia> tropical_polynomial(f,val)
(1)*x + y + (2)
Tropical curves
(no functions yet, under active development)
TropicalCurve
— TypeTropicalCurve(PC::PolyhedralComplex)
Construct a tropical curve from a polyhedral complex. If the curve is embedded, vertices must are points in $\mathbb R^n$. If the curve is abstract, the polyhedral complex is empty, vertices must be 1, ..., n, and the graph is given as attribute.
Examples
julia> IM = IncidenceMatrix([[1,2],[1,3],[1,4]])
3×4 IncidenceMatrix
[1, 2]
[1, 3]
[1, 4]
julia> VR = [0 0; 1 0; -1 0; 0 1]
4×2 Matrix{Int64}:
0 0
1 0
-1 0
0 1
julia> PC = PolyhedralComplex{QQFieldElem}(IM, VR)
Polyhedral complex in ambient dimension 2
julia> TC = TropicalCurve(PC)
min tropical curve in 2-dimensional Euclidean space
julia> abs_TC = TropicalCurve(IM)
Abstract min tropical curve
in work: chip firing, jacobians.
Tropical hypersurfaces
TropicalHypersurface
— TypeTropicalHypersurface(f::AbstractAlgebra.Generic.MPoly{Oscar.TropicalSemiringElem{T}})
Return the tropical hypersurface of a tropical polynomial f
.
Examples
julia> T = TropicalSemiring(min)
Tropical semiring (min)
julia> Txy,(x,y) = T["x","y"]
(Multivariate polynomial ring in 2 variables over tropical semiring (min), AbstractAlgebra.Generic.MPoly{Oscar.TropicalSemiringElem{typeof(min)}}[x, y])
julia> f = x+y+1
x + y + (1)
julia> Tf = TropicalHypersurface(f)
min tropical hypersurface embedded in 2-dimensional Euclidean space
TropicalHypersurface(f::MPolyRingElem,M::Union{typeof(min),typeof(max)}=min)
Given a polynomial f
over a field with an intrinsic valuation (i.e., a field on which a function valuation
is defined such as PadicField(7,2)
), return the tropical hypersurface of f
under the convention specified by M
.
Examples
julia> K = PadicField(7, 2);
julia> Kxy, (x,y) = K["x", "y"]
(Multivariate polynomial ring in 2 variables over QQ_7, AbstractAlgebra.Generic.MPoly{padic}[x, y])
julia> f = 7*x+y+49;
julia> TropicalHypersurface(f, min)
min tropical hypersurface embedded in 2-dimensional Euclidean space
julia> TropicalHypersurface(f, max)
max tropical hypersurface embedded in 2-dimensional Euclidean space
TropicalHypersurface(f::MPolyRingElem,M::Union{typeof(min),typeof(max)}=min)
Construct the tropical hypersurface from a polynomial f
and a map to the tropical semiring val
.
Examples
julia> Kx, (x1,x2) = polynomial_ring(QQ,2)
(Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[x1, x2])
julia> val = TropicalSemiringMap(QQ,7)
The 7-adic valuation on Rational field
julia> f = 7*x1+x2+49;
julia> TropicalHypersurface(f, val)
min tropical hypersurface embedded in 2-dimensional Euclidean space
dual_subdivision
— Methoddual_subdivision(TH::TropicalHypersurface{M, EMB})
Return the dual subdivision of TH
if it is embedded. Otherwise an error is thrown.
Examples
A tropical hypersurface in $\mathbb{R}^n$ is always of dimension n-1.
julia> T = TropicalSemiring(min);
julia> Txy,(x,y) = T["x","y"];
julia> f = x+y+1;
julia> tropicalLine = TropicalHypersurface(f);
julia> dual_subdivision(tropicalLine)
Subdivision of points in ambient dimension 3
in work: minimal tropical polynomials of a hypersurface.
Tropical linear spaces
TropicalLinearSpace
— TypeTropicalLinearSpace(I::MPolyIdeal, val::TropicalSemiringMap)
Construct a tropical linear space from a degree 1 polynomial ideal I
and a map to the tropical semiring val
.
Examples
julia> R,(x1,x2,x3,x4,x5,x6) = polynomial_ring(ZZ,6)
(Multivariate polynomial ring in 6 variables over ZZ, ZZMPolyRingElem[x1, x2, x3, x4, x5, x6])
julia> I = ideal(R,[-x1+x3+x4,-x2+x3+x5,-x1+x2+x6])
ideal(-x1 + x3 + x4, -x2 + x3 + x5, -x1 + x2 + x6)
julia> val = TropicalSemiringMap(ZZ)
The trivial valuation on Integer Ring
julia> TropicalLinearSpace(I,val)
TropicalLinearSpace{min, true}(Polyhedral complex in ambient dimension 6, #undef)
TropicalLinearSpace(A::MatElem,val::TropicalSemiringMap)
Construct a tropical linear space from a matrix A
and a map to the tropical semiring val
.
Examples
julia> Kt, t = RationalFunctionField(QQ,"t");
julia> val = TropicalSemiringMap(Kt,t);
julia> A = matrix(Kt,[[t,4*t,0,2],[1,4,1,t^2]]);
julia> TropicalLinearSpace(A, val)
TropicalLinearSpace{min, true}(Polyhedral complex in ambient dimension 4, #undef)
julia> p = 3;
julia> val = TropicalSemiringMap(QQ, p);
julia> A = matrix(QQ, [[3,7,5,1], [9,7,1,2]])
[3 7 5 1]
[9 7 1 2]
julia> TropicalLinearSpace(A,val)
TropicalLinearSpace{min, true}(Polyhedral complex in ambient dimension 4, #undef)
Tropical varieties
(no functions yet, under active development)
in work: tropical_variety(I::MPolyIdeal,val::TropicalSemiringMap)
Groebner bases and Groebner polyhedra
groebner_basis
— Methodgroebner_basis(I::Ideal, val::TropicalSemiringMap, w::Vector; complete_reduction::Bool, return_lead::Bool)
Compute a Groebner basis of I
over a field with valuation val
with respect to weight vector w
, that is a finite generating set of I
whose initial forms generate the initial ideal with respect to w
.
For the definitions of initial form, initial ideal and Groebner basis see Section 2.4 of Diane Maclagan, Bernd Sturmfels (2015).
Groebner bases over fields with valuation are still in an experimental stage. I
must be generated by homogeneous polynomials and val
must be non-trivial.
Examples
julia> R,(x,y) = polynomial_ring(QQ,["x","y"]);
julia> I = ideal([x^3-5*x^2*y,3*y^3-2*x^2*y])
ideal(x^3 - 5*x^2*y, -2*x^2*y + 3*y^3)
julia> val_2 = TropicalSemiringMap(QQ,2);
julia> w = [0,0];
julia> groebner_basis(I,val_2,w)
5-element Vector{QQMPolyRingElem}:
2*x^2*y - 3*y^3
x^3 - 5*x^2*y
x*y^3 - 5*y^4
y^5
x^2*y^3 + 69*y^5
in work: groebner_polyhedron(I::MPolyIdeal,val::TropicalSemiringMap,w::Vector{<: Union{Int,Rational{Int}})
Intersections and stable intersections
intersect
— Methodintersect(T1, T2)
Intersect two tropical varieties.
Examples
julia> RR = TropicalSemiring(min)
Tropical semiring (min)
julia> S,(x,y) = RR["x","y"]
(Multivariate polynomial ring in 2 variables over tropical semiring (min), AbstractAlgebra.Generic.MPoly{Oscar.TropicalSemiringElem{typeof(min)}}[x, y])
julia> f1 = x+y+1
x + y + (1)
julia> f2 = x^2+y^2+RR(-6)
x^2 + y^2 + (-6)
julia> hyp1 = TropicalHypersurface(f1)
min tropical hypersurface embedded in 2-dimensional Euclidean space
julia> hyp2 = TropicalHypersurface(f2)
min tropical hypersurface embedded in 2-dimensional Euclidean space
julia> tv12 = intersect(hyp1, hyp2)
min tropical variety of dimension 1 embedded in 2-dimensional Euclidean space
stably_intersect
— Methodintersect_stably(T1, T2)
Examples