ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
CaDiCaL Namespace Reference

Classes

struct  analyze_bumped_rank
 
struct  analyze_bumped_smaller
 
struct  analyze_trail_larger
 
struct  analyze_trail_negative_rank
 
class  Arena
 
struct  Averages
 
struct  Bin
 
struct  block_more_occs_size
 
class  Blocker
 
class  Checker
 
struct  CheckerClause
 
struct  CheckerWatch
 
struct  Clause
 
struct  clause_covered_or_smaller
 
struct  clause_lit_less_than
 
struct  clause_smaller_size
 
struct  ClauseCopier
 
class  ClauseCounter
 
class  ClauseIterator
 
struct  ClauseSize
 
class  ClauseWriter
 
struct  Closure
 
struct  compact_binary_order
 
struct  compact_binary_rank
 
struct  CompactBinary
 
struct  Config
 
struct  congruence_occurrences_larger
 
struct  congruence_occurrences_rank
 
struct  Coveror
 
struct  CubesWithStatus
 
struct  DeferDeleteArray
 
struct  DeferDeletePtr
 
struct  definition_extractor
 
struct  Delay
 
struct  DFS
 
class  DratTracer
 
struct  elim_more
 
struct  Eliminator
 
struct  EMA
 
struct  External
 
class  ExternalPropagator
 
struct  factor_occs_size
 
struct  Factoring
 
class  File
 
class  FileTracer
 
class  FixedAssignmentListener
 
struct  Flags
 
class  Format
 
class  FratTracer
 
struct  Gate
 
struct  GateEqualTo
 
class  Handler
 
struct  Hash
 
struct  HashId
 
class  heap
 
struct  IdrupClause
 
class  IdrupTracer
 
struct  Inc
 
class  Instantiator
 
struct  Internal
 
struct  InternalTracer
 
struct  Last
 
class  Learner
 
struct  less_conditioned
 
struct  Level
 
struct  LidrupClause
 
class  LidrupTracer
 
struct  Limit
 
struct  Link
 
struct  lit_equivalence
 
struct  lit_implication
 
struct  lit_smaller
 
struct  LitClausePair
 
struct  literal_occ
 
struct  LitIdPair
 
struct  litpair_rank
 
struct  litpair_smaller
 
class  LratChecker
 
struct  LratCheckerClause
 
class  LratTracer
 
struct  Mapper
 
struct  minimize_trail_level_positive_rank
 
struct  minimize_trail_level_smaller
 
struct  minimize_trail_positive_rank
 
struct  minimize_trail_smaller
 
struct  NameVal
 
struct  Option
 
class  Options
 
class  Parser
 
struct  Phases
 
struct  pointer_rank
 
struct  probe_negated_noccs_rank
 
class  Proof
 
struct  proof_clause
 
struct  Queue
 
struct  Quotient
 
class  Random
 
class  Range
 
struct  rank_sweep_candidate
 
struct  reduce_less_useful
 
class  Reluctant
 
struct  Rewrite
 
class  Sange
 
struct  score_smaller
 
struct  shrink_trail_larger
 
struct  shrink_trail_negative_rank
 
class  Signal
 
struct  smaller_clause_size_rank
 
struct  smaller_pair_first_rank
 
class  Solver
 
struct  sort_assumptions_positive_rank
 
struct  sort_assumptions_smaller
 
struct  sort_literals_by_var_rank
 
struct  sort_literals_by_var_rank_except
 
struct  sort_literals_by_var_smaller
 
struct  sort_literals_by_var_smaller_except
 
struct  Stats
 
class  StatTracer
 
struct  subsume_less_noccs
 
struct  sweep_binary
 
struct  sweep_blocked_clause
 
struct  sweep_candidate
 
struct  sweep_proof_clause
 
struct  Sweeper
 
class  Terminal
 
class  Terminator
 
class  Testing
 
class  Tracer
 
struct  Var
 
class  VeripbTracer
 
struct  Vivifier
 
struct  vivify_better_watch
 
struct  vivify_clause_later
 
struct  vivify_flush_smaller
 
struct  vivify_inversesize_rank
 
struct  vivify_inversesize_smaller
 
struct  vivify_more_noccs
 
struct  vivify_more_noccs_kissat
 
struct  vivify_ref
 
struct  vivify_refcount_rank
 
struct  vivify_refcount_smaller
 
struct  Walker
 
struct  Watch
 
struct  WitnessCopier
 
class  WitnessIterator
 
struct  WitnessWriter
 
struct  Wrapper
 

Typedefs

typedef vector< BinBins
 
typedef heap< block_more_occs_sizeBlockSchedule
 
typedef vector< CheckerWatchCheckerWatcher
 
typedef int * literal_iterator
 
typedef const int * const_literal_iterator
 
typedef int64_t LRAT_ID
 
typedef std::vector< lit_implicationlit_implications
 
typedef std::vector< lit_equivalencelit_equivalences
 
typedef vector< Gate * > GOccs
 
typedef heap< elim_moreElimSchedule
 
typedef heap< factor_occs_sizeFactorSchedule
 
typedef vector< Clause * > Occs
 
typedef Occs::iterator occs_iterator
 
typedef Occs::const_iterator const_occs_iterator
 
typedef std::vector< LinkLinks
 
typedef heap< score_smallerScoreSchedule
 
typedef vector< WatchWatches
 
typedef Watches::iterator watch_iterator
 
typedef Watches::const_iterator const_watch_iterator
 

Enumerations

enum  Status { SATISFIABLE = 10 , UNSATISFIABLE = 20 , UNKNOWN = 0 }
 
enum  State {
  INITIALIZING = 1 , CONFIGURING = 2 , STEADY = 4 , ADDING = 8 ,
  SOLVING = 16 , SATISFIED = 32 , UNSATISFIED = 64 , DELETING = 128 ,
  INCONCLUSIVE = 256 , READY = CONFIGURING | STEADY | SATISFIED | UNSATISFIED | INCONCLUSIVE , VALID = READY | ADDING , INVALID = INITIALIZING | DELETING
}
 
enum class  Gate_Type { And_Gate , XOr_Gate , ITE_Gate }
 
enum  Special_ITE_GATE {
  NORMAL = 0 , NO_PLUS_THEN = (1 << 0) , NO_NEG_THEN = (1 << 1) , NO_THEN = NO_PLUS_THEN + NO_NEG_THEN ,
  NO_PLUS_ELSE = (1 << 2) , NO_NEG_ELSE = (1 << 3) , NO_ELSE = NO_PLUS_ELSE + NO_NEG_ELSE , COND_LHS = NO_NEG_THEN + NO_PLUS_ELSE ,
  UCOND_LHS = NO_PLUS_THEN + NO_NEG_ELSE
}
 
enum  GateType {
  NO = 0 , EQUI = 1 , AND = 2 , ITE = 3 ,
  XOR = 4 , DEF = 5
}
 
enum  ConclusionType { CONFLICT = 1 , ASSUMPTIONS = 2 , CONSTRAINT = 4 }
 
enum class  Vivify_Mode { TIER1 , TIER2 , TIER3 , IRREDUNDANT }
 

Functions

void shrink_bins (Bins &bs)
 
void erase_bins (Bins &bs)
 
void update_ite_flags (Gate *g)
 
void check_correct_ite_flags (const Gate *const g)
 
bool gate_contains (Gate *g, int lit)
 
bool parity_lits (const vector< int > &lits)
 
void inc_lits (vector< int > &lits)
 
std::string string_of_gate (Gate_Type t)
 
void check_ite_lits_normalized (const std::vector< int > &lits)
 
bool less_litpair (lit_equivalence p, lit_equivalence q)
 
bool non_tautological_cube (std::vector< int > cube)
 
void fatal_message_start ()
 
void fatal_message_end ()
 
void fatal (const char *fmt,...)
 
double absolute_real_time ()
 
double absolute_process_time ()
 
uint64_t maximum_resident_set_size ()
 
uint64_t current_resident_set_size ()
 
bool parse_int_str (const char *val_str, int &val)
 
bool has_suffix (const char *str, const char *suffix)
 
bool has_prefix (const char *str, const char *prefix)
 
bool is_color_option (const char *arg)
 
bool is_no_color_option (const char *arg)
 
uint64_t hash_string (const char *str)
 
const char * version ()
 
const char * copyright ()
 
const char * authors ()
 
const char * affiliations ()
 
const char * signature ()
 
const char * identifier ()
 
const char * compiler ()
 
const char * date ()
 
const char * flags ()
 
vivify_ref create_ref (Internal *internal, Clause *c)
 
std::vector< vivify_ref > & current_refs_schedule (Vivifier &vivifier)
 
std::vector< Clause * > & current_schedule (Vivifier &vivifier)
 
void set_vivifier_mode (Vivifier &vivifier, Vivify_Mode tier)
 
bool ite_flags_no_then_clauses (int8_t flag)
 
bool ite_flags_no_else_clauses (int8_t flag)
 
bool ite_flags_neg_cond_lhs (int8_t flag)
 
bool ite_flags_cond_lhs (int8_t flag)
 
void shrink_occs (Occs &os)
 
void erase_occs (Occs &os)
 
void remove_occs (Occs &os, Clause *c)
 
template<class I, class Rank>
void rsort (I first, I last, Rank rank)
 
double relative (double a, double b)
 
double percent (double a, double b)
 
int sign (int lit)
 
unsigned bign (int lit)
 
bool is_power_of_two (unsigned n)
 
bool contained (int64_t c, int64_t l, int64_t u)
 
bool aligned (size_t n, size_t alignment)
 
size_t align (size_t n, size_t alignment)
 
bool parity (unsigned a)
 
template<class T>
void erase_vector (std::vector< T > &v)
 
template<class T>
void shrink_vector (std::vector< T > &v)
 
template<class T>
void clear_n (T *base, size_t n)
 
void remove_watch (Watches &ws, Clause *clause)
 
void update_watch_size (Watches &ws, int blit, Clause *conflict)
 

Variables

Terminal tout (stdout)
 
Terminal terr (stderr)
 
const unsigned invalid_heap_position = UINT_MAX
 

Typedef Documentation

◆ Bins

Definition at line 19 of file bins.hpp.

◆ BlockSchedule

Definition at line 20 of file block.hpp.

◆ CheckerWatcher

Definition at line 50 of file checker.hpp.

◆ const_literal_iterator

Definition at line 18 of file clause.hpp.

◆ const_occs_iterator

typedef Occs::const_iterator CaDiCaL::const_occs_iterator

Definition at line 36 of file occs.hpp.

◆ const_watch_iterator

typedef Watches::const_iterator CaDiCaL::const_watch_iterator

Definition at line 48 of file watch.hpp.

◆ ElimSchedule

Definition at line 20 of file elim.hpp.

◆ FactorSchedule

Definition at line 33 of file factor.hpp.

◆ GOccs

Definition at line 264 of file congruence.hpp.

◆ Links

typedef std::vector<Link> CaDiCaL::Links

Definition at line 21 of file queue.hpp.

◆ lit_equivalences

Definition at line 131 of file congruence.hpp.

◆ lit_implications

Definition at line 130 of file congruence.hpp.

◆ literal_iterator

Definition at line 17 of file clause.hpp.

◆ LRAT_ID

typedef int64_t CaDiCaL::LRAT_ID

Definition at line 26 of file congruence.hpp.

◆ Occs

Definition at line 18 of file occs.hpp.

◆ occs_iterator

typedef Occs::iterator CaDiCaL::occs_iterator

Definition at line 35 of file occs.hpp.

◆ ScoreSchedule

Definition at line 16 of file score.hpp.

