summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaniel Barbosa <hanielbbarbosa@gmail.com>2021-09-20 16:49:22 -0300
committerGitHub <noreply@github.com>2021-09-20 19:49:22 +0000
commitf6563f7d1e25279c6446e74ce358ea63c4b53ab0 (patch)
treed2c40f9ca3639fa587cc4bc7f3dcf510d867ac4b
parent44832e870dcf44c4710411331f9ce21e7f0dc64f (diff)
[proofs] Alethe: adds a node converter
Currently the only transformation it applies is removing attributes from quantifiers. Others may be added later.
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/proof/alethe/alethe_node_converter.cpp38
-rw-r--r--src/proof/alethe/alethe_node_converter.h48
3 files changed, 88 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index d6fbfba37..8053340e8 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -221,6 +221,8 @@ libcvc5_add_sources(
proof/theory_proof_step_buffer.h
proof/unsat_core.cpp
proof/unsat_core.h
+ proof/alethe/alethe_node_converter.cpp
+ proof/alethe/alethe_node_converter.h
prop/bv_sat_solver_notify.h
prop/bvminisat/bvminisat.cpp
prop/bvminisat/bvminisat.h
diff --git a/src/proof/alethe/alethe_node_converter.cpp b/src/proof/alethe/alethe_node_converter.cpp
new file mode 100644
index 000000000..d78c185a4
--- /dev/null
+++ b/src/proof/alethe/alethe_node_converter.cpp
@@ -0,0 +1,38 @@
+/******************************************************************************
+ * Top contributors (to current version):
+ * Haniel Barbosa
+ *
+ * This file is part of the cvc5 project.
+ *
+ * Copyright (c) 2009-2021 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.
+ * ****************************************************************************
+ *
+ * Implementation of Alethe node conversion
+ */
+
+#include "proof/alethe/alethe_node_converter.h"
+
+#include "expr/node_algorithm.h"
+
+namespace cvc5 {
+namespace proof {
+
+AletheNodeConverter::AletheNodeConverter() {}
+
+Node AletheNodeConverter::postConvert(Node n)
+{
+ // whether node is a quantifier with attributes, in which case we remove it
+ if (n.getKind() == kind::FORALL && n.getNumChildren() == 3)
+ {
+ return NodeManager::currentNM()->mkNode(kind::FORALL, n[0], n[1]);
+ }
+ return n;
+}
+
+bool AletheNodeConverter::shouldTraverse(Node n) { return expr::hasClosure(n); }
+
+} // namespace proof
+} // namespace cvc5
diff --git a/src/proof/alethe/alethe_node_converter.h b/src/proof/alethe/alethe_node_converter.h
new file mode 100644
index 000000000..310bc70ff
--- /dev/null
+++ b/src/proof/alethe/alethe_node_converter.h
@@ -0,0 +1,48 @@
+/******************************************************************************
+ * Top contributors (to current version):
+ * Haniel Barbosa
+ *
+ * This file is part of the cvc5 project.
+ *
+ * Copyright (c) 2009-2021 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.
+ * ****************************************************************************
+ *
+ * Alethe node conversion
+ */
+
+#include "cvc5_private.h"
+
+#ifndef CVC4__PROOF__ALETHE__ALETHE_NODE_CONVERTER_H
+#define CVC4__PROOF__ALETHE__ALETHE_NODE_CONVERTER_H
+
+#include <iostream>
+#include <map>
+
+#include "expr/node.h"
+#include "expr/node_converter.h"
+
+namespace cvc5 {
+namespace proof {
+
+/**
+ * This is a helper class for the Alethe post-processor that converts nodes into
+ * form that Alethe expects.
+ */
+class AletheNodeConverter : public NodeConverter
+{
+ public:
+ AletheNodeConverter();
+ ~AletheNodeConverter() {}
+ /** Convert by removing attributes of quantifiers. */
+ Node postConvert(Node n) override;
+ /** Should only traverse nodes containing closures. */
+ bool shouldTraverse(Node n) override;
+};
+
+} // namespace proof
+} // namespace cvc5
+
+#endif
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback