Z3
Loading...
Searching...
No Matches
tactic Class Reference

#include <z3++.h>

Inheritance diagram for tactic:

Public Member Functions

 tactic (context &c, char const *name)
 tactic (context &c, Z3_tactic s)
 tactic (tactic const &s)
 ~tactic () override
 operator Z3_tactic () const
tactic & operator= (tactic const &s)
solver mk_solver () const
apply_result apply (goal const &g) const
apply_result operator() (goal const &g) const
std::string help () const
param_descrs get_param_descrs ()
Public Member Functions inherited from object
 object (context &c)
virtual ~object ()=default
context & ctx () const
Z3_error_code check_error () const

Friends

tactic operator& (tactic const &t1, tactic const &t2)
tactic operator| (tactic const &t1, tactic const &t2)
tactic repeat (tactic const &t, unsigned max=UINT_MAX)
tactic with (tactic const &t, params const &p)
tactic try_for (tactic const &t, unsigned ms)
tactic par_or (unsigned n, tactic const *tactics)
tactic par_and_then (tactic const &t1, tactic const &t2)

Additional Inherited Members

Protected Attributes inherited from object
context * m_ctx

Detailed Description

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

Constructor & Destructor Documentation

◆ tactic() [1/3]

tactic ( context & c,
char const * name )
inline

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

3446:object(c) { Z3_tactic r = Z3_mk_tactic(c, name); check_error(); init(r); }
Z3_tactic Z3_API Z3_mk_tactic(Z3_context c, Z3_string name)
Return a tactic associated with the given name. The complete list of tactics may be obtained using th...

Referenced by z3::cond(), z3::fail_if(), operator&, operator=(), operator|, par_and_then, par_or, repeat, tactic(), try_for, z3::when(), and with.

◆ tactic() [2/3]

tactic ( context & c,
Z3_tactic s )
inline

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

3447:object(c) { init(s); }

◆ tactic() [3/3]

tactic ( tactic const & s)
inline

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

3448:object(s) { init(s.m_tactic); }

◆ ~tactic()

~tactic ( )
inlineoverride

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

3449{ Z3_tactic_dec_ref(ctx(), m_tactic); }
void Z3_API Z3_tactic_dec_ref(Z3_context c, Z3_tactic g)
Decrement the reference counter of the given tactic.

Member Function Documentation

◆ apply()

apply_result apply ( goal const & g) const
inline

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

3459 {
3460 check_context(*this, g);
3461 Z3_apply_result r = Z3_tactic_apply(ctx(), m_tactic, g);
3462 check_error();
3463 return apply_result(ctx(), r);
3464 }
Z3_apply_result Z3_API Z3_tactic_apply(Z3_context c, Z3_tactic t, Z3_goal g)
Apply tactic t to the goal g.
void check_context(object const &a, object const &b)
Definition z3++.h:566

Referenced by operator()().

◆ get_param_descrs()

param_descrs get_param_descrs ( )
inline

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

3476{ return param_descrs(ctx(), Z3_tactic_get_param_descrs(ctx(), m_tactic)); }
Z3_param_descrs Z3_API Z3_tactic_get_param_descrs(Z3_context c, Z3_tactic t)
Return the parameter description set for the given tactic object.

◆ help()

std::string help ( ) const
inline

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

3468{ char const * r = Z3_tactic_get_help(ctx(), m_tactic); check_error(); return r; }
Z3_string Z3_API Z3_tactic_get_help(Z3_context c, Z3_tactic t)
Return a string containing a description of parameters accepted by the given tactic.

◆ mk_solver()

solver mk_solver ( ) const
inline

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

3458{ Z3_solver r = Z3_mk_solver_from_tactic(ctx(), m_tactic); check_error(); return solver(ctx(), r); }
Z3_solver Z3_API Z3_mk_solver_from_tactic(Z3_context c, Z3_tactic t)
Create a new solver that is implemented using the given tactic. The solver supports the commands Z3_s...

◆ operator Z3_tactic()

operator Z3_tactic ( ) const
inline

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

3450{ return m_tactic; }

◆ operator()()

apply_result operator() ( goal const & g) const
inline

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

3465 {
3466 return apply(g);
3467 }

◆ operator=()

tactic & operator= ( tactic const & s)
inline

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

