setstarttime(d_t); composemap:=lambda(m1,m2) mn:=emptyset; for i in m2 do additem(mn,item(m1,i)); endfor; mn; endlambda; samemap:=lambda(m1,m2) result:=true; for j in card(m1) do if not(equal(item(m1,j),item(m2,j))) then result:=false else noop endif endfor; result endlambda; alreadyinlist:=lambda(nmap) res:=false; for m in listofmaps do if samemap(nmap, m) then res:=true else noop endif endfor; res endlambda; indexofmap:=lambda(nmap) res:=-(0,1); for m in card(listofmaps) do if samemap(nmap, item(listofmaps,m)) then res:=m else noop endif endfor; res endlambda; nameofmap:=lambda(m) item(namesofmaps,indexofmap(m)) endlambda; string_n:=prompt("n for Dn"); if tonumber(n,string_n) then % listofmaps is the list of group elements as mappings, i.e. lists % listofmaps:=emptyset; namesofmaps:=emptyset; % templist is a temporary list which, helps creating the individual group elements % templist:=emptyset; for i in n do templist:=insertintolist(templist, 0, i) endfor; additem(listofmaps, templist); additem(namesofmaps, "a"); templist:=emptyset; for i in n do if >(i,0) then additem(templist, i) else noop endif endfor; additem(templist, 0); additem(listofmaps, templist); additem(namesofmaps, "b"); weiter:=true; while weiter do weiter:=false; for map1 in listofmaps do for map2 in listofmaps do newmap:=composemap(map1,map2); if not(alreadyinlist(newmap)) then additem(listofmaps,newmap); additem(namesofmaps, concat(nameofmap(map1),nameofmap(map2))); weiter:=true else noop endif; newmap:=composemap(map2,map1); if not(alreadyinlist(newmap)) then additem(listofmaps,newmap); additem(namesofmaps, concat(nameofmap(map2),nameofmap(map1))); weiter:=true else noop endif endfor; endfor; endwhile; writeln(listofmaps); writeln(namesofmaps); dn:=addstructure(concat("D",string_n)); for i in card(listofmaps) do addelement(dn, item(namesofmaps,i), *(+(i,1),20), *(+(i,1),20)) endfor; op:=addtooperations(dn,"*",2,1); for i1 in card(listofmaps) do for i2 in card(listofmaps) do setvalue(op, [item(dn,i1),item(dn,i2)], item(dn,indexofmap(composemap(item(listofmaps,i1), item(listofmaps,i2))))) endfor endfor else writeln("keine Zahl!"); endif; writeln(timeasstring(d_t));