Macaulay2 / Macaulay2/M2

ideal of groebner basis should remember it has a groebner basis

Open
#996 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Core Gröbner bases
Dominant language
Macaulay2
Stars
435
Forks
297
Avg merge
4d 20h
Merged PRs (30d)
11

Description

I've had several cases where I'd like to construct an ideal from a Groebner basis and then perform some computation that needs Groebner basis information. For example, this has happened when passing a Groebner basis into a function and then needing `dim` or `R/I`.

Of course, constructing the ideal with `ideal gens G` makes a new ideal, and the Groebner basis has to be recomputed. For example,

```
i1 : R = ZZ/32003[x,y,z];

i2 : gbTrace = 3;

i3 : I1 = ideal(y-x^2, z-x^3);

o3 : Ideal of R

i4 : G1 = gb I1

-- registering gb 0 at 0x111503700

-- [gb]{2}(1)m{3}(1)m{4}(1)m{5}(1)onumber of (nonminimal) gb elements = 3
-- number of monomials = 6
-- #reduction steps = 2
-- #spairs done = 4
-- ncalls = 0
-- nloop = 0
-- nsaved = 0
--
o4 = GroebnerBasis[status: done; S-pairs encountered up to degree 4]

o4 : GroebnerBasis

i5 : I2 = ideal gens G1;

o5 : Ideal of R

i6 : gb I2 -- recomputes the Groebner basis

-- registering gb 1 at 0x111503540

-- [gb]{2}(3)mmm{3}(2)oonumber of (nonminimal) gb elements = 3
-- number of monomials = 6
-- #reduction steps = 2
-- #spairs done = 5
-- ncalls = 1
-- nloop = 0
-- nsaved = 0
--
o6 = GroebnerBasis[status: done; S-pairs encountered up to degree 2]

o6 : GroebnerBasis
```

I can prevent the computation by manually adjusting the ideal's cache after constructing it. For example,

```
i1 : R = ZZ/32003[x,y,z];

i2 : gbTrace = 3;

i3 : I1 = ideal(y-x^2, z-x^3);

o3 : Ideal of R

i4 : G1 = gb I1

-- registering gb 0 at 0x1134f6540

-- [gb]{2}(1)m{3}(1)m{4}(1)m{5}(1)onumber of (nonminimal) gb elements = 3
-- number of monomials = 6
-- #reduction steps = 2
-- #spairs done = 4
-- ncalls = 0
-- nloop = 0
-- nsaved = 0
--
o4 = GroebnerBasis[status: done; S-pairs encountered up to degree 4]

o4 : GroebnerBasis

i5 : I2 = ideal gens G1;

o5 : Ideal of R

i6 : gbOpt := new GroebnerBasisOptions from {HardDegreeLimit => null,
Syzygies => false,
SyzygyRows => 0};

i7 : I2.generators.cache#gbOpt = G1;

i8 : gb I2 -- does not recompute the Groebner basis

o8 = GroebnerBasis[status: done; S-pairs encountered up to degree 4]

o8 : GroebnerBasis
```

I think `ideal` should be able to take in a `GroebnerBasis` and immediately store that as its Groebner basis, maybe using the same idea as above. I'd be happy to implement this, but I'm not really sure what is going on in the `GroebnerBasisOptions` object, what special cases there may be, or what the side effects are of setting the cache. Is it possible to do something like this?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how ideal constructs an Ideal from gens and how gb retrieves or stores Groebner basis information. Read the GroebnerBasisOptions handling and the generators.cache#gbOpt access shown in the examples, then check the existing behavior of gb after constructing an ideal from gens G1. Done means the ideal accepts a GroebnerBasis and gb reuses it without recomputation, including relevant special cases.

Written by the indexing model from the issue text.

Assessment

Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.