Z3
 
Loading...
Searching...
No Matches
Expr.cs
Go to the documentation of this file.
1/*++
2Copyright (<c>) 2012 Microsoft Corporation
3
4Module Name:
5
6 Expr.cs
7
8Abstract:
9
10 Z3 Managed API: Expressions
11
12Author:
13
14 Christoph Wintersteiger (cwinter) 2012-03-20
15
16Notes:
17
18--*/
19
20using System.Diagnostics;
21using System;
22using System.Linq;
23
24
25namespace Microsoft.Z3
26{
30 public class Expr : AST
31 {
37 public Expr Simplify(Params p = null)
38 {
39
40 if (p == null)
41 return Expr.Create(Context, Native.Z3_simplify(Context.nCtx, NativeObject));
42 else
43 return Expr.Create(Context, Native.Z3_simplify_ex(Context.nCtx, NativeObject, p.NativeObject));
44 }
45
50 {
51 get
52 {
53 return new FuncDecl(Context, Native.Z3_get_app_decl(Context.nCtx, NativeObject));
54 }
55 }
56
62 {
63 get { return (Z3_lbool)Native.Z3_get_bool_value(Context.nCtx, NativeObject); }
64 }
65
69 public uint NumArgs
70 {
71 get { return Native.Z3_get_app_num_args(Context.nCtx, NativeObject); }
72 }
73
77 public Expr[] Args
78 {
79 get
80 {
81
82 uint n = NumArgs;
83 Expr[] res = new Expr[n];
84 for (uint i = 0; i < n; i++)
85 res[i] = Expr.Create(Context, Native.Z3_get_app_arg(Context.nCtx, NativeObject, i));
86 return res;
87 }
88 }
89
93 public Expr Arg(uint i)
94 {
95 return Expr.Create(Context, Native.Z3_get_app_arg(Context.nCtx, NativeObject, i));
96 }
97
102 public void Update(Expr[] args)
103 {
104 Debug.Assert(args != null);
105 Debug.Assert(args.All(a => a != null));
106
107 Context.CheckContextMatch<Expr>(args);
108 if (IsApp && args.Length != NumArgs)
109 throw new Z3Exception("Number of arguments does not match");
110 NativeObject = Native.Z3_update_term(Context.nCtx, NativeObject, (uint)args.Length, Expr.ArrayToNative(args));
111 }
112
121 public Expr Substitute(Expr[] from, Expr[] to)
122 {
123 Debug.Assert(from != null);
124 Debug.Assert(to != null);
125 Debug.Assert(from.All(f => f != null));
126 Debug.Assert(to.All(t => t != null));
127
128 Context.CheckContextMatch<Expr>(from);
129 Context.CheckContextMatch<Expr>(to);
130 if (from.Length != to.Length)
131 throw new Z3Exception("Argument sizes do not match");
132 return Expr.Create(Context, Native.Z3_substitute(Context.nCtx, NativeObject, (uint)from.Length, Expr.ArrayToNative(from), Expr.ArrayToNative(to)));
133 }
134
139 public Expr Substitute(Expr from, Expr to)
140 {
141 Debug.Assert(from != null);
142 Debug.Assert(to != null);
143
144 return Substitute(new Expr[] { from }, new Expr[] { to });
145 }
146
154 {
155 Debug.Assert(to != null);
156 Debug.Assert(to.All(t => t != null));
157
158 Context.CheckContextMatch<Expr>(to);
159 return Expr.Create(Context, Native.Z3_substitute_vars(Context.nCtx, NativeObject, (uint)to.Length, Expr.ArrayToNative(to)));
160 }
161
170 public Expr SubstituteFuns(FuncDecl[] from, Expr[] to)
171 {
172 Debug.Assert(from != null);
173 Debug.Assert(to != null);
174 Debug.Assert(from.All(f => f != null));
175 Debug.Assert(to.All(t => t != null));
176
177 Context.CheckContextMatch<FuncDecl>(from);
178 Context.CheckContextMatch<Expr>(to);
179 if (from.Length != to.Length)
180 throw new Z3Exception("Arrays 'from' and 'to' must have the same length");
181 return Expr.Create(Context, Native.Z3_substitute_funs(Context.nCtx, NativeObject, (uint)from.Length, FuncDecl.ArrayToNative(from), Expr.ArrayToNative(to)));
182 }
183
189 new public Expr Translate(Context ctx)
190 {
191 return (Expr)base.Translate(ctx);
192 }
193
200 public Expr Dup() {
201 return Expr.Create(Context, NativeObject);
202 }
203
207 public override string ToString()
208 {
209 return base.ToString();
210 }
211
215 public bool IsNumeral
216 {
217 get { return Native.Z3_is_numeral_ast(Context.nCtx, NativeObject) != 0; }
218 }
219
224 public bool IsWellSorted
225 {
226 get { return Native.Z3_is_well_sorted(Context.nCtx, NativeObject) != 0; }
227 }
228
232 public Sort Sort
233 {
234 get
235 {
236 return Sort.Create(Context, Native.Z3_get_sort(Context.nCtx, NativeObject));
237 }
238 }
239
240 #region Constants
244 public bool IsConst
245 {
246 get { return IsApp && NumArgs == 0 && FuncDecl.DomainSize == 0; }
247 }
248 #endregion
249
250 #region Integer Numerals
254 public bool IsIntNum
255 {
256 get { return IsNumeral && IsInt; }
257 }
258 #endregion
259
260 #region Real Numerals
264 public bool IsRatNum
265 {
266 get { return IsNumeral && IsReal; }
267 }
268 #endregion
269
270 #region Algebraic Numbers
275 {
276 get { return 0 != Native.Z3_is_algebraic_number(Context.nCtx, NativeObject); }
277 }
278 #endregion
279
280 #region Term Kind Tests
281
282 #region Boolean Terms
286 public bool IsBool
287 {
288 get
289 {
290 return (IsExpr &&
291 Native.Z3_is_eq_sort(Context.nCtx,
292 Native.Z3_mk_bool_sort(Context.nCtx),
293 Native.Z3_get_sort(Context.nCtx, NativeObject)) != 0);
294 }
295 }
296
300 public bool IsTrue { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_TRUE; } }
301
305 public bool IsFalse { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FALSE; } }
306
310 public bool IsEq { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_EQ; } }
311
315 public bool IsDistinct { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_DISTINCT; } }
316
320 public bool IsITE { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_ITE; } }
321
325 public bool IsAnd { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_AND; } }
326
330 public bool IsOr { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_OR; } }
331
335 public bool IsIff { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_IFF; } }
336
340 public bool IsXor { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_XOR; } }
341
345 public bool IsNot { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_NOT; } }
346
350 public bool IsImplies { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_IMPLIES; } }
351
355 public bool IsAtMost { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PB_AT_MOST; } }
356
360 public uint AtMostBound { get { Debug.Assert(IsAtMost); return (uint)FuncDecl.Parameters[0].Int; } }
361
365 public bool IsAtLeast { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PB_AT_LEAST; } }
366
370 public uint AtLeastBound { get { Debug.Assert(IsAtLeast); return (uint)FuncDecl.Parameters[0].Int; } }
371
375 public bool IsPbEq { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PB_EQ; } }
376
380 public bool IsPbLe { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PB_LE; } }
381
385 public bool IsPbGe { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PB_GE; } }
386
387 #endregion
388
389 #region Arithmetic Terms
393 public bool IsInt
394 {
395 get { return Native.Z3_get_sort_kind(Context.nCtx, Native.Z3_get_sort(Context.nCtx, NativeObject)) == (uint)Z3_sort_kind.Z3_INT_SORT; }
396 }
397
401 public bool IsReal
402 {
403 get { return Native.Z3_get_sort_kind(Context.nCtx, Native.Z3_get_sort(Context.nCtx, NativeObject)) == (uint)Z3_sort_kind.Z3_REAL_SORT; }
404 }
405
407 public bool IsComplex
408 {
409 get { return Native.Z3_get_sort_kind(Context.nCtx, Native.Z3_get_sort(Context.nCtx, NativeObject)) == (uint)Z3_sort_kind.Z3_COMPLEX_SORT; }
410 }
411
415 public bool IsArithmeticNumeral { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_ANUM; } }
416
420 public bool IsLE { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_LE; } }
421
425 public bool IsGE { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_GE; } }
426
430 public bool IsLT { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_LT; } }
431
435 public bool IsGT { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_GT; } }
436
440 public bool IsAdd { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_ADD; } }
441
445 public bool IsSub { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SUB; } }
446
450 public bool IsUMinus { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_UMINUS; } }
451
455 public bool IsMul { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_MUL; } }
456
460 public bool IsDiv { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_DIV; } }
461
465 public bool IsIDiv { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_IDIV; } }
466
470 public bool IsRemainder { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_REM; } }
471
475 public bool IsModulus { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_MOD; } }
476
480 public bool IsIntToReal { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_TO_REAL; } }
481
485 public bool IsRealToInt { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_TO_INT; } }
486
490 public bool IsRealIsInt { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_IS_INT; } }
491 #endregion
492
493 #region Array Terms
497 public bool IsArray
498 {
499 get
500 {
501 return (Native.Z3_is_app(Context.nCtx, NativeObject) != 0 &&
502 (Z3_sort_kind)Native.Z3_get_sort_kind(Context.nCtx, Native.Z3_get_sort(Context.nCtx, NativeObject))
503 == Z3_sort_kind.Z3_ARRAY_SORT);
504 }
505 }
506
512 public bool IsStore { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_STORE; } }
513
517 public bool IsSelect { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SELECT; } }
518
523 public bool IsConstantArray { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_CONST_ARRAY; } }
524
529 public bool IsDefaultArray { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_ARRAY_DEFAULT; } }
530
535 public bool IsArrayMap { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_ARRAY_MAP; } }
536
542 public bool IsAsArray { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_AS_ARRAY; } }
543 #endregion
544
545 #region Set Terms
549 public bool IsSetUnion { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SET_UNION; } }
550
554 public bool IsSetIntersect { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SET_INTERSECT; } }
555
559 public bool IsSetDifference { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SET_DIFFERENCE; } }
560
564 public bool IsSetComplement { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SET_COMPLEMENT; } }
565
569 public bool IsSetSubset { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SET_SUBSET; } }
570 #endregion
571
572 #region Bit-vector terms
576 public bool IsBV
577 {
578 get { return Native.Z3_get_sort_kind(Context.nCtx, Native.Z3_get_sort(Context.nCtx, NativeObject)) == (uint)Z3_sort_kind.Z3_BV_SORT; }
579 }
580
584 public bool IsBVNumeral { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BNUM; } }
585
589 public bool IsBVBitOne { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BIT1; } }
590
594 public bool IsBVBitZero { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BIT0; } }
595
599 public bool IsBVUMinus { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BNEG; } }
600
604 public bool IsBVAdd { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BADD; } }
605
609 public bool IsBVSub { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BSUB; } }
610
614 public bool IsBVMul { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BMUL; } }
615
619 public bool IsBVSDiv { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BSDIV; } }
620
624 public bool IsBVUDiv { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BUDIV; } }
625
629 public bool IsBVSRem { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BSREM; } }
630
634 public bool IsBVURem { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BUREM; } }
635
639 public bool IsBVSMod { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BSMOD; } }
640
644 internal bool IsBVSDiv0 { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BSDIV0; } }
645
649 internal bool IsBVUDiv0 { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BUDIV0; } }
650
654 internal bool IsBVSRem0 { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BSREM0; } }
655
659 internal bool IsBVURem0 { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BUREM0; } }
660
664 internal bool IsBVSMod0 { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BSMOD0; } }
665
669 public bool IsBVULE { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_ULEQ; } }
670
674 public bool IsBVSLE { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SLEQ; } }
675
679 public bool IsBVUGE { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_UGEQ; } }
680
684 public bool IsBVSGE { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SGEQ; } }
685
689 public bool IsBVULT { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_ULT; } }
690
694 public bool IsBVSLT { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SLT; } }
695
699 public bool IsBVUGT { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_UGT; } }
700
704 public bool IsBVSGT { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SGT; } }
705
709 public bool IsBVAND { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BAND; } }
710
714 public bool IsBVOR { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BOR; } }
715
719 public bool IsBVNOT { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BNOT; } }
720
724 public bool IsBVXOR { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BXOR; } }
725
729 public bool IsBVNAND { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BNAND; } }
730
734 public bool IsBVNOR { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BNOR; } }
735
739 public bool IsBVXNOR { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BXNOR; } }
740
744 public bool IsBVConcat { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_CONCAT; } }
745
749 public bool IsBVSignExtension { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SIGN_EXT; } }
750
754 public bool IsBVZeroExtension { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_ZERO_EXT; } }
755
759 public bool IsBVExtract { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_EXTRACT; } }
760
764 public bool IsBVRepeat { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_REPEAT; } }
765
769 public bool IsBVReduceOR { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BREDOR; } }
770
774 public bool IsBVReduceAND { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BREDAND; } }
775
779 public bool IsBVComp { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BCOMP; } }
780
784 public bool IsBVShiftLeft { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BSHL; } }
785
789 public bool IsBVShiftRightLogical { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BLSHR; } }
790
794 public bool IsBVShiftRightArithmetic { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BASHR; } }
795
799 public bool IsBVRotateLeft { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_ROTATE_LEFT; } }
800
804 public bool IsBVRotateRight { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_ROTATE_RIGHT; } }
805
810 public bool IsBVRotateLeftExtended { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_EXT_ROTATE_LEFT; } }
811
816 public bool IsBVRotateRightExtended { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_EXT_ROTATE_RIGHT; } }
817
823 public bool IsIntToBV { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_INT2BV; } }
824
830 public bool IsBVToInt { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BV2INT; } }
831
837 public bool IsBVCarry { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_CARRY; } }
838
843 public bool IsBVXOR3 { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_XOR3; } }
844
845 #endregion
846
847 #region Labels
852 public bool IsLabel { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_LABEL; } }
853
858 public bool IsLabelLit { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_LABEL_LIT; } }
859 #endregion
860
861 #region Sequences and Strings
862
867 public bool IsString { get { return IsApp && Native.Z3_is_string(Context.nCtx, NativeObject) != 0; } }
868
873 public string String { get { return Native.Z3_get_string(Context.nCtx, NativeObject); } }
874
879 public bool IsConcat { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_CONCAT; } }
880
885 public bool IsPrefix { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_PREFIX; } }
886
891 public bool IsSuffix { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_SUFFIX; } }
892
897 public bool IsContains { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_CONTAINS; } }
898
903 public bool IsExtract { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_EXTRACT; } }
904
909 public bool IsReplace { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_REPLACE; } }
910
915 public bool IsAt { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_AT; } }
916
921 public bool IsLength { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_LENGTH; } }
922
927 public bool IsIndex { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_INDEX; } }
928
929
930 #endregion
931
932 #region Proof Terms
938 public bool IsOEQ { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_OEQ; } }
939
943 public bool IsProofTrue { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_TRUE; } }
944
948 public bool IsProofAsserted { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_ASSERTED; } }
949
953 public bool IsProofGoal { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_GOAL; } }
954
964 public bool IsProofModusPonens { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_MODUS_PONENS; } }
965
973 public bool IsProofReflexivity { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_REFLEXIVITY; } }
974
984 public bool IsProofSymmetry { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_SYMMETRY; } }
985
996 public bool IsProofTransitivity { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_TRANSITIVITY; } }
997
1017 public bool IsProofTransitivityStar { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_TRANSITIVITY_STAR; } }
1018
1019
1031 public bool IsProofMonotonicity { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_MONOTONICITY; } }
1032
1041 public bool IsProofQuantIntro { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_QUANT_INTRO; } }
1042
1059 public bool IsProofDistributivity { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_DISTRIBUTIVITY; } }
1060
1069 public bool IsProofAndElimination { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_AND_ELIM; } }
1070
1079 public bool IsProofOrElimination { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_NOT_OR_ELIM; } }
1080
1098 public bool IsProofRewrite { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_REWRITE; } }
1099
1111 public bool IsProofRewriteStar { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_REWRITE_STAR; } }
1112
1119 public bool IsProofPullQuant { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_PULL_QUANT; } }
1120
1121
1133 public bool IsProofPushQuant { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_PUSH_QUANT; } }
1134
1145 public bool IsProofElimUnusedVars { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_ELIM_UNUSED_VARS; } }
1146
1159 public bool IsProofDER { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_DER; } }
1160
1167 public bool IsProofQuantInst { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_QUANT_INST; } }
1168
1173 public bool IsProofHypothesis { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_HYPOTHESIS; } }
1174
1186 public bool IsProofLemma { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_LEMMA; } }
1187
1198 public bool IsProofUnitResolution { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_UNIT_RESOLUTION; } }
1199
1207 public bool IsProofIFFTrue { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_IFF_TRUE; } }
1208
1216 public bool IsProofIFFFalse { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_IFF_FALSE; } }
1217
1229 public bool IsProofCommutativity { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_COMMUTATIVITY; } }
1230
1265 public bool IsProofDefAxiom { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_DEF_AXIOM; } }
1266
1288 public bool IsProofDefIntro { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_DEF_INTRO; } }
1289
1298 public bool IsProofApplyDef { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_APPLY_DEF; } }
1299
1307 public bool IsProofIFFOEQ { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_IFF_OEQ; } }
1308
1335 public bool IsProofNNFPos { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_NNF_POS; } }
1336
1360 public bool IsProofNNFNeg { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_NNF_NEG; } }
1361
1373 public bool IsProofSkolemize { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_SKOLEMIZE; } }
1374
1384 public bool IsProofModusPonensOEQ { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_MODUS_PONENS_OEQ; } }
1385
1403 public bool IsProofTheoryLemma { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_TH_LEMMA; } }
1404 #endregion
1405
1406 #region Relational Terms
1410 public bool IsRelation
1411 {
1412 get
1413 {
1414 return (Native.Z3_is_app(Context.nCtx, NativeObject) != 0 &&
1415 Native.Z3_get_sort_kind(Context.nCtx, Native.Z3_get_sort(Context.nCtx, NativeObject))
1416 == (uint)Z3_sort_kind.Z3_RELATION_SORT);
1417 }
1418 }
1419
1428 public bool IsRelationStore { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_STORE; } }
1429
1433 public bool IsEmptyRelation { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_EMPTY; } }
1434
1438 public bool IsIsEmptyRelation { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_IS_EMPTY; } }
1439
1443 public bool IsRelationalJoin { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_JOIN; } }
1444
1449 public bool IsRelationUnion { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_UNION; } }
1450
1455 public bool IsRelationWiden { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_WIDEN; } }
1456
1461 public bool IsRelationProject { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_PROJECT; } }
1462
1473 public bool IsRelationFilter { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_FILTER; } }
1474
1489 public bool IsRelationNegationFilter { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_NEGATION_FILTER; } }
1490
1498 public bool IsRelationRename { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_RENAME; } }
1499
1503 public bool IsRelationComplement { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_COMPLEMENT; } }
1504
1513 public bool IsRelationSelect { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_SELECT; } }
1514
1525 public bool IsRelationClone { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_CLONE; } }
1526 #endregion
1527
1528 #region Finite domain terms
1532 public bool IsFiniteDomain
1533 {
1534 get
1535 {
1536 return (Native.Z3_is_app(Context.nCtx, NativeObject) != 0 &&
1537 Native.Z3_get_sort_kind(Context.nCtx, Native.Z3_get_sort(Context.nCtx, NativeObject)) == (uint)Z3_sort_kind.Z3_FINITE_DOMAIN_SORT);
1538 }
1539 }
1540
1544 public bool IsFiniteDomainLT { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FD_LT; } }
1545 #endregion
1546
1547 #region Floating-point terms
1551 public bool IsFP
1552 {
1553 get { return Native.Z3_get_sort_kind(Context.nCtx, Native.Z3_get_sort(Context.nCtx, NativeObject)) == (uint)Z3_sort_kind.Z3_FLOATING_POINT_SORT; }
1554 }
1555
1559 public bool IsFPRM
1560 {
1561 get { return Native.Z3_get_sort_kind(Context.nCtx, Native.Z3_get_sort(Context.nCtx, NativeObject)) == (uint)Z3_sort_kind.Z3_ROUNDING_MODE_SORT; }
1562 }
1563
1567 public bool IsFPNumeral { get { return IsFP && IsNumeral; } }
1568
1572 public bool IsFPRMNumeral { get { return IsFPRM && IsNumeral; } }
1573
1577 public bool IsFPRMRoundNearestTiesToEven{ get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_EVEN; } }
1578
1582 public bool IsFPRMRoundNearestTiesToAway{ get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_AWAY; } }
1583
1587 public bool IsFPRMRoundTowardNegative{ get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_NEGATIVE; } }
1588
1592 public bool IsFPRMRoundTowardPositive{ get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_POSITIVE; } }
1593
1597 public bool IsFPRMRoundTowardZero{ get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_ZERO; } }
1598
1602 public bool IsFPRMExprRNE{ get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_EVEN; } }
1603
1607 public bool IsFPRMExprRNA { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_AWAY; } }
1608
1612 public bool IsFPRMExprRTN { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_NEGATIVE; } }
1613
1617 public bool IsFPRMExprRTP { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_POSITIVE; } }
1618
1622 public bool IsFPRMExprRTZ { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_ZERO; } }
1623
1627 public bool IsFPRMExpr {
1628 get {
1629 return IsApp &&
1630 (FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_AWAY||
1631 FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_EVEN ||
1632 FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_POSITIVE ||
1633 FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_NEGATIVE ||
1634 FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_ZERO);
1635 }
1636 }
1637
1641 public bool IsFPPlusInfinity{ get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_PLUS_INF; } }
1642
1646 public bool IsFPMinusInfinity{ get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_MINUS_INF; } }
1647
1651 public bool IsFPNaN { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_NAN; } }
1652
1656 public bool IsFPPlusZero { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_PLUS_ZERO; } }
1657
1661 public bool IsFPMinusZero { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_MINUS_ZERO; } }
1662
1666 public bool IsFPAdd { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_ADD; } }
1667
1668
1672 public bool IsFPSub { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_SUB; } }
1673
1677 public bool IsFPNeg { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_NEG; } }
1678
1682 public bool IsFPMul { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_MUL; } }
1683
1687 public bool IsFPDiv { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_DIV; } }
1688
1692 public bool IsFPRem { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_REM; } }
1693
1697 public bool IsFPAbs { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_ABS; } }
1698
1702 public bool IsFPMin { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_MIN; } }
1703
1707 public bool IsFPMax { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_MAX; } }
1708
1712 public bool IsFPFMA { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_FMA; } }
1713
1717 public bool IsFPSqrt { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_SQRT; } }
1718
1722 public bool IsFPRoundToIntegral { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_ROUND_TO_INTEGRAL; } }
1723
1727 public bool IsFPEq { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_EQ; } }
1728
1732 public bool IsFPLt { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_LT; } }
1733
1737 public bool IsFPGt { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_GT; } }
1738
1742 public bool IsFPLe { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_LE; } }
1743
1747 public bool IsFPGe { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_GE; } }
1748
1752 public bool IsFPisNaN { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_IS_NAN; } }
1753
1757 public bool IsFPisInf { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_IS_INF; } }
1758
1762 public bool IsFPisZero { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_IS_ZERO; } }
1763
1767 public bool IsFPisNormal { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_IS_NORMAL; } }
1768
1772 public bool IsFPisSubnormal { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_IS_SUBNORMAL; } }
1773
1777 public bool IsFPisNegative { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_IS_NEGATIVE; } }
1778
1782 public bool IsFPisPositive { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_IS_POSITIVE; } }
1783
1787 public bool IsFPFP { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_FP; } }
1788
1792 public bool IsFPToFp { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_TO_FP; } }
1793
1797 public bool IsFPToFpUnsigned { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_TO_FP_UNSIGNED; } }
1798
1802 public bool IsFPToUBV { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_TO_UBV; } }
1803
1807 public bool IsFPToSBV { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_TO_SBV; } }
1808
1812 public bool IsFPToReal { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_TO_REAL; } }
1813
1814
1818 public bool IsFPToIEEEBV { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_TO_IEEE_BV; } }
1819
1820 #endregion
1821 #endregion
1822
1823 #region Bound Variables
1843 public uint Index
1844 {
1845 get
1846 {
1847 if (!IsVar)
1848 throw new Z3Exception("Term is not a bound variable.");
1849
1850 return Native.Z3_get_index_value(Context.nCtx, NativeObject);
1851 }
1852 }
1853 #endregion
1854
1855 #region Internal
1859 internal protected Expr(Context ctx, IntPtr obj) : base(ctx, obj) { Debug.Assert(ctx != null); }
1860
1861#if DEBUG
1862 internal override void CheckNativeObject(IntPtr obj)
1863 {
1864 if (Native.Z3_is_app(Context.nCtx, obj) == 0 &&
1865 Native.Z3_get_ast_kind(Context.nCtx, obj) != (uint)Z3_ast_kind.Z3_VAR_AST &&
1866 Native.Z3_get_ast_kind(Context.nCtx, obj) != (uint)Z3_ast_kind.Z3_QUANTIFIER_AST)
1867 throw new Z3Exception("Underlying object is not a term");
1868 base.CheckNativeObject(obj);
1869 }
1870#endif
1871
1872 internal static Expr Create(Context ctx, FuncDecl f, params Expr[] arguments)
1873 {
1874 Debug.Assert(ctx != null);
1875 Debug.Assert(f != null);
1876
1877 IntPtr obj = Native.Z3_mk_app(ctx.nCtx, f.NativeObject,
1878 AST.ArrayLength(arguments),
1879 AST.ArrayToNative(arguments));
1880 return Create(ctx, obj);
1881 }
1882
1883 new internal static Expr Create(Context ctx, IntPtr obj)
1884 {
1885 Debug.Assert(ctx != null);
1886
1887 Z3_ast_kind k = (Z3_ast_kind)Native.Z3_get_ast_kind(ctx.nCtx, obj);
1888 if (k == Z3_ast_kind.Z3_QUANTIFIER_AST)
1889 return new Quantifier(ctx, obj);
1890 IntPtr s = Native.Z3_get_sort(ctx.nCtx, obj);
1891 Z3_sort_kind sk = (Z3_sort_kind)Native.Z3_get_sort_kind(ctx.nCtx, s);
1892
1893 if (0 != Native.Z3_is_algebraic_number(ctx.nCtx, obj)) // is this a numeral ast?
1894 return new AlgebraicNum(ctx, obj);
1895
1896 if (Native.Z3_is_numeral_ast(ctx.nCtx, obj) != 0)
1897 {
1898
1899 switch (sk)
1900 {
1901 case Z3_sort_kind.Z3_INT_SORT: return new IntNum(ctx, obj);
1902 case Z3_sort_kind.Z3_REAL_SORT: return new RatNum(ctx, obj);
1903 case Z3_sort_kind.Z3_BV_SORT: return new BitVecNum(ctx, obj);
1904 case Z3_sort_kind.Z3_FLOATING_POINT_SORT: return new FPNum(ctx, obj);
1905 case Z3_sort_kind.Z3_ROUNDING_MODE_SORT: return new FPRMNum(ctx, obj);
1906 case Z3_sort_kind.Z3_FINITE_DOMAIN_SORT: return new FiniteDomainNum(ctx, obj);
1907 }
1908 }
1909
1910 switch (sk)
1911 {
1912 case Z3_sort_kind.Z3_BOOL_SORT: return new BoolExpr(ctx, obj);
1913 case Z3_sort_kind.Z3_INT_SORT: return new IntExpr(ctx, obj);
1914 case Z3_sort_kind.Z3_REAL_SORT: return new RealExpr(ctx, obj);
1915 case Z3_sort_kind.Z3_COMPLEX_SORT: return new ComplexExpr(ctx, obj);
1916 case Z3_sort_kind.Z3_BV_SORT: return new BitVecExpr(ctx, obj);
1917 case Z3_sort_kind.Z3_ARRAY_SORT: return new ArrayExpr(ctx, obj);
1918 case Z3_sort_kind.Z3_DATATYPE_SORT: return new DatatypeExpr(ctx, obj);
1919 case Z3_sort_kind.Z3_FLOATING_POINT_SORT: return new FPExpr(ctx, obj);
1920 case Z3_sort_kind.Z3_ROUNDING_MODE_SORT: return new FPRMExpr(ctx, obj);
1921 case Z3_sort_kind.Z3_FINITE_DOMAIN_SORT: return new FiniteDomainExpr(ctx, obj);
1922 case Z3_sort_kind.Z3_RE_SORT: return new ReExpr(ctx, obj);
1923 case Z3_sort_kind.Z3_SEQ_SORT: return new SeqExpr(ctx, obj);
1924 }
1925
1926 return new Expr(ctx, obj);
1927 }
1928 #endregion
1929 }
1930}
The abstract syntax tree (AST) class.
Definition AST.cs:31
bool IsVar
Indicates whether the AST is a BoundVariable.
Definition AST.cs:162
bool IsApp
Indicates whether the AST is an application.
Definition AST.cs:154
bool IsExpr
Indicates whether the AST is an Expr.
Definition AST.cs:136
The main interaction with Z3 happens via the Context.
Definition Context.cs:34
Expressions are terms.
Definition Expr.cs:31
uint AtMostBound
Retrieve bound of at-most.
Definition Expr.cs:360
bool IsContains
Check whether expression is a contains.
Definition Expr.cs:897
bool IsInt
Indicates whether the term is of integer sort.
Definition Expr.cs:394
bool IsBVXOR3
Indicates whether the term is a bit-vector ternary XOR.
Definition Expr.cs:843
bool IsConst
Indicates whether the term represents a constant.
Definition Expr.cs:245
bool IsProofTransitivityStar
Indicates whether the term is a proof by condensed transitivity of a relation.
Definition Expr.cs:1017
bool IsXor
Indicates whether the term is an exclusive or.
Definition Expr.cs:340
bool IsFPToReal
Indicates whether the term is a floating-point conversion to real term.
Definition Expr.cs:1812
bool IsFPMinusInfinity
Indicates whether the term is a floating-point -oo.
Definition Expr.cs:1646
bool IsBVSLE
Indicates whether the term is a signed bit-vector less-than-or-equal.
Definition Expr.cs:674
bool IsFPRMRoundNearestTiesToAway
Indicates whether the term is the floating-point rounding numeral roundNearestTiesToAway.
Definition Expr.cs:1582
Z3_lbool BoolValue
Indicates whether the expression is the true or false expression or something else (Z3_L_UNDEF).
Definition Expr.cs:62
bool IsProofTheoryLemma
Indicates whether the term is a proof for theory lemma.
Definition Expr.cs:1403
bool IsFP
Indicates whether the terms is of floating-point sort.
Definition Expr.cs:1552
bool IsIntNum
Indicates whether the term is an integer numeral.
Definition Expr.cs:255
bool IsRelationUnion
Indicates whether the term is the union or convex hull of two relations.
Definition Expr.cs:1449
bool IsBVConcat
Indicates whether the term is a bit-vector concatenation (binary)
Definition Expr.cs:744
bool IsFiniteDomain
Indicates whether the term is of an array sort.
Definition Expr.cs:1533
bool IsProofQuantIntro
Indicates whether the term is a quant-intro proof.
Definition Expr.cs:1041
bool IsConcat
Check whether expression is a concatenation.
Definition Expr.cs:879
bool IsAt
Check whether expression is an at.
Definition Expr.cs:915
uint Index
The de-Bruijn index of a bound variable.
Definition Expr.cs:1844
bool IsProofHypothesis
Indicates whether the term is a hypothesis marker.
Definition Expr.cs:1173
bool IsProofTrue
Indicates whether the term is a Proof for the expression 'true'.
Definition Expr.cs:943
bool IsBVBitZero
Indicates whether the term is a one-bit bit-vector with value zero.
Definition Expr.cs:594
bool IsRelationNegationFilter
Indicates whether the term is an intersection of a relation with the negation of another.
Definition Expr.cs:1489
bool IsBVZeroExtension
Indicates whether the term is a bit-vector zero extension.
Definition Expr.cs:754
Expr Dup()
Create a duplicate of expression. This feature is to allow extending the life-time of expressions tha...
Definition Expr.cs:200
bool IsProofNNFPos
Indicates whether the term is a proof for a positive NNF step.
Definition Expr.cs:1335
bool IsFPToFpUnsigned
Indicates whether the term is a floating-point conversion from unsigned bit-vector term.
Definition Expr.cs:1797
bool IsFPDiv
Indicates whether the term is a floating-point division term.
Definition Expr.cs:1687
bool IsBVShiftRightLogical
Indicates whether the term is a bit-vector logical shift right.
Definition Expr.cs:789
bool IsPbEq
Indicates whether the term is pbeq.
Definition Expr.cs:375
bool IsFPLe
Indicates whether the term is a floating-point less-than or equal term.
Definition Expr.cs:1742
Expr Substitute(Expr from, Expr to)
Substitute every occurrence of from in the expression with to.
Definition Expr.cs:139
Expr Substitute(Expr[] from, Expr[] to)
Substitute every occurrence of from[i] in the expression with to[i], for i smaller than num_exprs.
Definition Expr.cs:121
bool IsFPLt
Indicates whether the term is a floating-point less-than term.
Definition Expr.cs:1732
bool IsBVCarry
Indicates whether the term is a bit-vector carry.
Definition Expr.cs:837
bool IsFPRMExprRTN
Indicates whether the term is the floating-point rounding numeral roundTowardNegative.
Definition Expr.cs:1612
bool IsBVRotateLeft
Indicates whether the term is a bit-vector rotate left.
Definition Expr.cs:799
bool IsTrue
Indicates whether the term is the constant true.
Definition Expr.cs:300
bool IsFPRMRoundTowardPositive
Indicates whether the term is the floating-point rounding numeral roundTowardPositive.
Definition Expr.cs:1592
bool IsBVAdd
Indicates whether the term is a bit-vector addition (binary)
Definition Expr.cs:604
bool IsFPRoundToIntegral
Indicates whether the term is a floating-point roundToIntegral term.
Definition Expr.cs:1722
bool IsFPEq
Indicates whether the term is a floating-point equality term.
Definition Expr.cs:1727
bool IsRelationStore
Indicates whether the term is an relation store.
Definition Expr.cs:1428
bool IsBVSGE
Indicates whether the term is a signed bit-vector greater-than-or-equal.
Definition Expr.cs:684
uint NumArgs
The number of arguments of the expression.
Definition Expr.cs:70
bool IsProofReflexivity
Indicates whether the term is a proof for (R t t), where R is a reflexive relation.
Definition Expr.cs:973
bool IsReplace
Check whether expression is a replace.
Definition Expr.cs:909
new Expr Translate(Context ctx)
Translates (copies) the term to the Context ctx .
Definition Expr.cs:189
bool IsProofModusPonensOEQ
Indicates whether the term is a proof by modus ponens for equi-satisfiability.
Definition Expr.cs:1384
bool IsFPFMA
Indicates whether the term is a floating-point fused multiply-add term.
Definition Expr.cs:1712
bool IsRatNum
Indicates whether the term is a real numeral.
Definition Expr.cs:265
bool IsNumeral
Indicates whether the term is a numeral.
Definition Expr.cs:216
bool IsBVComp
Indicates whether the term is a bit-vector comparison.
Definition Expr.cs:779
bool IsFPRMExprRTZ
Indicates whether the term is the floating-point rounding numeral roundTowardZero.
Definition Expr.cs:1622
bool IsProofIFFFalse
Indicates whether the term is a proof by iff-false.
Definition Expr.cs:1216
bool IsFPRMRoundTowardZero
Indicates whether the term is the floating-point rounding numeral roundTowardZero.
Definition Expr.cs:1597
bool IsBVULT
Indicates whether the term is an unsigned bit-vector less-than.
Definition Expr.cs:689
bool IsFPisPositive
Indicates whether the term is a floating-point isPositive predicate term.
Definition Expr.cs:1782
bool IsRelationSelect
Indicates whether the term is a relational select.
Definition Expr.cs:1513
bool IsProofElimUnusedVars
Indicates whether the term is a proof for elimination of unused variables.
Definition Expr.cs:1145
bool IsFPToUBV
Indicates whether the term is a floating-point conversion to unsigned bit-vector term.
Definition Expr.cs:1802
bool IsFalse
Indicates whether the term is the constant false.
Definition Expr.cs:305
bool IsPbLe
Indicates whether the term is pble.
Definition Expr.cs:380
bool IsEq
Indicates whether the term is an equality predicate.
Definition Expr.cs:310
bool IsProofLemma
Indicates whether the term is a proof by lemma.
Definition Expr.cs:1186
bool IsBVReduceOR
Indicates whether the term is a bit-vector reduce OR.
Definition Expr.cs:769
bool IsArrayMap
Indicates whether the term is an array map.
Definition Expr.cs:535
bool IsProofDefIntro
Indicates whether the term is a proof for introduction of a name.
Definition Expr.cs:1288
bool IsBVNumeral
Indicates whether the term is a bit-vector numeral.
Definition Expr.cs:584
bool IsBVAND
Indicates whether the term is a bit-wise AND.
Definition Expr.cs:709
bool IsPbGe
Indicates whether the term is pbge.
Definition Expr.cs:385
bool IsFPAbs
Indicates whether the term is a floating-point term absolute value term.
Definition Expr.cs:1697
bool IsRelationFilter
Indicates whether the term is a relation filter.
Definition Expr.cs:1473
bool IsProofApplyDef
Indicates whether the term is a proof for application of a definition.
Definition Expr.cs:1298
bool IsProofIFFTrue
Indicates whether the term is a proof by iff-true.
Definition Expr.cs:1207
bool IsIntToReal
Indicates whether the term is a coercion of integer to real (unary)
Definition Expr.cs:480
bool IsFPisNormal
Indicates whether the term is a floating-point isNormal term.
Definition Expr.cs:1767
bool IsString
Check whether expression is a string constant.
Definition Expr.cs:867
bool IsProofQuantInst
Indicates whether the term is a proof for quantifier instantiation.
Definition Expr.cs:1167
bool IsFPMax
Indicates whether the term is a floating-point maximum term.
Definition Expr.cs:1707
Expr SubstituteVars(Expr[] to)
Substitute the free variables in the expression with the expressions in to
Definition Expr.cs:153
bool IsIff
Indicates whether the term is an if-and-only-if (Boolean equivalence, binary)
Definition Expr.cs:335
bool IsBVNOR
Indicates whether the term is a bit-wise NOR.
Definition Expr.cs:734
bool IsFPNaN
Indicates whether the term is a floating-point NaN.
Definition Expr.cs:1651
bool IsBVXOR
Indicates whether the term is a bit-wise XOR.
Definition Expr.cs:724
bool IsBVUGE
Indicates whether the term is an unsigned bit-vector greater-than-or-equal.
Definition Expr.cs:679
bool IsExtract
Check whether expression is an extract.
Definition Expr.cs:903
bool IsFPisZero
Indicates whether the term is a floating-point isZero predicate term.
Definition Expr.cs:1762
bool IsProofDER
Indicates whether the term is a proof for destructive equality resolution.
Definition Expr.cs:1159
bool IsIndex
Check whether expression is a sequence index.
Definition Expr.cs:927
bool IsRelationClone
Indicates whether the term is a relational clone (copy)
Definition Expr.cs:1525
bool IsFiniteDomainLT
Indicates whether the term is a less than predicate over a finite domain.
Definition Expr.cs:1544
bool IsIntToBV
Indicates whether the term is a coercion from integer to bit-vector.
Definition Expr.cs:823
bool IsLE
Indicates whether the term is a less-than-or-equal.
Definition Expr.cs:420
Expr[] Args
The arguments of the expression.
Definition Expr.cs:78
bool IsBVUMinus
Indicates whether the term is a bit-vector unary minus.
Definition Expr.cs:599
bool IsBVShiftRightArithmetic
Indicates whether the term is a bit-vector arithmetic shift left.
Definition Expr.cs:794
Expr(Context ctx, IntPtr obj)
Constructor for Expr.
Definition Expr.cs:1859
bool IsOr
Indicates whether the term is an n-ary disjunction.
Definition Expr.cs:330
bool IsFPToSBV
Indicates whether the term is a floating-point conversion to signed bit-vector term.
Definition Expr.cs:1807
bool IsBVXNOR
Indicates whether the term is a bit-wise XNOR.
Definition Expr.cs:739
bool IsFPRMExprRNA
Indicates whether the term is the floating-point rounding numeral roundNearestTiesToAway.
Definition Expr.cs:1607
bool IsFPGe
Indicates whether the term is a floating-point greater-than or equal term.
Definition Expr.cs:1747
bool IsFPMin
Indicates whether the term is a floating-point minimum term.
Definition Expr.cs:1702
bool IsSetUnion
Indicates whether the term is set union.
Definition Expr.cs:549
bool IsProofModusPonens
Indicates whether the term is proof via modus ponens.
Definition Expr.cs:964
bool IsBVReduceAND
Indicates whether the term is a bit-vector reduce AND.
Definition Expr.cs:774
bool IsAsArray
Indicates whether the term is an as-array term.
Definition Expr.cs:542
bool IsBVToInt
Indicates whether the term is a coercion from bit-vector to integer.
Definition Expr.cs:830
bool IsIDiv
Indicates whether the term is integer division (binary)
Definition Expr.cs:465
bool IsFPMul
Indicates whether the term is a floating-point multiplication term.
Definition Expr.cs:1682
bool IsModulus
Indicates whether the term is modulus (binary)
Definition Expr.cs:475
bool IsFPNumeral
Indicates whether the term is a floating-point numeral.
Definition Expr.cs:1567
bool IsProofRewriteStar
Indicates whether the term is a proof by rewriting.
Definition Expr.cs:1111
bool IsSetIntersect
Indicates whether the term is set intersection.
Definition Expr.cs:554
string String
Retrieve string corresponding to string constant.
Definition Expr.cs:873
bool IsBVRotateRight
Indicates whether the term is a bit-vector rotate right.
Definition Expr.cs:804
bool IsFPRMRoundNearestTiesToEven
Indicates whether the term is the floating-point rounding numeral roundNearestTiesToEven.
Definition Expr.cs:1577
bool IsFPisSubnormal
Indicates whether the term is a floating-point isSubnormal predicate term.
Definition Expr.cs:1772
bool IsAtLeast
Indicates whether the term is at-least.
Definition Expr.cs:365
bool IsITE
Indicates whether the term is a ternary if-then-else term.
Definition Expr.cs:320
bool IsAdd
Indicates whether the term is addition (binary)
Definition Expr.cs:440
bool IsLT
Indicates whether the term is a less-than.
Definition Expr.cs:430
bool IsFPRMNumeral
Indicates whether the term is a floating-point rounding mode numeral.
Definition Expr.cs:1572
bool IsStore
Indicates whether the term is an array store.
Definition Expr.cs:512
bool IsBVNAND
Indicates whether the term is a bit-wise NAND.
Definition Expr.cs:729
bool IsBVShiftLeft
Indicates whether the term is a bit-vector shift left.
Definition Expr.cs:784
bool IsMul
Indicates whether the term is multiplication (binary)
Definition Expr.cs:455
bool IsFPisNegative
Indicates whether the term is a floating-point isNegative predicate term.
Definition Expr.cs:1777
bool IsFPRem
Indicates whether the term is a floating-point remainder term.
Definition Expr.cs:1692
bool IsAtMost
Indicates whether the term is at-most.
Definition Expr.cs:355
bool IsFPToIEEEBV
Indicates whether the term is a floating-point conversion to IEEE-754 bit-vector term.
Definition Expr.cs:1818
bool IsProofPullQuant
Indicates whether the term is a proof for pulling quantifiers out.
Definition Expr.cs:1119
bool IsFPGt
Indicates whether the term is a floating-point greater-than term.
Definition Expr.cs:1737
bool IsDistinct
Indicates whether the term is an n-ary distinct predicate (every argument is mutually distinct).
Definition Expr.cs:315
bool IsRelation
Indicates whether the term is of relation sort.
Definition Expr.cs:1411
bool IsFPisInf
Indicates whether the term is a floating-point isInf predicate term.
Definition Expr.cs:1757
bool IsProofNNFNeg
Indicates whether the term is a proof for a negative NNF step.
Definition Expr.cs:1360
bool IsDiv
Indicates whether the term is division (binary)
Definition Expr.cs:460
bool IsBVRotateRightExtended
Indicates whether the term is a bit-vector rotate right (extended)
Definition Expr.cs:816
Expr Arg(uint i)
The i'th argument of the expression.
Definition Expr.cs:93
bool IsGT
Indicates whether the term is a greater-than.
Definition Expr.cs:435
bool IsBVSDiv
Indicates whether the term is a bit-vector signed division (binary)
Definition Expr.cs:619
bool IsReal
Indicates whether the term is of sort real.
Definition Expr.cs:402
override string ToString()
Returns a string representation of the expression.
Definition Expr.cs:207
bool IsLabel
Indicates whether the term is a label (used by the Boogie Verification condition generator).
Definition Expr.cs:852
bool IsRemainder
Indicates whether the term is remainder (binary)
Definition Expr.cs:470
bool IsProofTransitivity
Indicates whether the term is a proof by transitivity of a relation.
Definition Expr.cs:996
bool IsRelationalJoin
Indicates whether the term is a relational join.
Definition Expr.cs:1443
bool IsOEQ
Indicates whether the term is a binary equivalence modulo namings.
Definition Expr.cs:938
bool IsDefaultArray
Indicates whether the term is a default array.
Definition Expr.cs:529
bool IsConstantArray
Indicates whether the term is a constant array.
Definition Expr.cs:523
bool IsGE
Indicates whether the term is a greater-than-or-equal.
Definition Expr.cs:425
bool IsRelationRename
Indicates whether the term is the renaming of a column in a relation.
Definition Expr.cs:1498
bool IsIsEmptyRelation
Indicates whether the term is a test for the emptiness of a relation.
Definition Expr.cs:1438
bool IsProofAsserted
Indicates whether the term is a proof for a fact asserted by the user.
Definition Expr.cs:948
bool IsFPRM
Indicates whether the terms is of floating-point rounding mode sort.
Definition Expr.cs:1560
bool IsProofOrElimination
Indicates whether the term is a proof by elimination of not-or.
Definition Expr.cs:1079
bool IsRealToInt
Indicates whether the term is a coercion of real to integer (unary)
Definition Expr.cs:485
bool IsAnd
Indicates whether the term is an n-ary conjunction.
Definition Expr.cs:325
bool IsFPPlusInfinity
Indicates whether the term is a floating-point +oo.
Definition Expr.cs:1641
bool IsBV
Indicates whether the terms is of bit-vector sort.
Definition Expr.cs:577
bool IsProofMonotonicity
Indicates whether the term is a monotonicity proof object.
Definition Expr.cs:1031
bool IsFPisNaN
Indicates whether the term is a floating-point isNaN predicate term.
Definition Expr.cs:1752
bool IsBool
Indicates whether the term has Boolean sort.
Definition Expr.cs:287
bool IsFPRMRoundTowardNegative
Indicates whether the term is the floating-point rounding numeral roundTowardNegative.
Definition Expr.cs:1587
void Update(Expr[] args)
Update the arguments of the expression using the arguments args The number of new arguments should c...
Definition Expr.cs:102
bool IsProofDefAxiom
Indicates whether the term is a proof for Tseitin-like axioms.
Definition Expr.cs:1265
bool IsWellSorted
Indicates whether the term is well-sorted.
Definition Expr.cs:225
bool IsImplies
Indicates whether the term is an implication.
Definition Expr.cs:350
bool IsSuffix
Check whether expression is a suffix.
Definition Expr.cs:891
bool IsBVSRem
Indicates whether the term is a bit-vector signed remainder (binary)
Definition Expr.cs:629
bool IsFPToFp
Indicates whether the term is a floating-point conversion term.
Definition Expr.cs:1792
bool IsLabelLit
Indicates whether the term is a label literal (used by the Boogie Verification condition generator).
Definition Expr.cs:858
uint AtLeastBound
Retrieve bound of at-least.
Definition Expr.cs:370
bool IsProofUnitResolution
Indicates whether the term is a proof by unit resolution.
Definition Expr.cs:1198
bool IsProofGoal
Indicates whether the term is a proof for a fact (tagged as goal) asserted by the user.
Definition Expr.cs:953
bool IsFPSqrt
Indicates whether the term is a floating-point square root term.
Definition Expr.cs:1717
bool IsSelect
Indicates whether the term is an array select.
Definition Expr.cs:517
bool IsNot
Indicates whether the term is a negation.
Definition Expr.cs:345
bool IsFPFP
Indicates whether the term is a floating-point constructor term.
Definition Expr.cs:1787
FuncDecl FuncDecl
The function declaration of the function that is applied in this expression.
Definition Expr.cs:50
bool IsFPMinusZero
Indicates whether the term is a floating-point -zero.
Definition Expr.cs:1661
bool IsRelationProject
Indicates whether the term is a projection of columns (provided as numbers in the parameters).
Definition Expr.cs:1461
bool IsComplex
Indicates whether the expression has Complex sort.
Definition Expr.cs:408
bool IsUMinus
Indicates whether the term is a unary minus.
Definition Expr.cs:450
bool IsRelationWiden
Indicates whether the term is the widening of two relations.
Definition Expr.cs:1455
bool IsBVRepeat
Indicates whether the term is a bit-vector repetition.
Definition Expr.cs:764
bool IsSub
Indicates whether the term is subtraction (binary)
Definition Expr.cs:445
bool IsRelationComplement
Indicates whether the term is the complement of a relation.
Definition Expr.cs:1503
bool IsFPPlusZero
Definition Expr.cs:1656
Expr SubstituteFuns(FuncDecl[] from, Expr[] to)
Substitute functions in from with the expressions in to .
Definition Expr.cs:170
bool IsBVOR
Indicates whether the term is a bit-wise OR.
Definition Expr.cs:714
bool IsBVSub
Indicates whether the term is a bit-vector subtraction (binary)
Definition Expr.cs:609
bool IsBVRotateLeftExtended
Indicates whether the term is a bit-vector rotate left (extended)
Definition Expr.cs:810
bool IsProofSymmetry
Indicates whether the term is proof by symmetricity of a relation.
Definition Expr.cs:984
bool IsProofSkolemize
Indicates whether the term is a proof for a Skolemization step.
Definition Expr.cs:1373
bool IsBVMul
Indicates whether the term is a bit-vector multiplication (binary)
Definition Expr.cs:614
bool IsLength
Check whether expression is a sequence length.
Definition Expr.cs:921
bool IsFPSub
Indicates whether the term is a floating-point subtraction term.
Definition Expr.cs:1672
bool IsBVUDiv
Indicates whether the term is a bit-vector unsigned division (binary)
Definition Expr.cs:624
bool IsProofCommutativity
Indicates whether the term is a proof by commutativity.
Definition Expr.cs:1229
bool IsAlgebraicNumber
Indicates whether the term is an algebraic number.
Definition Expr.cs:275
bool IsProofRewrite
Indicates whether the term is a proof by rewriting.
Definition Expr.cs:1098
bool IsFPRMExprRNE
Indicates whether the term is the floating-point rounding numeral roundNearestTiesToEven.
Definition Expr.cs:1602
bool IsArithmeticNumeral
Indicates whether the term is an arithmetic numeral.
Definition Expr.cs:415
bool IsProofAndElimination
Indicates whether the term is a proof by elimination of AND.
Definition Expr.cs:1069
bool IsEmptyRelation
Indicates whether the term is an empty relation.
Definition Expr.cs:1433
bool IsProofPushQuant
Indicates whether the term is a proof for pushing quantifiers in.
Definition Expr.cs:1133
bool IsProofDistributivity
Indicates whether the term is a distributivity proof object.
Definition Expr.cs:1059
bool IsBVURem
Indicates whether the term is a bit-vector unsigned remainder (binary)
Definition Expr.cs:634
bool IsBVULE
Indicates whether the term is an unsigned bit-vector less-than-or-equal.
Definition Expr.cs:669
bool IsBVSLT
Indicates whether the term is a signed bit-vector less-than.
Definition Expr.cs:694
bool IsBVExtract
Indicates whether the term is a bit-vector extraction.
Definition Expr.cs:759
bool IsBVSignExtension
Indicates whether the term is a bit-vector sign extension.
Definition Expr.cs:749
bool IsRealIsInt
Indicates whether the term is a check that tests whether a real is integral (unary)
Definition Expr.cs:490
bool IsSetDifference
Indicates whether the term is set difference.
Definition Expr.cs:559
Expr Simplify(Params p=null)
Returns a simplified version of the expression.
Definition Expr.cs:37
bool IsBVUGT
Indicates whether the term is an unsigned bit-vector greater-than.
Definition Expr.cs:699
bool IsPrefix
Check whether expression is a prefix.
Definition Expr.cs:885
bool IsFPRMExprRTP
Indicates whether the term is the floating-point rounding numeral roundTowardPositive.
Definition Expr.cs:1617
bool IsFPAdd
Indicates whether the term is a floating-point addition term.
Definition Expr.cs:1666
bool IsFPRMExpr
Indicates whether the term is a floating-point rounding mode numeral.
Definition Expr.cs:1627
bool IsBVSMod
Indicates whether the term is a bit-vector signed modulus.
Definition Expr.cs:639
bool IsBVBitOne
Indicates whether the term is a one-bit bit-vector with value one.
Definition Expr.cs:589
bool IsFPNeg
Indicates whether the term is a floating-point negation term.
Definition Expr.cs:1677
bool IsArray
Indicates whether the term is of an array sort.
Definition Expr.cs:498
bool IsBVNOT
Indicates whether the term is a bit-wise NOT.
Definition Expr.cs:719
bool IsBVSGT
Indicates whether the term is a signed bit-vector greater-than.
Definition Expr.cs:704
bool IsSetSubset
Indicates whether the term is set subset.
Definition Expr.cs:569
bool IsSetComplement
Indicates whether the term is set complement.
Definition Expr.cs:564
bool IsProofIFFOEQ
Indicates whether the term is a proof iff-oeq.
Definition Expr.cs:1307
int Int
The int value of the parameter.
Definition FuncDecl.cs:219
Function declarations.
Definition FuncDecl.cs:31
Parameter[] Parameters
The parameters of the function declaration.
Definition FuncDecl.cs:164
A Params objects represents a configuration in the form of Symbol/value pairs.
Definition Params.cs:29
The Sort class implements type information for ASTs.
Definition Sort.cs:29
The exception base class for error reporting from Z3.
Z3_ast_kind
The different kinds of Z3 AST (abstract syntax trees). That is, terms, formulas and types.
Definition z3_api.h:144
Z3_decl_kind
The different kinds of interpreted function kinds.
Definition z3_api.h:998
Z3_sort_kind
The different kinds of Z3 types (See Z3_get_sort_kind).
Definition z3_api.h:110
Z3_lbool
Lifted Boolean type: false, undefined, true.
Definition z3_api.h:58