summaryrefslogtreecommitdiff
path: root/src/proof/lfsc_proof_printer.h
blob: bf4bfabadac3a530fe10996924f41cacacd1a7dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*********************                                                        */
/*! \file lfsc_proof_printer.h
 ** \verbatim
 ** Top contributors (to current version):
 **   Andres Noetzli
 ** This file is part of the CVC4 project.
 ** Copyright (c) 2009-2018 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.\endverbatim
 **
 ** \brief Prints proofs in the LFSC format
 **
 ** Prints proofs in the LFSC format.
 **/

#include "cvc4_private.h"

#ifndef __CVC4__PROOF__LFSC_PROOF_PRINTER_H
#define __CVC4__PROOF__LFSC_PROOF_PRINTER_H

#include <iosfwd>
#include <string>
#include <vector>

#include "proof/clause_id.h"
#include "proof/proof_manager.h"
#include "proof/sat_proof.h"
#include "proof/sat_proof_implementation.h"
#include "util/proof.h"

namespace CVC4 {
namespace proof {

class LFSCProofPrinter
{
 public:
  /**
   * Prints the resolution proof for an assumption conflict.
   *
   * @param satProof The record of the reasoning done by the SAT solver
   * @param id The clause to print a proof for
   * @param out The stream to print to
   * @param paren A stream for the closing parentheses
   */
  template <class Solver>
  static void printAssumptionsResolution(TSatProof<Solver>* satProof,
                                         ClauseId id,
                                         std::ostream& out,
                                         std::ostream& paren);

  /**
   * Prints the resolution proofs for learned clauses that have been used to
   * deduce unsat.
   *
   * @param satProof The record of the reasoning done by the SAT solver
   * @param out The stream to print to
   * @param paren A stream for the closing parentheses
   */
  template <class Solver>
  static void printResolutions(TSatProof<Solver>* satProof,
                               std::ostream& out,
                               std::ostream& paren);

  /**
   * Prints the resolution proof for the empty clause.
   *
   * @param satProof The record of the reasoning done by the SAT solver
   * @param out The stream to print to
   * @param paren A stream for the closing parentheses
   */
  template <class Solver>
  static void printResolutionEmptyClause(TSatProof<Solver>* satProof,
                                         std::ostream& out,
                                         std::ostream& paren);

 private:
  /**
   * Maps a clause id to a string identifier used in the LFSC proof.
   *
   * @param satProof The record of the reasoning done by the SAT solver
   * @param id The clause to map to a string
   */
  template <class Solver>
  static std::string clauseName(TSatProof<Solver>* satProof, ClauseId id);

  /**
   * Prints the resolution proof for a given clause.
   *
   * @param satProof The record of the reasoning done by the SAT solver
   * @param id The clause to print a proof for
   * @param out The stream to print to
   * @param paren A stream for the closing parentheses
   */
  template <class Solver>
  static void printResolution(TSatProof<Solver>* satProof,
                              ClauseId id,
                              std::ostream& out,
                              std::ostream& paren);
};

}  // namespace proof
}  // namespace CVC4

#endif /* __CVC4__PROOF__LFSC_PROOF_PRINTER_H */
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback