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

Leipzig workshop #4358

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
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 @@ -246,6 +246,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 @@ -2217,6 +2217,18 @@ @Article{SV-D-V87
zbmath = {4069055}
}

@Article{SW05,
author = {Speyer, David and Williams, Lauren},
title = {The {{Tropical Totally Positive Grassmannian}}},
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
1 change: 1 addition & 0 deletions docs/src/TropicalGeometry/linear_space.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ In addition to converting from `TropicalVariety`, objects of type `TropicalLinea
4. matrices over a field and a tropical semiring map.
- if matrix over `QQ` and tropical semiring map is trivial, uses an implementation of Rincon's algorithm [Rin13](@cite) in `polymake`
- for general input, computes minors and uses constructor (2.)
5. graphs
```@docs
tropical_linear_space
```
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)
```
66 changes: 66 additions & 0 deletions src/PolyhedralGeometry/PolyhedralComplex/standard_constructions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,69 @@ function k_skeleton(PC::PolyhedralComplex{T}, k::Int) where {T<:scalar_types}
)
return PolyhedralComplex{T}(ksk, coefficient_field(PC))
end



function *(c::QQFieldElem, Sigma::PolyhedralComplex)
# if scalar is zero, return polyhedral complex consisting only of the origin
if iszero(c)
return polyhedral_complex(convex_hull(zero_matrix(QQ,1,ambient_dim(Sigma))))
end

# if scalar is non-zero, multiple all vertices and rays by said scalar
SigmaVertsAndRays = vertices_and_rays(Sigma)
SigmaRayIndices = findall(vr -> vr isa RayVector, SigmaVertsAndRays)
SigmaLineality = lineality_space(Sigma)
SigmaIncidence = maximal_polyhedra(IncidenceMatrix,Sigma)
return polyhedral_complex(SigmaIncidence, multiply_by_nonzero_scalar.(SigmaVertsAndRays,c), SigmaRayIndices, SigmaLineality)
end
*(c::ZZRingElem, Sigma::PolyhedralComplex) = QQ(c)*Sigma
*(c::Rational, Sigma::PolyhedralComplex) = QQ(c)*Sigma
*(c::Int, Sigma::PolyhedralComplex) = QQ(c)*Sigma

*(Sigma::PolyhedralComplex,c::QQFieldElem) = c*Sigma
*(Sigma::PolyhedralComplex,c::ZZRingElem) = QQ(c)*Sigma
*(Sigma::PolyhedralComplex,c::Rational) = QQ(c)*Sigma
*(Sigma::PolyhedralComplex,c::Int) = QQ(c)*Sigma



import Base.-
function -(Sigma::PolyhedralComplex)
SigmaVertsAndRays = vertices_and_rays(Sigma)
SigmaRayIndices = findall(vr -> vr isa RayVector, SigmaVertsAndRays)
SigmaLineality = lineality_space(Sigma)
SigmaIncidence = maximal_polyhedra(IncidenceMatrix,Sigma)
return polyhedral_complex(SigmaIncidence, -SigmaVertsAndRays, SigmaRayIndices, SigmaLineality)
end



import Base.+
function translate_by_vector(u::PointVector{QQFieldElem}, v::Vector{QQFieldElem})
return u .+ v
end
function translate_by_vector(u::RayVector{QQFieldElem}, ::Vector{QQFieldElem})
return u
end
function +(v::Vector{QQFieldElem}, Sigma::PolyhedralComplex)
@req length(v)==ambient_dim(Sigma) "ambient dimension mismatch"
SigmaVertsAndRays = vertices_and_rays(Sigma)
SigmaRayIndices = findall(vr -> vr isa RayVector, SigmaVertsAndRays)
SigmaLineality = lineality_space(Sigma)
SigmaIncidence = maximal_polyhedra(IncidenceMatrix,Sigma)
return polyhedral_complex(SigmaIncidence, translate_by_vector.(SigmaVertsAndRays,Ref(v)), SigmaRayIndices, SigmaLineality)
end
+(v::Vector{ZZRingElem}, Sigma::PolyhedralComplex) = QQ.(v)+Sigma
+(v::Vector{Rational}, Sigma::PolyhedralComplex) = QQ.(v)+Sigma
+(v::Vector{Int}, Sigma::PolyhedralComplex) = QQ.(v)+Sigma

+(Sigma::PolyhedralComplex, v::Vector{QQFieldElem}) = v+Sigma
+(Sigma::PolyhedralComplex, v::Vector{ZZRingElem}) = QQ.(v)+Sigma
+(Sigma::PolyhedralComplex, v::Vector{Rational}) = QQ.(v)+Sigma
+(Sigma::PolyhedralComplex, v::Vector{Int}) = QQ.(v)+Sigma


# Vector addition for polyhedral fans
+(Sigma::PolyhedralFan, v::Vector) = polyhedral_complex(Sigma)+v
+(v::Vector, Sigma::PolyhedralFan) = v+polyhedral_complex(Sigma)
37 changes: 37 additions & 0 deletions src/PolyhedralGeometry/PolyhedralFan/standard_constructions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -399,3 +399,40 @@ function arrangement_polynomial(
F = parent(first(A))
return arrangement_polynomial(ring, matrix(F, A); hyperplanes)
end


function multiply_by_nonzero_scalar(u::PointVector{QQFieldElem}, c::QQFieldElem)
return u .* c
end
function multiply_by_nonzero_scalar(u::RayVector{QQFieldElem}, c::QQFieldElem)
return (c<0 ? -u : u)
end

function *(c::QQFieldElem, Sigma::PolyhedralFan)
# if scalar is zero, return polyhedral complex consisting only of the origin
if iszero(c)
return polyhedral_complex(convex_hull(zero_matrix(QQ,1,ambient_dim(Sigma))))
end

# if scalar is non-zero, multiple all vertices and rays by said scalar
SigmaRays = first(rays_modulo_lineality(Sigma))
SigmaLineality = lineality_space(Sigma)
SigmaIncidence = maximal_cones(IncidenceMatrix,Sigma)
return polyhedral_fan(SigmaIncidence, multiply_by_nonzero_scalar.(SigmaRays,c), SigmaLineality)
end
*(c::ZZRingElem, Sigma::PolyhedralFan) = QQ(c)*Sigma
*(c::Rational, Sigma::PolyhedralFan) = QQ(c)*Sigma
*(c::Int, Sigma::PolyhedralFan) = QQ(c)*Sigma

*(Sigma::PolyhedralFan,c::QQFieldElem) = c*Sigma
*(Sigma::PolyhedralFan,c::ZZRingElem) = QQ(c)*Sigma
*(Sigma::PolyhedralFan,c::Rational) = QQ(c)*Sigma
*(Sigma::PolyhedralFan,c::Int) = QQ(c)*Sigma


function -(Sigma::PolyhedralFan)
SigmaRays = first(rays_modulo_lineality(Sigma))
SigmaLineality = lineality_space(Sigma)
SigmaIncidence = maximal_cones(IncidenceMatrix,Sigma)
return polyhedral_fan(SigmaIncidence, -SigmaRays, SigmaLineality)
end
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")
28 changes: 28 additions & 0 deletions src/TropicalGeometry/linear_space.jl
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,34 @@ function tropical_linear_space(I::MPolyIdeal, nu::Union{Nothing,TropicalSemiring
end


@doc raw"""
tropical_linear_space(G::Graph, nu::TropicalSemiringMap; weighted_polyhedral_complex_only::Bool=false)

Return the Bergman fan of the graphic matroid of `G` as a tropical linear space, the tropical semiring map `nu` is used to fix the convention. If `weighted_polyhedral_complex==true`, will not cache any extra information.

# Examples
```jldoctest
julia> G = complete_graph(4)
Undirected graph with 4 nodes and the following edges:
(2, 1)(3, 1)(3, 2)(4, 1)(4, 2)(4, 3)

julia> tropical_linear_space(G)
Min tropical linear space

```
"""
function tropical_linear_space(G::Graph, nu::Union{Nothing,TropicalSemiringMap}=nothing; weighted_polyhedral_complex_only::Bool=false)
M = zero_matrix(QQ,nv(G),ne(G))
for (i,edge) in enumerate(edges(G))
M[src(edge),i] = 1
M[dst(edge),i] = -1
end
TropG = tropical_linear_space(M,nu;weighted_polyhedral_complex_only=weighted_polyhedral_complex_only)
if !weighted_polyhedral_complex_only
set_attribute!(TropG,:graph,G)
end
return TropG
end

###############################################################################
#
Expand Down
62 changes: 62 additions & 0 deletions src/TropicalGeometry/positive_variety.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
@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 by affine linear polynomials either
(a) defined over the rational numbers and that `nu` encodes the trivial valuation,
(b) defined over 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)
@req all(isequal(1),total_degree.(gens(I))) "generators of input ideal not affine linear"

# 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

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 @@ -1257,6 +1257,7 @@ export polyhedron
export polynomial
export polynomial_ring
export positive_hull
export positive_tropical_variety
export possible_class_fusions
export power_sum
export powers_of_element
Expand Down
23 changes: 23 additions & 0 deletions test/PolyhedralGeometry/polyhedral_complex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,27 @@
@test n_maximal_polyhedra(vrep) == n_maximal_polyhedra(hrep)
end
end

@testset "Binary operations" begin
PCshifted = PC + [1, 1]
@test dim(PCshifted) == dim(PC)
@test ambient_dim(PCshifted) == ambient_dim(PC)
@test lineality_dim(PCshifted) == lineality_dim(PC)
@test issetequal(rays(PCshifted), rays(PC))
@test n_maximal_cones(PCshifted) == n_maximal_polyhedra(PC)

PCscaled = 2*PC
@test dim(PCscaled) == dim(PC)
@test ambient_dim(PCscaled) == ambient_dim(PC)
@test lineality_dim(PCscaled) == lineality_dim(PC)
@test issetequal(rays(PCscaled), rays(PC))
@test n_maximal_cones(PCscaled) == n_maximal_polyhedra(PC)

PCnegated = -PC
@test dim(PCnegated) == dim(PC)
@test ambient_dim(PCnegated) == ambient_dim(PC)
@test lineality_dim(PCnegated) == lineality_dim(PC)
@test issetequal(rays(PCnegated), rays(PC))
@test n_maximal_cones(PCnegated) == n_maximal_polyhedra(PC)
end
end
9 changes: 9 additions & 0 deletions test/PolyhedralGeometry/polyhedral_fan.jl
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,15 @@ end
sff1 = star_subdivision(ff, w1)
@test number_of_maximal_cones(sff0) == 2
@test number_of_maximal_cones(sff1) == 3

f = normal_fan(cube(2))
fMinus = -f
@test n_rays(fMinus) == n_rays(f)
@test n_maximal_cones(fMinus) == n_maximal_cones(f)

fMinus = -1*f
@test n_rays(fMinus) == n_rays(f)
@test n_maximal_cones(fMinus) == n_maximal_cones(f)
end

@testset "Defining polynomial of hyperplane arrangement from matrix" begin
Expand Down
Loading