Skip to content

fix: index betti_numbers by ascending cohomological degree - #35

Merged
giannipetrella merged 1 commit into
mainfrom
fix/betti-numbers
Jul 15, 2026
Merged

fix: index betti_numbers by ascending cohomological degree#35
giannipetrella merged 1 commit into
mainfrom
fix/betti-numbers

Conversation

@pbelmans

Copy link
Copy Markdown
Member

Problem

betti_numbers(M) misbehaves whenever the Poincaré polynomial is not palindromic, which happens for quivers with oriented cycles (the moduli space is smooth but not projective, so Poincaré duality does not force symmetry). Three distinct defects:

  1. Wrong ordering. Singular.coefficients(P) returns coefficients leading-term-first, and the old code interleaved them with zeros in that order. For a non-palindromic P this lists the Betti numbers by descending cohomological degree, so betti[i] is not b_{2(i-1)}.
  2. Float64 output. The zero-padding to length 2 dim + 1 used zeros(...), whose default eltype is Float64, promoting the whole Vector{Int} to Vector{Float64} (e.g. [1.0, 0.0, ...]). This padding branch only fires when deg P < 2 dim, which never happens in the palindromic examples the package usually runs on.
  3. Crash on a monomial P. When P is a single term (e.g. the round-trip quiver 1 ⇄ 2 with d = (1,1), whose moduli space is A^1 with P = L), coeff[1:(end-1)] is empty and reduce(vcat, ...) throws.

Fix

Build a zeros(Int, 2 dim + 1) vector and place each coefficient at its true degree via zip(Singular.coefficients(P), Singular.exponent_vectors(P)) (the same idiom already used in Chow.jl). This is integer-valued, ascending-degree-indexed, and correct for a monomial or any gapped polynomial.

Test

Adds a "Betti numbers" testset: the round-trip quiver (A^1, expects [0, 0, 1] as a Vector{Int}, which the old code failed on all three counts) plus the palindromic 6-fold as a no-regression guard. The existing doctests are palindromic and remain valid.

For non-palindromic Poincaré polynomials, which occur for quivers with
oriented cycles, the coefficients were listed by descending degree and
the padding to length 2 dim + 1 used Float64 zeros; a monomial Poincaré
polynomial crashed outright. Includes a regression test.
@giannipetrella
giannipetrella merged commit 2b2eb6c into main Jul 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants