Skip to content

Commit

Permalink
sagemathgh-37146: Fix a bug in reduction of element modulo ideal in e…
Browse files Browse the repository at this point in the history
…xterior algebra

    
<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes sagemath#1234" use "Introduce new method to
calculate 1+1"
-->
<!-- Describe your changes here in detail -->

This adds a loop to continue doing reduction modulo a Grobner basis for
an element modulo an ideal in the exterior algebra. This guarantees a
unique representative for each element, and that representative will be
$0$ if the element is in the ideal. This fixes sagemath#37108.

<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes sagemath#12345". -->
<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [x] I have created tests covering the changes.
- [x] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- sagemath#12345: short description why this is a dependency
- sagemath#34567: ...
-->
None.

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: sagemath#37146
Reported by: trevorkarn
Reviewer(s): Travis Scrimshaw
  • Loading branch information
Release Manager committed Jan 26, 2024
2 parents 626eb70 + fa766d2 commit ced1f2c
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/sage/algebras/exterior_algebra_groebner.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -477,13 +477,30 @@ cdef class GroebnerStrategy:
0
sage: I._groebner_strategy.reduce(E.zero())
0
Check :issue:`37108` is fixed::
sage: E = ExteriorAlgebra(QQ, 6)
sage: E.inject_variables(verbose=False)
sage: gens = [-e0*e1*e2 + e0*e1*e5 - e0*e2*e3 - e0*e3*e5 + e1*e2*e3 + e1*e3*e5,
....: e1*e2 - e1*e5 + e2*e5, e0*e2 - e0*e4 + e2*e4,
....: e3*e4 - e3*e5 + e4*e5, e0*e1 - e0*e3 + e1*e3]
sage: I = E.ideal(gens)
sage: S = E.quo(I)
sage: I.reduce(e1*e3*e4*e5)
0
"""
if not f:
return f
# Make a copy to mutate
f = type(f)(f._parent, copy(f._monomial_coefficients))
for g in self.groebner_basis:
self.reduce_single(f, g)
was_reduced = True
while was_reduced:
was_reduced = False
for g in self.groebner_basis:
was_reduced = self.reduce_single(f, g)
if was_reduced:
break
return f

cdef bint reduce_single(self, CliffordAlgebraElement f, CliffordAlgebraElement g) except -1:
Expand Down

0 comments on commit ced1f2c

Please sign in to comment.