GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/printer/tptp/tptp_printer.cpp Lines: 7 30 23.3 %
Date: 2021-11-07 Branches: 2 62 3.2 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Andrew Reynolds, Morgan Deters, Tim King
4
 *
5
 * This file is part of the cvc5 project.
6
 *
7
 * Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
8
 * in the top-level source directory and their institutional affiliations.
9
 * All rights reserved.  See the file COPYING in the top-level source
10
 * directory for licensing information.
11
 * ****************************************************************************
12
 *
13
 * The pretty-printer interface for the TPTP output language.
14
 */
15
#include "printer/tptp/tptp_printer.h"
16
17
#include <iostream>
18
#include <string>
19
#include <typeinfo>
20
#include <vector>
21
22
#include "expr/node_manager.h"    // for VarNameAttr
23
#include "options/language.h"     // for LANG_AST
24
#include "options/smt_options.h"  // for unsat cores
25
#include "proof/unsat_core.h"
26
#include "smt/command.h"
27
#include "smt/solver_engine.h"
28
29
using namespace std;
30
31
namespace cvc5 {
32
namespace printer {
33
namespace tptp {
34
35
3695
void TptpPrinter::toStream(std::ostream& out,
36
                           TNode n,
37
                           int toDepth,
38
                           size_t dag) const
39
{
40
3695
  n.toStream(out, toDepth, dag, Language::LANG_SMTLIB_V2_6);
41
3695
}/* TptpPrinter::toStream() */
42
43
1977
void TptpPrinter::toStream(std::ostream& out, const CommandStatus* s) const
44
{
45
1977
  s->toStream(out, Language::LANG_SMTLIB_V2_6);
46
1977
}/* TptpPrinter::toStream() */
47
48
void TptpPrinter::toStream(std::ostream& out, const smt::Model& m) const
49
{
50
  std::string statusName(m.isKnownSat() ? "FiniteModel"
51
                                        : "CandidateFiniteModel");
52
  out << "% SZS output start " << statusName << " for " << m.getInputName()
53
      << endl;
54
  this->Printer::toStreamUsing(Language::LANG_SMTLIB_V2_6, out, m);
55
  out << "% SZS output end " << statusName << " for " << m.getInputName()
56
      << endl;
57
}
58
59
void TptpPrinter::toStreamModelSort(std::ostream& out,
60
                                    TypeNode tn,
61
                                    const std::vector<Node>& elements) const
62
{
63
  // shouldn't be called; only the non-Command* version above should be
64
  Unreachable();
65
}
66
67
void TptpPrinter::toStreamModelTerm(std::ostream& out,
68
                                    const Node& n,
69
                                    const Node& value) const
70
{
71
  // shouldn't be called; only the non-Command* version above should be
72
  Unreachable();
73
}
74
75
void TptpPrinter::toStream(std::ostream& out, const UnsatCore& core) const
76
{
77
  out << "% SZS output start UnsatCore " << std::endl;
78
  if (core.useNames())
79
  {
80
    // use the names
81
    const std::vector<std::string>& cnames = core.getCoreNames();
82
    for (const std::string& cn : cnames)
83
    {
84
      out << cn << std::endl;
85
    }
86
  }
87
  else
88
  {
89
    // otherwise, use the formulas
90
    for (UnsatCore::const_iterator i = core.begin(); i != core.end(); ++i)
91
    {
92
      out << *i << endl;
93
    }
94
  }
95
  out << "% SZS output end UnsatCore " << std::endl;
96
}
97
98
}  // namespace tptp
99
}  // namespace printer
100
31137
}  // namespace cvc5