Z3
TupleSort.cs
Go to the documentation of this file.
1/*++
2Copyright (c) 2012 Microsoft Corporation
3
4Module Name:
5
6 TupleSort.cs
7
8Abstract:
9
10 Z3 Managed API: Tuple Sorts
11
12Author:
13
14 Christoph Wintersteiger (cwinter) 2012-11-23
15
16Notes:
17
18--*/
19
20using System;
21using System.Diagnostics;
22
23namespace Microsoft.Z3
24{
28 public class TupleSort : Sort
29 {
34 {
35 get
36 {
37
38 return new FuncDecl(Context, Native.Z3_get_tuple_sort_mk_decl(Context.nCtx, NativeObject));
39 }
40 }
41
45 public uint NumFields
46 {
47 get { return Native.Z3_get_tuple_sort_num_fields(Context.nCtx, NativeObject); }
48 }
49
54 {
55 get
56 {
57
58 uint n = NumFields;
59 FuncDecl[] res = new FuncDecl[n];
60 for (uint i = 0; i < n; i++)
61 res[i] = new FuncDecl(Context, Native.Z3_get_tuple_sort_field_decl(Context.nCtx, NativeObject, i));
62 return res;
63 }
64 }
65
66 #region Internal
67 internal TupleSort(Context ctx, Symbol name, uint numFields, Symbol[] fieldNames, Sort[] fieldSorts)
68 : base(ctx, IntPtr.Zero)
69 {
70 Debug.Assert(ctx != null);
71 Debug.Assert(name != null);
72
73 IntPtr t = IntPtr.Zero;
74 IntPtr[] f = new IntPtr[numFields];
75 NativeObject = Native.Z3_mk_tuple_sort(ctx.nCtx, name.NativeObject, numFields,
76 Symbol.ArrayToNative(fieldNames), AST.ArrayToNative(fieldSorts),
77 ref t, f);
78 }
79 #endregion
80 };
81}
The abstract syntax tree (AST) class.
Definition: AST.cs:31
The main interaction with Z3 happens via the Context.
Definition: Context.cs:32
Function declarations.
Definition: FuncDecl.cs:31
The Sort class implements type information for ASTs.
Definition: Sort.cs:29
Symbols are used to name several term and type constructors.
Definition: Symbol.cs:30
uint NumFields
The number of fields in the tuple.
Definition: TupleSort.cs:46
FuncDecl MkDecl
The constructor function of the tuple.
Definition: TupleSort.cs:34
FuncDecl[] FieldDecls
The field declarations.
Definition: TupleSort.cs:54