`posets/text/ideals` := TEXT(
` `,
`FUNCTION:  ideals - list/count order ideals in a partially ordered set`,
` `,
`CALLING SEQUENCE:  ideals(P,<option>);`,
`                   ideals(P,n,<option>);`,
`                   ideals(P,X,<option>);`,
` `,
`PARAMETERS:  P    = a poset`,
`             X    = a set (the vertex set); or, a linear extension of P`,
`             n    = a positive integer (the number of vertices)`,
`         <option> = at most one of the following:`,
`            (1) a range, such as 2..7`,
`            (2) a variable name, such as q`,
`   `,
`SYNOPSIS:`,
`  Let P be a poset with vertex set X. An order ideal of P is a subset I`,
`  of X such that if x is in I and y < x in P, then y is in I.`,
`   `,
`  ideals(P,X) returns a list of all order ideals of P.`,
`  ideals(P,n) does the same, if the vertex set of P is {1,2,...,n}.`,
`  ideals(P) does the same, assuming that P has no isolated vertices.`,
`   `,
`  The ideals are listed in a lexicographic order with ideal I preceding`,
`  ideal J if J contains the "last" vertex of the symmetric difference of`,
`  I and J. Here, "last" is determined by some linear extension of P;`,
`  i.e., a linear ordering of the vertex set X such that if x < y in P,`,
`  then x precedes y in the linear ordering. So for example, all ideals`,
`  that contain the last vertex appear after all ideals that do not.`,
`   `,
`  In order to force the use of the lexordering induced by a particular`,
`  linear extension of P, the vertex set X may be specified as a list in`,
`  the desired order, rather than as a set.`,
`   `,
`  Optionally, if the last argument is a range a..b, then only those`,
`  order ideals whose sizes fit within this range are listed.`,
`   `,
`  Optionally, if the last argument is a name, such as q, then the result`,
`  is the generating series for order ideals; i.e., the sum of q^nops(I)`,
`  over all order ideals I of P.`,
`   `,
`  Note that ideals(P,X,q) is the rank generating function for J(P,X).`,
`   `,
`EXAMPLES:`,
`  ideals(chain(3));                 yields          [{},{1},{1,2},{1,2,3}]`,
`  ideals({},[a,b,c]);               yields`,
`                                [{},{a},{b},{a,b},{c},{a,c},{b,c},{a,b,c}]`,
`  ideals({[1,3],[2,3]},4,3..4);     yields     [{1,2,4},{1,2,3},{1,2,3,4}]`,
`  ideals({[1,3],[2,3]},[1,2,3,4],3..4);`,
`                                    yields     [{1,2,3},{1,2,4},{1,2,3,4}]`,
`  ideals(chain(2) &* chain(3),q);   yields   1+q+2*q^2+2*q^3+2*q^4+q^5+q^6`,
`   `,
`SEE ALSO:  antichains, extensions, J`,
NULL):

if `+`(0)=0 then # Maple V.4 or later
  print(INTERFACE_HELP(insert, topic=`posets/ideals`,
  helpfile=HomeLib, text=`posets/text/ideals`))
elif ceil(0)=0 then # Maple V.2 or V.3
  `help/posets/text/ideals`:=`posets/text/ideals`:
  save `help/posets/text/ideals`, cat(HomeLib,`/help/posets/text/ideals.m`)
fi:
