|
| 1 | +@doc raw""" |
| 2 | + positive_tropical_variety(I::MPolyIdeal,nu::TropicalSemiringMap) |
| 3 | +
|
| 4 | +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 |
| 5 | +(a) the rational numbers and that `nu` encodes the trivial valuation, |
| 6 | +(b) the rational function field over the rational numbers and that `nu` encodes the t-adic valuation. |
| 7 | +
|
| 8 | +# Examples |
| 9 | +```jldoctest |
| 10 | +julia> K,t = rational_function_field(QQ,"t") |
| 11 | +(Rational function field over QQ, t) |
| 12 | +
|
| 13 | +julia> C = matrix(K,[[-3*t,1*t,-1*t,-2*t,2*t],[-1*t,1*t,-1*t,-1*t,1*t]]) |
| 14 | +[-3*t t -t -2*t 2*t] |
| 15 | +[ -t t -t -t t] |
| 16 | +
|
| 17 | +julia> R,x = polynomial_ring(K,ncols(C)) |
| 18 | +(Multivariate polynomial ring in 5 variables over K, AbstractAlgebra.Generic.MPoly{AbstractAlgebra.Generic.RationalFunctionFieldElem{QQFieldElem, QQPolyRingElem}}[x1, x2, x3, x4, x5]) |
| 19 | +
|
| 20 | +julia> nu = tropical_semiring_map(K,t) |
| 21 | +Map into Min tropical semiring encoding the t-adic valuation on Rational function field over QQ |
| 22 | +
|
| 23 | +julia> I = ideal(C*gens(R)) |
| 24 | +Ideal generated by |
| 25 | + -3*t*x1 + t*x2 - t*x3 - 2*t*x4 + 2*t*x5 |
| 26 | + -t*x1 + t*x2 - t*x3 - t*x4 + t*x5 |
| 27 | +
|
| 28 | +julia> TropPlusI = positive_tropical_variety(I,nu) |
| 29 | +Min tropical variety |
| 30 | +
|
| 31 | +``` |
| 32 | +""" |
| 33 | +function positive_tropical_variety(I::MPolyIdeal,nu::TropicalSemiringMap) |
| 34 | + if all(isequal(2),length.(gens(I))) |
| 35 | + if all(isequal(-1),[prod([sign(c) for c in coefficients(g)]) for g in gens(I)]) |
| 36 | + # binomial ideal positive, return regular tropical variety |
| 37 | + return tropical_variety(I,nu) |
| 38 | + else |
| 39 | + # binomial ideal not positive, return empty polyhedral complex in the correct ambient dimension |
| 40 | + return polyhedral_complex(IncidenceMatrix(zeros(Int,0,0)),zero_matrix(QQ,0,ambient_dim(TropL))) |
| 41 | + end |
| 42 | + end |
| 43 | + |
| 44 | + if all(isequal(1),total_degree.(gens(I))) |
| 45 | + # Construct the tropicalization of I |
| 46 | + TropL = tropical_linear_space(I,nu) |
| 47 | + |
| 48 | + # find maximal polyhedra belonging to the positive part |
| 49 | + # we check containment in the positive part by testing the initial ideal w.r.t. a relative interior point |
| 50 | + positivePolyhedra = Polyhedron{QQFieldElem}[sigma for sigma in maximal_polyhedra(TropL) if is_initial_positive(I,nu,relative_interior_point(sigma))] |
| 51 | + |
| 52 | + if isempty(positivePolyhedra) |
| 53 | + # if there are no positive polyhedra, |
| 54 | + # return empty polyhedral complex in the correct ambient dimension |
| 55 | + return polyhedral_complex(IncidenceMatrix(zeros(Int,0,0)),zero_matrix(QQ,0,ambient_dim(TropL))) |
| 56 | + end |
| 57 | + |
| 58 | + Sigma = polyhedral_complex(positivePolyhedra) |
| 59 | + mult = ones(ZZRingElem, n_maximal_polyhedra(Sigma)) |
| 60 | + minOrMax = convention(nu) |
| 61 | + return tropical_variety(Sigma,mult,minOrMax) |
| 62 | + end |
| 63 | + |
| 64 | + error("input ideal not supported") |
| 65 | +end |
| 66 | + |
| 67 | +function is_initial_positive(I::MPolyIdeal, nu::TropicalSemiringMap, w::AbstractVector) |
| 68 | + inI = initial(I,nu,w) |
| 69 | + G = groebner_basis(inI; complete_reduction=true) |
| 70 | + |
| 71 | + # the Groebner basis is binomial, check binomials have alternating signs |
| 72 | + return all(isequal(-1),[prod([sign(c) for c in coefficients(g)]) for g in G]) |
| 73 | +end |
0 commit comments