|
CBMC
|
#include <string_refinement.h>
Inheritance diagram for string_refinementt:
Collaboration diagram for string_refinementt:Classes | |
| struct | configt |
| struct | infot |
| string_refinementt constructor arguments More... | |
Public Member Functions | |
| string_refinementt (const infot &) | |
| std::string | decision_procedure_text () const override |
| Return a textual description of the decision procedure. | |
| exprt | get (const exprt &expr) const override |
| Evaluates the given expression in the valuation found by string_refinementt::dec_solve. | |
| void | set_to (const exprt &expr, bool value) override |
| Record the constraints to ensure that the expression is true when the boolean is true and false otherwise. | |
Public Member Functions inherited from bv_refinementt | |
| bv_refinementt (const infot &info) | |
Public Member Functions inherited from bv_pointerst | |
| bv_pointerst (const namespacet &, propt &, message_handlert &, bool get_array_constraints=false) | |
| void | finish_eager_conversion () override |
| endianness_mapt | endianness_map (const typet &, bool little_endian) const override |
Public Member Functions inherited from boolbvt | |
| boolbvt (const namespacet &_ns, propt &_prop, message_handlert &message_handler, bool get_array_constraints=false) | |
| virtual const bvt & | convert_bv (const exprt &expr, const std::optional< std::size_t > expected_width={}) |
| Convert expression to vector of literalts, using an internal cache to speed up conversion if available. | |
| void | print_assignment (std::ostream &out) const override |
Print satisfying assignment to out. | |
| exprt | handle (const exprt &) override |
| Generate a handle, which is an expression that has the same value as the argument in any model that is generated; this offers an efficient way to refer to the expression in subsequent calls to get or set_to. | |
| void | clear_cache () override |
| mp_integer | get_value (const bvt &bv) |
| mp_integer | get_value (const bvt &bv, std::size_t offset, std::size_t width) |
| const boolbv_mapt & | get_map () const |
| virtual std::size_t | boolbv_width (const typet &type) const |
| virtual endianness_mapt | endianness_map (const typet &type) const |
Public Member Functions inherited from arrayst | |
| arrayst (const namespacet &_ns, propt &_prop, message_handlert &message_handler, bool get_array_constraints=false) | |
| literalt | record_array_equality (const equal_exprt &expr) |
| void | record_array_index (const index_exprt &expr) |
Public Member Functions inherited from equalityt | |
| equalityt (propt &_prop, message_handlert &message_handler) | |
| virtual literalt | equality (const exprt &e1, const exprt &e2) |
| void | finish_eager_conversion () override |
Public Member Functions inherited from prop_conv_solvert | |
| prop_conv_solvert (propt &_prop, message_handlert &message_handler) | |
| virtual | ~prop_conv_solvert ()=default |
| void | print_assignment (std::ostream &out) const override |
Print satisfying assignment to out. | |
| tvt | l_get (literalt a) const override |
Return value of literal l from satisfying assignment. | |
| exprt | handle (const exprt &expr) override |
| Generate a handle, which is an expression that has the same value as the argument in any model that is generated; this offers an efficient way to refer to the expression in subsequent calls to get or set_to. | |
| void | set_frozen (literalt) |
| void | set_frozen (const bvt &) |
| void | set_all_frozen () |
| literalt | convert (const exprt &expr) override |
| Convert a Boolean expression and return the corresponding literal. | |
| bool | is_in_conflict (const exprt &expr) const override |
| Returns true if an expression is in the final conflict leading to UNSAT. | |
| void | push () override |
| Push a new context on the stack This context becomes a child context nested in the current context. | |
| void | push (const std::vector< exprt > &assumptions) override |
Push assumptions in form of literal_exprt | |
| void | pop () override |
| Pop whatever is on top of the stack. | |
| const cachet & | get_cache () const |
| const symbolst & | get_symbols () const |
| void | set_time_limit_seconds (uint32_t lim) override |
| Set the limit for the solver to time out in seconds. | |
| std::size_t | get_number_of_solver_calls () const override |
| Return the number of incremental solver calls. | |
| hardness_collectort * | get_hardness_collector () |
Public Member Functions inherited from conflict_providert | |
| virtual | ~conflict_providert ()=default |
Public Member Functions inherited from prop_convt | |
| virtual | ~prop_convt () |
Public Member Functions inherited from stack_decision_proceduret | |
| virtual | ~stack_decision_proceduret ()=default |
Public Member Functions inherited from decision_proceduret | |
| void | set_to_true (const exprt &) |
For a Boolean expression expr, add the constraint 'expr'. | |
| void | set_to_false (const exprt &) |
For a Boolean expression expr, add the constraint 'not expr'. | |
| resultt | operator() () |
| Run the decision procedure to solve the problem This corresponds to SMT-LIB's check-sat. | |
| resultt | operator() (const exprt &assumption) |
| Run the decision procedure to solve the problem under the given assumption. | |
| virtual | ~decision_proceduret () |
Public Member Functions inherited from solver_resource_limitst | |
| virtual | ~solver_resource_limitst ()=default |
Private Types | |
| typedef bv_refinementt | supert |
Private Member Functions | |
| string_refinementt (const infot &, bool) | |
| void | add_lemma (const exprt &lemma, bool simplify_lemma=true) |
| Add the given lemma to the solver. | |
Private Attributes | |
| const configt | config_ |
| std::size_t | loop_bound_ |
| string_constraint_generatort | generator |
| std::set< exprt > | seen_instances |
| string_axiomst | axioms |
| std::vector< exprt > | current_constraints |
| index_set_pairt | index_sets |
| union_find_replacet | symbol_resolve |
| std::vector< exprt > | equations |
| string_dependenciest | dependencies |
Related Symbols | |
(Note that these are not member symbols.) | |
| std::vector< exprt > | instantiate_not_contains (const string_not_contains_constraintt &axiom, const std::set< std::pair< exprt, exprt > > &index_pairs, const std::unordered_map< string_not_contains_constraintt, symbol_exprt > &witnesses) |
Instantiates a quantified formula representing not_contains by substituting the quantifiers and generating axioms. | |
Definition at line 63 of file string_refinement.h.
Definition at line 93 of file string_refinement.h.
Definition at line 165 of file string_refinement.cpp.
Definition at line 157 of file string_refinement.cpp.
Add the given lemma to the solver.
| lemma | a Boolean expression |
| simplify_lemma | whether the lemma should be simplified before being given to the underlying solver. |
Definition at line 908 of file string_refinement.cpp.
|
overrideprotectedvirtual |
Main decision procedure of the solver.
Looks for a valuation of variables compatible with the constraints that have been given to set_to so far.
The decision procedure initiated by string_refinementt::dec_solve is composed of several steps detailed below.
Pointer symbols which are set to be equal by constraints, are replaced by an single symbol in the solver. The symbol_solvert object used for this substitution is constructed by generate_symbol_resolution_from_equations(const std::vector<equal_exprt>&,const namespacet&,messaget::mstreamt&). All these symbols are then replaced using replace_symbols_in_equations(const union_find_replacet &, std::vector<equal_exprt> &).
Each string primitive is converted to a list of first order formulas by the function substitute_function_applications_in_equations(std::vector<equal_exprt>&,string_constraint_generatort&). These formulas should be unquantified or be either a string_constraintt or a string_not_contains_constraintt. The constraints corresponding to each primitive can be found by following the links in section String primitives.
Since only arrays appear in the string constraints, during the conversion to first order formulas, pointers are associated to arrays. The string_constraint_generatort object keeps track of this association. It can either be set manually using the primitives cprover_associate_array_to_pointer or a fresh array is created.
We use super_dec_solve and super_get to denote the methods of the underlying solver (bv_refinementt by default). The refinement loop relies on functions string_refinementt::check_axioms which returns true when the set of quantified constraints q is satisfied by the valuation given bysuper_get and string_refinementt::instantiate which gives propositional formulas implied by a string constraint. If the following algorithm returns SAT or UNSAT, the given constraints are SAT or UNSAT respectively:
resultt::D_SATISFIABLE if the constraints are satisfiable, resultt::D_UNSATISFIABLE if they are unsatisfiable, resultt::D_ERROR if the limit of iteration was reached. Reimplemented from bv_refinementt.
Definition at line 615 of file string_refinement.cpp.
|
inlineoverridevirtual |
Return a textual description of the decision procedure.
Reimplemented from bv_refinementt.
Definition at line 80 of file string_refinement.h.
Evaluates the given expression in the valuation found by string_refinementt::dec_solve.
Arrays of characters are interpreted differently from the result of supert::get: values are propagated to the left to fill unknown.
| expr | an expression |
Reimplemented from boolbvt.
Definition at line 1829 of file string_refinement.cpp.
Record the constraints to ensure that the expression is true when the boolean is true and false otherwise.
| expr | an expression of type bool |
| value | the boolean value to set it to |
Reimplemented from boolbvt.
Definition at line 283 of file string_refinement.cpp.
|
related |
Instantiates a quantified formula representing not_contains by substituting the quantifiers and generating axioms.
| [in] | axiom | the axiom to instantiate |
| [in] | index_pairs | pair of indexes for axiom.s0()and axiom.s1() |
| [in] | witnesses | axiom's witnesses for non containment |
Definition at line 203 of file string_constraint_instantiation.cpp.
|
private |
Definition at line 104 of file string_refinement.h.
Definition at line 97 of file string_refinement.h.
|
private |
Definition at line 107 of file string_refinement.h.
|
private |
Definition at line 117 of file string_refinement.h.
|
private |
Definition at line 115 of file string_refinement.h.
|
private |
Definition at line 99 of file string_refinement.h.
|
private |
Definition at line 112 of file string_refinement.h.
|
private |
Definition at line 98 of file string_refinement.h.
|
private |
Definition at line 102 of file string_refinement.h.
|
private |
Definition at line 113 of file string_refinement.h.