ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
veripbtracer.hpp
Go to the documentation of this file.
1#ifndef _veripbtracer_h_INCLUDED
2#define _veripbtracer_h_INCLUDED
3
4#include "global.h"
5
7
8class FileTracer;
9
10namespace CaDiCaL {
11
12struct HashId {
13 HashId *next; // collision chain link for hash table
14 uint64_t hash; // previously computed full 64-bit hash
15 int64_t id; // id of clause
16};
17
18class VeripbTracer : public FileTracer {
19
20 Internal *internal;
21 File *file;
22#ifndef CADICAL_NDEBUG
23 bool binary;
24#endif
25 bool with_antecedents;
26 bool checked_deletions;
27
28 // hash table for checked deletions
29 //
30 uint64_t num_clauses; // number of clauses in hash table
31 uint64_t size_clauses; // size of clause hash table
32 HashId **clauses; // hash table of clauses
33
34 static const unsigned num_nonces = 4;
35
36 uint64_t nonces[num_nonces]; // random numbers for hashing
37 uint64_t last_hash; // last computed hash value of clause
38 int64_t last_id; // id of the last added clause
39 HashId *last_clause;
40 uint64_t compute_hash (int64_t); // compute and save hash value of clause
41
42 HashId *new_clause ();
43 void delete_clause (HashId *);
44
45 // Reduce hash value to the actual size.
46 //
47 static uint64_t reduce_hash (uint64_t hash, uint64_t size);
48
49 void enlarge_clauses (); // enlarge hash table for clauses
50 void insert (); // insert clause in hash table
51 bool
52 find_and_delete (const int64_t); // find clause position in hash table
53
54#ifndef CADICAL_QUIET
55 int64_t added, deleted;
56#endif
57 vector<int64_t> delete_ids;
58
59 void put_binary_zero ();
60 void put_binary_lit (int external_lit);
61 void put_binary_id (int64_t id, bool = false);
62
63 // support veriPB
64 void veripb_add_derived_clause (int64_t, bool redundant,
65 const vector<int> &clause,
66 const vector<int64_t> &chain);
67 void veripb_add_derived_clause (int64_t, bool redundant,
68 const vector<int> &clause);
69 void veripb_begin_proof (int64_t reserved_ids);
70 void veripb_delete_clause (int64_t id, bool redundant);
71 void veripb_report_status (bool unsat, int64_t conflict_id);
72 void veripb_strengthen (int64_t);
73
74public:
75 // own and delete 'file'
76 VeripbTracer (Internal *, File *file, bool, bool, bool);
78
79 void connect_internal (Internal *i) override;
80 void begin_proof (int64_t) override;
81
82 void add_original_clause (int64_t, bool, const vector<int> &,
83 bool = false) override {} // skip
84
85 void add_derived_clause (int64_t, bool, const vector<int> &,
86 const vector<int64_t> &) override;
87
88 void delete_clause (int64_t, bool, const vector<int> &) override;
89 void finalize_clause (int64_t, const vector<int> &) override {} // skip
90
91 void report_status (int, int64_t) override;
92
93 void weaken_minus (int64_t, const vector<int> &) override;
94 void strengthen (int64_t) override;
95
96#ifndef CADICAL_QUIET
97 void print_statistics ();
98#endif
99 bool closed () override;
100 void close (bool) override;
101 void flush (bool) override;
102};
103
104} // namespace CaDiCaL
105
107
108#endif
#define ABC_NAMESPACE_CXX_HEADER_START
#define ABC_NAMESPACE_CXX_HEADER_END
void finalize_clause(int64_t, const vector< int > &) override
void connect_internal(Internal *i) override
void begin_proof(int64_t) override
VeripbTracer(Internal *, File *file, bool, bool, bool)
void add_derived_clause(int64_t, bool, const vector< int > &, const vector< int64_t > &) override
void report_status(int, int64_t) override
void weaken_minus(int64_t, const vector< int > &) override
void add_original_clause(int64_t, bool, const vector< int > &, bool=false) override
void strengthen(int64_t) override