return k2pos(((Relation)next).totalOrder((Relation)elem, (Relation)first, lst), x);
}
Formula f1 = elem.in(first.join(next.reflexiveClosure())); // every element is in the total order
Formula f2 = next.join(first).no(); // first element has no predecessor
Variable e = Variable.unary("");
Formula f3 = e.eq(first).or(next.join(e).one()); // each element (except the first) has one predecessor
Formula f4 = e.eq(elem.difference(next.join(elem))).or(e.join(next).one()); // each element (except the last) has one successor
Formula f5 = e.in(e.join(next.closure())).not(); // there are no cycles
return k2pos(f3.and(f4).and(f5).forAll(e.oneOf(elem)).and(f1).and(f2), x);
}
// This says no(a&b) and no((a+b)&c) and no((a+b+c)&d)...