Ask Your Question
0

Analyzing affine monoids

asked 2025-10-12 12:03:31 +0100

JTS gravatar image

updated 2025-10-13 07:43:09 +0100

I am studying a family of affine monoids. The programs Normaliz and libnormaliz are great for this, and some of their functionality is available in SageMath.

For instance, I can do

C = Cone([[1,1,0,0],[1,0,1,0],[1,0,0,1],[0,1,1,0],[0,1,0,1],[0,0,1,1]])
C.Hilbert_basis()

and from the output

N(1, 1, 0, 0),
N(1, 0, 1, 0),
N(1, 0, 0, 1),
N(0, 1, 1, 0),
N(0, 1, 0, 1),
N(0, 0, 1, 1),
N(1, 1, 0, 1),
N(1, 1, 1, 0),
N(1, 0, 1, 1),
N(0, 1, 1, 1)

one notes that the affine monoid generated by the extreme rays of the cone is not integrally closed (in the lattice Z^4).

However, Normaliz also allows one to find the sublattice that the monoid generates inside Z^4, as well as finding the Hilbert series of the (appropriately graded) affine monoid. Is this functionality exposed in SageMath? I could not find it.

I can certainly drag in libnormaliz and do it, but as you see below, it is cumbersome:

import PyNormaliz
from PyNormaliz import *
n = 4
C = Cone(cone = [[1,1,0,0],[1,0,1,0],[1,0,0,1],[0,1,1,0],[0,1,0,1],[0,0,1,1]], grading=[[int(1) for _ in range(n)]])
C.InternalIndex()
C.Grading()
print_series(C.HilbertSeries())

gives

2
[[1, 1, 1, 1], 1]
(1 -  t + 3t^2 +  t^3)
 ----------------------
 (1 - t) (1 - t^2)^3

This shows that the sublattice has index 2; reasonable, since all generators have even total sum. I got the Hilbert series of the affine monoid, not that of its integral closure --- nice. But I had to randomly convert some integers to python integers, switch from snake_case to CamelCase, overload Cone with the Normaliz version, which has a different syntax. This is irksome.

Questions:

  1. Is the functionality for affine monoids already in Sagemath, if so where? I am running sage 106, but I can certainly upgrade.
  2. If I need to import/call libnormaliz, is there some way of automagically turn sage integers to the type that libnormaliz prefers, but only when appropriate? In the example above, when inputting a cone, the extremal rays could be given by sage integers, but the grading vector needed python integers.

Edit: Max Alekseyev answered the Hilbert Series question. Guided by this, I found the "The Normaliz backend for polyhedral computations" section of the sagemath docs. It seems the most of the PyNormaliz functionality is implemented, but not the lattice algorithms of libnormaliz? For instance, in plain normaliz, using the input file

amb_space 4
cone_and_lattice 6
1 1 0 0
1 0 1 0
1 0 0 1
0 1 1 0
0 1 0 1 
0 0 1 1

total_degree
NoGradingDenom

HilbertBasis
HilbertSeries
Sublattice

I get at the end of the output file:

1 congruences:
1 1 1 1 2

4 basis elements of generated  lattice:
1 0 0 1
0 1 0 1
0 0 1 1
0 0 0 2

This tells me that all lattice points in the affine monoid lies in the sublattice consisting of those lattice points (a,b,c,d) with a+b+c+d congruent 0 mod 2, and that there are no further restrictions.

How can I use sagemath to do this calculation?

Edit 2: The functionality for finding the generated sublattice is available in PyNormaliz (somewhat poorly documented, I had to experiment):

import PyNormaliz
from PyNormaliz import *
n = 4
C = Cone(cone_and_lattice = [[1,1,0,0],[1,0,1,0],[1,0,0,1],[0,1,1,0],[0,1,0,1],[0,0,1,1]], grading=[[int(1) for _ in range(n)]])
print_matrix(C.Congruences())
print(C.Sublattice())

prints

 1 1 1 1 2
 [[[1, 0, 0, 1], [0, -1, -1, 0], [0, 1, 0, 1], [0, 0, 1, 1]], [[2, -1, -1, -1], [0, -1, 1, -1], [0, -1, -1, 1], [0, 1, 1, 1]], 2]
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2025-10-12 16:39:33 +0100

Max Alekseyev gravatar image

Is this what you want?

sage: C = Cone([[1,1,0,0],[1,0,1,0],[1,0,0,1],[0,1,1,0],[0,1,0,1],[0,0,1,1]])

sage: C.polyhedron(backend='normaliz').hilbert_series(grading=[1]*4)
(t^3 + 3*t^2 - t + 1)/(t^7 - t^6 - 3*t^5 + 3*t^4 + 3*t^3 - 3*t^2 - t + 1)
edit flag offensive delete link more

Comments

Thank you, that answers one of my questions. I would also like to find the lattice gp(M) inside Z^4 generated by the affine monoid. In this case, it is an index 2 subgroup.

JTS gravatar imageJTS ( 2025-10-12 17:36:51 +0100 )edit

If some functionality is missing, you can request it at https://github.com/sagemath/sage/issues

Max Alekseyev gravatar imageMax Alekseyev ( 2025-10-12 18:26:11 +0100 )edit

Yes, since it seems the desired functionality is already in PyNormaliz, see my second edit, it should be possible to add it to Sagemath. I'll make a request, as you suggested. Thanks again.

JTS gravatar imageJTS ( 2025-10-13 07:47:16 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2025-10-12 12:03:31 +0100

Seen: 86 times

Last updated: Oct 13