Z3
 
Loading...
Searching...
No Matches
Tactic.cs
Go to the documentation of this file.
1/*++
2Copyright (c) 2012 Microsoft Corporation
3
4Module Name:
5
6 Tactic.cs
7
8Abstract:
9
10 Z3 Managed API: Tactics
11
12Author:
13
14 Christoph Wintersteiger (cwinter) 2012-03-21
15
16Notes:
17
18--*/
19
20using System;
21using System.Diagnostics;
22
23namespace Microsoft.Z3
24{
31 public class Tactic : Z3Object
32 {
36 public string Help
37 {
38 get
39 {
40
41 return Native.Z3_tactic_get_help(Context.nCtx, NativeObject);
42 }
43 }
44
45
50 {
51 get { return new ParamDescrs(Context, Native.Z3_tactic_get_param_descrs(Context.nCtx, NativeObject)); }
52 }
53
54
58 public ApplyResult Apply(Goal g, Params p = null)
59 {
60 Debug.Assert(g != null);
61
62 Context.CheckContextMatch(g);
63 if (p == null)
64 return new ApplyResult(Context, Native.Z3_tactic_apply(Context.nCtx, NativeObject, g.NativeObject));
65 else
66 {
67 Context.CheckContextMatch(p);
68 return new ApplyResult(Context, Native.Z3_tactic_apply_ex(Context.nCtx, NativeObject, g.NativeObject, p.NativeObject));
69 }
70 }
71
75 public ApplyResult this[Goal g]
76 {
77 get
78 {
79 Debug.Assert(g != null);
80
81 return Apply(g);
82 }
83 }
84
90 {
91 get
92 {
93
94 return Context.MkSolver(this);
95 }
96 }
97
98 #region Internal
99 internal Tactic(Context ctx, IntPtr obj)
100 : base(ctx, obj)
101 {
102 Debug.Assert(ctx != null);
103 }
104 internal Tactic(Context ctx, string name)
105 : base(ctx, Native.Z3_mk_tactic(ctx.nCtx, name))
106 {
107 Debug.Assert(ctx != null);
108 }
109
110 internal override void IncRef(IntPtr o)
111 {
112 Native.Z3_tactic_inc_ref(Context.nCtx, o);
113 }
114
115 internal override void DecRef(IntPtr o)
116 {
117 lock (Context)
118 {
119 if (Context.nCtx != IntPtr.Zero)
120 Native.Z3_tactic_dec_ref(Context.nCtx, o);
121 }
122 }
123 #endregion
124 }
125}
ApplyResult objects represent the result of an application of a tactic to a goal. It contains the sub...
The main interaction with Z3 happens via the Context.
Definition Context.cs:34
Solver MkSolver(Symbol logic=null)
Creates a new (incremental) solver.
Definition Context.cs:4010
A goal (aka problem). A goal is essentially a set of formulas, that can be solved and/or transformed ...
Definition Goal.cs:32
A ParamDescrs describes a set of parameters.
A Params objects represents a configuration in the form of Symbol/value pairs.
Definition Params.cs:29
Tactics are the basic building block for creating custom solvers for specific problem domains....
Definition Tactic.cs:32
string Help
A string containing a description of parameters accepted by the tactic.
Definition Tactic.cs:37
ParamDescrs ParameterDescriptions
Retrieves parameter descriptions for Tactics.
Definition Tactic.cs:50
ApplyResult Apply(Goal g, Params p=null)
Execute the tactic over the goal.
Definition Tactic.cs:58
Internal base class for interfacing with native Z3 objects. Should not be used externally.
Definition Z3Object.cs:33
Context Context
Access Context object.
Definition Z3Object.cs:111
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...