if (tuples.size()!=ts.size()) return new A4TupleSet(ts, sol); else return this;
}
/** Construct a new tupleset as the intersection of this and that; this and that must be come from the same solution. */
public A4TupleSet intersect(A4TupleSet that) throws ErrorAPI {
if (sol != that.sol) throw new ErrorAPI("A4TupleSet.intersect() requires 2 tuplesets from the same A4Solution.");
if (arity() != that.arity()) throw new ErrorAPI("A4TupleSet.intersect() requires 2 tuplesets with the same arity.");
if (this.tuples.size()==0) return this; // special short cut
if (that.tuples.size()==0) return that; // special short cut
TupleSet ts = tuples.clone();
ts.retainAll(that.tuples);
if (tuples.size()!=ts.size()) return new A4TupleSet(ts, sol); else return this;