CBMC
cnft Class Referenceabstract

#include <cnf.h>

+ Inheritance diagram for cnft:
+ Collaboration diagram for cnft:

Public Member Functions

 cnft (message_handlert &message_handler)
 
virtual ~cnft ()
 
virtual literalt land (literalt a, literalt b) override
 
virtual literalt lor (literalt a, literalt b) override
 
virtual literalt land (const bvt &bv) override
 Tseitin encoding of conjunction between multiple literals. More...
 
virtual literalt lor (const bvt &bv) override
 Tseitin encoding of disjunction between multiple literals. More...
 
virtual literalt lxor (const bvt &bv) override
 Tseitin encoding of XOR between multiple literals. More...
 
virtual literalt lxor (literalt a, literalt b) override
 
virtual literalt lnand (literalt a, literalt b) override
 
virtual literalt lnor (literalt a, literalt b) override
 
virtual literalt lequal (literalt a, literalt b) override
 
virtual literalt limplies (literalt a, literalt b) override
 
virtual literalt lselect (literalt a, literalt b, literalt c) override
 
virtual literalt new_variable () override
 Generate a new variable and return it as a literal. More...
 
bvt new_variables (std::size_t width) override
 Generate a vector of new variables. More...
 
virtual size_t no_variables () const override
 
virtual void set_no_variables (size_t no)
 
virtual size_t no_clauses () const =0
 
- Public Member Functions inherited from propt
 propt (message_handlert &message_handler)
 
virtual ~propt ()
 
virtual void set_equal (literalt a, literalt b)
 asserts a==b in the propositional formula More...
 
virtual void l_set_to (literalt a, bool value)
 
void l_set_to_true (literalt a)
 
void l_set_to_false (literalt a)
 
void lcnf (literalt l0, literalt l1)
 
void lcnf (literalt l0, literalt l1, literalt l2)
 
void lcnf (literalt l0, literalt l1, literalt l2, literalt l3)
 
virtual void lcnf (const bvt &bv)=0
 
virtual bool has_set_to () const
 
virtual bool cnf_handled_well () const
 
virtual bool has_assumptions () const
 
virtual void set_variable_name (literalt, const irep_idt &)
 
virtual std::string solver_text () const =0
 
resultt prop_solve ()
 
resultt prop_solve (const bvt &assumptions)
 
virtual tvt l_get (literalt a) const =0
 
virtual void set_assignment (literalt a, bool value)=0
 
virtual bool is_in_conflict (literalt l) const =0
 Returns true if an assumption is in the final conflict. More...
 
virtual bool has_is_in_conflict () const
 
virtual void set_frozen (literalt)
 
virtual void set_time_limit_seconds (uint32_t)
 
std::size_t get_number_of_solver_calls () const
 

Protected Member Functions

void gate_and (literalt a, literalt b, literalt o)
 Tseitin encoding of conjunction of two literals. More...
 
void gate_or (literalt a, literalt b, literalt o)
 Tseitin encoding of disjunction of two literals. More...
 
void gate_xor (literalt a, literalt b, literalt o)
 Tseitin encoding of XOR of two literals. More...
 
void gate_nand (literalt a, literalt b, literalt o)
 Tseitin encoding of NAND of two literals. More...
 
void gate_nor (literalt a, literalt b, literalt o)
 Tseitin encoding of NOR of two literals. More...
 
void gate_equal (literalt a, literalt b, literalt o)
 Tseitin encoding of equality between two literals. More...
 
void gate_implies (literalt a, literalt b, literalt o)
 Tseitin encoding of implication between two literals. More...
 
bool process_clause (const bvt &bv, bvt &dest) const
 filter 'true' from clause, eliminate duplicates, recognise trivially satisfied clauses More...
 
- Protected Member Functions inherited from propt
virtual resultt do_prop_solve (const bvt &assumptions)=0
 

Static Protected Member Functions

static bvt eliminate_duplicates (const bvt &)
 eliminate duplicates from given vector of literals More...
 
static bool is_all (const bvt &bv, literalt l)
 

Protected Attributes

size_t _no_variables
 
- Protected Attributes inherited from propt
bvt lcnf_bv
 
messaget log
 
std::size_t number_of_solver_calls = 0
 

Additional Inherited Members

- Public Types inherited from propt
enum class  resultt { P_SATISFIABLE , P_UNSATISFIABLE , P_ERROR }
 

Detailed Description

Definition at line 17 of file cnf.h.

Constructor & Destructor Documentation

◆ cnft()

cnft::cnft ( message_handlert message_handler)
inlineexplicit

Definition at line 22 of file cnf.h.

◆ ~cnft()

virtual cnft::~cnft ( )
inlinevirtual

Definition at line 26 of file cnf.h.

Member Function Documentation

◆ eliminate_duplicates()

bvt cnft::eliminate_duplicates ( const bvt bv)
staticprotected

eliminate duplicates from given vector of literals

parameters: set of literals given as vector
Returns
set of literals, duplicates removed

Definition at line 412 of file cnf.cpp.

◆ gate_and()

void cnft::gate_and ( literalt  a,
literalt  b,
literalt  o 
)
protected

Tseitin encoding of conjunction of two literals.

Side effect: add clauses that encodes relation between inputs/output via lcnf.

parameters: Two input signals to the AND gate, one output

Definition at line 23 of file cnf.cpp.

◆ gate_equal()

void cnft::gate_equal ( literalt  a,
literalt  b,
literalt  o 
)
protected

Tseitin encoding of equality between two literals.

parameters: Two input signals to the EQUAL gate, one output

Definition at line 143 of file cnf.cpp.

◆ gate_implies()

void cnft::gate_implies ( literalt  a,
literalt  b,
literalt  o 
)
protected

