Public Member Functions | Friends
goal Class Reference
+ Inheritance diagram for goal:

Public Member Functions

 goal (context &c, bool models=true, bool unsat_cores=false, bool proofs=false)
 goal (context &c, Z3_goal s)
 goal (goal const &s)
 ~goal ()
 operator Z3_goal () const
goaloperator= (goal const &s)
void add (expr const &f)
void add (expr_vector const &v)
unsigned size () const
expr operator[] (int i) const
Z3_goal_prec precision () const
bool inconsistent () const
unsigned depth () const
void reset ()
unsigned num_exprs () const
bool is_decided_sat () const
bool is_decided_unsat () const
model convert_model (model const &m) const
model get_model () const
expr as_expr () const
std::string dimacs (bool include_names=true) const
- Public Member Functions inherited from object
 object (context &c)
contextctx () const
Z3_error_code check_error () const


std::ostream & operator<< (std::ostream &out, goal const &g)

Additional Inherited Members

- Protected Attributes inherited from object

Detailed Description

Definition at line 2899 of file z3++.h.

Constructor & Destructor Documentation

◆ goal() [1/3]

goal ( context c,
bool  models = true,
bool  unsat_cores = false,
bool  proofs = false 

Definition at line 2906 of file z3++.h.

2906 :object(c) { init(Z3_mk_goal(c, models, unsat_cores, proofs)); }
object(context &c)
Definition: z3++.h:462
Z3_goal Z3_API Z3_mk_goal(Z3_context c, bool models, bool unsat_cores, bool proofs)
Create a goal (aka problem). A goal is essentially a set of formulas, that can be solved and/or trans...

Referenced by Goal::__del__(), Goal::assert_exprs(), Goal::convert_model(), Goal::depth(), Goal::dimacs(), Goal::get(), Goal::inconsistent(), Goal::prec(), Goal::sexpr(), Goal::size(), and Goal::translate().

◆ goal() [2/3]

goal ( context c,
Z3_goal  s 

◆ goal() [3/3]

goal ( goal const &  s)

◆ ~goal()

~goal ( )

Definition at line 2909 of file z3++.h.

2909 { Z3_goal_dec_ref(ctx(), m_goal); }
context & ctx() const
Definition: z3++.h:463
void Z3_API Z3_goal_dec_ref(Z3_context c, Z3_goal g)
Decrement the reference counter of the given goal.

Member Function Documentation

◆ add() [1/2]

void add ( expr const &  f)

Definition at line 2918 of file z3++.h.

2918 { check_context(*this, f); Z3_goal_assert(ctx(), m_goal, f); check_error(); }
Z3_error_code check_error() const
Definition: z3++.h:464
friend void check_context(object const &a, object const &b)
Definition: z3++.h:467
void Z3_API Z3_goal_assert(Z3_context c, Z3_goal g, Z3_ast a)
Add a new formula a to the given goal. The formula is split according to the following procedure that...

Referenced by Solver::__iadd__(), Fixedpoint::__iadd__(), and Optimize::__iadd__().

◆ add() [2/2]

void add ( expr_vector const &  v)

Definition at line 2919 of file z3++.h.

2919 { check_context(*this, v); for (unsigned i = 0; i < v.size(); ++i) add(v[i]); }
void add(expr const &f)
Definition: z3++.h:2918

Referenced by Solver::__iadd__(), Fixedpoint::__iadd__(), Optimize::__iadd__(), and goal::add().

◆ as_expr()

expr as_expr ( ) const

Definition at line 2940 of file z3++.h.

2940  {
2941  unsigned n = size();
2942  if (n == 0)
2943  return ctx().bool_val(true);
2944  else if (n == 1)
2945  return operator[](0u);
2946  else {
2947  array<Z3_ast> args(n);
2948  for (unsigned i = 0; i < n; i++)
2949  args[i] = operator[](i);
2950  return expr(ctx(), Z3_mk_and(ctx(), n, args.ptr()));
2951  }
2952  }
expr bool_val(bool b)
Definition: z3++.h:3625
unsigned size() const
Definition: z3++.h:2920
expr operator[](int i) const
Definition: z3++.h:2921
Z3_ast Z3_API Z3_mk_and(Z3_context c, unsigned num_args, Z3_ast const args[])
Create an AST node representing args[0] and ... and args[num_args-1].

◆ convert_model()

model convert_model ( model const &  m) const

Definition at line 2929 of file z3++.h.

2929  {
2930  check_context(*this, m);
2931  Z3_model new_m = Z3_goal_convert_model(ctx(), m_goal, m);
2932  check_error();
2933  return model(ctx(), new_m);
2934  }
Z3_model Z3_API Z3_goal_convert_model(Z3_context c, Z3_goal g, Z3_model m)
Convert a model of the formulas of a goal to a model of an original goal. The model may be null,...
System.IntPtr Z3_model

◆ depth()

unsigned depth ( ) const

Definition at line 2924 of file z3++.h.

2924 { return Z3_goal_depth(ctx(), m_goal); }
unsigned Z3_API Z3_goal_depth(Z3_context c, Z3_goal g)
Return the depth of the given goal. It tracks how many transformations were applied to it.

◆ dimacs()

std::string dimacs ( bool  include_names = true) const

Definition at line 2953 of file z3++.h.

2953 { return std::string(Z3_goal_to_dimacs_string(ctx(), m_goal, include_names)); }
Z3_string Z3_API Z3_goal_to_dimacs_string(Z3_context c, Z3_goal g, bool include_names)
Convert a goal into a DIMACS formatted string. The goal must be in CNF. You can convert a goal to CNF...

◆ get_model()

model get_model ( ) const

Definition at line 2935 of file z3++.h.

2935  {
2936  Z3_model new_m = Z3_goal_convert_model(ctx(), m_goal, 0);
2937  check_error();
2938  return model(ctx(), new_m);
2939  }

◆ inconsistent()

bool inconsistent ( ) const

Definition at line 2923 of file z3++.h.

2923 { return Z3_goal_inconsistent(ctx(), m_goal); }
bool Z3_API Z3_goal_inconsistent(Z3_context c, Z3_goal g)
Return true if the given goal contains the formula false.

◆ is_decided_sat()

bool is_decided_sat ( ) const

Definition at line 2927 of file z3++.h.

2927 { return Z3_goal_is_decided_sat(ctx(), m_goal); }
bool Z3_API Z3_goal_is_decided_sat(Z3_context c, Z3_goal g)
Return true if the goal is empty, and it is precise or the product of a under approximation.

◆ is_decided_unsat()

bool is_decided_unsat ( ) const

Definition at line 2928 of file z3++.h.

2928 { return Z3_goal_is_decided_unsat(ctx(), m_goal); }
bool Z3_API Z3_goal_is_decided_unsat(Z3_context c, Z3_goal g)
Return true if the goal contains false, and it is precise or the product of an over approximation.

◆ num_exprs()

unsigned num_exprs ( ) const

Definition at line 2926 of file z3++.h.

2926 { return Z3_goal_num_exprs(ctx(), m_goal); }
unsigned Z3_API Z3_goal_num_exprs(Z3_context c, Z3_goal g)
Return the number of formulas, subformulas and terms in the given goal.

◆ operator Z3_goal()

operator Z3_goal ( ) const

Definition at line 2910 of file z3++.h.

2910 { return m_goal; }

◆ operator=()

goal& operator= ( goal const &  s)

Definition at line 2911 of file z3++.h.

2911  {
2912  Z3_goal_inc_ref(s.ctx(), s.m_goal);
2913  Z3_goal_dec_ref(ctx(), m_goal);
2914  object::operator=(s);
2915  m_goal = s.m_goal;
2916  return *this;
2917  }
void Z3_API Z3_goal_inc_ref(Z3_context c, Z3_goal g)
Increment the reference counter of the given goal.

◆ operator[]()

expr operator[] ( int  i) const

Definition at line 2921 of file z3++.h.

2921 { assert(0 <= i); Z3_ast r = Z3_goal_formula(ctx(), m_goal, i); check_error(); return expr(ctx(), r); }
Z3_ast Z3_API Z3_goal_formula(Z3_context c, Z3_goal g, unsigned idx)
Return a formula from the given goal.
System.IntPtr Z3_ast

Referenced by goal::as_expr().

◆ precision()

Z3_goal_prec precision ( ) const

Definition at line 2922 of file z3++.h.

2922 { return Z3_goal_precision(ctx(), m_goal); }
Z3_goal_prec Z3_API Z3_goal_precision(Z3_context c, Z3_goal g)
Return the "precision" of the given goal. Goals can be transformed using over and under approximation...

◆ reset()

void reset ( )

Definition at line 2925 of file z3++.h.

2925 { Z3_goal_reset(ctx(), m_goal); }
void Z3_API Z3_goal_reset(Z3_context c, Z3_goal g)
Erase all formulas from the given goal.

◆ size()

unsigned size ( ) const

Definition at line 2920 of file z3++.h.

2920 { return Z3_goal_size(ctx(), m_goal); }
unsigned Z3_API Z3_goal_size(Z3_context c, Z3_goal g)
Return the number of formulas in the given goal.

Referenced by ParamDescrsRef::__len__(), Goal::__len__(), goal::as_expr(), BitVecNumRef::as_signed_long(), and BitVecSortRef::subsort().

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
goal const &  g 

Definition at line 2956 of file z3++.h.

2956 { out << Z3_goal_to_string(g.ctx(), g); return out; }
Z3_string Z3_API Z3_goal_to_string(Z3_context c, Z3_goal g)
Convert a goal into a string.