Z3
IntSymbol.cs
Go to the documentation of this file.
1/*++
2Copyright (c) 2012 Microsoft Corporation
3
4Module Name:
5
6 IntSymbol.cs
7
8Abstract:
9
10 Z3 Managed API: Int Symbols
11
12Author:
13
14 Christoph Wintersteiger (cwinter) 2012-11-23
15
16Notes:
17
18--*/
19
20using System;
21using System.Diagnostics;
22using System.Runtime.InteropServices;
23
24namespace Microsoft.Z3
25{
29 public class IntSymbol : Symbol
30 {
35 public int Int
36 {
37 get
38 {
39 if (!IsIntSymbol())
40 throw new Z3Exception("Int requested from non-Int symbol");
41 return Native.Z3_get_symbol_int(Context.nCtx, NativeObject);
42 }
43 }
44
45 #region Internal
46 internal IntSymbol(Context ctx, IntPtr obj)
47 : base(ctx, obj)
48 {
49 Debug.Assert(ctx != null);
50 }
51 internal IntSymbol(Context ctx, int i)
52 : base(ctx, Native.Z3_mk_int_symbol(ctx.nCtx, i))
53 {
54 Debug.Assert(ctx != null);
55 }
56
57#if DEBUG
58 internal override void CheckNativeObject(IntPtr obj)
59 {
60 if ((Z3_symbol_kind)Native.Z3_get_symbol_kind(Context.nCtx, obj) != Z3_symbol_kind.Z3_INT_SYMBOL)
61 throw new Z3Exception("Symbol is not of integer kind");
62 base.CheckNativeObject(obj);
63 }
64#endif
65 #endregion
66 }
67}
The main interaction with Z3 happens via the Context.
Definition: Context.cs:32
Numbered symbols
Definition: IntSymbol.cs:30
int Int
The int value of the symbol.
Definition: IntSymbol.cs:36
Symbols are used to name several term and type constructors.
Definition: Symbol.cs:30
bool IsIntSymbol()
Indicates whether the symbol is of Int kind
Definition: Symbol.cs:42
The exception base class for error reporting from Z3
Definition: Z3Exception.cs:32
Z3_symbol_kind
The different kinds of symbol. In Z3, a symbol can be represented using integers and strings (See Z3_...
Definition: z3_api.h:116
Z3_symbol Z3_API Z3_mk_int_symbol(Z3_context c, int i)
Create a Z3 symbol using an integer.