mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 09:05:31 +00:00
expr utilities for pb
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
39333273a5
commit
7bd4a313dd
2 changed files with 45 additions and 0 deletions
|
@ -89,6 +89,15 @@ namespace Microsoft.Z3
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The i'th argument of the expression.
|
||||
/// </summary>
|
||||
public Expr Arg(uint i)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<Expr>() != null);
|
||||
return Expr.Create(Context, Native.Z3_get_app_arg(Context.nCtx, NativeObject, i));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the arguments of the expression using the arguments <paramref name="args"/>
|
||||
/// The number of new arguments should coincide with the current number of arguments.
|
||||
|
@ -315,6 +324,41 @@ namespace Microsoft.Z3
|
|||
/// </summary>
|
||||
public bool IsImplies { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_IMPLIES; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is at-most
|
||||
/// </summary>
|
||||
public bool IsAtMost { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PB_AT_MOST; } }
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve bound of at-most
|
||||
/// </summary>
|
||||
public uint AtMostBound { get { Contract.Requires(IsAtMost); return (uint)FuncDecl.Parameters[0].Int; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is at-least
|
||||
/// </summary>
|
||||
public bool IsAtLeast { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PB_AT_LEAST; } }
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve bound of at-least
|
||||
/// </summary>
|
||||
public uint AtLeastBound { get { Contract.Requires(IsAtLeast); return (uint)FuncDecl.Parameters[0].Int; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is pbeq
|
||||
/// </summary>
|
||||
public bool IsPbEq { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PB_EQ; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is pble
|
||||
/// </summary>
|
||||
public bool IsPbLe { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PB_LE; } }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the term is pbge
|
||||
/// </summary>
|
||||
public bool IsPbGe { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PB_GE; } }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Arithmetic Terms
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue