Skip to content
Merged
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
69 changes: 69 additions & 0 deletions src/TropicalGeometry/hypersurface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -260,3 +260,72 @@ end
# @req has_attribute(TropH,:tropical_semiring_map) "no tropical semiring map cached"
# return get_attribute(TropH,:tropical_semiring_map)
# end
#

@doc raw"""
tropical_prevariety(F::Vector{MPolyRingElem},nu::TropicalSemiringMap)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
tropical_prevariety(F::Vector{MPolyRingElem},nu::TropicalSemiringMap)
tropical_prevariety(F::Vector{MPolyRingElem},nu::TropicalSemiringMap)

This needs to be indented by 4 spaces.


Return the tropical prevariety generated by intersecting tropical hypersurfaces corresponding to elements of `F`.

If `F` is a finite collection of polynomials with coefficients from a given field, return the tropical prevariety obtained by tropicalizing elements of `F` with respect to a given tropicalization map `nu`.

If no `nu` is given, default to trivial valuation with `min` convention.

If `F` is a collection of tropical polynomials, the function computes and intersects the associated hypersurfaces.
# Example
We compute the Dressian $\text{Dr}(2,5)$ below.
```jldoctest
julia> Gr25 = grassmann_pluecker_ideal(2,5)
Ideal generated by
x[[1, 2]]*x[[3, 4]] - x[[1, 3]]*x[[2, 4]] + x[[1, 4]]*x[[2, 3]]
x[[1, 2]]*x[[3, 5]] - x[[1, 3]]*x[[2, 5]] + x[[1, 5]]*x[[2, 3]]
x[[1, 2]]*x[[4, 5]] - x[[1, 4]]*x[[2, 5]] + x[[1, 5]]*x[[2, 4]]
x[[1, 3]]*x[[4, 5]] - x[[1, 4]]*x[[3, 5]] + x[[1, 5]]*x[[3, 4]]
x[[2, 3]]*x[[4, 5]] - x[[2, 4]]*x[[3, 5]] + x[[2, 5]]*x[[3, 4]]

#Compute Dressian without specified tropicalization map.
julia> Dr25 = tropical_prevariety(gens(Gr25))
Comment on lines +286 to +287
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
#Compute Dressian without specified tropicalization map.
julia> Dr25 = tropical_prevariety(gens(Gr25))
julia> Dr25 = tropical_prevariety(gens(Gr25)) #Compute Dressian without specified tropicalization map.

Polyhedral complex in ambient dimension 10

julia> rays_modulo_lineality(Dr25)[1]
10-element SubObjectIterator{RayVector{QQFieldElem}}:
[1, -1//3, -1//3, -1//3, -1//3, -1//3, -1//3, 1//3, 1//3, 1//3]
[1, 1, -1, -1, 1, -1, -1, -1, -1, 3]
[1, -1, 1, -1, -1, 1, -1, -1, 3, -1]
[1, -1, -1, 1, -1, -1, 1, 3, -1, -1]
[-1, 1, 1, -1, -1, -1, 3, 1, -1, -1]
[-1, -1, -1, 3, 1, 1, -1, 1, -1, -1]
[-1, 1, -1, 1, -1, 3, -1, -1, 1, -1]
[-1, 3, -1, -1, -1, 1, 1, -1, -1, 1]
[-1, -1, 3, -1, 1, -1, 1, -1, 1, -1]
[-1, -1, 1, 1, 3, -1, -1, -1, -1, 1]

#Compute with respect to max convention
julia> nu = tropical_semiring_map(QQ,max)
Comment on lines +303 to +304
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
#Compute with respect to max convention
julia> nu = tropical_semiring_map(QQ,max)
julia> nu = tropical_semiring_map(QQ,max) #Compute with respect to max convention

Map into Max tropical semiring encoding the trivial valuation on Rational field

julia> Dr25max = tropical_prevariety(gens(Gr25),nu)
Polyhedral complex in ambient dimension 10

#Give input as tropical polynomials
Dr25 = tropical_prevariety(tropical_polynomial.([f for f in gens(Gr25)]))
Polyhedral complex in ambient dimension 10
Comment on lines +310 to +312
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
#Give input as tropical polynomials
Dr25 = tropical_prevariety(tropical_polynomial.([f for f in gens(Gr25)]))
Polyhedral complex in ambient dimension 10
julia> Dr25 = tropical_prevariety(tropical_polynomial.([f for f in gens(Gr25)])) # Give input as tropical polynomials
Polyhedral complex in ambient dimension 10

There is a julia> missing, also I don't think comments like this before the julia> lines will work, we do have it like this in other cases so I added this as a suggestion:

julia> some + code   # some explanation

```
"""
Comment thread
benlorenz marked this conversation as resolved.
Outdated
#Input array of tropical polynomials
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
#Input array of tropical polynomials

This line needs to be removed for the docstring to work.

The doctest is also not run currently.

function tropical_prevariety(F::Vector{<:AbstractAlgebra.Generic.MPoly{TropicalSemiringElem{minmax}}}) where {minmax<:Union{typeof(min),typeof(max)}}
length(F) > 0 || error("Empty array.")
HTF = tropical_hypersurface.(F)
return tropical_prevariety(HTF)
end

function tropical_prevariety(F::Vector{<:MPolyRingElem}, nu::TropicalSemiringMap)
return tropical_prevariety(tropical_polynomial.(F,Ref(nu)))
end

#Default to min with trivial valuation
tropical_prevariety(F::Vector{<:MPolyRingElem}) = tropical_prevariety(F, tropical_semiring_map(coefficient_ring(first(F))))

tropical_prevariety(F::Vector{<:MPolyRingElem}, convention::minmax) where {minmax<:Union{typeof(min),typeof(max)}} = tropical_prevariety(F, tropical_semiring_map(coefficient_ring(first(F)), convention))

tropical_prevariety(F::Vector{TropicalHypersurface{minmax, true}}) where {minmax<:Union{typeof(min),typeof(max)}} = reduce(common_refinement, [h.polyhedralComplex for h in F])
1 change: 1 addition & 0 deletions src/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1659,6 +1659,7 @@ export tropical_median_consensus
export tropical_pluecker_vector
export tropical_polynomial
export tropical_variety
export tropical_prevariety
export truncate
export turn_denominator_into_polyhedron
export tutte_connectivity
Expand Down
20 changes: 19 additions & 1 deletion test/TropicalGeometry/variety.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,23 @@
TropH = tropical_hypersurface(f,nu)
@test issetequal(maximal_polyhedra(TropH),maximal_polyhedra(TropV))
end


@testset "tropical prevarieties" begin
G = grassmann_pluecker_ideal(2,4)
f = gens(G)[1]
T = tropical_hypersurface(f)
TP = polyhedral_complex(T)
TT = tropical_prevariety([f])
@test rays_modulo_lineality(TP) == rays_modulo_lineality(TT)
@test incidence_matrix(maximal_polyhedra(TP)) == incidence_matrix(maximal_polyhedra(TT))
G = grassmann_pluecker_ideal(2,5)
T = tropical_prevariety(gens(G))
@test length(rays_modulo_lineality(T)[1]) == 10
nu = tropical_semiring_map(QQ,max)
T = tropical_prevariety(gens(G),nu)
@test length(rays_modulo_lineality(T)[1]) == 10
TG = tropical_hypersurface.(gens(G))
T = tropical_prevariety(TG)
@test length(rays_modulo_lineality(T)[1]) == 10
end
end
Loading