From: Lachnitt Date: Tue, 30 Nov 2021 16:54:31 +0000 (-0800) Subject: [proofs] Alethe: Implementation of Printer (#7674) X-Git-Tag: cvc5-1.0.0~759 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3510c76b9bbfa8997da7cd934071adb863b7153f;p=cvc5.git [proofs] Alethe: Implementation of Printer (#7674) Adds an implementation file of the Alethe printer with function stubs to be filled in in further PRs. Co-authored-by: Haniel Barbosa --- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 224af6a09..025f499e6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -224,6 +224,7 @@ libcvc5_add_sources( proof/alethe/alethe_post_processor.cpp proof/alethe/alethe_post_processor.h proof/alethe/alethe_printer.h + proof/alethe/alethe_printer.cpp proof/alethe/alethe_proof_rule.cpp proof/alethe/alethe_proof_rule.h prop/cadical.cpp diff --git a/src/proof/alethe/alethe_printer.cpp b/src/proof/alethe/alethe_printer.cpp new file mode 100644 index 000000000..49b2716f3 --- /dev/null +++ b/src/proof/alethe/alethe_printer.cpp @@ -0,0 +1,62 @@ +/****************************************************************************** + * Top contributors (to current version): + * Hanna Lachnitt + * + * 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. + * **************************************************************************** + * + * The module for printing Alethe proof nodes. + */ + +#include "proof/alethe/alethe_printer.h" + +#include +#include + +#include "proof/alethe/alethe_proof_rule.h" + +namespace cvc5 { + +namespace proof { + +AletheProofPrinter::AletheProofPrinter() {} + +void AletheProofPrinter::print(std::ostream& out, + std::shared_ptr pfn) +{ + Trace("alethe-printer") << "- Print proof in Alethe format. " << std::endl; + std::unordered_map assumptions; + const std::vector& args = pfn->getArguments(); + // Special handling for the first scope + // Print assumptions and add them to the list but do not print anchor. + for (size_t i = 3, size = args.size(); i < size; i++) + { + Trace("alethe-printer") << "... print assumption " << args[i] << std::endl; + out << "(assume a" << i - 3 << " " << args[i] << ")\n"; + assumptions[args[i]] = "a" + std::to_string(i - 3); + } + + // Then, print the rest of the proof node + uint32_t start_t = 1; + printInternal(out, pfn->getChildren()[0], assumptions, {}, "", start_t); +} + +std::string AletheProofPrinter::printInternal( + std::ostream& out, + std::shared_ptr pfn, + const std::unordered_map& assumptions, + const std::unordered_map& steps, + std::string current_prefix, + uint32_t& current_step_id) +{ + return ""; +} + +} // namespace proof + +} // namespace cvc5