diff --git a/src/TropicalGeometry/hypersurface.jl b/src/TropicalGeometry/hypersurface.jl index febef38fa345..389a82b99ee0 100644 --- a/src/TropicalGeometry/hypersurface.jl +++ b/src/TropicalGeometry/hypersurface.jl @@ -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) + +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)) +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) +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 +``` +""" +#Input array of tropical polynomials +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]) diff --git a/src/exports.jl b/src/exports.jl index 4c9bb819aec3..06c4fc2813f1 100644 --- a/src/exports.jl +++ b/src/exports.jl @@ -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 diff --git a/test/TropicalGeometry/variety.jl b/test/TropicalGeometry/variety.jl index 3b816574b357..bf5aa9ba7eba 100644 --- a/test/TropicalGeometry/variety.jl +++ b/test/TropicalGeometry/variety.jl @@ -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