{"action":"created","issue":{"url":"https://api.github.com/repos/gap-system/gap/issues/2234","repository_url":"https://api.github.com/repos/gap-system/gap","labels_url":"https://api.github.com/repos/gap-system/gap/issues/2234/labels{/name}","comments_url":"https://api.github.com/repos/gap-system/gap/issues/2234/comments","events_url":"https://api.github.com/repos/gap-system/gap/issues/2234/events","html_url":"https://github.com/gap-system/gap/issues/2234","id":301895266,"number":2234,"title":"Incorrect result from Union","user":{"login":"sylvie-ln","id":30486146,"avatar_url":"https://avatars3.githubusercontent.com/u/30486146?v=4","gravatar_id":"","url":"https://api.github.com/users/sylvie-ln","html_url":"https://github.com/sylvie-ln","followers_url":"https://api.github.com/users/sylvie-ln/followers","following_url":"https://api.github.com/users/sylvie-ln/following{/other_user}","gists_url":"https://api.github.com/users/sylvie-ln/gists{/gist_id}","starred_url":"https://api.github.com/users/sylvie-ln/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sylvie-ln/subscriptions","organizations_url":"https://api.github.com/users/sylvie-ln/orgs","repos_url":"https://api.github.com/users/sylvie-ln/repos","events_url":"https://api.github.com/users/sylvie-ln/events{/privacy}","received_events_url":"https://api.github.com/users/sylvie-ln/received_events","type":"User","site_admin":false},"labels":[{"id":180442294,"url":"https://api.github.com/repos/gap-system/gap/labels/bug","name":"bug","color":"e11d21","default":true},{"id":180442295,"url":"https://api.github.com/repos/gap-system/gap/labels/duplicate","name":"duplicate","color":"e6e6e6","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-03-02T20:30:19Z","updated_at":"2018-03-05T09:19:58Z","closed_at":"2018-03-05T09:19:58Z","author_association":"NONE","body":"Hello,\r\nI am getting strange behaviour from Union. The error may be related to the Automata package. I am using Gap 4.8.10 on Windows 10.\r\n\r\n### Observed behaviour\r\nApplying Union to a list constructed from the transition matrix of an certain automaton produces an incorrect result. Copying and pasting the same list directly into Union produces the correct result.\r\n\r\n```\r\ngap> List([1..9],q->TransitionMatrixOfAutomaton(A)[3][q]);\r\n[ [ 8 ], [ 2 ], [ 4 ], [ 1 ], [ 6 ], [ 7, 8 ], [ 3, 8 ], [ 5, 8 ], [ 8 ] ]\r\ngap> Union(last);\r\n[ 1, 2 ]\r\ngap> Union([ [ 8 ], [ 2 ], [ 4 ], [ 1 ], [ 6 ], [ 7, 8 ], [ 3, 8 ], [ 5, 8 ], [ 8 ] ]);\r\n[ 1, 2, 3, 4, 5, 6, 7, 8 ]\r\ngap>\r\n```\r\n\r\n**Update:**\r\nI can reproduce the incorrect behaviour without loading the Automata package, as follows:\r\n```\r\ngap> Union([[4],[1],[6],[7,8..8],[3,8..8],[5,8..8]]);\r\n[ 1 ]\r\n```\r\nMaybe it is related to the strange use of range syntax in the lists [7,8..8], [3,8..8], [5,8..8]. This strange syntax also appears in the automaton A whose construction is described below.\r\n\r\n### Expected behaviour\r\nIn the above snippet, Union(last) and Union([ [ 8 ], [ 2 ], [ 4 ], [ 1 ], [ 6 ], [ 7, 8 ], [ 3, 8 ], [ 5, 8 ], [ 8 ] ]) should produce the same result.\r\n\r\nHere is how the automaton A is constructed, in case it is relevant:\r\n```\r\ngap> LoadPackage(\"automata\");\r\n----------------------------------------------------------------\r\nLoading  Automata 1.13\r\nFor help, type: ?Automata:\r\n----------------------------------------------------------------\r\ntrue\r\ngap> StarOperation := function(A)\r\n>  local S,n,a,t,T,i,I,N,f,F;\r\n>  n:=NumberStatesOfAutomaton(A);\r\n>  a:=AlphabetOfAutomaton(A);\r\n>  T:=StructuralCopy(TransitionMatrixOfAutomaton(A));\r\n>  I:=InitialStatesOfAutomaton(A);\r\n>  F:=FinalStatesOfAutomaton(A);\r\n>  for i in [1..a] do\r\n>   t:=T[i];\r\n>   N:=List(I,q->T[i][q]);\r\n>   Add(t,N);\r\n>   for f in F do\r\n>    if not IsList(T[i][f]) then\r\n>     T[i][f] := [T[i][f]];\r\n>    fi;\r\n>    T[i][f] := Union(T[i][f],N);\r\n>   od;\r\n>  od;\r\n>  S:=Automaton(\"nondet\",n+1,a,T,[n+1],Concatenation(F,[n+1]));\r\n>  return S;\r\n> end;\r\nfunction( A ) ... end\r\ngap> n:=8;; k:=3;;\r\ngap> A:=StarOperation(Automaton(\"det\",n,3,[Concatenation([2..n],[1]),Concatenation([1],[3..n],[2]),Concatenation([n,2],[4 .. n-4],[1],[n-2,n-1,3],[n-3])],[1],[n-k+1..n]));;\r\n```\r\n\r\n### Copy and paste GAP banner (to tell us about your setup)\r\n```\r\n ┌───────┐   GAP 4.8.10, 15-Jan-2018, build of 2018-01-15 14:36:25 (GMTST)\r\n │  GAP  │   https://www.gap-system.org\r\n └───────┘   Architecture: i686-pc-cygwin-gcc-default32\r\n Libs used:  gmp, readline\r\n Loading the library and packages ...\r\n Components: trans 1.0, prim 2.1, small* 1.0, id* 1.0\r\n Packages:   AClib 1.2, Alnuth 3.1.0, AtlasRep 1.5.1, AutPGrp 1.8, Browse 1.8.7, CRISP 1.4.4, Cryst 4.1.13,\r\n             CrystCat 1.1.6, CTblLib 1.2.2, FactInt 1.6.0, FGA 1.3.1, GAPDoc 1.6.1, IO 4.5.1, IRREDSOL 1.4,\r\n             LAGUNA 3.8.0, Polenta 1.3.8, Polycyclic 2.11, RadiRoot 2.7, ResClasses 4.7.1, Sophus 1.23, SpinSym 1.5,\r\n             TomLib 1.2.6, utils 0.49\r\n Try '??help' for help. See also '?copyright', '?cite' and '?authors'\r\n```"},"comment":{"url":"https://api.github.com/repos/gap-system/gap/issues/comments/370356819","html_url":"https://github.com/gap-system/gap/issues/2234#issuecomment-370356819","issue_url":"https://api.github.com/repos/gap-system/gap/issues/2234","id":370356819,"user":{"login":"fingolfin","id":241512,"avatar_url":"https://avatars2.githubusercontent.com/u/241512?v=4","gravatar_id":"","url":"https://api.github.com/users/fingolfin","html_url":"https://github.com/fingolfin","followers_url":"https://api.github.com/users/fingolfin/followers","following_url":"https://api.github.com/users/fingolfin/following{/other_user}","gists_url":"https://api.github.com/users/fingolfin/gists{/gist_id}","starred_url":"https://api.github.com/users/fingolfin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fingolfin/subscriptions","organizations_url":"https://api.github.com/users/fingolfin/orgs","repos_url":"https://api.github.com/users/fingolfin/repos","events_url":"https://api.github.com/users/fingolfin/events{/privacy}","received_events_url":"https://api.github.com/users/fingolfin/received_events","type":"User","site_admin":false},"created_at":"2018-03-05T09:19:58Z","updated_at":"2018-03-05T09:19:58Z","author_association":"OWNER","body":"@sylvie-ln no worries, nothing to be sorry about; I wouldn't expect anybody to find that duplicate (and even if: it's not that clear that it is really a duplicate). I merely pointed it out for context. Anyway, I am glad that GAP 4.9 solves the issue for you. Please do not hesitate to report further issues as you encounter them, an don't worry too much about duplicates (though of course it's always a good idea to search through open and closed issues first, but again, don't worry too much about that :-)"}}
{"actor":{"display_login":"fingolfin"}}