1 /********************* */
2 /*! \file lfsc_proof_printer.h
4 ** Top contributors (to current version):
5 ** Andres Noetzli, Alex Ozdemir, Mathias Preiner
6 ** This file is part of the CVC4 project.
7 ** Copyright (c) 2009-2020 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
12 ** \brief Prints proofs in the LFSC format
14 ** Prints proofs in the LFSC format.
17 #include "cvc4_private.h"
19 #ifndef CVC4__PROOF__LFSC_PROOF_PRINTER_H
20 #define CVC4__PROOF__LFSC_PROOF_PRINTER_H
26 #include "proof/clause_id.h"
27 #include "proof/proof_manager.h"
28 #include "proof/sat_proof.h"
29 #include "proof/sat_proof_implementation.h"
30 #include "util/proof.h"
35 class LFSCProofPrinter
39 * Prints the resolution proof for an assumption conflict.
41 * @param satProof The record of the reasoning done by the SAT solver
42 * @param id The clause to print a proof for
43 * @param out The stream to print to
44 * @param paren A stream for the closing parentheses
46 template <class Solver
>
47 static void printAssumptionsResolution(TSatProof
<Solver
>* satProof
,
53 * Prints the resolution proofs for learned clauses that have been used to
56 * @param satProof The record of the reasoning done by the SAT solver
57 * @param out The stream to print to
58 * @param paren A stream for the closing parentheses
60 template <class Solver
>
61 static void printResolutions(TSatProof
<Solver
>* satProof
,
66 * Prints the resolution proof for the empty clause.
68 * @param satProof The record of the reasoning done by the SAT solver
69 * @param out The stream to print to
70 * @param paren A stream for the closing parentheses
72 template <class Solver
>
73 static void printResolutionEmptyClause(TSatProof
<Solver
>* satProof
,
78 * The SAT solver is given a list of clauses.
79 * Assuming that each clause has alreay been individually proven,
80 * defines a proof of the input to the SAT solver.
82 * Prints an LFSC value corresponding to the proof, i.e. a value of type
85 * @param clauses The clauses to print a proof of
86 * @param out The stream to print to
87 * @param namingPrefix The prefix for LFSC names
89 static void printSatInputProof(const std::vector
<ClauseId
>& clauses
,
91 const std::string
& namingPrefix
);
94 * The LRAT proof signature uses the concept of a _clause map_ (CMap), which
95 * represents an indexed collection of (conjoined) clauses.
97 * Specifically, the signatures rely on a proof that a CMap containing the
98 * clauses given to the SAT solver hold.
100 * Assuming that the individual clauses already have proofs, this function
101 * prints a proof of the CMap mapping 1 to the first clause, 2 to the second,
104 * That is, it prints a value of type (CMap_holds ...)
106 * @param clauses The clauses to print a proof of
107 * @param out The stream to print to
108 * @param namingPrefix The prefix for LFSC names
110 static void printCMapProof(const std::vector
<ClauseId
>& clauses
,
112 const std::string
& namingPrefix
);
117 * @param clause The clause to print
118 * @param out The stream to print to
119 * @param namingPrefix The prefix for LFSC names
121 static void printSatClause(const prop::SatClause
& clause
,
123 const std::string
& namingPrefix
);
128 * Maps a clause id to a string identifier used in the LFSC proof.
130 * @param satProof The record of the reasoning done by the SAT solver
131 * @param id The clause to map to a string
133 template <class Solver
>
134 static std::string
clauseName(TSatProof
<Solver
>* satProof
, ClauseId id
);
137 * Prints the resolution proof for a given clause.
139 * @param satProof The record of the reasoning done by the SAT solver
140 * @param id The clause to print a proof for
141 * @param out The stream to print to
142 * @param paren A stream for the closing parentheses
144 template <class Solver
>
145 static void printResolution(TSatProof
<Solver
>* satProof
,
148 std::ostream
& paren
);
154 #endif /* CVC4__PROOF__LFSC_PROOF_PRINTER_H */