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

problem with strictly sorted inhomogeneous lists #3398

Closed
ThomasBreuer opened this issue Apr 9, 2019 · 3 comments · Fixed by #3401
Closed

problem with strictly sorted inhomogeneous lists #3398

ThomasBreuer opened this issue Apr 9, 2019 · 3 comments · Fixed by #3401
Labels
kind: bug: unexpected error Issues describing bugs in which computation unexpectedly encounters an error, and PRs fixing them kind: bug Issues describing general bugs, and PRs fixing them regression A bug that only occurs in the branch, not in a release

Comments

@ThomasBreuer
Copy link
Contributor

The following happens in the current master branch as well as in some released versions of GAP.

gap> l:= [ 1, Z(2) ];;
gap> SetIsSSortedList( l, true );
Error, filter not possible for list (plain,dense,nhom)
not in any function at *stdin*:10
type 'quit;' to quit to outer loop
brk>

This is strange if one looks at the following.

gap> 1 < Z(2);
true
gap> l:= [ 1, Z(2) ];;
gap> HasIsSSortedList( l );
false
gap> IsSSortedList( l );
true
gap> HasIsSSortedList( l );
true

The second piece of code shows that GAP regards the list as strictly sorted,
and also stores the filter.

Here is a situation --in the master branch-- where one runs into trouble because of the error.
Note that Filtered assumes that its result is strictly sorted whenever the argument is strictly sorted, and wants to apply this knowledge.

gap> l:= [ 1, Z(2) ];;
gap> IsSSortedList( l );
true
gap> Filtered( l, IsObject );
Error, filter not possible for list (plain,dense,nhom) in
  SetIsSSortedList( res, true ); at .../gapmaster/gap/lib/coll.gi:1380 called from 
<function "Filtered">( <arguments> )
 called from read-eval loop at *stdin*:15
type 'quit;' to quit to outer loop
brk> 
@ThomasBreuer ThomasBreuer added kind: bug: unexpected error Issues describing bugs in which computation unexpectedly encounters an error, and PRs fixing them regression A bug that only occurs in the branch, not in a release labels Apr 9, 2019
@fingolfin fingolfin added the kind: bug Issues describing general bugs, and PRs fixing them label Apr 11, 2019
@fingolfin
Copy link
Member

This issue is already present in GAP 4.4.12, so I'd argue it was intentional. Of course we are free to revise this. But it's definitely not a recent regression.

@ChrisJefferson
Copy link
Contributor

I think (I'm guessing pre-history) there was a time when "Sets" were supposed to be homogeneous, but now we don't require that any more. Certainly I think #3401 fixes it, and doesn't cause (I think) other problems.

@ThomasBreuer
Copy link
Contributor Author

I do not understand @fingolfin 's comment.
It cannot be intentional that on the one hand, GAP can find out with IsSSortedList that a given list is sorted, and then store the filter, but on the other hand, GAP refused to set the filter via SetIsSSortedList.
Either inhomogeneous lists should never get the filter HasIsSSortedList, or SetIsSSortedList should be admissible for inhomogeneous lists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug: unexpected error Issues describing bugs in which computation unexpectedly encounters an error, and PRs fixing them kind: bug Issues describing general bugs, and PRs fixing them regression A bug that only occurs in the branch, not in a release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants