-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TropicalGeometry: new positive tropicalizations #4447
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Positive tropicalizations of linear ideals | ||
|
||
## Introduction | ||
Positive tropial varieties (in OSCAR) are weighted polyhedral complexes and as per the definition in [SW05](@cite). They may arise as tropicalizations of polynomial ideals over an ordered field. Currently, the only ideals supported are linear ideals over rational numbers or rational function fields over rational numbers. | ||
|
||
|
||
```@docs | ||
positive_tropical_variety(::MPolyIdeal, ::TropicalSemiringMap) | ||
``` |
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,73 @@ | ||||||||||||||||||
@doc raw""" | ||||||||||||||||||
positive_tropical_variety(I::MPolyIdeal,nu::TropicalSemiringMap) | ||||||||||||||||||
|
||||||||||||||||||
Return the positive tropical variety of `I` as a `PolyhedralComplex` as per the definition in [SW05](@cite). Assumes that `I` is generated either by binomials or by linear polynomials and that `I` is defined either over | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Break an overly long line. And good docstring style adds a paragraph break after the first sentence |
||||||||||||||||||
(a) the rational numbers and that `nu` encodes the trivial valuation, | ||||||||||||||||||
(b) the rational function field over the rational numbers and that `nu` encodes the t-adic valuation. | ||||||||||||||||||
Comment on lines
+5
to
+6
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have you checked by locally building the docs that this produces what you expect? From the first glance, I think that this may do weird linebreaks. Maybe one of the following is suitable for your case here?
Suggested change
Suggested change
|
||||||||||||||||||
|
||||||||||||||||||
# Examples | ||||||||||||||||||
```jldoctest | ||||||||||||||||||
julia> K,t = rational_function_field(QQ,"t") | ||||||||||||||||||
(Rational function field over QQ, t) | ||||||||||||||||||
|
||||||||||||||||||
julia> C = matrix(K,[[-3*t,1*t,-1*t,-2*t,2*t],[-1*t,1*t,-1*t,-1*t,1*t]]) | ||||||||||||||||||
[-3*t t -t -2*t 2*t] | ||||||||||||||||||
[ -t t -t -t t] | ||||||||||||||||||
|
||||||||||||||||||
julia> R,x = polynomial_ring(K,ncols(C)) | ||||||||||||||||||
(Multivariate polynomial ring in 5 variables over K, AbstractAlgebra.Generic.MPoly{AbstractAlgebra.Generic.RationalFunctionFieldElem{QQFieldElem, QQPolyRingElem}}[x1, x2, x3, x4, x5]) | ||||||||||||||||||
|
||||||||||||||||||
julia> nu = tropical_semiring_map(K,t) | ||||||||||||||||||
Map into Min tropical semiring encoding the t-adic valuation on Rational function field over QQ | ||||||||||||||||||
|
||||||||||||||||||
julia> I = ideal(C*gens(R)) | ||||||||||||||||||
Ideal generated by | ||||||||||||||||||
-3*t*x1 + t*x2 - t*x3 - 2*t*x4 + 2*t*x5 | ||||||||||||||||||
-t*x1 + t*x2 - t*x3 - t*x4 + t*x5 | ||||||||||||||||||
|
||||||||||||||||||
julia> TropPlusI = positive_tropical_variety(I,nu) | ||||||||||||||||||
Min tropical variety | ||||||||||||||||||
|
||||||||||||||||||
``` | ||||||||||||||||||
""" | ||||||||||||||||||
function positive_tropical_variety(I::MPolyIdeal,nu::TropicalSemiringMap) | ||||||||||||||||||
if all(isequal(2),length.(gens(I))) | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||
if all(isequal(-1),[prod([sign(c) for c in coefficients(g)]) for g in gens(I)]) | ||||||||||||||||||
# binomial ideal positive, return regular tropical variety | ||||||||||||||||||
return tropical_variety_binomial(I,nu) | ||||||||||||||||||
else | ||||||||||||||||||
# binomial ideal not positive, return empty polyhedral complex in the correct ambient dimension | ||||||||||||||||||
return polyhedral_complex(IncidenceMatrix(zeros(Int,0,0)),zero_matrix(QQ,0,ambient_dim(TropL))) | ||||||||||||||||||
end | ||||||||||||||||||
end | ||||||||||||||||||
|
||||||||||||||||||
if all(isequal(1),total_degree.(gens(I))) | ||||||||||||||||||
# Construct the tropicalization of I | ||||||||||||||||||
TropL = tropical_linear_space(I,nu) | ||||||||||||||||||
|
||||||||||||||||||
# find maximal polyhedra belonging to the positive part | ||||||||||||||||||
# we check containment in the positive part by testing the initial ideal w.r.t. a relative interior point | ||||||||||||||||||
positivePolyhedra = Polyhedron{QQFieldElem}[sigma for sigma in maximal_polyhedra(TropL) if is_initial_positive(I,nu,relative_interior_point(sigma))] | ||||||||||||||||||
|
||||||||||||||||||
if isempty(positivePolyhedra) | ||||||||||||||||||
# if there are no positive polyhedra, | ||||||||||||||||||
# return empty polyhedral complex in the correct ambient dimension | ||||||||||||||||||
return polyhedral_complex(IncidenceMatrix(zeros(Int,0,0)),zero_matrix(QQ,0,ambient_dim(TropL))) | ||||||||||||||||||
end | ||||||||||||||||||
|
||||||||||||||||||
Sigma = polyhedral_complex(positivePolyhedra) | ||||||||||||||||||
mult = ones(ZZRingElem, n_maximal_polyhedra(Sigma)) | ||||||||||||||||||
minOrMax = convention(nu) | ||||||||||||||||||
return tropical_variety(Sigma,mult,minOrMax) | ||||||||||||||||||
end | ||||||||||||||||||
|
||||||||||||||||||
error("input ideal not supported") | ||||||||||||||||||
end | ||||||||||||||||||
|
||||||||||||||||||
function is_initial_positive(I::MPolyIdeal, nu::TropicalSemiringMap, w::AbstractVector) | ||||||||||||||||||
inI = initial(I,nu,w) | ||||||||||||||||||
G = groebner_basis(inI; complete_reduction=true) | ||||||||||||||||||
|
||||||||||||||||||
# the Groebner basis is binomial, check binomials have alternating signs | ||||||||||||||||||
return all(isequal(-1),[prod([sign(c) for c in coefficients(g)]) for g in G]) | ||||||||||||||||||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
@testset "src/TropicalGeometry/positive_variety.jl" begin | ||
|
||
C = matrix(QQ,[[-3,1,-1,-2,2],[-1,1,-1,-1,1]]) | ||
R,x = polynomial_ring(QQ,ncols(C)) | ||
nu = tropical_semiring_map(QQ) | ||
I = ideal(C*gens(R)) | ||
TropPlusI = positive_tropical_variety(I,nu) | ||
@test n_maximal_polyhedra(TropPlusI) == 5 | ||
|
||
I = ideal([x[1]^2-x[2]^2,x[3]^3-x[4]^3]) | ||
TropPlusI = positive_tropical_variety(I,nu) | ||
@test n_maximal_polyhedra(TropPlusI) == 1 | ||
|
||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
our bibtex parser does not work well with braces inside of fields. It will keep the casing even without them (contrary to latex)