Tseitin encoding of implication between two literals.

parameters: Two input signals to the IMPLIES gate, one output

Definition at line 150 of file cnf.cpp.

◆ gate_nand()

void cnft::gate_nand ( literalt  a,
literalt  b,
literalt  o 
)
protected

Tseitin encoding of NAND of two literals.

parameters: Two input signals to the NAND gate, one output

Definition at line 99 of file cnf.cpp.

◆ gate_nor()

void cnft::gate_nor ( literalt  a,
literalt  b,
literalt  o 
)
protected

Tseitin encoding of NOR of two literals.

parameters: Two input signals to the NOR gate, one output

Definition at line 121 of file cnf.cpp.

◆ gate_or()

void cnft::gate_or ( literalt  a,
literalt  b,
literalt  o 
)
protected

Tseitin encoding of disjunction of two literals.

parameters: Two input signals to the OR gate, one output

Definition at line 46 of file cnf.cpp.

◆ gate_xor()

void cnft::gate_xor ( literalt  a,
literalt  b,
literalt  o 
)
protected

Tseitin encoding of XOR of two literals.

parameters: Two input signals to the XOR gate, one output

Definition at line 68 of file cnf.cpp.

◆ is_all()

static bool cnft::is_all ( const bvt bv,
literalt  l 
)
inlinestaticprotected

Definition at line 61 of file cnf.h.

◆ land() [1/2]

literalt cnft::land ( const bvt bv)
overridevirtual

Tseitin encoding of conjunction between multiple literals.

parameters: Any number of inputs to the AND gate
Returns
Output signal of the AND gate as literal

Implements propt.

Definition at line 158 of file cnf.cpp.

◆ land() [2/2]

literalt cnft::land ( literalt  a,
literalt  b 
)
overridevirtual
parameters: Two inputs to the AND gate
Returns
Output signal of the AND gate as literal

Implements propt.

Definition at line 263 of file cnf.cpp.

◆ lequal()

literalt cnft::lequal ( literalt  a,
literalt  b 
)
overridevirtual

Implements propt.

Definition at line 329 of file cnf.cpp.

◆ limplies()

literalt cnft::limplies ( literalt  a,
literalt  b 
)
overridevirtual

Implements propt.

Definition at line 334 of file cnf.cpp.

◆ lnand()

literalt cnft::lnand ( literalt  a,
literalt  b 
)
overridevirtual
parameters: Two inputs to the NAND gate
Returns
Output signal of the NAND gate as literal

Implements propt.

Definition at line 317 of file cnf.cpp.

◆ lnor()

literalt cnft::lnor ( literalt  a,
literalt  b 
)
overridevirtual
parameters: Two inputs to the NOR gate
Returns
Output signal of the NOR gate as literal

Implements propt.

Definition at line 324 of file cnf.cpp.

◆ lor() [1/2]

literalt cnft::lor ( const bvt bv)
overridevirtual

Tseitin encoding of disjunction between multiple literals.

parameters: Any number of inputs to the OR gate
Returns
Output signal of the OR gate as literal

Implements propt.

Reimplemented in qbf_bdd_coret.

Definition at line 201 of file cnf.cpp.

◆ lor() [2/2]

literalt cnft::lor ( literalt  a,
literalt  b 
)
overridevirtual
parameters: Two inputs to the OR gate
Returns
Output signal of the OR gate as literal

Implements propt.

Reimplemented in qbf_bdd_coret.

Definition at line 279 of file cnf.cpp.

◆ lselect()

literalt cnft::lselect ( literalt  a,
literalt  b,
literalt  c 
)
overridevirtual

Implements propt.

Definition at line 344 of file cnf.cpp.

◆ lxor() [1/2]

literalt cnft::lxor ( const bvt bv)
overridevirtual

Tseitin encoding of XOR between multiple literals.

parameters: Any number of inputs to the XOR gate
Returns
Output signal of the XOR gate as literal

Implements propt.

Definition at line 244 of file cnf.cpp.

◆ lxor() [2/2]

literalt cnft::lxor ( literalt  a,
literalt  b 
)
overridevirtual
parameters: Two inputs to the XOR gate
Returns
Output signal of the XOR gate as literal

Implements propt.

Definition at line 295 of file cnf.cpp.

◆ new_variable()

literalt cnft::new_variable ( void  )
overridevirtual

Generate a new variable and return it as a literal.

Returns
New variable as literal

Implements propt.

Reimplemented in qbf_bdd_certificatet, and qbf_bdd_coret.

Definition at line 385 of file cnf.cpp.

◆ new_variables()

bvt cnft::new_variables ( std::size_t  width)
overridevirtual

Generate a vector of new variables.

Returns
Vector of new variables.

Reimplemented from propt.

Definition at line 396 of file cnf.cpp.

◆ no_clauses()

virtual size_t cnft::no_clauses ( ) const
pure virtual

◆ no_variables()

virtual size_t cnft::no_variables ( ) const
inlineoverridevirtual

Implements propt.

Definition at line 42 of file cnf.h.

◆ process_clause()

bool cnft::process_clause ( const bvt bv,
bvt dest 
) const
protected

filter 'true' from clause, eliminate duplicates, recognise trivially satisfied clauses

Definition at line 424 of file cnf.cpp.

◆ set_no_variables()

virtual void cnft::set_no_variables ( size_t  no)
inlinevirtual

Reimplemented in qbf_squolem_coret, and qbf_squolemt.

Definition at line 43 of file cnf.h.

Member Data Documentation

◆ _no_variables

size_t cnft::_no_variables
protected

Definition at line 57 of file cnf.h.


The documentation for this class was generated from the following files: