summaryrefslogtreecommitdiff
path: root/src/theory/uf
diff options
context:
space:
mode:
authorTim King <taking@google.com>2015-12-14 18:51:40 -0800
committerTim King <taking@google.com>2015-12-14 18:51:40 -0800
commit90e3b73fbd1b2eb262a7a7e2e72d701c8f9e3600 (patch)
tree77af58f4233d766d31e8e032e16cc0b4833d8de2 /src/theory/uf
parent157a2ed349418611302476dce79fced1d95a4ecc (diff)
Refactoring Options Handler & Library Cycle Breaking
What to Know As a User: A number of files have moved. Users that include files in the public API in more refined ways than using #include <cvc4.h> should consult which files have moved. Note though that some files may move again after being cleaned up. A number of small tweaks have been made to the swig interfaces that may cause issues. Please file bug reports for any problems. The Problem: The build order of CVC4 used to be [roughly] specified as: options < expr < util < libcvc4 < parsers < main Each of these had their own directories and their own Makefile.am files. With the exception of the util/ directory, each of the subdirectories built exactly one convenience library. The util/ directory additionally built a statistics library. While the order above was partially correct, the build order was more complicated as options/Makefile.am executed building the sources for expr/Makefile.am as part of its BUILT_SOURCES phase. This options/Makefile.am also build the options/h and options.cpp files in other directories. There were cyclical library dependencies between the first four above libraries. All of these aspects combined to make options extremely brittle and hard to develop. Maintaining these between clang versus gcc, and bazel versus autotools has become increasing unpredictable. The Solution: To address these cyclic build problems, I am simplifying the build process. Here are the main things that have to happen: 1. util/ will be split into 3 separate directories: base, util, and smt_util. Each will have their own library and Makefile.am file. 2. Dependencies for options/ will be moved into options/. If a type appears as an option, this file will be moved into options. 3. All of the old options_handlers.h files have been refactored. 4. Some files have moved from util into expr/ to resolve cycles. Some of these moves are temporary. 5. I am removing the libstatistics library. The constraints that the CVC4 build system will eventually satisfy are: - The include order for both the .h and .cpp files for a directory must respect the order libraries are built. For example, a file in options/ cannot include from the expr/ directory. This includes built source files such as those coming from */kinds files and */options files. - The types definitions must also respect the build order. Forward type declarations will be allowed in exceptional, justified cases. - The Makefile.am for a directory cannot generate a file outside of the directory it controls. (Or call another Makefile.am except through subdirectory calls.) - One library per Makefile.am. - No extra copies of libraries will be built for the purpose of distinguishing between external and internal visibility in libraries for building parser/ or main/ libraries and binaries. Any function used by parser/ and main/ will be labeled with CVC4_PUBLIC and be in a public API. (AFAICT, libstatistics was being built exactly to skirt this.) The build order of CVC4 can now be [roughly] specified as base < options < util < expr < smt_util < libcvc4 < parsers < main The distinction between "base < options < util < expr" are currently clean. The relationship between expr and the subsequent directories/libraries are not yet clean. More details about the directories: base/ The new directory base/ contains the shared utilities that are absolutely crucial to starting cvc4. The list currently includes just: cvc4_assert.{h,cpp}, output.{h,cpp}, exception.{h,cpp}, and tls.{h, h.in, cpp}. These are things that are required everywhere. options/ The options/ directory is self contained. - It contains all of the enums that appear as options. This includes things like theory/bv/bitblast_mode.h . - There are exactly 4 classes that handled currently using forward declarations currently to this: LogicInfo, LemmaInputChannel, LemmaOutputChannel, and CommandSequence. These will all be removed from options. - Functionality of the options_handlers.h files has been moved into smt/smt_options_handler.h. The options library itself only uses an interface class defined in options/options_handler_interface.h. We are now using virtual dispatch to avoid using inlined functions as was previously done. - The */options_handlers.h files have been removed. - The generated smt/smt_options.cpp file has been be replaced by pushing the functionality that was generated into: options/options_handler_{get,set}_option_template.cpp . The non-generated functionality was moved into smt_engine.cpp. - All of the options files have been moved from their directories into options/. This means includes like theory/arith/options.h have changed to change to options/arith_options.h . util/ The util/ directory continues to contain core utility classes that may be used [almost] everywhere. The exception is that these are not used by options/ or base/. This includes things like rational and integer. These may not use anything in expr/ or libcvc4. A number of files have been moved out of this directory as they have cyclic dependencies graph with exprs and types. The build process up to this directory is currently clean. expr/ The expr/ directory continues to be the home of expressions. The major change is files moving from util/ moving into expr/. The reason for this is that these files form a cycle with files in expr/. - An example is datatype.h. This includes "expr/expr.h", "expr/type.h" while "expr/command.h" includes datatype.h. - Another example is predicate.h. This uses expr.h and is also declared in a kinds file and thus appears in kinds.h. - The rule of thumb is if expr/ pulls it in it needs to be independent of expr/, in which case it is in util/, or it is not, in which case it is pulled into expr/. - Some files do not have a strong justification currently. Result, ResourceManager and SExpr can be moved back into util/ once the iostream manipulation routines are refactored out of the Node and Expr classes. - Note the kinds files are expected to remain in the theory/ directories. These are only read in order to build sources. - This directory is not yet clean. It contains forward references into libcvc4 such as the printer. It also makes some classes used by main/ and parser CVC4_PUBLIC. smt_util/ The smt_util/ directory contains those utility classes which require exprs, but expr/ does not require them. These are mostly utilities for working with expressions and nodes. Examples include ite_removal.h, LemmaInputChannel and LemmaOutputChannel. What is up next: - A number of new #warning "TODO: ..." items have been scattered throughout the code as reminders to myself. Help with these issues is welcomed. - The expr/ directory needs to be cleaned up in a similar to options/. Before this happens statistics needs to be cleaned up.
Diffstat (limited to 'src/theory/uf')
-rw-r--r--src/theory/uf/equality_engine.h15
-rw-r--r--src/theory/uf/options42
-rw-r--r--src/theory/uf/options_handlers.h70
-rw-r--r--src/theory/uf/symmetry_breaker.h6
-rw-r--r--src/theory/uf/theory_uf.cpp9
-rw-r--r--src/theory/uf/theory_uf_model.cpp12
-rw-r--r--src/theory/uf/theory_uf_strong_solver.cpp3
-rw-r--r--src/theory/uf/theory_uf_strong_solver.h10
8 files changed, 28 insertions, 139 deletions
diff --git a/src/theory/uf/equality_engine.h b/src/theory/uf/equality_engine.h
index a26947ed1..f7f7f9ddd 100644
--- a/src/theory/uf/equality_engine.h
+++ b/src/theory/uf/equality_engine.h
@@ -19,20 +19,19 @@
#pragma once
-#include <queue>
#include <deque>
-#include <vector>
#include <ext/hash_map>
+#include <queue>
+#include <vector>
-#include "expr/node.h"
-#include "expr/kind_map.h"
-#include "context/cdo.h"
+#include "base/output.h"
#include "context/cdhashmap.h"
-#include "util/output.h"
-#include "util/statistics_registry.h"
+#include "context/cdo.h"
+#include "expr/kind_map.h"
+#include "expr/node.h"
+#include "expr/statistics_registry.h"
#include "theory/rewriter.h"
#include "theory/theory.h"
-
#include "theory/uf/equality_engine_types.h"
namespace CVC4 {
diff --git a/src/theory/uf/options b/src/theory/uf/options
deleted file mode 100644
index cb6ddc0fa..000000000
--- a/src/theory/uf/options
+++ /dev/null
@@ -1,42 +0,0 @@
-#
-# Option specification file for CVC4
-# See src/options/base_options for a description of this file format
-#
-
-module UF "theory/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 /--disable-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 a cardinality to abort at (-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 "theory/uf/options_handlers.h" :handler CVC4::theory::uf::stringToUfssMode :handler-include "theory/uf/options_handlers.h"
- 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
-
-endmodule
diff --git a/src/theory/uf/options_handlers.h b/src/theory/uf/options_handlers.h
deleted file mode 100644
index 8c072e232..000000000
--- a/src/theory/uf/options_handlers.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/********************* */
-/*! \file options_handlers.h
- ** \verbatim
- ** Original author: Morgan Deters
- ** Major contributors: Andrew Reynolds
- ** Minor contributors (to current version): none
- ** This file is part of the CVC4 project.
- ** Copyright (c) 2009-2014 New York University and The University of Iowa
- ** See the file COPYING in the top-level source directory for licensing
- ** information.\endverbatim
- **
- ** \brief Custom handlers and predicates for TheoryUF options
- **
- ** Custom handlers and predicates for TheoryUF options.
- **/
-
-#include "cvc4_private.h"
-
-#ifndef __CVC4__THEORY__UF__OPTIONS_HANDLERS_H
-#define __CVC4__THEORY__UF__OPTIONS_HANDLERS_H
-
-namespace CVC4 {
-namespace theory {
-namespace uf {
-
-typedef enum {
- /** default, use uf strong solver to find minimal models for uninterpreted sorts */
- UF_SS_FULL,
- /** use uf strong solver to shrink model sizes, but do no enforce minimality */
- UF_SS_NO_MINIMAL,
- /** do not use uf strong solver */
- UF_SS_NONE,
-} UfssMode;
-
-static const std::string ufssModeHelp = "\
-UF strong solver options currently supported by the --uf-ss option:\n\
-\n\
-full \n\
-+ Default, use uf strong solver to find minimal models for uninterpreted sorts.\n\
-\n\
-no-minimal \n\
-+ Use uf strong solver to shrink model sizes, but do no enforce minimality.\n\
-\n\
-none \n\
-+ Do not use uf strong solver to shrink model sizes. \n\
-\n\
-";
-
-inline UfssMode stringToUfssMode(std::string option, std::string optarg, SmtEngine* smt) throw(OptionException) {
- if(optarg == "default" || optarg == "full" ) {
- return UF_SS_FULL;
- } else if(optarg == "no-minimal") {
- return UF_SS_NO_MINIMAL;
- } else if(optarg == "none") {
- return UF_SS_NONE;
- } else if(optarg == "help") {
- puts(ufssModeHelp.c_str());
- exit(1);
- } else {
- throw OptionException(std::string("unknown option for --uf-ss: `") +
- optarg + "'. Try --uf-ss help.");
- }
-}
-
-}/* CVC4::theory::uf namespace */
-}/* CVC4::theory namespace */
-}/* CVC4 namespace */
-
-#endif /* __CVC4__THEORY__UF__OPTIONS_HANDLERS_H */
-
diff --git a/src/theory/uf/symmetry_breaker.h b/src/theory/uf/symmetry_breaker.h
index d07ef64e0..e49b4652a 100644
--- a/src/theory/uf/symmetry_breaker.h
+++ b/src/theory/uf/symmetry_breaker.h
@@ -48,11 +48,11 @@
#include <list>
#include <vector>
+#include "context/cdlist.h"
+#include "context/context.h"
#include "expr/node.h"
#include "expr/node_builder.h"
-#include "context/context.h"
-#include "context/cdlist.h"
-#include "util/statistics_registry.h"
+#include "expr/statistics_registry.h"
namespace CVC4 {
namespace theory {
diff --git a/src/theory/uf/theory_uf.cpp b/src/theory/uf/theory_uf.cpp
index 6679b5dc2..31bee316a 100644
--- a/src/theory/uf/theory_uf.cpp
+++ b/src/theory/uf/theory_uf.cpp
@@ -16,12 +16,13 @@
**/
#include "theory/uf/theory_uf.h"
-#include "theory/uf/options.h"
-#include "smt/options.h"
-#include "theory/quantifiers/options.h"
-#include "theory/uf/theory_uf_strong_solver.h"
+
+#include "options/quantifiers_options.h"
+#include "options/smt_options.h"
+#include "options/uf_options.h"
#include "theory/theory_model.h"
#include "theory/type_enumerator.h"
+#include "theory/uf/theory_uf_strong_solver.h"
using namespace std;
using namespace CVC4;
diff --git a/src/theory/uf/theory_uf_model.cpp b/src/theory/uf/theory_uf_model.cpp
index 64f06ceb7..6d0123a19 100644
--- a/src/theory/uf/theory_uf_model.cpp
+++ b/src/theory/uf/theory_uf_model.cpp
@@ -12,16 +12,18 @@
** \brief Implementation of Theory UF Model
**/
+#include "theory/uf/theory_uf_model.h"
+
+#include <stack>
+#include <vector>
+
#include "expr/attribute.h"
+#include "options/quantifiers_options.h"
+#include "theory/quantifiers/term_database.h"
#include "theory/theory_engine.h"
-#include "theory/uf/theory_uf_model.h"
#include "theory/uf/equality_engine.h"
#include "theory/uf/theory_uf.h"
-#include "theory/quantifiers/term_database.h"
-#include "theory/quantifiers/options.h"
-#include <vector>
-#include <stack>
#define RECONSIDER_FUNC_DEFAULT_VALUE
#define USE_PARTIAL_DEFAULT_VALUES
diff --git a/src/theory/uf/theory_uf_strong_solver.cpp b/src/theory/uf/theory_uf_strong_solver.cpp
index 29e726da7..d617207cf 100644
--- a/src/theory/uf/theory_uf_strong_solver.cpp
+++ b/src/theory/uf/theory_uf_strong_solver.cpp
@@ -13,12 +13,13 @@
**/
#include "theory/uf/theory_uf_strong_solver.h"
+
+#include "options/uf_options.h"
#include "theory/uf/theory_uf.h"
#include "theory/uf/equality_engine.h"
#include "theory/theory_engine.h"
#include "theory/quantifiers_engine.h"
#include "theory/quantifiers/term_database.h"
-#include "theory/uf/options.h"
#include "theory/theory_model.h"
#include "theory/quantifiers/symmetry_breaking.h"
diff --git a/src/theory/uf/theory_uf_strong_solver.h b/src/theory/uf/theory_uf_strong_solver.h
index 3e612ff1f..dd32154d9 100644
--- a/src/theory/uf/theory_uf_strong_solver.h
+++ b/src/theory/uf/theory_uf_strong_solver.h
@@ -17,14 +17,12 @@
#ifndef __CVC4__THEORY_UF_STRONG_SOLVER_H
#define __CVC4__THEORY_UF_STRONG_SOLVER_H
-#include "theory/theory.h"
-
+#include "context/cdchunk_list.h"
+#include "context/cdhashmap.h"
#include "context/context.h"
#include "context/context_mm.h"
-#include "context/cdhashmap.h"
-#include "context/cdchunk_list.h"
-
-#include "util/statistics_registry.h"
+#include "expr/statistics_registry.h"
+#include "theory/theory.h"
namespace CVC4 {
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback