From bdba2bf65eb2f68daa1a5e488c4e50f5dac1b312 Mon Sep 17 00:00:00 2001 From: Mathias Preiner Date: Wed, 21 Mar 2018 15:48:57 -0700 Subject: [PATCH] Refactor mkoptions (#1631) This commit refactors code generation for options. It uses a new configuration format for defining options (*.toml) and a new Python script mkoptions.py to generate the source code and option documentation. The option behavior did not change for most of the options, except that for bool --enable-/--disable- long options enable/disable was removed. E.g. --enable-miplib-trick and --disable-miplib-trick got changed to --miplib-trick and --no-miplib-trick. This commit fixes also an issues with set-option/get-option via the SMT2 interface. Before long options were only accessible if the name included the =ARG part. --- Makefile.am | 3 +- configure.ac | 2 +- contrib/new-theory | 4 +- contrib/new-theory.awk | 18 +- contrib/optionsskel/DIR_options | 8 - contrib/optionsskel/DIR_options.toml | 8 + contrib/run-script-smtcomp2018 | 4 +- contrib/run-script-smtcomp2018-unsat-cores | 2 +- doc/SmtEngine.3cvc_template.in | 4 +- doc/cvc4.1_template.in | 4 +- doc/{libcvc4.3_template.in => libcvc4.3.in} | 0 doc/options.3cvc_template.in | 4 +- src/options/Makefile.am | 399 +--- src/options/README | 229 +++ src/options/arith_options | 206 -- src/options/arith_options.toml | 540 ++++++ src/options/arrays_options | 35 - src/options/arrays_options.toml | 75 + src/options/base_options | 213 --- src/options/base_options.toml | 208 ++ src/options/base_options_template.h | 55 - src/options/booleans_options | 9 - src/options/booleans_options.toml | 3 + src/options/builtin_options | 8 - src/options/builtin_options.toml | 3 + src/options/bv_options | 87 - src/options/bv_options.toml | 212 +++ src/options/datatypes_options | 53 - src/options/datatypes_options.toml | 169 ++ src/options/decision_options | 27 - src/options/decision_options.toml | 57 + src/options/expr_options | 30 - src/options/expr_options.toml | 74 + src/options/fp_options | 8 - src/options/fp_options.toml | 3 + src/options/generate-toml-files.sh | 3 + src/options/idl_options | 12 - src/options/idl_options.toml | 11 + src/options/main_options | 69 - src/options/main_options.toml | 205 ++ src/options/mkoptions | 1676 ----------------- src/options/mkoptions.py | 1448 ++++++++++++++ ...tions_template.cpp => module_template.cpp} | 22 +- src/options/module_template.h | 51 + src/options/options_get_option_template.cpp | 53 - src/options/options_holder_template.h | 12 +- src/options/options_set_option_template.cpp | 52 - src/options/options_template.cpp | 66 +- src/options/parser_options | 35 - src/options/parser_options.toml | 67 + src/options/printer_options | 14 - src/options/printer_options.toml | 23 + src/options/proof_options | 20 - src/options/proof_options.toml | 38 + src/options/prop_options | 31 - src/options/prop_options.toml | 84 + src/options/quantifiers_options | 421 ----- src/options/quantifiers_options.toml | 1492 +++++++++++++++ src/options/sep_options | 24 - src/options/sep_options.toml | 57 + src/options/sets_options | 20 - src/options/sets_options.toml | 39 + src/options/smt_options.toml | 617 ++++++ src/options/strings_options | 76 - src/options/strings_options.toml | 229 +++ src/options/theory_options | 14 - src/options/theory_options.toml | 25 + src/options/uf_options | 49 - src/options/uf_options.toml | 164 ++ .../arith/miplib-opt1217--27.smt.expect | 2 +- .../arith/miplib-pp08a-3000.smt.expect | 2 +- test/regress/regress0/arith/miplib.cvc | 2 +- test/regress/regress0/arith/miplib2.cvc | 2 +- test/regress/regress0/arith/miplib4.cvc | 2 +- test/regress/regress1/arith/miplib3.cvc | 2 +- .../regress2/arith/miplib-opt1217--27.smt2 | 2 +- .../regress2/arith/miplib-pp08a-3000.smt2 | 2 +- 77 files changed, 6273 insertions(+), 3726 deletions(-) delete mode 100644 contrib/optionsskel/DIR_options create mode 100644 contrib/optionsskel/DIR_options.toml rename doc/{libcvc4.3_template.in => libcvc4.3.in} (100%) create mode 100644 src/options/README delete mode 100644 src/options/arith_options create mode 100644 src/options/arith_options.toml delete mode 100644 src/options/arrays_options create mode 100644 src/options/arrays_options.toml delete mode 100644 src/options/base_options create mode 100644 src/options/base_options.toml delete mode 100644 src/options/base_options_template.h delete mode 100644 src/options/booleans_options create mode 100644 src/options/booleans_options.toml delete mode 100644 src/options/builtin_options create mode 100644 src/options/builtin_options.toml delete mode 100644 src/options/bv_options create mode 100644 src/options/bv_options.toml delete mode 100644 src/options/datatypes_options create mode 100644 src/options/datatypes_options.toml delete mode 100644 src/options/decision_options create mode 100644 src/options/decision_options.toml delete mode 100644 src/options/expr_options create mode 100644 src/options/expr_options.toml delete mode 100644 src/options/fp_options create mode 100644 src/options/fp_options.toml create mode 100755 src/options/generate-toml-files.sh delete mode 100644 src/options/idl_options create mode 100644 src/options/idl_options.toml delete mode 100644 src/options/main_options create mode 100644 src/options/main_options.toml delete mode 100755 src/options/mkoptions create mode 100755 src/options/mkoptions.py rename src/options/{base_options_template.cpp => module_template.cpp} (55%) create mode 100644 src/options/module_template.h delete mode 100644 src/options/options_get_option_template.cpp delete mode 100644 src/options/options_set_option_template.cpp delete mode 100644 src/options/parser_options create mode 100644 src/options/parser_options.toml delete mode 100644 src/options/printer_options create mode 100644 src/options/printer_options.toml delete mode 100644 src/options/proof_options create mode 100644 src/options/proof_options.toml delete mode 100644 src/options/prop_options create mode 100644 src/options/prop_options.toml delete mode 100644 src/options/quantifiers_options create mode 100644 src/options/quantifiers_options.toml delete mode 100644 src/options/sep_options create mode 100644 src/options/sep_options.toml delete mode 100644 src/options/sets_options create mode 100644 src/options/sets_options.toml create mode 100644 src/options/smt_options.toml delete mode 100644 src/options/strings_options create mode 100644 src/options/strings_options.toml delete mode 100644 src/options/theory_options create mode 100644 src/options/theory_options.toml delete mode 100644 src/options/uf_options create mode 100644 src/options/uf_options.toml diff --git a/Makefile.am b/Makefile.am index e975455ec..c2efa0420 100644 --- a/Makefile.am +++ b/Makefile.am @@ -127,7 +127,7 @@ EXTRA_DIST = \ doc/find_public_interface.sh \ doc/cvc4.1_template.in \ doc/cvc4.5.in \ - doc/libcvc4.3_template.in \ + doc/libcvc4.3.in \ doc/SmtEngine.3cvc_template.in \ doc/options.3cvc_template.in \ doc/libcvc4parser.3.in \ @@ -167,7 +167,6 @@ DISTCLEANFILES = \ doc/pcvc4.1 \ doc/cvc4.5 \ doc/libcvc4.3 \ - doc/libcvc4.3_template \ doc/libcvc4compat.3 \ doc/libcvc4parser.3 \ doc/SmtEngine.3cvc \ diff --git a/configure.ac b/configure.ac index 3fe7587eb..a279da5cb 100644 --- a/configure.ac +++ b/configure.ac @@ -1547,7 +1547,7 @@ CVC4_CONFIG_FILE_ONLY_IF_CHANGED([src/util/rational.h]) CVC4_CONFIG_FILE_ONLY_IF_CHANGED([doc/cvc4.1_template]) CVC4_CONFIG_FILE_ONLY_IF_CHANGED([doc/cvc4.5]) -CVC4_CONFIG_FILE_ONLY_IF_CHANGED([doc/libcvc4.3_template]) +CVC4_CONFIG_FILE_ONLY_IF_CHANGED([doc/libcvc4.3]) CVC4_CONFIG_FILE_ONLY_IF_CHANGED([doc/SmtEngine.3cvc_template]) CVC4_CONFIG_FILE_ONLY_IF_CHANGED([doc/options.3cvc_template]) CVC4_CONFIG_FILE_ONLY_IF_CHANGED([doc/libcvc4parser.3]) diff --git a/contrib/new-theory b/contrib/new-theory index 0d9e45647..b349e78b0 100755 --- a/contrib/new-theory +++ b/contrib/new-theory @@ -179,8 +179,8 @@ if ! mv -f src/Makefile.am.new-theory src/Makefile.am; then exit 1 fi -echo "Adding ${dir}_options to src/options/Makefile.am..." -if grep -q '^ ${dir}_options' src/options/Makefile.am &>/dev/null; then +echo "Adding ${dir}_options.toml to src/options/Makefile.am..." +if grep -q '^ ${dir}_options.toml' src/options/Makefile.am &>/dev/null; then echo "NOTE: src/options/Makefile.am already seems to link to $dir option files" else awk -v name="$dir" -f contrib/new-theory.awk src/options/Makefile.am > src/options/Makefile.am.new-theory diff --git a/contrib/new-theory.awk b/contrib/new-theory.awk index 6c523f259..1adbb2f24 100755 --- a/contrib/new-theory.awk +++ b/contrib/new-theory.awk @@ -1,17 +1,7 @@ #!/bin/awk -v name=theory_new -f # -# The do nothing rule -!/^OPTIONS_SRC_FILES = \\|^OPTIONS_TEMPS = \\|^OPTIONS_OPTIONS_FILES = \\|^OPTIONS_SEDS = \\|^OPTIONS_HEADS = \\|^OPTIONS_CPPS = \\/ {print$0} -# Add the name to the correct locations. -/^OPTIONS_SRC_FILES = \\/{print $0; printf "\t%s_options \\\n", name;} -/^OPTIONS_TEMPS = \\/{print $0; printf "\t%s_options.tmp \\\n", name;} -/^OPTIONS_OPTIONS_FILES = \\/{print $0; printf "\t%s_options.options \\\n", name;} -/^OPTIONS_SEDS = \\/{print $0; printf "\t%s_options.sed \\\n", name;} -/^OPTIONS_HEADS = \\/{print $0; printf "\t%s_options.h \\\n", name;} -/^OPTIONS_CPPS = \\/{print $0; printf "\t%s_options.cpp \\\n", name;} -# Add the rule for name_options. -END{printf "%s_options:;\n", name} -# Add the rules for name_options.tmp -END{printf ".PHONY: %s_options.tmp\n", name} -END{printf "%s_options.tmp:\n\techo \"$@\" \"$(@:.tmp=)\"\n\t$(AM_V_GEN)(cp \"@srcdir@/$(@:.tmp=)\" \"$@\" || true)\n", name} +# Keep non-matching lines unchanged +!/^OPTIONS_CONFIG_FILES = \\/ {print$0} +# Add *_options.toml to OPTIONS_CONFIG_FILES +/^OPTIONS_CONFIG_FILES = \\/{print $0; printf "\t%s_options.toml \\\n", name;} diff --git a/contrib/optionsskel/DIR_options b/contrib/optionsskel/DIR_options deleted file mode 100644 index de160df6d..000000000 --- a/contrib/optionsskel/DIR_options +++ /dev/null @@ -1,8 +0,0 @@ -# -# Option specification file for CVC4 -# See src/options/base_options for a description of this file format -# - -module $id "options/$dir_options.h" $camel - -endmodule diff --git a/contrib/optionsskel/DIR_options.toml b/contrib/optionsskel/DIR_options.toml new file mode 100644 index 000000000..09f44fde7 --- /dev/null +++ b/contrib/optionsskel/DIR_options.toml @@ -0,0 +1,8 @@ +# +# Option specification file for CVC4 +# See src/options/README for a description of this file format +# + +id = "$id" +name = "$camel" +header = "options/$dir_options.h" diff --git a/contrib/run-script-smtcomp2018 b/contrib/run-script-smtcomp2018 index befef362f..a0e793c2e 100644 --- a/contrib/run-script-smtcomp2018 +++ b/contrib/run-script-smtcomp2018 @@ -26,12 +26,12 @@ function finishwith { case "$logic" in QF_LRA) - trywith 200 --enable-miplib-trick --miplib-trick-subs=4 --use-approx --lemmas-on-replay-failure --replay-early-close-depth=4 --replay-lemma-reject-cut=128 --replay-reject-cut=512 --unconstrained-simp --use-soi + trywith 200 --miplib-trick --miplib-trick-subs=4 --use-approx --lemmas-on-replay-failure --replay-early-close-depth=4 --replay-lemma-reject-cut=128 --replay-reject-cut=512 --unconstrained-simp --use-soi finishwith --no-restrict-pivots --use-soi --new-prop --unconstrained-simp ;; QF_LIA) # same as QF_LRA but add --pb-rewrites - finishwith --enable-miplib-trick --miplib-trick-subs=4 --use-approx --lemmas-on-replay-failure --replay-early-close-depth=4 --replay-lemma-reject-cut=128 --replay-reject-cut=512 --unconstrained-simp --use-soi --pb-rewrites + finishwith --miplib-trick --miplib-trick-subs=4 --use-approx --lemmas-on-replay-failure --replay-early-close-depth=4 --replay-lemma-reject-cut=128 --replay-reject-cut=512 --unconstrained-simp --use-soi --pb-rewrites ;; QF_NIA) trywith 300 --nl-ext --nl-ext-tplanes --decision=internal diff --git a/contrib/run-script-smtcomp2018-unsat-cores b/contrib/run-script-smtcomp2018-unsat-cores index f42f3ca30..19dc45885 100644 --- a/contrib/run-script-smtcomp2018-unsat-cores +++ b/contrib/run-script-smtcomp2018-unsat-cores @@ -17,7 +17,7 @@ QF_LRA) finishwith --no-restrict-pivots --use-soi --new-prop --unconstrained-simp ;; QF_LIA) - finishwith --enable-miplib-trick --miplib-trick-subs=4 --use-approx --lemmas-on-replay-failure --replay-early-close-depth=4 --replay-lemma-reject-cut=128 --replay-reject-cut=512 --unconstrained-simp --use-soi + finishwith --miplib-trick --miplib-trick-subs=4 --use-approx --lemmas-on-replay-failure --replay-early-close-depth=4 --replay-lemma-reject-cut=128 --replay-reject-cut=512 --unconstrained-simp --use-soi ;; QF_NIA) finishwith --solve-int-as-bv=32 --bitblast=eager --bv-sat-solver=cryptominisat diff --git a/doc/SmtEngine.3cvc_template.in b/doc/SmtEngine.3cvc_template.in index 0c558d8b7..b240dd8d2 100644 --- a/doc/SmtEngine.3cvc_template.in +++ b/doc/SmtEngine.3cvc_template.in @@ -24,9 +24,9 @@ use the following option keys. .RS .TP 10 .I "COMMON OPTIONS" -${common_manpage_smt_documentation} +${man_common_smt}$ -${remaining_manpage_smt_documentation} +${man_others_smt}$ .PD .RE diff --git a/doc/cvc4.1_template.in b/doc/cvc4.1_template.in index ddf9bac09..a0535553b 100644 --- a/doc/cvc4.1_template.in +++ b/doc/cvc4.1_template.in @@ -48,9 +48,9 @@ is connected to a terminal, interactive mode is assumed. .IP "Each option marked with [*] has a \-\-no\-OPTIONNAME variant, which reverses the sense of the option." -${common_manpage_documentation} +${man_common}$ -${remaining_manpage_documentation} +${man_others}$ .IP "Each option marked with [*] has a \-\-no\-OPTIONNAME variant, which reverses the sense of the option." diff --git a/doc/libcvc4.3_template.in b/doc/libcvc4.3.in similarity index 100% rename from doc/libcvc4.3_template.in rename to doc/libcvc4.3.in diff --git a/doc/options.3cvc_template.in b/doc/options.3cvc_template.in index d239b66f3..e72363b62 100644 --- a/doc/options.3cvc_template.in +++ b/doc/options.3cvc_template.in @@ -12,9 +12,9 @@ options \- the options infrastructure .RS .TP 10 .I "COMMON OPTIONS" -${common_manpage_internals_documentation} +${man_common_internals}$ -${remaining_manpage_internals_documentation} +${man_others_internals}$ .PD .RE diff --git a/src/options/Makefile.am b/src/options/Makefile.am index 54027c128..723b110ea 100644 --- a/src/options/Makefile.am +++ b/src/options/Makefile.am @@ -1,17 +1,3 @@ -# How options are built: -# Step 1: Copy the X_options source file into builddir as X_options.tmp. -# X_options.tmp is a .PHONY rule to force this step to always be done. -# Step 2: Compare X_options.tmp to X_options.options. -# If they are different, overwrite "X_options.options". -# This is the file that we use to generate options from. -# This is always up to dat with X_options. The change in name is just -# to keep Makefile stage more explicit. -# Step 3: Generate X_options.sed from X_options.options using mkoptions. -# Step 4: Generate X_options.h from X_options.sed -# Step 5: Generate X_options.cpp from X_options.sed. -# This stage also waits for X_options.h as otherwise it cannot compile. -# - # if coverage is enabled: # COVERAGE_ON = yes from configure.ac # Using an inline conditional function to choose between absolute and @@ -22,191 +8,51 @@ VPATH = $(if $(COVERAGE_ON), $(realpath @srcdir@), @srcdir@) -OPTIONS_SRC_FILES = \ - arith_options \ - arrays_options \ - base_options \ - booleans_options \ - builtin_options \ - bv_options \ - datatypes_options \ - decision_options \ - expr_options \ - fp_options \ - idl_options \ - main_options \ - parser_options \ - printer_options \ - proof_options \ - prop_options \ - quantifiers_options \ - sep_options \ - sets_options \ - smt_options \ - strings_options \ - theory_options \ - uf_options - -OPTIONS_TEMPS = \ - arith_options.tmp \ - arrays_options.tmp \ - base_options.tmp \ - booleans_options.tmp \ - builtin_options.tmp \ - bv_options.tmp \ - datatypes_options.tmp \ - decision_options.tmp \ - expr_options.tmp \ - fp_options.tmp \ - idl_options.tmp \ - main_options.tmp \ - parser_options.tmp \ - printer_options.tmp \ - proof_options.tmp \ - prop_options.tmp \ - quantifiers_options.tmp \ - sep_options.tmp \ - sets_options.tmp \ - smt_options.tmp \ - strings_options.tmp \ - theory_options.tmp \ - uf_options.tmp - -OPTIONS_OPTIONS_FILES = \ - arith_options.options \ - arrays_options.options \ - base_options.options \ - booleans_options.options \ - builtin_options.options \ - bv_options.options \ - datatypes_options.options \ - decision_options.options \ - expr_options.options \ - fp_options.options \ - idl_options.options \ - main_options.options \ - parser_options.options \ - printer_options.options \ - proof_options.options \ - prop_options.options \ - quantifiers_options.options \ - sep_options.options \ - sets_options.options \ - smt_options.options \ - strings_options.options \ - theory_options.options \ - uf_options.options - -OPTIONS_SEDS = \ - arith_options.sed \ - arrays_options.sed \ - base_options.sed \ - booleans_options.sed \ - builtin_options.sed \ - bv_options.sed \ - datatypes_options.sed \ - decision_options.sed \ - expr_options.sed \ - fp_options.sed \ - idl_options.sed \ - main_options.sed \ - parser_options.sed \ - printer_options.sed \ - proof_options.sed \ - prop_options.sed \ - quantifiers_options.sed \ - sep_options.sed \ - sets_options.sed \ - smt_options.sed \ - strings_options.sed \ - theory_options.sed \ - uf_options.sed - -OPTIONS_HEADS = \ - arith_options.h \ - arrays_options.h \ - base_options.h \ - booleans_options.h \ - builtin_options.h \ - bv_options.h \ - datatypes_options.h \ - decision_options.h \ - expr_options.h \ - fp_options.h \ - idl_options.h \ - main_options.h \ - parser_options.h \ - printer_options.h \ - proof_options.h \ - prop_options.h \ - quantifiers_options.h \ - sep_options.h \ - sets_options.h \ - smt_options.h \ - strings_options.h \ - theory_options.h \ - uf_options.h - -OPTIONS_CPPS = \ - arith_options.cpp \ - arrays_options.cpp \ - base_options.cpp \ - booleans_options.cpp \ - builtin_options.cpp \ - bv_options.cpp \ - datatypes_options.cpp \ - decision_options.cpp \ - expr_options.cpp \ - fp_options.cpp \ - idl_options.cpp \ - main_options.cpp \ - parser_options.cpp \ - printer_options.cpp \ - proof_options.cpp \ - prop_options.cpp \ - quantifiers_options.cpp \ - sep_options.cpp \ - sets_options.cpp \ - smt_options.cpp \ - strings_options.cpp \ - theory_options.cpp \ - uf_options.cpp - +OPTIONS_CONFIG_FILES = \ + arith_options.toml \ + arrays_options.toml \ + base_options.toml \ + booleans_options.toml \ + builtin_options.toml \ + bv_options.toml \ + datatypes_options.toml \ + decision_options.toml \ + expr_options.toml \ + fp_options.toml \ + idl_options.toml \ + main_options.toml \ + parser_options.toml \ + printer_options.toml \ + proof_options.toml \ + prop_options.toml \ + quantifiers_options.toml \ + sep_options.toml \ + sets_options.toml \ + smt_options.toml \ + strings_options.toml \ + theory_options.toml \ + uf_options.toml + +OPTIONS_GEN_H = $(OPTIONS_CONFIG_FILES:.toml=.h) + +OPTIONS_GEN_CPP = $(OPTIONS_CONFIG_FILES:.toml=.cpp) CPP_TEMPLATE_FILES = \ - base_options_template.h \ - base_options_template.cpp \ + module_template.h \ + module_template.cpp \ options_holder_template.h \ - options_template.cpp \ - options_get_option_template.cpp \ - options_set_option_template.cpp - -CPP_TEMPLATE_SEDS = \ - base_options_template.h.sed \ - base_options_template.cpp.sed \ - options_holder_template.h.sed \ - options_template.cpp.sed \ - options_get_option_template.cpp.sed \ - options_set_option_template.cpp.sed - + options_template.cpp DOCUMENTATION_FILES = \ ../../doc/cvc4.1 \ - ../../doc/libcvc4.3 \ ../../doc/SmtEngine.3cvc \ ../../doc/options.3cvc DOCUMENTATION_TEMPLATE_FILES = \ ../../doc/cvc4.1_template \ - ../../doc/libcvc4.3_template \ ../../doc/SmtEngine.3cvc_template \ ../../doc/options.3cvc_template -DOCUMENTATION_TEMPLATE_SEDS = \ - ../../doc/cvc4.1_template.sed \ - ../../doc/libcvc4.3_template.sed \ - ../../doc/SmtEngine.3cvc_template.sed \ - ../../doc/options.3cvc_template.sed AM_CPPFLAGS = \ -D__BUILDING_CVC4LIB \ @@ -261,180 +107,51 @@ liboptions_la_SOURCES = \ nodist_liboptions_la_SOURCES = \ options.cpp \ options_holder.h \ - $(OPTIONS_HEADS) \ - $(OPTIONS_CPPS) \ - options_get_option.cpp \ - options_set_option.cpp + $(OPTIONS_GEN_H) \ + $(OPTIONS_GEN_CPP) BUILT_SOURCES = \ - $(CPP_TEMPLATE_SEDS) \ - $(DOCUMENTATION_FILES) \ - $(DOCUMENTATION_TEMPLATE_SEDS) \ - $(OPTIONS_CPPS) \ - $(OPTIONS_HEADS) \ - $(OPTIONS_OPTIONS_FILES) \ - $(OPTIONS_SEDS) \ - options.cpp \ - options_get_option.cpp \ - options_set_option.cpp \ - options_holder.h \ - summary.sed + options.cpp CLEANFILES = \ $(BUILT_SOURCES) \ + $(OPTIONS_GEN_H) \ + $(OPTIONS_GEN_CPP) \ $(DOCUMENTATION_FILES) \ - $(OPTIONS_TEMPS) + ../../doc/libcvc4.3 \ + options_holder.h + EXTRA_DIST = \ + options.cpp \ + options_holder.h \ + $(OPTIONS_GEN_CPP) \ + $(OPTIONS_GEN_H) \ + $(OPTIONS_CONFIG_FILES) \ + $(CPP_TEMPLATE_FILES) \ $(DOCUMENTATION_FILES) \ - $(OPTIONS_CPPS) \ - $(OPTIONS_HEADS) \ - $(OPTIONS_SRC_FILES) \ - base_options_template.cpp \ - base_options_template.h \ + ../../doc/libcvc4.3 \ + mkoptions.py \ language.i \ - mkoptions \ option_exception.i \ - options.i \ - options_get_option_template.cpp \ - options_holder_template.h \ - options_set_option_template.cpp \ - options_template.cpp - - - - - -# Make sure the implicit rules never mistake a _template.cpp or _template.h file for source file. -options_holder_template.h options_template.cpp options_get_option_template.cpp options_set_option_template.cpp base_options_template.h base_options_template.cpp :; - -# Make sure the implicit rules never mistake X_options for the -o file for a -# CPP file. -arith_options arrays_options base_options booleans_options builtin_options bv_options datatypes_options decision_options expr_options fp_options idl_options main_options parser_options printer_options proof_options prop_options quantifiers_options sep_options sets_options smt_options strings_options theory_options uf_options:; - - -# These are phony to force them to be made everytime. -.PHONY: arith_options.tmp arrays_options.tmp base_options.tmp booleans_options.tmp builtin_options.tmp bv_options.tmp datatypes_options.tmp decision_options.tmp expr_options.tmp fp_options.tmp idl_options.tmp main_options.tmp parser_options.tmp printer_options.tmp proof_options.tmp prop_options.tmp quantifiers_options.tmp sep_options.tmp sets_options.tmp smt_options.tmp strings_options.tmp theory_options.tmp uf_options.tmp - -# Make is happier being listed explictly. Not sure why. -arith_options.tmp arrays_options.tmp base_options.tmp booleans_options.tmp builtin_options.tmp bv_options.tmp datatypes_options.tmp decision_options.tmp expr_options.tmp fp_options.tmp idl_options.tmp main_options.tmp parser_options.tmp printer_options.tmp proof_options.tmp prop_options.tmp quantifiers_options.tmp sep_options.tmp sets_options.tmp smt_options.tmp strings_options.tmp theory_options.tmp uf_options.tmp: - echo "$@" "$(@:.tmp=)" - $(AM_V_GEN)(cp $(if $(COVERAGE_ON), "@abs_srcdir@/$(@:.tmp=)", "@srcdir@/$(@:.tmp=)") "$@" || true) -#TIM: -#The (... || true) here is to make distcheck not fail. - -%_options.options: %_options.tmp - $(AM_V_GEN)\ - diff -q "$^" "$@" &>/dev/null || mv "$^" "$@" || true - - -# This bit is kinda tricky. -# We use the updating of %_options.options to signal that the options file updated. -# However, we use the original file in src to generate the file. -%_options.sed: %_options.options mkoptions - $(AM_V_at)chmod +x @srcdir@/mkoptions - $(AM_V_GEN)(@srcdir@/mkoptions module-sed $(if $(COVERAGE_ON), "@abs_srcdir@/$(@:.sed=)", "@srcdir@/$(@:.sed=)")) > "$@" - - -$(CPP_TEMPLATE_SEDS): %.sed : % mkoptions -# echo "template seds" -# echo "$@" -# echo $(TEMPLATE_SEDS) - $(AM_V_at)chmod +x @srcdir@/mkoptions - $(AM_V_GEN)(@srcdir@/mkoptions template-sed "$<" ) > "$@" - -$(DOCUMENTATION_TEMPLATE_SEDS): %.sed : % mkoptions -# echo "template seds" -# echo "$@" -# echo $(TEMPLATE_SEDS) - $(AM_V_at)chmod +x @srcdir@/mkoptions - $(AM_V_GEN)(@srcdir@/mkoptions template-sed "$<" ) > "$@" - -%_options.h : %_options.sed mkoptions base_options_template.h base_options_template.h.sed -# echo heads -# echo "$@" -# echo $(OPTIONS_HEADS) - $(AM_V_at)chmod +x @srcdir@/mkoptions - $(AM_V_GEN)(@srcdir@/mkoptions apply-sed-files-to-template \ - $(if $(COVERAGE_ON), @abs_srcdir@, @srcdir@)/base_options_template.h \ - base_options_template.h.sed \ - "$<" \ - ) > "$@" - -summary.sed : mkoptions $(OPTIONS_OPTIONS_FILES) - $(AM_V_at)chmod +x @srcdir@/mkoptions - $(AM_V_GEN)(@srcdir@/mkoptions summary-sed \ - $(OPTIONS_OPTIONS_FILES) \ - ) > summary.sed - - - -# mkoptions apply-sed-to-template sed-file template-file -options_holder.h : options_holder_template.h options_holder_template.h.sed summary.sed mkoptions $(OPTIONS_HEADS) - $(AM_V_at)chmod +x @srcdir@/mkoptions - $(AM_V_GEN)(@srcdir@/mkoptions apply-sed-files-to-template \ - $(if $(COVERAGE_ON), @abs_srcdir@, @srcdir@)/options_holder_template.h \ - @builddir@/options_holder_template.h.sed \ - summary.sed \ - ) > "$@" - -# Make sure not to match with "options.cpp" too. -%_options.cpp: %_options.sed %_options.h mkoptions options_holder.h base_options_template.cpp base_options_template.cpp.sed - $(AM_V_at)chmod +x @srcdir@/mkoptions - $(AM_V_GEN)(@srcdir@/mkoptions apply-sed-files-to-template \ - $(if $(COVERAGE_ON), @abs_srcdir@, @srcdir@)/base_options_template.cpp \ - base_options_template.cpp.sed \ - "$<" \ - ) > "$@" - - - - -# mkoptions apply-sed-to-template sed-file template-file -options.cpp : options_template.cpp options_template.cpp.sed mkoptions summary.sed $(OPTIONS_HEADS) options_holder.h - $(AM_V_at)chmod +x @srcdir@/mkoptions - $(AM_V_GEN)(@srcdir@/mkoptions apply-sed-files-to-template \ - $(if $(COVERAGE_ON), @abs_srcdir@, @srcdir@)/options_template.cpp \ - @builddir@/options_template.cpp.sed \ - summary.sed \ - ) > "$@" - - -# mkoptions apply-sed-to-template sed-file template-file -options_get_option.cpp : options_get_option_template.cpp options_get_option_template.cpp.sed mkoptions summary.sed $(OPTIONS_HEADS) - $(AM_V_at)chmod +x @srcdir@/mkoptions - $(AM_V_GEN)(@srcdir@/mkoptions apply-sed-files-to-template \ - $(if $(COVERAGE_ON), @abs_srcdir@, @srcdir@)/options_get_option_template.cpp \ - @builddir@/options_get_option_template.cpp.sed \ - summary.sed \ - ) > "$@" - -options_set_option.cpp : options_set_option_template.cpp options_set_option_template.cpp.sed mkoptions summary.sed $(OPTIONS_HEADS) - $(AM_V_at)chmod +x @srcdir@/mkoptions - $(AM_V_GEN)(@srcdir@/mkoptions apply-sed-files-to-template \ - $(if $(COVERAGE_ON), @abs_srcdir@, @srcdir@)/options_set_option_template.cpp \ - @builddir@/options_set_option_template.cpp.sed \ - summary.sed \ - ) > "$@" - - + options.i -$(DOCUMENTATION_FILES) : % : %_template %_template.sed mkoptions summary.sed -# echo "$<" -# echo "$@" - $(AM_V_at)chmod +x @srcdir@/mkoptions - $(AM_V_GEN)(@srcdir@/mkoptions apply-sed-files-to-template \ - "$<" \ - "$<".sed \ - @builddir@/summary.sed \ - ) > "$@" +# Make sure the implicit rules never mistake a _template.cpp or _template.h +# file for source file. +$(CPP_TEMPLATE_FILES):; -#options-stamp: options_holder_template.h options_template.cpp smt_options_template.cpp base_options_template.h base_options_template.cpp mkoptions $(OPTIONS_FILE_SRCS) +# All source/doc files are generated in one pass with rule options.cpp. Note +# that this is done incrementally since mkoptions.py checks if a generated file +# changed before writing to the file. No global re-compilation of all generated +# files happens if only individual files were modified. +$(OPTIONS_GEN_CPP) $(OPTIONS_GEN_H) options_holder.h $(DOCUMENTATION_FILES): options.cpp +options.cpp: mkoptions.py $(CPP_TEMPLATE_FILES) $(OPTIONS_CONFIG_FILES) $(DOCUMENTATION_TEMPLATE_FILES) + @srcdir@/mkoptions.py @abs_srcdir@ ../../doc . $(addprefix @abs_srcdir@/, $(OPTIONS_CONFIG_FILES)) # This rule is ugly. It's needed to ensure that automake's dependence # includes are available during distclean, even though they come from diff --git a/src/options/README b/src/options/README new file mode 100644 index 000000000..ac371e835 --- /dev/null +++ b/src/options/README @@ -0,0 +1,229 @@ +Modules +======= + + Each options module starts with the following required attributes: + + id ... (string) ID of the module (e.g., "ARITH") + name ... (string) name of the module (e.g., "Arithmetic Theory") + header ... (string) name of the options header to generated (e.g., "options/arith_options.h") + + A module defines 0 or more options and/or aliases. + + In general, each attribute/value pair is required to be in one line. + Comments start with # and are not allowed in attribute/value lines. + + +Options +======= + + Options can be defined with the [[option]] tag, the required attributes for + an option are: + + category ... (string) common | expert | regular | undocumented + type ... (string) C++ type of the option value + + Optional attributes are: + + name ... (string) option name that is used to access via + options::() + smt_name ... (string) alternative name to access option via + set-option/get-option commands + short ... (string) short option name consisting of one character + (no '-' prefix required) + long ... (string) long option name (required if short is specified, + no '--' prefix required). + long option names may have a suffix '=XXX' where + 'XXX' can be used to indicate the type of the + option value, e.g., '=MODE', '=LANG', '=N', ... + default ... (string) default value of type 'type' + handler ... (string) handler for parsing option values before setting + option + predicates ... (list) functions that check whether given option value is + valid + includes ... (list) header files required by + handler/predicates/notifies + notifies ... (list) notifications to call when option is set + links ... (list) additional options to set after this option is set + read_only ... (bool) true: option should not provide a ::set method, + false (default): option should provide a ::set + method to set the option value + alternate ... (bool) true (default): add --no- alternative option + false: omit --no- alternative option + help ... (string) documentation (required if category is not + undocumented) + + Note that if an option defines a long option name with type 'bool', + mkoptions.py automatically generates a --no- option to set the option + to false. + This behaviour can be explicitely disabled for options with attribute + alternate = false. + More information on how to use handler, predicates and notifies can be found + at the end of the README. + + + Example: + + [[option]] + name = "outputLanguage" + smt_name = "output-language" + category = "common" + short = "" + long = "output-lang=LANG" + type = "OutputLanguage" + default = "language::output::LANG_AUTO" + handler = "stringToOutputLanguage" + predicates = [] + includes = ["options/language.h"] + notifies = [] + links = [] + read_only = false + help = "force output language (default is \"auto\"; see --output-lang help)" + + + If an alternate option is generated, the linked options defined via attribute + links are not considered. If you want to define links for an alternate option + --no- for an existing option , you can define an alias with long + option no-. This overwrites the default --no- behaviour and + creates the linked options. + + +Aliases +======= + + Aliases can be defined with the [[alias]] tag, which creates a new long + option and binds it to the list of long options specified via the 'links' + attributes. + + + The required attributes are: + + category ... (string) common | expert | regular | undocumented + long ... (string) long option name + links ... (list) list of long options to set + + Optional attributes are: + + help ... (string) documentation (only option for category undocumented) + + + Example: + + [[alias]] + category = "regular" + long = "smtlib-strict" + links = ["--lang=smt2", "--output-lang=smt2", "--strict-parsing", "--default-expr-depth=-1", "--print-success", "--incremental", "--abstract-values"] + help = "SMT-LIBv2 compliance mode (implies other options)" + + + This example creates a regular option with the long option name + 'smtlib-strict', which links to the long options given as a list 'links'. + Calling + + --smtlib-strict + + is equivalent to specifying the options + + --lang=smt2 --output-lang=smt2 --strict-parsing --default-expr-depth=-1 --print-success --incremental --abstract-values + + + It's also possible to pass an argument through to another option. + + Example: + + [[alias]] + category = "undocumented" + long = "output-language=L" + links = ["--output-lang=L"] + + This alias makes --output-language synonymous with --output-lang and passes + argument L through to --output-lang. The placeholer name (in this example + 'L') of the argument can be arbitrarily chosen and can be referenced multiple + times in 'links'. + + + +Further information (the old option package) +============================================ + + The options/ package supports a wide range of operations for responding to + an option being set. Roughly the three major concepts are: + + - handler to parse an option before setting its value. + - predicates to reject bad values for the option. + - notifies for dynamic dispatch after an option is assigned. + + More details on each class of custom handlers. + + - handler = "" + + Handlers provide support for parsing custom option types. + The signature for a handler call is: + + T custom-option-handler(std::string option, std::string optarg, + OptionsHandler* handler); + + where T is the type of the option. The suggested implementation is to + implement custom-handler as a dispatch into a function on handler with the + signature: + + T OptionsHandler::custom-option-handler(std::string option, + std::string optarg); + + The handlers are run before predicates and notifications. + Having multiple handlers is considered bad practice and is unsupported. + Handlers may have arbitrary side effects, but should call no code + inaccessible to liboptions. For side effects that are not required in order + to parse the option, using :predicate is recommended. Use :notify to + achieve dynamic dispatch outside of base/, lib/, and options/. Memory + management done by a handler needs to either be encapsulated by the type + and the destructor for the type or should *always* be owned by handler. + More elaborate memory management schemes are not currently supported. + + - predicates = [...] + + Predicates provide support for checking whether or not the value of an + option is acceptable. Predicates are run after handlers and before + notifications. + The signature for a predicate call is: + + void custom-predicate(std::string option, T value, + OptionsHandler* handler); + + where T is the type of the option. The suggested implementation is to + implement custom-predicate as a dispatch into a function on handler with + the signature: + + void OptionsHandler::custom-predicate(std::string option, T value); + + The predicates are run after handlers and before notifications. Multiple + predicates may be defined for the same option, but the order they are run + is not guaranteed. Predicates may have arbitrary side effects, but should + call no code inaccessible to liboptions. Use :notify to + achieve dynamic dispatch outside of base/, lib/, and options/. + Predicates are expected to reject bad value for the option by throwing an + OptionsException. + + - notifies = [...] + + This allows for the installation of custom post-processing callbacks using + the Listener infrastructure. custom-option-notification is a C++ function + that is called after the assignment of the option is updated. + The normal usage of an notify is to call a Listener that is registered for + this specific option. This is how dynamic dispatch outside of the + liboptions package should always be done. + The signature of custom-option-notification should take an option name as + well as an OptionsHandler*. + + void custom-notification( + const std::string& option, CVC4::options::OptionsHandler* handler); + + The name is provided so multiple options can use the same notification + implementation. + This is called after all handlers and predicates have been run. + Formally, this is always placed at the end of either the generated + Options::assign or Options::assignBool function for the option. + Because of this :notify cannot be used with void type options. + Users of this feature should *always* check the code generated in + builds/src/options/options.cpp for the correctness of the placement of the + generated code. The Listener notify() function is allowed to throw + an arbitrary std::exception. diff --git a/src/options/arith_options b/src/options/arith_options deleted file mode 100644 index 722af1fa1..000000000 --- a/src/options/arith_options +++ /dev/null @@ -1,206 +0,0 @@ -# -# Option specification file for CVC4 -# See src/options/base_options for a description of this file format -# - -module ARITH "options/arith_options.h" Arithmetic theory - -option arithUnateLemmaMode --unate-lemmas=MODE ArithUnateLemmaMode :handler stringToArithUnateLemmaMode :default ALL_PRESOLVE_LEMMAS :include "options/arith_unate_lemma_mode.h" - determines which lemmas to add before solving (default is 'all', see --unate-lemmas=help) - -option arithPropagationMode --arith-prop=MODE ArithPropagationMode :handler stringToArithPropagationMode :default BOTH_PROP :include "options/arith_propagation_mode.h" - turns on arithmetic propagation (default is 'old', see --arith-prop=help) - -# The maximum number of difference pivots to do per invocation of simplex. -# If this is negative, the number of pivots done is the number of variables. -# If this is not set by the user, different logics are free to chose different -# defaults. -option arithHeuristicPivots --heuristic-pivots=N int16_t :default 0 :read-write - the number of times to apply the heuristic pivot rule; if N < 0, this defaults to the number of variables; if this is unset, this is tuned by the logic selection - -# The maximum number of variable order pivots to do per invocation of simplex. -# If this is negative, the number of pivots done is unlimited. -# If this is not set by the user, different logics are free to chose different -# defaults. -expert-option arithStandardCheckVarOrderPivots --standard-effort-variable-order-pivots=N int16_t :default -1 :read-write - limits the number of pivots in a single invocation of check() at a non-full effort level using Bland's pivot rule - -option arithErrorSelectionRule --error-selection-rule=RULE ErrorSelectionRule :handler stringToErrorSelectionRule :default MINIMUM_AMOUNT :include "options/arith_heuristic_pivot_rule.h" - change the pivot rule for the basic variable (default is 'min', see --pivot-rule help) - -# The number of pivots before simplex rechecks every basic variable for a conflict -option arithSimplexCheckPeriod --simplex-check-period=N uint16_t :default 200 - the number of pivots to do in simplex before rechecking for a conflict on all variables - -# This is the pivots per basic variable that can be done using heuristic choices -# before variable order must be used. -# If this is not set by the user, different logics are free to chose different -# defaults. -option arithPivotThreshold --pivot-threshold=N uint16_t :default 2 :read-write - sets the number of pivots using --pivot-rule per basic variable per simplex instance before using variable order - -option arithPropagateMaxLength --prop-row-length=N uint16_t :default 16 - sets the maximum row length to be used in propagation - -option arithDioSolver --enable-dio-solver/--disable-dio-solver bool :default true - turns on Linear Diophantine Equation solver (Griggio, JSAT 2012) -/turns off Linear Diophantine Equation solver (Griggio, JSAT 2012) - -# Whether to split (= x y) into (and (<= x y) (>= x y)) in -# arithmetic preprocessing. -option arithRewriteEq --enable-arith-rewrite-equalities/--disable-arith-rewrite-equalities bool :default false :read-write - turns on the preprocessing rewrite turning equalities into a conjunction of inequalities -/turns off the preprocessing rewrite turning equalities into a conjunction of inequalities - - -option arithMLTrick miplib-trick --enable-miplib-trick/--disable-miplib-trick bool :default false - turns on the preprocessing step of attempting to infer bounds on miplib problems -/turns off the preprocessing step of attempting to infer bounds on miplib problems - -option arithMLTrickSubstitutions miplib-trick-subs --miplib-trick-subs=N unsigned :default 1 - do substitution for miplib 'tmp' vars if defined in <= N eliminated vars - -option doCutAllBounded --cut-all-bounded bool :default false :read-write - turns on the integer solving step of periodically cutting all integer variables that have both upper and lower bounds -/turns off the integer solving step of periodically cutting all integer variables that have both upper and lower bounds - -option maxCutsInContext --maxCutsInContext unsigned :default 65535 - maximum cuts in a given context before signalling a restart - -option revertArithModels --revert-arith-models-on-unsat bool :default false - revert the arithmetic model to a known safe model on unsat if one is cached - -option havePenalties --fc-penalties bool :default false :read-write - turns on degenerate pivot penalties -/turns off degenerate pivot penalties - -option useFC --use-fcsimplex bool :default false :read-write - use focusing and converging simplex (FMCAD 2013 submission) - -option useSOI --use-soi bool :default false :read-write - use sum of infeasibility simplex (FMCAD 2013 submission) - -option restrictedPivots --restrict-pivots bool :default true :read-write - have a pivot cap for simplex at effort levels below fullEffort - -option collectPivots --collect-pivot-stats bool :default false :read-write - collect the pivot history - -option useApprox --use-approx bool :default false :read-write - attempt to use an approximate solver - -option maxApproxDepth --approx-branch-depth int16_t :default 200 :read-write - maximum branch depth the approximate solver is allowed to take - -option exportDioDecompositions --dio-decomps bool :default false :read-write - let skolem variables for integer divisibility constraints leak from the dio solver - -option newProp --new-prop bool :default false :read-write - use the new row propagation system - -option arithPropAsLemmaLength --arith-prop-clauses uint16_t :default 8 :read-write - rows shorter than this are propagated as clauses - -option soiQuickExplain --soi-qe bool :default false :read-write - use quick explain to minimize the sum of infeasibility conflicts - -option rewriteDivk rewrite-divk --rewrite-divk bool :default false :read-write - rewrite division and mod when by a constant into linear terms - -option trySolveIntStandardEffort --se-solve-int bool :default false - attempt to use the approximate solve integer method on standard effort - -option replayFailureLemma --lemmas-on-replay-failure bool :default false - attempt to use external lemmas if approximate solve integer failed - -option dioSolverTurns --dio-turns int :default 10 - turns in a row dio solver cutting gets - -option rrTurns --rr-turns int :default 3 - round robin turn - -option dioRepeat --dio-repeat bool :default false - handle dio solver constraints in mass or one at a time - -option replayEarlyCloseDepths --replay-early-close-depth int :default 1 - multiples of the depths to try to close the approx log eagerly - -option replayFailurePenalty --replay-failure-penalty int :default 100 - number of solve integer attempts to skips after a numeric failure - -option replayNumericFailurePenalty --replay-num-err-penalty int :default 4194304 - number of solve integer attempts to skips after a numeric failure - -option replayRejectCutSize --replay-reject-cut unsigned :default 25500 - maximum complexity of any coefficient while replaying cuts - -option lemmaRejectCutSize --replay-lemma-reject-cut unsigned :default 25500 - maximum complexity of any coefficient while outputting replaying cut lemmas - -option soiApproxMajorFailure --replay-soi-major-threshold double :default .01 - threshold for a major tolerance failure by the approximate solver - -option soiApproxMajorFailurePen --replay-soi-major-threshold-pen int :default 50 - threshold for a major tolerance failure by the approximate solver - -option soiApproxMinorFailure --replay-soi-minor-threshold double :default .0001 - threshold for a minor tolerance failure by the approximate solver - -option soiApproxMinorFailurePen --replay-soi-minor-threshold-pen int :default 10 - threshold for a minor tolerance failure by the approximate solver - -option ppAssertMaxSubSize --pp-assert-max-sub-size unsigned :default 2 - threshold for substituting an equality in ppAssert - -option maxReplayTree --max-replay-tree int :default 512 - threshold for attempting to replay a tree - -option arithNoPartialFun --arith-no-partial-fun bool :default false - do not use partial function semantics for arithmetic (not SMT LIB compliant) - -option pbRewrites --pb-rewrites bool :default false - apply pseudo boolean rewrites - -option pbRewriteThreshold --pb-rewrite-threshold int :default 256 - threshold of number of pseudoboolean variables to have before doing rewrites - -option sNormInferEq --snorm-infer-eq bool :default false - infer equalities based on Shostak normalization - -option nlExt --nl-ext bool :default true - extended approach to non-linear - -option nlExtResBound --nl-ext-rbound bool :default false - use resolution-style inference for inferring new bounds - -option nlExtFactor --nl-ext-factor bool :default true - use factoring inference in non-linear solver - -option nlExtTangentPlanes --nl-ext-tplanes bool :default false - use non-terminating tangent plane strategy for non-linear - -option nlExtTfTangentPlanes --nl-ext-tf-tplanes bool :default false - use non-terminating tangent plane strategy for transcendental functions for non-linear - -option nlExtEntailConflicts --nl-ext-ent-conf bool :default false - check for entailed conflicts in non-linear solver - -option nlExtRewrites --nl-ext-rewrite bool :default true - do rewrites in non-linear solver - -option nlExtSolveSubs --nl-ext-solve-subs bool :default false - do solving for determining constant substitutions - -option nlExtPurify --nl-ext-purify bool :default false - purify non-linear terms at preprocess - -option nlExtSplitZero --nl-ext-split-zero bool :default false - intial splits on zero for all variables - -option nlExtTfTaylorDegree --nl-ext-tf-taylor-deg=N int16_t :default 4 :read-write - initial degree of polynomials for Taylor approximation - -option nlExtTfIncPrecision --nl-ext-tf-inc-prec bool :default true - whether to increment the precision for transcendental function constraints - -endmodule diff --git a/src/options/arith_options.toml b/src/options/arith_options.toml new file mode 100644 index 000000000..dc7b95d58 --- /dev/null +++ b/src/options/arith_options.toml @@ -0,0 +1,540 @@ +id = "ARITH" +name = "Arithmetic theory" +header = "options/arith_options.h" + +[[option]] + name = "arithUnateLemmaMode" + category = "regular" + long = "unate-lemmas=MODE" + type = "ArithUnateLemmaMode" + default = "ALL_PRESOLVE_LEMMAS" + handler = "stringToArithUnateLemmaMode" + includes = ["options/arith_unate_lemma_mode.h"] + read_only = true + help = "determines which lemmas to add before solving (default is 'all', see --unate-lemmas=help)" + +[[option]] + name = "arithPropagationMode" + category = "regular" + long = "arith-prop=MODE" + type = "ArithPropagationMode" + default = "BOTH_PROP" + handler = "stringToArithPropagationMode" + includes = ["options/arith_propagation_mode.h"] + read_only = true + help = "turns on arithmetic propagation (default is 'old', see --arith-prop=help)" + +# The maximum number of difference pivots to do per invocation of simplex. +# If this is negative, the number of pivots done is the number of variables. +# If this is not set by the user, different logics are free to chose different +# defaults. +[[option]] + name = "arithHeuristicPivots" + category = "regular" + long = "heuristic-pivots=N" + type = "int16_t" + default = "0" + help = "the number of times to apply the heuristic pivot rule; if N < 0, this defaults to the number of variables; if this is unset, this is tuned by the logic selection" + + +# The maximum number of variable order pivots to do per invocation of simplex. +# If this is negative, the number of pivots done is unlimited. +# If this is not set by the user, different logics are free to chose different +# defaults. +[[option]] + name = "arithStandardCheckVarOrderPivots" + category = "expert" + long = "standard-effort-variable-order-pivots=N" + type = "int16_t" + default = "-1" + help = "limits the number of pivots in a single invocation of check() at a non-full effort level using Bland's pivot rule" + +[[option]] + name = "arithErrorSelectionRule" + category = "regular" + long = "error-selection-rule=RULE" + type = "ErrorSelectionRule" + default = "MINIMUM_AMOUNT" + handler = "stringToErrorSelectionRule" + includes = ["options/arith_heuristic_pivot_rule.h"] + read_only = true + help = "change the pivot rule for the basic variable (default is 'min', see --pivot-rule help)" + +# The number of pivots before simplex rechecks every basic variable for a conflict +[[option]] + name = "arithSimplexCheckPeriod" + category = "regular" + long = "simplex-check-period=N" + type = "uint16_t" + default = "200" + read_only = true + help = "the number of pivots to do in simplex before rechecking for a conflict on all variables" + +# This is the pivots per basic variable that can be done using heuristic choices +# before variable order must be used. +# If this is not set by the user, different logics are free to chose different +# defaults. +[[option]] + name = "arithPivotThreshold" + category = "regular" + long = "pivot-threshold=N" + type = "uint16_t" + default = "2" + help = "sets the number of pivots using --pivot-rule per basic variable per simplex instance before using variable order" + +[[option]] + name = "arithPropagateMaxLength" + category = "regular" + long = "prop-row-length=N" + type = "uint16_t" + default = "16" + read_only = true + help = "sets the maximum row length to be used in propagation" + +[[option]] + name = "arithDioSolver" + category = "regular" + long = "dio-solver" + type = "bool" + default = "true" + read_only = true + help = "turns on Linear Diophantine Equation solver (Griggio, JSAT 2012)" + +# Whether to split (= x y) into (and (<= x y) (>= x y)) in +# arithmetic preprocessing. +[[option]] + name = "arithRewriteEq" + category = "regular" + long = "arith-rewrite-equalities" + type = "bool" + default = "false" + help = "turns on the preprocessing rewrite turning equalities into a conjunction of inequalities" + +[[option]] + name = "arithMLTrick" + smt_name = "miplib-trick" + category = "regular" + long = "miplib-trick" + type = "bool" + default = "false" + read_only = true + help = "turns on the preprocessing step of attempting to infer bounds on miplib problems" + +[[option]] + name = "arithMLTrickSubstitutions" + smt_name = "miplib-trick-subs" + category = "regular" + long = "miplib-trick-subs=N" + type = "unsigned" + default = "1" + read_only = true + help = "do substitution for miplib 'tmp' vars if defined in <= N eliminated vars" + +[[option]] + name = "doCutAllBounded" + category = "regular" + long = "cut-all-bounded" + type = "bool" + default = "false" + help = "turns on the integer solving step of periodically cutting all integer variables that have both upper and lower bounds" + +[[option]] + name = "maxCutsInContext" + category = "regular" + long = "maxCutsInContext" + type = "unsigned" + default = "65535" + read_only = true + help = "maximum cuts in a given context before signalling a restart" + +[[option]] + name = "revertArithModels" + category = "regular" + long = "revert-arith-models-on-unsat" + type = "bool" + default = "false" + read_only = true + help = "revert the arithmetic model to a known safe model on unsat if one is cached" + +[[option]] + name = "havePenalties" + category = "regular" + long = "fc-penalties" + type = "bool" + default = "false" + help = "turns on degenerate pivot penalties" + +[[option]] + name = "useFC" + category = "regular" + long = "use-fcsimplex" + type = "bool" + default = "false" + help = "use focusing and converging simplex (FMCAD 2013 submission)" + +[[option]] + name = "useSOI" + category = "regular" + long = "use-soi" + type = "bool" + default = "false" + help = "use sum of infeasibility simplex (FMCAD 2013 submission)" + +[[option]] + name = "restrictedPivots" + category = "regular" + long = "restrict-pivots" + type = "bool" + default = "true" + help = "have a pivot cap for simplex at effort levels below fullEffort" + +[[option]] + name = "collectPivots" + category = "regular" + long = "collect-pivot-stats" + type = "bool" + default = "false" + help = "collect the pivot history" + +[[option]] + name = "useApprox" + category = "regular" + long = "use-approx" + type = "bool" + default = "false" + help = "attempt to use an approximate solver" + +[[option]] + name = "maxApproxDepth" + category = "regular" + long = "approx-branch-depth" + type = "int16_t" + default = "200" + help = "maximum branch depth the approximate solver is allowed to take" + +[[option]] + name = "exportDioDecompositions" + category = "regular" + long = "dio-decomps" + type = "bool" + default = "false" + help = "let skolem variables for integer divisibility constraints leak from the dio solver" + +[[option]] + name = "newProp" + category = "regular" + long = "new-prop" + type = "bool" + default = "false" + help = "use the new row propagation system" + +[[option]] + name = "arithPropAsLemmaLength" + category = "regular" + long = "arith-prop-clauses" + type = "uint16_t" + default = "8" + help = "rows shorter than this are propagated as clauses" + +[[option]] + name = "soiQuickExplain" + category = "regular" + long = "soi-qe" + type = "bool" + default = "false" + help = "use quick explain to minimize the sum of infeasibility conflicts" + +[[option]] + name = "rewriteDivk" + category = "regular" + long = "rewrite-divk" + type = "bool" + default = "false" + help = "rewrite division and mod when by a constant into linear terms" + +[[option]] + name = "trySolveIntStandardEffort" + category = "regular" + long = "se-solve-int" + type = "bool" + default = "false" + read_only = true + help = "attempt to use the approximate solve integer method on standard effort" + +[[option]] + name = "replayFailureLemma" + category = "regular" + long = "lemmas-on-replay-failure" + type = "bool" + default = "false" + read_only = true + help = "attempt to use external lemmas if approximate solve integer failed" + +[[option]] + name = "dioSolverTurns" + category = "regular" + long = "dio-turns" + type = "int" + default = "10" + read_only = true + help = "turns in a row dio solver cutting gets" + +[[option]] + name = "rrTurns" + category = "regular" + long = "rr-turns" + type = "int" + default = "3" + read_only = true + help = "round robin turn" + +[[option]] + name = "dioRepeat" + category = "regular" + long = "dio-repeat" + type = "bool" + default = "false" + read_only = true + help = "handle dio solver constraints in mass or one at a time" + +[[option]] + name = "replayEarlyCloseDepths" + category = "regular" + long = "replay-early-close-depth" + type = "int" + default = "1" + read_only = true + help = "multiples of the depths to try to close the approx log eagerly" + +[[option]] + name = "replayFailurePenalty" + category = "regular" + long = "replay-failure-penalty" + type = "int" + default = "100" + read_only = true + help = "number of solve integer attempts to skips after a numeric failure" + +[[option]] + name = "replayNumericFailurePenalty" + category = "regular" + long = "replay-num-err-penalty" + type = "int" + default = "4194304" + read_only = true + help = "number of solve integer attempts to skips after a numeric failure" + +[[option]] + name = "replayRejectCutSize" + category = "regular" + long = "replay-reject-cut" + type = "unsigned" + default = "25500" + read_only = true + help = "maximum complexity of any coefficient while replaying cuts" + +[[option]] + name = "lemmaRejectCutSize" + category = "regular" + long = "replay-lemma-reject-cut" + type = "unsigned" + default = "25500" + read_only = true + help = "maximum complexity of any coefficient while outputting replaying cut lemmas" + +[[option]] + name = "soiApproxMajorFailure" + category = "regular" + long = "replay-soi-major-threshold" + type = "double" + default = ".01" + read_only = true + help = "threshold for a major tolerance failure by the approximate solver" + +[[option]] + name = "soiApproxMajorFailurePen" + category = "regular" + long = "replay-soi-major-threshold-pen" + type = "int" + default = "50" + read_only = true + help = "threshold for a major tolerance failure by the approximate solver" + +[[option]] + name = "soiApproxMinorFailure" + category = "regular" + long = "replay-soi-minor-threshold" + type = "double" + default = ".0001" + read_only = true + help = "threshold for a minor tolerance failure by the approximate solver" + +[[option]] + name = "soiApproxMinorFailurePen" + category = "regular" + long = "replay-soi-minor-threshold-pen" + type = "int" + default = "10" + read_only = true + help = "threshold for a minor tolerance failure by the approximate solver" + +[[option]] + name = "ppAssertMaxSubSize" + category = "regular" + long = "pp-assert-max-sub-size" + type = "unsigned" + default = "2" + read_only = true + help = "threshold for substituting an equality in ppAssert" + +[[option]] + name = "maxReplayTree" + category = "regular" + long = "max-replay-tree" + type = "int" + default = "512" + read_only = true + help = "threshold for attempting to replay a tree" + +[[option]] + name = "arithNoPartialFun" + category = "regular" + long = "arith-no-partial-fun" + type = "bool" + default = "false" + read_only = true + help = "do not use partial function semantics for arithmetic (not SMT LIB compliant)" + +[[option]] + name = "pbRewrites" + category = "regular" + long = "pb-rewrites" + type = "bool" + default = "false" + read_only = true + help = "apply pseudo boolean rewrites" + +[[option]] + name = "pbRewriteThreshold" + category = "regular" + long = "pb-rewrite-threshold" + type = "int" + default = "256" + read_only = true + help = "threshold of number of pseudoboolean variables to have before doing rewrites" + +[[option]] + name = "sNormInferEq" + category = "regular" + long = "snorm-infer-eq" + type = "bool" + default = "false" + read_only = true + help = "infer equalities based on Shostak normalization" + +[[option]] + name = "nlExt" + category = "regular" + long = "nl-ext" + type = "bool" + default = "true" + read_only = true + help = "extended approach to non-linear" + +[[option]] + name = "nlExtResBound" + category = "regular" + long = "nl-ext-rbound" + type = "bool" + default = "false" + read_only = true + help = "use resolution-style inference for inferring new bounds" + +[[option]] + name = "nlExtFactor" + category = "regular" + long = "nl-ext-factor" + type = "bool" + default = "true" + read_only = true + help = "use factoring inference in non-linear solver" + +[[option]] + name = "nlExtTangentPlanes" + category = "regular" + long = "nl-ext-tplanes" + type = "bool" + default = "false" + read_only = true + help = "use non-terminating tangent plane strategy for non-linear" + +[[option]] + name = "nlExtTfTangentPlanes" + category = "regular" + long = "nl-ext-tf-tplanes" + type = "bool" + default = "false" + read_only = true + help = "use non-terminating tangent plane strategy for transcendental functions for non-linear" + +[[option]] + name = "nlExtEntailConflicts" + category = "regular" + long = "nl-ext-ent-conf" + type = "bool" + default = "false" + read_only = true + help = "check for entailed conflicts in non-linear solver" + +[[option]] + name = "nlExtRewrites" + category = "regular" + long = "nl-ext-rewrite" + type = "bool" + default = "true" + read_only = true + help = "do rewrites in non-linear solver" + +[[option]] + name = "nlExtSolveSubs" + category = "regular" + long = "nl-ext-solve-subs" + type = "bool" + default = "false" + read_only = true + help = "do solving for determining constant substitutions" + +[[option]] + name = "nlExtPurify" + category = "regular" + long = "nl-ext-purify" + type = "bool" + default = "false" + read_only = true + help = "purify non-linear terms at preprocess" + +[[option]] + name = "nlExtSplitZero" + category = "regular" + long = "nl-ext-split-zero" + type = "bool" + default = "false" + read_only = true + help = "intial splits on zero for all variables" + +[[option]] + name = "nlExtTfTaylorDegree" + category = "regular" + long = "nl-ext-tf-taylor-deg=N" + type = "int16_t" + default = "4" + help = "initial degree of polynomials for Taylor approximation" + +[[option]] + name = "nlExtTfIncPrecision" + category = "regular" + long = "nl-ext-tf-inc-prec" + type = "bool" + default = "true" + read_only = true + help = "whether to increment the precision for transcendental function constraints" diff --git a/src/options/arrays_options b/src/options/arrays_options deleted file mode 100644 index 371554a2b..000000000 --- a/src/options/arrays_options +++ /dev/null @@ -1,35 +0,0 @@ -# -# Option specification file for CVC4 -# See src/options/base_options for a description of this file format -# - -module ARRAYS "options/arrays_options.h" Arrays theory - -option arraysOptimizeLinear --arrays-optimize-linear bool :default true :read-write - turn on optimization for linear array terms (see de Moura FMCAD 09 arrays paper) - -option arraysLazyRIntro1 --arrays-lazy-rintro1 bool :default true :read-write - turn on optimization to only perform RIntro1 rule lazily (see Jovanovic/Barrett 2012: Being Careful with Theory Combination) - -option arraysWeakEquivalence --arrays-weak-equiv bool :default false :read-write - use algorithm from Christ/Hoenicke (SMT 2014) - -option arraysModelBased --arrays-model-based bool :default false :read-write - turn on model-based array solver - -option arraysEagerIndexSplitting --arrays-eager-index bool :default true :read-write - turn on eager index splitting for generated array lemmas - -option arraysEagerLemmas --arrays-eager-lemmas bool :default false :read-write - turn on eager lemma generation for arrays - -option arraysConfig --arrays-config int :default 0 :read-write - set different array option configurations - for developers only - -option arraysReduceSharing --arrays-reduce-sharing bool :default false :read-write - use model information to reduce size of care graph for arrays - -option arraysPropagate --arrays-prop int :default 2 :read-write - propagation effort for arrays: 0 is none, 1 is some, 2 is full - -endmodule diff --git a/src/options/arrays_options.toml b/src/options/arrays_options.toml new file mode 100644 index 000000000..c6021adb9 --- /dev/null +++ b/src/options/arrays_options.toml @@ -0,0 +1,75 @@ +id = "ARRAYS" +name = "Arrays theory" +header = "options/arrays_options.h" + +[[option]] + name = "arraysOptimizeLinear" + category = "regular" + long = "arrays-optimize-linear" + type = "bool" + default = "true" + help = "turn on optimization for linear array terms (see de Moura FMCAD 09 arrays paper)" + +[[option]] + name = "arraysLazyRIntro1" + category = "regular" + long = "arrays-lazy-rintro1" + type = "bool" + default = "true" + help = "turn on optimization to only perform RIntro1 rule lazily (see Jovanovic/Barrett 2012: Being Careful with Theory Combination)" + +[[option]] + name = "arraysWeakEquivalence" + category = "regular" + long = "arrays-weak-equiv" + type = "bool" + default = "false" + help = "use algorithm from Christ/Hoenicke (SMT 2014)" + +[[option]] + name = "arraysModelBased" + category = "regular" + long = "arrays-model-based" + type = "bool" + default = "false" + help = "turn on model-based array solver" + +[[option]] + name = "arraysEagerIndexSplitting" + category = "regular" + long = "arrays-eager-index" + type = "bool" + default = "true" + help = "turn on eager index splitting for generated array lemmas" + +[[option]] + name = "arraysEagerLemmas" + category = "regular" + long = "arrays-eager-lemmas" + type = "bool" + default = "false" + help = "turn on eager lemma generation for arrays" + +[[option]] + name = "arraysConfig" + category = "regular" + long = "arrays-config" + type = "int" + default = "0" + help = "set different array option configurations - for developers only" + +[[option]] + name = "arraysReduceSharing" + category = "regular" + long = "arrays-reduce-sharing" + type = "bool" + default = "false" + help = "use model information to reduce size of care graph for arrays" + +[[option]] + name = "arraysPropagate" + category = "regular" + long = "arrays-prop" + type = "int" + default = "2" + help = "propagation effort for arrays: 0 is none, 1 is some, 2 is full" diff --git a/src/options/base_options b/src/options/base_options deleted file mode 100644 index 7098e1f5d..000000000 --- a/src/options/base_options +++ /dev/null @@ -1,213 +0,0 @@ -# -# Option specification file for CVC4 -# -# This is essentially a shell script interpreted with special commands. -# -# Lines starting with whitespace are special. They are passed in their entirety -# (minus the first whitespace char) to the "doc" command. Lines starting with a -# single slash are stripped of this initial character and interpreted by the -# "doc-alt" command. A period "." in the first column of a line, followed -# optionally by whitespace but without any other content on the line, is -# interpreted as an empty string passed to doc. (This allows multi-paragraph -# documentation for options.) Lines may be continued with a backslash (\) at the -# end of a line. -# -# commands are: -# -# module ID "include-file" name -# -# Identifies the module. Must be the first command in the file. ID is a -# suitable identifier for a preprocessor definition, and should be unique; -# name is a "pretty" name used for the benefit of the end CVC4 user in, e.g., -# option listings. -# -# common-option SPECIFICATION -# option SPECIFICATION -# expert-option SPECIFICATION -# undocumented-option SPECIFICATION -# -# These commands declare (respectively) common options presented first to the -# user, standard options that the user might want to see with "--help" -# documentation, expert options that should be marked as expert-only, and -# options that should not appear in normal option documentation (even if -# documentation is included here). -# -# SPECIFICATIONs take this form: -# -# SPECIFICATION ::= (internal-name | -) [smt-option-name] [-short-option/-alternate-short-option] [--long-option/--alternate-long-option] C++-type [ATTRIBUTEs...] -# ATTRIBUTE ::= :include include-files.. -# | :default C++-expression -# | :handler custom-option-handlers.. -# | :handler-include include-files.. -# | :predicate custom-option-handlers.. -# | :predicate-include include-files.. -# | :notify custom-option-notifications.. -# | :read-only -# | :read-write -# | :link linked-options.. -# | :link-smt linked-option [value] -# -# common-alias ALIAS_SPECIFICATION -# alias ALIAS_SPECIFICATION -# expert-alias ALIAS_SPECIFICATION -# undocumented-alias ALIAS_SPECIFICATION -# -# ALIAS_SPECIFICATION ::= (-short-option | --long-option) = (-option[=argument] | --long-option[=argument])+ -# | (-short-option=ARG | --long-option=ARG) = (-option[=ARG|argument] | --long-option[=ARG|argument])+ -# -# The alias command creates a new short or long option, and binds it -# to act the same way as if the options to the right of "=" were passed. -# For example, if there are options to --disable-warning-1 and -# --disable-warning-2, etc., a useful alias might be: -# -# alias --disable-all-warnings = --disable-warning-1 --disable-warning-2 -# -# It's also possible to pass an argument through to another option. -# This alias makes "--output-language" synonymous with "--output-lang". -# Without the "=L" parts, --output-language would not take an argument, -# and option processing would fail (because --output-lang expects one). -# -# alias --output-language=L = --output-lang=L -# -# You can also ignore such an argument: -# -# alias --some-option=VALUE = --other-option --option2=foo --option3=bar -# -# or use it for multiple options on the right-hand side, etc. -# -# warning message -# -# Warn about something during processing (like a FIXME). -# -# endmodule -# -# This file should end with the "endmodule" command, and nothing should -# follow it. -# -# -# The options/ package supports a wide range of operations for responding to -# an option being set. Roughly the three major concepts are: -# - :handler is to parse an option before setting its value. -# - :predicate is to reject bad values for the option. -# - :notify is used for dynamic dispatch after an option is assigned. -# -# More details on each class of custom handlers. -# :handler custom-option-handler -# Handlers provide support for parsing custom types and parsing for options. -# The signature for a handler call is: -# T custom-option-handler(std::string option, std::string optarg, -# OptionsHandler* handler); -# where T is the type of the option. The suggested implementation is to -# implement custom-handler as a dispatch into a function on handler with the -# signature: -# T OptionsHandler::custom-option-handler(std::string option, -# std::string optarg); -# The handlers are run before predicates and notifications. -# Having multiple handlers is considered bad practice and is unsupported. -# Handlers may have arbitrary side effects, but should call no code -# inaccessible to liboptions. For side effects that are not required in order -# to parse the option, using :predicate is recommended. Use :notify to -# achieve dynamic dispatch outside of base/, lib/, and options/. Memory -# management done by a handler needs to either be encapsulated by the type -# and the destructor for the type or should *always* be owned by handler. More -# elaborate memory management schemes are not currently supported. -# -# :predicate custom-predicate -# Predicates provide support for checking whether or not the value of an -# is acceptable. Predicates are run after handlers and before notifications. -# The signature for a predicate call is: -# void custom-predicate(std::string option, T value, -# OptionsHandler* handler); -# where T is the type of the option. The suggested implementation is to -# implement custom-predicate as a dispatch into a function on handler with the -# signature: -# void OptionsHandler::custom-predicate(std::string option, T value); -# The predicates are run after handlers and before notifications. Multiple -# predicates may be defined for the same option, but the order they are run -# is not guaranteed. Predicates may have arbitrary side effects, but should -# call no code inaccessible to liboptions. Use :notify to -# achieve dynamic dispatch outside of base/, lib/, and options/. -# Predicates are expected to reject bad value for the option by throwing an -# OptionsException. -# -# :notify custom-notification -# This allows for the installation of custom post-processing callbacks using -# the Listener infrastructure. custom-option-notification is a C++ function -# that is called after the assignment of the option is updated. -# The normal usage of an notify is to call a Listener that is registered for -# this specific option. This is how dynamic dispatch outside of the -# liboptions package should always be done. -# The signature of custom-option-notification should take an option name as -# well as an OptionsHandler*. -# void custom-notification( -# const std::string& option, CVC4::options::OptionsHandler* handler); -# The name is provided so multiple options can use the same notification -# implementation. -# This is called after all handlers and predicates have been run. -# Formally, this is always placed at the end of either the generated -# Options::assign or Options::assignBool function for the option. -# Because of this :notify cannot be used with void type options. -# Users of this feature should *always* check the code generated in -# builds/src/options/options.cpp for the correctness of the placement of the -# generated code. The Listener notify() function is allowed to throw -# an arbitrary std::exception. -# - -module BASE "options/base_options.h" Base - -option binary_name std::string - -option in std::istream* :default &std::cin :include -option out std::ostream* :default &std::cout :include -option err std::ostream* :default &std::cerr :include - -common-option inputLanguage input-language -L --lang=LANG InputLanguage :handler stringToInputLanguage :include "options/language.h" :default language::input::LANG_AUTO :read-write - force input language (default is "auto"; see --lang help) -common-option outputLanguage output-language --output-lang=LANG OutputLanguage :handler stringToOutputLanguage :include "options/language.h" :default language::output::LANG_AUTO :read-write - force output language (default is "auto"; see --output-lang help) -option languageHelp bool - -# Allow also --language and --output-language, it's a common mistake to -# type these, but no need to document it. -undocumented-alias --language=L = --lang=L -undocumented-alias --output-language=L = --output-lang=L - -option verbosity verbosity int :read-write :default 0 :predicate setVerbosity - the verbosity level of CVC4 -common-option - -v --verbose void :handler increaseVerbosity - increase verbosity (may be repeated) -common-option - -q --quiet void :handler decreaseVerbosity - decrease verbosity (may be repeated) - -common-option statistics statistics --stats bool :predicate statsEnabledBuild - give statistics on exit -undocumented-alias --statistics = --stats -undocumented-alias --no-statistics = --no-stats -option statsEveryQuery --stats-every-query bool :default false :link --stats :link-smt statistics - in incremental mode, print stats after every satisfiability or validity query -undocumented-alias --statistics-every-query = --stats-every-query -undocumented-alias --no-statistics-every-query = --no-stats-every-query -option statsHideZeros --stats-hide-zeros/--stats-show-zeros bool :default false - hide statistics which are zero -/show statistics even when they are zero (default) -undocumented-alias --hide-zero-stats = --stats-hide-zeros -undocumented-alias --show-zero-stats = --stats-show-zeros - -option parseOnly parse-only --parse-only bool :read-write - exit after parsing input - -option preprocessOnly preprocess-only --preprocess-only bool - exit after preprocessing input - -option - trace -t --trace=TAG argument :handler enableTraceTag - trace something (e.g. -t pushpop), can repeat -option - debug -d --debug=TAG argument :handler enableDebugTag - debug something (e.g. -d arith), can repeat - -option printSuccess print-success --print-success bool :notify notifyPrintSuccess - print the "success" output required of SMT-LIBv2 - -alias --smtlib-strict = --lang=smt2 --output-lang=smt2 --strict-parsing --default-expr-depth=-1 --print-success --incremental --abstract-values - SMT-LIBv2 compliance mode (implies other options) - -endmodule diff --git a/src/options/base_options.toml b/src/options/base_options.toml new file mode 100644 index 000000000..15ace0869 --- /dev/null +++ b/src/options/base_options.toml @@ -0,0 +1,208 @@ +id = "BASE" +name = "Base" +header = "options/base_options.h" + +[[option]] + name = "binary_name" + category = "undocumented" + type = "std::string" + +[[option]] + name = "in" + category = "undocumented" + type = "std::istream*" + default = "&std::cin" + includes = [""] + +[[option]] + name = "out" + category = "undocumented" + type = "std::ostream*" + default = "&std::cout" + includes = [""] + +[[option]] + name = "err" + category = "undocumented" + type = "std::ostream*" + default = "&std::cerr" + includes = [""] + +[[option]] + name = "inputLanguage" + smt_name = "input-language" + category = "common" + short = "L" + long = "lang=LANG" + type = "InputLanguage" + default = "language::input::LANG_AUTO" + handler = "stringToInputLanguage" + includes = ["options/language.h"] + help = "force input language (default is \"auto\"; see --lang help)" + +[[option]] + name = "outputLanguage" + smt_name = "output-language" + category = "common" + long = "output-lang=LANG" + type = "OutputLanguage" + default = "language::output::LANG_AUTO" + handler = "stringToOutputLanguage" + includes = ["options/language.h"] + help = "force output language (default is \"auto\"; see --output-lang help)" + +[[option]] + name = "languageHelp" + category = "undocumented" + type = "bool" + +[[alias]] + category = "undocumented" + long = "language=L" + links = ["--lang=L"] + +[[alias]] + category = "undocumented" + long = "output-language=L" + links = ["--output-lang=L"] + +[[option]] + name = "verbosity" + smt_name = "verbosity" + category = "regular" + type = "int" + default = "0" + predicates = ["setVerbosity"] + help = "the verbosity level of CVC4" + +[[option]] + category = "common" + short = "v" + long = "verbose" + type = "void" + handler = "increaseVerbosity" + read_only = true + help = "increase verbosity (may be repeated)" + +[[option]] + category = "common" + short = "q" + long = "quiet" + type = "void" + handler = "decreaseVerbosity" + read_only = true + help = "decrease verbosity (may be repeated)" + +[[option]] + name = "statistics" + smt_name = "statistics" + category = "common" + long = "stats" + type = "bool" + predicates = ["statsEnabledBuild"] + read_only = true + help = "give statistics on exit" + +[[alias]] + category = "undocumented" + long = "statistics" + links = ["--stats"] + +[[alias]] + category = "undocumented" + long = "no-statistics" + links = ["--no-stats"] + +[[option]] + name = "statsEveryQuery" + category = "regular" + long = "stats-every-query" + type = "bool" + default = "false" + links = ["--stats"] + read_only = true + help = "in incremental mode, print stats after every satisfiability or validity query" + +[[alias]] + category = "undocumented" + long = "statistics-every-query" + links = ["--stats-every-query"] + +[[alias]] + category = "undocumented" + long = "no-statistics-every-query" + links = ["--no-stats-every-query"] + +[[option]] + name = "statsHideZeros" + category = "regular" + long = "stats-hide-zeros" + type = "bool" + default = "false" + read_only = true + help = "hide statistics which are zero" + +[[alias]] + category = "undocumented" + long = "stats-show-zeros" + links = ["--no-stats-hide-zeros"] + +[[alias]] + category = "undocumented" + long = "hide-zero-stats" + links = ["--stats-hide-zeros"] + +[[alias]] + category = "undocumented" + long = "show-zero-stats" + links = ["--stats-show-zeros"] + +[[option]] + name = "parseOnly" + category = "regular" + long = "parse-only" + type = "bool" + help = "exit after parsing input" + +[[option]] + name = "preprocessOnly" + category = "regular" + long = "preprocess-only" + type = "bool" + read_only = true + help = "exit after preprocessing input" + +[[option]] + smt_name = "trace" + category = "regular" + short = "t" + long = "trace=TAG" + type = "std::string" + handler = "enableTraceTag" + read_only = true + help = "trace something (e.g. -t pushpop), can repeat" + +[[option]] + smt_name = "debug" + category = "regular" + short = "d" + long = "debug=TAG" + type = "std::string" + handler = "enableDebugTag" + read_only = true + help = "debug something (e.g. -d arith), can repeat" + +[[option]] + name = "printSuccess" + category = "regular" + long = "print-success" + type = "bool" + notifies = ["notifyPrintSuccess"] + read_only = true + help = "print the \"success\" output required of SMT-LIBv2" + +[[alias]] + category = "regular" + long = "smtlib-strict" + links = ["--lang=smt2", "--output-lang=smt2", "--strict-parsing", "--default-expr-depth=-1", "--print-success", "--incremental", "--abstract-values"] + help = "SMT-LIBv2 compliance mode (implies other options)" diff --git a/src/options/base_options_template.h b/src/options/base_options_template.h deleted file mode 100644 index 8fe3a390f..000000000 --- a/src/options/base_options_template.h +++ /dev/null @@ -1,55 +0,0 @@ -/********************* */ -/*! \file base_options_template.h - ** \verbatim - ** Top contributors (to current version): - ** Morgan Deters, Paul Meng, Tim King - ** This file is part of the CVC4 project. - ** Copyright (c) 2009-2017 by the authors listed in the file AUTHORS - ** in the top-level source directory) and their institutional affiliations. - ** All rights reserved. See the file COPYING in the top-level source - ** directory for licensing information.\endverbatim - ** - ** \brief Contains code for handling command-line options. - ** - ** Contains code for handling command-line options - **/ - -#include "cvc4_private.h" - -#ifndef __CVC4__OPTIONS__${module_id}_H -#define __CVC4__OPTIONS__${module_id}_H - -#include "options/options.h" -${module_includes} - -#line 26 "${template}" - -${module_optionholder_spec} - -#line 30 "${template}" - -namespace CVC4 { - -namespace options { - -${module_decls} - -#line 38 "${template}" - -}/* CVC4::options namespace */ - -${module_specializations} - -#line 44 "${template}" - -namespace options { - -${module_inlines} - -#line 50 "${template}" - -}/* CVC4::options namespace */ - -}/* CVC4 namespace */ - -#endif /* __CVC4__OPTIONS__${module_id}_H */ diff --git a/src/options/booleans_options b/src/options/booleans_options deleted file mode 100644 index 6143f4f67..000000000 --- a/src/options/booleans_options +++ /dev/null @@ -1,9 +0,0 @@ -# -# Option specification file for CVC4 -# See src/options/base_options for a description of this file format -# - -module BOOLEANS "options/booleans_options.h" Boolean theory - - -endmodule diff --git a/src/options/booleans_options.toml b/src/options/booleans_options.toml new file mode 100644 index 000000000..811e0fdd2 --- /dev/null +++ b/src/options/booleans_options.toml @@ -0,0 +1,3 @@ +id = "BOOLEANS" +name = "Boolean theory" +header = "options/booleans_options.h" diff --git a/src/options/builtin_options b/src/options/builtin_options deleted file mode 100644 index ea4229b67..000000000 --- a/src/options/builtin_options +++ /dev/null @@ -1,8 +0,0 @@ -# -# Option specification file for CVC4 -# See src/options/base_options for a description of this file format -# - -module BUILTIN "options/builtin_options.h" Builtin theory - -endmodule diff --git a/src/options/builtin_options.toml b/src/options/builtin_options.toml new file mode 100644 index 000000000..6ef79cd0b --- /dev/null +++ b/src/options/builtin_options.toml @@ -0,0 +1,3 @@ +id = "BUILTIN" +name = "Builtin theory" +header = "options/builtin_options.h" diff --git a/src/options/bv_options b/src/options/bv_options deleted file mode 100644 index f434339b0..000000000 --- a/src/options/bv_options +++ /dev/null @@ -1,87 +0,0 @@ -# -# Option specification file for CVC4 -# See src/options/base_options for a description of this file format -# - -module BV "options/bv_options.h" Bitvector theory - -# Option to set the bit-blasting mode (lazy, eager) - -expert-option bvSatSolver bv-sat-solver --bv-sat-solver=MODE CVC4::theory::bv::SatSolverMode :predicate satSolverEnabledBuild :handler stringToSatSolver :default CVC4::theory::bv::SAT_SOLVER_MINISAT :read-write :include "options/bv_bitblast_mode.h" - choose which sat solver to use, see --bv-sat-solver=help - -option bitblastMode bitblast --bitblast=MODE CVC4::theory::bv::BitblastMode :handler stringToBitblastMode :default CVC4::theory::bv::BITBLAST_MODE_LAZY :read-write :include "options/bv_bitblast_mode.h" - choose bitblasting mode, see --bitblast=help - -# Options for eager bit-blasting - -option bitvectorAig --bitblast-aig bool :default false :predicate abcEnabledBuild setBitblastAig :read-write - bitblast by first converting to AIG (implies --bitblast=eager) -expert-option bitvectorAigSimplifications --bv-aig-simp=COMMAND std::string :default "" :predicate abcEnabledBuild :read-write :link --bitblast-aig :link-smt bitblast-aig - abc command to run AIG simplifications (implies --bitblast-aig, default is "balance;drw") - -# Options for lazy bit-blasting -option bitvectorPropagate --bv-propagate bool :default true :read-write - use bit-vector propagation in the bit-blaster - -option bitvectorEqualitySolver --bv-eq-solver bool :default true :read-write - use the equality engine for the bit-vector theory (only if --bitblast=lazy) - -option bitvectorEqualitySlicer --bv-eq-slicer=MODE CVC4::theory::bv::BvSlicerMode :handler stringToBvSlicerMode :default CVC4::theory::bv::BITVECTOR_SLICER_OFF :read-write :include "options/bv_bitblast_mode.h" :read-write :link --bv-eq-solver :link-smt bv-eq-solver - turn on the slicing equality solver for the bit-vector theory (only if --bitblast=lazy) - - -option bitvectorInequalitySolver --bv-inequality-solver bool :default true :read-write - turn on the inequality solver for the bit-vector theory (only if --bitblast=lazy) - -option bitvectorAlgebraicSolver --bv-algebraic-solver bool :default true :read-write - turn on the algebraic solver for the bit-vector theory (only if --bitblast=lazy) - -expert-option bitvectorAlgebraicBudget --bv-algebraic-budget unsigned :default 1500 :read-write :link --bv-algebraic-solver :link-smt bv-algebraic-solver - the budget allowed for the algebraic solver in number of SAT conflicts - -# General options - -option bitvectorToBool --bv-to-bool bool :default false :read-write - lift bit-vectors of size 1 to booleans when possible - -option boolToBitvector --bool-to-bv bool :default false :read-write - convert booleans to bit-vectors of size 1 when possible - -option bitvectorDivByZeroConst --bv-div-zero-const bool :default false :read-write - always return -1 on division by zero - -expert-option bvExtractArithRewrite --bv-extract-arith bool :default false :read-write - enable rewrite pushing extract [i:0] over arithmetic operations (can blow up) - -expert-option bvAbstraction --bv-abstraction bool :default false :read-write - mcm benchmark abstraction - -expert-option skolemizeArguments --bv-skolemize bool :default false :read-write - skolemize arguments for bv abstraction (only does something if --bv-abstraction is on) - -expert-option bvNumFunc --bv-num-func=NUM unsigned :default 1 - number of function symbols in conflicts that are generalized - -expert-option bvEagerExplanations --bv-eager-explanations bool :default false :read-write - compute bit-blasting propagation explanations eagerly - -expert-option bitvectorQuickXplain --bv-quick-xplain bool :default false - minimize bv conflicts using the QuickXplain algorithm - -expert-option bvIntroducePow2 --bv-intro-pow2 bool :default false - introduce bitvector powers of two as a preprocessing pass - -expert-option bvGaussElim --bv-gauss-elim bool :default false - simplify formula via Gaussian Elimination if applicable - -option bvLazyRewriteExtf --bv-lazy-rewrite-extf bool :default true :read-write - lazily rewrite extended functions like bv2nat and int2bv - -option bvLazyReduceExtf --bv-lazy-reduce-extf bool :default false :read-write - reduce extended functions like bv2nat and int2bv at last call instead of full effort - -option bvAlgExtf --bv-alg-extf bool :default true :read-write - algebraic inferences for extended functions - -endmodule diff --git a/src/options/bv_options.toml b/src/options/bv_options.toml new file mode 100644 index 000000000..ed0bdce7a --- /dev/null +++ b/src/options/bv_options.toml @@ -0,0 +1,212 @@ +id = "BV" +name = "Bitvector theory" +header = "options/bv_options.h" + +[[option]] + name = "bvSatSolver" + smt_name = "bv-sat-solver" + category = "expert" + long = "bv-sat-solver=MODE" + type = "CVC4::theory::bv::SatSolverMode" + default = "CVC4::theory::bv::SAT_SOLVER_MINISAT" + handler = "stringToSatSolver" + predicates = ["satSolverEnabledBuild"] + includes = ["options/bv_bitblast_mode.h"] + help = "choose which sat solver to use, see --bv-sat-solver=help" + +[[option]] + name = "bitblastMode" + smt_name = "bitblast" + category = "regular" + long = "bitblast=MODE" + type = "CVC4::theory::bv::BitblastMode" + default = "CVC4::theory::bv::BITBLAST_MODE_LAZY" + handler = "stringToBitblastMode" + includes = ["options/bv_bitblast_mode.h"] + help = "choose bitblasting mode, see --bitblast=help" + +[[option]] + name = "bitvectorAig" + category = "regular" + long = "bitblast-aig" + type = "bool" + default = "false" + predicates = ["abcEnabledBuild", "setBitblastAig"] + help = "bitblast by first converting to AIG (implies --bitblast=eager)" + +[[option]] + name = "bitvectorAigSimplifications" + category = "expert" + long = "bv-aig-simp=COMMAND" + type = "std::string" + predicates = ["abcEnabledBuild"] + links = ["--bitblast-aig"] + help = "abc command to run AIG simplifications (implies --bitblast-aig, default is \"balance;drw\")" + +[[option]] + name = "bitvectorPropagate" + category = "regular" + long = "bv-propagate" + type = "bool" + default = "true" + help = "use bit-vector propagation in the bit-blaster" + +[[option]] + name = "bitvectorEqualitySolver" + category = "regular" + long = "bv-eq-solver" + type = "bool" + default = "true" + help = "use the equality engine for the bit-vector theory (only if --bitblast=lazy)" + +[[option]] + name = "bitvectorEqualitySlicer" + category = "regular" + long = "bv-eq-slicer=MODE" + type = "CVC4::theory::bv::BvSlicerMode" + default = "CVC4::theory::bv::BITVECTOR_SLICER_OFF" + handler = "stringToBvSlicerMode" + includes = ["options/bv_bitblast_mode.h"] + links = ["--bv-eq-solver"] + help = "turn on the slicing equality solver for the bit-vector theory (only if --bitblast=lazy)" + +[[option]] + name = "bitvectorInequalitySolver" + category = "regular" + long = "bv-inequality-solver" + type = "bool" + default = "true" + help = "turn on the inequality solver for the bit-vector theory (only if --bitblast=lazy)" + +[[option]] + name = "bitvectorAlgebraicSolver" + category = "regular" + long = "bv-algebraic-solver" + type = "bool" + default = "true" + help = "turn on the algebraic solver for the bit-vector theory (only if --bitblast=lazy)" + +[[option]] + name = "bitvectorAlgebraicBudget" + category = "expert" + long = "bv-algebraic-budget" + type = "unsigned" + default = "1500" + links = ["--bv-algebraic-solver"] + help = "the budget allowed for the algebraic solver in number of SAT conflicts" + +[[option]] + name = "bitvectorToBool" + category = "regular" + long = "bv-to-bool" + type = "bool" + default = "false" + help = "lift bit-vectors of size 1 to booleans when possible" + +[[option]] + name = "boolToBitvector" + category = "regular" + long = "bool-to-bv" + type = "bool" + default = "false" + help = "convert booleans to bit-vectors of size 1 when possible" + +[[option]] + name = "bitvectorDivByZeroConst" + category = "regular" + long = "bv-div-zero-const" + type = "bool" + default = "false" + help = "always return -1 on division by zero" + +[[option]] + name = "bvExtractArithRewrite" + category = "expert" + long = "bv-extract-arith" + type = "bool" + default = "false" + help = "enable rewrite pushing extract [i:0] over arithmetic operations (can blow up)" + +[[option]] + name = "bvAbstraction" + category = "expert" + long = "bv-abstraction" + type = "bool" + default = "false" + help = "mcm benchmark abstraction" + +[[option]] + name = "skolemizeArguments" + category = "expert" + long = "bv-skolemize" + type = "bool" + default = "false" + help = "skolemize arguments for bv abstraction (only does something if --bv-abstraction is on)" + +[[option]] + name = "bvNumFunc" + category = "expert" + long = "bv-num-func=NUM" + type = "unsigned" + default = "1" + read_only = true + help = "number of function symbols in conflicts that are generalized" + +[[option]] + name = "bvEagerExplanations" + category = "expert" + long = "bv-eager-explanations" + type = "bool" + default = "false" + help = "compute bit-blasting propagation explanations eagerly" + +[[option]] + name = "bitvectorQuickXplain" + category = "expert" + long = "bv-quick-xplain" + type = "bool" + default = "false" + read_only = true + help = "minimize bv conflicts using the QuickXplain algorithm" + +[[option]] + name = "bvIntroducePow2" + category = "expert" + long = "bv-intro-pow2" + type = "bool" + default = "false" + read_only = true + help = "introduce bitvector powers of two as a preprocessing pass" + +[[option]] + name = "bvGaussElim" + category = "expert" + long = "bv-gauss-elim" + type = "bool" + default = "false" + read_only = true + help = "simplify formula via Gaussian Elimination if applicable" + +[[option]] + name = "bvLazyRewriteExtf" + category = "regular" + long = "bv-lazy-rewrite-extf" + type = "bool" + default = "true" + help = "lazily rewrite extended functions like bv2nat and int2bv" + +[[option]] + name = "bvLazyReduceExtf" + category = "regular" + long = "bv-lazy-reduce-extf" + type = "bool" + default = "false" + help = "reduce extended functions like bv2nat and int2bv at last call instead of full effort" + +[[option]] + name = "bvAlgExtf" + category = "regular" + long = "bv-alg-extf" + type = "bool" + default = "true" + help = "algebraic inferences for extended functions" diff --git a/src/options/datatypes_options b/src/options/datatypes_options deleted file mode 100644 index 5163cf35d..000000000 --- a/src/options/datatypes_options +++ /dev/null @@ -1,53 +0,0 @@ -# -# Option specification file for CVC4 -# See src/options/base_options for a description of this file format -# - -module DATATYPES "options/datatypes_options.h" Datatypes theory - -# How to handle selectors applied to incorrect constructors. If this option is set, -# then we do not rewrite such a selector term to an arbitrary ground term. -# For example, by default cvc4 considers cdr( nil ) = nil. If this option is set, then -# cdr( nil ) has no set value. -expert-option dtRewriteErrorSel --dt-rewrite-error-sel bool :default false :read-write - rewrite incorrectly applied selectors to arbitrary ground term -option dtForceAssignment --dt-force-assignment bool :default false :read-write - force the datatypes solver to give specific values to all datatypes terms before answering sat -option dtBinarySplit --dt-binary-split bool :default false - do binary splits for datatype constructor types -option dtRefIntro --dt-ref-sk-intro bool :default false - introduce reference skolems for shorter explanations -option dtUseTesters --dt-use-testers bool :default true - do not preprocess away tester predicates -option cdtBisimilar --cdt-bisimilar bool :default true - do bisimilarity check for co-datatypes -option dtCyclic --dt-cyclic bool :default true - do cyclicity check for datatypes -option dtInferAsLemmas --dt-infer-as-lemmas bool :default false - always send lemmas out instead of making internal inferences -#option dtRExplainLemmas --dt-rexplain-lemmas bool :default true -# regression explanations for datatype lemmas -option dtBlastSplits --dt-blast-splits bool :default false - when applicable, blast splitting lemmas for all variables at once -option dtSharedSelectors --dt-share-sel bool :default true - internally use shared selectors across multiple constructors - -option sygusSymBreak --sygus-sym-break bool :default true - simple sygus sym break lemmas -option sygusSymBreakDynamic --sygus-sym-break-dynamic bool :default true - dynamic sygus sym break lemmas -option sygusOpt1 --sygus-opt1 bool :default false - sygus experimental option -option sygusSymBreakLazy --sygus-sym-break-lazy bool :default true - lazily add symmetry breaking lemmas for terms -option sygusSymBreakRlv --sygus-sym-break-rlv bool :default true - add relevancy conditions to symmetry breaking lemmas - -option sygusFair --sygus-fair=MODE CVC4::theory::SygusFairMode :default CVC4::theory::SYGUS_FAIR_DT_SIZE :include "options/datatypes_modes.h" :handler stringToSygusFairMode - if and how to apply fairness for sygus -option sygusFairMax --sygus-fair-max bool :default true - use max instead of sum for multi-function sygus conjectures -option sygusAbortSize --sygus-abort-size=N int :default -1 - tells enumerative sygus to only consider solutions up to term size N (-1 == no limit, default) - -endmodule diff --git a/src/options/datatypes_options.toml b/src/options/datatypes_options.toml new file mode 100644 index 000000000..ef736e913 --- /dev/null +++ b/src/options/datatypes_options.toml @@ -0,0 +1,169 @@ +id = "DATATYPES" +name = "Datatypes theory" +header = "options/datatypes_options.h" + +# How to handle selectors applied to incorrect constructors. If this option is set, +# then we do not rewrite such a selector term to an arbitrary ground term. +# For example, by default cvc4 considers cdr( nil ) = nil. If this option is set, then +# cdr( nil ) has no set value. +[[option]] + name = "dtRewriteErrorSel" + category = "expert" + long = "dt-rewrite-error-sel" + type = "bool" + default = "false" + help = "rewrite incorrectly applied selectors to arbitrary ground term" + +[[option]] + name = "dtForceAssignment" + category = "regular" + long = "dt-force-assignment" + type = "bool" + default = "false" + help = "force the datatypes solver to give specific values to all datatypes terms before answering sat" + +[[option]] + name = "dtBinarySplit" + category = "regular" + long = "dt-binary-split" + type = "bool" + default = "false" + read_only = true + help = "do binary splits for datatype constructor types" + +[[option]] + name = "dtRefIntro" + category = "regular" + long = "dt-ref-sk-intro" + type = "bool" + default = "false" + read_only = true + help = "introduce reference skolems for shorter explanations" + +[[option]] + name = "dtUseTesters" + category = "regular" + long = "dt-use-testers" + type = "bool" + default = "true" + read_only = true + help = "do not preprocess away tester predicates" + +[[option]] + name = "cdtBisimilar" + category = "regular" + long = "cdt-bisimilar" + type = "bool" + default = "true" + read_only = true + help = "do bisimilarity check for co-datatypes" + +[[option]] + name = "dtCyclic" + category = "regular" + long = "dt-cyclic" + type = "bool" + default = "true" + read_only = true + help = "do cyclicity check for datatypes" + +[[option]] + name = "dtInferAsLemmas" + category = "regular" + long = "dt-infer-as-lemmas" + type = "bool" + default = "false" + read_only = true + help = "always send lemmas out instead of making internal inferences" + +[[option]] + name = "dtBlastSplits" + category = "regular" + long = "dt-blast-splits" + type = "bool" + default = "false" + read_only = true + help = "when applicable, blast splitting lemmas for all variables at once" + +[[option]] + name = "dtSharedSelectors" + category = "regular" + long = "dt-share-sel" + type = "bool" + default = "true" + read_only = true + help = "internally use shared selectors across multiple constructors" + +[[option]] + name = "sygusSymBreak" + category = "regular" + long = "sygus-sym-break" + type = "bool" + default = "true" + read_only = true + help = "simple sygus sym break lemmas" + +[[option]] + name = "sygusSymBreakDynamic" + category = "regular" + long = "sygus-sym-break-dynamic" + type = "bool" + default = "true" + read_only = true + help = "dynamic sygus sym break lemmas" + +[[option]] + name = "sygusOpt1" + category = "regular" + long = "sygus-opt1" + type = "bool" + default = "false" + read_only = true + help = "sygus experimental option" + +[[option]] + name = "sygusSymBreakLazy" + category = "regular" + long = "sygus-sym-break-lazy" + type = "bool" + default = "true" + read_only = true + help = "lazily add symmetry breaking lemmas for terms" + +[[option]] + name = "sygusSymBreakRlv" + category = "regular" + long = "sygus-sym-break-rlv" + type = "bool" + default = "true" + read_only = true + help = "add relevancy conditions to symmetry breaking lemmas" + +[[option]] + name = "sygusFair" + category = "regular" + long = "sygus-fair=MODE" + type = "CVC4::theory::SygusFairMode" + default = "CVC4::theory::SYGUS_FAIR_DT_SIZE" + handler = "stringToSygusFairMode" + includes = ["options/datatypes_modes.h"] + read_only = true + help = "if and how to apply fairness for sygus" + +[[option]] + name = "sygusFairMax" + category = "regular" + long = "sygus-fair-max" + type = "bool" + default = "true" + read_only = true + help = "use max instead of sum for multi-function sygus conjectures" + +[[option]] + name = "sygusAbortSize" + category = "regular" + long = "sygus-abort-size=N" + type = "int" + default = "-1" + read_only = true + help = "tells enumerative sygus to only consider solutions up to term size N (-1 == no limit, default)" diff --git a/src/options/decision_options b/src/options/decision_options deleted file mode 100644 index 2490d2808..000000000 --- a/src/options/decision_options +++ /dev/null @@ -1,27 +0,0 @@ -# -# Option specification file for CVC4 -# See src/options/base_options for a description of this file format -# - -module DECISION "options/decision_options.h" Decision heuristics - -# When/whether to use any decision strategies -option decisionMode decision-mode --decision=MODE decision::DecisionMode :handler stringToDecisionMode :default decision::DECISION_STRATEGY_INTERNAL :read-write :include "options/decision_mode.h" - choose decision mode, see --decision=help - -# only use DE to determine when to stop, not to make decisions -option decisionStopOnly bool - -expert-option decisionThreshold --decision-threshold=N decision::DecisionWeight :default 0 :include "options/decision_weight.h" - ignore all nodes greater than threshold in first attempt to pick decision - -expert-option decisionUseWeight --decision-use-weight bool :default false - use the weight nodes (locally, by looking at children) to direct recursive search - -expert-option decisionRandomWeight --decision-random-weight=N int :default 0 - assign random weights to nodes between 0 and N-1 (0: disable) - -expert-option decisionWeightInternal --decision-weight-internal=HOW decision::DecisionWeightInternal :handler stringToDecisionWeightInternal :default decision::DECISION_WEIGHT_INTERNAL_OFF - computer weights of internal nodes using children: off, max, sum, usr1 (meaning evolving) - -endmodule diff --git a/src/options/decision_options.toml b/src/options/decision_options.toml new file mode 100644 index 000000000..5826368c8 --- /dev/null +++ b/src/options/decision_options.toml @@ -0,0 +1,57 @@ +id = "DECISION" +name = "Decision heuristics" +header = "options/decision_options.h" + +[[option]] + name = "decisionMode" + smt_name = "decision-mode" + category = "regular" + long = "decision=MODE" + type = "decision::DecisionMode" + default = "decision::DECISION_STRATEGY_INTERNAL" + handler = "stringToDecisionMode" + includes = ["options/decision_mode.h"] + help = "choose decision mode, see --decision=help" + +[[option]] + name = "decisionStopOnly" + category = "undocumented" + type = "bool" + +[[option]] + name = "decisionThreshold" + category = "expert" + long = "decision-threshold=N" + type = "decision::DecisionWeight" + default = "0" + includes = ["options/decision_weight.h"] + read_only = true + help = "ignore all nodes greater than threshold in first attempt to pick decision" + +[[option]] + name = "decisionUseWeight" + category = "expert" + long = "decision-use-weight" + type = "bool" + default = "false" + read_only = true + help = "use the weight nodes (locally, by looking at children) to direct recursive search" + +[[option]] + name = "decisionRandomWeight" + category = "expert" + long = "decision-random-weight=N" + type = "int" + default = "0" + read_only = true + help = "assign random weights to nodes between 0 and N-1 (0: disable)" + +[[option]] + name = "decisionWeightInternal" + category = "expert" + long = "decision-weight-internal=HOW" + type = "decision::DecisionWeightInternal" + default = "decision::DECISION_WEIGHT_INTERNAL_OFF" + handler = "stringToDecisionWeightInternal" + read_only = true + help = "computer weights of internal nodes using children: off, max, sum, usr1 (meaning evolving)" diff --git a/src/options/expr_options b/src/options/expr_options deleted file mode 100644 index d6997b2dd..000000000 --- a/src/options/expr_options +++ /dev/null @@ -1,30 +0,0 @@ -# -# Option specification file for CVC4 -# See src/options/base_options for a description of this file format -# - -module EXPR "options/expr_options.h" Expression package - -option defaultExprDepth --default-expr-depth=N int :default 0 :predicate setDefaultExprDepthPredicate :notify notifySetDefaultExprDepth - print exprs to depth N (0 == default, -1 == no limit) -undocumented-alias --expr-depth=N = --default-expr-depth=N - -option defaultDagThresh default-dag-thresh --default-dag-thresh=N int :default 1 :predicate setDefaultDagThreshPredicate :notify notifySetDefaultDagThresh - dagify common subexprs appearing > N times (1 == default, 0 == don't dagify) -undocumented-alias --dag-thresh=N = --default-dag-thresh=N -undocumented-alias --dag-threshold=N = --default-dag-thresh=N - -option printExprTypes --print-expr-types bool :default false :notify notifySetPrintExprTypes - print types with variables when printing exprs - -option earlyTypeChecking --eager-type-checking/--lazy-type-checking bool :default USE_EARLY_TYPE_CHECKING_BY_DEFAULT - type check expressions immediately on creation (debug builds only) -/type check expressions only when necessary (default) - -# --no-type-checking will override any --early-type-checking or --lazy-type-checking option -# --lazy-type-checking is linked because earlyTypeChecking should be set false too -option typeChecking type-checking /--no-type-checking bool :default DO_SEMANTIC_CHECKS_BY_DEFAULT :link /--lazy-type-checking - never type check expressions - -endmodule - diff --git a/src/options/expr_options.toml b/src/options/expr_options.toml new file mode 100644 index 000000000..3791da714 --- /dev/null +++ b/src/options/expr_options.toml @@ -0,0 +1,74 @@ +id = "EXPR" +name = "Expression package" +header = "options/expr_options.h" + +[[option]] + name = "defaultExprDepth" + category = "regular" + long = "default-expr-depth=N" + type = "int" + default = "0" + predicates = ["setDefaultExprDepthPredicate"] + notifies = ["notifySetDefaultExprDepth"] + read_only = true + help = "print exprs to depth N (0 == default, -1 == no limit)" + +[[alias]] + category = "undocumented" + long = "expr-depth=N" + links = ["--default-expr-depth=N"] + +[[option]] + name = "defaultDagThresh" + smt_name = "default-dag-thresh" + category = "regular" + long = "default-dag-thresh=N" + type = "int" + default = "1" + predicates = ["setDefaultDagThreshPredicate"] + notifies = ["notifySetDefaultDagThresh"] + read_only = true + help = "dagify common subexprs appearing > N times (1 == default, 0 == don't dagify)" + +[[alias]] + category = "undocumented" + long = "dag-thresh=N" + links = ["--default-dag-thresh=N"] + +[[alias]] + category = "undocumented" + long = "dag-threshold=N" + links = ["--default-dag-thresh=N"] + +[[option]] + name = "printExprTypes" + category = "regular" + long = "print-expr-types" + type = "bool" + default = "false" + notifies = ["notifySetPrintExprTypes"] + read_only = true + help = "print types with variables when printing exprs" + +[[option]] + name = "earlyTypeChecking" + category = "regular" + long = "eager-type-checking" + type = "bool" + default = "USE_EARLY_TYPE_CHECKING_BY_DEFAULT" + read_only = true + help = "type check expressions immediately on creation (debug builds only)" + +[[option]] + name = "typeChecking" + category = "regular" + long = "type-checking" + type = "bool" + default = "DO_SEMANTIC_CHECKS_BY_DEFAULT" + read_only = true + help = "never type check expressions" + +[[alias]] + category = "undocumented" + long = "no-type-checking" + links = ["--no-eager-type-checking"] diff --git a/src/options/fp_options b/src/options/fp_options deleted file mode 100644 index 977e868d9..000000000 --- a/src/options/fp_options +++ /dev/null @@ -1,8 +0,0 @@ -# -# Option specification file for CVC4 -# See src/options/base_options for a description of this file format -# - -module FP "options/fp_options.h" Fp - -endmodule diff --git a/src/options/fp_options.toml b/src/options/fp_options.toml new file mode 100644 index 000000000..eb8c933af --- /dev/null +++ b/src/options/fp_options.toml @@ -0,0 +1,3 @@ +id = "FP" +name = "Fp" +header = "options/fp_options.h" diff --git a/src/options/generate-toml-files.sh b/src/options/generate-toml-files.sh new file mode 100755 index 000000000..1a2100227 --- /dev/null +++ b/src/options/generate-toml-files.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +for f in *_options; do echo $f; time ./mkoptions-toml module-sed $f > ${f}.toml; done diff --git a/src/options/idl_options b/src/options/idl_options deleted file mode 100644 index 9d4d2a442..000000000 --- a/src/options/idl_options +++ /dev/null @@ -1,12 +0,0 @@ -# -# Option specification file for CVC4 -# See src/options/base_options for a description of this file format -# - -module IDL "options/idl_options.h" Idl - -option idlRewriteEq --enable-idl-rewrite-equalities/--disable-idl-rewrite-equalities bool :default false :read-write - enable rewriting equalities into two inequalities in IDL solver (default is disabled) -/disable rewriting equalities into two inequalities in IDL solver (default is disabled) - -endmodule diff --git a/src/options/idl_options.toml b/src/options/idl_options.toml new file mode 100644 index 000000000..d3bee7018 --- /dev/null +++ b/src/options/idl_options.toml @@ -0,0 +1,11 @@ +id = "IDL" +name = "Idl" +header = "options/idl_options.h" + +[[option]] + name = "idlRewriteEq" + category = "regular" + long = "idl-rewrite-equalities" + type = "bool" + default = "false" + help = "enable rewriting equalities into two inequalities in IDL solver (default is disabled)" diff --git a/src/options/main_options b/src/options/main_options deleted file mode 100644 index 1793cae2d..000000000 --- a/src/options/main_options +++ /dev/null @@ -1,69 +0,0 @@ -# -# Option specification file for CVC4 -# See src/options/base_options for a description of this file format -# - -module DRIVER "options/main_options.h" Driver - -common-option version -V --version/ bool - identify this CVC4 binary -undocumented-alias --license = --version - -common-option help -h --help/ bool - full command line reference - -common-option - --show-config void :handler showConfiguration - show CVC4 static configuration - -common-option - --copyright void :handler copyright - show CVC4 copyright information - -common-option seed -s --seed uint64_t :default 0 - seed for random number generator - -option - --show-debug-tags void :handler showDebugTags - show all available tags for debugging -option - --show-trace-tags void :handler showTraceTags - show all available tags for tracing - -expert-option earlyExit --early-exit bool :default true - do not run destructors at exit; default on except in debug builds - -# portfolio options -option threads --threads=N unsigned :default 2 :predicate unsignedGreater0 - Total number of threads for portfolio -option - --threadN=string void :handler threadN - configures portfolio thread N (0..#threads-1) -option threadStackSize --thread-stack=N unsigned :default 0 - stack size for worker threads in MB (0 means use Boost/thread lib default) -option threadArgv std::vector :include - Thread configuration (a string to be passed to parseOptions) -option thread_id int :default -1 - Thread ID, for internal use in case of multi-threaded run -option sharingFilterByLength --filter-lemma-length=N int :default -1 :read-write - don't share (among portfolio threads) lemmas strictly longer than N -option fallbackSequential --fallback-sequential bool :default false - Switch to sequential mode (instead of printing an error) if it can't be solved in portfolio mode -option incrementalParallel --incremental-parallel bool :default false :link --incremental :link-smt incremental - Use parallel solver even in incremental mode (may print 'unknown's at times) - -option interactive : --interactive bool :read-write - force interactive/non-interactive mode -undocumented-option interactivePrompt --interactive-prompt bool :default true - interactive prompting while in interactive mode - -# error behaviors (--immediate-exit is default in cases we support, thus no options) -option continuedExecution --continued-execution/ bool :default false :link "--interactive --no-interactive-prompt"/ :link-smt interactive :link-smt interactivePrompt \"false\" - continue executing commands, even on error - -option segvSpin --segv-spin bool :default false - spin on segfault/other crash waiting for gdb -undocumented-alias --segv-nospin = --no-segv-spin - -expert-option tearDownIncremental : --tear-down-incremental=N int :default 0 - implement PUSH/POP/multi-query by destroying and recreating SmtEngine every N queries - -expert-option waitToJoin --wait-to-join bool :default true - wait for other threads to join before quitting - -endmodule diff --git a/src/options/main_options.toml b/src/options/main_options.toml new file mode 100644 index 000000000..42453a92c --- /dev/null +++ b/src/options/main_options.toml @@ -0,0 +1,205 @@ +id = "DRIVER" +name = "Driver" +header = "options/main_options.h" + +[[option]] + name = "version" + category = "common" + short = "V" + long = "version" + type = "bool" + read_only = true + alternate = false + help = "identify this CVC4 binary" + +[[alias]] + category = "undocumented" + long = "license" + links = ["--version"] + +[[option]] + name = "help" + category = "common" + short = "h" + long = "help" + type = "bool" + read_only = true + alternate = false + help = "full command line reference" + +[[option]] + category = "common" + long = "show-config" + type = "void" + handler = "showConfiguration" + read_only = true + help = "show CVC4 static configuration" + +[[option]] + category = "common" + long = "copyright" + type = "void" + handler = "copyright" + read_only = true + help = "show CVC4 copyright information" + +[[option]] + name = "seed" + category = "common" + short = "s" + long = "seed" + type = "uint64_t" + default = "0" + read_only = true + help = "seed for random number generator" + +[[option]] + category = "regular" + long = "show-debug-tags" + type = "void" + handler = "showDebugTags" + read_only = true + help = "show all available tags for debugging" + +[[option]] + category = "regular" + long = "show-trace-tags" + type = "void" + handler = "showTraceTags" + read_only = true + help = "show all available tags for tracing" + +[[option]] + name = "earlyExit" + category = "expert" + long = "early-exit" + type = "bool" + default = "true" + read_only = true + help = "do not run destructors at exit; default on except in debug builds" + +[[option]] + name = "threads" + category = "regular" + long = "threads=N" + type = "unsigned" + default = "2" + predicates = ["unsignedGreater0"] + read_only = true + help = "Total number of threads for portfolio" + +[[option]] + category = "regular" + long = "threadN=string" + type = "void" + handler = "threadN" + read_only = true + help = "configures portfolio thread N (0..#threads-1)" + +[[option]] + name = "threadStackSize" + category = "regular" + long = "thread-stack=N" + type = "unsigned" + default = "0" + read_only = true + help = "stack size for worker threads in MB (0 means use Boost/thread lib default)" + +[[option]] + name = "threadArgv" + category = "regular" + type = "std::vector" + includes = ["", ""] + help = "Thread configuration (a string to be passed to parseOptions)" + +[[option]] + name = "thread_id" + category = "regular" + type = "int" + default = "-1" + help = "Thread ID, for internal use in case of multi-threaded run" + +[[option]] + name = "sharingFilterByLength" + category = "regular" + long = "filter-lemma-length=N" + type = "int" + default = "-1" + help = "don't share (among portfolio threads) lemmas strictly longer than N" + +[[option]] + name = "fallbackSequential" + category = "regular" + long = "fallback-sequential" + type = "bool" + default = "false" + read_only = true + help = "Switch to sequential mode (instead of printing an error) if it can't be solved in portfolio mode" + +[[option]] + name = "incrementalParallel" + category = "regular" + long = "incremental-parallel" + type = "bool" + default = "false" + links = ["--incremental"] + read_only = true + help = "Use parallel solver even in incremental mode (may print 'unknown's at times)" + +[[option]] + name = "interactive" + category = "regular" + long = "interactive" + type = "bool" + help = "force interactive/non-interactive mode" + +[[option]] + name = "interactivePrompt" + category = "undocumented" + long = "interactive-prompt" + type = "bool" + default = "true" + read_only = true + help = "interactive prompting while in interactive mode" + +[[option]] + name = "continuedExecution" + category = "regular" + long = "continued-execution" + type = "bool" + default = "false" + links = ["--interactive", "--no-interactive-prompt"] + read_only = true + help = "continue executing commands, even on error" + +[[option]] + name = "segvSpin" + category = "regular" + long = "segv-spin" + type = "bool" + default = "false" + read_only = true + help = "spin on segfault/other crash waiting for gdb" + +[[alias]] + category = "undocumented" + long = "segv-nospin" + links = ["--no-segv-spin"] + +[[option]] + name = "tearDownIncremental" + category = "expert" + long = "tear-down-incremental=N" + type = "int" + default = "0" + read_only = true + help = "implement PUSH/POP/multi-query by destroying and recreating SmtEngine every N queries" + +[[option]] + name = "waitToJoin" + category = "expert" + long = "wait-to-join" + type = "bool" + default = "true" + read_only = true + help = "wait for other threads to join before quitting" diff --git a/src/options/mkoptions b/src/options/mkoptions deleted file mode 100755 index 4c640c9c3..000000000 --- a/src/options/mkoptions +++ /dev/null @@ -1,1676 +0,0 @@ -#!/bin/bash -# -# mkoptions -# Morgan Deters for CVC4 -# Tim King for CVC4 -# Copyright (c) 2011-2015 The CVC4 Project -# -# Invocation: -# -# mkoptions module-sed options-file -# mkoptions summary-sed (options-file)* -# mkoptions template-sed template-file -# mkoptions apply-sed-files-to-template template-file (sed-file)* -# -# The primary purpose of this script is to create options/*_options.{h,cpp} -# from template files and a list of options. This additionally generates -# the several documentation files, option_handler_get_option.cpp, -# option_handler_set_option.cpp, and options_holder.{h,cpp}. This script can in -# broad terms be thought of as an interpreter for a domain specific language -# within bash. -# -# The process for generating the files is as follows. -# 1) Scan all of the option files that are of interest. -# For an options.h file this is a single option file. For the system wide -# aggregates, like documentation, this is all of the option files. -# -# 2) Each option file is effectively a bash script. To oversimplify, each line -# in the file corresponds to executing a command in this file. -# The side effect of running the bash script is to populate the internal -# variables of this script. -# See the "eval" call in scan_module to see how internal functions are -# called. -# -# 3) The internal variables are then compiled into a map from variables to -# string values. These maps are printed to standard output. This output -# is a valid sed file. -# -# 4) These sed maps are then applied to templates files to generate the final -# output files. -# -# Example of generating a module: -# mkoptions module-sed src/options/base_options.h src/theory - -copyright=2011-2015 - -me=$(basename "$0") - -function usage { - echo "usage: $me module-sed options-file" >&2 - echo "usage: $me summary-sed (options-file)*" >&2 - echo "usage: $me template-sed template-file" >&2 - echo "usage: $me apply-sed-files-to-template template-file (sed-file)*" >&2 -} - -# progress_char=/ -# if [ -t 1 ]; then r="\r"; else r=""; fi -# function progress { -# file="$(expr "$1" : '.*\(.................................................................\)')" -# if [ -z "$file" ]; then file="$1"; else file="[...]$file"; fi -# [ -t 1 ] && printf "$r%c %-70s (%3d%%)" "$progress_char" "$file" "$(($2*100/$3))" -# progress_char="`echo "$progress_char" | tr -- '-\\\\|/' '\\\\|/-'`" -# } - -function NOTE { - printf "$r%-80s\n" "$kf:$lineno: note: $@" >&2 -} - -function WARN { - printf "$r%-80s\n" "$kf:$lineno: warning: $@" >&2 -} - -function ERR { - printf "$r%-80s\n" "$kf:$lineno: error: $@" >&2 - exit 1 -} - - -#options_h_template="$1"; shift -#options_cpp_template="$1"; shift - -all_modules_defaults= -all_modules_short_options= -all_modules_long_options= -all_modules_smt_options= -all_modules_option_handlers= -all_modules_get_options= -smt_getoption_handlers= -smt_setoption_handlers= -include_all_option_headers= -all_modules_contributions= -option_handler_includes= -all_custom_handlers= -common_documentation= -remaining_documentation= -common_manpage_documentation= -remaining_manpage_documentation= -common_manpage_smt_documentation= -remaining_manpage_smt_documentation= -common_manpage_internals_documentation= -remaining_manpage_internals_documentation= - -seen_module=false -seen_endmodule=false -expect_doc=false -expect_doc_alternate=false -seen_doc=false -n_long=256 - -internal= -smtname= -short_option= -short_option_alternate= -long_option= -long_option_alternate= -long_option_alternate_set= -type= -predicates= -notifications= - -# just for duplicates-checking -all_declared_internal_options= -all_declared_long_options= -all_declared_short_options= -all_declared_smt_options= - -long_option_value_begin=$n_long - -function module { - # module id name - - module_id= - module_name= - module_includes= - module_optionholder_spec= - module_decls= - module_specializations= - module_inlines= - module_accessors= - module_global_definitions= - - seen_module=true - if [ $# -lt 3 -o -z "$1" -o -z "$2" -o -z "$3" ]; then - ERR "\"module\" directive requires exactly three arguments" - fi - - module_id="$1"; shift - include="$1"; shift - module_name="$@" - include_all_option_headers="${include_all_option_headers} -#line $lineno \"$kf\" -#include $(check_include "$include")" - all_modules_contributions="${all_modules_contributions} - CVC4_OPTIONS__${module_id}__FOR_OPTION_HOLDER" - module_optionholder_spec="#define CVC4_OPTIONS__${module_id}__FOR_OPTION_HOLDER" - - previous_remaining_documentation="${remaining_documentation}" - remaining_documentation="${remaining_documentation}\\n\\n\" -#line $lineno \"$kf\" -\"From the $module_name module:" - remaining_documentation_at_start_of_module="${remaining_documentation}" - - previous_remaining_manpage_documentation="${remaining_manpage_documentation}" - remaining_manpage_documentation="${remaining_manpage_documentation} -.SH `echo "$module_name" | tr a-z A-Z` OPTIONS -" - remaining_manpage_documentation_at_start_of_module="${remaining_manpage_documentation}" - - previous_remaining_manpage_smt_documentation="${remaining_manpage_smt_documentation}" - remaining_manpage_smt_documentation="${remaining_manpage_smt_documentation} -.TP -.I \"`echo "$module_name" | tr a-z A-Z` OPTIONS\" -" - remaining_manpage_smt_documentation_at_start_of_module="${remaining_manpage_smt_documentation}" - - previous_remaining_manpage_internals_documentation="${remaining_manpage_internals_documentation}" - remaining_manpage_internals_documentation="${remaining_manpage_internals_documentation} -.TP -.I \"`echo "$module_name" | tr a-z A-Z` OPTIONS\" -" - remaining_manpage_internals_documentation_at_start_of_module="${remaining_manpage_internals_documentation}" -} - -function endmodule { - # endmodule - check_module_seen - check_doc - seen_endmodule=true - if [ $# -ne 0 ]; then - ERR "endmodule takes no arguments" - fi - - # check, and if no documented options, remove the headers - - if [ "$remaining_documentation" = "$remaining_documentation_at_start_of_module" ]; then - remaining_documentation="$previous_remaining_documentation" - fi - - if [ "$remaining_manpage_documentation" = "$remaining_manpage_documentation_at_start_of_module" ]; then - remaining_manpage_documentation="$previous_remaining_manpage_documentation" - fi - - if [ "$remaining_manpage_smt_documentation" = "$remaining_manpage_smt_documentation_at_start_of_module" ]; then - remaining_manpage_smt_documentation="$previous_remaining_manpage_smt_documentation" - fi - - if [ "$remaining_manpage_internals_documentation" = "$remaining_manpage_internals_documentation_at_start_of_module" ]; then - remaining_manpage_internals_documentation="$previous_remaining_manpage_internals_documentation" - fi -} - -function common-option { - # common-option option-args... - handle_option COMMON "$@" -} - -function option { - # option option-args... - handle_option STANDARD "$@" -} - -function expert-option { - # expert-option option-args... - handle_option EXPERT "$@" -} - -function undocumented-option { - # undocumented-option option-args... - handle_option UNDOCUMENTED "$@" -} - -function handle_option { - check_module_seen - check_doc - - args=("$@") - - category="${args[0]}" - internal="${args[1]}" - smtname= - short_option= - short_option_alternate= - long_option= - long_option_alternate= - long_option_alternate_set= - type= - readOnly=true - required_argument=false - default_value= - handlers= - predicates= - notifications= - links= - links_alternate= - smt_links= - - options_already_documented=false - alternate_options_already_documented=false - - if [ "$category" = UNDOCUMENTED ]; then - expect_doc=false - else - expect_doc=true - fi - expect_doc_alternate=false - seen_doc=false - - # scan ahead to see where the type is - type_pos=2 - while [ $(($type_pos+1)) -lt ${#args[@]} ] && ! expr "${args[$(($type_pos+1))]}" : '\:' &>/dev/null; do - let ++type_pos - done - - type="${args[$type_pos]}" - - if [ "$type" = argument ]; then - type=void - required_argument=true - fi - - if [ $type_pos -eq 2 ]; then - expect_doc=false - readOnly=false - else - i=2 - while [ $i -lt $type_pos ]; do - if expr "${args[$i]}" : '\--' &>/dev/null || expr "${args[$i]}" : '/--' &>/dev/null; then - if [ -n "$long_option" -o -n "$long_option_alternate" ]; then - ERR "malformed option line for \`$internal': unexpected \`${args[$i]}'" - fi - long_option="$(echo "${args[$i]}" | sed 's,/.*,,')" - if [ -n "$long_option" ]; then - if ! expr "$long_option" : '\--.' &>/dev/null; then - ERR "bad long option \`$long_option': expected something like \`--foo'" - fi - long_option="$(echo "$long_option" | sed 's,^--,,')" - fi - if expr "${args[$i]}" : '.*/' &>/dev/null; then - long_option_alternate="$(echo "${args[$i]}" | sed 's,[^/]*/,,')" - long_option_alternate_set=set - if [ -n "$long_option_alternate" ]; then - if ! expr "$long_option_alternate" : '\--.' &>/dev/null; then - ERR "bad alternate long option \`$long_option_alternate': expected something like \`--foo'" - fi - long_option_alternate="$(echo "$long_option_alternate" | sed 's,^--,,')" - fi - fi - elif expr "${args[$i]}" : '\-' &>/dev/null || expr "${args[$i]}" : '/-' &>/dev/null; then - if [ -n "$short_option" -o -n "$short_option_alternate" -o -n "$long_option" -o -n "$long_option_alternate" ]; then - ERR "malformed option line for \`$internal': unexpected \`${args[$i]}'" - fi - short_option="$(echo "${args[$i]}" | sed 's,/.*,,')" - if [ -n "$short_option" ]; then - if ! expr "$short_option" : '\-.$' &>/dev/null; then - ERR "bad short option \`$short_option': expected something like \`-x'" - fi - short_option="$(echo "$short_option" | sed 's,^-,,')" - fi - if expr "${args[$i]}" : '.*/' &>/dev/null; then - short_option_alternate="$(echo "${args[$i]}" | sed 's,[^/]*/,,')" - if expr "$short_option_alternate" : '\-' &>/dev/null; then - if ! expr "$short_option_alternate" : '\-.$' &>/dev/null; then - ERR "bad alternate short option \`$short_option_alternate': expected something like \`-x'" - fi - short_option_alternate="$(echo "$short_option_alternate" | sed 's,^-,,')" - fi - fi - else - if [ -n "$smtname" -o -n "$short_option" -o -n "$short_option_alternate" -o -n "$long_option" -o -n "$long_option_alternate" ]; then - ERR "malformed option line for \`$internal': unexpected \`${args[$i]}'" - fi - smtname="${args[$i]}" - fi - let ++i - done - fi - - if [ "$type" = void -a "$internal" != - ]; then - ERR "$internal cannot be void-typed; use \`-' as the name if its to be void" - elif [ "$type" != void -a "$internal" = - ]; then - ERR "cannot use an unnamed option if its type is not void" - fi - - if [ "$type" = bool -a -n "$long_option$short_option" -a "$category" != UNDOCUMENTED ]; then - if [ -n "$short_option_alternate" -o -n "$long_option_alternate" ]; then - expect_doc_alternate=true - fi - fi - if [ "$type" = bool -a -n "$long_option" -a -z "$long_option_alternate" -a -z "$long_option_alternate_set" ]; then - long_option_alternate="no-$(echo "$long_option" | sed 's,^--,,')" - fi - if [ "$type" != bool -a -n "$short_option_alternate" ]; then - ERR "cannot use alternate short option -$short_option_alternate for \`$internal' because it's not of bool type" - elif [ "$type" != bool -a -n "$long_option_alternate" ]; then - ERR "cannot use alternate long option --$long_option_alternate for \`$internal' because it's not of bool type" - fi - - # check that normal options are accessible via SmtEngine too - if [ -n "$long_option$short_option$long_option_alternate$short_option_alternate" -a -z "$smtname" -a "$internal" != - ]; then - if [ -n "$long_option" ]; then - smtname="$long_option" - else - WARN "$internal is inaccessible via SmtEngine (no smt name for option) but can be set via command-line: $long_option $short_option $long_option_alternate $short_option_alternate" - fi - fi - # in options files, use an smt name of ":" to force there not to be one - if [ "$smtname" = : ]; then - smtname= - fi - - # check for duplicates - if [ "$internal" != - ]; then - if echo " $all_declared_internal_options " | grep -q " $internal "; then - ERR "internal option name \`$internal' previously declared" - fi - all_declared_internal_options="$all_declared_internal_options $internal" - fi - if [ -n "$long_option" ]; then - if echo " $all_declared_long_options " | grep -q " $long_option "; then - ERR "long option name \`--$long_option' previously declared" - fi - all_declared_long_options="$all_declared_long_options $long_option" - fi - if [ -n "$long_option_alternate" ]; then - if echo " $all_declared_long_options " | grep -q " $long_option_alternate "; then - ERR "long option name \`--$long_option_alternate' previously declared" - fi - all_declared_long_options="$all_declared_long_options $long_option_alternate" - fi - if [ -n "$short_option" ]; then - if echo " $all_declared_short_options " | grep -q " $short_option "; then - ERR "short option name \`-$short_option' previously declared" - fi - all_declared_short_options="$all_declared_short_options $short_option" - fi - if [ -n "$short_option_alternate" ]; then - if echo " $all_declared_short_options " | grep -q " $short_option_alternate "; then - ERR "short option name \`-$short_option_alternate' previously declared" - fi - all_declared_short_options="$all_declared_short_options $short_option_alternate" - fi - if [ -n "$smtname" ]; then - if echo " $all_declared_smt_options " | grep -q " $smtname "; then - ERR "SMT option name \`$smtname' previously declared" - fi - all_declared_smt_options="$all_declared_smt_options $smtname" - fi - - # parse attributes - i=$(($type_pos+1)) - colon_pattern='^\:' - while [ $i -lt ${#args[@]} ]; do - attribute="${args[$i]}" - case "$attribute" in - :default) - let ++i - default_value="${args[$i]}" - ;; - :handler) - let ++i - if [ -n "$handlers" ]; then - ERR "cannot specify more than one handler; maybe you want a :handler and a :predicate" - fi - handlers="${args[$i]}" - ;; - :predicate) - while [ $(($i+1)) -lt ${#args[@]} ] && ! [[ ${args[$(($i+1))]} =~ $colon_pattern ]]; do - let ++i - predicates="${predicates} ${args[$i]}" - done - ;; - :notify) - while [ $(($i+1)) -lt ${#args[@]} ] && ! [[ ${args[$(($i+1))]} =~ $colon_pattern ]]; do - let ++i - notifications="${notifications} ${args[$i]}" - done - ;; - :link) - while [ $(($i+1)) -lt ${#args[@]} ] && ! [[ ${args[$(($i+1))]} =~ $colon_pattern ]]; do - let ++i - link="${args[$i]}" - if expr "${args[$i]}" : '.*/' &>/dev/null; then - links="${links} $(echo "${args[$i]}" | sed 's,/.*,,')" - links_alternate="${links_alternate} $(echo "${args[$i]}" | sed 's,[^/]*/,,')" - else - links="${links} ${args[$i]}" - fi - done - ;; - :link-smt) - j=0 - while [ $(($i+1)) -lt ${#args[@]} ] && ! [[ ${args[$(($i+1))]} =~ $colon_pattern ]]; do - let ++i - let ++j - if [ $j -eq 3 ]; then - echo "$kf:$lineno: error: attribute :link-smt can only take two arguments" >&2 - exit 1 - fi - if expr "${args[$i]}" : '.*/' &>/dev/null; then - echo "$kf:$lineno: error: attribute :link-smt cannot take alternates" >&2 - exit 1 - fi - smt_links="${smt_links} ${args[$i]}" - done - if [ $j -eq 1 ]; then - smt_links="${smt_links} \"true\"" - fi - ;; - :include) - while [ $(($i+1)) -lt ${#args[@]} ] && ! [[ ${args[$(($i+1))]} =~ $colon_pattern ]]; do - let ++i - module_includes="${module_includes} -#line $lineno \"$kf\" -#include $(check_include "${args[$i]}")" - done - ;; - :handler-include|:predicate-include) - while [ $(($i+1)) -lt ${#args[@]} ] && ! [[ ${args[$(($i+1))]} =~ $colon_pattern ]]; do - let ++i - option_handler_includes="${option_handler_includes} -#line $lineno \"$kf\" -#include $(check_include "${args[$i]}")" - done - ;; - :read-write) - readOnly=false - ;; - :read-only) - readOnly=true - ;; - *) - ERR "error in option \`$internal': bad attribute \`$attribute'" - esac - let ++i - done - - # set up structures - if [ "$internal" != - ]; then - # set up a field in the options_holder - module_optionholder_spec="${module_optionholder_spec} \\ - ${internal}__option_t::type $internal; \\ - bool ${internal}__setByUser__;" - all_modules_defaults="${all_modules_defaults:+${all_modules_defaults},} -#line $lineno \"$kf\" - $internal($default_value), -#line $lineno \"$kf\" - ${internal}__setByUser__(false)" - if $readOnly; then - module_decls="${module_decls} -#line $lineno \"$kf\" -extern struct CVC4_PUBLIC ${internal}__option_t { typedef $type type; type operator()() const; bool wasSetByUser() const; } $internal CVC4_PUBLIC;" - module_inlines="${module_inlines} -#line $lineno \"$kf\" -inline ${internal}__option_t::type ${internal}__option_t::operator()() const { return (*Options::current())[*this]; } -#line $lineno \"$kf\" -inline bool ${internal}__option_t::wasSetByUser() const { return Options::current()->wasSetByUser(*this); } -" - else - module_decls="${module_decls} -#line $lineno \"$kf\" -extern struct CVC4_PUBLIC ${internal}__option_t { typedef $type type; type operator()() const; bool wasSetByUser() const; void set(const type& v); } $internal CVC4_PUBLIC;" - module_inlines="${module_inlines} -#line $lineno \"$kf\" -inline ${internal}__option_t::type ${internal}__option_t::operator()() const { return (*Options::current())[*this]; } -#line $lineno \"$kf\" -inline bool ${internal}__option_t::wasSetByUser() const { return Options::current()->wasSetByUser(*this); } -#line $lineno \"$kf\" -inline void ${internal}__option_t::set(const ${internal}__option_t::type& v) { Options::current()->set(*this, v); } -" - module_specializations="${module_specializations} -#line $lineno \"$kf\" -template <> void Options::set(options::${internal}__option_t, const options::${internal}__option_t::type& x);" - module_accessors="${module_accessors} -#line $lineno \"$kf\" -template <> void Options::set(options::${internal}__option_t, const options::${internal}__option_t::type& x) { d_holder->$internal = x; }" - fi - module_global_definitions="${module_global_definitions} -#line $lineno \"$kf\" -struct ${internal}__option_t $internal;" - module_specializations="${module_specializations} -#line $lineno \"$kf\" -template <> const options::${internal}__option_t::type& Options::operator[](options::${internal}__option_t) const; -#line $lineno \"$kf\" -template <> bool Options::wasSetByUser(options::${internal}__option_t) const;" - if [ "$type" = bool ]; then - module_specializations="${module_specializations} -#line $lineno \"$kf\" -template <> void Options::assignBool(options::${internal}__option_t, std::string option, bool value);" - elif [ "$internal" != - ]; then - module_specializations="${module_specializations} -#line $lineno \"$kf\" -template <> void Options::assign(options::${internal}__option_t, std::string option, std::string value);" - fi - - module_accessors="${module_accessors} -#line $lineno \"$kf\" -template <> const options::${internal}__option_t::type& Options::operator[](options::${internal}__option_t) const { return d_holder->$internal; } -#line $lineno \"$kf\" -template <> bool Options::wasSetByUser(options::${internal}__option_t) const { return d_holder->${internal}__setByUser__; }" - fi - - if $required_argument || [ "$type" != bool -a "$type" != void ]; then - expect_arg=: - expect_arg_long=required_argument - else - expect_arg= - expect_arg_long=no_argument - fi - cases= - cases_alternate= - if [ -n "$short_option" ]; then - all_modules_short_options="${all_modules_short_options}$short_option$expect_arg" - cases="${cases} - case '$short_option':" - fi - if [ -n "$short_option_alternate" ]; then - all_modules_short_options="${all_modules_short_options}$short_option_alternate$expect_arg" - cases_alternate="${cases_alternate} - case '$short_option_alternate':" - fi - if [ -n "$long_option" ]; then - all_modules_long_options="${all_modules_long_options} - { \"$(echo "$long_option" | sed 's,=.*,,')\", $expect_arg_long, NULL, $n_long }," - cases="${cases} - case $n_long:// --$long_option" - let ++n_long - fi - if [ -n "$long_option_alternate" ]; then - all_modules_long_options="${all_modules_long_options} - { \"$(echo "$long_option_alternate" | sed 's,=.*,,')\", $expect_arg_long, NULL, $n_long }," - cases_alternate="${cases_alternate} - case $n_long:// --$long_option_alternate" - let ++n_long - fi - run_links= - run_links_alternate= - run_smt_links= - run_notifications= - if [ -n "$links" -a -z "$smt_links" -a -n "$smtname" ]; then - WARN "$smtname has no :link-smt, but equivalent command-line has :link" - elif [ -n "$smt_links" -a -z "$links" ] && [ -n "$short_option" -o -n "$short_option_alternate" -o -n "$long_option" -o "$long_option_alternate" ]; then - WARN "$smtname has a :link-smt, but equivalent command-line has no :link" - fi - if [ -n "$links" ]; then - # command-line links - for link in $links; do - run_links="$run_links -#line $lineno \"$kf\" - extender->pushBackPreemption(\"$link\");" - done - fi - if [ -n "$smt_links" ]; then - # smt links - smt_links=($smt_links) - i=0 - while [ $i -lt ${#smt_links[@]} ]; do - run_smt_links="$run_smt_links -#line $lineno \"$kf\" - setOption(std::string(\"${smt_links[$i]}\"), (${smt_links[$(($i+1))]}));" - i=$((i+2)) - done - fi - if [ -n "$links_alternate" ]; then - # command-line links - for link in $links_alternate; do - run_links_alternate="$run_links_alternate -#line $lineno \"$kf\" - extender->pushBackPreemption(\"$link\");" - done - fi - if [ -n "$notifications" ]; then - for notification in $notifications; do - run_notifications="$run_notifications -#line $lineno \"$kf\" - d_handler->$notification(option);" - done - fi - if [ "$type" = bool ] && [ -n "$cases" -o -n "$cases_alternate" -o -n "$smtname" ]; then - run_handlers= - if [ -n "$handlers" ]; then - ERR "bool-valued options cannot have handlers" - fi - if [ -n "$predicates" ]; then - for predicate in $predicates; do - run_handlers="$run_handlers -#line $lineno \"$kf\" - handler->$predicate(option, b);" - done - fi - if [ -n "$run_handlers" ]; then - all_custom_handlers="${all_custom_handlers} -#line $lineno \"$kf\" -template <> void runBoolPredicates(options::${internal}__option_t, std::string option, bool b, options::OptionsHandler* handler) { - $run_handlers -}" - fi - fi - if [ -n "$cases" ]; then - if [ "$type" = bool ]; then - all_modules_option_handlers="${all_modules_option_handlers}${cases} -#line $lineno \"$kf\" - options->assignBool(options::$internal, option, true);$run_links - break; -" - elif [ -n "$expect_arg" -a "$internal" != - ]; then - run_handlers= - if [ -n "$handlers" ]; then - for handler in $handlers; do - run_handlers="$run_handlers -#line $lineno \"$kf\" - handler->$handler(option, optionarg);" - done - else - run_handlers=" -#line $lineno \"$kf\" - handleOption<$type>(option, optionarg);" - fi - if [ -n "$predicates" ]; then - for predicate in $predicates; do - run_handlers="$run_handlers -#line $lineno \"$kf\" - handler->$predicate(option, retval);" - done - fi - all_custom_handlers="${all_custom_handlers} -#line $lineno \"$kf\" -template <> options::${internal}__option_t::type runHandlerAndPredicates(options::${internal}__option_t, std::string option, std::string optionarg, options::OptionsHandler* handler) { -#line $lineno \"$kf\" - options::${internal}__option_t::type retval = $run_handlers -#line $lineno \"$kf\" - return retval; -}" - all_modules_option_handlers="${all_modules_option_handlers}${cases} -#line $lineno \"$kf\" - options->assign(options::$internal, option, optionarg);$run_links - break; -" - elif [ -n "$expect_arg" ]; then - run_handlers= - if [ -n "$predicates" ]; then - ERR "void-valued options cannot have predicates" - fi - if [ -n "$handlers" ]; then - for handler in $handlers; do - run_handlers="$run_handlers -#line $lineno \"$kf\" - handler->$handler(option, optionarg);" - done - fi - all_modules_option_handlers="${all_modules_option_handlers}${cases} -#line $lineno \"$kf\" - $run_handlers$run_links - break; -" - else - run_handlers= - if [ -n "$predicates" ]; then - ERR "void-valued options cannot have predicates" - fi - if [ -n "$handlers" ]; then - for handler in $handlers; do - run_handlers="$run_handlers -#line $lineno \"$kf\" - handler->$handler(option);" - done - fi - all_modules_option_handlers="${all_modules_option_handlers}${cases} -#line $lineno \"$kf\" - $run_handlers$run_links - break; -" - fi - fi # ends if [ -n "$cases" ]; - if [ -n "$cases_alternate" ]; then - if [ "$type" = bool ]; then - all_modules_option_handlers="${all_modules_option_handlers}${cases_alternate} -#line $lineno \"$kf\" - options->assignBool(options::$internal, option, false);$run_links_alternate - break; -" - else - ERR "internal error: expected BOOL-typed option in alternate handler" - fi - fi - - if [ -n "$smtname" ]; then - all_modules_smt_options="${all_modules_smt_options:+$all_modules_smt_options,} -#line $lineno \"$kf\" - \"$smtname\"" - if [ "$internal" != - ]; then - case "$type" in - bool) - all_modules_get_options="${all_modules_get_options:+$all_modules_get_options -#line $lineno \"$kf\" - }{ std::vector v; v.push_back(\"$smtname\"); v.push_back(std::string(d_holder->$internal ? \"true\" : \"false\")); opts.push_back(v); }" - smt_getoption_handlers="${smt_getoption_handlers} -#line $lineno \"$kf\" - if(key == \"$smtname\") { -#line $lineno \"$kf\" - return std::string(options::$internal() ? \"true\" : \"false\"); - }";; - int|unsigned|int*_t|uint*_t|unsigned\ long|long|float|double) - all_modules_get_options="${all_modules_get_options:+$all_modules_get_options -#line $lineno \"$kf\" - }{ std::stringstream ss; ss << std::fixed << std::setprecision(8); ss << d_holder->$internal; std::vector v; v.push_back(\"$smtname\"); v.push_back(ss.str()); opts.push_back(v); }" - smt_getoption_handlers="${smt_getoption_handlers} -#line $lineno \"$kf\" - if(key == \"$smtname\") { -#line $lineno \"$kf\" - std::stringstream ss; ss << std::fixed << std::setprecision(8); ss << options::$internal(); return ss.str(); - }";; - *) - all_modules_get_options="${all_modules_get_options:+$all_modules_get_options -#line $lineno \"$kf\" - }{ std::stringstream ss; ss << d_holder->$internal; std::vector v; v.push_back(\"$smtname\"); v.push_back(ss.str()); opts.push_back(v); }" - smt_getoption_handlers="${smt_getoption_handlers} -#line $lineno \"$kf\" - if(key == \"$smtname\") { -#line $lineno \"$kf\" - std::stringstream ss; ss << options::$internal(); - return ss.str(); - }";; - esac - fi - - if [ "$type" = bool ]; then - smt_setoption_handlers="${smt_setoption_handlers} -#line $lineno \"$kf\" - if(key == \"$smtname\") { -#line $lineno \"$kf\" - Options::current()->assignBool(options::$internal, \"$smtname\", optionarg == \"true\");$run_smt_links - return; - }" - elif [ -n "$expect_arg" -a "$internal" != - ]; then - run_handlers= - if [ -n "$handlers" ]; then - for handler in $handlers; do - run_handlers="$run_handlers -#line $lineno \"$kf\" - handler->$handler(\"$smtname\", optionarg); -" - done - fi - smt_setoption_handlers="${smt_setoption_handlers} -#line $lineno \"$kf\" - if(key == \"$smtname\") { -#line $lineno \"$kf\" - Options::current()->assign(options::$internal, \"$smtname\", optionarg);$run_smt_links - return; - }" - elif [ -n "$expect_arg" ]; then - run_handlers= - for handler in $handlers; do - run_handlers="$run_handlers -#line $lineno \"$kf\" - handler->$handler(\"$smtname\", optionarg); -" - done - smt_setoption_handlers="${smt_setoption_handlers} -#line $lineno \"$kf\" - if(key == \"$smtname\") { -#line $lineno \"$kf\" - $run_handlers$run_smt_links - return; - }" - else - run_handlers= - for handler in $handlers; do - run_handlers="$run_handlers -#line $lineno \"$kf\" - handler->$handler(\"$smtname\"); -" - done - smt_setoption_handlers="${smt_setoption_handlers} -#line $lineno \"$kf\" - if(key == \"$smtname\") { -#line $lineno \"$kf\" - $run_handlers$run_smt_links - return; - }" - fi - elif [ -n "$long_option" -o "$long_option_alternate" ] && [ "$internal" != - ]; then - case "$type" in - bool) - getoption_name="$long_option" - inv= - # case where we have a --disable but no corresponding --enable - if [ -z "$getoption_name" ]; then - getoption_name="$long_option_alternate" - inv='!' - fi - all_modules_get_options="${all_modules_get_options:+$all_modules_get_options -#line $lineno \"$kf\" - }{ std::vector v; v.push_back(\"$getoption_name\"); v.push_back(std::string((${inv}d_holder->$internal) ? \"true\" : \"false\")); opts.push_back(v); }";; - int|unsigned|int*_t|uint*_t|unsigned\ long|long|float|double) - all_modules_get_options="${all_modules_get_options:+$all_modules_get_options -#line $lineno \"$kf\" - }{ std::stringstream ss; ss << std::fixed << std::setprecision(8); ss << d_holder->$internal; std::vector v; v.push_back(\"$long_option\"); v.push_back(ss.str()); opts.push_back(v); }";; - *) - all_modules_get_options="${all_modules_get_options:+$all_modules_get_options -#line $lineno \"$kf\" - }{ std::stringstream ss; ss << std::fixed << std::setprecision(8); ss << d_holder->$internal; std::vector v; v.push_back(\"$long_option\"); v.push_back(ss.str()); opts.push_back(v); }";; - esac - fi - - if [ "$type" = bool ]; then - # emit assignBool/assign - all_custom_handlers="${all_custom_handlers} -#line $lineno \"$kf\" -template <> void Options::assignBool(options::${internal}__option_t, std::string option, bool value) { -#line $lineno \"$kf\" - runBoolPredicates(options::$internal, option, value, d_handler); -#line $lineno \"$kf\" - d_holder->$internal = value; -#line $lineno \"$kf\" - d_holder->${internal}__setByUser__ = true; -#line $lineno \"$kf\" - Trace(\"options\") << \"user assigned option $internal\" << std::endl;$run_notifications -}" - elif [ -n "$expect_arg" -a "$internal" != - ] && [ -n "$cases" -o -n "$cases_alternate" -o -n "$smtname" ]; then - all_custom_handlers="${all_custom_handlers} -#line $lineno \"$kf\" -template <> void Options::assign(options::${internal}__option_t, std::string option, std::string value) { -#line $lineno \"$kf\" - d_holder->$internal = runHandlerAndPredicates(options::$internal, option, value, d_handler); -#line $lineno \"$kf\" - d_holder->${internal}__setByUser__ = true; -#line $lineno \"$kf\" - Trace(\"options\") << \"user assigned option $internal\" << std::endl;$run_notifications -}" - fi -} - -function common-alias { - # common-alias -option[=arg] = (-option[=arg])+ - handle_alias COMMON "$@" -} - -function alias { - # alias -option[=arg] = (-option[=arg])+ - handle_alias STANDARD "$@" -} - -function expert-alias { - # expert-alias -option[=arg] = (-option[=arg])+ - handle_alias EXPERT "$@" -} - -function undocumented-alias { - # undocumented-alias -option[=arg] = (-option[=arg])+ - handle_alias UNDOCUMENTED "$@" -} - -function handle_alias { - # handle_alias CATEGORY -option[=arg] = (-option[=arg])+ - check_module_seen - check_doc - - category="$1" - shift - - internal=- - smtname= - short_option= - short_option_alternate= - long_option= - long_option_alternate= - long_option_alternate_set= - type=void - readOnly=true - required_argument=false - default_value= - links= - links_alternate= - - options_already_documented=false - alternate_options_already_documented=false - - if [ "$category" = UNDOCUMENTED ]; then - expect_doc=false - else - expect_doc=true - fi - expect_doc_alternate=false - - if [ $# -lt 3 ]; then - ERR "malformed \"alias\" command; expected more arguments" - fi - if [ "$1" = '=' ]; then - ERR "malformed \"alias\" command; expected option name" - fi - option="$1" - shift - if [ "$1" != '=' ]; then - ERR "malformed \"alias\" command; expected \`='" - fi - shift - if [ $# -eq 0 ]; then - ERR "malformed \"alias\" command; expected more arguments" - fi - cases= - if ! expr "$option" : '\-' &>/dev/null; then - ERR "alias for SMT options not yet supported" - fi - if expr "$option" : '\--' &>/dev/null; then - if expr "$option" : '.*=' &>/dev/null; then - expect_arg_long=required_argument - arg="$(echo "$option" | sed 's,[^=]*=\(.*\),\1,')" - option="$(echo "$option" | sed 's,--,,;s,=.*,,')" - else - expect_arg_long=no_argument - arg= - option="$(echo "$option" | sed 's,--,,')" - fi - all_modules_long_options="${all_modules_long_options} - { \"$(echo "$option" | sed 's,=.*,,')\", $expect_arg_long, NULL, $n_long }," - cases="${cases} - case $n_long:// --$option" - let ++n_long - long_option="${long_option:+$long_option | --}$option" - else - if ! expr "$option" : '\-.$' &>/dev/null; then - if ! expr "$option" : '\-.=' &>/dev/null; then - ERR "expected short option specification, got \`$option'" - fi - expect_arg=: - arg="$(echo "$option" | sed 's,[^=]*=,,')" - option="$(echo "$option" | sed 's,-\(.\)=.*,\1,')" - else - expect_arg= - arg= - option="$(echo "$option" | sed 's,-,,')" - fi - all_modules_short_options="${all_modules_short_options}$option$expect_arg" - cases="${cases} - case '$option':" - short_option="${short_option:+$short_option | -}$option" - fi - - while [ $# -gt 0 ]; do - linkopt="$1" - # on the RHS, we're looking for =ARG, where "ARG" is *exactly* what - # was given on the LHS - if expr "$linkopt" : '.*=' &>/dev/null; then - linkarg="$(echo "$linkopt" | sed 's,[^=]*=,,')" - if [ "$linkarg" = "$arg" ]; then - # we found =ARG - linkopt="$(echo "$linkopt" | sed 's,=.*,,')" - else - # false positive: =SOMETHING, where SOMETHING != ARG - linkarg= - fi - else - linkarg= - fi - links="$links -#line $lineno \"$kf\" - extender->pushBackPreemption(\"$linkopt\");" - if [ "$linkarg" ]; then - # include also the arg - links="$links -#line $lineno \"$kf\" - extender->pushBackPreemption(optionarg.c_str());" - fi - shift - done - all_modules_option_handlers="$all_modules_option_handlers$cases$links - break; -" -} - -function warning { - # warning message - check_module_seen - check_doc - - WARN "$*" -} - -function doc { - # doc text... - check_module_seen - expect_doc=false - seen_doc=true - - if [ -z "$short_option" -a -z "$long_option" ]; then - if [ -n "$short_option_alternate" -o -n "$long_option_alternate" ]; then - if [ -n "$smtname" ]; then - expect_doc_alternate=true - else - if [ "$internal" != - ]; then - if ! $alternate_options_already_documented; then - if [ "$short_option_alternate" ]; then - if [ "$long_option_alternate" ]; then - altopt="s -$short_option_alternate and --$long_option_alternate, each of" - else - altopt=" -$short_option_alternate," - fi - else - altopt=" --$long_option_alternate," - fi - if [ -z "$default_value" ]; then - typedefault="($type)" - else - typedefault="($type, default = $default_value)" - fi - mansmtdoc="$@" - if [ "$category" = EXPERT ]; then - mansmtdoc="$mansmtdoc (EXPERTS only)" - fi - altmanopt="`echo "$altopt" | sed 's,-,\\\\\\-,g'`" - mansmtdoc="`echo "$mansmtdoc" | sed 's,-,\\\\\\-,g'`" - typedefault="`echo "$typedefault" | sed 's,-,\\\\\\-,g'`" - if [ "$category" = COMMON ]; then - common_manpage_internals_documentation="${common_manpage_internals_documentation} -.TP -.B \"$internal\" -$typedefault -.br -.B \"This internal Boolean flag is undocumented; however, its alternate option$altmanopt which reverses the sense of the option, is documented thusly:\" -$mansmtdoc" - else - remaining_manpage_internals_documentation="${remaining_manpage_internals_documentation} -.TP -.B \"$internal\" -$typedefault -.br -.B \"This internal Boolean flag is undocumented; however, its alternate option$altmanopt which reverses the sense of the option, is documented thusly:\" -$mansmtdoc" - fi - else - if [ "$category" = COMMON ]; then - common_manpage_internals_documentation="${common_manpage_internals_documentation} -$@" - else - remaining_manpage_internals_documentation="${remaining_manpage_internals_documentation} -$@" - fi - fi - fi - doc-alternate "$@" - return - fi - fi - fi - - the_opt= - if [ "$long_option" ]; then - the_opt="--$long_option" - if [ "$short_option" ]; then - shortoptarg= - if expr "$the_opt" : '.*=' &>/dev/null; then - shortoptarg="$(echo "$the_opt" | sed 's,[^=]*=, ,')" - fi - the_opt="$the_opt | -$short_option$shortoptarg" - fi - elif [ "$short_option" ]; then - the_opt="-$short_option" - fi - - if ! $options_already_documented; then - options_already_documented=true - - the_doc="$@" - mandoc="$@" - mansmtdoc="$@" - if [ "$category" = EXPERT ]; then - the_doc="$the_doc (EXPERTS only)" - mandoc="$mandoc (EXPERTS only)" - mansmtdoc="$mansmtdoc (EXPERTS only)" - fi - - if [ "$type" = bool -a -n "$long_option" -a "$long_option_alternate" = "no-$long_option" ]; then - the_doc="$the_doc [*]" - mandoc="$mandoc [*]" - fi - - # in man, minus sign is \-, different from hyphen - the_manopt="`echo "$the_opt" | sed 's,-,\\\\\\-,g'`" - mandoc="`echo "$mandoc" | sed 's,-,\\\\\\-,g'`" - mansmtdoc="`echo "$mansmtdoc" | sed 's,-,\\\\\\-,g'`" - - if [ "$the_opt" ]; then - doc_line= - while [ -n "$the_doc" ]; do - remaining_doc="$(expr "$the_doc " : '.\{1,53\} \(.*\)')" - the_doc="$(expr "$the_doc " : '\(.\{1,53\}\) ')" - if [ -z "$doc_line" ]; then - if expr "$the_opt" : '.\{23\}' &>/dev/null; then - # break into two lines - doc_line="$(printf ' %s\\n\\\n%-24s %s' "$the_opt" "" "$the_doc")" - else - doc_line="$(printf ' %-22s %s' "$the_opt" "$the_doc")" - fi - else - doc_line="$doc_line\\n$(printf '%-24s %s' "" "$the_doc")" - fi - the_doc="$(expr "$remaining_doc" : '\(.*\) ')" - done - - if [ "$category" = COMMON ]; then - common_documentation="${common_documentation}\\n\" -#line $lineno \"$kf\" -\"$(echo "$doc_line" | sed 's,'\'',\\'\'',g;s,",\\",g')" - common_manpage_documentation="${common_manpage_documentation} -.IP \"$the_manopt\" -$mandoc" - elif [ "$category" != UNDOCUMENTED ]; then - remaining_documentation="${remaining_documentation}\\n\" -#line $lineno \"$kf\" -\"$(echo "$doc_line" | sed 's,'\'',\\'\'',g;s,",\\",g')" - remaining_manpage_documentation="${remaining_manpage_documentation} -.IP \"$the_manopt\" -$mandoc" - fi - fi - - if [ "$smtname" -a "$category" != UNDOCUMENTED ]; then - if [ "$category" = COMMON ]; then - common_manpage_smt_documentation="${common_manpage_smt_documentation} -.TP -.B \"$smtname\" -($type) $mansmtdoc" - else - remaining_manpage_smt_documentation="${remaining_manpage_smt_documentation} -.TP -.B \"$smtname\" -($type) $mansmtdoc" - fi - fi - if [ "$internal" != - ]; then - if [ -z "$default_value" ]; then - typedefault="($type)" - else - typedefault="($type, default = $default_value)" - fi - typedefault="`echo "$typedefault" | sed 's,-,\\\\\\-,g'`" - if [ "$category" = COMMON ]; then - common_manpage_internals_documentation="${common_manpage_internals_documentation} -.TP -.B \"$internal\" -$typedefault -.br -$mansmtdoc" - else - remaining_manpage_internals_documentation="${remaining_manpage_internals_documentation} -.TP -.B \"$internal\" -$typedefault -.br -$mansmtdoc" - fi - fi - else - if [ "$the_opt" -a "$category" != UNDOCUMENTED ]; then - if [ "$category" = COMMON ]; then - common_manpage_documentation="${common_manpage_documentation} -$@" - else - remaining_manpage_documentation="${remaining_manpage_documentation} -$@" - fi - fi - - if [ "$smtname" -a "$category" != UNDOCUMENTED ]; then - if [ "$category" = COMMON ]; then - common_manpage_smt_documentation="${common_manpage_smt_documentation} -$@" - else - remaining_manpage_smt_documentation="${remaining_manpage_smt_documentation} -$@" - fi - fi - - if [ "$internal" != - ]; then - if [ "$category" = COMMON ]; then - common_manpage_internals_documentation="${common_manpage_internals_documentation} -$@" - else - remaining_manpage_internals_documentation="${remaining_manpage_internals_documentation} -$@" - fi - fi - fi -} - -function doc-alternate { - # doc-alternate text... - check_module_seen - expect_doc_alternate=false - - if $expect_doc; then - ERR "must provide documentation before alternate documentation" - fi - - if [ -z "$short_option_alternate" -a -z "$long_option_alternate" ]; then - ERR "cannot document an alternative for option \`$internal'; one does not exist" - fi - - if [ "$category" = UNDOCUMENTED ]; then - return - fi - - if ! $alternate_options_already_documented; then - alternate_options_already_documented=true - the_opt= - if [ "$long_option_alternate" ]; then - the_opt="--$long_option_alternate" - shortoptarg= - if expr "$the_opt" : '.*=' &>/dev/null; then - shortoptarg="$(echo "$the_opt" | sed 's,[^=]*=, ,')" - fi - if [ "$short_option_alternate" ]; then - the_opt="$the_opt | -$short_option_alternate$shortoptarg" - fi - elif [ "$short_option_alternate" ]; then - the_opt="-$short_option_alternate" - fi - if [ -z "$the_opt" ]; then - # nothing to document - return - fi - - the_doc="$@" - if [ "$category" = EXPERT ]; then - the_doc="$the_doc (EXPERTS only)" - fi - - doc_line= - while [ -n "$the_doc" ]; do - remaining_doc="$(expr "$the_doc " : '.\{1,53\} \(.*\)')" - the_doc="$(expr "$the_doc " : '\(.\{1,53\}\) ')" - if [ -z "$doc_line" ]; then - if expr "$the_opt" : '.\{23\}' &>/dev/null; then - # break into two lines - doc_line="$(printf ' %s\\n\\\n%-24s %s' "$the_opt" "" "$the_doc")" - else - doc_line="$(printf ' %-22s %s' "$the_opt" "$the_doc")" - fi - else - doc_line="$doc_line\\n$(printf '%-24s %s' "" "$the_doc")" - fi - the_doc="$(expr "$remaining_doc" : '\(.*\) ')" - done - - # in man, minus sign is \-, different from hyphen - the_manopt="`echo "$the_opt" | sed 's,-,\\\\\\-,g'`" - - if [ "$category" = COMMON ]; then - common_documentation="${common_documentation}\\n\" -#line $lineno \"$kf\" -\"$(echo "$doc_line" | sed 's,'\'',\\'\'',g;s,",\\",g')" - common_manpage_documentation="${common_manpage_documentation} -.IP \"$the_manopt\" -$@" - else - remaining_documentation="${remaining_documentation}\\n\" -#line $lineno \"$kf\" -\"$(echo "$doc_line" | sed 's,'\'',\\'\'',g;s,",\\",g')" - remaining_manpage_documentation="${remaining_manpage_documentation} -.IP \"$the_manopt\" -$@" - fi - else - if [ "$category" = COMMON ]; then - common_manpage_documentation="${common_manpage_documentation} -$@" - else - remaining_manpage_documentation="${remaining_manpage_documentation} -$@" - fi - fi -} - -function check_doc { - if $expect_doc; then - if [ "$internal" != - ]; then - WARN "$internal is lacking documentation" - elif [ -n "$long_option" ]; then - WARN "option --$long_option is lacking documentation" - elif [ -n "$short_option" ]; then - WARN "option -$short_option is lacking documentation" - elif [ -n "$smtname" ]; then - WARN "SMT option $smtname is lacking documentation" - fi - expect_doc=false - elif ! $seen_doc; then - if [ -n "$internal" -a "$internal" != - ]; then - if [ -z "$default_value" ]; then - typedefault="($type)" - else - typedefault="($type, default = $default_value)" - fi - if [ "$category" = COMMON ]; then - common_manpage_internals_documentation="${common_manpage_internals_documentation} -.TP -.B \"$internal\" -$typedefault -.br -[undocumented]" - else - remaining_manpage_internals_documentation="${remaining_manpage_internals_documentation} -.TP -.B \"$internal\" -$typedefault -.br -[undocumented]" - fi - fi - fi - - if $expect_doc_alternate; then - WARN "$internal is lacking documentation for the alternative option(s): $short_option_alternate $long_option_alternate" - expect_doc_alternate=false - fi -} - -function check_module_seen { - if $seen_endmodule; then - ERR "command after \"endmodule\" declaration (endmodule has to be last)" - fi - if ! $seen_module; then - ERR "no \"module\" declaration found (it has to be first)" - fi -} - -function check_include { - if ! expr "$1" : '".*"$' &>/dev/null && ! expr "$1" : '<.*>$' &>/dev/null; then - echo "\"$1\"" - else - echo "$1" - fi -} - -function apply_sed_files_to_template { - template="$1" - sed_files="$2" - command="$3" - - filename="$(basename "$sed_file")" - filename="${filename%.*}" - - echo "applying sed files $sed_files to $template to get $filename " 1>&2 - - sed_args="" - for file in $sed_files; do - sed_args+=" -f $file" - done - - echo "applying sed files $sed_args " 1>&2 - - output_working=$(sed $sed_args "$template") - error="$(echo "$output_working" | grep '.*\${[^}]*}.*' | head -n 1)" - if [ -n "$error" ]; then - error="$(echo "$error" | sed 's,.*\${\([^}]*\)}.*,\1,')" - kf="$template" - lineno=0 - ERR "undefined replacement \${$error}" - fi - - - # Output header (if this is a .cpp or .c or .h file) and then the - # processed text - - if expr "$filename" : '.*\.cpp$' &>/dev/null || expr "$filename" : '.*\.[ch]$' &>/dev/null; then - - - cat <&2 - - - for var in \ - module_id \ - module_name \ - module_includes \ - module_optionholder_spec \ - module_decls \ - module_specializations \ - module_inlines \ - module_accessors \ - module_global_definitions \ - ; do - repl="$(eval "echo \"\${$var}\"" | sed 's,\\,\\\\,g;s/,/\\,/g;s,&,\\\&,g;$!s,$,\\,g')" - # a little nasty; for multi-line replacements, bash can eat a final - # (blank) newline, and so we get a final \ on the final line, leading - # to malformed replacements in the sed script - repl2="$(echo "$repl" | sed '$s,\\*$,,')" - while [ "$repl" != "$repl2" ]; do - repl="$repl2" - repl2="$(echo "$repl" | sed '$s,\\*$,,')" - done - repl="$repl2" - echo -n ";s,$(eval echo "\$\{$var\}"),$repl,g" - done -} - -function output_summary_sed { - echo "generating summary sed" 1>&2 - - long_option_value_end=$n_long - - for var in \ - smt_getoption_handlers \ - smt_setoption_handlers \ - long_option_value_begin \ - long_option_value_end \ - option_handler_includes \ - all_modules_defaults \ - all_modules_short_options \ - all_modules_long_options \ - all_modules_smt_options \ - all_modules_option_handlers \ - all_modules_get_options \ - include_all_option_headers \ - all_modules_contributions \ - all_custom_handlers \ - common_documentation \ - remaining_documentation \ - common_manpage_documentation \ - remaining_manpage_documentation \ - common_manpage_smt_documentation \ - remaining_manpage_smt_documentation \ - common_manpage_internals_documentation \ - remaining_manpage_internals_documentation \ - ; do - let ++count - repl="$(eval "echo \"\${$var}\"" | sed 's,\\,\\\\,g;s/,/\\,/g;s,&,\\\&,g;$!s,$,\\,g')" - # a little nasty; for multi-line replacements, bash can eat a final - # (blank) newline, and so we get a final \ on the final line, leading - # to malformed replacements in the sed script - repl2="$(echo "$repl" | sed '$s,\\*$,,')" - while [ "$repl" != "$repl2" ]; do - repl="$repl2" - repl2="$(echo "$repl" | sed '$s,\\*$,,')" - done - repl="$repl2" - echo -n ";s,$(eval echo "\$\{$var\}"),$repl,g" - done -} - - -function output_template_sed { - template="$1" - - echo "generating $template" 1>&2 - - # generate warnings about incorrect #line annotations in templates - nl -ba -s' ' "$template" | grep '^ *[0-9][0-9]* # *line' | - awk '{OFS="";if($1+1!=$3) print "'"$template"':",$1,": warning: incorrect annotation \"#line ",$3,"\" (it should be \"#line ",($1+1),"\")"}' >&2 - - long_option_value_end=$n_long - - for var in \ - template \ - ; do - let ++count - repl="$(eval "echo \"\${$var}\"" | sed 's,\\,\\\\,g;s/,/\\,/g;s,&,\\\&,g;$!s,$,\\,g')" - # a little nasty; for multi-line replacements, bash can eat a final - # (blank) newline, and so we get a final \ on the final line, leading - # to malformed replacements in the sed script - repl2="$(echo "$repl" | sed '$s,\\*$,,')" - while [ "$repl" != "$repl2" ]; do - repl="$repl2" - repl2="$(echo "$repl" | sed '$s,\\*$,,')" - done - repl="$repl2" - echo -n ";s,$(eval echo "\$\{$var\}"),$repl,g" - done -} - - - -function scan_module { - kf="$1"; - - echo "scanning $kf" >&2 - let ++count - #progress "$kf" $count $total - - seen_module=false - seen_endmodule=false - b=$(basename $(dirname "$kf")) - lineno=0 - # IFS= forces read to read an entire line - while IFS= read -r line; do - let ++lineno - # read any continuations of the line - continuation_pattern='^.*\\$' - while [[ $line =~ $continuation_pattern ]]; do - IFS= read -r line2 - line="$(echo "$line" | sed 's,\\$,,')$line2" - let ++lineno - done - doc_pattern='^[ ].*' - empty_doc_pattern='^\.[ ]*$' - malformed_pattern='^\.' - doc_alternate_pattern='^/.*' - if [[ $line =~ $doc_pattern ]]; then - doc "$(echo "$line" | sed 's,^[ ],,')" - elif [[ $line =~ $empty_doc_pattern ]]; then - doc "" - elif [[ $line =~ $malformed_pattern ]]; then - ERR "malformed line during processing of option \`$internal': continuation lines should not have content" - elif [[ $line =~ $doc_alternate_pattern ]]; then - doc-alternate "$(echo "$line" | sed 's,^/,,')" - else - line="$(echo "$line" | sed 's,\([<>&()!?*]\),\\\1,g')" - #progress "$kf" $count $total - if ! eval "$line"; then - ERR "error was due to evaluation of this line" - fi - fi - done < "$kf" - - if ! $seen_module; then - ERR "no module content found in file!" - fi - if ! $seen_endmodule; then - ERR "no \"endmodule\" declaration found (it is required at the end)" - fi - - echo "done scanning $kf" >&2 -} - - -running_command="$1" - -if [ "$running_command" = "module-sed" ]; then -# mkoptions module-sed options-file - echo "args: $#" >&2 - if [ "$#" -eq 2 ]; then - options_file="$2" - scan_module "$options_file" - output_module_sed "$options_file" - else - usage - exit 1 - fi -elif [ "$running_command" = "apply-sed-files-to-template" ]; then -# mkoptions apply-sed-files-to-template template-file (sed-file)* - echo "args: $#" >&2 - if [ "$#" -ge 2 ]; then - shift; - options_template="$1"; shift - sed_files="$@" - apply_sed_files_to_template "$options_template" "$sed_files" "$*" - else - usage - exit 1 - fi -elif [ "$running_command" = "summary-sed" ]; then -# mkoptions summary-sed (options-file)* - echo "args: $#" >&2 - shift; - - while [ $# -gt 0 ]; do - kf="$1"; shift - scan_module "$kf" - done - output_summary_sed -elif [ "$running_command" = "template-sed" ]; then -# mkoptions template-sed template-file - if [ "$#" -eq 2 ]; then - template_file="$2" - output_template_sed "$template_file" - else - echo "$me: error: expected -t on command line" >&2 - usage - exit 1 - fi -else - echo "$me: error: $running_command" >&2 - usage - exit 1 -fi - -exit 0 - diff --git a/src/options/mkoptions.py b/src/options/mkoptions.py new file mode 100755 index 000000000..5020920ff --- /dev/null +++ b/src/options/mkoptions.py @@ -0,0 +1,1448 @@ +#!/usr/bin/env python3 +""" + Generate option handling code and documentation in one pass. The generated + files are only written to the destination file if the contents of the file + has changed (in order to avoid global re-compilation if only single option + files changed). + + mkoptions.py + + + location of all *_template.{cpp,h} files + location of all *_template documentation files + destination directory for the generated source code files + + one or more *_optios.toml files + + + Directory must contain: + - options_template.cpp + - module_template.cpp + - options_holder_template.h + - module_template.h + + Directory must contain: + - cvc4.1_template + - options.3cvc_template + - SmtEngine.3cvc_template + These files get generated during autogen.sh from the corresponding *.in + files in doc/. Note that for the generated documentation files tpl-doc is + also the destination directory. + + + must be the list of all *.toml option configuration files from + the src/options directory. + + + The script generates the following files: + - /MODULE_options.h + - /MODULE_options.cpp + - /options_holder.h + - /options.cpp + - /cvc4.1 + - /options.3 + - /SmtEngine.3 +""" + +import ast +import os +import re +import sys +import textwrap + +### Allowed attributes for module/option/alias + +MODULE_ATTR_REQ = ['id', 'name', 'header'] +MODULE_ATTR_ALL = MODULE_ATTR_REQ + ['options', 'aliases'] + +OPTION_ATTR_REQ = ['category', 'type'] +OPTION_ATTR_ALL = OPTION_ATTR_REQ + [ + 'name', 'help', 'smt_name', 'short', 'long', 'default', 'includes', + 'handler', 'predicates', 'notifies', 'links', 'read_only', 'alternate' +] + +ALIAS_ATTR_REQ = ['category', 'long', 'links'] +ALIAS_ATTR_ALL = ALIAS_ATTR_REQ + ['help'] + +CATEGORY_VALUES = ['common', 'expert', 'regular', 'undocumented'] + +SUPPORTED_CTYPES = ['int', 'unsigned', 'unsigned long', 'long', 'float', + 'double'] + +### Other globals + +g_long_to_opt = dict() # maps long options to option objects +g_module_id_cache = dict() # maps ids to filename/lineno +g_long_cache = dict() # maps long options to filename/fileno +g_short_cache = dict() # maps short options to filename/fileno +g_smt_cache = dict() # maps smt options to filename/fileno +g_name_cache = dict() # maps option names to filename/fileno +g_long_arguments = set() # set of long options that require an argument + +g_getopt_long_start = 256 + +### Source code templates + +TPL_HOLDER_MACRO_NAME = 'CVC4_OPTIONS__{id}__FOR_OPTION_HOLDER' + +TPL_RUN_HANDLER = \ +"""template <> options::{name}__option_t::type runHandlerAndPredicates( + options::{name}__option_t, + std::string option, + std::string optionarg, + options::OptionsHandler* handler) +{{ + options::{name}__option_t::type retval = {handler}; + {predicates} + return retval; +}}""" + +TPL_DECL_ASSIGN = \ +"""template <> void Options::assign( + options::{name}__option_t, + std::string option, + std::string value);""" + +TPL_IMPL_ASSIGN = TPL_DECL_ASSIGN[:-1] + \ +""" +{{ + d_holder->{name} = + runHandlerAndPredicates(options::{name}, option, value, d_handler); + d_holder->{name}__setByUser__ = true; + Trace("options") << "user assigned option {name}" << std::endl; + {notifications} +}}""" + + +TPL_RUN_HANDLER_BOOL = \ +"""template <> void runBoolPredicates( + options::{name}__option_t, + std::string option, + bool b, + options::OptionsHandler* handler) +{{ + {predicates} +}}""" + +TPL_DECL_ASSIGN_BOOL = \ +"""template <> void Options::assignBool( + options::{name}__option_t, + std::string option, + bool value);""" + +TPL_IMPL_ASSIGN_BOOL = TPL_DECL_ASSIGN_BOOL[:-1] + \ +""" +{{ + runBoolPredicates(options::{name}, option, value, d_handler); + d_holder->{name} = value; + d_holder->{name}__setByUser__ = true; + Trace("options") << "user assigned option {name}" << std::endl; + {notifications} +}}""" + +TPL_CALL_ASSIGN_BOOL = \ + ' options->assignBool(options::{name}, {option}, {value});' + +TPL_CALL_ASSIGN = ' options->assign(options::{name}, {option}, optionarg);' + +TPL_CALL_SET_OPTION = 'setOption(std::string("{smtname}"), ("{value}"));' + +TPL_GETOPT_LONG = '{{ "{}", {}_argument, nullptr, {} }},' + +TPL_PUSHBACK_PREEMPT = 'extender->pushBackPreemption({});' + + +TPL_HOLDER_MACRO = '#define ' + TPL_HOLDER_MACRO_NAME + +TPL_HOLDER_MACRO_ATTR = " {name}__option_t::type {name};\\\n" +TPL_HOLDER_MACRO_ATTR += " bool {name}__setByUser__;" + + +TPL_OPTION_STRUCT_RW = \ +"""extern struct CVC4_PUBLIC {name}__option_t +{{ + typedef {type} type; + type operator()() const; + bool wasSetByUser() const; + void set(const type& v); +}} {name} CVC4_PUBLIC;""" + +TPL_OPTION_STRUCT_RO = \ +"""extern struct CVC4_PUBLIC {name}__option_t +{{ + typedef {type} type; + type operator()() const; + bool wasSetByUser() const; +}} {name} CVC4_PUBLIC;""" + + +TPL_DECL_SET = \ +"""template <> void Options::set( + options::{name}__option_t, + const options::{name}__option_t::type& x);""" + +TPL_IMPL_SET = TPL_DECL_SET[:-1] + \ +""" +{{ + d_holder->{name} = x; +}}""" + + +TPL_DECL_OP_BRACKET = \ +"""template <> const options::{name}__option_t::type& Options::operator[]( + options::{name}__option_t) const;""" + +TPL_IMPL_OP_BRACKET = TPL_DECL_OP_BRACKET[:-1] + \ +""" +{{ + return d_holder->{name}; +}}""" + + +TPL_DECL_WAS_SET_BY_USER = \ +"""template <> bool Options::wasSetByUser(options::{name}__option_t) const;""" + +TPL_IMPL_WAS_SET_BY_USER = TPL_DECL_WAS_SET_BY_USER[:-1] + \ +""" +{{ + return d_holder->{name}__setByUser__; +}}""" + + +# Option specific methods + +TPL_IMPL_OPTION_SET = \ +"""inline void {name}__option_t::set(const {name}__option_t::type& v) +{{ + Options::current()->set(*this, v); +}}""" + +TPL_IMPL_OP_PAR = \ +"""inline {name}__option_t::type {name}__option_t::operator()() const +{{ + return (*Options::current())[*this]; +}}""" + +TPL_IMPL_OPTION_WAS_SET_BY_USER = \ +"""inline bool {name}__option_t::wasSetByUser() const +{{ + return Options::current()->wasSetByUser(*this); +}}""" + + + +class Module(object): + """Options module. + + An options module represents a MODULE_options.toml option configuration + file and contains lists of options and aliases. + """ + def __init__(self, d): + self.__dict__ = dict((k, None) for k in MODULE_ATTR_ALL) + self.options = [] + self.aliases = [] + for (attr, val) in d.items(): + assert attr in self.__dict__ + if val: + self.__dict__[attr] = val + + +class Option(object): + """Module option. + + An instance of this class corresponds to an option defined in a + MODULE_options.toml configuration file specified via [[option]]. + """ + def __init__(self, d): + self.__dict__ = dict((k, None) for k in OPTION_ATTR_ALL) + self.includes = [] + self.predicates = [] + self.notifies = [] + self.links = [] + self.read_only = False + self.alternate = True # add --no- alternative long option for bool + self.lineno = None + self.filename = None + for (attr, val) in d.items(): + assert attr in self.__dict__ + if attr in ['read_only', 'alternate'] or val: + self.__dict__[attr] = val + + +class Alias(object): + """Module alias. + + An instance of this class corresponds to an alias defined in a + MODULE_options.toml configuration file specified via [[alias]]. + """ + def __init__(self, d): + self.__dict__ = dict((k, None) for k in ALIAS_ATTR_ALL) + self.links = [] + self.lineno = None + self.filename = None + self.alternate_for = None # replaces a --no- alternative for an option + for (attr, val) in d.items(): + assert attr in self.__dict__ + if val: + self.__dict__[attr] = val + + +def die(msg): + sys.exit('[error] {}'.format(msg)) + + +def perr(filename, lineno, msg): + die('parse error in {}:{}: {}'.format(filename, lineno + 1, msg)) + + +def write_file(directory, name, content): + """ + Write string 'content' to file directory/name. If the file already exists, + we first check if the contents of the file is different from 'content' + before overwriting the file. + """ + fname = os.path.join(directory, name) + try: + if os.path.isfile(fname): + with open(fname, 'r') as file: + if content == file.read(): + print('{} is up-to-date'.format(name)) + return + with open(fname, 'w') as file: + print('generated {}'.format(name)) + file.write(content) + except IOError: + die("Could not write '{}'".format(fname)) + + +def read_tpl(directory, name): + """ + Read a template file directory/name. The contents of the template file will + be read into a string, which will later be used to fill in the generated + code/documentation via format. Hence, we have to escape curly braces. All + placeholder variables in the template files are enclosed in ${placeholer}$ + and will be {placeholder} in the returned string. + """ + fname = os.path.join(directory, name) + try: + # Escape { and } since we later use .format to add the generated code. + # Further, strip ${ and }$ from placeholder variables in the template + # file. + with open(fname, 'r') as file: + contents = \ + file.read().replace('{', '{{').replace('}', '}}').\ + replace('${', '').replace('}$', '') + return contents + except IOError: + die("Could not find '{}'. Aborting.".format(fname)) + + +def match_option(long_name): + """ + Lookup option by long_name option name. The function returns a tuple of (option, + bool), where the bool indicates the option value (true if not alternate, + false if alternate option). + """ + global g_long_to_opt + val = True + opt = None + long_name = lstrip('--', long_get_option(long_name)) + if long_name.startswith('no-'): + opt = g_long_to_opt.get(lstrip('no-', long_name)) + # Check if we generated an alternative option + if opt and opt.type == 'bool' and opt.alternate: + val = False + else: + opt = g_long_to_opt.get(long_name) + return (opt, val) + + +def long_get_arg(name): + """ + Extract the argument part ARG of a long_name option long_name=ARG. + """ + long_name = name.split('=') + assert len(long_name) <= 2 + return long_name[1] if len(long_name) == 2 else None + + +def long_get_option(name): + """ + Extract the name of a given long option long=ARG + """ + return name.split('=')[0] + + +def get_smt_name(option): + """ + Determine the name of the option used as SMT option name. If no smt_name is + given it defaults to the long option name. + """ + assert option.smt_name or option.long + return option.smt_name if option.smt_name else long_get_option(option.long) + + +def is_numeric_cpp_type(ctype): + """ + Check if given type is a numeric C++ type (this should cover the most + common cases). + """ + if ctype in SUPPORTED_CTYPES: + return True + elif re.match('u?int[0-9]+_t', ctype): + return True + return False + + +def format_include(include): + """ + Generate the #include directive for a given header name. + """ + if '<' in include: + return '#include {}'.format(include) + return '#include "{}"'.format(include) + + +def help_format_options(short_name, long_name): + """ + Format short and long options for the cmdline documentation + (--long | -short). + """ + opts = [] + arg = None + if long_name: + opts.append('--{}'.format(long_name)) + long_name = long_name.split('=') + if len(long_name) > 1: + arg = long_name[1] + + if short_name: + if arg: + opts.append('-{} {}'.format(short_name, arg)) + else: + opts.append('-{}'.format(short_name)) + + return ' | '.join(opts) + + +def help_format(help_msg, opts): + """ + Format cmdline documentation (--help) to be 80 chars wide. + """ + width = 80 + width_opt = 25 + wrapper = \ + textwrap.TextWrapper(width=width - width_opt, break_on_hyphens=False) + text = wrapper.wrap(help_msg.replace('"', '\\"')) + if len(opts) > width_opt - 3: + lines = [' {}'.format(opts)] + lines.append(' ' * width_opt + text[0]) + else: + lines = [' {}{}'.format(opts.ljust(width_opt - 2), text[0])] + lines.extend([' ' * width_opt + l for l in text[1:]]) + return ['"{}\\n"'.format(x) for x in lines] + + +def codegen_module(module, dst_dir, tpl_module_h, tpl_module_cpp): + """ + Generate code for each option module (*_options.{h,cpp}) + """ + global g_long_to_opt + + # *_options.h + includes = set() + holder_specs = [] + decls = [] + specs = [] + inls = [] + + # *_options_.cpp + accs = [] + defs = [] + + holder_specs.append(TPL_HOLDER_MACRO.format(id=module.id)) + + for option in \ + sorted(module.options, key=lambda x: x.long if x.long else x.name): + if option.name is None: + continue + + ### Generate code for {module.name}_options.h + includes.update([format_include(x) for x in option.includes]) + + # Generate option holder macro + holder_specs.append(TPL_HOLDER_MACRO_ATTR.format(name=option.name)) + + # Generate module declaration + tpl_decl = TPL_OPTION_STRUCT_RO if option.read_only else TPL_OPTION_STRUCT_RW + decls.append(tpl_decl.format(name=option.name, type=option.type)) + + # Generate module specialization + if not option.read_only: + specs.append(TPL_DECL_SET.format(name=option.name)) + specs.append(TPL_DECL_OP_BRACKET.format(name=option.name)) + specs.append(TPL_DECL_WAS_SET_BY_USER.format(name=option.name)) + + if option.type == 'bool': + specs.append(TPL_DECL_ASSIGN_BOOL.format(name=option.name)) + else: + specs.append(TPL_DECL_ASSIGN.format(name=option.name)) + + # Generate module inlines + inls.append(TPL_IMPL_OP_PAR.format(name=option.name)) + inls.append(TPL_IMPL_OPTION_WAS_SET_BY_USER.format(name=option.name)) + if not option.read_only: + inls.append(TPL_IMPL_OPTION_SET.format(name=option.name)) + + + ### Generate code for {module.name}_options.cpp + + # Accessors + if not option.read_only: + accs.append(TPL_IMPL_SET.format(name=option.name)) + accs.append(TPL_IMPL_OP_BRACKET.format(name=option.name)) + accs.append(TPL_IMPL_WAS_SET_BY_USER.format(name=option.name)) + + # Global definitions + defs.append('struct {name}__option_t {name};'.format(name=option.name)) + + + filename = os.path.splitext(os.path.split(module.header)[1])[0] + write_file(dst_dir, '{}.h'.format(filename), tpl_module_h.format( + filename=filename, + header=module.header, + id=module.id, + includes='\n'.join(sorted(list(includes))), + holder_spec=' \\\n'.join(holder_specs), + decls='\n'.join(decls), + specs='\n'.join(specs), + inls='\n'.join(inls) + )) + + write_file(dst_dir, '{}.cpp'.format(filename), tpl_module_cpp.format( + filename=filename, + accs='\n'.join(accs), + defs='\n'.join(defs) + )) + + +def docgen(category, name, smt_name, short_name, long_name, ctype, default, + help_msg, alternate, + help_common, man_common, man_common_smt, man_common_int, + help_others, man_others, man_others_smt, man_others_int): + """ + Generate the documentation for --help and all man pages. + """ + + ### Generate documentation + if category == 'common': + doc_cmd = help_common + doc_man = man_common + doc_smt = man_common_smt + doc_int = man_common_int + else: + doc_cmd = help_others + doc_man = man_others + doc_smt = man_others_smt + doc_int = man_others_int + + help_msg = help_msg if help_msg else '[undocumented]' + if category == 'expert': + help_msg += ' (EXPERTS only)' + + opts = help_format_options(short_name, long_name) + + # Generate documentation for cmdline options + if opts and category != 'undocumented': + help_cmd = help_msg + if ctype == 'bool' and alternate: + help_cmd += ' [*]' + doc_cmd.extend(help_format(help_cmd, opts)) + + # Generate man page documentation for cmdline options + doc_man.append('.IP "{}"'.format(opts.replace('-', '\\-'))) + doc_man.append(help_cmd.replace('-', '\\-')) + + # Escape - with \- for man page documentation + help_msg = help_msg.replace('-', '\\-') + + # Generate man page documentation for smt options + if smt_name or long_name: + smtname = smt_name if smt_name else long_get_option(long_name) + doc_smt.append('.TP\n.B "{}"'.format(smtname)) + if ctype: + doc_smt.append('({}) {}'.format(ctype, help_msg)) + else: + doc_smt.append(help_msg) + + # Generate man page documentation for internal options + if name: + doc_int.append('.TP\n.B "{}"'.format(name)) + if default: + assert ctype + doc_int.append('({}, default = {})'.format( + ctype, + default.replace('-', '\\-'))) + elif ctype: + doc_int.append('({})'.format(ctype)) + doc_int.append('.br\n{}'.format(help_msg)) + + + +def docgen_option(option, + help_common, man_common, man_common_smt, man_common_int, + help_others, man_others, man_others_smt, man_others_int): + """ + Generate documentation for options. + """ + docgen(option.category, option.name, option.smt_name, + option.short, option.long, option.type, option.default, + option.help, option.alternate, + help_common, man_common, man_common_smt, man_common_int, + help_others, man_others, man_others_smt, man_others_int) + + +def docgen_alias(alias, + help_common, man_common, man_common_smt, man_common_int, + help_others, man_others, man_others_smt, man_others_int): + """ + Generate documentation for aliases. + """ + docgen(alias.category, None, None, + None, alias.long, None, None, + alias.help, None, + help_common, man_common, man_common_smt, man_common_int, + help_others, man_others, man_others_smt, man_others_int) + + +def add_getopt_long(long_name, argument_req, getopt_long): + """ + For each long option we need to add an instance of the option struct in + order to parse long options (command-line) with getopt_long. Each long + option is associated with a number that gets incremented by one each time + we add a new long option. + """ + value = g_getopt_long_start + len(getopt_long) + getopt_long.append( + TPL_GETOPT_LONG.format( + long_get_option(long_name), + 'required' if argument_req else 'no', value)) + + +def codegen_all_modules(modules, dst_dir, tpl_options, tpl_options_holder, + doc_dir, tpl_man_cvc, tpl_man_smt, tpl_man_int): + """ + Generate code for all option modules (options.cpp, options_holder.h). + """ + + headers_module = [] # generated *_options.h header includes + headers_handler = set() # option includes (for handlers, predicates, ...) + macros_module = [] # option holder macro for options_holder.h + getopt_short = [] # short options for getopt_long + getopt_long = [] # long options for getopt_long + options_smt = [] # all options names accessible via {set,get}-option + options_getoptions = [] # options for Options::getOptions() + options_handler = [] # option handler calls + defaults = [] # default values + custom_handlers = [] # custom handler implementations assign/assignBool + help_common = [] # help text for all common options + help_others = [] # help text for all non-common options + setoption_handlers = [] # handlers for set-option command + getoption_handlers = [] # handlers for get-option command + + # other documentation + man_common = [] + man_others = [] + man_common_smt = [] + man_others_smt = [] + man_common_int = [] + man_others_int = [] + + for module in modules: + headers_module.append(format_include(module.header)) + macros_module.append(TPL_HOLDER_MACRO_NAME.format(id=module.id)) + + if module.options or module.aliases: + help_others.append( + '"\\nFrom the {} module:\\n"'.format(module.name)) + man_others.append('.SH {} OPTIONS'.format(module.name.upper())) + man_others_smt.append( + '.TP\n.I "{} OPTIONS"'.format(module.name.upper())) + man_others_int.append(man_others_smt[-1]) + + + for option in \ + sorted(module.options, key=lambda x: x.long if x.long else x.name): + assert option.type != 'void' or option.name is None + assert option.name or option.smt_name or option.short or option.long + argument_req = option.type not in ['bool', 'void'] + + docgen_option(option, + help_common, man_common, man_common_smt, + man_common_int, help_others, man_others, + man_others_smt, man_others_int) + + # Generate handler call + handler = None + if option.handler: + if option.type == 'void': + handler = 'handler->{}(option)'.format(option.handler) + else: + handler = \ + 'handler->{}(option, optionarg)'.format(option.handler) + elif option.type != 'bool': + handler = \ + 'handleOption<{}>(option, optionarg)'.format(option.type) + + # Generate predicate calls + predicates = [] + if option.predicates: + if option.type == 'bool': + predicates = \ + ['handler->{}(option, b);'.format(x) \ + for x in option.predicates] + else: + assert option.type != 'void' + predicates = \ + ['handler->{}(option, retval);'.format(x) \ + for x in option.predicates] + + # Generate notification calls + notifications = \ + ['d_handler->{}(option);'.format(x) for x in option.notifies] + + + # Generate options_handler and getopt_long + cases = [] + if option.short: + cases.append("case '{}':".format(option.short)) + + getopt_short.append(option.short) + if argument_req: + getopt_short.append(':') + + if option.long: + cases.append( + 'case {}:// --{}'.format( + g_getopt_long_start + len(getopt_long), + option.long)) + add_getopt_long(option.long, argument_req, getopt_long) + + if cases: + if option.type == 'bool' and option.name: + cases.append( + TPL_CALL_ASSIGN_BOOL.format( + name=option.name, + option='option', + value='true')) + elif option.type != 'void' and option.name: + cases.append( + TPL_CALL_ASSIGN.format( + name=option.name, + option='option', + value='optionarg')) + elif handler: + cases.append('{};'.format(handler)) + + cases.extend( + [TPL_PUSHBACK_PREEMPT.format('"{}"'.format(x)) \ + for x in option.links]) + cases.append(' break;\n') + + options_handler.extend(cases) + + + # Generate handlers for setOption/getOption + if option.smt_name or option.long: + smtlinks = [] + for link in option.links: + m = match_option(link) + assert m + smtname = get_smt_name(m[0]) + assert smtname + smtlinks.append( + TPL_CALL_SET_OPTION.format( + smtname=smtname, + value='true' if m[1] else 'false' + )) + + # Make smt_name and long name available via set/get-option + keys = set() + if option.smt_name: + keys.add(option.smt_name) + if option.long: + keys.add(long_get_option(option.long)) + assert keys + + cond = ' || '.join( + ['key == "{}"'.format(x) for x in sorted(keys)]) + + smtname = get_smt_name(option) + + setoption_handlers.append('if({}) {{'.format(cond)) + if option.type == 'bool': + setoption_handlers.append( + TPL_CALL_ASSIGN_BOOL.format( + name=option.name, + option='"{}"'.format(smtname), + value='optionarg == "true"')) + elif argument_req and option.name: + setoption_handlers.append( + TPL_CALL_ASSIGN.format( + name=option.name, + option='"{}"'.format(smtname))) + elif option.handler: + h = 'handler->{handler}("{smtname}"' + if argument_req: + h += ', optionarg' + h += ');' + setoption_handlers.append( + h.format(handler=option.handler, smtname=smtname)) + + if smtlinks: + setoption_handlers.append('\n'.join(smtlinks)) + setoption_handlers.append('return;') + setoption_handlers.append('}') + + if option.name: + getoption_handlers.append( + 'if ({}) {{'.format(cond)) + if option.type == 'bool': + getoption_handlers.append( + 'return options::{}() ? "true" : "false";'.format( + option.name)) + else: + getoption_handlers.append('std::stringstream ss;') + if is_numeric_cpp_type(option.type): + getoption_handlers.append( + 'ss << std::fixed << std::setprecision(8);') + getoption_handlers.append('ss << options::{}();'.format( + option.name)) + getoption_handlers.append('return ss.str();') + getoption_handlers.append('}') + + + # Add --no- alternative options for boolean options + if option.long and option.type == 'bool' and option.alternate: + cases = [] + cases.append( + 'case {}:// --no-{}'.format( + g_getopt_long_start + len(getopt_long), + option.long)) + cases.append( + TPL_CALL_ASSIGN_BOOL.format( + name=option.name, option='option', value='false')) + cases.append(' break;\n') + + options_handler.extend(cases) + + add_getopt_long('no-{}'.format(option.long), argument_req, + getopt_long) + + optname = option.smt_name if option.smt_name else option.long + # collect options available to the SMT-frontend + if optname: + options_smt.append('"{}",'.format(optname)) + + if option.name: + # Build options for options::getOptions() + if optname: + # collect SMT option names + options_smt.append('"{}",'.format(optname)) + + if option.type == 'bool': + s = '{ std::vector v; ' + s += 'v.push_back("{}"); '.format(optname) + s += 'v.push_back(std::string(' + s += 'd_holder->{}'.format(option.name) + s += ' ? "true" : "false")); ' + s += 'opts.push_back(v); }' + else: + s = '{ std::stringstream ss; ' + if is_numeric_cpp_type(option.type): + s += 'ss << std::fixed << std::setprecision(8); ' + s += 'ss << d_holder->{}; '.format(option.name) + s += 'std::vector v; ' + s += 'v.push_back("{}"); '.format(optname) + s += 'v.push_back(ss.str()); ' + s += 'opts.push_back(v); }' + options_getoptions.append(s) + + + # Define runBoolPredicates/runHandlerAndPredicates + tpl = None + if option.type == 'bool': + if predicates: + assert handler is None + tpl = TPL_RUN_HANDLER_BOOL + elif option.short or option.long: + assert option.type != 'void' + assert handler + tpl = TPL_RUN_HANDLER + if tpl: + custom_handlers.append( + tpl.format( + name=option.name, + handler=handler, + predicates='\n'.join(predicates) + )) + + # Define handler assign/assignBool + tpl = None + if option.type == 'bool': + tpl = TPL_IMPL_ASSIGN_BOOL + elif option.short or option.long or option.smt_name: + tpl = TPL_IMPL_ASSIGN + if tpl: + custom_handlers.append(tpl.format( + name=option.name, + notifications='\n'.join(notifications) + )) + + # Default option values + default = option.default if option.default else '' + defaults.append('{}({})'.format(option.name, default)) + defaults.append('{}__setByUser__(false)'.format(option.name)) + + + for alias in sorted(module.aliases, key=lambda x: x.long): + argument_req = '=' in alias.long + + options_handler.append( + 'case {}:// --{}'.format( + g_getopt_long_start + len(getopt_long), alias.long)) + + # If an alias replaces and alternate --no- option, we have to set + # the corresponding option to false + if alias.alternate_for: + assert alias.alternate_for.name + options_handler.append( + TPL_CALL_ASSIGN_BOOL.format( + name=alias.alternate_for.name, + option='option', value='false')) + + assert alias.links + arg = long_get_arg(alias.long) + for link in alias.links: + arg_link = long_get_arg(link) + if arg == arg_link: + options_handler.append( + TPL_PUSHBACK_PREEMPT.format( + '"{}"'.format(long_get_option(link)))) + if argument_req: + options_handler.append( + TPL_PUSHBACK_PREEMPT.format('optionarg.c_str()')) + else: + options_handler.append( + TPL_PUSHBACK_PREEMPT.format('"{}"'.format(link))) + + options_handler.append(' break;\n') + + add_getopt_long(alias.long, argument_req, getopt_long) + + docgen_alias(alias, + help_common, man_common, man_common_smt, + man_common_int, help_others, man_others, + man_others_smt, man_others_int) + + + write_file(dst_dir, 'options_holder.h', tpl_options_holder.format( + headers_module='\n'.join(headers_module), + macros_module='\n '.join(macros_module) + )) + + write_file(dst_dir, 'options.cpp', tpl_options.format( + headers_module='\n'.join(headers_module), + headers_handler='\n'.join(sorted(list(headers_handler))), + custom_handlers='\n'.join(custom_handlers), + module_defaults=',\n '.join(defaults), + help_common='\n'.join(help_common), + help_others='\n'.join(help_others), + cmdline_options='\n '.join(getopt_long), + options_short=''.join(getopt_short), + options_handler='\n '.join(options_handler), + option_value_begin=g_getopt_long_start, + option_value_end=g_getopt_long_start + len(getopt_long), + options_smt='\n '.join(options_smt), + options_getoptions='\n '.join(options_getoptions), + setoption_handlers='\n'.join(setoption_handlers), + getoption_handlers='\n'.join(getoption_handlers) + )) + + write_file(doc_dir, 'cvc4.1', tpl_man_cvc.format( + man_common='\n'.join(man_common), + man_others='\n'.join(man_others) + )) + + write_file(doc_dir, 'SmtEngine.3cvc', tpl_man_smt.format( + man_common_smt='\n'.join(man_common_smt), + man_others_smt='\n'.join(man_others_smt) + )) + + write_file(doc_dir, 'options.3cvc', tpl_man_int.format( + man_common_internals='\n'.join(man_common_int), + man_others_internals='\n'.join(man_others_int) + )) + + +def lstrip(prefix, s): + """ + Remove prefix from the beginning of string s. + """ + return s[len(prefix):] if s.startswith(prefix) else s + + +def rstrip(suffix, s): + """ + Remove suffix from the end of string s. + """ + return s[:-len(suffix)] if s.endswith(suffix) else s + + +def check_attribs(filename, lineno, req_attribs, valid_attribs, attribs, ctype): + """ + Check if for a given module/option/alias the defined attributes are valid and + if all required attributes are defined. + """ + msg_for = "" + if 'name' in attribs: + msg_for = " for '{}'".format(attribs['name']) + for k in req_attribs: + if k not in attribs: + perr(filename, lineno, + "required {} attribute '{}' not specified{}".format( + ctype, k, msg_for)) + for k in attribs: + if k not in valid_attribs: + perr(filename, lineno, + "invalid {} attribute '{}' specified{}".format( + ctype, k, msg_for)) + + +def check_unique(filename, lineno, value, cache): + """ + Check if given name is unique in cache. + """ + if value in cache: + perr(filename, lineno, + "'{}' already defined in '{}' at line {}".format( + value, cache[value][0], cache[value][1])) + cache[value] = (filename, lineno + 1) + + +def check_long(filename, lineno, long_name, ctype=None): + """ + Check if given long option name is valid. + """ + global g_long_cache + if long_name is None: + return + if long_name.startswith('--'): + perr(filename, lineno, 'remove -- prefix from long option') + r = r'^[0-9a-zA-Z\-=]+$' + if not re.match(r, long_name): + perr(filename, lineno, + "long option '{}' does not match regex criteria '{}'".format( + long_name, r)) + name = long_get_option(long_name) + check_unique(filename, lineno, name, g_long_cache) + + if ctype == 'bool': + check_unique(filename, lineno, 'no-{}'.format(name), g_long_cache) + + +def check_links(filename, lineno, links): + """ + Check if long options defined in links are valid and correctly used. + """ + global g_long_cache, g_long_arguments + for link in links: + long_name = lstrip('no-', lstrip('--', long_get_option(link))) + if long_name not in g_long_cache: + perr(filename, lineno, + "invalid long option '{}' in links list".format(link)) + # check if long option requires an argument + if long_name in g_long_arguments and '=' not in link: + perr(filename, lineno, + "linked option '{}' requires an argument".format(link)) + + +def check_alias_attrib(filename, lineno, attrib, value): + """ + Check alias attribute values. All attribute checks that can be done while + parsing should be done here. + """ + if attrib not in ALIAS_ATTR_ALL: + perr(filename, lineno, "invalid alias attribute '{}'".format(attrib)) + if attrib == 'category': + if value not in CATEGORY_VALUES: + perr(filename, lineno, "invalid category value '{}'".format(value)) + elif attrib == 'long': + pass # Will be checked after parsing is done + elif attrib == 'links': + assert isinstance(value, list) + if not value: + perr(filename, lineno, 'links list must not be empty') + + +def check_option_attrib(filename, lineno, attrib, value): + """ + Check option attribute values. All attribute checks that can be done while + parsing should be done here. + """ + global g_smt_cache, g_name_cache, g_short_cache + + if attrib not in OPTION_ATTR_ALL: + perr(filename, lineno, "invalid option attribute '{}'".format(attrib)) + + if attrib == 'category': + if value not in CATEGORY_VALUES: + perr(filename, lineno, "invalid category value '{}'".format(value)) + elif attrib == 'type': + if not value: + perr(filename, lineno, 'type must not be empty') + elif attrib == 'long': + pass # Will be checked after parsing is done + elif attrib == 'name' and value: + r = r'^[a-zA-Z]+[0-9a-zA-Z_]*$' + if not re.match(r, value): + perr(filename, lineno, + "name '{}' does not match regex criteria '{}'".format( + value, r)) + check_unique(filename, lineno, value, g_name_cache) + elif attrib == 'smt_name' and value: + r = r'^[a-zA-Z]+[0-9a-zA-Z\-_]*$' + if not re.match(r, value): + perr(filename, lineno, + "smt_name '{}' does not match regex criteria '{}'".format( + value, r)) + check_unique(filename, lineno, value, g_smt_cache) + elif attrib == 'short' and value: + if value[0].startswith('-'): + perr(filename, lineno, 'remove - prefix from short option') + if len(value) != 1: + perr(filename, lineno, 'short option must be of length 1') + if not value.isalpha() and not value.isdigit(): + perr(filename, lineno, 'short option must be a character or a digit') + check_unique(filename, lineno, value, g_short_cache) + elif attrib == 'default': + pass + elif attrib == 'includes' and value: + if not isinstance(value, list): + perr(filename, lineno, 'expected list for includes attribute') + elif attrib == 'handler': + pass + elif attrib == 'predicates' and value: + if not isinstance(value, list): + perr(filename, lineno, 'expected list for predicates attribute') + elif attrib == 'notifies' and value: + if not isinstance(value, list): + perr(filename, lineno, 'expected list for notifies attribute') + elif attrib == 'links' and value: + if not isinstance(value, list): + perr(filename, lineno, 'expected list for links attribute') + elif attrib in ['read_only', 'alternate'] and value is not None: + if not isinstance(value, bool): + perr(filename, lineno, + "expected true/false instead of '{}' for {}".format( + value, attrib)) + + +def check_module_attrib(filename, lineno, attrib, value): + """ + Check module attribute values. All attribute checks that can be done while + parsing should be done here. + """ + global g_module_id_cache + if attrib not in MODULE_ATTR_ALL: + perr(filename, lineno, "invalid module attribute '{}'".format(attrib)) + if attrib == 'id': + if not value: + perr(filename, lineno, 'module id must not be empty') + if value in g_module_id_cache: + perr(filename, lineno, + "module id '{}' already defined in '{}' at line {}".format( + value, + g_module_id_cache[value][0], + g_module_id_cache[value][1])) + g_module_id_cache[value] = (filename, lineno) + r = r'^[A-Z]+[A-Z_]*$' + if not re.match(r, value): + perr(filename, lineno, + "module id '{}' does not match regex criteria '{}'".format( + value, r)) + elif attrib == 'name': + if not value: + perr(filename, lineno, 'module name must not be empty') + elif attrib == 'header': + if not value: + perr(filename, lineno, 'module header must not be empty') + header_name = \ + 'options/{}.h'.format(rstrip('.toml', os.path.basename(filename))) + if header_name != value: + perr(filename, lineno, + "expected module header '{}' instead of '{}'".format( + header_name, value)) + + +def parse_value(filename, lineno, attrib, val): + """ + Parse attribute values. + We only allow three types of values: + - bool (val either true/false or "true"/"false") + - string (val starting with ") + - lists (val starting with [) + """ + if val[0] == '"': + if val[-1] != '"': + perr(filename, lineno, 'missing closing " for string') + val = val.lstrip('"').rstrip('"').replace('\\"', '"') + + # for read_only/alternate we allow both true/false and "true"/"false" + if attrib in ['read_only', 'alternate']: + if val == 'true': + return True + elif val == 'false': + return False + return val if val else None + elif val[0] == '[': + try: + val_list = ast.literal_eval(val) + except SyntaxError as e: + perr(filename, lineno, 'parsing list: {}'.format(e.msg)) + return val_list + elif val == 'true': + return True + elif val == 'false': + return False + else: + perr(filename, lineno, "invalid value '{}'".format(val)) + return None + + +def parse_module(filename, file): + """ + Parse options module file. + + Note: We could use an existing toml parser to parse the configuration + files. However, since we only use a very restricted feature set of the + toml format, we chose to implement our own parser to get better error + messages. + """ + module = dict() + options = [] + aliases = [] + lines = [[x.strip() for x in line.split('=', 1)] for line in file] + option = None + alias = None + option_lines = [] + alias_lines = [] + for i in range(len(lines)): + assert option is None or alias is None + line = lines[i] + # Skip comments + if line[0].startswith('#'): + continue + # Check if a new option/alias starts. + if len(line) == 1: + # Create a new option/alias object, save previously created + if line[0] in ['[[option]]', '[[alias]]']: + if option: + options.append(option) + option = None + if alias: + aliases.append(alias) + alias = None + # Create new option dict and save line number where option + # was defined. + if line[0] == '[[option]]': + assert alias is None + option = dict() + option_lines.append(i) + else: + # Create new alias dict and save line number where alias + # was defined. + assert line[0] == '[[alias]]' + assert option is None + alias = dict() + # Save line number where alias was defined + alias_lines.append(i) + elif line[0] != '': + perr(filename, i, "invalid attribute '{}'".format(line[0])) + # Parse module/option/alias attributes. + elif len(line) == 2: + attrib = line[0] + value = parse_value(filename, i, attrib, line[1]) + # All attributes we parse are part of the current option. + if option is not None: + check_option_attrib(filename, i, attrib, value) + if attrib in option: + perr(filename, i, + "duplicate option attribute '{}'".format(attrib)) + assert option is not None + option[attrib] = value + # All attributes we parse are part of the current alias. + elif alias is not None: + check_alias_attrib(filename, i, attrib, value) + if attrib in alias: + perr(filename, i, + "duplicate alias attribute '{}'".format(attrib)) + assert alias is not None + alias[attrib] = value + # All other attributes are part of the module. + else: + if attrib in module: + perr(filename, i, + "duplicate module attribute '{}'".format(attrib)) + check_module_attrib(filename, i, attrib, value) + module[attrib] = value + else: + perr(filename, i, "invalid attribute '{}'".format(line[0])) + + # Save previously parsed option/alias + if option: + options.append(option) + if alias: + aliases.append(alias) + + # Check if parsed module attributes are valid and if all required + # attributes are defined. + check_attribs(filename, 1, + MODULE_ATTR_REQ, MODULE_ATTR_ALL, module, 'module') + res = Module(module) + + # Check parsed option/alias attributes and create option/alias objects and + # associate file name and line number with options/aliases (required for + # better error reporting). + assert len(option_lines) == len(options) + assert len(alias_lines) == len(aliases) + for i in range(len(options)): + attribs = options[i] + lineno = option_lines[i] + check_attribs(filename, lineno, + OPTION_ATTR_REQ, OPTION_ATTR_ALL, attribs, 'option') + option = Option(attribs) + if option.short and not option.long: + perr(filename, lineno, + "short option '{}' specified but no long option".format( + option.short)) + if option.type == 'bool' and option.handler: + perr(filename, lineno, + 'specifying handlers for options of type bool is not allowed') + if option.category != 'undocumented' and not option.help: + perr(filename, lineno, + 'help text is required for {} options'.format(option.category)) + option.lineno = lineno + option.filename = filename + res.options.append(option) + + for i in range(len(aliases)): + attribs = aliases[i] + lineno = alias_lines[i] + check_attribs(filename, lineno, + ALIAS_ATTR_REQ, ALIAS_ATTR_ALL, attribs, 'alias') + alias = Alias(attribs) + alias.lineno = lineno + alias.filename = filename + res.aliases.append(alias) + + return res + + +def usage(): + print('mkoptions.py +') + print('') + print(' location of all *_template.{cpp,h} files') + print(' location of all *_template documentation files') + print(' destination directory for the generated files') + print(' + one or more *_optios.toml files') + print('') + + +def mkoptions_main(): + if len(sys.argv) < 5: + usage() + die('missing arguments') + + src_dir = sys.argv[1] + doc_dir = sys.argv[2] + dst_dir = sys.argv[3] + filenames = sys.argv[4:] + + # Check if given directories exist. + for d in [src_dir, doc_dir, dst_dir]: + if not os.path.isdir(d): + usage() + die("'{}' is not a directory".format(d)) + + # Check if given configuration files exist. + for file in filenames: + if not os.path.exists(file): + die("configuration file '{}' does not exist".format(file)) + + # Read source code template files from source directory. + tpl_module_h = read_tpl(src_dir, 'module_template.h') + tpl_module_cpp = read_tpl(src_dir, 'module_template.cpp') + tpl_options = read_tpl(src_dir, 'options_template.cpp') + tpl_options_holder = read_tpl(src_dir, 'options_holder_template.h') + + # Read documentation template files from documentation directory. + tpl_man_cvc = read_tpl(doc_dir, 'cvc4.1_template') + tpl_man_smt = read_tpl(doc_dir, 'SmtEngine.3cvc_template') + tpl_man_int = read_tpl(doc_dir, 'options.3cvc_template') + + # Parse files, check attributes and create module/option objects + modules = [] + for filename in filenames: + with open(filename, 'r') as file: + module = parse_module(filename, file) + # Check if long options are valid and unique. First populate + # g_long_cache with option.long and --no- alternatives if + # applicable. + for option in module.options: + check_long(option.filename, option.lineno, option.long, + option.type) + if option.long: + g_long_to_opt[long_get_option(option.long)] = option + # Add long option that requires an argument + if option.type not in ['bool', 'void']: + g_long_arguments.add(long_get_option(option.long)) + modules.append(module) + + # Check if alias.long is unique and check if alias.long defines an alias + # for an alternate (--no-) option for existing option . + for module in modules: + for alias in module.aliases: + # If an alias defines a --no- alternative for an existing boolean + # option, we do not create the alternative for the option, but use + # the alias instead. + if alias.long.startswith('no-'): + m = match_option(alias.long) + if m[0] and m[0].type == 'bool': + m[0].alternate = False + alias.alternate_for = m[0] + del g_long_cache[alias.long] + check_long(alias.filename, alias.lineno, alias.long) + # Add long option that requires an argument + if '=' in alias.long: + g_long_arguments.add(long_get_option(alias.long)) + + # Check if long options in links are valid (that needs to be done after all + # long options are available). + for module in modules: + for option in module.options: + check_links(option.filename, option.lineno, option.links) + for alias in module.aliases: + check_links(alias.filename, alias.lineno, alias.links) + + # Create *_options.{h,cpp} in destination directory + for module in modules: + codegen_module(module, dst_dir, tpl_module_h, tpl_module_cpp) + + # Create options.cpp and options_holder.h in destination directory + codegen_all_modules(modules, + dst_dir, tpl_options, tpl_options_holder, + doc_dir, tpl_man_cvc, tpl_man_smt, tpl_man_int) + + + +if __name__ == "__main__": + mkoptions_main() + sys.exit(0) diff --git a/src/options/base_options_template.cpp b/src/options/module_template.cpp similarity index 55% rename from src/options/base_options_template.cpp rename to src/options/module_template.cpp index 1093b83e6..191833706 100644 --- a/src/options/base_options_template.cpp +++ b/src/options/module_template.cpp @@ -1,33 +1,31 @@ /********************* */ -/*! \file base_options_template.cpp +/*! \file ${filename}$.cpp ** \verbatim ** Top contributors (to current version): - ** Morgan Deters, Paul Meng + ** Mathias Preiner ** This file is part of the CVC4 project. - ** Copyright (c) 2009-2017 by the authors listed in the file AUTHORS + ** Copyright (c) 2009-2018 by the authors listed in the file AUTHORS ** in the top-level source directory) and their institutional affiliations. ** All rights reserved. See the file COPYING in the top-level source ** directory for licensing information.\endverbatim ** - ** \brief Contains code for handling command-line options. + ** \brief Option template for option modules. ** - ** Contains code for handling command-line options + ** For each _options.toml configuration file, mkoptions.py + ** expands this template and generates a _options.cpp file. **/ #include "options/options_holder.h" namespace CVC4 { -${module_accessors} +${accs}$ -#line 24 "${template}" namespace options { -${module_global_definitions} +${defs}$ -#line 30 "${template}" -}/* CVC4::options namespace */ - -}/* CVC4 namespace */ +} // namespace options +} // namespace CVC4 diff --git a/src/options/module_template.h b/src/options/module_template.h new file mode 100644 index 000000000..47c9ec3fd --- /dev/null +++ b/src/options/module_template.h @@ -0,0 +1,51 @@ +/********************* */ +/*! \file ${filename}$.h + ** \verbatim + ** Top contributors (to current version): + ** Mathias Preiner + ** This file is part of the CVC4 project. + ** Copyright (c) 2009-2018 by the authors listed in the file AUTHORS + ** in the top-level source directory) and their institutional affiliations. + ** All rights reserved. See the file COPYING in the top-level source + ** directory for licensing information.\endverbatim + ** + ** \brief Contains code for handling command-line options. + ** + ** For each _options.toml configuration file, mkoptions.py + ** expands this template and generates a _options.h file. + **/ + +#include "cvc4_private.h" + +#ifndef __CVC4__OPTIONS__${id}$_H +#define __CVC4__OPTIONS__${id}$_H + +#include "options/options.h" + +${includes}$ + + +${holder_spec}$ + + +namespace CVC4 { + +namespace options { + +${decls}$ + + +} // namespace options + +${specs}$ + + +namespace options { + +${inls}$ + + +} // namespace options +} // namespace CVC4 + +#endif /* __CVC4__OPTIONS__${id}$_H */ diff --git a/src/options/options_get_option_template.cpp b/src/options/options_get_option_template.cpp deleted file mode 100644 index 8a88abaa5..000000000 --- a/src/options/options_get_option_template.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/********************* */ -/*! \file options_get_option_template.cpp - ** \verbatim - ** Top contributors (to current version): - ** Tim King, Paul Meng - ** This file is part of the CVC4 project. - ** Copyright (c) 2009-2017 by the authors listed in the file AUTHORS - ** in the top-level source directory) and their institutional affiliations. - ** All rights reserved. See the file COPYING in the top-level source - ** directory for licensing information.\endverbatim - ** - ** \brief Implementation of OptionsHandler::getOption. - ** - ** This template file is expanded into the cpp implementation of - ** OptionsHandler::setOption. The file is essentially the contents - ** of the ${smt_getoption_handlers} variable in the options/mkoptions - ** script. This variable depends on all options files. To generate this file, - ** first generate options/summary.sed. - **/ - -#include -#include -#include - - -#include "base/output.h" -#include "base/modal_exception.h" -#include "options/option_exception.h" -#include "options/options.h" -#include "options/options_handler.h" - - -${include_all_option_headers} -${option_handler_includes} - -#line 37 "${template}" - -using namespace std; - -namespace CVC4 { - -std::string Options::getOption(const std::string& key) const -{ - Trace("options") << "SMT getOption(" << key << ")" << endl; - - ${smt_getoption_handlers} - -#line 49 "${template}" - - throw UnrecognizedOptionException(key); -} - -}/* CVC4 namespace */ diff --git a/src/options/options_holder_template.h b/src/options/options_holder_template.h index 0d6da1e56..910f08e31 100644 --- a/src/options/options_holder_template.h +++ b/src/options/options_holder_template.h @@ -1,5 +1,5 @@ /********************* */ -/*! \file options_holder_template.h +/*! \file options_holder.h ** \verbatim ** Top contributors (to current version): ** Morgan Deters, Paul Meng @@ -19,22 +19,20 @@ #ifndef __CVC4__OPTIONS__OPTIONS_HOLDER_H #define __CVC4__OPTIONS__OPTIONS_HOLDER_H -${include_all_option_headers} +${headers_module}$ -#line 25 "${template}" namespace CVC4 { namespace options { struct OptionsHolder { OptionsHolder(); -${all_modules_contributions} + ${macros_module}$ -#line 34 "${template}" };/* struct OptionsHolder */ -}/* CVC4::options namespace */ -}/* CVC4 namespace */ +} // namespace options +} // namespace CVC4 #endif /* __CVC4__OPTIONS__OPTIONS_HOLDER_H */ diff --git a/src/options/options_set_option_template.cpp b/src/options/options_set_option_template.cpp deleted file mode 100644 index aa56163f2..000000000 --- a/src/options/options_set_option_template.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/********************* */ -/*! \file options_set_option_template.cpp - ** \verbatim - ** Top contributors (to current version): - ** Tim King, Paul Meng - ** This file is part of the CVC4 project. - ** Copyright (c) 2009-2017 by the authors listed in the file AUTHORS - ** in the top-level source directory) and their institutional affiliations. - ** All rights reserved. See the file COPYING in the top-level source - ** directory for licensing information.\endverbatim - ** - ** \brief Implementation of OptionsHandler::setOption. - ** - ** This template file is expanded into the cpp implementation of - ** OptionsHandler::setOption. The file is essentially the contents - ** of the ${smt_setoption_handlers} variable in the options/mkoptions - ** script. This variable depends on all options files. To generate this file, - ** first generate options/summary.sed. - **/ - - -#include -#include - -#include "base/modal_exception.h" -#include "base/output.h" -#include "options/option_exception.h" -#include "options/options.h" -#include "options/options_handler.h" - -${include_all_option_headers} -${option_handler_includes} - -#line 35 "${template}" - -using namespace std; - -namespace CVC4 { - -void Options::setOption(const std::string& key, const std::string& optionarg) -{ - options::OptionsHandler* handler = d_handler; - Trace("options") << "SMT setOption(" << key << ", " << optionarg << ")" << endl; - - ${smt_setoption_handlers} - -#line 48 "${template}" - - throw UnrecognizedOptionException(key); -} - -}/* CVC4 namespace */ diff --git a/src/options/options_template.cpp b/src/options/options_template.cpp index 43d825488..917dae687 100644 --- a/src/options/options_template.cpp +++ b/src/options/options_template.cpp @@ -1,5 +1,5 @@ /********************* */ -/*! \file options_template.cpp +/*! \file options.cpp ** \verbatim ** Top contributors (to current version): ** Tim King, Morgan Deters, Kshitij Bansal @@ -58,17 +58,15 @@ extern int optreset; #include "options/language.h" #include "options/options_handler.h" -${include_all_option_headers} +${headers_module}$ -#line 64 "${template}" #include "options/options_holder.h" #include "cvc4autoconfig.h" #include "options/base_handlers.h" -${option_handler_includes} +${headers_handler}$ -#line 72 "${template}" using namespace CVC4; using namespace CVC4::options; @@ -388,9 +386,8 @@ Options::registerSetReplayLogFilename( return registerAndNotify(d_setReplayFilenameListeners, listener, notify); } -${all_custom_handlers} +${custom_handlers}$ -#line 394 "${template}" #ifdef CVC4_DEBUG # define USE_EARLY_TYPE_CHECKING_BY_DEFAULT true @@ -404,22 +401,22 @@ ${all_custom_handlers} # define DO_SEMANTIC_CHECKS_BY_DEFAULT true #endif /* CVC4_MUZZLED || CVC4_COMPETITION_MODE */ -options::OptionsHolder::OptionsHolder() : ${all_modules_defaults} +options::OptionsHolder::OptionsHolder() : + ${module_defaults}$ { } -#line 412 "${template}" static const std::string mostCommonOptionsDescription = "\ -Most commonly-used CVC4 options:${common_documentation}"; +Most commonly-used CVC4 options:\n" +${help_common}$; -#line 417 "${template}" static const std::string optionsDescription = mostCommonOptionsDescription + "\n\ \n\ -Additional CVC4 options:${remaining_documentation}"; +Additional CVC4 options:\n" +${help_others}$; -#line 423 "${template}" static const std::string optionsFootnote = "\n\ [*] Each of these options has a --no-OPTIONNAME variant, which reverses the\n\ @@ -496,11 +493,11 @@ void Options::printLanguageHelp(std::ostream& out) { * If you add something that has a short option equivalent, you should * add it to the getopt_long() call in parseOptions(). */ -static struct option cmdlineOptions[] = {${all_modules_long_options} +static struct option cmdlineOptions[] = { + ${cmdline_options}$ { NULL, no_argument, NULL, '\0' } };/* cmdlineOptions */ -#line 504 "${template}" // static void preemptGetopt(int& argc, char**& argv, const char* opt) { @@ -671,7 +668,7 @@ void Options::parseOptionsRecursive(Options* options, Debug("options") << "[ argc == " << argc << ", argv == " << argv << " ]" << std::endl; int c = getopt_long(argc, argv, - "+:${all_modules_short_options}", + "+:${options_short}$", cmdlineOptions, NULL); while(main_optind < optind) { @@ -721,9 +718,8 @@ void Options::parseOptionsRecursive(Options* options, << " (`" << char(c) << "'), " << option << std::endl; switch(c) { -${all_modules_option_handlers} +${options_handler}$ -#line 726 "${template}" case ':': // This can be a long or short option, and the way to get at the @@ -734,8 +730,8 @@ ${all_modules_option_handlers} case '?': default: if( ( optopt == 0 || - ( optopt >= ${long_option_value_begin} && - optopt <= ${long_option_value_end} ) + ( optopt >= ${option_value_begin}$ && + optopt <= ${option_value_end}$ ) ) && !strncmp(argv[optind - 1], "--thread", 8) && strlen(argv[optind - 1]) > 8 ) { @@ -801,8 +797,7 @@ std::string Options::suggestCommandLineOptions(const std::string& optionName) } static const char* smtOptions[] = { - ${all_modules_smt_options}, -#line 804 "${template}" + ${options_smt}$ NULL };/* smtOptions[] */ @@ -825,15 +820,36 @@ std::vector > Options::getOptions() const { std::vector< std::vector > opts; - ${all_modules_get_options} + ${options_getoptions}$ -#line 826 "${template}" return opts; } +void Options::setOption(const std::string& key, const std::string& optionarg) +{ + options::OptionsHandler* handler = d_handler; + Options *options = Options::current(); + Trace("options") << "SMT setOption(" << key << ", " << optionarg << ")" + << std::endl; + + ${setoption_handlers}$ + + + throw UnrecognizedOptionException(key); +} + +std::string Options::getOption(const std::string& key) const +{ + Trace("options") << "SMT getOption(" << key << ")" << std::endl; + + ${getoption_handlers}$ + + + throw UnrecognizedOptionException(key); +} #undef USE_EARLY_TYPE_CHECKING_BY_DEFAULT #undef DO_SEMANTIC_CHECKS_BY_DEFAULT -}/* CVC4 namespace */ +} // namespace CVC4 diff --git a/src/options/parser_options b/src/options/parser_options deleted file mode 100644 index d1e9aa142..000000000 --- a/src/options/parser_options +++ /dev/null @@ -1,35 +0,0 @@ -# -# Option specification file for CVC4 -# See src/options/base_options for a description of this file format -# - -module PARSER "options/parser_options.h" Parser - -common-option strictParsing --strict-parsing bool - be less tolerant of non-conforming inputs - -option memoryMap --mmap bool - memory map file input - -option semanticChecks semantic-checks /--no-checking bool :default DO_SEMANTIC_CHECKS_BY_DEFAULT :link /--no-type-checking - disable ALL semantic checks, including type checks - -option globalDeclarations global-declarations bool :default false - force all declarations and definitions to be global - -# this is to support security in the online version, and in other similar -# contexts (--no-include-file disables filesystem access in TPTP and SMT2 -# parsers) the name --no-include-file is legacy: it also now limits any -# filesystem access (read or write) for example by using --dump-to (or the -# equivalent set-option) or set-option -# :regular-output-channel/:diagnostic-output-channel. However, the main driver -# is still permitted to read the input file given on the command-line if any. -# creation/use of temp files are still permitted (but the paths aren't given by -# the user). Also note this is only safe for the version invoked through the -# main driver, there are ways via the API to get the CVC4 library to open a file -# for reading or writing and thus leak information from an existing file, or -# overwrite an existing file with malicious content. -undocumented-option filesystemAccess filesystem-access /--no-filesystem-access bool :default true -undocumented-alias --no-include-file = --no-filesystem-access - -endmodule diff --git a/src/options/parser_options.toml b/src/options/parser_options.toml new file mode 100644 index 000000000..988bcb6eb --- /dev/null +++ b/src/options/parser_options.toml @@ -0,0 +1,67 @@ +id = "PARSER" +name = "Parser" +header = "options/parser_options.h" + +[[option]] + name = "strictParsing" + category = "common" + long = "strict-parsing" + type = "bool" + read_only = true + help = "be less tolerant of non-conforming inputs" + +[[option]] + name = "memoryMap" + category = "regular" + long = "mmap" + type = "bool" + read_only = true + help = "memory map file input" + +[[option]] + name = "semanticChecks" + smt_name = "semantic-checks" + category = "regular" + type = "bool" + default = "DO_SEMANTIC_CHECKS_BY_DEFAULT" + read_only = true + help = "disable ALL semantic checks, including type checks" + +[[alias]] + category = "undocumented" + long = "no-checking" + links = ["--no-type-checking"] + +[[option]] + name = "globalDeclarations" + smt_name = "global-declarations" + category = "regular" + type = "bool" + default = "false" + read_only = true + help = "force all declarations and definitions to be global" + +# this is to support security in the online version, and in other similar +# contexts (--no-include-file disables filesystem access in TPTP and SMT2 +# parsers) the name --no-include-file is legacy: it also now limits any +# filesystem access (read or write) for example by using --dump-to (or the +# equivalent set-option) or set-option +# :regular-output-channel/:diagnostic-output-channel. However, the main driver +# is still permitted to read the input file given on the command-line if any. +# creation/use of temp files are still permitted (but the paths aren't given by +# the user). Also note this is only safe for the version invoked through the +# main driver, there are ways via the API to get the CVC4 library to open a file +# for reading or writing and thus leak information from an existing file, or +# overwrite an existing file with malicious content. +[[option]] + name = "filesystemAccess" + category = "undocumented" + long = "filesystem-access" + type = "bool" + default = "true" + read_only = true + +[[alias]] + category = "undocumented" + long = "no-include-file" + links = ["--no-filesystem-access"] diff --git a/src/options/printer_options b/src/options/printer_options deleted file mode 100644 index c276c0dd5..000000000 --- a/src/options/printer_options +++ /dev/null @@ -1,14 +0,0 @@ -# -# Option specification file for CVC4 -# See src/options/base_options for a description of this file format -# - -module PRINTER "options/printer_options.h" Printing - -option modelFormatMode --model-format=MODE ModelFormatMode :handler stringToModelFormatMode :default MODEL_FORMAT_MODE_DEFAULT :read-write :include "options/printer_modes.h" - print format mode for models, see --model-format=help - -option instFormatMode --inst-format=MODE InstFormatMode :handler stringToInstFormatMode :default INST_FORMAT_MODE_DEFAULT :read-write :include "options/printer_modes.h" - print format mode for instantiations, see --inst-format=help - -endmodule diff --git a/src/options/printer_options.toml b/src/options/printer_options.toml new file mode 100644 index 000000000..89ae3b559 --- /dev/null +++ b/src/options/printer_options.toml @@ -0,0 +1,23 @@ +id = "PRINTER" +name = "Printing" +header = "options/printer_options.h" + +[[option]] + name = "modelFormatMode" + category = "regular" + long = "model-format=MODE" + type = "ModelFormatMode" + default = "MODEL_FORMAT_MODE_DEFAULT" + handler = "stringToModelFormatMode" + includes = ["options/printer_modes.h"] + help = "print format mode for models, see --model-format=help" + +[[option]] + name = "instFormatMode" + category = "regular" + long = "inst-format=MODE" + type = "InstFormatMode" + default = "INST_FORMAT_MODE_DEFAULT" + handler = "stringToInstFormatMode" + includes = ["options/printer_modes.h"] + help = "print format mode for instantiations, see --inst-format=help" diff --git a/src/options/proof_options b/src/options/proof_options deleted file mode 100644 index 789513334..000000000 --- a/src/options/proof_options +++ /dev/null @@ -1,20 +0,0 @@ -# -# Option specification file for CVC4 -# See src/options/base_options for a description of this file format -# - -module PROOF "options/proof_options.h" Proof - -option lfscLetification --lfsc-letification bool :default true - turns on global letification in LFSC proofs - -option aggressiveCoreMin --aggressive-core-min bool :default false - turns on aggressive unsat core minimization (experimental) - -option fewerPreprocessingHoles --fewer-preprocessing-holes bool :default false :read-write - try to eliminate preprocessing holes in proofs - -option allowEmptyDependencies --allow-empty-dependencies bool :default false - if unable to track the dependencies of a rewritten/preprocessed assertion, fail silently - -endmodule diff --git a/src/options/proof_options.toml b/src/options/proof_options.toml new file mode 100644 index 000000000..a23241e3d --- /dev/null +++ b/src/options/proof_options.toml @@ -0,0 +1,38 @@ +id = "PROOF" +name = "Proof" +header = "options/proof_options.h" + +[[option]] + name = "lfscLetification" + category = "regular" + long = "lfsc-letification" + type = "bool" + default = "true" + read_only = true + help = "turns on global letification in LFSC proofs" + +[[option]] + name = "aggressiveCoreMin" + category = "regular" + long = "aggressive-core-min" + type = "bool" + default = "false" + read_only = true + help = "turns on aggressive unsat core minimization (experimental)" + +[[option]] + name = "fewerPreprocessingHoles" + category = "regular" + long = "fewer-preprocessing-holes" + type = "bool" + default = "false" + help = "try to eliminate preprocessing holes in proofs" + +[[option]] + name = "allowEmptyDependencies" + category = "regular" + long = "allow-empty-dependencies" + type = "bool" + default = "false" + read_only = true + help = "if unable to track the dependencies of a rewritten/preprocessed assertion, fail silently" diff --git a/src/options/prop_options b/src/options/prop_options deleted file mode 100644 index 87112197c..000000000 --- a/src/options/prop_options +++ /dev/null @@ -1,31 +0,0 @@ -# -# Option specification file for CVC4 -# See src/options/base_options for a description of this file format -# - -module PROP "options/prop_options.h" SAT layer - -option satRandomFreq random-frequency --random-freq=P double :default 0.0 :predicate doubleGreaterOrEqual0 doubleLessOrEqual1 - sets the frequency of random decisions in the sat solver (P=0.0 by default) -option satRandomSeed random-seed --random-seed=S uint32_t :default 0 :read-write - sets the random seed for the sat solver - -option satVarDecay double :default 0.95 :predicate doubleGreaterOrEqual0 doubleLessOrEqual1 - variable activity decay factor for Minisat -option satClauseDecay double :default 0.999 :predicate doubleGreaterOrEqual0 doubleLessOrEqual1 - clause activity decay factor for Minisat -option satRestartFirst --restart-int-base=N unsigned :default 25 - sets the base restart interval for the sat solver (N=25 by default) -option satRestartInc --restart-int-inc=F double :default 3.0 :predicate doubleGreaterOrEqual0 - sets the restart interval increase factor for the sat solver (F=3.0 by default) - -option sat_refine_conflicts --refine-conflicts bool :default false - refine theory conflict clauses (default false) - -option minisatUseElim --minisat-elimination bool :default true :read-write - use Minisat elimination - -option minisatDumpDimacs --minisat-dump-dimacs bool :default false - instead of solving minisat dumps the asserted clauses in Dimacs format - -endmodule diff --git a/src/options/prop_options.toml b/src/options/prop_options.toml new file mode 100644 index 000000000..5ad691e62 --- /dev/null +++ b/src/options/prop_options.toml @@ -0,0 +1,84 @@ +id = "PROP" +name = "SAT layer" +header = "options/prop_options.h" + +[[option]] + name = "satRandomFreq" + smt_name = "random-frequency" + category = "regular" + long = "random-freq=P" + type = "double" + default = "0.0" + predicates = ["doubleGreaterOrEqual0", "doubleLessOrEqual1"] + read_only = true + help = "sets the frequency of random decisions in the sat solver (P=0.0 by default)" + +[[option]] + name = "satRandomSeed" + smt_name = "random-seed" + category = "regular" + long = "random-seed=S" + type = "uint32_t" + default = "0" + help = "sets the random seed for the sat solver" + +[[option]] + name = "satVarDecay" + category = "regular" + type = "double" + default = "0.95" + predicates = ["doubleGreaterOrEqual0", "doubleLessOrEqual1"] + help = "variable activity decay factor for Minisat" + +[[option]] + name = "satClauseDecay" + category = "regular" + type = "double" + default = "0.999" + predicates = ["doubleGreaterOrEqual0", "doubleLessOrEqual1"] + help = "clause activity decay factor for Minisat" + +[[option]] + name = "satRestartFirst" + category = "regular" + long = "restart-int-base=N" + type = "unsigned" + default = "25" + read_only = true + help = "sets the base restart interval for the sat solver (N=25 by default)" + +[[option]] + name = "satRestartInc" + category = "regular" + long = "restart-int-inc=F" + type = "double" + default = "3.0" + predicates = ["doubleGreaterOrEqual0"] + read_only = true + help = "sets the restart interval increase factor for the sat solver (F=3.0 by default)" + +[[option]] + name = "sat_refine_conflicts" + category = "regular" + long = "refine-conflicts" + type = "bool" + default = "false" + read_only = true + help = "refine theory conflict clauses (default false)" + +[[option]] + name = "minisatUseElim" + category = "regular" + long = "minisat-elimination" + type = "bool" + default = "true" + help = "use Minisat elimination" + +[[option]] + name = "minisatDumpDimacs" + category = "regular" + long = "minisat-dump-dimacs" + type = "bool" + default = "false" + read_only = true + help = "instead of solving minisat dumps the asserted clauses in Dimacs format" diff --git a/src/options/quantifiers_options b/src/options/quantifiers_options deleted file mode 100644 index 6552b9157..000000000 --- a/src/options/quantifiers_options +++ /dev/null @@ -1,421 +0,0 @@ -# -# Option specification file for CVC4 -# See src/options/base_options for a description of this file format -# - -module QUANTIFIERS "options/quantifiers_options.h" Quantifiers - -#### rewriter options - -# Whether to mini-scope quantifiers. -# For example, forall x. ( P( x ) ^ Q( x ) ) will be rewritten to -# ( forall x. P( x ) ) ^ ( forall x. Q( x ) ) -option miniscopeQuant --miniscope-quant bool :default true :read-write - miniscope quantifiers -# Whether to mini-scope quantifiers based on formulas with no free variables. -# For example, forall x. ( P( x ) V Q ) will be rewritten to -# ( forall x. P( x ) ) V Q -option miniscopeQuantFreeVar --miniscope-quant-fv bool :default true :read-write - miniscope quantifiers for ground subformulas -option quantSplit --quant-split bool :default true :read-write - apply splitting to quantified formulas based on variable disjoint disjuncts -option prenexQuant --prenex-quant=MODE CVC4::theory::quantifiers::PrenexQuantMode :default CVC4::theory::quantifiers::PRENEX_QUANT_SIMPLE :include "options/quantifiers_modes.h" :read-write :handler stringToPrenexQuantMode - prenex mode for quantified formulas -option prenexQuantUser --prenex-quant-user bool :default false :read-write - prenex quantified formulas with user patterns -# Whether to variable-eliminate quantifiers. -# For example, forall x y. ( P( x, y ) V x != c ) will be rewritten to -# forall y. P( c, y ) -option varElimQuant --var-elim-quant bool :default true - enable simple variable elimination for quantified formulas -option varIneqElimQuant --var-ineq-elim-quant bool :default true - enable variable elimination based on infinite projection of unbound arithmetic variables -option dtVarExpandQuant --dt-var-exp-quant bool :default true - expand datatype variables bound to one constructor in quantifiers -#ite lift mode for quantified formulas -option iteLiftQuant --ite-lift-quant=MODE CVC4::theory::quantifiers::IteLiftQuantMode :default CVC4::theory::quantifiers::ITE_LIFT_QUANT_MODE_SIMPLE :include "options/quantifiers_modes.h" :read-write :handler stringToIteLiftQuantMode - ite lifting mode for quantified formulas -option condVarSplitQuant --cond-var-split-quant bool :default true - split quantified formulas that lead to variable eliminations -option condVarSplitQuantAgg --cond-var-split-agg-quant bool :default false - aggressive split quantified formulas that lead to variable eliminations -option iteDtTesterSplitQuant --ite-dtt-split-quant bool :read-write :default false - split ites with dt testers as conditions -# Whether to pre-skolemize quantifier bodies. -# For example, forall x. ( P( x ) => (exists y. f( y ) = x) ) will be rewritten to -# forall x. P( x ) => f( S( x ) ) = x -option preSkolemQuant --pre-skolem-quant bool :read-write :default false - apply skolemization eagerly to bodies of quantified formulas -option preSkolemQuantNested --pre-skolem-quant-nested bool :read-write :default true - apply skolemization to nested quantified formulas -option preSkolemQuantAgg --pre-skolem-quant-agg bool :read-write :default true - apply skolemization to quantified formulas aggressively -option aggressiveMiniscopeQuant --ag-miniscope-quant bool :default false - perform aggressive miniscoping for quantifiers -option elimTautQuant --elim-taut-quant bool :default true - eliminate tautological disjuncts of quantified formulas -option elimExtArithQuant --elim-ext-arith-quant bool :read-write :default true - eliminate extended arithmetic symbols in quantified formulas -option condRewriteQuant --cond-rewrite-quant bool :default true - conditional rewriting of quantified formulas -option globalNegate --global-negate bool :read-write :default false - do global negation of input formula - -#### E-matching options - -option eMatching --e-matching bool :read-write :default true - whether to do heuristic E-matching - -option termDbMode --term-db-mode CVC4::theory::quantifiers::TermDbMode :default CVC4::theory::quantifiers::TERM_DB_ALL :read-write :include "options/quantifiers_modes.h" :handler stringToTermDbMode - which ground terms to consider for instantiation -option registerQuantBodyTerms --register-quant-body-terms bool :default false - consider ground terms within bodies of quantified formulas for matching -option inferArithTriggerEq --infer-arith-trigger-eq bool :default false - infer equalities for trigger terms based on solving arithmetic equalities -option inferArithTriggerEqExp --infer-arith-trigger-eq-exp bool :default false - record explanations for inferArithTriggerEq - -option strictTriggers --strict-triggers bool :default false - only instantiate quantifiers with user patterns based on triggers -option relevantTriggers --relevant-triggers bool :default false - prefer triggers that are more relevant based on SInE style analysis -option relationalTriggers --relational-triggers bool :default false - choose relational triggers such as x = f(y), x >= f(y) -option purifyTriggers --purify-triggers bool :default false :read-write - purify triggers, e.g. f( x+1 ) becomes f( y ), x mapsto y-1 -option purifyDtTriggers --purify-dt-triggers bool :default false :read-write - purify dt triggers, match all constructors of correct form instead of selectors -option pureThTriggers --pure-th-triggers bool :default false :read-write - use pure theory terms as single triggers -option partialTriggers --partial-triggers bool :default false :read-write - use triggers that do not contain all free variables -option multiTriggerWhenSingle --multi-trigger-when-single bool :default false - select multi triggers when single triggers exist -option multiTriggerPriority --multi-trigger-priority bool :default false - only try multi triggers if single triggers give no instantiations -option multiTriggerCache --multi-trigger-cache bool :default false - caching version of multi triggers -option multiTriggerLinear --multi-trigger-linear bool :default true - implementation of multi triggers where maximum number of instantiations is linear wrt number of ground terms -option triggerSelMode --trigger-sel CVC4::theory::quantifiers::TriggerSelMode :default CVC4::theory::quantifiers::TRIGGER_SEL_MIN :read-write :include "options/quantifiers_modes.h" :handler stringToTriggerSelMode - selection mode for triggers -option triggerActiveSelMode --trigger-active-sel CVC4::theory::quantifiers::TriggerActiveSelMode :default CVC4::theory::quantifiers::TRIGGER_ACTIVE_SEL_ALL :read-write :include "options/quantifiers_modes.h" :handler stringToTriggerActiveSelMode - selection mode to activate triggers -option userPatternsQuant --user-pat=MODE CVC4::theory::quantifiers::UserPatMode :default CVC4::theory::quantifiers::USER_PAT_MODE_TRUST :read-write :include "options/quantifiers_modes.h" :handler stringToUserPatMode - policy for handling user-provided patterns for quantifier instantiation -option incrementTriggers --increment-triggers bool :default true - generate additional triggers as needed during search - -option instWhenMode --inst-when=MODE CVC4::theory::quantifiers::InstWhenMode :default CVC4::theory::quantifiers::INST_WHEN_FULL_LAST_CALL :read-write :include "options/quantifiers_modes.h" :handler stringToInstWhenMode :predicate checkInstWhenMode - when to apply instantiation -option instWhenStrictInterleave --inst-when-strict-interleave bool :default true :read-write - ensure theory combination and standard quantifier effort strategies take turns -option instWhenPhase --inst-when-phase=N int :read-write :default 2 :read-write - instantiation rounds quantifiers takes (>=1) before allowing theory combination to happen -option instWhenTcFirst --inst-when-tc-first bool :default true :read-write - allow theory combination to happen once initially, before quantifier strategies are run -option quantModelEe --quant-model-ee bool :default false - use equality engine of model for last call effort - -option instMaxLevel --inst-max-level=N int :read-write :default -1 - maximum inst level of terms used to instantiate quantified formulas with (-1 == no limit, default) -option instLevelInputOnly --inst-level-input-only bool :default true - only input terms are assigned instantiation level zero -option quantRepMode --quant-rep-mode=MODE CVC4::theory::quantifiers::QuantRepMode :default CVC4::theory::quantifiers::QUANT_REP_MODE_FIRST :read-write :include "options/quantifiers_modes.h" :handler stringToQuantRepMode - selection mode for representatives in quantifiers engine -option instRelevantCond --inst-rlv-cond bool :default false - add relevancy conditions for instantiations - -option fullSaturateQuant --full-saturate-quant bool :default false :read-write - when all other quantifier instantiation strategies fail, instantiate with ground terms from relevant domain, then arbitrary ground terms before answering unknown -option fullSaturateQuantRd --full-saturate-quant-rd bool :default true - whether to use relevant domain first for full saturation instantiation strategy -option fullSaturateInterleave --fs-interleave bool :default false - interleave full saturate instantiation with other techniques - -option literalMatchMode --literal-matching=MODE CVC4::theory::quantifiers::LiteralMatchMode :default CVC4::theory::quantifiers::LITERAL_MATCH_USE :include "options/quantifiers_modes.h" :handler stringToLiteralMatchMode :predicate checkLiteralMatchMode - choose literal matching mode - -### finite model finding options - -option finiteModelFind finite-model-find --finite-model-find bool :default false :read-write - use finite model finding heuristic for quantifier instantiation - -option quantFunWellDefined --quant-fun-wd bool :default false - assume that function defined by quantifiers are well defined -option fmfFunWellDefined --fmf-fun bool :default false :read-write - find models for recursively defined functions, assumes functions are admissible -option fmfFunWellDefinedRelevant --fmf-fun-rlv bool :default false - find models for recursively defined functions, assumes functions are admissible, allows empty type when function is irrelevant -option fmfEmptySorts --fmf-empty-sorts bool :default false - allow finite model finding to assume sorts that do not occur in ground assertions are empty - -option mbqiMode --mbqi=MODE CVC4::theory::quantifiers::MbqiMode :read-write :default CVC4::theory::quantifiers::MBQI_FMC :include "options/quantifiers_modes.h" :handler stringToMbqiMode :predicate checkMbqiMode - choose mode for model-based quantifier instantiation -option fmfOneInstPerRound --mbqi-one-inst-per-round bool :read-write :default false - only add one instantiation per quantifier per round for mbqi -option fmfOneQuantPerRound --mbqi-one-quant-per-round bool :default false - only add instantiations for one quantifier per round for mbqi -option mbqiInterleave --mbqi-interleave bool :default false - interleave model-based quantifier instantiation with other techniques - -option fmfInstEngine --fmf-inst-engine bool :default false :read-write - use instantiation engine in conjunction with finite model finding -option fmfInstGen --fmf-inst-gen bool :default true - enable Inst-Gen instantiation techniques for finite model finding -option fmfInstGenOneQuantPerRound --fmf-inst-gen-one-quant-per-round bool :default false - only perform Inst-Gen instantiation techniques on one quantifier per round -option fmfFreshDistConst --fmf-fresh-dc bool :default false - use fresh distinguished representative when applying Inst-Gen techniques -option fmfFmcSimple --fmf-fmc-simple bool :default true - simple models in full model check for finite model finding -option fmfBoundInt fmf-bound-int --fmf-bound-int bool :default false :read-write - finite model finding on bounded integer quantification -option fmfBound fmf-bound --fmf-bound bool :default false :read-write - finite model finding on bounded quantification -option fmfBoundLazy --fmf-bound-lazy bool :default false :read-write - enforce bounds for bounded quantification lazily via use of proxy variables -option fmfBoundMinMode --fmf-bound-min-mode=MODE CVC4::theory::quantifiers::FmfBoundMinMode :default CVC4::theory::quantifiers::FMF_BOUND_MIN_INT_RANGE :include "options/quantifiers_modes.h" :handler stringToFmfBoundMinMode - mode for which types of bounds to minimize via first decision heuristics - -### conflict-based instantiation options - -option quantConflictFind --quant-cf bool :read-write :default true - enable conflict find mechanism for quantifiers -option qcfMode --quant-cf-mode=MODE CVC4::theory::quantifiers::QcfMode :default CVC4::theory::quantifiers::QCF_PROP_EQ :include "options/quantifiers_modes.h" :handler stringToQcfMode - what effort to apply conflict find mechanism -option qcfWhenMode --quant-cf-when=MODE CVC4::theory::quantifiers::QcfWhenMode :default CVC4::theory::quantifiers::QCF_WHEN_MODE_DEFAULT :include "options/quantifiers_modes.h" :handler stringToQcfWhenMode - when to invoke conflict find mechanism for quantifiers -option qcfTConstraint --qcf-tconstraint bool :read-write :default false - enable entailment checks for t-constraints in qcf algorithm -option qcfAllConflict --qcf-all-conflict bool :read-write :default false - add all available conflicting instances during conflict-based instantiation -option qcfNestedConflict --qcf-nested-conflict bool :default false - consider conflicts for nested quantifiers -option qcfVoExp --qcf-vo-exp bool :default false - qcf experimental variable ordering - -option instNoEntail --inst-no-entail bool :read-write :default true - do not consider instances of quantified formulas that are currently entailed -option instNoModelTrue --inst-no-model-true bool :read-write :default false - do not consider instances of quantified formulas that are currently true in model, if it is available - -option instPropagate --inst-prop bool :read-write :default false - internal propagation for instantiations for selecting relevant instances - -option qcfEagerTest --qcf-eager-test bool :default true - optimization, test qcf instances eagerly -option qcfEagerCheckRd --qcf-eager-check-rd bool :default true - optimization, eagerly check relevant domain of matched position -option qcfSkipRd --qcf-skip-rd bool :default false - optimization, skip instances based on possibly irrelevant portions of quantified formulas - -### rewrite rules options - -option quantRewriteRules --rewrite-rules bool :default false - use rewrite rules module -option rrOneInstPerRound --rr-one-inst-per-round bool :default false - add one instance of rewrite rule per round - -### induction options - -option quantInduction --quant-ind bool :default false - use all available techniques for inductive reasoning -option dtStcInduction --dt-stc-ind bool :read-write :default false - apply strengthening for existential quantification over datatypes based on structural induction -option intWfInduction --int-wf-ind bool :read-write :default false - apply strengthening for integers based on well-founded induction -option conjectureGen --conjecture-gen bool :read-write :default false - generate candidate conjectures for inductive proofs - -option conjectureGenPerRound --conjecture-gen-per-round=N int :default 1 - number of conjectures to generate per instantiation round -option conjectureNoFilter --conjecture-no-filter bool :default false - do not filter conjectures -option conjectureFilterActiveTerms --conjecture-filter-active-terms bool :read-write :default true - filter based on active terms -option conjectureFilterCanonical --conjecture-filter-canonical bool :read-write :default true - filter based on canonicity -option conjectureFilterModel --conjecture-filter-model bool :read-write :default true - filter based on model -option conjectureGenGtEnum --conjecture-gen-gt-enum=N int :default 50 - number of ground terms to generate for model filtering -option conjectureUeeIntro --conjecture-gen-uee-intro bool :default false - more aggressive merging for universal equality engine, introduces terms -option conjectureGenMaxDepth --conjecture-gen-max-depth=N int :default 3 - maximum depth of terms to consider for conjectures - -### synthesis options - -option ceGuidedInst --cegqi bool :default false :read-write - counterexample-guided quantifier instantiation for sygus -option cegqiSingleInvMode --cegqi-si=MODE CVC4::theory::quantifiers::CegqiSingleInvMode :default CVC4::theory::quantifiers::CEGQI_SI_MODE_NONE :include "options/quantifiers_modes.h" :handler stringToCegqiSingleInvMode :read-write - mode for processing single invocation synthesis conjectures -option cegqiSingleInvPartial --cegqi-si-partial bool :default false - combined techniques for synthesis conjectures that are partially single invocation -option cegqiSingleInvReconstruct --cegqi-si-reconstruct bool :default true - reconstruct solutions for single invocation conjectures in original grammar -option cegqiSolMinCore --cegqi-si-sol-min-core bool :default false - minimize solutions for single invocation conjectures based on unsat core -option cegqiSolMinInst --cegqi-si-sol-min-inst bool :default true - minimize individual instantiations for single invocation conjectures based on unsat core -option cegqiSingleInvReconstructConst --cegqi-si-reconstruct-const bool :default true - include constants when reconstruct solutions for single invocation conjectures in original grammar -option cegqiSingleInvAbort --cegqi-si-abort bool :default false - abort if synthesis conjecture is not single invocation -option sygusPbe --sygus-pbe bool :default true :read-write - sygus advanced pruning based on examples -option sygusQePreproc --sygus-qe-preproc bool :default false - use quantifier elimination as a preprocessing step for sygus - -option sygusMinGrammar --sygus-min-grammar bool :default true - statically minimize sygus grammars -option sygusAddConstGrammar --sygus-add-const-grammar bool :default true - statically add constants appearing in conjecture to grammars -option sygusGrammarNorm --sygus-grammar-norm bool :default false - statically normalize sygus grammars based on flattening (linearization) -option sygusTemplEmbedGrammar --sygus-templ-embed-grammar bool :default false - embed sygus templates into grammars - -option sygusInvTemplMode --sygus-inv-templ=MODE CVC4::theory::quantifiers::SygusInvTemplMode :default CVC4::theory::quantifiers::SYGUS_INV_TEMPL_MODE_NONE :include "options/quantifiers_modes.h" :handler stringToSygusInvTemplMode - template mode for sygus invariant synthesis -option sygusInvAutoUnfold --sygus-auto-unfold bool :default true - enable approach which automatically unfolds transition systems for directly solving invariant synthesis problems -option sygusUnifCondSol --sygus-unif-csol bool :default true - enable new approach which unifies conditional solutions - -option sygusDirectEval --sygus-direct-eval bool :default true - direct unfolding of evaluation functions -option sygusUnfoldBool --sygus-unfold-bool bool :default true - do unfolding of Boolean evaluation functions that appear in refinement lemmas -option sygusCRefEval --sygus-cref-eval bool :default true - direct evaluation of refinement lemmas for conflict analysis -option sygusCRefEvalMinExp --sygus-cref-eval-min-exp bool :default true - use min explain for direct evaluation of refinement lemmas for conflict analysis - -option sygusStream --sygus-stream bool :read-write :default false - enumerate a stream of solutions instead of terminating after the first one - -option cegisSample --cegis-sample=MODE CVC4::theory::quantifiers::CegisSampleMode :read-write :default CVC4::theory::quantifiers::CEGIS_SAMPLE_NONE :include "options/quantifiers_modes.h" :handler stringToCegisSampleMode - mode for using samples in the counterexample-guided inductive synthesis loop - -# internal uses of sygus -option sygusRew --sygus-rr bool :default false - use sygus to enumerate and verify correctness of rewrite rules via sampling -option sygusRewSynth --sygus-rr-synth bool :read-write :default false - use sygus to enumerate candidate rewrite rules via sampling -option sygusRewVerify --sygus-rr-verify bool :read-write :default false - use sygus to verify the correctness of rewrite rules via sampling -option sygusSamples --sygus-samples=N int :read-write :default 1000 :read-write - number of points to consider when doing sygus rewriter sample testing -option sygusSampleGrammar --sygus-sample-grammar bool :default true - when applicable, use grammar for choosing sample points - -# CEGQI applied to general quantified formulas -option cbqi --cbqi bool :read-write :default false - turns on counterexample-based quantifier instantiation -option cbqiFullEffort --cbqi-full bool :read-write :default false - turns on full effort counterexample-based quantifier instantiation, which may resort to model-value instantiation -option recurseCbqi --cbqi-recurse bool :default true - turns on recursive counterexample-based quantifier instantiation -option cbqiSat --cbqi-sat bool :read-write :default true - answer sat when quantifiers are asserted with counterexample-based quantifier instantiation -option cbqiModel --cbqi-model bool :read-write :default true - guide instantiations by model values for counterexample-based quantifier instantiation -option cbqiAll --cbqi-all bool :read-write :default false - apply counterexample-based instantiation to all quantified formulas -option cbqiMultiInst --cbqi-multi-inst bool :read-write :default false - when applicable, do multi instantiations per quantifier per round in counterexample-based quantifier instantiation -option cbqiRepeatLit --cbqi-repeat-lit bool :read-write :default false - solve literals more than once in counterexample-based quantifier instantiation -option cbqiInnermost --cbqi-innermost bool :read-write :default true - only process innermost quantified formulas in counterexample-based quantifier instantiation -option cbqiNestedQE --cbqi-nested-qe bool :read-write :default false - process nested quantified formulas with quantifier elimination in counterexample-based quantifier instantiation - -# CEGQI for arithmetic -option cbqiUseInfInt --cbqi-use-inf-int bool :read-write :default false - use integer infinity for vts in counterexample-based quantifier instantiation -option cbqiUseInfReal --cbqi-use-inf-real bool :read-write :default false - use real infinity for vts in counterexample-based quantifier instantiation -option cbqiPreRegInst --cbqi-prereg-inst bool :read-write :default false - preregister ground instantiations in counterexample-based quantifier instantiation -option cbqiMinBounds --cbqi-min-bounds bool :default false - use minimally constrained lower/upper bound for counterexample-based quantifier instantiation -option cbqiRoundUpLowerLia --cbqi-round-up-lia bool :default false - round up integer lower bounds in substitutions for counterexample-based quantifier instantiation -option cbqiMidpoint --cbqi-midpoint bool :read-write :default false - choose substitutions based on midpoints of lower and upper bounds for counterexample-based quantifier instantiation -option cbqiNopt --cbqi-nopt bool :default true - non-optimal bounds for counterexample-based quantifier instantiation -option cbqiLitDepend --cbqi-lit-dep bool :default true - dependency lemmas for quantifier alternation in counterexample-based quantifier instantiation - -# CEGQI for EPR -option quantEpr --quant-epr bool :default false :read-write - infer whether in effectively propositional fragment, use for cbqi -option quantEprMatching --quant-epr-match bool :default true - use matching heuristics for EPR instantiation - -# CEGQI for BV -option cbqiBv cbqi-bv --cbqi-bv bool :read-write :default true - use word-level inversion approach for counterexample-guided quantifier instantiation for bit-vectors -option cbqiBvInterleaveValue --cbqi-bv-interleave-value bool :read-write :default false - interleave model value instantiation with word-level inversion approach -option cbqiBvIneqMode --cbqi-bv-ineq=MODE CVC4::theory::quantifiers::CbqiBvIneqMode :read-write :default CVC4::theory::quantifiers::CBQI_BV_INEQ_EQ_BOUNDARY :include "options/quantifiers_modes.h" :handler stringToCbqiBvIneqMode - choose mode for handling bit-vector inequalities with counterexample-guided instantiation -option cbqiBvRmExtract --cbqi-bv-rm-extract bool :read-write :default true - replaces extract terms with variables for counterexample-guided instantiation for bit-vectors -option cbqiBvLinearize --cbqi-bv-linear bool :read-write :default true - linearize adder chains for variables -option cbqiBvConcInv cbqi-bv-concat-inv --cbqi-bv-concat-inv bool :read-write :default true - compute inverse for concat over equalities rather than producing an invertibility condition - -### local theory extensions options - -option localTheoryExt --local-t-ext bool :default false - do instantiation based on local theory extensions -option ltePartialInst --lte-partial-inst bool :default false - partially instantiate local theory quantifiers -option lteRestrictInstClosure --lte-restrict-inst-closure bool :default false - treat arguments of inst closure as restricted terms for instantiation - -### reduction options - -option quantAlphaEquiv --quant-alpha-equiv bool :default true - infer alpha equivalence between quantified formulas -option macrosQuant --macros-quant bool :read-write :default false - perform quantifiers macro expansion -option macrosQuantMode --macros-quant-mode=MODE CVC4::theory::quantifiers::MacrosQuantMode :default CVC4::theory::quantifiers::MACROS_QUANT_MODE_GROUND_UF :include "options/quantifiers_modes.h" :handler stringToMacrosQuantMode - mode for quantifiers macro expansion -option quantDynamicSplit --quant-dsplit-mode=MODE CVC4::theory::quantifiers::QuantDSplitMode :read-write :default CVC4::theory::quantifiers::QUANT_DSPLIT_MODE_NONE :include "options/quantifiers_modes.h" :handler stringToQuantDSplitMode - mode for dynamic quantifiers splitting -option quantAntiSkolem --quant-anti-skolem bool :read-write :default false - perform anti-skolemization for quantified formulas - -### recursive function options - -#option funDefs --fun-defs bool :default false -# enable specialized techniques for recursive function definitions - -### e-unification options - -option quantEqualityEngine --quant-ee bool :default false - maintain congrunce closure over universal equalities - -### higher-order options - -option hoMatching --ho-matching bool :default true - do higher-order matching algorithm for triggers with variable operators -option hoMatchingVarArgPriority --ho-matching-var-priority bool :default true - give priority to variable arguments over constant arguments - -option hoMergeTermDb --ho-merge-term-db bool :default true - merge term indices modulo equality - -### proof options - -option trackInstLemmas --track-inst-lemmas bool :read-write :default false - track instantiation lemmas (for proofs, unsat cores, qe and synthesis minimization) - -endmodule diff --git a/src/options/quantifiers_options.toml b/src/options/quantifiers_options.toml new file mode 100644 index 000000000..8f07384d6 --- /dev/null +++ b/src/options/quantifiers_options.toml @@ -0,0 +1,1492 @@ +id = "QUANTIFIERS" +name = "Quantifiers" +header = "options/quantifiers_options.h" + +# Whether to mini-scope quantifiers. +# For example, forall x. ( P( x ) ^ Q( x ) ) will be rewritten to +# ( forall x. P( x ) ) ^ ( forall x. Q( x ) ) +[[option]] + name = "miniscopeQuant" + category = "regular" + long = "miniscope-quant" + type = "bool" + default = "true" + help = "miniscope quantifiers" + +# Whether to mini-scope quantifiers based on formulas with no free variables. +# For example, forall x. ( P( x ) V Q ) will be rewritten to +# ( forall x. P( x ) ) V Q +[[option]] + name = "miniscopeQuantFreeVar" + category = "regular" + long = "miniscope-quant-fv" + type = "bool" + default = "true" + help = "miniscope quantifiers for ground subformulas" + +[[option]] + name = "quantSplit" + category = "regular" + long = "quant-split" + type = "bool" + default = "true" + help = "apply splitting to quantified formulas based on variable disjoint disjuncts" + +[[option]] + name = "prenexQuant" + category = "regular" + long = "prenex-quant=MODE" + type = "CVC4::theory::quantifiers::PrenexQuantMode" + default = "CVC4::theory::quantifiers::PRENEX_QUANT_SIMPLE" + handler = "stringToPrenexQuantMode" + includes = ["options/quantifiers_modes.h"] + help = "prenex mode for quantified formulas" + +[[option]] + name = "prenexQuantUser" + category = "regular" + long = "prenex-quant-user" + type = "bool" + default = "false" + help = "prenex quantified formulas with user patterns" + +# Whether to variable-eliminate quantifiers. +# For example, forall x y. ( P( x, y ) V x != c ) will be rewritten to +# forall y. P( c, y ) +[[option]] + name = "varElimQuant" + category = "regular" + long = "var-elim-quant" + type = "bool" + default = "true" + read_only = true + help = "enable simple variable elimination for quantified formulas" + +[[option]] + name = "varIneqElimQuant" + category = "regular" + long = "var-ineq-elim-quant" + type = "bool" + default = "true" + read_only = true + help = "enable variable elimination based on infinite projection of unbound arithmetic variables" + +[[option]] + name = "dtVarExpandQuant" + category = "regular" + long = "dt-var-exp-quant" + type = "bool" + default = "true" + read_only = true + help = "expand datatype variables bound to one constructor in quantifiers" + +[[option]] + name = "iteLiftQuant" + category = "regular" + long = "ite-lift-quant=MODE" + type = "CVC4::theory::quantifiers::IteLiftQuantMode" + default = "CVC4::theory::quantifiers::ITE_LIFT_QUANT_MODE_SIMPLE" + handler = "stringToIteLiftQuantMode" + includes = ["options/quantifiers_modes.h"] + help = "ite lifting mode for quantified formulas" + +[[option]] + name = "condVarSplitQuant" + category = "regular" + long = "cond-var-split-quant" + type = "bool" + default = "true" + read_only = true + help = "split quantified formulas that lead to variable eliminations" + +[[option]] + name = "condVarSplitQuantAgg" + category = "regular" + long = "cond-var-split-agg-quant" + type = "bool" + default = "false" + read_only = true + help = "aggressive split quantified formulas that lead to variable eliminations" + +[[option]] + name = "iteDtTesterSplitQuant" + category = "regular" + long = "ite-dtt-split-quant" + type = "bool" + default = "false" + help = "split ites with dt testers as conditions" + +# Whether to pre-skolemize quantifier bodies. +# For example, forall x. ( P( x ) => (exists y. f( y ) = x) ) will be rewritten to +# forall x. P( x ) => f( S( x ) ) = x +[[option]] + name = "preSkolemQuant" + category = "regular" + long = "pre-skolem-quant" + type = "bool" + default = "false" + help = "apply skolemization eagerly to bodies of quantified formulas" + +[[option]] + name = "preSkolemQuantNested" + category = "regular" + long = "pre-skolem-quant-nested" + type = "bool" + default = "true" + help = "apply skolemization to nested quantified formulas" + +[[option]] + name = "preSkolemQuantAgg" + category = "regular" + long = "pre-skolem-quant-agg" + type = "bool" + default = "true" + help = "apply skolemization to quantified formulas aggressively" + +[[option]] + name = "aggressiveMiniscopeQuant" + category = "regular" + long = "ag-miniscope-quant" + type = "bool" + default = "false" + read_only = true + help = "perform aggressive miniscoping for quantifiers" + +[[option]] + name = "elimTautQuant" + category = "regular" + long = "elim-taut-quant" + type = "bool" + default = "true" + read_only = true + help = "eliminate tautological disjuncts of quantified formulas" + +[[option]] + name = "elimExtArithQuant" + category = "regular" + long = "elim-ext-arith-quant" + type = "bool" + default = "true" + help = "eliminate extended arithmetic symbols in quantified formulas" + +[[option]] + name = "condRewriteQuant" + category = "regular" + long = "cond-rewrite-quant" + type = "bool" + default = "true" + read_only = true + help = "conditional rewriting of quantified formulas" + +[[option]] + name = "globalNegate" + category = "regular" + long = "global-negate" + type = "bool" + default = "false" + help = "do global negation of input formula" + +#### E-matching options + +[[option]] + name = "eMatching" + category = "regular" + long = "e-matching" + type = "bool" + default = "true" + help = "whether to do heuristic E-matching" + +[[option]] + name = "termDbMode" + category = "regular" + long = "term-db-mode" + type = "CVC4::theory::quantifiers::TermDbMode" + default = "CVC4::theory::quantifiers::TERM_DB_ALL" + handler = "stringToTermDbMode" + includes = ["options/quantifiers_modes.h"] + help = "which ground terms to consider for instantiation" + +[[option]] + name = "registerQuantBodyTerms" + category = "regular" + long = "register-quant-body-terms" + type = "bool" + default = "false" + read_only = true + help = "consider ground terms within bodies of quantified formulas for matching" + +[[option]] + name = "inferArithTriggerEq" + category = "regular" + long = "infer-arith-trigger-eq" + type = "bool" + default = "false" + read_only = true + help = "infer equalities for trigger terms based on solving arithmetic equalities" + +[[option]] + name = "inferArithTriggerEqExp" + category = "regular" + long = "infer-arith-trigger-eq-exp" + type = "bool" + default = "false" + read_only = true + help = "record explanations for inferArithTriggerEq" + +[[option]] + name = "strictTriggers" + category = "regular" + long = "strict-triggers" + type = "bool" + default = "false" + read_only = true + help = "only instantiate quantifiers with user patterns based on triggers" + +[[option]] + name = "relevantTriggers" + category = "regular" + long = "relevant-triggers" + type = "bool" + default = "false" + read_only = true + help = "prefer triggers that are more relevant based on SInE style analysis" + +[[option]] + name = "relationalTriggers" + category = "regular" + long = "relational-triggers" + type = "bool" + default = "false" + read_only = true + help = "choose relational triggers such as x = f(y), x >= f(y)" + +[[option]] + name = "purifyTriggers" + category = "regular" + long = "purify-triggers" + type = "bool" + default = "false" + help = "purify triggers, e.g. f( x+1 ) becomes f( y ), x mapsto y-1" + +[[option]] + name = "purifyDtTriggers" + category = "regular" + long = "purify-dt-triggers" + type = "bool" + default = "false" + help = "purify dt triggers, match all constructors of correct form instead of selectors" + +[[option]] + name = "pureThTriggers" + category = "regular" + long = "pure-th-triggers" + type = "bool" + default = "false" + help = "use pure theory terms as single triggers" + +[[option]] + name = "partialTriggers" + category = "regular" + long = "partial-triggers" + type = "bool" + default = "false" + help = "use triggers that do not contain all free variables" + +[[option]] + name = "multiTriggerWhenSingle" + category = "regular" + long = "multi-trigger-when-single" + type = "bool" + default = "false" + read_only = true + help = "select multi triggers when single triggers exist" + +[[option]] + name = "multiTriggerPriority" + category = "regular" + long = "multi-trigger-priority" + type = "bool" + default = "false" + read_only = true + help = "only try multi triggers if single triggers give no instantiations" + +[[option]] + name = "multiTriggerCache" + category = "regular" + long = "multi-trigger-cache" + type = "bool" + default = "false" + read_only = true + help = "caching version of multi triggers" + +[[option]] + name = "multiTriggerLinear" + category = "regular" + long = "multi-trigger-linear" + type = "bool" + default = "true" + read_only = true + help = "implementation of multi triggers where maximum number of instantiations is linear wrt number of ground terms" + +[[option]] + name = "triggerSelMode" + category = "regular" + long = "trigger-sel" + type = "CVC4::theory::quantifiers::TriggerSelMode" + default = "CVC4::theory::quantifiers::TRIGGER_SEL_MIN" + handler = "stringToTriggerSelMode" + includes = ["options/quantifiers_modes.h"] + help = "selection mode for triggers" + +[[option]] + name = "triggerActiveSelMode" + category = "regular" + long = "trigger-active-sel" + type = "CVC4::theory::quantifiers::TriggerActiveSelMode" + default = "CVC4::theory::quantifiers::TRIGGER_ACTIVE_SEL_ALL" + handler = "stringToTriggerActiveSelMode" + includes = ["options/quantifiers_modes.h"] + help = "selection mode to activate triggers" + +[[option]] + name = "userPatternsQuant" + category = "regular" + long = "user-pat=MODE" + type = "CVC4::theory::quantifiers::UserPatMode" + default = "CVC4::theory::quantifiers::USER_PAT_MODE_TRUST" + handler = "stringToUserPatMode" + includes = ["options/quantifiers_modes.h"] + help = "policy for handling user-provided patterns for quantifier instantiation" + +[[option]] + name = "incrementTriggers" + category = "regular" + long = "increment-triggers" + type = "bool" + default = "true" + read_only = true + help = "generate additional triggers as needed during search" + +[[option]] + name = "instWhenMode" + category = "regular" + long = "inst-when=MODE" + type = "CVC4::theory::quantifiers::InstWhenMode" + default = "CVC4::theory::quantifiers::INST_WHEN_FULL_LAST_CALL" + handler = "stringToInstWhenMode" + predicates = ["checkInstWhenMode"] + includes = ["options/quantifiers_modes.h"] + help = "when to apply instantiation" + +[[option]] + name = "instWhenStrictInterleave" + category = "regular" + long = "inst-when-strict-interleave" + type = "bool" + default = "true" + help = "ensure theory combination and standard quantifier effort strategies take turns" + +[[option]] + name = "instWhenPhase" + category = "regular" + long = "inst-when-phase=N" + type = "int" + default = "2" + help = "instantiation rounds quantifiers takes (>=1) before allowing theory combination to happen" + +[[option]] + name = "instWhenTcFirst" + category = "regular" + long = "inst-when-tc-first" + type = "bool" + default = "true" + help = "allow theory combination to happen once initially, before quantifier strategies are run" + +[[option]] + name = "quantModelEe" + category = "regular" + long = "quant-model-ee" + type = "bool" + default = "false" + read_only = true + help = "use equality engine of model for last call effort" + +[[option]] + name = "instMaxLevel" + category = "regular" + long = "inst-max-level=N" + type = "int" + default = "-1" + help = "maximum inst level of terms used to instantiate quantified formulas with (-1 == no limit, default)" + +[[option]] + name = "instLevelInputOnly" + category = "regular" + long = "inst-level-input-only" + type = "bool" + default = "true" + read_only = true + help = "only input terms are assigned instantiation level zero" + +[[option]] + name = "quantRepMode" + category = "regular" + long = "quant-rep-mode=MODE" + type = "CVC4::theory::quantifiers::QuantRepMode" + default = "CVC4::theory::quantifiers::QUANT_REP_MODE_FIRST" + handler = "stringToQuantRepMode" + includes = ["options/quantifiers_modes.h"] + help = "selection mode for representatives in quantifiers engine" + +[[option]] + name = "instRelevantCond" + category = "regular" + long = "inst-rlv-cond" + type = "bool" + default = "false" + read_only = true + help = "add relevancy conditions for instantiations" + +[[option]] + name = "fullSaturateQuant" + category = "regular" + long = "full-saturate-quant" + type = "bool" + default = "false" + help = "when all other quantifier instantiation strategies fail, instantiate with ground terms from relevant domain, then arbitrary ground terms before answering unknown" + +[[option]] + name = "fullSaturateQuantRd" + category = "regular" + long = "full-saturate-quant-rd" + type = "bool" + default = "true" + read_only = true + help = "whether to use relevant domain first for full saturation instantiation strategy" + +[[option]] + name = "fullSaturateInterleave" + category = "regular" + long = "fs-interleave" + type = "bool" + default = "false" + read_only = true + help = "interleave full saturate instantiation with other techniques" + +[[option]] + name = "literalMatchMode" + category = "regular" + long = "literal-matching=MODE" + type = "CVC4::theory::quantifiers::LiteralMatchMode" + default = "CVC4::theory::quantifiers::LITERAL_MATCH_USE" + handler = "stringToLiteralMatchMode" + predicates = ["checkLiteralMatchMode"] + includes = ["options/quantifiers_modes.h"] + read_only = true + help = "choose literal matching mode" + +### Finite model finding options + +[[option]] + name = "finiteModelFind" + category = "regular" + long = "finite-model-find" + type = "bool" + default = "false" + help = "use finite model finding heuristic for quantifier instantiation" + +[[option]] + name = "quantFunWellDefined" + category = "regular" + long = "quant-fun-wd" + type = "bool" + default = "false" + read_only = true + help = "assume that function defined by quantifiers are well defined" + +[[option]] + name = "fmfFunWellDefined" + category = "regular" + long = "fmf-fun" + type = "bool" + default = "false" + help = "find models for recursively defined functions, assumes functions are admissible" + +[[option]] + name = "fmfFunWellDefinedRelevant" + category = "regular" + long = "fmf-fun-rlv" + type = "bool" + default = "false" + read_only = true + help = "find models for recursively defined functions, assumes functions are admissible, allows empty type when function is irrelevant" + +[[option]] + name = "fmfEmptySorts" + category = "regular" + long = "fmf-empty-sorts" + type = "bool" + default = "false" + read_only = true + help = "allow finite model finding to assume sorts that do not occur in ground assertions are empty" + +[[option]] + name = "mbqiMode" + category = "regular" + long = "mbqi=MODE" + type = "CVC4::theory::quantifiers::MbqiMode" + default = "CVC4::theory::quantifiers::MBQI_FMC" + handler = "stringToMbqiMode" + predicates = ["checkMbqiMode"] + includes = ["options/quantifiers_modes.h"] + help = "choose mode for model-based quantifier instantiation" + +[[option]] + name = "fmfOneInstPerRound" + category = "regular" + long = "mbqi-one-inst-per-round" + type = "bool" + default = "false" + help = "only add one instantiation per quantifier per round for mbqi" + +[[option]] + name = "fmfOneQuantPerRound" + category = "regular" + long = "mbqi-one-quant-per-round" + type = "bool" + default = "false" + read_only = true + help = "only add instantiations for one quantifier per round for mbqi" + +[[option]] + name = "mbqiInterleave" + category = "regular" + long = "mbqi-interleave" + type = "bool" + default = "false" + read_only = true + help = "interleave model-based quantifier instantiation with other techniques" + +[[option]] + name = "fmfInstEngine" + category = "regular" + long = "fmf-inst-engine" + type = "bool" + default = "false" + help = "use instantiation engine in conjunction with finite model finding" + +[[option]] + name = "fmfInstGen" + category = "regular" + long = "fmf-inst-gen" + type = "bool" + default = "true" + read_only = true + help = "enable Inst-Gen instantiation techniques for finite model finding" + +[[option]] + name = "fmfInstGenOneQuantPerRound" + category = "regular" + long = "fmf-inst-gen-one-quant-per-round" + type = "bool" + default = "false" + read_only = true + help = "only perform Inst-Gen instantiation techniques on one quantifier per round" + +[[option]] + name = "fmfFreshDistConst" + category = "regular" + long = "fmf-fresh-dc" + type = "bool" + default = "false" + read_only = true + help = "use fresh distinguished representative when applying Inst-Gen techniques" + +[[option]] + name = "fmfFmcSimple" + category = "regular" + long = "fmf-fmc-simple" + type = "bool" + default = "true" + read_only = true + help = "simple models in full model check for finite model finding" + +[[option]] + name = "fmfBoundInt" + category = "regular" + long = "fmf-bound-int" + type = "bool" + default = "false" + help = "finite model finding on bounded integer quantification" + +[[option]] + name = "fmfBound" + category = "regular" + long = "fmf-bound" + type = "bool" + default = "false" + help = "finite model finding on bounded quantification" + +[[option]] + name = "fmfBoundLazy" + category = "regular" + long = "fmf-bound-lazy" + type = "bool" + default = "false" + help = "enforce bounds for bounded quantification lazily via use of proxy variables" + +[[option]] + name = "fmfBoundMinMode" + category = "regular" + long = "fmf-bound-min-mode=MODE" + type = "CVC4::theory::quantifiers::FmfBoundMinMode" + default = "CVC4::theory::quantifiers::FMF_BOUND_MIN_INT_RANGE" + handler = "stringToFmfBoundMinMode" + includes = ["options/quantifiers_modes.h"] + read_only = true + help = "mode for which types of bounds to minimize via first decision heuristics" + +[[option]] + name = "quantConflictFind" + category = "regular" + long = "quant-cf" + type = "bool" + default = "true" + help = "enable conflict find mechanism for quantifiers" + +[[option]] + name = "qcfMode" + category = "regular" + long = "quant-cf-mode=MODE" + type = "CVC4::theory::quantifiers::QcfMode" + default = "CVC4::theory::quantifiers::QCF_PROP_EQ" + handler = "stringToQcfMode" + includes = ["options/quantifiers_modes.h"] + read_only = true + help = "what effort to apply conflict find mechanism" + +[[option]] + name = "qcfWhenMode" + category = "regular" + long = "quant-cf-when=MODE" + type = "CVC4::theory::quantifiers::QcfWhenMode" + default = "CVC4::theory::quantifiers::QCF_WHEN_MODE_DEFAULT" + handler = "stringToQcfWhenMode" + includes = ["options/quantifiers_modes.h"] + read_only = true + help = "when to invoke conflict find mechanism for quantifiers" + +[[option]] + name = "qcfTConstraint" + category = "regular" + long = "qcf-tconstraint" + type = "bool" + default = "false" + help = "enable entailment checks for t-constraints in qcf algorithm" + +[[option]] + name = "qcfAllConflict" + category = "regular" + long = "qcf-all-conflict" + type = "bool" + default = "false" + help = "add all available conflicting instances during conflict-based instantiation" + +[[option]] + name = "qcfNestedConflict" + category = "regular" + long = "qcf-nested-conflict" + type = "bool" + default = "false" + read_only = true + help = "consider conflicts for nested quantifiers" + +[[option]] + name = "qcfVoExp" + category = "regular" + long = "qcf-vo-exp" + type = "bool" + default = "false" + read_only = true + help = "qcf experimental variable ordering" + +[[option]] + name = "instNoEntail" + category = "regular" + long = "inst-no-entail" + type = "bool" + default = "true" + help = "do not consider instances of quantified formulas that are currently entailed" + +[[option]] + name = "instNoModelTrue" + category = "regular" + long = "inst-no-model-true" + type = "bool" + default = "false" + help = "do not consider instances of quantified formulas that are currently true in model, if it is available" + +[[option]] + name = "instPropagate" + category = "regular" + long = "inst-prop" + type = "bool" + default = "false" + help = "internal propagation for instantiations for selecting relevant instances" + +[[option]] + name = "qcfEagerTest" + category = "regular" + long = "qcf-eager-test" + type = "bool" + default = "true" + read_only = true + help = "optimization, test qcf instances eagerly" + +[[option]] + name = "qcfEagerCheckRd" + category = "regular" + long = "qcf-eager-check-rd" + type = "bool" + default = "true" + read_only = true + help = "optimization, eagerly check relevant domain of matched position" + +[[option]] + name = "qcfSkipRd" + category = "regular" + long = "qcf-skip-rd" + type = "bool" + default = "false" + read_only = true + help = "optimization, skip instances based on possibly irrelevant portions of quantified formulas" + +### Rewrite rules options + +[[option]] + name = "quantRewriteRules" + category = "regular" + long = "rewrite-rules" + type = "bool" + default = "false" + read_only = true + help = "use rewrite rules module" + +[[option]] + name = "rrOneInstPerRound" + category = "regular" + long = "rr-one-inst-per-round" + type = "bool" + default = "false" + read_only = true + help = "add one instance of rewrite rule per round" + +### Induction options + +[[option]] + name = "quantInduction" + category = "regular" + long = "quant-ind" + type = "bool" + default = "false" + read_only = true + help = "use all available techniques for inductive reasoning" + +[[option]] + name = "dtStcInduction" + category = "regular" + long = "dt-stc-ind" + type = "bool" + default = "false" + help = "apply strengthening for existential quantification over datatypes based on structural induction" + +[[option]] + name = "intWfInduction" + category = "regular" + long = "int-wf-ind" + type = "bool" + default = "false" + help = "apply strengthening for integers based on well-founded induction" + +[[option]] + name = "conjectureGen" + category = "regular" + long = "conjecture-gen" + type = "bool" + default = "false" + help = "generate candidate conjectures for inductive proofs" + +[[option]] + name = "conjectureGenPerRound" + category = "regular" + long = "conjecture-gen-per-round=N" + type = "int" + default = "1" + read_only = true + help = "number of conjectures to generate per instantiation round" + +[[option]] + name = "conjectureNoFilter" + category = "regular" + long = "conjecture-no-filter" + type = "bool" + default = "false" + read_only = true + help = "do not filter conjectures" + +[[option]] + name = "conjectureFilterActiveTerms" + category = "regular" + long = "conjecture-filter-active-terms" + type = "bool" + default = "true" + help = "filter based on active terms" + +[[option]] + name = "conjectureFilterCanonical" + category = "regular" + long = "conjecture-filter-canonical" + type = "bool" + default = "true" + help = "filter based on canonicity" + +[[option]] + name = "conjectureFilterModel" + category = "regular" + long = "conjecture-filter-model" + type = "bool" + default = "true" + help = "filter based on model" + +[[option]] + name = "conjectureGenGtEnum" + category = "regular" + long = "conjecture-gen-gt-enum=N" + type = "int" + default = "50" + read_only = true + help = "number of ground terms to generate for model filtering" + +[[option]] + name = "conjectureUeeIntro" + category = "regular" + long = "conjecture-gen-uee-intro" + type = "bool" + default = "false" + read_only = true + help = "more aggressive merging for universal equality engine, introduces terms" + +[[option]] + name = "conjectureGenMaxDepth" + category = "regular" + long = "conjecture-gen-max-depth=N" + type = "int" + default = "3" + read_only = true + help = "maximum depth of terms to consider for conjectures" + +### Synthesis options + +[[option]] + name = "ceGuidedInst" + category = "regular" + long = "cegqi" + type = "bool" + default = "false" + help = "counterexample-guided quantifier instantiation for sygus" + +[[option]] + name = "cegqiSingleInvMode" + category = "regular" + long = "cegqi-si=MODE" + type = "CVC4::theory::quantifiers::CegqiSingleInvMode" + default = "CVC4::theory::quantifiers::CEGQI_SI_MODE_NONE" + handler = "stringToCegqiSingleInvMode" + includes = ["options/quantifiers_modes.h"] + help = "mode for processing single invocation synthesis conjectures" + +[[option]] + name = "cegqiSingleInvPartial" + category = "regular" + long = "cegqi-si-partial" + type = "bool" + default = "false" + read_only = true + help = "combined techniques for synthesis conjectures that are partially single invocation" + +[[option]] + name = "cegqiSingleInvReconstruct" + category = "regular" + long = "cegqi-si-reconstruct" + type = "bool" + default = "true" + read_only = true + help = "reconstruct solutions for single invocation conjectures in original grammar" + +[[option]] + name = "cegqiSolMinCore" + category = "regular" + long = "cegqi-si-sol-min-core" + type = "bool" + default = "false" + read_only = true + help = "minimize solutions for single invocation conjectures based on unsat core" + +[[option]] + name = "cegqiSolMinInst" + category = "regular" + long = "cegqi-si-sol-min-inst" + type = "bool" + default = "true" + read_only = true + help = "minimize individual instantiations for single invocation conjectures based on unsat core" + +[[option]] + name = "cegqiSingleInvReconstructConst" + category = "regular" + long = "cegqi-si-reconstruct-const" + type = "bool" + default = "true" + read_only = true + help = "include constants when reconstruct solutions for single invocation conjectures in original grammar" + +[[option]] + name = "cegqiSingleInvAbort" + category = "regular" + long = "cegqi-si-abort" + type = "bool" + default = "false" + read_only = true + help = "abort if synthesis conjecture is not single invocation" + +[[option]] + name = "sygusPbe" + category = "regular" + long = "sygus-pbe" + type = "bool" + default = "true" + help = "sygus advanced pruning based on examples" + +[[option]] + name = "sygusQePreproc" + category = "regular" + long = "sygus-qe-preproc" + type = "bool" + default = "false" + read_only = true + help = "use quantifier elimination as a preprocessing step for sygus" + +[[option]] + name = "sygusMinGrammar" + category = "regular" + long = "sygus-min-grammar" + type = "bool" + default = "true" + read_only = true + help = "statically minimize sygus grammars" + +[[option]] + name = "sygusAddConstGrammar" + category = "regular" + long = "sygus-add-const-grammar" + type = "bool" + default = "true" + read_only = true + help = "statically add constants appearing in conjecture to grammars" + +[[option]] + name = "sygusGrammarNorm" + category = "regular" + long = "sygus-grammar-norm" + type = "bool" + default = "false" + read_only = true + help = "statically normalize sygus grammars based on flattening (linearization)" + +[[option]] + name = "sygusTemplEmbedGrammar" + category = "regular" + long = "sygus-templ-embed-grammar" + type = "bool" + default = "false" + read_only = true + help = "embed sygus templates into grammars" + +[[option]] + name = "sygusInvTemplMode" + category = "regular" + long = "sygus-inv-templ=MODE" + type = "CVC4::theory::quantifiers::SygusInvTemplMode" + default = "CVC4::theory::quantifiers::SYGUS_INV_TEMPL_MODE_NONE" + handler = "stringToSygusInvTemplMode" + includes = ["options/quantifiers_modes.h"] + read_only = true + help = "template mode for sygus invariant synthesis" + +[[option]] + name = "sygusInvAutoUnfold" + category = "regular" + long = "sygus-auto-unfold" + type = "bool" + default = "true" + read_only = true + help = "enable approach which automatically unfolds transition systems for directly solving invariant synthesis problems" + +[[option]] + name = "sygusUnifCondSol" + category = "regular" + long = "sygus-unif-csol" + type = "bool" + default = "true" + read_only = true + help = "enable new approach which unifies conditional solutions" + +[[option]] + name = "sygusDirectEval" + category = "regular" + long = "sygus-direct-eval" + type = "bool" + default = "true" + read_only = true + help = "direct unfolding of evaluation functions" + +[[option]] + name = "sygusUnfoldBool" + category = "regular" + long = "sygus-unfold-bool" + type = "bool" + default = "true" + read_only = true + help = "do unfolding of Boolean evaluation functions that appear in refinement lemmas" + +[[option]] + name = "sygusCRefEval" + category = "regular" + long = "sygus-cref-eval" + type = "bool" + default = "true" + read_only = true + help = "direct evaluation of refinement lemmas for conflict analysis" + +[[option]] + name = "sygusCRefEvalMinExp" + category = "regular" + long = "sygus-cref-eval-min-exp" + type = "bool" + default = "true" + read_only = true + help = "use min explain for direct evaluation of refinement lemmas for conflict analysis" + +[[option]] + name = "sygusStream" + category = "regular" + long = "sygus-stream" + type = "bool" + default = "false" + help = "enumerate a stream of solutions instead of terminating after the first one" + +[[option]] + name = "cegisSample" + category = "regular" + long = "cegis-sample=MODE" + type = "CVC4::theory::quantifiers::CegisSampleMode" + default = "CVC4::theory::quantifiers::CEGIS_SAMPLE_NONE" + handler = "stringToCegisSampleMode" + includes = ["options/quantifiers_modes.h"] + help = "mode for using samples in the counterexample-guided inductive synthesis loop" + +# Internal uses of sygus + +[[option]] + name = "sygusRew" + category = "regular" + long = "sygus-rr" + type = "bool" + default = "false" + read_only = true + help = "use sygus to enumerate and verify correctness of rewrite rules via sampling" + +[[option]] + name = "sygusRewSynth" + category = "regular" + long = "sygus-rr-synth" + type = "bool" + default = "false" + help = "use sygus to enumerate candidate rewrite rules via sampling" + +[[option]] + name = "sygusRewVerify" + category = "regular" + long = "sygus-rr-verify" + type = "bool" + default = "false" + help = "use sygus to verify the correctness of rewrite rules via sampling" + +[[option]] + name = "sygusSamples" + category = "regular" + long = "sygus-samples=N" + type = "int" + default = "1000" + help = "number of points to consider when doing sygus rewriter sample testing" + +[[option]] + name = "sygusSampleGrammar" + category = "regular" + long = "sygus-sample-grammar" + type = "bool" + default = "true" + read_only = true + help = "when applicable, use grammar for choosing sample points" + + +# CEGQI applied to general quantified formulas + +[[option]] + name = "cbqi" + category = "regular" + long = "cbqi" + type = "bool" + default = "false" + help = "turns on counterexample-based quantifier instantiation" + +[[option]] + name = "cbqiFullEffort" + category = "regular" + long = "cbqi-full" + type = "bool" + default = "false" + help = "turns on full effort counterexample-based quantifier instantiation, which may resort to model-value instantiation" + +[[option]] + name = "recurseCbqi" + category = "regular" + long = "cbqi-recurse" + type = "bool" + default = "true" + read_only = true + help = "turns on recursive counterexample-based quantifier instantiation" + +[[option]] + name = "cbqiSat" + category = "regular" + long = "cbqi-sat" + type = "bool" + default = "true" + help = "answer sat when quantifiers are asserted with counterexample-based quantifier instantiation" + +[[option]] + name = "cbqiModel" + category = "regular" + long = "cbqi-model" + type = "bool" + default = "true" + help = "guide instantiations by model values for counterexample-based quantifier instantiation" + +[[option]] + name = "cbqiAll" + category = "regular" + long = "cbqi-all" + type = "bool" + default = "false" + help = "apply counterexample-based instantiation to all quantified formulas" + +[[option]] + name = "cbqiMultiInst" + category = "regular" + long = "cbqi-multi-inst" + type = "bool" + default = "false" + help = "when applicable, do multi instantiations per quantifier per round in counterexample-based quantifier instantiation" + +[[option]] + name = "cbqiRepeatLit" + category = "regular" + long = "cbqi-repeat-lit" + type = "bool" + default = "false" + help = "solve literals more than once in counterexample-based quantifier instantiation" + +[[option]] + name = "cbqiInnermost" + category = "regular" + long = "cbqi-innermost" + type = "bool" + default = "true" + help = "only process innermost quantified formulas in counterexample-based quantifier instantiation" + +[[option]] + name = "cbqiNestedQE" + category = "regular" + long = "cbqi-nested-qe" + type = "bool" + default = "false" + help = "process nested quantified formulas with quantifier elimination in counterexample-based quantifier instantiation" + +# CEGQI for arithmetic + +[[option]] + name = "cbqiUseInfInt" + category = "regular" + long = "cbqi-use-inf-int" + type = "bool" + default = "false" + help = "use integer infinity for vts in counterexample-based quantifier instantiation" + +[[option]] + name = "cbqiUseInfReal" + category = "regular" + long = "cbqi-use-inf-real" + type = "bool" + default = "false" + help = "use real infinity for vts in counterexample-based quantifier instantiation" + +[[option]] + name = "cbqiPreRegInst" + category = "regular" + long = "cbqi-prereg-inst" + type = "bool" + default = "false" + help = "preregister ground instantiations in counterexample-based quantifier instantiation" + +[[option]] + name = "cbqiMinBounds" + category = "regular" + long = "cbqi-min-bounds" + type = "bool" + default = "false" + read_only = true + help = "use minimally constrained lower/upper bound for counterexample-based quantifier instantiation" + +[[option]] + name = "cbqiRoundUpLowerLia" + category = "regular" + long = "cbqi-round-up-lia" + type = "bool" + default = "false" + read_only = true + help = "round up integer lower bounds in substitutions for counterexample-based quantifier instantiation" + +[[option]] + name = "cbqiMidpoint" + category = "regular" + long = "cbqi-midpoint" + type = "bool" + default = "false" + help = "choose substitutions based on midpoints of lower and upper bounds for counterexample-based quantifier instantiation" + +[[option]] + name = "cbqiNopt" + category = "regular" + long = "cbqi-nopt" + type = "bool" + default = "true" + read_only = true + help = "non-optimal bounds for counterexample-based quantifier instantiation" + +[[option]] + name = "cbqiLitDepend" + category = "regular" + long = "cbqi-lit-dep" + type = "bool" + default = "true" + read_only = true + help = "dependency lemmas for quantifier alternation in counterexample-based quantifier instantiation" + +# CEGQI for EPR + +[[option]] + name = "quantEpr" + category = "regular" + long = "quant-epr" + type = "bool" + default = "false" + help = "infer whether in effectively propositional fragment, use for cbqi" + +[[option]] + name = "quantEprMatching" + category = "regular" + long = "quant-epr-match" + type = "bool" + default = "true" + read_only = true + help = "use matching heuristics for EPR instantiation" + +# CEGQI for BV + +[[option]] + name = "cbqiBv" + category = "regular" + long = "cbqi-bv" + type = "bool" + default = "true" + help = "use word-level inversion approach for counterexample-guided quantifier instantiation for bit-vectors" + +[[option]] + name = "cbqiBvInterleaveValue" + category = "regular" + long = "cbqi-bv-interleave-value" + type = "bool" + default = "false" + help = "interleave model value instantiation with word-level inversion approach" + +[[option]] + name = "cbqiBvIneqMode" + category = "regular" + long = "cbqi-bv-ineq=MODE" + type = "CVC4::theory::quantifiers::CbqiBvIneqMode" + default = "CVC4::theory::quantifiers::CBQI_BV_INEQ_EQ_BOUNDARY" + handler = "stringToCbqiBvIneqMode" + includes = ["options/quantifiers_modes.h"] + help = "choose mode for handling bit-vector inequalities with counterexample-guided instantiation" + +[[option]] + name = "cbqiBvRmExtract" + category = "regular" + long = "cbqi-bv-rm-extract" + type = "bool" + default = "true" + help = "replaces extract terms with variables for counterexample-guided instantiation for bit-vectors" + +[[option]] + name = "cbqiBvLinearize" + category = "regular" + long = "cbqi-bv-linear" + type = "bool" + default = "true" + help = "linearize adder chains for variables" + +[[option]] + name = "cbqiBvConcInv" + category = "regular" + long = "cbqi-bv-concat-inv" + type = "bool" + default = "true" + help = "compute inverse for concat over equalities rather than producing an invertibility condition" + +### Local theory extensions options + +[[option]] + name = "localTheoryExt" + category = "regular" + long = "local-t-ext" + type = "bool" + default = "false" + read_only = true + help = "do instantiation based on local theory extensions" + +[[option]] + name = "ltePartialInst" + category = "regular" + long = "lte-partial-inst" + type = "bool" + default = "false" + read_only = true + help = "partially instantiate local theory quantifiers" + +[[option]] + name = "lteRestrictInstClosure" + category = "regular" + long = "lte-restrict-inst-closure" + type = "bool" + default = "false" + read_only = true + help = "treat arguments of inst closure as restricted terms for instantiation" + +### Reduction options + +[[option]] + name = "quantAlphaEquiv" + category = "regular" + long = "quant-alpha-equiv" + type = "bool" + default = "true" + read_only = true + help = "infer alpha equivalence between quantified formulas" + +[[option]] + name = "macrosQuant" + category = "regular" + long = "macros-quant" + type = "bool" + default = "false" + help = "perform quantifiers macro expansion" + +[[option]] + name = "macrosQuantMode" + category = "regular" + long = "macros-quant-mode=MODE" + type = "CVC4::theory::quantifiers::MacrosQuantMode" + default = "CVC4::theory::quantifiers::MACROS_QUANT_MODE_GROUND_UF" + handler = "stringToMacrosQuantMode" + includes = ["options/quantifiers_modes.h"] + read_only = true + help = "mode for quantifiers macro expansion" + +[[option]] + name = "quantDynamicSplit" + category = "regular" + long = "quant-dsplit-mode=MODE" + type = "CVC4::theory::quantifiers::QuantDSplitMode" + default = "CVC4::theory::quantifiers::QUANT_DSPLIT_MODE_NONE" + handler = "stringToQuantDSplitMode" + includes = ["options/quantifiers_modes.h"] + help = "mode for dynamic quantifiers splitting" + +[[option]] + name = "quantAntiSkolem" + category = "regular" + long = "quant-anti-skolem" + type = "bool" + default = "false" + help = "perform anti-skolemization for quantified formulas" + +### e-unification options + +[[option]] + name = "quantEqualityEngine" + category = "regular" + long = "quant-ee" + type = "bool" + default = "false" + read_only = true + help = "maintain congrunce closure over universal equalities" + +### Higher-order options + +[[option]] + name = "hoMatching" + category = "regular" + long = "ho-matching" + type = "bool" + default = "true" + read_only = true + help = "do higher-order matching algorithm for triggers with variable operators" + +[[option]] + name = "hoMatchingVarArgPriority" + category = "regular" + long = "ho-matching-var-priority" + type = "bool" + default = "true" + read_only = true + help = "give priority to variable arguments over constant arguments" + +[[option]] + name = "hoMergeTermDb" + category = "regular" + long = "ho-merge-term-db" + type = "bool" + default = "true" + read_only = true + help = "merge term indices modulo equality" + +### Proof options + +[[option]] + name = "trackInstLemmas" + category = "regular" + long = "track-inst-lemmas" + type = "bool" + default = "false" + help = "track instantiation lemmas (for proofs, unsat cores, qe and synthesis minimization)" diff --git a/src/options/sep_options b/src/options/sep_options deleted file mode 100644 index ba10cdefb..000000000 --- a/src/options/sep_options +++ /dev/null @@ -1,24 +0,0 @@ -# -# Option specification file for CVC4 -# See src/options/base_options for a description of this file format -# - -module SEP "options/sep_options.h" Sep - -option sepCheckNeg --sep-check-neg bool :default true - check negated spatial assertions - -option sepExp --sep-exp bool :default false - experimental flag for sep -option sepMinimalRefine --sep-min-refine bool :default false - only add refinement lemmas for minimal (innermost) assertions -option sepDisequalC --sep-deq-c bool :default true - assume cardinality elements are distinct - -option sepPreSkolemEmp --sep-pre-skolem-emp bool :default false - eliminate emp constraint at preprocess time - -option sepChildRefine --sep-child-refine bool :default false - child-specific refinements of negated star, positive wand - -endmodule diff --git a/src/options/sep_options.toml b/src/options/sep_options.toml new file mode 100644 index 000000000..e19790d7b --- /dev/null +++ b/src/options/sep_options.toml @@ -0,0 +1,57 @@ +id = "SEP" +name = "Sep" +header = "options/sep_options.h" + +[[option]] + name = "sepCheckNeg" + category = "regular" + long = "sep-check-neg" + type = "bool" + default = "true" + read_only = true + help = "check negated spatial assertions" + +[[option]] + name = "sepExp" + category = "regular" + long = "sep-exp" + type = "bool" + default = "false" + read_only = true + help = "experimental flag for sep" + +[[option]] + name = "sepMinimalRefine" + category = "regular" + long = "sep-min-refine" + type = "bool" + default = "false" + read_only = true + help = "only add refinement lemmas for minimal (innermost) assertions" + +[[option]] + name = "sepDisequalC" + category = "regular" + long = "sep-deq-c" + type = "bool" + default = "true" + read_only = true + help = "assume cardinality elements are distinct" + +[[option]] + name = "sepPreSkolemEmp" + category = "regular" + long = "sep-pre-skolem-emp" + type = "bool" + default = "false" + read_only = true + help = "eliminate emp constraint at preprocess time" + +[[option]] + name = "sepChildRefine" + category = "regular" + long = "sep-child-refine" + type = "bool" + default = "false" + read_only = true + help = "child-specific refinements of negated star, positive wand" diff --git a/src/options/sets_options b/src/options/sets_options deleted file mode 100644 index 3e093cb8b..000000000 --- a/src/options/sets_options +++ /dev/null @@ -1,20 +0,0 @@ -# -# Option specification file for CVC4 -# See src/options/base_options for a description of this file format -# - -module SETS "options/sets_options.h" Sets - -option setsProxyLemmas --sets-proxy-lemmas bool :default false - introduce proxy variables eagerly to shorten lemmas - -option setsInferAsLemmas --sets-infer-as-lemmas bool :default true - send inferences as lemmas - -option setsRelEager --sets-rel-eager bool :default true - standard effort checks for relations - -option setsExt --sets-ext bool :default false - enable extended symbols such as complement and universe in theory of sets - -endmodule diff --git a/src/options/sets_options.toml b/src/options/sets_options.toml new file mode 100644 index 000000000..3d46b3be3 --- /dev/null +++ b/src/options/sets_options.toml @@ -0,0 +1,39 @@ +id = "SETS" +name = "Sets" +header = "options/sets_options.h" + +[[option]] + name = "setsProxyLemmas" + category = "regular" + long = "sets-proxy-lemmas" + type = "bool" + default = "false" + read_only = true + help = "introduce proxy variables eagerly to shorten lemmas" + +[[option]] + name = "setsInferAsLemmas" + category = "regular" + long = "sets-infer-as-lemmas" + type = "bool" + default = "true" + read_only = true + help = "send inferences as lemmas" + +[[option]] + name = "setsRelEager" + category = "regular" + long = "sets-rel-eager" + type = "bool" + default = "true" + read_only = true + help = "standard effort checks for relations" + +[[option]] + name = "setsExt" + category = "regular" + long = "sets-ext" + type = "bool" + default = "false" + read_only = true + help = "enable extended symbols such as complement and universe in theory of sets" diff --git a/src/options/smt_options.toml b/src/options/smt_options.toml new file mode 100644 index 000000000..a9093b894 --- /dev/null +++ b/src/options/smt_options.toml @@ -0,0 +1,617 @@ +id = "SMT" +name = "SMT layer" +header = "options/smt_options.h" + +[[option]] + name = "dumpModeString" + smt_name = "dump" + category = "common" + long = "dump=MODE" + type = "std::string" + notifies = ["notifyDumpMode"] + read_only = true + help = "dump preprocessed assertions, etc., see --dump=help" + +[[option]] + name = "dumpToFileName" + smt_name = "dump-to" + category = "common" + long = "dump-to=FILE" + type = "std::string" + notifies = ["notifyDumpToFile"] + read_only = true + help = "all dumping goes to FILE (instead of stdout)" + +[[option]] + name = "forceLogicString" + smt_name = "force-logic" + category = "expert" + long = "force-logic=LOGIC" + type = "std::string" + notifies = ["notifyForceLogic"] + read_only = true + help = "set the logic, and override all further user attempts to change it" + +[[option]] + name = "simplificationMode" + smt_name = "simplification-mode" + category = "regular" + long = "simplification=MODE" + type = "SimplificationMode" + default = "SIMPLIFICATION_MODE_BATCH" + handler = "stringToSimplificationMode" + includes = ["options/simplification_mode.h"] + help = "choose simplification mode, see --simplification=help" + +[[alias]] + category = "regular" + long = "no-simplification" + links = ["--simplification=none"] + help = "turn off all simplification (same as --simplification=none)" + +[[option]] + name = "doStaticLearning" + category = "regular" + long = "static-learning" + type = "bool" + default = "true" + read_only = true + help = "use static learning (on by default)" + +[[option]] + name = "expandDefinitions" + smt_name = "expand-definitions" + category = "regular" + type = "bool" + default = "false" + read_only = true + help = "always expand symbol definitions in output" + +[[option]] + name = "produceModels" + category = "common" + short = "m" + long = "produce-models" + type = "bool" + default = "false" + notifies = ["notifyBeforeSearch"] + read_only = true + help = "support the get-value and get-model commands" + +[[option]] + name = "checkModels" + category = "regular" + long = "check-models" + type = "bool" + notifies = ["notifyBeforeSearch"] + links = ["--produce-models", "--produce-assertions"] + read_only = true + help = "after SAT/INVALID/UNKNOWN, check that the generated model satisfies user assertions" + +[[option]] + name = "dumpModels" + category = "regular" + long = "dump-models" + type = "bool" + default = "false" + links = ["--produce-models"] + read_only = true + help = "output models after every SAT/INVALID/UNKNOWN response" + +[[option]] + name = "omitDontCares" + category = "regular" + long = "omit-dont-cares" + type = "bool" + default = "false" + read_only = true + help = "When producing a model, omit variables whose value does not matter" + +[[option]] + name = "proof" + smt_name = "produce-proofs" + category = "regular" + long = "proof" + type = "bool" + default = "false" + predicates = ["proofEnabledBuild"] + notifies = ["notifyBeforeSearch"] + read_only = true + help = "turn on proof generation" + +[[option]] + name = "checkProofs" + category = "regular" + long = "check-proofs" + type = "bool" + predicates = ["LFSCEnabledBuild"] + notifies = ["notifyBeforeSearch"] + links = ["--proof"] + help = "after UNSAT/VALID, machine-check the generated proof" + +[[option]] + name = "dumpProofs" + category = "regular" + long = "dump-proofs" + type = "bool" + default = "false" + links = ["--proof"] + read_only = true + help = "output proofs after every UNSAT/VALID response" + +[[option]] + name = "dumpInstantiations" + category = "regular" + long = "dump-instantiations" + type = "bool" + default = "false" + read_only = true + help = "output instantiations of quantified formulas after every UNSAT/VALID response" + +[[option]] + name = "sygusOut" + category = "regular" + long = "sygus-out=MODE" + type = "SygusSolutionOutMode" + default = "SYGUS_SOL_OUT_STATUS_AND_DEF" + handler = "stringToSygusSolutionOutMode" + includes = ["options/sygus_out_mode.h"] + help = "output mode for sygus" + +[[option]] + name = "sygusPrintCallbacks" + category = "regular" + long = "sygus-print-callbacks" + type = "bool" + default = "true" + read_only = true + help = "use sygus print callbacks to print sygus terms in the user-provided form (disable for debugging)" + +[[option]] + name = "dumpSynth" + category = "regular" + long = "dump-synth" + type = "bool" + default = "false" + help = "output solution for synthesis conjectures after every UNSAT/VALID response" + +[[option]] + name = "unsatCores" + category = "regular" + long = "produce-unsat-cores" + type = "bool" + predicates = ["proofEnabledBuild"] + notifies = ["notifyBeforeSearch"] + read_only = true + help = "turn on unsat core generation" + +[[option]] + name = "checkUnsatCores" + category = "regular" + long = "check-unsat-cores" + type = "bool" + links = ["--produce-unsat-cores"] + help = "after UNSAT/VALID, produce and check an unsat core (expensive)" + +[[option]] + name = "dumpUnsatCores" + category = "regular" + long = "dump-unsat-cores" + type = "bool" + default = "false" + notifies = ["notifyBeforeSearch"] + links = ["--produce-unsat-cores"] + read_only = true + help = "output unsat cores after every UNSAT/VALID response" + +[[option]] + name = "dumpUnsatCoresFull" + category = "regular" + long = "dump-unsat-cores-full" + type = "bool" + default = "false" + notifies = ["notifyBeforeSearch"] + links = ["--dump-unsat-cores"] + read_only = true + help = "dump the full unsat core, including unlabeled assertions" + +[[option]] + name = "unsatAssumptions" + category = "regular" + long = "produce-unsat-assumptions" + type = "bool" + default = "false" + links = ["--produce-unsat-cores"] + predicates = ["proofEnabledBuild"] + notifies = ["notifyBeforeSearch"] + read_only = true + help = "turn on unsat assumptions generation" + +[[option]] + name = "checkSynthSol" + category = "regular" + long = "check-synth-sol" + type = "bool" + default = "false" + read_only = true + help = "checks whether produced solutions to functions-to-synthesize satisfy the conjecture" + +[[option]] + name = "produceAssignments" + category = "regular" + long = "produce-assignments" + type = "bool" + default = "false" + notifies = ["notifyBeforeSearch"] + read_only = true + help = "support the get-assignment command" + +[[option]] + name = "interactiveMode" + smt_name = "interactive-mode" + category = "undocumented" + type = "bool" + predicates = ["setProduceAssertions"] + notifies = ["notifyBeforeSearch"] + help = "deprecated name for produce-assertions" + +[[option]] + name = "produceAssertions" + category = "common" + long = "produce-assertions" + type = "bool" + predicates = ["setProduceAssertions"] + notifies = ["notifyBeforeSearch"] + help = "keep an assertions list (enables get-assertions command)" + +[[option]] + name = "doITESimp" + category = "regular" + long = "ite-simp" + type = "bool" + help = "turn on ite simplification (Kim (and Somenzi) et al., SAT 2009)" + +[[option]] + name = "doITESimpOnRepeat" + category = "regular" + long = "on-repeat-ite-simp" + type = "bool" + default = "false" + help = "do the ite simplification pass again if repeating simplification" + +[[option]] + name = "extRewPrep" + category = "regular" + long = "ext-rew-prep" + type = "bool" + default = "false" + help = "use extended rewriter as a preprocessing pass" + +[[option]] + name = "extRewPrepAgg" + category = "regular" + long = "ext-rew-prep-agg" + type = "bool" + default = "false" + help = "use aggressive extended rewriter as a preprocessing pass" + +[[option]] + name = "simplifyWithCareEnabled" + category = "regular" + long = "simp-with-care" + type = "bool" + default = "false" + help = "enables simplifyWithCare in ite simplificiation" + +[[option]] + name = "compressItes" + category = "regular" + long = "simp-ite-compress" + type = "bool" + default = "false" + help = "enables compressing ites after ite simplification" + +[[option]] + name = "unconstrainedSimp" + category = "regular" + long = "unconstrained-simp" + type = "bool" + default = "false" + help = "turn on unconstrained simplification (see Bruttomesso/Brummayer PhD thesis)" + +[[option]] + name = "repeatSimp" + category = "regular" + long = "repeat-simp" + type = "bool" + help = "make multiple passes with nonclausal simplifier" + +[[option]] + name = "zombieHuntThreshold" + category = "regular" + long = "simp-ite-hunt-zombies" + type = "uint32_t" + default = "524288" + read_only = true + help = "post ite compression enables zombie removal while the number of nodes is above this threshold" + +[[option]] + name = "sortInference" + category = "regular" + long = "sort-inference" + type = "bool" + default = "false" + help = "calculate sort inference of input problem, convert the input based on monotonic sorts" + +[[option]] + name = "incrementalSolving" + category = "common" + short = "i" + long = "incremental" + type = "bool" + default = "true" + read_only = true + help = "enable incremental solving" + +[[option]] + name = "abstractValues" + category = "regular" + long = "abstract-values" + type = "bool" + default = "false" + read_only = true + help = "in models, output arrays (and in future, maybe others) using abstract values, as required by the SMT-LIB standard" + +[[option]] + name = "modelUninterpDtEnum" + category = "regular" + long = "model-u-dt-enum" + type = "bool" + default = "false" + read_only = true + help = "in models, output uninterpreted sorts as datatype enumerations" + +[[option]] + name = "regularChannelName" + smt_name = "regular-output-channel" + category = "regular" + type = "std::string" + notifies = ["notifySetRegularOutputChannel"] + read_only = true + help = "set the regular output channel of the solver" + +[[option]] + name = "diagnosticChannelName" + smt_name = "diagnostic-output-channel" + category = "regular" + type = "std::string" + notifies = ["notifySetDiagnosticOutputChannel"] + read_only = true + help = "set the diagnostic output channel of the solver" + +[[option]] + name = "cumulativeMillisecondLimit" + smt_name = "tlimit" + category = "common" + long = "tlimit=MS" + type = "unsigned long" + handler = "tlimitHandler" + notifies = ["notifyTlimit"] + read_only = true + help = "enable time limiting (give milliseconds)" + +[[option]] + name = "perCallMillisecondLimit" + smt_name = "tlimit-per" + category = "common" + long = "tlimit-per=MS" + type = "unsigned long" + handler = "tlimitPerHandler" + notifies = ["notifyTlimitPer"] + read_only = true + help = "enable time limiting per query (give milliseconds)" + +[[option]] + name = "cumulativeResourceLimit" + smt_name = "rlimit" + category = "common" + long = "rlimit=N" + type = "unsigned long" + handler = "rlimitHandler" + notifies = ["notifyRlimit"] + read_only = true + help = "enable resource limiting (currently, roughly the number of SAT conflicts)" + +[[option]] + name = "perCallResourceLimit" + smt_name = "reproducible-resource-limit" + category = "common" + long = "rlimit-per=N" + type = "unsigned long" + handler = "rlimitPerHandler" + notifies = ["notifyRlimitPer"] + read_only = true + help = "enable resource limiting per query" + +[[option]] + name = "hardLimit" + category = "common" + long = "hard-limit" + type = "bool" + default = "false" + read_only = true + help = "the resource limit is hard potentially leaving the smtEngine in an unsafe state (should be destroyed and rebuild after resourcing out)" + +[[option]] + name = "cpuTime" + category = "common" + long = "cpu-time" + type = "bool" + default = "false" + read_only = true + help = "measures CPU time if set to true and wall time if false (default false)" + +[[option]] + name = "rewriteStep" + category = "expert" + long = "rewrite-step" + type = "unsigned" + default = "1" + read_only = true + help = "amount of resources spent for each rewrite step" + +[[option]] + name = "theoryCheckStep" + category = "expert" + long = "theory-check-step" + type = "unsigned" + default = "1" + read_only = true + help = "amount of resources spent for each theory check call" + +[[option]] + name = "decisionStep" + category = "expert" + long = "decision-step" + type = "unsigned" + default = "1" + read_only = true + help = "amount of getNext decision calls in the decision engine" + +[[option]] + name = "bitblastStep" + category = "expert" + long = "bitblast-step" + type = "unsigned" + default = "1" + read_only = true + help = "amount of resources spent for each bitblast step" + +[[option]] + name = "parseStep" + category = "expert" + long = "parse-step" + type = "unsigned" + default = "1" + read_only = true + help = "amount of resources spent for each command/expression parsing" + +[[option]] + name = "lemmaStep" + category = "expert" + long = "lemma-step" + type = "unsigned" + default = "1" + read_only = true + help = "amount of resources spent when adding lemmas" + +[[option]] + name = "restartStep" + category = "expert" + long = "restart-step" + type = "unsigned" + default = "1" + read_only = true + help = "amount of resources spent for each theory restart" + +[[option]] + name = "cnfStep" + category = "expert" + long = "cnf-step" + type = "unsigned" + default = "1" + read_only = true + help = "amount of resources spent for each call to cnf conversion" + +[[option]] + name = "preprocessStep" + category = "expert" + long = "preprocess-step" + type = "unsigned" + default = "1" + read_only = true + help = "amount of resources spent for each preprocessing step in SmtEngine" + +[[option]] + name = "quantifierStep" + category = "expert" + long = "quantifier-step" + type = "unsigned" + default = "1" + read_only = true + help = "amount of resources spent for quantifier instantiations" + +[[option]] + name = "satConflictStep" + category = "expert" + long = "sat-conflict-step" + type = "unsigned" + default = "1" + read_only = true + help = "amount of resources spent for each sat conflict (main sat solver)" + +[[option]] + name = "bvSatConflictStep" + category = "expert" + long = "bv-sat-conflict-step" + type = "unsigned" + default = "1" + read_only = true + help = "amount of resources spent for each sat conflict (bitvectors)" + +[[option]] + name = "rewriteApplyToConst" + category = "expert" + long = "rewrite-apply-to-const" + type = "bool" + default = "false" + read_only = true + help = "eliminate function applications, rewriting e.g. f(5) to a new symbol f_5" + +# --replay is currently broken; don't document it for 1.0 +[[option]] + name = "replayInputFilename" + category = "undocumented" + long = "replay=FILE" + type = "std::string" + handler = "checkReplayFilename" + read_only = true + help = "replay decisions from file" + +# --replay is currently broken; don't document it for 1.0 +[[option]] + name = "replayLogFilename" + category = "undocumented" + long = "replay-log=FILE" + type = "std::string" + handler = "checkReplayFilename" + notifies = ["notifySetReplayLogFilename", "notifyBeforeSearch"] + read_only = true + help = "replay decisions from file" + +[[option]] + name = "forceNoLimitCpuWhileDump" + category = "regular" + long = "force-no-limit-cpu-while-dump" + type = "bool" + default = "false" + read_only = true + help = "Force no CPU limit when dumping models and proofs" + +[[option]] + name = "solveIntAsBV" + category = "undocumented" + long = "solve-int-as-bv" + type = "uint32_t" + default = "0" + read_only = true + help = "attempt to solve a pure integer satisfiable problem by bitblasting in sufficient bitwidth (experimental)" + +[[option]] + name = "solveRealAsInt" + category = "undocumented" + long = "solve-real-as-int" + type = "bool" + default = "false" + read_only = true + help = "attempt to solve a pure real satisfiable problem as a integer problem (for non-linear)" diff --git a/src/options/strings_options b/src/options/strings_options deleted file mode 100644 index 6dd7030a1..000000000 --- a/src/options/strings_options +++ /dev/null @@ -1,76 +0,0 @@ -# -# Option specification file for CVC4 -# See src/options/base_options for a description of this file format -# - -module STRINGS "options/strings_options.h" Strings theory - -option stringExp strings-exp --strings-exp bool :default false :read-write - experimental features in the theory of strings - -# :predicate-include "smt/smt_engine.h" -option stringLB strings-lb --strings-lb=N unsigned :default 0 :predicate unsignedLessEqual2 - the strategy of LB rule application: 0-lazy, 1-eager, 2-no - -# :predicate-include "smt/smt_engine.h" -option stdASCII strings-std-ascii --strings-std-ascii bool :default true :predicate unsignedLessEqual2 - the alphabet contains only characters from the standard ASCII or the extended one - -option stringFMF strings-fmf --strings-fmf bool :default false :read-write - the finite model finding used by the theory of strings - -option stringEager strings-eager --strings-eager bool :default false - strings eager check - -option stringEIT strings-eit --strings-eit bool :default false - the eager intersection used by the theory of strings - -option stringOpt1 strings-opt1 --strings-opt1 bool :default true - internal option1 for strings: normal form - -option stringOpt2 strings-opt2 --strings-opt2 bool :default false - internal option2 for strings: constant regexp splitting - -option stringIgnNegMembership strings-inm --strings-inm bool :default false - internal for strings: ignore negative membership constraints (fragment checking is needed, left to users for now) - -#expert-option stringCharCardinality strings-alphabet-card --strings-alphabet-card=N int16_t :default 128 :read-write -# the cardinality of the characters used by the theory of strings, default 128 (for standard ASCII) or 256 (for extended ASCII) - -option stringLazyPreproc strings-lazy-pp --strings-lazy-pp bool :default true - perform string preprocessing lazily - -option stringLenGeqZ strings-len-geqz --strings-len-geqz bool :default false - strings length greater than zero lemmas - -option stringLenNorm strings-len-norm --strings-len-norm bool :default true - strings length normalization lemma -option stringSplitEmp strings-sp-emp --strings-sp-emp bool :default true - strings split on empty string -option stringInferSym strings-infer-sym --strings-infer-sym bool :default true - strings split on empty string -option stringEagerLen strings-eager-len --strings-eager-len bool :default true - strings eager length lemmas -option stringCheckEntailLen strings-check-entail-len --strings-check-entail-len bool :default true - check entailment between length terms to reduce splitting -option stringProcessLoop strings-process-loop --strings-process-loop bool :default true - reduce looping word equations to regular expressions -option stringAbortLoop strings-abort-loop --strings-abort-loop bool :default false - abort when a looping word equation is encountered -option stringInferAsLemmas strings-infer-as-lemmas --strings-infer-as-lemmas bool :default false - always send lemmas out instead of making internal inferences -option stringRExplainLemmas strings-rexplain-lemmas --strings-rexplain-lemmas bool :default true - regression explanations for string lemmas -option stringMinPrefixExplain strings-min-prefix-explain --strings-min-prefix-explain bool :default true - minimize explanations for prefix of normal forms in strings -option stringGuessModel strings-guess-model --strings-guess-model bool :default false - use model guessing to avoid string extended function reductions -option stringUfReduct strings-uf-reduct --strings-uf-reduct bool :default false - use uninterpreted functions when applying extended function reductions -option stringBinaryCsp strings-binary-csp --strings-binary-csp bool :default false - use binary search when splitting strings -option stringLenPropCsp strings-lprop-csp --strings-lprop-csp bool :default false - do length propagation based on constant splits - - -endmodule diff --git a/src/options/strings_options.toml b/src/options/strings_options.toml new file mode 100644 index 000000000..06edb53ed --- /dev/null +++ b/src/options/strings_options.toml @@ -0,0 +1,229 @@ +id = "STRINGS" +name = "Strings theory" +header = "options/strings_options.h" + +[[option]] + name = "stringExp" + category = "regular" + long = "strings-exp" + type = "bool" + default = "false" + help = "experimental features in the theory of strings" + +[[option]] + name = "stringLB" + smt_name = "strings-lb" + category = "regular" + long = "strings-lb=N" + type = "unsigned" + default = "0" + predicates = ["unsignedLessEqual2"] + read_only = true + help = "the strategy of LB rule application: 0-lazy, 1-eager, 2-no" + +[[option]] + name = "stdASCII" + category = "regular" + long = "strings-std-ascii" + type = "bool" + default = "true" + predicates = ["unsignedLessEqual2"] + read_only = true + help = "the alphabet contains only characters from the standard ASCII or the extended one" + +[[option]] + name = "stringFMF" + category = "regular" + long = "strings-fmf" + type = "bool" + default = "false" + help = "the finite model finding used by the theory of strings" + +[[option]] + name = "stringEager" + category = "regular" + long = "strings-eager" + type = "bool" + default = "false" + read_only = true + help = "strings eager check" + +[[option]] + name = "stringEIT" + category = "regular" + long = "strings-eit" + type = "bool" + default = "false" + read_only = true + help = "the eager intersection used by the theory of strings" + +[[option]] + name = "stringOpt1" + category = "regular" + long = "strings-opt1" + type = "bool" + default = "true" + read_only = true + help = "internal option1 for strings: normal form" + +[[option]] + name = "stringOpt2" + category = "regular" + long = "strings-opt2" + type = "bool" + default = "false" + read_only = true + help = "internal option2 for strings: constant regexp splitting" + +[[option]] + name = "stringIgnNegMembership" + category = "regular" + long = "strings-inm" + type = "bool" + default = "false" + read_only = true + help = "internal for strings: ignore negative membership constraints (fragment checking is needed, left to users for now)" + +[[option]] + name = "stringLazyPreproc" + category = "regular" + long = "strings-lazy-pp" + type = "bool" + default = "true" + read_only = true + help = "perform string preprocessing lazily" + +[[option]] + name = "stringLenGeqZ" + category = "regular" + long = "strings-len-geqz" + type = "bool" + default = "false" + read_only = true + help = "strings length greater than zero lemmas" + +[[option]] + name = "stringLenNorm" + category = "regular" + long = "strings-len-norm" + type = "bool" + default = "true" + read_only = true + help = "strings length normalization lemma" + +[[option]] + name = "stringSplitEmp" + category = "regular" + long = "strings-sp-emp" + type = "bool" + default = "true" + read_only = true + help = "strings split on empty string" + +[[option]] + name = "stringInferSym" + category = "regular" + long = "strings-infer-sym" + type = "bool" + default = "true" + read_only = true + help = "strings split on empty string" + +[[option]] + name = "stringEagerLen" + category = "regular" + long = "strings-eager-len" + type = "bool" + default = "true" + read_only = true + help = "strings eager length lemmas" + +[[option]] + name = "stringCheckEntailLen" + category = "regular" + long = "strings-check-entail-len" + type = "bool" + default = "true" + read_only = true + help = "check entailment between length terms to reduce splitting" + +[[option]] + name = "stringProcessLoop" + category = "regular" + long = "strings-process-loop" + type = "bool" + default = "true" + read_only = true + help = "reduce looping word equations to regular expressions" + +[[option]] + name = "stringAbortLoop" + category = "regular" + long = "strings-abort-loop" + type = "bool" + default = "false" + read_only = true + help = "abort when a looping word equation is encountered" + +[[option]] + name = "stringInferAsLemmas" + category = "regular" + long = "strings-infer-as-lemmas" + type = "bool" + default = "false" + read_only = true + help = "always send lemmas out instead of making internal inferences" + +[[option]] + name = "stringRExplainLemmas" + category = "regular" + long = "strings-rexplain-lemmas" + type = "bool" + default = "true" + read_only = true + help = "regression explanations for string lemmas" + +[[option]] + name = "stringMinPrefixExplain" + category = "regular" + long = "strings-min-prefix-explain" + type = "bool" + default = "true" + read_only = true + help = "minimize explanations for prefix of normal forms in strings" + +[[option]] + name = "stringGuessModel" + category = "regular" + long = "strings-guess-model" + type = "bool" + default = "false" + read_only = true + help = "use model guessing to avoid string extended function reductions" + +[[option]] + name = "stringUfReduct" + category = "regular" + long = "strings-uf-reduct" + type = "bool" + default = "false" + read_only = true + help = "use uninterpreted functions when applying extended function reductions" + +[[option]] + name = "stringBinaryCsp" + category = "regular" + long = "strings-binary-csp" + type = "bool" + default = "false" + read_only = true + help = "use binary search when splitting strings" + +[[option]] + name = "stringLenPropCsp" + category = "regular" + long = "strings-lprop-csp" + type = "bool" + default = "false" + read_only = true + help = "do length propagation based on constant splits" diff --git a/src/options/theory_options b/src/options/theory_options deleted file mode 100644 index 131b5fb80..000000000 --- a/src/options/theory_options +++ /dev/null @@ -1,14 +0,0 @@ -# -# Option specification file for CVC4 -# See src/options/base_options for a description of this file format -# - -module THEORY "options/theory_options.h" Theory layer - -expert-option theoryOfMode theoryof-mode --theoryof-mode=MODE CVC4::theory::TheoryOfMode :handler stringToTheoryOfMode :default CVC4::theory::THEORY_OF_TYPE_BASED :include "options/theoryof_mode.h" :read-write - mode for Theory::theoryof() - -option useTheoryList use-theory --use-theory=NAME std::string :handler handleUseTheoryList :notify notifyUseTheoryList - use alternate theory implementation NAME (--use-theory=help for a list). This option may be repeated or a comma separated list. - -endmodule diff --git a/src/options/theory_options.toml b/src/options/theory_options.toml new file mode 100644 index 000000000..2b1f75072 --- /dev/null +++ b/src/options/theory_options.toml @@ -0,0 +1,25 @@ +id = "THEORY" +name = "Theory layer" +header = "options/theory_options.h" + +[[option]] + name = "theoryOfMode" + smt_name = "theoryof-mode" + category = "expert" + long = "theoryof-mode=MODE" + type = "CVC4::theory::TheoryOfMode" + default = "CVC4::theory::THEORY_OF_TYPE_BASED" + handler = "stringToTheoryOfMode" + includes = ["options/theoryof_mode.h"] + help = "mode for Theory::theoryof()" + +[[option]] + name = "useTheoryList" + smt_name = "use-theory" + category = "regular" + long = "use-theory=NAME" + type = "std::string" + handler = "handleUseTheoryList" + notifies = ["notifyUseTheoryList"] + read_only = true + help = "use alternate theory implementation NAME (--use-theory=help for a list). This option may be repeated or a comma separated list." diff --git a/src/options/uf_options b/src/options/uf_options deleted file mode 100644 index c93ccf864..000000000 --- a/src/options/uf_options +++ /dev/null @@ -1,49 +0,0 @@ -# -# Option specification file for CVC4 -# See src/options/base_options for a description of this file format -# - -module UF "options/uf_options.h" Uninterpreted functions theory - -option ufSymmetryBreaker uf-symmetry-breaker --symmetry-breaker bool :read-write :default true - use UF symmetry breaker (Deharbe et al., CADE 2011) - -option condenseFunctionValues condense-function-values --condense-function-values bool :default true - condense models for functions rather than explicitly representing them - -option ufssRegions --uf-ss-regions bool :default true - disable region-based method for discovering cliques and splits in uf strong solver -option ufssEagerSplits --uf-ss-eager-split bool :default false - add splits eagerly for uf strong solver -option ufssTotality --uf-ss-totality bool :default false - always use totality axioms for enforcing cardinality constraints -option ufssTotalityLimited --uf-ss-totality-limited=N int :default -1 - apply totality axioms, but only up to cardinality N (-1 == do not apply totality axioms, default) -option ufssTotalitySymBreak --uf-ss-totality-sym-break bool :default false - apply symmetry breaking for totality axioms -option ufssAbortCardinality --uf-ss-abort-card=N int :default -1 - tells the uf strong solver to only consider models that interpret uninterpreted sorts of cardinality at most N (-1 == no limit, default) -option ufssExplainedCliques --uf-ss-explained-cliques bool :default false - use explained clique lemmas for uf strong solver -option ufssSimpleCliques --uf-ss-simple-cliques bool :default true - always use simple clique lemmas for uf strong solver -option ufssDiseqPropagation --uf-ss-deq-prop bool :default false - eagerly propagate disequalities for uf strong solver -option ufssMode --uf-ss=MODE CVC4::theory::uf::UfssMode :default CVC4::theory::uf::UF_SS_FULL :include "options/ufss_mode.h" :handler stringToUfssMode - mode of operation for uf strong solver. -option ufssCliqueSplits --uf-ss-clique-splits bool :default false - use cliques instead of splitting on demand to shrink model - -option ufssSymBreak --uf-ss-sym-break bool :default false - finite model finding symmetry breaking techniques -option ufssFairness --uf-ss-fair bool :default true - use fair strategy for finite model finding multiple sorts -option ufssFairnessMonotone --uf-ss-fair-monotone bool :read-write :default false - group monotone sorts when enforcing fairness for finite model finding - -option ufHo --uf-ho bool :read-write :default false - enable support for higher-order reasoning -option ufHoExt --uf-ho-ext bool :read-write :default true - apply extensionality on function symbols - -endmodule diff --git a/src/options/uf_options.toml b/src/options/uf_options.toml new file mode 100644 index 000000000..34d4eeefc --- /dev/null +++ b/src/options/uf_options.toml @@ -0,0 +1,164 @@ +id = "UF" +name = "Uninterpreted functions theory" +header = "options/uf_options.h" + +[[option]] + name = "ufSymmetryBreaker" + smt_name = "uf-symmetry-breaker" + category = "regular" + long = "symmetry-breaker" + type = "bool" + default = "true" + help = "use UF symmetry breaker (Deharbe et al., CADE 2011)" + +[[option]] + name = "condenseFunctionValues" + category = "regular" + long = "condense-function-values" + type = "bool" + default = "true" + read_only = true + help = "condense models for functions rather than explicitly representing them" + +[[option]] + name = "ufssRegions" + category = "regular" + long = "uf-ss-regions" + type = "bool" + default = "true" + read_only = true + help = "disable region-based method for discovering cliques and splits in uf strong solver" + +[[option]] + name = "ufssEagerSplits" + category = "regular" + long = "uf-ss-eager-split" + type = "bool" + default = "false" + read_only = true + help = "add splits eagerly for uf strong solver" + +[[option]] + name = "ufssTotality" + category = "regular" + long = "uf-ss-totality" + type = "bool" + default = "false" + read_only = true + help = "always use totality axioms for enforcing cardinality constraints" + +[[option]] + name = "ufssTotalityLimited" + category = "regular" + long = "uf-ss-totality-limited=N" + type = "int" + default = "-1" + read_only = true + help = "apply totality axioms, but only up to cardinality N (-1 == do not apply totality axioms, default)" + +[[option]] + name = "ufssTotalitySymBreak" + category = "regular" + long = "uf-ss-totality-sym-break" + type = "bool" + default = "false" + read_only = true + help = "apply symmetry breaking for totality axioms" + +[[option]] + name = "ufssAbortCardinality" + category = "regular" + long = "uf-ss-abort-card=N" + type = "int" + default = "-1" + read_only = true + help = "tells the uf strong solver to only consider models that interpret uninterpreted sorts of cardinality at most N (-1 == no limit, default)" + +[[option]] + name = "ufssExplainedCliques" + category = "regular" + long = "uf-ss-explained-cliques" + type = "bool" + default = "false" + read_only = true + help = "use explained clique lemmas for uf strong solver" + +[[option]] + name = "ufssSimpleCliques" + category = "regular" + long = "uf-ss-simple-cliques" + type = "bool" + default = "true" + read_only = true + help = "always use simple clique lemmas for uf strong solver" + +[[option]] + name = "ufssDiseqPropagation" + category = "regular" + long = "uf-ss-deq-prop" + type = "bool" + default = "false" + read_only = true + help = "eagerly propagate disequalities for uf strong solver" + +[[option]] + name = "ufssMode" + category = "regular" + long = "uf-ss=MODE" + type = "CVC4::theory::uf::UfssMode" + default = "CVC4::theory::uf::UF_SS_FULL" + handler = "stringToUfssMode" + includes = ["options/ufss_mode.h"] + read_only = true + help = "mode of operation for uf strong solver." + +[[option]] + name = "ufssCliqueSplits" + category = "regular" + long = "uf-ss-clique-splits" + type = "bool" + default = "false" + read_only = true + help = "use cliques instead of splitting on demand to shrink model" + +[[option]] + name = "ufssSymBreak" + category = "regular" + long = "uf-ss-sym-break" + type = "bool" + default = "false" + read_only = true + help = "finite model finding symmetry breaking techniques" + +[[option]] + name = "ufssFairness" + category = "regular" + long = "uf-ss-fair" + type = "bool" + default = "true" + read_only = true + help = "use fair strategy for finite model finding multiple sorts" + +[[option]] + name = "ufssFairnessMonotone" + category = "regular" + long = "uf-ss-fair-monotone" + type = "bool" + default = "false" + help = "group monotone sorts when enforcing fairness for finite model finding" + +[[option]] + name = "ufHo" + category = "regular" + long = "uf-ho" + type = "bool" + default = "false" + help = "enable support for higher-order reasoning" + +[[option]] + name = "ufHoExt" + category = "regular" + long = "uf-ho-ext" + type = "bool" + default = "true" + help = "apply extensionality on function symbols" diff --git a/test/regress/regress0/arith/miplib-opt1217--27.smt.expect b/test/regress/regress0/arith/miplib-opt1217--27.smt.expect index f0bc97ee5..24c63a495 100644 --- a/test/regress/regress0/arith/miplib-opt1217--27.smt.expect +++ b/test/regress/regress0/arith/miplib-opt1217--27.smt.expect @@ -1,2 +1,2 @@ -% COMMAND-LINE: --enable-miplib-trick +% COMMAND-LINE: --miplib-trick % EXPECT: unsat diff --git a/test/regress/regress0/arith/miplib-pp08a-3000.smt.expect b/test/regress/regress0/arith/miplib-pp08a-3000.smt.expect index f0bc97ee5..24c63a495 100644 --- a/test/regress/regress0/arith/miplib-pp08a-3000.smt.expect +++ b/test/regress/regress0/arith/miplib-pp08a-3000.smt.expect @@ -1,2 +1,2 @@ -% COMMAND-LINE: --enable-miplib-trick +% COMMAND-LINE: --miplib-trick % EXPECT: unsat diff --git a/test/regress/regress0/arith/miplib.cvc b/test/regress/regress0/arith/miplib.cvc index 49c0b61cb..a7ae19b0a 100644 --- a/test/regress/regress0/arith/miplib.cvc +++ b/test/regress/regress0/arith/miplib.cvc @@ -1,4 +1,4 @@ -% COMMAND-LINE: --enable-miplib-trick +% COMMAND-LINE: --miplib-trick % EXPECT: sat tmp1, tmp2, tmp3 : INT; diff --git a/test/regress/regress0/arith/miplib2.cvc b/test/regress/regress0/arith/miplib2.cvc index 5cd2f545c..ce2e9712e 100644 --- a/test/regress/regress0/arith/miplib2.cvc +++ b/test/regress/regress0/arith/miplib2.cvc @@ -1,4 +1,4 @@ -% COMMAND-LINE: --enable-miplib-trick +% COMMAND-LINE: --miplib-trick % EXPECT: sat tmp1, tmp2, tmp3 : INT; diff --git a/test/regress/regress0/arith/miplib4.cvc b/test/regress/regress0/arith/miplib4.cvc index 9d7c4592e..722122b38 100644 --- a/test/regress/regress0/arith/miplib4.cvc +++ b/test/regress/regress0/arith/miplib4.cvc @@ -1,4 +1,4 @@ -% COMMAND-LINE: --enable-miplib-trick +% COMMAND-LINE: --miplib-trick % EXPECT: sat tmp1 : INT; diff --git a/test/regress/regress1/arith/miplib3.cvc b/test/regress/regress1/arith/miplib3.cvc index 9e1ae5a62..fa8b28f58 100644 --- a/test/regress/regress1/arith/miplib3.cvc +++ b/test/regress/regress1/arith/miplib3.cvc @@ -1,4 +1,4 @@ -% COMMAND-LINE: --enable-miplib-trick +% COMMAND-LINE: --miplib-trick % EXPECT: sat tmp1, tmp2, tmp3, tmp4 : INT; diff --git a/test/regress/regress2/arith/miplib-opt1217--27.smt2 b/test/regress/regress2/arith/miplib-opt1217--27.smt2 index dc0ca78a8..2adcdd3a9 100644 --- a/test/regress/regress2/arith/miplib-opt1217--27.smt2 +++ b/test/regress/regress2/arith/miplib-opt1217--27.smt2 @@ -1,4 +1,4 @@ -; COMMAND-LINE: --enable-miplib-trick +; COMMAND-LINE: --miplib-trick ; EXPECT: unsat (set-logic QF_LRA) (set-info :source | diff --git a/test/regress/regress2/arith/miplib-pp08a-3000.smt2 b/test/regress/regress2/arith/miplib-pp08a-3000.smt2 index 3e34badc2..edd77a9d1 100644 --- a/test/regress/regress2/arith/miplib-pp08a-3000.smt2 +++ b/test/regress/regress2/arith/miplib-pp08a-3000.smt2 @@ -1,4 +1,4 @@ -; COMMAND-LINE: --enable-miplib-trick +; COMMAND-LINE: --miplib-trick ; EXPECT: unsat (set-logic QF_LRA) (set-info :source | -- 2.30.2