summaryrefslogtreecommitdiff
path: root/examples/sets-translate
diff options
context:
space:
mode:
authorKshitij Bansal <kshitij@cs.nyu.edu>2014-06-18 15:51:57 -0400
committerlianah <lianahady@gmail.com>2014-06-19 18:24:40 -0400
commiteca295cff1baafcaa1ec9316a7f867ec4a88968a (patch)
treeab83d38d80561452fc6f45e36fda9a8233bc9986 /examples/sets-translate
parent58b07681d667ae70e262b728555b75a2fdec8c6f (diff)
basic fixes for sets translator, separate binaries
Diffstat (limited to 'examples/sets-translate')
-rw-r--r--examples/sets-translate/Makefile.am15
-rw-r--r--examples/sets-translate/sets_translate.cpp24
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 = "<stdin>";
// Create the expression manager
@@ -259,6 +263,7 @@ int main(int argc, char* argv[])
// Create the parser
ParserBuilder parserBuilder(&exprManager, input, options);
+ if(input == "<stdin>") 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;
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback