Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/doc.main
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"TropicalGeometry/linear_space.md",
"TropicalGeometry/groebner_theory.md",
"TropicalGeometry/tropicalization.md",
"TropicalGeometry/positive_variety.md",
],

"Noncommutative Algebra" => [
Expand Down
12 changes: 12 additions & 0 deletions docs/oscar_references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -2290,6 +2290,18 @@ @Article{SV-D-V87
zbmath = {4069055}
}

@Article{SW05,
author = {Speyer, David and Williams, Lauren},
title = {The {{Tropical Totally Positive Grassmannian}}},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
title = {The {{Tropical Totally Positive Grassmannian}}},
title = {The Tropical Totally Positive Grassmannian},

our bibtex parser does not work well with braces inside of fields. It will keep the casing even without them (contrary to latex)

journal = {Journal of Algebraic Combinatorics},
volume = {22},
number = {2},
pages = {189--210},
year = {2005},
month = sep,
doi = {10.1007/s10801-005-2513-3}
}

@Article{SY96,
author = {Shimoyama, Takeshi and Yokoyama, Kazuhiro},
title = {Localization and primary decomposition of polynomial ideals},
Expand Down
9 changes: 9 additions & 0 deletions docs/src/TropicalGeometry/positive_variety.md
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)
```
1 change: 1 addition & 0 deletions src/TropicalGeometry/TropicalGeometry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ include("hypersurface.jl")
include("curve.jl")
include("linear_space.jl")
include("variety.jl")
include("positive_variety.jl")
include("intersection.jl")
include("groebner_fan.jl")
73 changes: 73 additions & 0 deletions src/TropicalGeometry/positive_variety.jl
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
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

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
Copy link
Member

Choose a reason for hiding this comment

The 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
(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.
1. the rational numbers and that `nu` encodes the trivial valuation,
2. the rational function field over the rational numbers and that `nu` encodes the t-adic valuation.
Suggested change
(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.
- the rational numbers and that `nu` encodes the trivial valuation,
- the rational function field over the rational numbers and that `nu` encodes the t-adic valuation.


# 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)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if all(isequal(2),length.(gens(I)))
if all(is_binomial, gens(I))

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

Check warning on line 40 in src/TropicalGeometry/positive_variety.jl

View check run for this annotation

Codecov / codecov/patch

src/TropicalGeometry/positive_variety.jl#L40

Added line #L40 was not covered by tests
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)))

Check warning on line 55 in src/TropicalGeometry/positive_variety.jl

View check run for this annotation

Codecov / codecov/patch

src/TropicalGeometry/positive_variety.jl#L55

Added line #L55 was not covered by tests
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")

Check warning on line 64 in src/TropicalGeometry/positive_variety.jl

View check run for this annotation

Codecov / codecov/patch

src/TropicalGeometry/positive_variety.jl#L64

Added line #L64 was not covered by tests
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
1 change: 1 addition & 0 deletions src/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1319,6 +1319,7 @@ export positive_coroots
export positive_hull
export positive_root
export positive_roots
export positive_tropical_variety
export possible_class_fusions
export power_sum
export powers_of_element
Expand Down
14 changes: 14 additions & 0 deletions test/TropicalGeometry/positive_variety.jl
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
Loading