Skip to content

Commit 1fa3b61

Browse files
author
Markus Pfeiffer
committed
Add VerifySolverAtPlace
1 parent 0a528f3 commit 1fa3b61

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

gap/walrus.gi

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@
3030
# - Make a reasonably standard format (and exporter/importer) to exchange
3131
# pregroup presentations so we can move them between GAP/other
3232
# implementations for cross-checking
33+
# - some names are unfortunate:
34+
#
35+
# PregroupPlace should be PregroupPresentationPlace
36+
# PregroupRelator should be PregroupPresentationRelator
37+
# generally I would like to implement proper pregroup presentations, defining
38+
# the "unive rsal group over a pregroup"
39+
# and then quotients of that, in the same way as quotients of free groups are implemented
3340

3441
#
3542
# TODO (mathematical/functional)
@@ -484,3 +491,62 @@ InstallMethod(IsHyperbolic, "for a pregroup presentation, and a rational number"
484491
[IsPregroupPresentation, IsRat],
485492
{pres, eps} -> RSymTest(pres,eps));
486493

494+
495+
InstallGlobalFunction("VerifySolverAtPlace",
496+
function(place)
497+
local n, L, places, psip, osrp, pp, i, pq, P, Q, Pq, np, chi;
498+
499+
places := Places(PregroupPresentationOf(place));
500+
501+
if not IsPregroupPlace(place) then
502+
Error("<place> has to be a PregroupPlace");
503+
fi;
504+
505+
n := Length(Relator(place));
506+
507+
if IsTerminal(place) then
508+
Error("Terminal place in VerifySolverAtPlace");
509+
elif Colour(place) = "green" then
510+
L := [(place, 0, 1, 3/4)];
511+
elif Colour(place) = "red" then
512+
L := [(place, 0, 0, 1)];
513+
for np in NextPlaces(place) do
514+
Add(L, [np, 1, 1, 1 + chi]);
515+
od;
516+
fi;
517+
518+
for i in [1..3] do
519+
for pq in L do
520+
521+
if pq[3] = i then
522+
P := pq[1];
523+
osrp := OneStepReachablePlaces(P);
524+
for Q in Keys(osrp) do
525+
psip := pq[4] + Q[2];
526+
527+
if pq[2] + Q[2] < n/2 and
528+
not IsTerminal(places[Q[1]]) and
529+
psip > 0 then
530+
pp := PositionProperty(L, x -> (x[1] = osrp[1])
531+
and (x[2] = Pq[2] + osrp[2]));
532+
if pp = fail then
533+
Add(L, Immutable([osrp[1], pq[2] + Q[2], i + 1, psip]) );
534+
else
535+
if L[pp][4] < psip then
536+
L[pp] := Immutable([osrp[1], Pq[2] + Q[2], i + 1, psip]);
537+
fi;
538+
fi;
539+
fi;
540+
541+
if pq[2] + Q[2] >= n/2 and
542+
IsTerminal(places[Q[1]]) and
543+
psip > 0 then
544+
return [fail, L];
545+
fi;
546+
od;
547+
fi;
548+
od;
549+
od;
550+
return true;
551+
end);
552+

0 commit comments

Comments
 (0)