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

WIP lib: add SetAsDomain #3460

Closed
wants to merge 2 commits into from
Closed

Conversation

ssiccha
Copy link
Contributor

@ssiccha ssiccha commented May 18, 2019

TODO

  • move new code into domain.g?
  • add tests!!
  • text for release notes

Description

Currently there is no filter that specifies explicitly that a domain is created as a set with no operational structure. This PR introduces the filter IsSetAsDomain. The motivation is to be able to use e.g. SetAsDomain([1..n]) as a domain for MappingByFunction:

gap> MappingByFunction(SetAsDomain([1..5]), SetAsDomain([1..5]), x -> x);
MappingByFunction( SetAsDomain([ 1 .. 5 ]), SetAsDomain([ 1 .. 5 ]), function( x ) ... end )
gap> Image(last);
[ 1, 2, 3, 4, 5 ]

One thing that is not entirely clear to me yet: As IsPermGroup already implies IsDomain, should it also imply IsSetAsDomain or not? I think it should. Methods for e.g. IsPermGroup would then outrank methods for IsSetAsDomain anyways.

@ssiccha ssiccha added kind: new feature topic: library kind: discussion discussions, questions, requests for comments, and so on do not review PRs which are not yet ready for a proper external review (e.g. only submitted for test results) release notes: to be added PRs introducing changes that should be (but have not yet been) mentioned in the release notes labels May 18, 2019
@ssiccha ssiccha requested a review from fingolfin May 18, 2019 13:20
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.003%) to 85.159% when pulling 069366b on ssiccha:ss/add-SetAsDomain into 7162a59 on gap-system:master.

ssiccha added 2 commits May 19, 2019 17:35
... GeneratorsOfDomain.

TODO Add synonym
Now: declare synonym

TODO
- move new code into domain.gd and .gi
- adjust installations to
- update doc
- also document this as a synonym?
- add tests!!
@ssiccha ssiccha force-pushed the ss/add-SetAsDomain branch from 069366b to 50af123 Compare May 19, 2019 15:37
@codecov
Copy link

codecov bot commented May 19, 2019

Codecov Report

Merging #3460 into master will decrease coverage by <.01%.
The diff coverage is 51.51%.

@@            Coverage Diff             @@
##           master    #3460      +/-   ##
==========================================
- Coverage   85.34%   85.33%   -0.01%     
==========================================
  Files         699      699              
  Lines      346471   346505      +34     
==========================================
+ Hits       295681   295699      +18     
- Misses      50790    50806      +16
Impacted Files Coverage Δ
lib/set.gd 100% <100%> (ø) ⬆️
lib/set.gi 61.37% <48.38%> (-3.23%) ⬇️

Copy link
Member

@fingolfin fingolfin left a comment

Choose a reason for hiding this comment

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

Something is wrong with this PR, with it it seems GAP cannot even start (looking at Travis logs here).

To be honest, I am not quite sure what the point of this is. In the end, all it seems to add is a print method, and only for domains who are defined on a GAP "set". But that does not seem to be very compelling to me. I can already do everything else in GAP right now, can't I?

gap> d:=Domain([1,2,3,1]);
<object>
gap> d!.GeneratorsOfDomain;
[ 1, 2, 3, 1 ]
gap> AsSet(d);
[ 1, 2, 3 ]
gap> 1 in d;
true
gap> 4 in d;
false


InstallMethod(\in,
"for an IsSetAsDomain",
[IsObject, IsSetAsDomain],
Copy link
Member

Choose a reason for hiding this comment

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

But IsSetAsDomain is merely a synonym for IsDomain; so now you really have installed a generic \in method for arbitrary domains, which tries to use AsList. That makes me a bit nervous, though I can't put my finger on it right now.

"for an IsSetAsDomain",
[IsSetAsDomain],
function( setAsDomain )
Print("SetAsDomain(", AsList(setAsDomain), ")");
Copy link
Member

Choose a reason for hiding this comment

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

Don't you need a different function for empty domains?

@ssiccha
Copy link
Contributor Author

ssiccha commented May 21, 2019

Oh sorry. This was a bit chaotic since I also had like 5 other PRs going on. I first thought I would introduce a new Category IsSetAsDomain. Then I decided against that and unfortunately left the PR in a broken state which doesn't make any sense.

Here are my current thoughts on what I actually want to do:
For constructing the normalisers of socles of primitive groups I want to use the IsMapping objects in GAP. If I define a mapping of "sets" in the current master though I get

gap> MappingByFunction(Domain([1..5]), Domain([1..5]), x -> x);
MappingByFunction( <object>, <object>, function( x ) ... end )

which I find very ugly. At the very least I want users to be able to see for a map that I defined what its domain and range are. So I think there are basically two options

  1. Install a PrintObj method for IsDomain and HasGeneratorsOfDomain
  2. Create a new category IsSetAsDomain which models that our domain is an actual set. After all a collection of families could also be turned into a domain and this is neither a set in the mathematical sense nor in the IsSSortedList sense.

While I'm not sure whether there are people who would find 2. useful I'm gonna go with 1. atm since that's also a lot less effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do not review PRs which are not yet ready for a proper external review (e.g. only submitted for test results) kind: discussion discussions, questions, requests for comments, and so on kind: new feature release notes: to be added PRs introducing changes that should be (but have not yet been) mentioned in the release notes topic: library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants