summaryrefslogtreecommitdiff
path: root/src/theory/builtin
diff options
context:
space:
mode:
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>2020-03-03 09:18:59 -0600
committerGitHub <noreply@github.com>2020-03-03 09:18:59 -0600
commit0cd812af4a6db43a7d6c2c95fff7e58f86e90a78 (patch)
treeab35d8c8dd7ee7c7c8ba085d42ef834fe17e2dbd /src/theory/builtin
parent1d44edf91762b837adf3db5ed40af9383e883b28 (diff)
Standardize the interface for SMT engine subsolvers (#3836)
This standardizes the interface for using SMT engines as subsolvers in various approaches. More refactoring is possible, but this is an initial cut at cleaning things up. This will make it easy to accommodate new feature request for SyGuS (timeouts for calls to verification steps). Notice this also required adding a missing function (mkGroundTerm/isWellFounded for functions) which was caught after standardizing due to an optimization (don't create SmtEngines to check satisfiability of constant Booleans).
Diffstat (limited to 'src/theory/builtin')
-rw-r--r--src/theory/builtin/kinds5
-rw-r--r--src/theory/builtin/theory_builtin_type_rules.h25
2 files changed, 29 insertions, 1 deletions
diff --git a/src/theory/builtin/kinds b/src/theory/builtin/kinds
index c90419def..4d5e95119 100644
--- a/src/theory/builtin/kinds
+++ b/src/theory/builtin/kinds
@@ -309,7 +309,10 @@ operator FUNCTION_TYPE 2: "a function type"
cardinality FUNCTION_TYPE \
"::CVC4::theory::builtin::FunctionProperties::computeCardinality(%TYPE%)" \
"theory/builtin/theory_builtin_type_rules.h"
-well-founded FUNCTION_TYPE false
+well-founded FUNCTION_TYPE \
+ "::CVC4::theory::builtin::FunctionProperties::isWellFounded(%TYPE%)" \
+ "::CVC4::theory::builtin::FunctionProperties::mkGroundTerm(%TYPE%)" \
+ "theory/builtin/theory_builtin_type_rules.h"
enumerator FUNCTION_TYPE \
::CVC4::theory::builtin::FunctionEnumerator \
"theory/builtin/type_enumerator.h"
diff --git a/src/theory/builtin/theory_builtin_type_rules.h b/src/theory/builtin/theory_builtin_type_rules.h
index d49edbc8c..a3d1776e1 100644
--- a/src/theory/builtin/theory_builtin_type_rules.h
+++ b/src/theory/builtin/theory_builtin_type_rules.h
@@ -223,6 +223,31 @@ class FunctionProperties {
return valueCard ^ argsCard;
}
+ /** Function type is well-founded if its component sorts are */
+ static bool isWellFounded(TypeNode type)
+ {
+ for (TypeNode::iterator i = type.begin(), i_end = type.end(); i != i_end;
+ ++i)
+ {
+ if (!(*i).isWellFounded())
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+ /**
+ * Ground term for function sorts is (lambda x. t) where x is the
+ * canonical variable list for its type and t is the canonical ground term of
+ * its range.
+ */
+ static Node mkGroundTerm(TypeNode type)
+ {
+ NodeManager* nm = NodeManager::currentNM();
+ Node bvl = nm->getBoundVarListForFunctionType(type);
+ Node ret = type.getRangeType().mkGroundTerm();
+ return nm->mkNode(kind::LAMBDA, bvl, ret);
+ }
};/* class FuctionProperties */
class SExprProperties {
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback