#
# Given a permutation group pg, expressed as a list or set of sets of
# equations defining substitutions that generate the group, determine
# the orbit of a point i under the action of this group. 
#
`posets/orbit`:=proc(pg,i) local orb,n,pi;
  orb:={i}; n:=0;
  while nops(orb)>n do n:=nops(orb);
    orb:={op(orb),seq(op(subs(pi,orb)),pi=pg)}
  od; orb
end:
#
save `posets/orbit`, cat(HomeLib,`/posets/orbit.m`);
quit;

