Commit graph

67 commits

Author SHA1 Message Date
Guillaume Bury
8076c06047 [bugfix] Eliminate duplicates in input clauses
When adding clauses that conatins duplicates, the checking
of some proof would fail because there would sometime be multiple
littrals to resolve over. This fixes that problem.
2017-02-15 13:04:54 +01:00
Guillaume Bury
8acf02cb74 [bugfix] subterm insertion in forgetful propagation 2017-01-29 13:38:00 +01:00
Guillaume Bury
44509c6f8d [bugfix] conflict in forgetful propagation 2017-01-27 17:56:47 +01:00
Guillaume Bury
928622b511 [feature] New functions new_lit and new_atom 2017-01-24 11:12:17 +01:00
Guillaume Bury
1f5b5fc422 Renamed new_atom -> create_atom 2017-01-24 11:12:17 +01:00
Guillaume Bury
ea2c905644 Add forgetful propagation 2017-01-17 13:16:00 +01:00
Guillaume Bury
e8e619f3c7 Do not decide on unused variables 2017-01-17 12:29:39 +01:00
Guillaume Bury
b5d816fbac Typo in doc 2017-01-17 12:26:12 +01:00
Guillaume Bury
f80c3b3df7 [bugfix] Allow semantic propagation of already true lits 2016-12-19 15:58:48 +01:00
Guillaume Bury
2e7e947b62 Allow level 0 semantic propagations 2016-11-25 15:16:10 +01:00
Guillaume Bury
64694b524d [breaking] Ceaner interface for mcsat propagations 2016-11-25 12:07:23 +01:00
Simon Cruanes
6be7e7c71a rename a Vec function
`grow_to_by_double` becomes `grow_to_at_least` so that it doesn't
specify its own implementation's strategy
2016-11-24 14:12:32 +01:00
Guillaume Bury
c64a94c2aa Updated some logging levels 2016-11-22 18:42:56 +01:00
Guillaume Bury
3124d55209 [bugfix?] Avoid forgetting theory conflict clauses
When theory raises a conflict, it is analysed, and the backtracck clause
that result is added to the solver, however, I didn't find yet a
satisfying answer as to wether the original clause is implied (or not)
by this backtrack clause, so in order not to lose information, we also
add the original conflict clause when it comes from the theory (because
if not, then it comes from a conflict detected during propgation, so the
conflict clause is actually already attached).
2016-11-22 17:04:18 +01:00
Guillaume Bury
9a6d07e097 [bugfix] Do not forget conflict at level 0
In add_clause, a conflcit at level 0 raised Unsat, but was forgotten,
which is obviously incorrect as succesive solving of the same problem
would yield different results.
2016-11-22 16:53:47 +01:00
Guillaume Bury
e3d8513286 [bugfix] late propagations need to be re-propagated
Indeed, the previous strategy was that late propagations didn't need to
be propagated since they already have been, however that may not be the
case as a conflict might arise during propagation. It manifested as a
bug when the conflict did *not* depend on local hyps, and was tragically
lost during popping.
2016-11-22 16:43:49 +01:00
Guillaume Bury
03dd2f9e38 Removed some commented code 2016-11-17 16:12:34 +01:00
Guillaume Bury
6c0148016d Merge branch 'wip-analyze' 2016-11-17 16:11:18 +01:00
Guillaume Bury
e7b22b9c3e Merge branch 'wip-basic-smt' 2016-11-17 15:22:28 +01:00
Guillaume Bury
b4d62d6f3b [breaking] Changed if_sat interface
In Plugin, and Theory, if_sat function now has the same type as assume
Additionally, some insertions into the heap have been moved to avoid
some unnecessary operations.
2016-11-16 17:33:10 +01:00
Guillaume Bury
3af700bbd0 [bugfix] Better fix for propagation at level 0
Previously a fix was introduced to mitigate the fact that some atoms
couldn't be propagated at level 0 because of local assumptions. However
that fix didn't take into account propagation that implicated the
already propagated atom: for instance consider an atom [a] propagted at
level 1 because of some local hyp, and then atoms [b] propagated at
level 1 because [a] is true in a clause [C = not a \/ b]. If we propagte
0 and modify its level in-place as done in the previous fix, then we
should also propagate [b] at level 0, which is hard. Instead of
modifying levels in place, we simply store unit clauses at level 0 in a
stack, which we transfer to the clauses to add when we pop local hyps.
2016-11-09 14:27:50 +01:00
Guillaume Bury
443a3b0731 [bugfix] Attempt at fixing enqueue bug
When we enqueue an atom at level 0, we expect it to stay unconditionally
true whatever happens. However, if it happens that the atom is alrady
true at a level strictly greater than 0 (but lower than base_level),
then enqueue_bool would simply do nothing. To fix this, there is a new
function enqueue_root which modifies in place the level and reason of
the propagated atom if it is already true.
Additionally, enqueue_bool now requires that the atom be undecided,
since if it not (i.e if it is propagated while already decided) it is
most likely a bug.
2016-11-09 00:24:41 +01:00
Guillaume Bury
d681e247ed Added some debug logging 2016-11-04 12:19:43 +01:00
Guillaume Bury
d5d7234afc [bugfix] Avoid forgetting 1 atom clauses
When a new clause with only 1 atom is added with (usually
from simplifying a theory lemma), the usual strategy is to backtrack to
the base level, then propagate the atom. However, when the atom is
already false at base level, Unsat is raised, in which case the
information that the atom must be true is lost. To avoid that, the
single atom clause is simply pushed back in the stack of clauses to add,
so that it will be re-examined later.
2016-11-03 16:04:51 +01:00
Guillaume Bury
3321f556d6 Better way of keeping track of local hyps 2016-10-19 17:09:13 +02:00
Guillaume Bury
e6f3e79acc [bugfix] Grow heap when adding local hyps
Previously, the heap was not grown when adding local assumptions. This
lead to a bug whne backtracking: indeed when a local assumption was
backtracked, it was added to the (too small) heap, which then raised a
Sparse_vec exception.
2016-10-19 17:07:19 +02:00
Guillaume Bury
1656995097 Added uninterpreted functions to mcsat solver 2016-09-23 15:39:23 +02:00
Simon Cruanes
9baa3f0716 fix bug in add_clause 2016-09-12 10:38:37 +02:00
Guillaume Bury
18a3478926 Give access to the trail 2016-09-06 14:34:22 +02:00
Guillaume Bury
119f3a8566 New function to export a problem to dimacs format 2016-08-18 18:19:14 +02:00
Guillaume Bury
56f98d9a82 Explicit status for local assumption clauses
Proofs require local assumptions to be recognisable.
Keeping the reason of local assumptions as Bcp simplfies
the code, since a proof is a clause, and allows to not have
to recreate the local unit clause that effectively propagates
the local assumptions.

