-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
322 feature request clone proverenvironment with stack #324
base: master
Are you sure you want to change the base?
Changes from 11 commits
e6c380c
d36cb96
8f86ab1
0dfb3e7
0fd372f
4881e3c
9193dd6
198e7b2
98303fb
e217830
f63ec0e
d614169
28cc2fb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,6 +65,18 @@ enum ProverOptions { | |
*/ | ||
ProverEnvironment newProverEnvironment(ProverOptions... options); | ||
|
||
/** | ||
* Create a new {@link ProverEnvironment} which encapsulates an assertion stack and can be used to | ||
* check formulas for unsatisfiability, but retains the current assertion stack of the given | ||
* {@link ProverEnvironment}. | ||
* | ||
* @param proverToCopy An existing {@link ProverEnvironment}, whichs assertion stack is to be | ||
* copied into the new one. | ||
* @param options Options specified for the prover environment. All the options specified in | ||
* {@link ProverOptions} are turned off by default. | ||
*/ | ||
ProverEnvironment copyProverEnvironment(ProverEnvironment proverToCopy, ProverOptions... options); | ||
|
||
/** | ||
* Create a fresh new {@link InterpolatingProverEnvironment} which encapsulates an assertion stack | ||
* and allows generating and retrieve interpolants for unsatisfiable formulas. If the SMT solver | ||
|
@@ -76,6 +88,22 @@ enum ProverOptions { | |
*/ | ||
InterpolatingProverEnvironment<?> newProverEnvironmentWithInterpolation(ProverOptions... options); | ||
|
||
/** | ||
* Create a fresh new {@link InterpolatingProverEnvironment} which encapsulates an assertion stack | ||
* and allows generating and retrieve interpolants for unsatisfiable formulas. The new {@link | ||
* ProverEnvironment} retains the current assertion stack of the given {@link ProverEnvironment}. | ||
* If the SMT solver is able to handle satisfiability tests with assumptions please consider | ||
* implementing the {@link InterpolatingProverEnvironment} interface, and return an Object of this | ||
* type here. | ||
* | ||
* @param proverToCopy An existing {@link ProverEnvironment}, whichs assertion stack is to be | ||
* copied into the new one. | ||
* @param options Options specified for the prover environment. All the options specified in | ||
* {@link ProverOptions} are turned off by default. | ||
*/ | ||
InterpolatingProverEnvironment<?> copyProverEnvironmentWithInterpolation( | ||
ProverEnvironment proverToCopy, ProverOptions... options); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Leaving the options open for the user might introduce problems, when it comes to featuers like unsat-core and interpolation, because we need to provide tokens/ids for all pushed assertions. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is there no copy-method for the OptimizationProver? The current API is incomplete. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It might be better to provide a copy-method/copy-constructor directly in the ProverEnvironment, because it knows best how to copy its content. The current naming scheme is quite verbous. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree with you on all things. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If Z3 requires permanent memory-tracking for the base-solver and does not allow closing it, then the copy-method is broken by design. Are you sure that there is no bug in using the copy-method? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think its permanent memory tracking for the base solver, i think the ghost references prevent garbage collection in case a old solver is closed. Hence why i save them in the context. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we copy a solver, I would assume that the new solver-instance increments all internal references on its own to avoid garbage-collection in case the old solver-instance is closed. I do not see a requirement for JavaSMT to keep track of the old solver-instance. |
||
|
||
/** | ||
* Create a fresh new {@link OptimizationProverEnvironment} which encapsulates an assertion stack | ||
* and allows solving optimization queries. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leaving the options open for the user might introduce problems, when it comes to featuers like unsat-core and interpolation, because we need to provide tokens/ids for all pushed assertions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you would suggest to always copy the options 1:1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the method should copy a stack and (as optimization) also the solver-internal data, then I would assume that the Prover requires identical options.
However, if we keep this open for the user and are able to copy all assertions directly onto another Prover, and limit the internal optimization to only the case of identical options, then we could cover more potential use-cases, e.g., if a user wants to enable unsat-cores or interpolants later. We need to specify this in the API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the options for now. We may want to test if it is possible to alter the options in copied provers first.