summaryrefslogtreecommitdiff
path: root/src/proof/dimacs.h
blob: 405b33208664c38f57c8a26ba7c2f6c3656740f3 (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
/*********************                                                        */
/*! \file dimacs.h
 ** \verbatim
 ** Top contributors (to current version):
 **   Alex Ozdemir
 ** This file is part of the CVC4 project.
 ** Copyright (c) 2009-2020 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 DIMACS SAT Problem Format
 **
 ** Defines serialization/deserialization for SAT problems as DIMACS
 **/

#include "cvc4_private.h"

#ifndef CVC4__PROOF__DIMACS_H
#define CVC4__PROOF__DIMACS_H

#include <iosfwd>
#include <memory>
#include <unordered_map>

#include "proof/clause_id.h"
#include "prop/sat_solver_types.h"

namespace CVC4 {
namespace proof {

/**
 * Prints the literal as a (+) or (-) int
 * Not operator<< b/c that represents negation as ~
 *
 * @param o where to print
 * @param l the literal to print
 *
 * @return the original stream
 */
std::ostream& textOut(std::ostream& o, const prop::SatLiteral& l);

/**
 * Prints the clause as a space-separated list of ints
 * Not operator<< b/c that represents literal negation as ~
 *
 * @param o where to print
 * @param c the clause to print
 *
 * @return the original stream
 */
std::ostream& textOut(std::ostream& o, const prop::SatClause& c);

/**
 * Prints a CNF formula in DIMACS format
 *
 * @param o where to print to
 * @param usedClauses the CNF formula
 */
void printDimacs(std::ostream& o,
                 const std::unordered_map<ClauseId, prop::SatClause>& clauses,
                 const std::vector<ClauseId>& usedIndices);

std::vector<prop::SatClause> parseDimacs(std::istream& i);

}  // namespace proof
}  // namespace CVC4

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