With this fix, simplification of clauses is not required aymore for
levels between 0 (excluded) and base_level, so the partition function
can be simplified accordingly.
2016-08-17 19:20:05 +02:00
Guillaume Bury
ec6ced9809 Unify analyze code for sat and mcsat 2016-08-04 22:16:52 +02:00
Guillaume Bury
7d57b3f1b5 Accept late conflict clauses, closes #4 2016-08-04 21:34:17 +02:00
Guillaume Bury
6f54604dc9 Optim for non-mcsat solvers 2016-07-29 23:20:31 +02:00
Simon Cruanes
af55371eb4 change the caching mechanism for var's assignable subterms 2016-07-29 22:50:37 +02:00
Guillaume Bury
5fdffe1f85 Handle new clauses unsat at level >0 && <=base_lvl 2016-07-29 21:00:24 +02:00
Simon Cruanes
6eeaa8513c fix bug 2016-07-29 20:45:30 +02:00
Simon Cruanes
85c290c0ce small changes 2016-07-29 20:15:53 +02:00
Guillaume Bury
9d6634d621 Better interface for Msat.Internal 2016-07-29 15:47:51 +02:00
Guillaume Bury
bc200474eb Simpler code for clause simplification
Simplify_zero is a strict subset of partition_aux
2016-07-29 14:40:42 +02:00
Guillaume Bury
a32b35e994 Fix proofs with local assumptions 2016-07-29 13:35:05 +02:00
Simon Cruanes
5a04fa49ed for proofs, represent assumptions as propagations 2016-07-28 10:56:19 +02:00
Simon Cruanes
eb14a1e229 fix 2016-07-28 10:47:59 +02:00
Simon Cruanes
ac706f3e56 fix bug 2016-07-28 10:18:07 +02:00
Simon Cruanes
2e8b45edbc many small changes 2016-07-28 00:51:36 +02:00
Simon Cruanes
73c2500b05 allow propagation of lits under base_level 2016-07-27 18:16:26 +02:00
Simon Cruanes
3e9c0d3a1e forgot to pop before assume 2016-07-27 17:58:15 +02:00
Simon Cruanes
563e9027e1 first draft of replacing push/pop by assumptions 2016-07-27 17:50:03 +02:00
Guillaume Bury
09166d0370 Removed Stack.fold for compat with ocaml < 4.03 2016-07-26 15:35:22 +02:00
Guillaume Bury
3c6da0ffdc Clause buffer must be fitered when popping
Indeed imagine the following case:
"push; assume [c]; pop; push; solve"
since c has user-level 1, in the current state, it would
have been wrongfully added to the solver state when solve
is run.
2016-07-26 14:34:42 +02:00