◆ watch_iterator

typedef Watches::iterator CaDiCaL::watch_iterator

Definition at line 47 of file watch.hpp.

◆ Watches

Definition at line 45 of file watch.hpp.

Enumeration Type Documentation

◆ ConclusionType

Enumerator
CONFLICT 
ASSUMPTIONS 
CONSTRAINT 

Definition at line 15 of file tracer.hpp.

15{ CONFLICT = 1, ASSUMPTIONS = 2, CONSTRAINT = 4 };
@ CONFLICT
Definition tracer.hpp:15
@ ASSUMPTIONS
Definition tracer.hpp:15
@ CONSTRAINT
Definition tracer.hpp:15

◆ Gate_Type

enum class CaDiCaL::Gate_Type
strong
Enumerator
And_Gate 
XOr_Gate 
ITE_Gate 

Definition at line 76 of file congruence.hpp.

◆ GateType

Enumerator
NO 
EQUI 
AND 
ITE 
XOR 
DEF 

Definition at line 31 of file elim.hpp.

31{ NO = 0, EQUI = 1, AND = 2, ITE = 3, XOR = 4, DEF = 5 };
@ DEF
Definition elim.hpp:31
@ NO
Definition elim.hpp:31
@ EQUI
Definition elim.hpp:31
@ ITE
Definition elim.hpp:31
@ AND
Definition elim.hpp:31
@ XOR
Definition elim.hpp:31

◆ Special_ITE_GATE

Enumerator
NORMAL 
NO_PLUS_THEN 
NO_NEG_THEN 
NO_THEN 
NO_PLUS_ELSE 
NO_NEG_ELSE 
NO_ELSE 
COND_LHS 
UCOND_LHS 

Definition at line 176 of file congruence.hpp.

176 {
177 NORMAL = 0,
178 NO_PLUS_THEN = (1 << 0),
179 NO_NEG_THEN = (1 << 1),
181 NO_PLUS_ELSE = (1 << 2),
182 NO_NEG_ELSE = (1 << 3),
186};

◆ State

Enumerator
INITIALIZING 
CONFIGURING 
STEADY 
ADDING 
SOLVING 
SATISFIED 
UNSATISFIED 
DELETING 
INCONCLUSIVE 
READY 
VALID 
INVALID 

Definition at line 186 of file cadical.hpp.

186 {
187 INITIALIZING = 1, // during initialization (invalid)
188 CONFIGURING = 2, // configure options (with 'set')
189 STEADY = 4, // ready to call 'solve'
190 ADDING = 8, // adding clause literals (zero missing)
191 SOLVING = 16, // while solving (within 'solve')
192 SATISFIED = 32, // satisfiable allows 'val'
193 UNSATISFIED = 64, // unsatisfiable allows 'failed'
194 DELETING = 128, // during and after deletion (invalid)
195 INCONCLUSIVE = 256, // unknown allows 'implied'
196
197 // These combined states are used to check contracts.
198
200 VALID = READY | ADDING,
202};
@ SATISFIED
Definition cadical.hpp:192
@ INITIALIZING
Definition cadical.hpp:187
@ INCONCLUSIVE
Definition cadical.hpp:195
@ UNSATISFIED
Definition cadical.hpp:193
@ CONFIGURING
Definition cadical.hpp:188

◆ Status

Enumerator
SATISFIABLE 
UNSATISFIABLE 
UNKNOWN 

Definition at line 28 of file cadical.hpp.

28 {
29 SATISFIABLE = 10,
30 UNSATISFIABLE = 20,
31 UNKNOWN = 0,
32};
@ UNKNOWN
Definition cadical.hpp:31
@ UNSATISFIABLE
Definition cadical.hpp:30
@ SATISFIABLE
Definition cadical.hpp:29

◆ Vivify_Mode

enum class CaDiCaL::Vivify_Mode
strong
Enumerator
TIER1 
TIER2 
TIER3 
IRREDUNDANT 

Definition at line 18 of file vivify.hpp.

#define TIER1
Definition internal.h:258
#define TIER2
Definition internal.h:259

Function Documentation

◆ absolute_process_time()

double CaDiCaL::absolute_process_time ( )

Definition at line 89 of file cadical_resources.cpp.

89 {
90 double res;
91 struct rusage u;
92 if (getrusage (RUSAGE_SELF, &u))
93 return 0;
94 res = u.ru_utime.tv_sec + 1e-6 * u.ru_utime.tv_usec; // user time
95 res += u.ru_stime.tv_sec + 1e-6 * u.ru_stime.tv_usec; // + system time
96 return res;
97}
Here is the caller graph for this function:

◆ absolute_real_time()

double CaDiCaL::absolute_real_time ( )

Definition at line 78 of file cadical_resources.cpp.

78 {
79 struct timeval tv;
80 if (gettimeofday (&tv, 0))
81 return 0;
82 return 1e-6 * tv.tv_usec + tv.tv_sec;
83}
Here is the caller graph for this function:

◆ affiliations()

const char * CaDiCaL::affiliations ( )

Definition at line 104 of file cadical_version.cpp.

104{ return AFFILIATIONS; }

◆ align()

size_t CaDiCaL::align ( size_t n,
size_t alignment )
inline

Definition at line 59 of file util.hpp.

59 {
60 size_t res = n;
61 CADICAL_assert (is_power_of_two (alignment));
62 const size_t mask = alignment - 1;
63 if (res & mask)
64 res = (res | mask) + 1;
65 CADICAL_assert (aligned (res, alignment));
66 return res;
67}
#define CADICAL_assert(ignore)
Definition global.h:14
bool is_power_of_two(unsigned n)
Definition util.hpp:47
bool aligned(size_t n, size_t alignment)
Definition util.hpp:53
Here is the call graph for this function:
Here is the caller graph for this function:

◆ aligned()

bool CaDiCaL::aligned ( size_t n,
size_t alignment )
inline

Definition at line 53 of file util.hpp.

53 {
54 CADICAL_assert (is_power_of_two (alignment));
55 const size_t mask = alignment - 1;
56 return !(n & mask);
57}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ authors()

const char * CaDiCaL::authors ( )

Definition at line 103 of file cadical_version.cpp.

103{ return AUTHORS; }

◆ bign()

unsigned CaDiCaL::bign ( int lit)
inline

Definition at line 23 of file util.hpp.

23{ return 1 + (lit < 0); }
int lit
Definition satVec.h:130
Here is the caller graph for this function:

◆ check_correct_ite_flags()

void CaDiCaL::check_correct_ite_flags ( const Gate *const g)

Definition at line 60 of file cadical_congruence.cpp.

60 {
61#ifndef CADICAL_NDEBUG
62 const int8_t f = g->degenerated_ite;
63 const int lhs = g->lhs;
64 const int cond = g->rhs [0];
65 const int then_lit = g->rhs[1];
66 const int else_lit = g->rhs[2];
67 CADICAL_assert (g->pos_lhs_ids.size () == 4);
68 if (g->pos_lhs_ids[0].clause == nullptr)
70 if (g->pos_lhs_ids[1].clause == nullptr)
72 if (g->pos_lhs_ids[2].clause == nullptr)
74 if (g->pos_lhs_ids[3].clause == nullptr)
76 if (lhs == cond) {
79 }
80 if (lhs == -cond) {
83 }
84 if (lhs == then_lit) {
87 }
88 if (lhs == else_lit) {
91 }
92 CADICAL_assert (lhs != -then_lit);
93 CADICAL_assert (lhs != -else_lit);
94 CADICAL_assert (cond != then_lit);
95 CADICAL_assert (cond != else_lit);
96 CADICAL_assert (cond != -then_lit);
97 CADICAL_assert (cond != -else_lit);
98#else
99 (void)g;
100#endif
101}
vector< int > rhs
int8_t degenerated_ite
vector< LitClausePair > pos_lhs_ids
Here is the caller graph for this function:

◆ check_ite_lits_normalized()

void CaDiCaL::check_ite_lits_normalized ( const std::vector< int > & lits)

Definition at line 6867 of file cadical_congruence.cpp.

6867 {
6868 CADICAL_assert (lits[0] > 0);
6869 CADICAL_assert (lits[1] > 0);
6870 CADICAL_assert (lits[0] != lits[1]);
6871 CADICAL_assert (lits[0] != lits[2]);
6872 CADICAL_assert (lits[1] != lits[2]);
6873 CADICAL_assert (lits[0] != -lits[1]);
6874 CADICAL_assert (lits[0] != -lits[2]);
6875 CADICAL_assert (lits[1] != -lits[2]);
6876#ifdef CADICAL_NDEBUG
6877 (void) lits;
6878#endif
6879}

◆ clear_n()

template<class T>
void CaDiCaL::clear_n ( T * base,
size_t n )
inline

Definition at line 149 of file util.hpp.

149 {
150 memset (base, 0, sizeof (T) * n);
151}
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ compiler()

const char * CaDiCaL::compiler ( )

Definition at line 107 of file cadical_version.cpp.

107{ return COMPILER; }
#define COMPILER
Here is the caller graph for this function:

◆ contained()

bool CaDiCaL::contained ( int64_t c,
int64_t l,
int64_t u )
inline

Definition at line 49 of file util.hpp.

49 {
50 return l <= c && c <= u;
51}
Here is the caller graph for this function:

◆ copyright()

const char * CaDiCaL::copyright ( )

Definition at line 102 of file cadical_version.cpp.

102{ return COPYRIGHT; }

◆ create_ref()

vivify_ref CaDiCaL::create_ref ( Internal * internal,
Clause * c )

Definition at line 1328 of file cadical_vivify.cpp.

1328 {
1329 LOG (c, "creating vivify_refs of clause");
1330 vivify_ref ref;
1331 ref.clause = c;
1332 ref.size = c->size;
1333 for (int i = 0; i < COUNTREF_COUNTS; ++i)
1334 ref.count[i] = 0;
1335 ref.vivify = c->vivify;
1336 int lits[COUNTREF_COUNTS] = {0};
1337 for (int i = 0; i != std::min (COUNTREF_COUNTS, c->size); ++i) {
1338 int best = 0;
1339 unsigned best_count = 0;
1340 for (auto lit : *c) {
1341 LOG ("to find best number of occurrences for literal %d, looking at "
1342 "literal %d",
1343 i, lit);
1344 for (int j = 0; j != i; ++j) {
1345 LOG ("comparing %d with literal %d", lit, lits[j]);
1346 if (lits[j] == lit)
1347 goto CONTINUE_WITH_NEXT_LITERAL;
1348 }
1349 {
1350 const int64_t lit_count = internal->noccs (lit);
1351 CADICAL_assert (lit_count);
1352 LOG ("checking literal %d with %zd occurrences", lit, lit_count);
1353 if (lit_count <= best_count)
1354 continue;
1355 best_count = lit_count;
1356 best = lit;
1357 }
1358 CONTINUE_WITH_NEXT_LITERAL:;
1359 }
1360 CADICAL_assert (best);
1361 CADICAL_assert (best_count);
1362 CADICAL_assert (best_count < UINT32_MAX);
1363 ref.count[i] =
1364 ((uint64_t) best_count << 32) + (uint64_t) internal->vlit (best);
1365 LOG ("final count at position %d is %d - %d: %lu", i, best, best_count,
1366 ref.count[i]);
1367 lits[i] = best;
1368 }
1369 return ref;
1370}
#define UINT32_MAX
Definition pstdint.h:388
#define LOG(...)
unsigned short ref
Definition giaNewBdd.h:38
int64_t & noccs(int lit)
Definition internal.hpp:466
unsigned vlit(int lit) const
Definition internal.hpp:408
#define COUNTREF_COUNTS
Definition vivify.hpp:20
Here is the call graph for this function:
Here is the caller graph for this function:

◆ current_refs_schedule()

std::vector< vivify_ref > & CaDiCaL::current_refs_schedule ( Vivifier & vivifier)
inline

Definition at line 1489 of file cadical_vivify.cpp.

1489 {
1490 switch (vivifier.tier) {
1491 case Vivify_Mode::TIER1:
1492 return vivifier.refs_schedule_tier1;
1493 break;
1494 case Vivify_Mode::TIER2:
1495 return vivifier.refs_schedule_tier2;
1496 break;
1497 case Vivify_Mode::TIER3:
1498 return vivifier.refs_schedule_tier3;
1499 break;
1500 default:
1501 return vivifier.refs_schedule_irred;
1502 break;
1503 }
1504#ifdef WIN32
1505 __assume(false);
1506#else
1507 __builtin_unreachable ();
1508#endif
1509}
struct vivifier vivifier
Definition vivify.c:167
Here is the caller graph for this function:

◆ current_resident_set_size()

uint64_t CaDiCaL::current_resident_set_size ( )

Definition at line 147 of file cadical_resources.cpp.

147 {
148 char path[64];
149 snprintf (path, sizeof path, "/proc/%" PRId64 "/statm",
150 (int64_t) getpid ());
151 FILE *file = fopen (path, "r");
152 if (!file)
153 return 0;
154 uint64_t dummy, rss;
155 int scanned = fscanf (file, "%" PRIu64 " %" PRIu64 "", &dummy, &rss);
156 fclose (file);
157 return scanned == 2 ? rss * sysconf (_SC_PAGESIZE) : 0;
158}
Definition file.h:23

◆ current_schedule()

std::vector< Clause * > & CaDiCaL::current_schedule ( Vivifier & vivifier)
inline

Definition at line 1511 of file cadical_vivify.cpp.

1511 {
1512 switch (vivifier.tier) {
1513 case Vivify_Mode::TIER1:
1514 return vivifier.schedule_tier1;
1515 break;
1516 case Vivify_Mode::TIER2:
1517 return vivifier.schedule_tier2;
1518 break;
1519 case Vivify_Mode::TIER3:
1520 return vivifier.schedule_tier3;
1521 break;
1522 default:
1523 return vivifier.schedule_irred;
1524 break;
1525 }
1526#ifdef WIN32
1527 __assume(false);
1528#else
1529 __builtin_unreachable ();
1530#endif
1531}
Here is the caller graph for this function:

◆ date()

const char * CaDiCaL::date ( )

Definition at line 108 of file cadical_version.cpp.

108{ return DATE; }
#define DATE
Here is the caller graph for this function:

◆ erase_bins()

void CaDiCaL::erase_bins ( Bins & bs)
inline

Definition at line 22 of file bins.hpp.

22{ erase_vector (bs); }
void erase_vector(std::vector< T > &v)
Definition util.hpp:90
Here is the call graph for this function:

◆ erase_occs()

void CaDiCaL::erase_occs ( Occs & os)
inline

Definition at line 21 of file occs.hpp.

