From eca295cff1baafcaa1ec9316a7f867ec4a88968a Mon Sep 17 00:00:00 2001 From: Kshitij Bansal Date: Wed, 18 Jun 2014 15:51:57 -0400 Subject: [PATCH] basic fixes for sets translator, separate binaries --- examples/sets-translate/Makefile.am | 15 +++++++++++--- examples/sets-translate/sets_translate.cpp | 24 +++++++++++++++++----- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/examples/sets-translate/Makefile.am b/examples/sets-translate/Makefile.am index 40b79e998..720e56597 100644 --- a/examples/sets-translate/Makefile.am +++ b/examples/sets-translate/Makefile.am @@ -4,16 +4,25 @@ AM_CXXFLAGS = -Wall AM_CFLAGS = -Wall noinst_PROGRAMS = \ - sets_translate + sets2arrays \ + sets2axioms noinst_DATA = -sets_translate_SOURCES = \ +sets2arrays_SOURCES = \ sets_translate.cpp -sets_translate_LDADD = \ +sets2arrays_LDADD = \ @builddir@/../../src/parser/libcvc4parser.la \ @builddir@/../../src/libcvc4.la +sets2axioms_SOURCES = \ + sets_translate.cpp +sets2axioms_LDADD = \ + @builddir@/../../src/parser/libcvc4parser.la \ + @builddir@/../../src/libcvc4.la +sets2axioms_CXXFLAGS = \ + -DENABLE_AXIOMS + # for installation examplesdir = $(docdir)/$(subdir) examples_DATA = $(DIST_SOURCES) $(EXTRA_DIST) diff --git a/examples/sets-translate/sets_translate.cpp b/examples/sets-translate/sets_translate.cpp index dbc7100c0..e23b7cec2 100644 --- a/examples/sets-translate/sets_translate.cpp +++ b/examples/sets-translate/sets_translate.cpp @@ -37,7 +37,11 @@ using namespace CVC4::options; bool nonsense(char c) { return !isalnum(c); } +#ifdef ENABLE_AXIOMS const bool enableAxioms = true; +#else +const bool enableAxioms = false; +#endif string setaxioms[] = { "(declare-fun inHOLDA (HOLDB (Set HOLDB)) Bool)", @@ -245,7 +249,7 @@ int main(int argc, char* argv[]) // Get the filename string input; - if(argv > 0) input = (argv[1]); + if(argc > 1) input = string(argv[1]); else input = ""; // Create the expression manager @@ -259,6 +263,7 @@ int main(int argc, char* argv[]) // Create the parser ParserBuilder parserBuilder(&exprManager, input, options); + if(input == "") parserBuilder.withStreamInput(cin); Parser* parser = parserBuilder.build(); // Variables and assertions @@ -289,10 +294,19 @@ int main(int argc, char* argv[]) return 0; } logicinfo = logicinfo.getUnlockedCopy(); - logicinfo.disableTheory(theory::THEORY_SETS); - logicinfo.enableTheory(theory::THEORY_ARRAY); - logicinfo.lock(); - // cout << SetBenchmarkLogicCommand(logicinfo.getLogicString()) << endl; + if(enableAxioms) { + logicinfo.enableQuantifiers(); + logicinfo.lock(); + if(!logicinfo.hasEverything()) { + (logicinfo = logicinfo.getUnlockedCopy()).disableTheory(theory::THEORY_SETS); + logicinfo.lock(); + cout << SetBenchmarkLogicCommand(logicinfo.getLogicString()) << endl; + } + } else { + logicinfo.enableTheory(theory::THEORY_ARRAY); + // we print logic string only for Quantifiers, for Z3 stuff + // we don't set the logic + } delete cmd; continue; -- 2.30.2