ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
clause.h File Reference
#include "arena.h"
#include "literal.h"
#include "reference.h"
#include "utilities.h"
#include <stdbool.h>
#include "global.h"
Include dependency graph for clause.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  clause
 

Macros

#define LD_MAX_GLUE   19
 
#define LD_MAX_USED   5
 
#define MAX_GLUE   ((1u << LD_MAX_GLUE) - 1)
 
#define MAX_USED   ((1u << LD_MAX_USED) - 1)
 
#define SIZE_OF_CLAUSE_HEADER   ((size_t) & ((clause *) 0)->searched)
 
#define BEGIN_LITS(C)
 
#define END_LITS(C)
 
#define all_literals_in_clause(LIT, C)
 

Typedefs

typedef typedefABC_NAMESPACE_HEADER_START struct clause clause
 

Functions

void kissat_new_binary_clause (struct kissat *, unsigned, unsigned)
 
void kissat_new_unwatched_binary_clause (struct kissat *, unsigned, unsigned)
 
reference kissat_new_original_clause (struct kissat *)
 
reference kissat_new_irredundant_clause (struct kissat *)
 
reference kissat_new_redundant_clause (struct kissat *, unsigned glue)
 
void kissat_sort_literals (struct kissat *, unsigned size, unsigned *lits)
 
void kissat_connect_clause (struct kissat *, clause *)
 
void kissat_connect_referenced (struct kissat *solver, reference)
 
clausekissat_delete_clause (struct kissat *, clause *)
 
void kissat_delete_binary (struct kissat *, unsigned, unsigned)
 
void kissat_mark_clause_as_garbage (struct kissat *, clause *)
 

Macro Definition Documentation

◆ all_literals_in_clause

#define all_literals_in_clause ( LIT,
C )
Value:
unsigned LIT, \
*LIT##_PTR = BEGIN_LITS (C), *const LIT##_END = END_LITS (C); \
LIT##_PTR != LIT##_END && ((LIT = *LIT##_PTR), true); \
++LIT##_PTR
#define BEGIN_LITS(C)
Definition clause.h:44
#define END_LITS(C)
Definition clause.h:45
#define LIT(IDX)
Definition literal.h:31

Definition at line 47 of file clause.h.

47#define all_literals_in_clause(LIT, C) \
48 unsigned LIT, \
49 *LIT##_PTR = BEGIN_LITS (C), *const LIT##_END = END_LITS (C); \
50 LIT##_PTR != LIT##_END && ((LIT = *LIT##_PTR), true); \
51 ++LIT##_PTR

◆ BEGIN_LITS

#define BEGIN_LITS ( C)
Value:
((C)->lits)

Definition at line 44 of file clause.h.

◆ END_LITS

#define END_LITS ( C)
Value:
(BEGIN_LITS (C) + (C)->size)

Definition at line 45 of file clause.h.

◆ LD_MAX_GLUE

#define LD_MAX_GLUE   19

Definition at line 16 of file clause.h.

◆ LD_MAX_USED

#define LD_MAX_USED   5

Definition at line 17 of file clause.h.

◆ MAX_GLUE

#define MAX_GLUE   ((1u << LD_MAX_GLUE) - 1)

Definition at line 19 of file clause.h.

◆ MAX_USED

#define MAX_USED   ((1u << LD_MAX_USED) - 1)

Definition at line 20 of file clause.h.

◆ SIZE_OF_CLAUSE_HEADER

#define SIZE_OF_CLAUSE_HEADER   ((size_t) & ((clause *) 0)->searched)

Definition at line 42 of file clause.h.

Typedef Documentation

◆ clause

typedef typedefABC_NAMESPACE_HEADER_START struct clause clause

Definition at line 14 of file clause.h.

Function Documentation

◆ kissat_connect_clause()

void kissat_connect_clause ( struct kissat * solver,
clause * c )

Definition at line 60 of file clause.c.

60 {
61 watches *all_watches = solver->watches;
62 const reference ref = kissat_reference_clause (solver, c);
63 kissat_inlined_connect_clause (solver, all_watches, c, ref);
64}
#define solver
Definition kitten.c:211
unsigned short ref
Definition giaNewBdd.h:38
ABC_NAMESPACE_HEADER_START typedef unsigned reference
Definition reference.h:9
vector watches
Definition watch.h:49

◆ kissat_connect_referenced()

void kissat_connect_referenced ( struct kissat * solver,
reference ref )

Definition at line 54 of file clause.c.

54 {
55 watches *all_watches = solver->watches;
56 clause *c = kissat_dereference_clause (solver, ref);
57 kissat_inlined_connect_clause (solver, all_watches, c, ref);
58}