21{ erase_vector (os); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ erase_vector()

template<class T>
void CaDiCaL::erase_vector ( std::vector< T > & v)

Definition at line 90 of file util.hpp.

90 {
91 if (v.capacity ()) {
92 std::vector<T> ().swap (v);
93 }
94 CADICAL_assert (!v.capacity ()); // not guaranteed though
95}
Here is the caller graph for this function:

◆ fatal()

void CaDiCaL::fatal ( const char * fmt,
... )

Definition at line 206 of file cadical_message.cpp.

206 {
208 va_list ap;
209 va_start (ap, fmt);
210 vfprintf (stderr, fmt, ap);
211 va_end (ap);
213 abort ();
214}
void fatal_message_start()
void fatal_message_end()
VOID_HACK abort()
Here is the call graph for this function:

◆ fatal_message_end()

void CaDiCaL::fatal_message_end ( )

Definition at line 200 of file cadical_message.cpp.

200 {
201 fputc ('\n', stderr);
202 fflush (stderr);
203 abort ();
204}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ fatal_message_start()

void CaDiCaL::fatal_message_start ( )

Definition at line 190 of file cadical_message.cpp.

190 {
191 fflush (stdout);
192 terr.bold ();
193 fputs ("cadical: ", stderr);
194 terr.red (1);
195 fputs ("fatal error:", stderr);
196 terr.normal ();
197 fputc (' ', stderr);
198}
Terminal terr(stderr)
Definition terminal.hpp:98
Here is the caller graph for this function:

◆ flags()

const char * CaDiCaL::flags ( )

Definition at line 109 of file cadical_version.cpp.

109{ return FLAGS; }
#define FLAGS

◆ gate_contains()

bool CaDiCaL::gate_contains ( Gate * g,
int lit )

Definition at line 127 of file cadical_congruence.cpp.

127 {
128 return find (begin (g->rhs), end (g->rhs), lit) != end (g->rhs);
129}
Here is the caller graph for this function:

◆ has_prefix()

bool CaDiCaL::has_prefix ( const char * str,
const char * prefix )

Definition at line 82 of file cadical_util.cpp.

82 {
83 for (const char *p = str, *q = prefix; *q; q++, p++)
84 if (*q != *p)
85 return false;
86 return true;
87}
Cube * p
Definition exorList.c:222

◆ has_suffix()

bool CaDiCaL::has_suffix ( const char * str,
const char * suffix )

Definition at line 77 of file cadical_util.cpp.

77 {
78 size_t k = strlen (str), l = strlen (suffix);
79 return k > l && !strcmp (str + k - l, suffix);
80}
int strlen()
int strcmp()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hash_string()

uint64_t CaDiCaL::hash_string ( const char * str)

Definition at line 119 of file cadical_util.cpp.

119 {
120 const unsigned size = sizeof primes / sizeof *primes;
121 uint64_t res = 0;
122 unsigned char ch;
123 unsigned i = 0;
124 for (const char *p = str; (ch = *p); p++) {
125 res += ch;
126 res *= primes[i++];
127 if (i == size)
128 i = 0;
129 }
130 return res;
131}

◆ identifier()

const char * CaDiCaL::identifier ( )

Definition at line 106 of file cadical_version.cpp.

106{ return IDENTIFIER; }
#define IDENTIFIER
Here is the caller graph for this function:

◆ inc_lits()

void CaDiCaL::inc_lits ( vector< int > & lits)

Definition at line 3407 of file cadical_congruence.cpp.

3407 {
3408 bool carry = true;
3409 for (size_t i = 0; i < lits.size () && carry; ++i) {
3410 int lit = lits[i];
3411 carry = (lit < 0);
3412 lits[i] = -lit;
3413 }
3414}
unsigned size
Definition vector.h:35
Here is the caller graph for this function:

◆ is_color_option()

bool CaDiCaL::is_color_option ( const char * arg)

Definition at line 91 of file cadical_util.cpp.

91 {
92 return !strcmp (arg, "--color") || !strcmp (arg, "--colors") ||
93 !strcmp (arg, "--colour") || !strcmp (arg, "--colours") ||
94 !strcmp (arg, "--color=1") || !strcmp (arg, "--colors=1") ||
95 !strcmp (arg, "--colour=1") || !strcmp (arg, "--colours=1") ||
96 !strcmp (arg, "--color=true") || !strcmp (arg, "--colors=true") ||
97 !strcmp (arg, "--colour=true") || !strcmp (arg, "--colours=true");
98}
Here is the call graph for this function:

◆ is_no_color_option()

bool CaDiCaL::is_no_color_option ( const char * arg)

Definition at line 100 of file cadical_util.cpp.

100 {
101 return !strcmp (arg, "--no-color") || !strcmp (arg, "--no-colors") ||
102 !strcmp (arg, "--no-colour") || !strcmp (arg, "--no-colours") ||
103 !strcmp (arg, "--color=0") || !strcmp (arg, "--colors=0") ||
104 !strcmp (arg, "--colour=0") || !strcmp (arg, "--colours=0") ||
105 !strcmp (arg, "--color=false") ||
106 !strcmp (arg, "--colors=false") ||
107 !strcmp (arg, "--colour=false") ||
108 !strcmp (arg, "--colours=false");
109}
Here is the call graph for this function:

◆ is_power_of_two()

bool CaDiCaL::is_power_of_two ( unsigned n)
inline

Definition at line 47 of file util.hpp.

47{ return n && !(n & (n - 1)); }
Here is the caller graph for this function:

◆ ite_flags_cond_lhs()

bool CaDiCaL::ite_flags_cond_lhs ( int8_t flag)
inline

Definition at line 200 of file congruence.hpp.

200 {
201 return (flag & COND_LHS) == COND_LHS;
202}
Here is the caller graph for this function:

◆ ite_flags_neg_cond_lhs()

bool CaDiCaL::ite_flags_neg_cond_lhs ( int8_t flag)
inline

Definition at line 196 of file congruence.hpp.

196 {
197 return (flag & UCOND_LHS) == UCOND_LHS;
198}
Here is the caller graph for this function:

◆ ite_flags_no_else_clauses()

bool CaDiCaL::ite_flags_no_else_clauses ( int8_t flag)
inline

Definition at line 192 of file congruence.hpp.

192 {
193 return (flag & NO_ELSE) == NO_ELSE;
194}
Here is the caller graph for this function:

◆ ite_flags_no_then_clauses()

bool CaDiCaL::ite_flags_no_then_clauses ( int8_t flag)
inline

Definition at line 188 of file congruence.hpp.

188 {
189 return (flag & NO_THEN) == NO_THEN;
190}
Here is the caller graph for this function:

◆ less_litpair()

bool CaDiCaL::less_litpair ( lit_equivalence p,
lit_equivalence q )

Definition at line 7054 of file cadical_congruence.cpp.

7054 {
7055 const int a = p.first;
7056 const int b = q.first;
7057 if (a < b)
7058 return true;
7059 if (b > a)
7060 return false;
7061 const int c = p.second;
7062 const int d = q.second;
7063 return (c < d);
7064}

◆ maximum_resident_set_size()

uint64_t CaDiCaL::maximum_resident_set_size ( )

Definition at line 133 of file cadical_resources.cpp.

133 {
134 struct rusage u;
135 if (getrusage (RUSAGE_SELF, &u))
136 return 0;
137 return ((uint64_t) u.ru_maxrss) << 10;
138}
Here is the caller graph for this function:

◆ non_tautological_cube()

bool CaDiCaL::non_tautological_cube ( std::vector< int > cube)

Definition at line 253 of file cadical_lookahead.cpp.

253 {
254 std::sort (begin (cube), end (cube), clause_lit_less_than ());
255
256 for (size_t i = 0, j = 1; j < cube.size (); ++i, ++j)
257 if (cube[i] == cube[j])
258 return false;
259 else if (cube[i] == -cube[j])
260 return false;
261 else if (cube[i] == 0)
262 return false;
263
264 return true;
265}
Definition exor.h:123
Here is the caller graph for this function:

◆ parity()

bool CaDiCaL::parity ( unsigned a)
inline

Definition at line 71 of file util.hpp.

71 {
72 CADICAL_assert (sizeof a == 4);
73 unsigned tmp = a;
74 tmp ^= (tmp >> 16);
75 tmp ^= (tmp >> 8);
76 tmp ^= (tmp >> 4);
77 tmp ^= (tmp >> 2);
78 tmp ^= (tmp >> 1);
79 return tmp & 1;
80}
Here is the caller graph for this function:

◆ parity_lits()

bool CaDiCaL::parity_lits ( const vector< int > & lits)

Definition at line 3400 of file cadical_congruence.cpp.

3400 {
3401 unsigned res = 0;
3402 for (auto lit : lits)
3403 res ^= (lit < 0);
3404 return res;
3405}
Here is the caller graph for this function:

◆ parse_int_str()

bool CaDiCaL::parse_int_str ( const char * val_str,
int & val )

Definition at line 11 of file cadical_util.cpp.

11 {
12 if (!strcmp (val_str, "true"))
13 val = 1;
14 else if (!strcmp (val_str, "false"))
15 val = 0;
16 else {
17 const char *p = val_str;
18 int sign;
19
20 if (*p == '-')
21 sign = -1, p++;
22 else
23 sign = 1;
24
25 int ch;
26 if (!isdigit ((ch = *p++)))
27 return false;
28
29 const int64_t bound = -(int64_t) INT_MIN;
30 int64_t mantissa = ch - '0';
31
32 while (isdigit (ch = *p++)) {
33 if (bound / 10 < mantissa)
34 mantissa = bound;
35 else
36 mantissa *= 10;
37 const int digit = ch - '0';
38 if (bound - digit < mantissa)
39 mantissa = bound;
40 else
41 mantissa += digit;
42 }
43
44 int exponent = 0;
45 if (ch == 'e') {
46 while (isdigit ((ch = *p++)))
47 exponent = exponent ? 10 : ch - '0';
48 if (ch)
49 return false;
50 } else if (ch)
51 return false;
52
53 CADICAL_assert (exponent <= 10);
54 int64_t val64 = mantissa;
55 for (int i = 0; i < exponent; i++)
56 val64 *= 10;
57
58 if (sign < 0) {
59 val64 = -val64;
60 if (val64 < INT_MIN)
61 val64 = INT_MIN;
62 } else {
63 if (val64 > INT_MAX)
64 val64 = INT_MAX;
65 }
66
67 CADICAL_assert (INT_MIN <= val64);
68 CADICAL_assert (val64 <= INT_MAX);
69
70 val = val64;
71 }
72 return true;
73}
int sign(int lit)
Definition util.hpp:22
Here is the call graph for this function:
Here is the caller graph for this function:

◆ percent()

double CaDiCaL::percent ( double a,
double b )
inline

Definition at line 21 of file util.hpp.

21{ return relative (100 * a, b); }
double relative(double a, double b)
Definition util.hpp:20
Here is the call graph for this function:
Here is the caller graph for this function:

◆ relative()

double CaDiCaL::relative ( double a,
double b )
inline

Definition at line 20 of file util.hpp.

20{ return b ? a / b : 0; }
Here is the caller graph for this function:

◆ remove_occs()

void CaDiCaL::remove_occs ( Occs & os,
Clause * c )
inline

Definition at line 23 of file occs.hpp.

23 {
24 const auto end = os.end ();
25 auto i = os.begin ();
26 for (auto j = i; j != end; j++) {
27 const Clause *d = *i++ = *j;
28 if (c == d)
29 i--;
30 }
31 CADICAL_assert (i + 1 == end);
32 os.resize (i - os.begin ());
33}
Here is the caller graph for this function:

◆ remove_watch()

void CaDiCaL::remove_watch ( Watches & ws,
Clause * clause )
inline

Definition at line 50 of file watch.hpp.

50 {
51 const auto end = ws.end ();
52 auto i = ws.begin ();
53 for (auto j = i; j != end; j++) {
54 const Watch &w = *i++ = *j;
55 if (w.clause == clause)
56 i--;
57 }
58 CADICAL_assert (i + 1 == end);
59 ws.resize (i - ws.begin ());
60}
Clause * clause
Definition watch.hpp:35
Here is the caller graph for this function:

◆ rsort()

template<class I, class Rank>
void CaDiCaL::rsort ( I first,
I last,
Rank rank )

Definition at line 45 of file radix.hpp.

45 {
46 typedef typename iterator_traits<I>::value_type T;
47 typedef typename Rank::Type R;
48
49 CADICAL_assert (first <= last);
50 const size_t n = last - first;
51 if (n <= 1)
52 return;
53
54 const size_t l = 8; // Radix 8, thus byte-wise.
55 const size_t w = (1 << l); // So many buckets.
56
57 const unsigned mask = w - 1; // Fast mod 'w'.
58
59// Uncomment the following define for large values of 'w' in order to keep
60// the large bucket array 'count' on the heap instead of the stack.
61//
62// #define CADICAL_RADIX_BUCKETS_ON_THE_HEAP
63//
64#ifdef CADICAL_RADIX_BUCKETS_ON_THE_HEAP
65 size_t *count = new size_t[w]; // Put buckets on the heap.
66#else
67 size_t count[w]; // Put buckets on the stack.
68#endif
69
70 I a = first, b = last, c = a;
71 bool initialized = false;
72 std::vector<T> v;
73
74 R upper = 0, lower = ~upper;
75 R shifted = mask;
76 bool bounded = false;
77
78 R masked_lower = 0, masked_upper = mask;
79
80 for (size_t i = 0; i < 8 * sizeof (rank (*first));
81 i += l, shifted <<= l) {
82
83 if (bounded && (lower & shifted) == (upper & shifted))
84 continue;
85
86 memset (count + masked_lower, 0,
87 (masked_upper - masked_lower + 1) * sizeof *count);
88
89 const I end = c + n;
90 bool sorted = true;
91 R last = 0;
92
93 for (I p = c; p != end; p++) {
94 const auto r = rank (*p);
95 if (!bounded)
96 lower &= r, upper |= r;
97 const auto s = r >> i;
98 const auto m = s & mask;
99 if (sorted && last > m)
100 sorted = false;
101 else
102 last = m;
103 count[m]++;
104 }
105
106 masked_lower = (lower >> i) & mask;
107 masked_upper = (upper >> i) & mask;
108
109 if (!bounded) {
110 bounded = true;
111 if ((lower & shifted) == (upper & shifted))
112 continue;
113 }
114
115 if (sorted)
116 continue;
117
118 size_t pos = 0;
119 for (R j = masked_lower; j <= masked_upper; j++) {
120 const size_t delta = count[j];
121 count[j] = pos;
122 pos += delta;
123 }
124
125 if (!initialized) {
126 CADICAL_assert (&*c == &*a); // MS VC++
127 v.resize (n);
128 b = v.begin ();
129 initialized = true;
130 }
131
132 I d = (&*c == &*a) ? b : a; // MS VC++
133
134 for (I p = c; p != end; p++) {
135 const auto r = rank (*p);
136 const auto s = r >> i;
137 const auto m = s & mask;
138 d[count[m]++] = *p;
139 }
140 c = d;
141 }
142
143 if (c == b) {
144 for (size_t i = 0; i < n; i++)
145 a[i] = b[i];
146 }
147
148#ifdef CADICAL_RADIX_BUCKETS_ON_THE_HEAP
149 delete[] count;
150#endif
151
152#ifndef CADICAL_NDEBUG
153 for (I p = first; p + 1 != last; p++)
154 CADICAL_assert (rank (p[0]) <= rank (p[1]));
155#endif
156}
bool pos
Definition globals.c:30
unsigned rank
Definition vector.c:142
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_vivifier_mode()

void CaDiCaL::set_vivifier_mode ( Vivifier & vivifier,
Vivify_Mode tier )

Definition at line 1772 of file cadical_vivify.cpp.

1772 {
1773 vivifier.tier = tier;
1774 switch (tier) {
1775 case Vivify_Mode::TIER1:
1776 vivifier.tag = 'u';
1777 break;
1778 case Vivify_Mode::TIER2:
1779 vivifier.tag = 'v';
1780 break;
1781 case Vivify_Mode::TIER3:
1782 vivifier.tag = 'w';
1783 break;
1784 default:
1786 vivifier.tag = 'x';
1787 break;
1788 }
1789}
Here is the caller graph for this function:

◆ shrink_bins()

void CaDiCaL::shrink_bins ( Bins & bs)
inline

Definition at line 21 of file bins.hpp.

21{ shrink_vector (bs); }
void shrink_vector(std::vector< T > &v)
Definition util.hpp:101
Here is the call graph for this function:

◆ shrink_occs()

void CaDiCaL::shrink_occs ( Occs & os)
inline

Definition at line 20 of file occs.hpp.

20{ shrink_vector (os); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ shrink_vector()

template<class T>
void CaDiCaL::shrink_vector ( std::vector< T > & v)

Definition at line 101 of file util.hpp.

101 {
102 if (v.capacity () > v.size ()) {
103 std::vector<T> (v).swap (v);
104 }
105 CADICAL_assert (v.capacity () == v.size ()); // not guaranteed though
106}
Here is the caller graph for this function:

◆ sign()

int CaDiCaL::sign ( int lit)
inline

Definition at line 22 of file util.hpp.

22{ return (lit > 0) - (lit < 0); }
Here is the caller graph for this function:

◆ signature()

const char * CaDiCaL::signature ( )

Definition at line 105 of file cadical_version.cpp.

105{ return "cadical-" VERSION SHORTIDSTR; }
#define SHORTIDSTR
#define VERSION
Definition espresso.h:367
Here is the caller graph for this function:

◆ string_of_gate()

std::string CaDiCaL::string_of_gate ( Gate_Type t)

Definition at line 4823 of file cadical_congruence.cpp.

4823 {
4824 switch (t) {
4826 return "And";
4828 return "XOr";
4830 return "ITE";
4831 default:
4832 return "buggy";
4833 }
4834}

◆ update_ite_flags()

void CaDiCaL::update_ite_flags ( Gate * g)

Definition at line 28 of file cadical_congruence.cpp.

28 {
29 int8_t f = g->degenerated_ite;
30 const int lhs = g->lhs;
31 const int cond = g->rhs [0];
32 const int then_lit = g->rhs[1];
33 const int else_lit = g->rhs[2];
34
35 if (lhs == cond) {
38 }
39 if (lhs == -cond) {
42 }
43 if (lhs == then_lit) {
46 }
47 if (lhs == else_lit) {
50 }
51 g->degenerated_ite = f;
52 CADICAL_assert (lhs != -then_lit);
53 CADICAL_assert (lhs != -else_lit);
54 CADICAL_assert (cond != then_lit);
55 CADICAL_assert (cond != else_lit);
56 CADICAL_assert (cond != -then_lit);
57 CADICAL_assert (cond != -else_lit);
58}
Here is the caller graph for this function:

◆ update_watch_size()

void CaDiCaL::update_watch_size ( Watches & ws,
int blit,
Clause * conflict )
inline

Definition at line 63 of file watch.hpp.

63 {
64 bool found = false;
65 const int size = conflict->size;
66 for (Watch &w : ws) {
67 if (w.clause == conflict)
68 w.size = size, w.blit = blit, found = true;
69 CADICAL_assert (w.clause->garbage || w.size == 2 || w.clause->size != 2);
70 }
71 CADICAL_assert (found), (void) found;
72}
Here is the caller graph for this function:

◆ version()

const char * CaDiCaL::version ( )

Definition at line 101 of file cadical_version.cpp.

101{ return VERSION; }
Here is the caller graph for this function:

Variable Documentation

◆ invalid_heap_position

const unsigned CaDiCaL::invalid_heap_position = UINT_MAX

Definition at line 26 of file heap.hpp.

◆ terr

Terminal CaDiCaL::terr ( stderr )

Definition at line 98 of file terminal.hpp.

◆ tout

Terminal CaDiCaL::tout ( stdout )

Definition at line 97 of file terminal.hpp.