kodkod.engine.fol2sat
Class Translation

java.lang.Object
  extended by kodkod.engine.fol2sat.Translation

public final class Translation
extends java.lang.Object

Stores the translation of a kodkod formula to CNF.

Author:
Emina Torlak
specfield:
formula: Formula // the formula that was translated
bounds: Bounds // the bounds used to obtain the CNF from the formula
solver: SATSolver // a SATSolver containing the CNF representation of the formula
options: Options // the options object used to control translation parameters

Method Summary
 SATSolver cnf()
          Returns a SATSolver object initialized with the CNF encoding of this.formula and the timeout and random seed values specified by this.options.
 Instance interpret()
          If this.solver.solve() is true, returns an interpretation of the cnf solution as a mapping from Relations to sets of Tuples.
 TranslationLog log()
          If this.options.logTranslation was set to true, returns the log of the translation that produced this Translation object.
 int numPrimaryVariables()
          Returns the number of primary variables allocated during translation.
 IntSet primaryVariables(Relation relation)
          Returns the set of primary variable literals that represent the tuples in the given relation.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

cnf

public SATSolver cnf()
Returns a SATSolver object initialized with the CNF encoding of this.formula and the timeout and random seed values specified by this.options. Satisfiability of the formula can be checked by calling SATSolver.solve().

Returns:
{s: SATSolver | [[s.clauses]] = [[this.formula]] && s.timeout() = this.options.timeout() && s.seed() = this.options.seed() }

interpret

public Instance interpret()
If this.solver.solve() is true, returns an interpretation of the cnf solution as a mapping from Relations to sets of Tuples. The Relations mapped by the returned instance are either leaves of this.formula with different lower and upper bounds (i.e. {r: this.formula.*children & Relation | this.bounds.upperBound[r] != this.bounds.lowerBound[r]}), or skolem constants.

Returns:
an interpretation of the cnf solution as a mapping from (this.variableUsage().keySet() & Relation) to sets of Tuples.
Throws:
java.lang.IllegalStateException - - this.solver.solve() has not been called or the outcome of the last call was not true.

primaryVariables

public IntSet primaryVariables(Relation relation)
Returns the set of primary variable literals that represent the tuples in the given relation. If no literals were allocated to the given relation, null is returned.

Returns:
the set of primary variable literals that represent the tuples in the given relation.

numPrimaryVariables

public int numPrimaryVariables()
Returns the number of primary variables allocated during translation. Primary variables represent the tuples of Relations that are either leaves of this.formula with different lower and upper bounds (i.e. {r: this.formula.*children & Relation | this.bounds.upperBound[r] != this.bounds.lowerBound[r]}), or skolem constants.

Returns:
the number of primary variables allocated during translation.

log

public TranslationLog log()
If this.options.logTranslation was set to true, returns the log of the translation that produced this Translation object. Otherwise returns null.

Returns:
the log of the translation that produced this Translation object, if this.options.logTranslation was enabled during translation, or null if not.