◆ kissat_delete_binary()

void kissat_delete_binary ( struct kissat * solver,
unsigned a,
unsigned b )

Definition at line 181 of file clause.c.

181 {
182 LOGBINARY (a, b, "delete");
183 kissat_mark_removed_literal (solver, a);
184 kissat_mark_removed_literal (solver, b);
187 dec_clause (solver, false, true);
188 INC (clauses_deleted);
189}
#define INC(NAME)
#define REMOVE_CHECKER_BINARY(...)
Definition check.h:161
#define LOGBINARY(...)
Definition logging.h:442
#define DELETE_BINARY_FROM_PROOF(...)
Definition proof.h:149
Here is the caller graph for this function:

◆ kissat_delete_clause()

clause * kissat_delete_clause ( struct kissat * solver,
clause * c )

Definition at line 171 of file clause.c.

171 {
172 LOGCLS (c, "delete");
173 KISSAT_assert (c->size > 2);
175 size_t bytes = kissat_actual_bytes_of_clause (c);
176 SUB (arena_garbage, bytes);
177 INC (clauses_deleted);
178 return (clause *) ((char *) c + bytes);
179}
#define KISSAT_assert(ignore)
Definition global.h:13
#define LOGCLS(...)
Definition logging.h:415
#define SUB(NAME, N)
Definition statistics.h:415
unsigned size
Definition clause.h:37
bool garbage
Definition clause.h:25

◆ kissat_mark_clause_as_garbage()

void kissat_mark_clause_as_garbage ( struct kissat * solver,
clause * c )

Definition at line 164 of file clause.c.

164 {
166 mark_clause_as_garbage (solver, c);
167 size_t bytes = kissat_actual_bytes_of_clause (c);
168 ADD (arena_garbage, bytes);
169}
#define ADD(NAME, DELTA)
Here is the caller graph for this function:

◆ kissat_new_binary_clause()

void kissat_new_binary_clause ( struct kissat * solver,
unsigned first,
unsigned second )

Definition at line 122 of file clause.c.

123 {
124 (void) new_binary_clause (solver, false, true, first, second);
125}

◆ kissat_new_irredundant_clause()

reference kissat_new_irredundant_clause ( struct kissat * solver)

Definition at line 140 of file clause.c.

140 {
141 const unsigned size = SIZE_STACK (solver->clause);
142 unsigned *lits = BEGIN_STACK (solver->clause);
143 return new_clause (solver, false, false, 0, size, lits);
144}
#define BEGIN_STACK(S)
Definition stack.h:46
#define SIZE_STACK(S)
Definition stack.h:19
unsigned long long size
Definition giaNewBdd.h:39

◆ kissat_new_original_clause()

reference kissat_new_original_clause ( struct kissat * solver)

Definition at line 132 of file clause.c.

132 {
133 const unsigned size = SIZE_STACK (solver->clause);
134 unsigned *lits = BEGIN_STACK (solver->clause);
135 kissat_sort_literals (solver, size, lits);
136 reference res = new_clause (solver, true, false, 0, size, lits);
137 return res;
138}
void kissat_sort_literals(struct kissat *, unsigned size, unsigned *lits)
Definition sort.c:85
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kissat_new_redundant_clause()

reference kissat_new_redundant_clause ( struct kissat * solver,
unsigned glue )

Definition at line 146 of file clause.c.

146 {
147 const unsigned size = SIZE_STACK (solver->clause);
148 unsigned *lits = BEGIN_STACK (solver->clause);
149 return new_clause (solver, false, true, glue, size, lits);
150}

◆ kissat_new_unwatched_binary_clause()

void kissat_new_unwatched_binary_clause ( struct kissat * solver,
unsigned first,
unsigned second )

Definition at line 127 of file clause.c.

128 {
129 (void) new_binary_clause (solver, false, false, first, second);
130}

◆ kissat_sort_literals()

void kissat_sort_literals ( struct kissat * solver,
unsigned size,
unsigned * lits )

Definition at line 85 of file sort.c.

90 {
91#ifndef INLINE_SORT
92 const value *const values = solver->values;
93 const assigned *const assigned = solver->assigned;
94#endif
95 value u = move_smallest_literal_to_front (solver, values, assigned, false,
96 0, size, lits);
97 if (size > 2)
98 move_smallest_literal_to_front (solver, values, assigned, (u >= 0), 1,
99 size, lits);
100}
ABC_NAMESPACE_IMPL_START typedef signed char value
Here is the caller graph for this function: