Skip to content

Commit

Permalink
Let HighLevelGroebnerBasis compute *the reduced* Groebner basis.
Browse files Browse the repository at this point in the history
  • Loading branch information
erich-9 committed Oct 1, 2018
1 parent 045eab7 commit 1afafbb
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 4 deletions.
2 changes: 2 additions & 0 deletions lib/gbhighlevel.gd
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
DeclareOperation( "HighLevelGroebnerBasis", [ IsList, IsPathAlgebra ] );
DeclareOperation( "RemainderOfDivision", [ IsElementOfMagmaRingModuloRelations, IsList, IsPathAlgebra ] );
DeclareOperation( "ReducedList", [ IsList, IsPathAlgebra ] );
DeclareOperation( "TipReducedList", [ IsList, IsPathAlgebra ] );
DeclareOperation( "LeftmostOccurrence", [ IsList, IsList ] );
DeclareSynonym( "TipWalk", x -> WalkOfPath(TipMonomial(x)) );
64 changes: 60 additions & 4 deletions lib/gbhighlevel.gi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
InstallMethod( HighLevelGroebnerBasis,
"compute a complete Groebner Basis",
"compute the complete reduced Groebner Basis",
[ IsList, IsPathAlgebra ],
function(els, A)
local gb, el, el_tip,
Expand All @@ -10,7 +10,7 @@ InstallMethod( HighLevelGroebnerBasis,
Error("elements do not belong to the arrow ideal of the path algebra");
fi;

els := MakeUniform(els);
els := ReducedList(MakeUniform(els), A);

gb := [];

Expand Down Expand Up @@ -48,13 +48,69 @@ InstallMethod( HighLevelGroebnerBasis,
od;
od;

gb := TipReducedList(gb, A);
gb := ReducedList(gb, A);

return gb;
end
);


InstallMethod( ReducedList,
"for a list of path-algebra elements",
[ IsList, IsPathAlgebra ],
function(els, A)
local res, i, r;

res := Filtered(els, el -> not IsZero(el));

i := Length(res);
while i > 0 do
r := RemainderOfDivision(res[i], res{Concatenation([1..i-1], [i+1..Length(res)])}, A);

if IsZero(r) then
Remove(res, i);
else
res[i] := r;
fi;

i := i-1;
od;

return res;
end
);


InstallMethod( TipReducedList,
"for a list of path-algebra elements",
[ IsList, IsPathAlgebra ],
function(els, A)
local res, el, i;

res := [];

for el in els do
if not IsZero(el) then
AddSet(res, el);
fi;
od;

i := Length(res);
while i > 0 do
if ForAny([1..i-1], j -> LeftmostOccurrence(TipWalk(res[i]), TipWalk(res[j])) <> fail) then
Remove(res, i);
fi;
i := i-1;
od;

return res;
end
);


InstallMethod( RemainderOfDivision,
"for a path-algebra element and a list of monic path-algebra elements",
"for a path-algebra element and a list of path-algebra elements",
[ IsElementOfMagmaRingModuloRelations, IsList, IsPathAlgebra ],
function(y, X, A)
local r, n, y_tip, y_wtip, divided, i, p, u, v;
Expand All @@ -75,7 +131,7 @@ InstallMethod( RemainderOfDivision,
u := Product(y_wtip{[1..p[1]-1]}, One(A));
v := Product(y_wtip{[p[2]+1..Length(y_wtip)]}, One(A));

y := y - TipCoefficient(y_tip) * u*X[i]*v;
y := y - TipCoefficient(y_tip)/TipCoefficient(X[i]) * u*X[i]*v;

divided := true;
break;
Expand Down

0 comments on commit 1afafbb

Please sign in to comment.