CBMC
cegis_evaluator.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Evaluate if an expression is consistent with examples
4 
5 Author: Qinheping Hu
6 
7 \*******************************************************************/
8 
11 
12 #ifndef CPROVER_GOTO_SYNTHESIZER_CEGIS_EVALUATOR_H
13 #define CPROVER_GOTO_SYNTHESIZER_CEGIS_EVALUATOR_H
14 
15 #include "cegis_verifier.h"
16 
20 {
21 public:
22  cegis_evaluatort(const exprt &expr, const std::vector<cext> &cexs)
23  : checked_expr(expr), cexs(cexs)
24  {
25  }
26 
27  // Evaluate if the expression `checked_expr` is consistent with `cexs`.
28  // Return true if `checked_expr` is consistent with all examples.
29  bool evaluate();
30 
31 protected:
32  // Recursively evaluate boolean expressions on `cex`.
33  // If `is_positive` is set, evaluate on the positive example in `cex`.
34  // The positive example is the test collected from the first iteration of
35  // loop---the loop_entry valuation.
36  bool
37  evaluate_rec_bool(const exprt &expr, const cext &cex, const bool is_positive);
38 
39  // Recursively evaluate integer expressions on `cex`.
40  // If `is_positive` is set, evaluate on the positive example in `cex`.
41  // The positive example is the test collected from the first iteration of
42  // loop---the loop_entry valuation.
44  evaluate_rec_int(const exprt &expr, const cext &cex, const bool is_positive);
45 
49  const std::vector<cext> &cexs;
50 };
51 
52 #endif // CPROVER_GOTO_SYNTHESIZER_CEGIS_EVALUATOR_H
Verifier for Counterexample-Guided Synthesis.
Evaluator for checking if an expression is consistent with a given set of test cases (positive exampl...
const std::vector< cext > & cexs
The set of examples evaluated against.
const exprt & checked_expr
The expression being evaluated.
bool evaluate_rec_bool(const exprt &expr, const cext &cex, const bool is_positive)
mp_integer evaluate_rec_int(const exprt &expr, const cext &cex, const bool is_positive)
cegis_evaluatort(const exprt &expr, const std::vector< cext > &cexs)
Formatted counterexample.
Base class for all expressions.
Definition: expr.h:56
BigInt mp_integer
Definition: smt_terms.h:17
exprt is_positive(const exprt &x)