Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

semifp: Add a method for IsomorphismFpSemigroup #426

Merged
merged 2 commits into from
Jan 17, 2018

Conversation

ChristopherRussell
Copy link
Collaborator

This method applies to factorizable inverse monoids of partial perms. Method is
based on the paper Presentations of Factorizable Inverse Monoids by D. Easdown,
J. East, and D. G. FitzGerald (2004).

@ChristopherRussell
Copy link
Collaborator Author

ChristopherRussell commented Dec 15, 2017

I'm not sure if I have done lines 632 - 640 of semifp.gi in the best way. Also BruteForceInverseCheck typically (for example, on my tests) takes much longer than BruteForceIsoCheck - does this say that the way I have created the function inv is ineffective?

MF := F / rels; # FpSemigroup which is isomorphic to M, with different gens.
fam := ElementsFamily(FamilyObj(MF));
T := Semigroup(Concatenation(SS, GG)); # M with isomorphic generators to MF

map := x -> ElementOfFpSemigroup(fam, EvaluateWord(GeneratorsOfSemigroup(F),
                                                   Factorization(T, x)));
inv := x -> EvaluateWord(GeneratorsOfSemigroup(T),
        SEMIGROUPS.ExtRepObjToWord(ExtRepOfObj(x)));

  return MagmaIsomorphismByFunctionsNC(M, MF, map, inv);
end);

@ChristopherRussell
Copy link
Collaborator Author

ChristopherRussell commented Dec 15, 2017

@james-d-mitchell I'm not sure why the travis tests are failing. The issues seem unrelated to the new code in this PR.

@james-d-mitchell
Copy link
Collaborator

Hmm, @ChristopherRussell I'm not so sure, do the test all pass on your computer?

@james-d-mitchell james-d-mitchell added 3.0 new-feature A label for PRs that contain new features labels Dec 18, 2017
@wilfwilson
Copy link
Collaborator

@ChristopherRussell if you rebase on the most recent master branch, the diffs should disappear.

@ChristopherRussell
Copy link
Collaborator Author

Thanks @wilfwilson!

@ChristopherRussell
Copy link
Collaborator Author

ChristopherRussell commented Dec 21, 2017

I have fixed some of the issues in sempfp.tst (made a fix to IsomorphismFpMonoid and stopped calling BrandtSemigroup which is not yet in stable-3.0).

@james-d-mitchell I can't reproduce the remaining errors in the failed travis test, which only occur in one of the builds, and I was hoping you could help.

Also I am am going to write a function EvaluateExtRep to save converting ExtReps to words then using EvaluateWord. The function would look something like this:

InstallMethod(EvaluateExtRep,
"for a multiplicative element collection and a list of positive ints of even length",
[IsMultiplicativeElementCollection, IsList],
function(gens, w)
  local res, i;
    if Length(w) = 0 then
      return One(gens); # need to account for semigroup not being a moniod?
    elif Length(w) mod 2 = 1 then
      ErrorNoReturn("Semigroups: EvaluateExtRep, the second argument must be ",
                     "a list of even length");
    fi;
    res := gens[AbsInt(w[1])] ^ w[2];
    for i in [3, 5 .. Length(w) - 1] do
      res := res * gens[AbsInt(w[i])] ^ w[i + 1];
    od;
    return res;
end);

We also noticed that EvaluateWord has several implementations in semigroups/gap/main/orbits.gi and you asked me to remind you that these should perhaps be replaced by a single method with filter IsMultiplicativeElementColl. The three methods in orbits.gi are:

InstallMethod(EvaluateWord, "for bipartition coll and list of integers",
[IsBipartitionCollection, IsList],
function(gens, w)
    local i, res;
    if Length(w) = 0  then
      return One(gens);
    fi;
    res := gens[AbsInt(w[1])] ^ SignInt(w[1]);
    for i in [2 .. Length(w)]  do
      res := res * gens[AbsInt(w[i])] ^ SignInt(w[i]);
    od;
    return res;
end);