3451 {
3452 Z3_tactic_inc_ref(s.ctx(), s.m_tactic);
3453 Z3_tactic_dec_ref(ctx(), m_tactic);
3454 object::operator=(s);
3455 m_tactic = s.m_tactic;
3456 return *this;
3457 }
void Z3_API Z3_tactic_inc_ref(Z3_context c, Z3_tactic t)
Increment the reference counter of the given tactic.

◆ operator&

tactic operator& ( tactic const & t1,
tactic const & t2 )
friend

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

3479 {
3480 check_context(t1, t2);
3481 Z3_tactic r = Z3_tactic_and_then(t1.ctx(), t1, t2);
3482 t1.check_error();
3483 return tactic(t1.ctx(), r);
3484 }
Z3_tactic Z3_API Z3_tactic_and_then(Z3_context c, Z3_tactic t1, Z3_tactic t2)
Return a tactic that applies t1 to a given goal and t2 to every subgoal produced by t1.

Referenced by operator&.

◆ operator|

tactic operator| ( tactic const & t1,
tactic const & t2 )
friend

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

3486 {
3487 check_context(t1, t2);
3488 Z3_tactic r = Z3_tactic_or_else(t1.ctx(), t1, t2);
3489 t1.check_error();
3490 return tactic(t1.ctx(), r);
3491 }
Z3_tactic Z3_API Z3_tactic_or_else(Z3_context c, Z3_tactic t1, Z3_tactic t2)
Return a tactic that first applies t1 to a given goal, if it fails then returns the result of t2 appl...

Referenced by operator|.

◆ par_and_then

tactic par_and_then ( tactic const & t1,
tactic const & t2 )
friend

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

3518 {
3519 check_context(t1, t2);
3520 Z3_tactic r = Z3_tactic_par_and_then(t1.ctx(), t1, t2);
3521 t1.check_error();
3522 return tactic(t1.ctx(), r);
3523 }
Z3_tactic Z3_API Z3_tactic_par_and_then(Z3_context c, Z3_tactic t1, Z3_tactic t2)
Return a tactic that applies t1 to a given goal and then t2 to every subgoal produced by t1....

Referenced by par_and_then.

◆ par_or

tactic par_or ( unsigned n,
tactic const * tactics )
friend

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

3509 {
3510 if (n == 0) {
3511 Z3_THROW(exception("a non-zero number of tactics need to be passed to par_or"));
3512 }
3513 array<Z3_tactic> buffer(n);
3514 for (unsigned i = 0; i < n; ++i) buffer[i] = tactics[i];
3515 return tactic(tactics[0u].ctx(), Z3_tactic_par_or(tactics[0u].ctx(), n, buffer.ptr()));
3516 }
Z3_tactic Z3_API Z3_tactic_par_or(Z3_context c, unsigned num, Z3_tactic const ts[])
Return a tactic that applies the given tactics in parallel.
#define Z3_THROW(x)
Definition z3++.h:134

Referenced by par_or.

◆ repeat

tactic repeat ( tactic const & t,
unsigned max = UINT_MAX )
friend

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

3493 {
3494 Z3_tactic r = Z3_tactic_repeat(t.ctx(), t, max);
3495 t.check_error();
3496 return tactic(t.ctx(), r);
3497 }
Z3_tactic Z3_API Z3_tactic_repeat(Z3_context c, Z3_tactic t, unsigned max)
Return a tactic that keeps applying t until the goal is not modified anymore or the maximum number of...

Referenced by repeat.

◆ try_for

tactic try_for ( tactic const & t,
unsigned ms )
friend

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

3504 {
3505 Z3_tactic r = Z3_tactic_try_for(t.ctx(), t, ms);
3506 t.check_error();
3507 return tactic(t.ctx(), r);
3508 }
Z3_tactic Z3_API Z3_tactic_try_for(Z3_context c, Z3_tactic t, unsigned ms)
Return a tactic that applies t to a given goal for ms milliseconds. If t does not terminate in ms mil...

Referenced by try_for.

◆ with

tactic with ( tactic const & t,
params const & p )
friend

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

3499 {
3500 Z3_tactic r = Z3_tactic_using_params(t.ctx(), t, p);
3501 t.check_error();
3502 return tactic(t.ctx(), r);
3503 }
Z3_tactic Z3_API Z3_tactic_using_params(Z3_context c, Z3_tactic t, Z3_params p)
Return a tactic that applies t using the given set of parameters.

Referenced by with.