kodkod.engine.satlab
Interface ResolutionTrace

All Superinterfaces:
java.lang.Iterable<Clause>

public interface ResolutionTrace
extends java.lang.Iterable<Clause>

A proof of unsatisfiability generated by a SATProver. Formally, a resolution trace is a sequence of inferences made by a prover that ends in a conflict (empty clause). An element in a resolution trace is called a clause. There are two kinds of clauses in the trace: axioms and resolvents. Axioms are the clauses given to the prover via the SATSolver.addClause(int[]) method, and resolvents are the clauses derived by the prover from axioms or previously learned resolvents through resolution.

Clauses in a resolution trace are ordered as follows. The first |A| elements in the trace correspond to the axioms given to the prover (i.e. prover.clauses). An axiom a1 precedes an axiom a2 in the trace if and only if a1 was added to the prover before a2. (An axiom is "added" to the prover, and appears in the trace, if and only if the corresponding call to SATSolver.addClause(int[])) returned true.) The remaining elements in the trace are the resolvents. A resolvent r succeeds all of the resolvents needed for its derivation (i.e. all resolvents reachable from r via the Clause.antecedents() relation). The last element in the trace is the conflict resolvent. The axioms that are reachable from the conflict form the unsatisfiable core of the trace.

Author:
Emina Torlak
invariant:
#elts = #(prover.clauses + prover.resolvents)
elts[[0..#prover.clauses)].literals = prover.clauses
elts[[#prover.clauses..#elts)].literals = prover.resolvents
all i: [0..#prover.clauses) | no elts[i].antecedents
all i: [#prover.clauses..#elts) | all ante: elts[i].antecedents[int] | elts.ante < i
no conflict.literals
specfield:
prover: SATProver
elts: Clause[]
conflict: elts[#elts-1]

Method Summary
 IntSet axioms()
          Returns the indices of the axioms in this trace.
 IntSet backwardReachable(IntSet indices)
          Returns the indices of all clauses reachable from the clauses at the given indices by following the transpose of the antecedent relation zero or more times.
 IntSet core()
          Returns the indices of the axioms that form the unsatisfiable core of this trace.
 Clause get(int index)
          Returns the clause at the given index.
 java.util.Iterator<Clause> iterator()
          Returns an iterator over the elements in this trace in proper sequence.
 java.util.Iterator<Clause> iterator(IntSet indices)
          Returns an iterator over the elements at the given indices in this trace, in proper sequence.
 IntSet reachable(IntSet indices)
          Returns the indices of all clauses reachable from the clauses at the given indices by following the antecedent relation zero or more times.
 IntSet resolvents()
          Returns the indices of the resolvents in this trace.
 java.util.Iterator<Clause> reverseIterator(IntSet indices)
          Returns an iterator over the elements at the given indices in this trace, in the reverse order of indices.
 int size()
          Returns the length of this trace.
 

Method Detail

size

int size()
Returns the length of this trace.

Returns:
#this.elts

iterator

java.util.Iterator<Clause> iterator()
Returns an iterator over the elements in this trace in proper sequence.

Note:The clause objects returned by the iterator are not required to be immutable. In particular, the state of a clause object returned by next() (as well as the state of any object obtained through that clause's Clause.antecedents() method) is guaranteed to remain the same only until the subsequent call to the next() method of the iterator instance.

Specified by:
iterator in interface java.lang.Iterable<Clause>
Returns:
an iterator over the elements in this trace in proper sequence.

iterator

java.util.Iterator<Clause> iterator(IntSet indices)
Returns an iterator over the elements at the given indices in this trace, in proper sequence.

Note:The clause objects returned by the iterator are not required to be immutable. In particular, the state of a clause object returned by next() (as well as the state of any object obtained through that clause's Clause.antecedents() method) is guaranteed to remain the same only until the subsequent call to the next() method of the iterator instance.

Returns:
an iterator over the elements at the given indices in this trace, in proper sequence.
Throws:
java.lang.IndexOutOfBoundsException - - indices.min() < 0 || indices.max() >= this.size()
requires:
indices.min() >= 0 && indices.max() < this.size()

reverseIterator

java.util.Iterator<Clause> reverseIterator(IntSet indices)
Returns an iterator over the elements at the given indices in this trace, in the reverse order of indices.

Note:The clause objects returned by the iterator are not required to be immutable. In particular, the state of a clause object returned by next() (as well as the state of any object obtained through that clause's Clause.antecedents() method) is guaranteed to remain the same only until the subsequent call to the next() method of the iterator instance.

Returns:
an iterator over the elements at the given indices in this trace, in the reverse order of indices.
Throws:
java.lang.IndexOutOfBoundsException - - indices.min() < 0 || indices.max() >= this.size()
requires:
indices.min() >= 0 && indices.max() < this.size()

core

IntSet core()
Returns the indices of the axioms that form the unsatisfiable core of this trace.

Returns:
{ i: int | no this.elts[i].antecedents and this.elts[i] in this.conflict.^antecedents }

axioms

IntSet axioms()
Returns the indices of the axioms in this trace.

Returns:
{ i: int | this.elts[i] in this.prover.clauses }

resolvents

IntSet resolvents()
Returns the indices of the resolvents in this trace.

Returns:
{ i: int | this.elts[i] in this.prover.resolvents }

reachable

IntSet reachable(IntSet indices)
Returns the indices of all clauses reachable from the clauses at the given indices by following the antecedent relation zero or more times.

Returns:
{ i: int | this.elts[i] in this.elts[indices].*antecedents }
Throws:
java.lang.IllegalArgumentException - - indices.min() < 0 || indices.max() >= this.size()
requires:
indices.min() >= 0 && indices.max() < this.size()

backwardReachable

IntSet backwardReachable(IntSet indices)
Returns the indices of all clauses reachable from the clauses at the given indices by following the transpose of the antecedent relation zero or more times.

Returns:
{ i: int | this.elts[i] in this.elts[indices].*~antecedents }
Throws:
java.lang.IllegalArgumentException - - indices.min() < 0 || indices.max() >= this.size()
requires:
indices.min() >= 0 && indices.max() < this.size()

get

Clause get(int index)
Returns the clause at the given index. Note that this method is not required to always return the same Clause object; it is only required to return Clause objects that are equal according to their equals methods. The Clause objects returned by this method are guaranteed to be immutable.

Returns:
this.elts[index]
Throws:
java.lang.IndexOutOfBoundsException - - 0 < index || index >= this.size()
requires:
0 <= index < this.size()