length of free_resolution gives wrong results
bugtopic: commutative algebra
**Describe the bug**
It seems that `length` has problems with short free resolutions of graded modules. This bug has been discovered when confronting over R=QQ[x] the free resolution of
- R itself, which is 0 -> R;
- R/(x), which is 0 -> R -> R;
Obviously, the second resolution is longer.
**To Reproduce**
```
using Oscar
# QQ[x]
M1 = free_module(R,1)
length(free_resolution(M1))
# QQ[x]/(x)
M2 = cokernel(matrix(R, [x]))
length(free_resolution(M2))
```
The function `length` returns `1` for both free resolutions.
**Expected behavior**
The expectation is that `length` returns the number of non-zero terms in the free resolution, so `1` for the free resolution of `M1` and `2` for the one of `M2`. This information can be obtained, for example, by the following code (supposing that `rank` is a cheap function for terms of `FreeResolution`):
```
function length_complex(F::FreeResolution)
l=0
while rank(F[l])>0
l=l+1
end
return l
end
```
**System:**
```
julia> Oscar.versioninfo(full=true)
OSCAR version 1.7.0
combining:
AbstractAlgebra.jl v0.47.6
GAP.jl v0.16.2
Hecke.jl v0.39.3
Nemo.jl v0.52.4
Polymake.jl v0.13.7
Singular.jl v0.28.2
building on:
FLINT_jll v301.300.102+0
GAP_jll v400.1500.100+1
GAP_lib_jll v400.1500.100+0
Singular_jll v404.101.502+0
libpolymake_julia_jll v0.14.3+1
libsingular_julia_jll v0.47.9+0
polymake_jll v400.1500.0+0
polymake_oscarnumber_jll v0.3.12+1
See `]st -m` for a full list of dependencies.
Julia Version 1.12.5
Commit 5fe89b8ddc1 (2026-02-09 16:05 UTC)
Build Info:
Official https://julialang.org release
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 12 × AMD Ryzen 5 8500GE w/ Radeon 740M Graphics
WORD_SIZE: 64
LLVM: libLLVM-18.1.7 (ORCJIT, znver4)
GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 12 virtual cores)
Official https://julialang.org release
```
0 条评论