3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-09-01 07:40:41 +00:00

add simplifiers to .net API

This commit is contained in:
Nikolaj Bjorner 2023-02-02 17:41:00 -08:00
parent 72e7a8a481
commit 2e068e3f56
5 changed files with 199 additions and 4 deletions

View file

@ -0,0 +1,78 @@
/*++
Copyright (c) 2012 Microsoft Corporation
Module Name:
Tactic.cs
Abstract:
Z3 Managed API: Simplifiers
Author:
Christoph Wintersteiger (cwinter) 2012-03-21
--*/
using System;
using System.Diagnostics;
namespace Microsoft.Z3
{
/// <summary>
/// Simplifiers are the basic building block for creating custom solvers with incremental pre-processing.
/// The complete list of simplifiers may be obtained using <c>Context.NumSimplifiers</c>
/// and <c>Context.SimplifierNames</c>.
/// It may also be obtained using the command <c>(help-simplifier)</c> in the SMT 2.0 front-end.
/// </summary>
public class Simplifier : Z3Object
{
/// <summary>
/// A string containing a description of parameters accepted by the tactic.
/// </summary>
public string Help
{
get
{
return Native.Z3_simplifier_get_help(Context.nCtx, NativeObject);
}
}
/// <summary>
/// Retrieves parameter descriptions for Simplifiers.
/// </summary>
public ParamDescrs ParameterDescriptions
{
get { return new ParamDescrs(Context, Native.Z3_simplifier_get_param_descrs(Context.nCtx, NativeObject)); }
}
#region Internal
internal Simplifier(Context ctx, IntPtr obj)
: base(ctx, obj)
{
Debug.Assert(ctx != null);
}
internal Simplifier(Context ctx, string name)
: base(ctx, Native.Z3_mk_simplifier(ctx.nCtx, name))
{
Debug.Assert(ctx != null);
}
internal override void IncRef(IntPtr o)
{
Native.Z3_simplifier_inc_ref(Context.nCtx, o);
}
internal override void DecRef(IntPtr o)
{
lock (Context)
{
if (Context.nCtx != IntPtr.Zero)
Native.Z3_simplifier_dec_ref(Context.nCtx, o);
}
}
#endregion
}
}