* of one of the ArrayTrace constructors.
* @return trace
*/
private int[][] format(int[][] trace) {
final int length = trace.length;
final IntSet resolvents = new IntBitSet(length);
final int offset = numberOfVariables() + 1;
for(int i = 0; i < length; i++) {
int[] clause = trace[i];
if (clause!=null && clause[0]>=offset) {
clause[0] -= offset;
resolvents.add(i);
}
}
final int axioms = length - resolvents.size();
if (resolvents.min()<axioms) {
final int[] position = new int[length];
for(int i = 0, axiomIndex = 0, resolventIndex = axioms; i < length; i++) {
if (resolvents.contains(i)) {
position[i] = resolventIndex++;
int[] resolvent = trace[i];
for(int j = 0, resLength = resolvent.length; j < resLength; j++) {
resolvent[j] = position[resolvent[j]];
}
} else {
position[i] = axiomIndex++;
}
}
for(IntIterator itr = resolvents.iterator(length, 0); itr.hasNext(); ) {
int i = itr.next();
int pos = position[i];
if (i==pos) continue; // correctly positioned, do nothing
int[] resolvent = trace[i];
System.arraycopy(trace, i+1, trace, i, pos-i);