GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/printer/tptp/tptp_printer.cpp Lines: 7 30 23.3 %
Date: 2021-03-23 Branches: 2 64 3.1 %

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