InstallMethod(EvaluateWord, "for partial perm coll and list of integers",
[IsPartialPermCollection, IsList],
function(gens, w)
    local i, res;
    if Length(w) = 0  then
      return One(gens);
    fi;
    res := gens[AbsInt(w[1])] ^ SignInt(w[1]);
    for i  in [2 .. Length(w)]  do
      res := res * gens[AbsInt(w[i])] ^ SignInt(w[i]);
    od;
    return res;
end);

InstallMethod(EvaluateWord,
"for Rees 0-matrix semigroup element collection and a list of positive ints",
[IsReesZeroMatrixSemigroupElementCollection, IsList],
function(gens, w)
    local i, res;
    if Length(w) = 0  then
      return SEMIGROUPS.UniversalFakeOne;
    fi;
    res := gens[w[1]];
    for i in [2 .. Length(w)]  do
      res := res * gens[w[i]];
    od;
    return res;
end);

@james-d-mitchell
Copy link
Collaborator

@ChristopherRussell Maybe the failure here is related to Issue #435? I also can't reproduce this, on my computer. Can you rebase on the top of stable-3.0 (which now contains some changes not present when travis ran) and see if the tests pass?

@james-d-mitchell
Copy link
Collaborator

Also I like your suggestion for EvaluateExtRep, I'd call it EvaluateExtRepObjWord or similar though. I'd handle the case of monoid separately (i.e. in another method), with the filter being IsMultiplicativeElementWithOneCollection and in the version for IsMultplicativeElementCollection I'd just not allow the case of words of length 0 (error).

Also I like the suggestion about combining the methods for EvaluateWord, I'd be tempted to have two methods again one for IsMultiplicativeElementCollection and another for IsMultiplicativeElementWithOneCollection they can both use the method for bipartitions.

This method applies to factorizable inverse monoids of partial perms. Method is
based on the paper Presentations of Factorizable Inverse Monoids by D. Easdown,
J. East, and D. G. FitzGerald (2004).
@ChristopherRussell
Copy link
Collaborator Author

I will make the EvaluateExtRepObjWord and EvaluateWord changes with PR #443

@james-d-mitchell
Copy link
Collaborator

This looks good. Here are a couple of minor points:

  1. You mention a bug in factorisation in a comment, what's this bug can you file and issue?
  2. Can you add an extreme test together with a comment that your method is quicker than the default one in that case?
  3. Can you please reference the paper as a comment before the method?

Copy link
Collaborator

@james-d-mitchell james-d-mitchell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good other than the minor comments I've made.

list[i] := list[i] + s;
od;
return list;
end;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't this whole method just be list{[1, 3 .. Length(list) - 1]} := list{[1, 3 .. Length(list) - 1]} + s?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, changed.

end;

# FIXME: this shouldn't be necessary but for an error with
# MinimalFactorization
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please file an issue for this error, or is this already resolved?

Copy link
Collaborator Author

@ChristopherRussell ChristopherRussell Jan 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't remember the issue now. It was something we noticed when writing code together and it hasn't been resolved. However I am not sure if it was a bug or just that the format of the output didn't suit our purposes (e.g. due to how it dealt with inverses or the identity when factorizing).

My tests still pass when I remove the rec(acting := false) so that didn't give any hints.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha, then this was fixed, it was Issue #424. Please remove the comment.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah okay, great.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also remove the unnecessary code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, sorry. Done it now.

map := InverseGeneralMapping(IsomorphismPermGroup(G));
H := Source(map);
o := Enumerate(LambdaOrb(M));
#R_tilde
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have a line/page reference in the paper for this?

map := x -> ElementOfFpSemigroup(fam, EvaluateWord(GeneratorsOfSemigroup(F),
Factorization(T, x)));
inv := x -> EvaluateWord(GeneratorsOfSemigroup(T),
SEMIGROUPS.ExtRepObjToWord(ExtRepOfObj(x)));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be indented so that it is aligned with the ( in (GeneratorsOf...

@james-d-mitchell james-d-mitchell merged commit 0bb1e13 into semigroups:stable-3.0 Jan 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-feature A label for PRs that contain new features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants