Class AlloySession
java.lang.Object
org.clafer.alloy.solve.AlloySession
An Alloy model in this JVM and its solutions: claferIG's
AlloyIG.java,
whose operations are the methods here rather than messages on a pipe. A
solution is Alloy's XML of it, as AlloyIG sends it.
The model is parsed from its text, in memory. The solutions of a dynamic
model, a trace each, are solved for one by one, without the traces given so
far (next()); fork(int) and nextConfiguration() give
other traces, and check(String) the counterexample of an assertion. The
unsat core of the model comes from the minisat prover, claferIG's fixed
one (FixedMiniSatProver).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordThe sigs of the model and the global scope of its command.static final recordA sig of the model, asloadsends it. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncheck: the counterexample of the assertion with the given label, at the scopes and the trace length of the model, if any.fork(int forkState) fork: a trace with the same states as the trace shown last before the given state, which differs from the traces given so far.booleanload: parses the model.next()next: the next solution, if any.nextConfiguration: a trace whose relations that do not change over time differ from those of the traces given so far, or an instance of a static model whose structure differs from those of the instances given so far.voidremoveConstraint(int y, int x, int y2, int x2) removeConstraint: the constraint at the span, as the unsat core gives it (the second column one more than Alloy's).voidresolve()resolve: solves the command again, from its first solution.voidrestoreState.voidsaveState: to generate counterexamples, the model is mutated; its state is saved first and restored once completed.voidsetBitwidth(int bitwidth) setBitwidth.voidsetGlobalScope(int scopeSize) setGlobalScope.voidsetMaxTraceLength(int maxTraceLength) setMaxTraceLength.voidsetScope: the scope of the sig with the given label.voidsetUnsatCoreMinimization(int level) unsatCoreMinimization: 0 (best), 1 or 2 (fastest).List<int[]> unsatCore: the spans of the constraints of the unsat core of the model, each as {line, column, line, column + 1}, or none.
-
Constructor Details
-
AlloySession
public AlloySession()
-
-
Method Details
-
load
load: parses the model.- Throws:
edu.mit.csail.sdg.alloy4.Err- the errors of the model
-
isDynamic
- Returns:
- whether the model has mutable sigs or fields: its solutions are traces
-
resolve
resolve: solves the command again, from its first solution.- Throws:
edu.mit.csail.sdg.alloy4.Err
-
next
-
fork
-
nextConfiguration
nextConfiguration: a trace whose relations that do not change over time differ from those of the traces given so far, or an instance of a static model whose structure differs from those of the instances given so far.- Throws:
edu.mit.csail.sdg.alloy4.Err
-
check
check: the counterexample of the assertion with the given label, at the scopes and the trace length of the model, if any. It has no unsat core. The solutions of the model stay as they are.- Throws:
edu.mit.csail.sdg.alloy4.Err
-
setGlobalScope
setGlobalScope. -
setScope
-
setBitwidth
setBitwidth. -
setMaxTraceLength
setMaxTraceLength. -
setUnsatCoreMinimization
unsatCoreMinimization: 0 (best), 1 or 2 (fastest). -
saveState
saveState: to generate counterexamples, the model is mutated; its state is saved first and restored once completed. -
restoreState
restoreState. -
removeConstraint
removeConstraint: the constraint at the span, as the unsat core gives it (the second column one more than Alloy's).- Throws:
IllegalStateException- if there is no constraint at the span
-
unsatCore
unsatCore: the spans of the constraints of the unsat core of the model, each as {line, column, line, column + 1}, or none. Only the model has an unsat core: not the next solution, when the solutions of the model run out. Alloy reports no minimized core when it finds the model unsatisfiable without solving, e.g.,[ some b ]and[ no b ], so the core is not checked by its size.
-