@@ -1572,6 +1572,88 @@ function equidimensional_hull_radical(
1572
1572
return ideal (R, unique! (iso .(gens (res))))
1573
1573
end
1574
1574
1575
+ # ###############################################################################
1576
+ #
1577
+ # triangular decomposition
1578
+ #
1579
+ # ###############################################################################
1580
+
1581
+ @doc raw """
1582
+ triangular_decomposition(I::MPolyIdeal; algorithm::Symbol=:Lazard)
1583
+
1584
+ Return a triangular decomposition of a zero-dimensional `I`.
1585
+
1586
+ The default algorithm is `:Lazard` based on [Laz92](@cite). Algorithm `:LazardFactorized` further
1587
+ factorizes each polynomial in the output of `:Lazard`. Algorithm `:Moeller` is based on [Moe93](@cite)
1588
+ and Algorithm `:MoellerHillebrand` is based on [Hill99](@cite).
1589
+
1590
+ # Examples
1591
+ ```jldoctest
1592
+ julia> R, (x1,x2,x3,x4,x5) = polynomial_ring(QQ, [:x1,:x2,:x3,:x4,:x5]);
1593
+
1594
+ julia> I = ideal([x1+x2+x3+x4+x5,
1595
+ x1*x2+x2*x3+x3*x4+x1*x5+x4*x5,
1596
+ x1*x2*x3+x2*x3*x4+x1*x2*x5+x1*x4*x5+x3*x4*x5,
1597
+ x1*x2*x3*x4+x1*x2*x3*x5+x1*x2*x4*x5+x1*x3*x4*x5+x2*x3*x4*x5,
1598
+ x1*x2*x3*x4*x5-1]);
1599
+
1600
+ julia> triangular_decomposition(I)
1601
+ 4-element Vector{MPolyIdeal{QQMPolyRingElem}}:
1602
+ Ideal (x5^5 - 1, x4 - x5, x3^2 + 3*x3*x5 + x5^2, x2 + x3 + 3*x5, x1 - x5)
1603
+ Ideal (x5^5 - 1, x4 - x5, x3 - x5, x2^2 + 3*x2*x5 + x5^2, x1 + x2 + 3*x5)
1604
+ Ideal with 5 generators
1605
+ Ideal with 5 generators
1606
+
1607
+ julia> triangular_decomposition(I, :LazardFactorized)
1608
+ 13-element Vector{MPolyIdeal{QQMPolyRingElem}}:
1609
+ Ideal (x5 - 1, x4 - 1, x3 - 1, x2^2 + 3*x2 + 1, x1 + x2 + 3)
1610
+ Ideal (x5 - 1, x4 - 1, x3^2 + 3*x3 + 1, x2 + x3 + 3, x1 - 1)
1611
+ Ideal (x5 - 1, x4^2 + 3*x4 + 1, x3 + x4 + 3, x2 - 1, x1 - 1)
1612
+ Ideal (x5 - 1, x4^4 + x4^3 + x4^2 + x4 + 1, -x3 + x4^2, -x2 + x4^3, x1 + x4^3 + x4^2 + x4 + 1)
1613
+ Ideal (x5^2 + 3*x5 + 1, x4 - 1, x3 - 1, x2 - 1, x1 + x5 + 3)
1614
+ Ideal (x5^2 + 3*x5 + 1, x4 + x5 + 3, x3 - 1, x2 - 1, x1 - 1)
1615
+ ⋮
1616
+ Ideal (x5^4 + x5^3 + x5^2 + x5 + 1, x4 - x5, x3 - x5, x2^2 + 3*x2*x5 + x5^2, x1 + x2 + 3*x5)
1617
+ Ideal (x5^4 + x5^3 + x5^2 + x5 + 1, x4 - x5, x3^2 + 3*x3*x5 + x5^2, x2 + x3 + 3*x5, x1 - x5)
1618
+ Ideal with 5 generators
1619
+ Ideal (x5^4 + x5^3 + x5^2 + x5 + 1, x4^2 + 3*x4*x5 + x5^2, x3 + x4 + 3*x5, x2 - x5, x1 - x5)
1620
+ Ideal with 5 generators
1621
+
1622
+ julia> triangular_decomposition(I, :Moeller)
1623
+ 4-element Vector{MPolyIdeal{QQMPolyRingElem}}:
1624
+ Ideal (x5^5 - 1, x4 - x5, x3 - x5, x2^2 + 3*x2*x5 + x5^2, x1 + x2 + 3*x5)
1625
+ Ideal with 5 generators
1626
+ Ideal with 5 generators
1627
+ Ideal (x5^5 - 1, x4 - x5, x3^2 + 3*x3*x5 + x5^2, x2 + x3 + 3*x5, x1 - x5)
1628
+
1629
+ julia> triangular_decomposition(I, :MoellerHillebrand)
1630
+ 4-element Vector{MPolyIdeal{QQMPolyRingElem}}:
1631
+ Ideal (x5^5 - 1, x4 - x5, x3 - x5, x2^2 + 3*x2*x5 + x5^2, x1 + x2 + 3*x5)
1632
+ Ideal with 5 generators
1633
+ Ideal with 5 generators
1634
+ Ideal (x5^5 - 1, x4 - x5, x3^2 + 3*x3*x5 + x5^2, x2 + x3 + 3*x5, x1 - x5)
1635
+
1636
+ ```
1637
+ """
1638
+ function triangular_decomposition (I:: MPolyIdeal , algorithm:: Symbol = :Lazard )
1639
+ @req dim (I)== 0 " The ideal must be zero-dimensional."
1640
+ R = base_ring (I)
1641
+ G = ideal (groebner_basis (I; ordering= lex (R), complete_reduction= true ))
1642
+ Gsing = singular_generators (G,lex (R))
1643
+ if algorithm== :Lazard
1644
+ Ts = Singular. LibTriang. triangL (Gsing)
1645
+ elseif algorithm== :LazardFactorized
1646
+ Ts = Singular. LibTriang. triangLfak (Gsing)
1647
+ elseif algorithm== :Moeller
1648
+ Ts = Singular. LibTriang. triangM (Gsing)
1649
+ elseif algorithm== :MoellerHillebrand
1650
+ Ts = Singular. LibTriang. triangMH (Gsing)
1651
+ else
1652
+ error (" algorithm allowed are :Lazard, :LazardFactorized, :Moeller, or :MoellerHillebrand" )
1653
+ end
1654
+ return [ideal (R, T) for T in Ts]
1655
+ end
1656
+
1575
1657
# ######################################################
1576
1658
@doc raw """
1577
1659
==(I::MPolyIdeal, J::MPolyIdeal)
0 commit comments