diff options
author | Morgan Deters <mdeters@cs.nyu.edu> | 2013-12-12 18:24:54 -0500 |
---|---|---|
committer | Morgan Deters <mdeters@cs.nyu.edu> | 2013-12-16 22:28:26 -0500 |
commit | 5186ca79710fe935d1f7ed27c4a34e913ab547e8 (patch) | |
tree | 4f5ce4957063085f607492a6474b0d244e4b2da4 /src | |
parent | 4d9caf9782c59823fb95519b9b518b7d7f89738a (diff) |
First attempt at incorporating LFSC proof checker into CVC4.
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 7 | ||||
-rw-r--r-- | src/smt/options | 2 | ||||
-rw-r--r-- | src/smt/smt_engine.cpp | 12 | ||||
-rw-r--r-- | src/smt/smt_engine.h | 5 | ||||
-rw-r--r-- | src/smt/smt_engine_check_proof.cpp | 36 |
5 files changed, 61 insertions, 1 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 3637cb089..18382a8ab 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -16,7 +16,7 @@ AM_CPPFLAGS = \ -D__BUILDING_CVC4LIB \ -D __STDC_LIMIT_MACROS \ -D __STDC_FORMAT_MACROS \ - -I@builddir@ -I@srcdir@/include -I@srcdir@ + -I@builddir@ -I@srcdir@/include -I@srcdir@ -I@top_srcdir@/proofs/lfsc_checker AM_CXXFLAGS = -Wall -Wno-unknown-pragmas -Wno-parentheses $(FLAG_VISIBILITY_HIDDEN) SUBDIRS = lib options expr util prop/minisat prop/bvminisat . parser compat bindings main @@ -104,6 +104,7 @@ libcvc4_la_SOURCES = \ prop/sat_solver_registry.cpp \ prop/options_handlers.h \ smt/smt_engine.cpp \ + smt/smt_engine_check_proof.cpp \ smt/smt_engine.h \ smt/model_postprocessor.cpp \ smt/model_postprocessor.h \ @@ -393,6 +394,10 @@ libcvc4_la_LIBADD = \ @builddir@/expr/libexpr.la \ @builddir@/prop/minisat/libminisat.la \ @builddir@/prop/bvminisat/libbvminisat.la +if CVC4_PROOF +libcvc4_la_LIBADD += \ + @top_builddir@/proofs/lfsc_checker/liblfsc_checker.la +endif if CVC4_NEEDS_REPLACEMENT_FUNCTIONS libcvc4_la_LIBADD += \ diff --git a/src/smt/options b/src/smt/options index 05a138f60..69b5102de 100644 --- a/src/smt/options +++ b/src/smt/options @@ -22,6 +22,8 @@ option expandDefinitions expand-definitions bool :default false always expand symbol definitions in output common-option produceModels produce-models -m --produce-models bool :default false :predicate CVC4::smt::beforeSearch :predicate-include "smt/smt_engine.h" support the get-value and get-model commands +option checkProofs check-proofs --check-proofs bool :predicate CVC4::smt::beforeSearch :predicate-include "smt/options_handlers.h" + after UNSAT/VALID, machine-check the generated proof option checkModels check-models --check-models bool :predicate CVC4::smt::beforeSearch :predicate-include "smt/options_handlers.h" after SAT/INVALID/UNKNOWN, check that the generated model satisfies user assertions option dumpModels --dump-models bool :default false diff --git a/src/smt/smt_engine.cpp b/src/smt/smt_engine.cpp index 0fadca424..1f83bb547 100644 --- a/src/smt/smt_engine.cpp +++ b/src/smt/smt_engine.cpp @@ -3358,6 +3358,12 @@ Result SmtEngine::checkSat(const Expr& ex) throw(TypeCheckingException, ModalExc checkModel(/* hard failure iff */ ! r.isUnknown()); } } + // Check that UNSAT results generate a proof correctly. + if(options::checkProofs()) { + if(r.asSatisfiabilityResult().isSat() == Result::UNSAT) { + checkProof(); + } + } return r; }/* SmtEngine::checkSat() */ @@ -3428,6 +3434,12 @@ Result SmtEngine::query(const Expr& ex) throw(TypeCheckingException, ModalExcept checkModel(/* hard failure iff */ ! r.isUnknown()); } } + // Check that UNSAT results generate a proof correctly. + if(options::checkProofs()) { + if(r.asSatisfiabilityResult().isSat() == Result::UNSAT) { + checkProof(); + } + } return r; }/* SmtEngine::query() */ diff --git a/src/smt/smt_engine.h b/src/smt/smt_engine.h index 9655297b3..0781ac1c0 100644 --- a/src/smt/smt_engine.h +++ b/src/smt/smt_engine.h @@ -249,6 +249,11 @@ class CVC4_PUBLIC SmtEngine { smt::SmtEnginePrivate* d_private; /** + * Check that a generated Proof (via getProof()) checks. + */ + void checkProof(); + + /** * Check that a generated Model (via getModel()) actually satisfies * all user assertions. */ diff --git a/src/smt/smt_engine_check_proof.cpp b/src/smt/smt_engine_check_proof.cpp new file mode 100644 index 000000000..e4de1029b --- /dev/null +++ b/src/smt/smt_engine_check_proof.cpp @@ -0,0 +1,36 @@ +/********************* */ +/*! \file smt_engine_check_proof.cpp + ** \verbatim + ** Original author: Morgan Deters + ** Major contributors: none + ** Minor contributors (to current version): none + ** This file is part of the CVC4 project. + ** Copyright (c) 2009-2013 New York University and The University of Iowa + ** See the file COPYING in the top-level source directory for licensing + ** information.\endverbatim + ** + ** \brief [[ Add one-line brief description here ]] + ** + ** [[ Add lengthier description here ]] + ** \todo document this file + **/ + +#include "smt/smt_engine.h" +#include "check.h" + +using namespace CVC4; +using namespace std; + +void SmtEngine::checkProof() { + +#ifdef CVC4_PROOF + + //TimerStat::CodeTimer checkProofTimer(d_stats->d_checkProofTime); + +#else /* CVC4_PROOF */ + + Unreachable("This version of CVC4 was built without proof support; cannot check proofs."); + +#endif /* CVC4_PROOF */ + +} |