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
409 public bool IsArithmeticNumeral { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_ANUM; } }
410
414 public bool IsLE { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_LE; } }
415
419 public bool IsGE { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_GE; } }
420
424 public bool IsLT { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_LT; } }
425
429 public bool IsGT { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_GT; } }
430
434 public bool IsAdd { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_ADD; } }
435
439 public bool IsSub { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SUB; } }
440
444 public bool IsUMinus { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_UMINUS; } }
445
449 public bool IsMul { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_MUL; } }
450
454 public bool IsDiv { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_DIV; } }
455
459 public bool IsIDiv { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_IDIV; } }
460
464 public bool IsRemainder { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_REM; } }
465
469 public bool IsModulus { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_MOD; } }
470
474 public bool IsIntToReal { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_TO_REAL; } }
475
479 public bool IsRealToInt { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_TO_INT; } }
480
484 public bool IsRealIsInt { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_IS_INT; } }
485 #endregion
486
487 #region Array Terms
491 public bool IsArray
492 {
493 get
494 {
495 return (Native.Z3_is_app(Context.nCtx, NativeObject) != 0 &&
496 (Z3_sort_kind)Native.Z3_get_sort_kind(Context.nCtx, Native.Z3_get_sort(Context.nCtx, NativeObject))
497 == Z3_sort_kind.Z3_ARRAY_SORT);
498 }
499 }
500
506 public bool IsStore { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_STORE; } }
507
511 public bool IsSelect { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SELECT; } }
512
517 public bool IsConstantArray { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_CONST_ARRAY; } }
518
523 public bool IsDefaultArray { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_ARRAY_DEFAULT; } }
524
529 public bool IsArrayMap { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_ARRAY_MAP; } }
530
536 public bool IsAsArray { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_AS_ARRAY; } }
537 #endregion
538
539 #region Set Terms
543 public bool IsSetUnion { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SET_UNION; } }
544
548 public bool IsSetIntersect { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SET_INTERSECT; } }
549
553 public bool IsSetDifference { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SET_DIFFERENCE; } }
554
558 public bool IsSetComplement { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SET_COMPLEMENT; } }
559
563 public bool IsSetSubset { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SET_SUBSET; } }
564 #endregion
565
566 #region Bit-vector terms
570 public bool IsBV
571 {
572 get { return Native.Z3_get_sort_kind(Context.nCtx, Native.Z3_get_sort(Context.nCtx, NativeObject)) == (uint)Z3_sort_kind.Z3_BV_SORT; }
573 }
574
578 public bool IsBVNumeral { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BNUM; } }
579
583 public bool IsBVBitOne { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BIT1; } }
584
588 public bool IsBVBitZero { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BIT0; } }
589
593 public bool IsBVUMinus { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BNEG; } }
594
598 public bool IsBVAdd { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BADD; } }
599
603 public bool IsBVSub { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BSUB; } }
604
608 public bool IsBVMul { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BMUL; } }
609
613 public bool IsBVSDiv { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BSDIV; } }
614
618 public bool IsBVUDiv { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BUDIV; } }
619
623 public bool IsBVSRem { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BSREM; } }
624
628 public bool IsBVURem { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BUREM; } }
629
633 public bool IsBVSMod { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BSMOD; } }
634
638 internal bool IsBVSDiv0 { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BSDIV0; } }
639
643 internal bool IsBVUDiv0 { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BUDIV0; } }
644
648 internal bool IsBVSRem0 { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BSREM0; } }
649
653 internal bool IsBVURem0 { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BUREM0; } }
654
658 internal bool IsBVSMod0 { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BSMOD0; } }
659
663 public bool IsBVULE { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_ULEQ; } }
664
668 public bool IsBVSLE { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SLEQ; } }
669
673 public bool IsBVUGE { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_UGEQ; } }
674
678 public bool IsBVSGE { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SGEQ; } }
679
683 public bool IsBVULT { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_ULT; } }
684
688 public bool IsBVSLT { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SLT; } }
689
693 public bool IsBVUGT { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_UGT; } }
694
698 public bool IsBVSGT { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SGT; } }
699
703 public bool IsBVAND { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BAND; } }
704
708 public bool IsBVOR { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BOR; } }
709
713 public bool IsBVNOT { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BNOT; } }
714
718 public bool IsBVXOR { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BXOR; } }
719
723 public bool IsBVNAND { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BNAND; } }
724
728 public bool IsBVNOR { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BNOR; } }
729
733 public bool IsBVXNOR { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BXNOR; } }
734
738 public bool IsBVConcat { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_CONCAT; } }
739
743 public bool IsBVSignExtension { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SIGN_EXT; } }
744
748 public bool IsBVZeroExtension { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_ZERO_EXT; } }
749
753 public bool IsBVExtract { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_EXTRACT; } }
754
758 public bool IsBVRepeat { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_REPEAT; } }
759
763 public bool IsBVReduceOR { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BREDOR; } }
764
768 public bool IsBVReduceAND { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BREDAND; } }
769
773 public bool IsBVComp { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BCOMP; } }
774
778 public bool IsBVShiftLeft { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BSHL; } }
779
783 public bool IsBVShiftRightLogical { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BLSHR; } }
784
788 public bool IsBVShiftRightArithmetic { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BASHR; } }
789
793 public bool IsBVRotateLeft { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_ROTATE_LEFT; } }
794
798 public bool IsBVRotateRight { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_ROTATE_RIGHT; } }
799
804 public bool IsBVRotateLeftExtended { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_EXT_ROTATE_LEFT; } }
805
810 public bool IsBVRotateRightExtended { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_EXT_ROTATE_RIGHT; } }
811
817 public bool IsIntToBV { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_INT2BV; } }
818
824 public bool IsBVToInt { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BV2INT; } }
825
831 public bool IsBVCarry { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_CARRY; } }
832
837 public bool IsBVXOR3 { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_XOR3; } }
838
839 #endregion
840
841 #region Labels
846 public bool IsLabel { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_LABEL; } }
847
852 public bool IsLabelLit { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_LABEL_LIT; } }
853 #endregion
854
855 #region Sequences and Strings
856
861 public bool IsString { get { return IsApp && Native.Z3_is_string(Context.nCtx, NativeObject) != 0; } }
862
867 public string String { get { return Native.Z3_get_string(Context.nCtx, NativeObject); } }
868
873 public bool IsConcat { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_CONCAT; } }
874
879 public bool IsPrefix { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_PREFIX; } }
880
885 public bool IsSuffix { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_SUFFIX; } }
886
891 public bool IsContains { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_CONTAINS; } }
892
897 public bool IsExtract { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_EXTRACT; } }
898
903 public bool IsReplace { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_REPLACE; } }
904
909 public bool IsAt { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_AT; } }
910
915 public bool IsLength { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_LENGTH; } }
916
921 public bool IsIndex { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_INDEX; } }
922
923
924 #endregion
925
926 #region Proof Terms
932 public bool IsOEQ { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_OEQ; } }
933
937 public bool IsProofTrue { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_TRUE; } }
938
942 public bool IsProofAsserted { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_ASSERTED; } }
943
947 public bool IsProofGoal { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_GOAL; } }
948
958 public bool IsProofModusPonens { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_MODUS_PONENS; } }
959
967 public bool IsProofReflexivity { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_REFLEXIVITY; } }
968
978 public bool IsProofSymmetry { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_SYMMETRY; } }
979
990 public bool IsProofTransitivity { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_TRANSITIVITY; } }
991
1011 public bool IsProofTransitivityStar { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_TRANSITIVITY_STAR; } }
1012
1013
1025 public bool IsProofMonotonicity { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_MONOTONICITY; } }
1026
1035 public bool IsProofQuantIntro { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_QUANT_INTRO; } }
1036
1053 public bool IsProofDistributivity { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_DISTRIBUTIVITY; } }
1054
1063 public bool IsProofAndElimination { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_AND_ELIM; } }
1064
1073 public bool IsProofOrElimination { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_NOT_OR_ELIM; } }
1074
1092 public bool IsProofRewrite { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_REWRITE; } }
1093
1105 public bool IsProofRewriteStar { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_REWRITE_STAR; } }
1106
1113 public bool IsProofPullQuant { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_PULL_QUANT; } }
1114
1115
1127 public bool IsProofPushQuant { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_PUSH_QUANT; } }
1128
1139 public bool IsProofElimUnusedVars { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_ELIM_UNUSED_VARS; } }
1140
1153 public bool IsProofDER { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_DER; } }
1154
1161 public bool IsProofQuantInst { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_QUANT_INST; } }
1162
1167 public bool IsProofHypothesis { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_HYPOTHESIS; } }
1168
1180 public bool IsProofLemma { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_LEMMA; } }
1181
1192 public bool IsProofUnitResolution { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_UNIT_RESOLUTION; } }
1193
1201 public bool IsProofIFFTrue { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_IFF_TRUE; } }
1202
1210 public bool IsProofIFFFalse { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_IFF_FALSE; } }
1211
1223 public bool IsProofCommutativity { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_COMMUTATIVITY; } }
1224
1259 public bool IsProofDefAxiom { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_DEF_AXIOM; } }
1260
1282 public bool IsProofDefIntro { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_DEF_INTRO; } }
1283
1292 public bool IsProofApplyDef { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_APPLY_DEF; } }
1293
1301 public bool IsProofIFFOEQ { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_IFF_OEQ; } }
1302
1329 public bool IsProofNNFPos { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_NNF_POS; } }
1330
1354 public bool IsProofNNFNeg { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_NNF_NEG; } }
1355
1367 public bool IsProofSkolemize { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_SKOLEMIZE; } }
1368
1378 public bool IsProofModusPonensOEQ { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_MODUS_PONENS_OEQ; } }
1379
1397 public bool IsProofTheoryLemma { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_TH_LEMMA; } }
1398 #endregion
1399
1400 #region Relational Terms
1404 public bool IsRelation
1405 {
1406 get
1407 {
1408 return (Native.Z3_is_app(Context.nCtx, NativeObject) != 0 &&
1409 Native.Z3_get_sort_kind(Context.nCtx, Native.Z3_get_sort(Context.nCtx, NativeObject))
1410 == (uint)Z3_sort_kind.Z3_RELATION_SORT);
1411 }
1412 }
1413
1422 public bool IsRelationStore { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_STORE; } }
1423
1427 public bool IsEmptyRelation { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_EMPTY; } }
1428
1432 public bool IsIsEmptyRelation { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_IS_EMPTY; } }
1433
1437 public bool IsRelationalJoin { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_JOIN; } }
1438
1443 public bool IsRelationUnion { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_UNION; } }
1444
1449 public bool IsRelationWiden { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_WIDEN; } }
1450
1455 public bool IsRelationProject { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_PROJECT; } }
1456
1467 public bool IsRelationFilter { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_FILTER; } }
1468
1483 public bool IsRelationNegationFilter { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_NEGATION_FILTER; } }
1484
1492 public bool IsRelationRename { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_RENAME; } }
1493
1497 public bool IsRelationComplement { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_COMPLEMENT; } }
1498
1507 public bool IsRelationSelect { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_SELECT; } }
1508
1519 public bool IsRelationClone { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_CLONE; } }
1520 #endregion
1521
1522 #region Finite domain terms
1526 public bool IsFiniteDomain
1527 {
1528 get
1529 {
1530 return (Native.Z3_is_app(Context.nCtx, NativeObject) != 0 &&
1531 Native.Z3_get_sort_kind(Context.nCtx, Native.Z3_get_sort(Context.nCtx, NativeObject)) == (uint)Z3_sort_kind.Z3_FINITE_DOMAIN_SORT);
1532 }
1533 }
1534
1538 public bool IsFiniteDomainLT { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FD_LT; } }
1539 #endregion
1540
1541 #region Floating-point terms
1545 public bool IsFP
1546 {
1547 get { return Native.Z3_get_sort_kind(Context.nCtx, Native.Z3_get_sort(Context.nCtx, NativeObject)) == (uint)Z3_sort_kind.Z3_FLOATING_POINT_SORT; }
1548 }
1549
1553 public bool IsFPRM
1554 {
1555 get { return Native.Z3_get_sort_kind(Context.nCtx, Native.Z3_get_sort(Context.nCtx, NativeObject)) == (uint)Z3_sort_kind.Z3_ROUNDING_MODE_SORT; }
1556 }
1557
1561 public bool IsFPNumeral { get { return IsFP && IsNumeral; } }
1562
1566 public bool IsFPRMNumeral { get { return IsFPRM && IsNumeral; } }
1567
1571 public bool IsFPRMRoundNearestTiesToEven{ get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_EVEN; } }
1572
1576 public bool IsFPRMRoundNearestTiesToAway{ get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_AWAY; } }
1577
1581 public bool IsFPRMRoundTowardNegative{ get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_NEGATIVE; } }
1582
1586 public bool IsFPRMRoundTowardPositive{ get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_POSITIVE; } }
1587
1591 public bool IsFPRMRoundTowardZero{ get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_ZERO; } }
1592
1596 public bool IsFPRMExprRNE{ get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_EVEN; } }
1597
1601 public bool IsFPRMExprRNA { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_AWAY; } }
1602
1606 public bool IsFPRMExprRTN { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_NEGATIVE; } }
1607
1611 public bool IsFPRMExprRTP { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_POSITIVE; } }
1612
1616 public bool IsFPRMExprRTZ { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_ZERO; } }
1617
1621 public bool IsFPRMExpr {
1622 get {
1623 return IsApp &&
1624 (FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_AWAY||
1625 FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_EVEN ||
1626 FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_POSITIVE ||
1627 FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_NEGATIVE ||
1628 FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_ZERO);
1629 }
1630 }
1631
1635 public bool IsFPPlusInfinity{ get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_PLUS_INF; } }
1636
1640 public bool IsFPMinusInfinity{ get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_MINUS_INF; } }
1641
1645 public bool IsFPNaN { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_NAN; } }
1646
1650 public bool IsFPPlusZero { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_PLUS_ZERO; } }
1651
1655 public bool IsFPMinusZero { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_MINUS_ZERO; } }
1656
1660 public bool IsFPAdd { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_ADD; } }
1661
1662
1666 public bool IsFPSub { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_SUB; } }
1667
1671 public bool IsFPNeg { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_NEG; } }
1672
1676 public bool IsFPMul { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_MUL; } }
1677
1681 public bool IsFPDiv { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_DIV; } }
1682
1686 public bool IsFPRem { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_REM; } }
1687
1691 public bool IsFPAbs { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_ABS; } }
1692
1696 public bool IsFPMin { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_MIN; } }
1697
1701 public bool IsFPMax { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_MAX; } }
1702
1706 public bool IsFPFMA { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_FMA; } }
1707
1711 public bool IsFPSqrt { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_SQRT; } }
1712
1716 public bool IsFPRoundToIntegral { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_ROUND_TO_INTEGRAL; } }
1717
1721 public bool IsFPEq { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_EQ; } }
1722
1726 public bool IsFPLt { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_LT; } }
1727
1731 public bool IsFPGt { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_GT; } }
1732
1736 public bool IsFPLe { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_LE; } }
1737
1741 public bool IsFPGe { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_GE; } }
1742
1746 public bool IsFPisNaN { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_IS_NAN; } }
1747
1751 public bool IsFPisInf { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_IS_INF; } }
1752
1756 public bool IsFPisZero { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_IS_ZERO; } }
1757
1761 public bool IsFPisNormal { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_IS_NORMAL; } }
1762
1766 public bool IsFPisSubnormal { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_IS_SUBNORMAL; } }
1767
1771 public bool IsFPisNegative { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_IS_NEGATIVE; } }
1772
1776 public bool IsFPisPositive { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_IS_POSITIVE; } }
1777
1781 public bool IsFPFP { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_FP; } }
1782
1786 public bool IsFPToFp { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_TO_FP; } }
1787
1791 public bool IsFPToFpUnsigned { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_TO_FP_UNSIGNED; } }
1792
1796 public bool IsFPToUBV { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_TO_UBV; } }
1797
1801 public bool IsFPToSBV { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_TO_SBV; } }
1802
1806 public bool IsFPToReal { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_TO_REAL; } }
1807
1808
1812 public bool IsFPToIEEEBV { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_TO_IEEE_BV; } }
1813
1814 #endregion
1815 #endregion
1816
1817 #region Bound Variables
1837 public uint Index
1838 {
1839 get
1840 {
1841 if (!IsVar)
1842 throw new Z3Exception("Term is not a bound variable.");
1843
1844 return Native.Z3_get_index_value(Context.nCtx, NativeObject);
1845 }
1846 }
1847 #endregion
1848
1849 #region Internal
1853 internal protected Expr(Context ctx, IntPtr obj) : base(ctx, obj) { Debug.Assert(ctx != null); }
1854
1855#if DEBUG
1856 internal override void CheckNativeObject(IntPtr obj)
1857 {
1858 if (Native.Z3_is_app(Context.nCtx, obj) == 0 &&
1859 Native.Z3_get_ast_kind(Context.nCtx, obj) != (uint)Z3_ast_kind.Z3_VAR_AST &&
1860 Native.Z3_get_ast_kind(Context.nCtx, obj) != (uint)Z3_ast_kind.Z3_QUANTIFIER_AST)
1861 throw new Z3Exception("Underlying object is not a term");
1862 base.CheckNativeObject(obj);
1863 }
1864#endif
1865
1866 internal static Expr Create(Context ctx, FuncDecl f, params Expr[] arguments)
1867 {
1868 Debug.Assert(ctx != null);
1869 Debug.Assert(f != null);
1870
1871 IntPtr obj = Native.Z3_mk_app(ctx.nCtx, f.NativeObject,
1872 AST.ArrayLength(arguments),
1873 AST.ArrayToNative(arguments));
1874 return Create(ctx, obj);
1875 }
1876
1877 new internal static Expr Create(Context ctx, IntPtr obj)
1878 {
1879 Debug.Assert(ctx != null);
1880
1881 Z3_ast_kind k = (Z3_ast_kind)Native.Z3_get_ast_kind(ctx.nCtx, obj);
1882 if (k == Z3_ast_kind.Z3_QUANTIFIER_AST)
1883 return new Quantifier(ctx, obj);
1884 IntPtr s = Native.Z3_get_sort(ctx.nCtx, obj);
1885 Z3_sort_kind sk = (Z3_sort_kind)Native.Z3_get_sort_kind(ctx.nCtx, s);
1886
1887 if (0 != Native.Z3_is_algebraic_number(ctx.nCtx, obj)) // is this a numeral ast?
1888 return new AlgebraicNum(ctx, obj);
1889
1890 if (Native.Z3_is_numeral_ast(ctx.nCtx, obj) != 0)
1891 {
1892
1893 switch (sk)
1894 {
1895 case Z3_sort_kind.Z3_INT_SORT: return new IntNum(ctx, obj);
1896 case Z3_sort_kind.Z3_REAL_SORT: return new RatNum(ctx, obj);
1897 case Z3_sort_kind.Z3_BV_SORT: return new BitVecNum(ctx, obj);
1898 case Z3_sort_kind.Z3_FLOATING_POINT_SORT: return new FPNum(ctx, obj);
1899 case Z3_sort_kind.Z3_ROUNDING_MODE_SORT: return new FPRMNum(ctx, obj);
1900 case Z3_sort_kind.Z3_FINITE_DOMAIN_SORT: return new FiniteDomainNum(ctx, obj);
1901 }
1902 }
1903
1904 switch (sk)
1905 {
1906 case Z3_sort_kind.Z3_BOOL_SORT: return new BoolExpr(ctx, obj);
1907 case Z3_sort_kind.Z3_INT_SORT: return new IntExpr(ctx, obj);
1908 case Z3_sort_kind.Z3_REAL_SORT: return new RealExpr(ctx, obj);
1909 case Z3_sort_kind.Z3_BV_SORT: return new BitVecExpr(ctx, obj);
1910 case Z3_sort_kind.Z3_ARRAY_SORT: return new ArrayExpr(ctx, obj);
1911 case Z3_sort_kind.Z3_DATATYPE_SORT: return new DatatypeExpr(ctx, obj);
1912 case Z3_sort_kind.Z3_FLOATING_POINT_SORT: return new FPExpr(ctx, obj);
1913 case Z3_sort_kind.Z3_ROUNDING_MODE_SORT: return new FPRMExpr(ctx, obj);
1914 case Z3_sort_kind.Z3_FINITE_DOMAIN_SORT: return new FiniteDomainExpr(ctx, obj);
1915 case Z3_sort_kind.Z3_RE_SORT: return new ReExpr(ctx, obj);
1916 case Z3_sort_kind.Z3_SEQ_SORT: return new SeqExpr(ctx, obj);
1917 }
1918
1919 return new Expr(ctx, obj);
1920 }
1921 #endregion
1922 }
1923}
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:891
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:837
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:1011
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:1806
bool IsFPMinusInfinity
Indicates whether the term is a floating-point -oo.
Definition Expr.cs:1640
bool IsBVSLE
Indicates whether the term is a signed bit-vector less-than-or-equal.
Definition Expr.cs:668
bool IsFPRMRoundNearestTiesToAway
Indicates whether the term is the floating-point rounding numeral roundNearestTiesToAway.
Definition Expr.cs:1576
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:1397
bool IsFP
Indicates whether the terms is of floating-point sort.
Definition Expr.cs:1546
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:1443
bool IsBVConcat
Indicates whether the term is a bit-vector concatenation (binary)
Definition Expr.cs:738
bool IsFiniteDomain
Indicates whether the term is of an array sort.
Definition Expr.cs:1527
bool IsProofQuantIntro
Indicates whether the term is a quant-intro proof.
Definition Expr.cs:1035
bool IsConcat
Check whether expression is a concatenation.
Definition Expr.cs:873
bool IsAt
Check whether expression is an at.
Definition Expr.cs:909
uint Index
The de-Bruijn index of a bound variable.
Definition Expr.cs:1838
bool IsProofHypothesis
Indicates whether the term is a hypothesis marker.
Definition Expr.cs:1167
bool IsProofTrue
Indicates whether the term is a Proof for the expression 'true'.
Definition Expr.cs:937
bool IsBVBitZero
Indicates whether the term is a one-bit bit-vector with value zero.
Definition Expr.cs:588
bool IsRelationNegationFilter
Indicates whether the term is an intersection of a relation with the negation of another.
Definition Expr.cs:1483
bool IsBVZeroExtension
Indicates whether the term is a bit-vector zero extension.
Definition Expr.cs:748
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:1329
bool IsFPToFpUnsigned
Indicates whether the term is a floating-point conversion from unsigned bit-vector term.
Definition Expr.cs:1791
bool IsFPDiv
Indicates whether the term is a floating-point division term.
Definition Expr.cs:1681
bool IsBVShiftRightLogical
Indicates whether the term is a bit-vector logical shift right.
Definition Expr.cs:783
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:1736
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:1726
bool IsBVCarry
Indicates whether the term is a bit-vector carry.
Definition Expr.cs:831
bool IsFPRMExprRTN
Indicates whether the term is the floating-point rounding numeral roundTowardNegative.
Definition Expr.cs:1606
bool IsBVRotateLeft
Indicates whether the term is a bit-vector rotate left.
Definition Expr.cs:793
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:1586
bool IsBVAdd
Indicates whether the term is a bit-vector addition (binary)
Definition Expr.cs:598
bool IsFPRoundToIntegral
Indicates whether the term is a floating-point roundToIntegral term.
Definition Expr.cs:1716
bool IsFPEq
Indicates whether the term is a floating-point equality term.
Definition Expr.cs:1721
bool IsRelationStore
Indicates whether the term is an relation store.
Definition Expr.cs:1422
bool IsBVSGE
Indicates whether the term is a signed bit-vector greater-than-or-equal.
Definition Expr.cs:678
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:967
bool IsReplace
Check whether expression is a replace.
Definition Expr.cs:903
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:1378
bool IsFPFMA
Indicates whether the term is a floating-point fused multiply-add term.
Definition Expr.cs:1706
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:773
bool IsFPRMExprRTZ
Indicates whether the term is the floating-point rounding numeral roundTowardZero.
Definition Expr.cs:1616
bool IsProofIFFFalse
Indicates whether the term is a proof by iff-false.
Definition Expr.cs:1210
bool IsFPRMRoundTowardZero
Indicates whether the term is the floating-point rounding numeral roundTowardZero.
Definition Expr.cs:1591
bool IsBVULT
Indicates whether the term is an unsigned bit-vector less-than.
Definition Expr.cs:683
bool IsFPisPositive
Indicates whether the term is a floating-point isPositive predicate term.
Definition Expr.cs:1776
bool IsRelationSelect
Indicates whether the term is a relational select.
Definition Expr.cs:1507
bool IsProofElimUnusedVars
Indicates whether the term is a proof for elimination of unused variables.
Definition Expr.cs:1139
bool IsFPToUBV
Indicates whether the term is a floating-point conversion to unsigned bit-vector term.
Definition Expr.cs:1796
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:1180
bool IsBVReduceOR
Indicates whether the term is a bit-vector reduce OR.
Definition Expr.cs:763
bool IsArrayMap
Indicates whether the term is an array map.
Definition Expr.cs:529
bool IsProofDefIntro
Indicates whether the term is a proof for introduction of a name.
Definition Expr.cs:1282
bool IsBVNumeral
Indicates whether the term is a bit-vector numeral.
Definition Expr.cs:578
bool IsBVAND
Indicates whether the term is a bit-wise AND.
Definition Expr.cs:703
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:1691
bool IsRelationFilter
Indicates whether the term is a relation filter.
Definition Expr.cs:1467
bool IsProofApplyDef
Indicates whether the term is a proof for application of a definition.
Definition Expr.cs:1292
bool IsProofIFFTrue
Indicates whether the term is a proof by iff-true.
Definition Expr.cs:1201
bool IsIntToReal
Indicates whether the term is a coercion of integer to real (unary)
Definition Expr.cs:474
bool IsFPisNormal
Indicates whether the term is a floating-point isNormal term.
Definition Expr.cs:1761
bool IsString
Check whether expression is a string constant.
Definition Expr.cs:861
bool IsProofQuantInst
Indicates whether the term is a proof for quantifier instantiation.
Definition Expr.cs:1161
bool IsFPMax
Indicates whether the term is a floating-point maximum term.
Definition Expr.cs:1701
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:728
bool IsFPNaN
Indicates whether the term is a floating-point NaN.
Definition Expr.cs:1645
bool IsBVXOR
Indicates whether the term is a bit-wise XOR.
Definition Expr.cs:718
bool IsBVUGE
Indicates whether the term is an unsigned bit-vector greater-than-or-equal.
Definition Expr.cs:673
bool IsExtract
Check whether expression is an extract.
Definition Expr.cs:897
bool IsFPisZero
Indicates whether the term is a floating-point isZero predicate term.
Definition Expr.cs:1756
bool IsProofDER
Indicates whether the term is a proof for destructive equality resolution.
Definition Expr.cs:1153
bool IsIndex
Check whether expression is a sequence index.
Definition Expr.cs:921
bool IsRelationClone
Indicates whether the term is a relational clone (copy)
Definition Expr.cs:1519
bool IsFiniteDomainLT
Indicates whether the term is a less than predicate over a finite domain.
Definition Expr.cs:1538
bool IsIntToBV
Indicates whether the term is a coercion from integer to bit-vector.
Definition Expr.cs:817
bool IsLE
Indicates whether the term is a less-than-or-equal.
Definition Expr.cs:414
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:593
bool IsBVShiftRightArithmetic
Indicates whether the term is a bit-vector arithmetic shift left.
Definition Expr.cs:788
Expr(Context ctx, IntPtr obj)
Constructor for Expr.
Definition Expr.cs:1853
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:1801
bool IsBVXNOR
Indicates whether the term is a bit-wise XNOR.
Definition Expr.cs:733
bool IsFPRMExprRNA
Indicates whether the term is the floating-point rounding numeral roundNearestTiesToAway.
Definition Expr.cs:1601
bool IsFPGe
Indicates whether the term is a floating-point greater-than or equal term.
Definition Expr.cs:1741
bool IsFPMin
Indicates whether the term is a floating-point minimum term.
Definition Expr.cs:1696
bool IsSetUnion
Indicates whether the term is set union.
Definition Expr.cs:543
bool IsProofModusPonens
Indicates whether the term is proof via modus ponens.
Definition Expr.cs:958
bool IsBVReduceAND
Indicates whether the term is a bit-vector reduce AND.
Definition Expr.cs:768
bool IsAsArray
Indicates whether the term is an as-array term.
Definition Expr.cs:536
bool IsBVToInt
Indicates whether the term is a coercion from bit-vector to integer.
Definition Expr.cs:824
bool IsIDiv
Indicates whether the term is integer division (binary)
Definition Expr.cs:459
bool IsFPMul
Indicates whether the term is a floating-point multiplication term.
Definition Expr.cs:1676
bool IsModulus
Indicates whether the term is modulus (binary)
Definition Expr.cs:469
bool IsFPNumeral
Indicates whether the term is a floating-point numeral.
Definition Expr.cs:1561
bool IsProofRewriteStar
Indicates whether the term is a proof by rewriting.
Definition Expr.cs:1105
bool IsSetIntersect
Indicates whether the term is set intersection.
Definition Expr.cs:548
string String
Retrieve string corresponding to string constant.
Definition Expr.cs:867
bool IsBVRotateRight
Indicates whether the term is a bit-vector rotate right.
Definition Expr.cs:798
bool IsFPRMRoundNearestTiesToEven
Indicates whether the term is the floating-point rounding numeral roundNearestTiesToEven.
Definition Expr.cs:1571
bool IsFPisSubnormal
Indicates whether the term is a floating-point isSubnormal predicate term.
Definition Expr.cs:1766
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:434
bool IsLT
Indicates whether the term is a less-than.
Definition Expr.cs:424
bool IsFPRMNumeral
Indicates whether the term is a floating-point rounding mode numeral.
Definition Expr.cs:1566
bool IsStore
Indicates whether the term is an array store.
Definition Expr.cs:506
bool IsBVNAND
Indicates whether the term is a bit-wise NAND.
Definition Expr.cs:723
bool IsBVShiftLeft
Indicates whether the term is a bit-vector shift left.
Definition Expr.cs:778
bool IsMul
Indicates whether the term is multiplication (binary)
Definition Expr.cs:449
bool IsFPisNegative
Indicates whether the term is a floating-point isNegative predicate term.
Definition Expr.cs:1771
bool IsFPRem
Indicates whether the term is a floating-point remainder term.
Definition Expr.cs:1686
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:1812
bool IsProofPullQuant
Indicates whether the term is a proof for pulling quantifiers out.
Definition Expr.cs:1113
bool IsFPGt
Indicates whether the term is a floating-point greater-than term.
Definition Expr.cs:1731
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:1405
bool IsFPisInf
Indicates whether the term is a floating-point isInf predicate term.
Definition Expr.cs:1751
bool IsProofNNFNeg
Indicates whether the term is a proof for a negative NNF step.
Definition Expr.cs:1354
bool IsDiv
Indicates whether the term is division (binary)
Definition Expr.cs:454
bool IsBVRotateRightExtended
Indicates whether the term is a bit-vector rotate right (extended)
Definition Expr.cs:810
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:429
bool IsBVSDiv
Indicates whether the term is a bit-vector signed division (binary)
Definition Expr.cs:613
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:846
bool IsRemainder
Indicates whether the term is remainder (binary)
Definition Expr.cs:464
bool IsProofTransitivity
Indicates whether the term is a proof by transitivity of a relation.
Definition Expr.cs:990
bool IsRelationalJoin
Indicates whether the term is a relational join.
Definition Expr.cs:1437
bool IsOEQ
Indicates whether the term is a binary equivalence modulo namings.
Definition Expr.cs:932
bool IsDefaultArray
Indicates whether the term is a default array.
Definition Expr.cs:523
bool IsConstantArray
Indicates whether the term is a constant array.
Definition Expr.cs:517
bool IsGE
Indicates whether the term is a greater-than-or-equal.
Definition Expr.cs:419
bool IsRelationRename
Indicates whether the term is the renaming of a column in a relation.
Definition Expr.cs:1492
bool IsIsEmptyRelation
Indicates whether the term is a test for the emptiness of a relation.
Definition Expr.cs:1432
bool IsProofAsserted
Indicates whether the term is a proof for a fact asserted by the user.
Definition Expr.cs:942
bool IsFPRM
Indicates whether the terms is of floating-point rounding mode sort.
Definition Expr.cs:1554
bool IsProofOrElimination
Indicates whether the term is a proof by elimination of not-or.
Definition Expr.cs:1073
bool IsRealToInt
Indicates whether the term is a coercion of real to integer (unary)
Definition Expr.cs:479
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:1635
bool IsBV
Indicates whether the terms is of bit-vector sort.
Definition Expr.cs:571
bool IsProofMonotonicity
Indicates whether the term is a monotonicity proof object.
Definition Expr.cs:1025
bool IsFPisNaN
Indicates whether the term is a floating-point isNaN predicate term.
Definition Expr.cs:1746
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:1581
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:1259
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:885
bool IsBVSRem
Indicates whether the term is a bit-vector signed remainder (binary)
Definition Expr.cs:623
bool IsFPToFp
Indicates whether the term is a floating-point conversion term.
Definition Expr.cs:1786
bool IsLabelLit
Indicates whether the term is a label literal (used by the Boogie Verification condition generator).
Definition Expr.cs:852
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:1192
bool IsProofGoal
Indicates whether the term is a proof for a fact (tagged as goal) asserted by the user.
Definition Expr.cs:947
bool IsFPSqrt
Indicates whether the term is a floating-point square root term.
Definition Expr.cs:1711
bool IsSelect
Indicates whether the term is an array select.
Definition Expr.cs:511
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:1781
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:1655
bool IsRelationProject
Indicates whether the term is a projection of columns (provided as numbers in the parameters).
Definition Expr.cs:1455
bool IsUMinus
Indicates whether the term is a unary minus.
Definition Expr.cs:444
bool IsRelationWiden
Indicates whether the term is the widening of two relations.
Definition Expr.cs:1449
bool IsBVRepeat
Indicates whether the term is a bit-vector repetition.
Definition Expr.cs:758
bool IsSub
Indicates whether the term is subtraction (binary)
Definition Expr.cs:439
bool IsRelationComplement
Indicates whether the term is the complement of a relation.
Definition Expr.cs:1497
bool IsFPPlusZero
Definition Expr.cs:1650
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:708
bool IsBVSub
Indicates whether the term is a bit-vector subtraction (binary)
Definition Expr.cs:603
bool IsBVRotateLeftExtended
Indicates whether the term is a bit-vector rotate left (extended)
Definition Expr.cs:804
bool IsProofSymmetry
Indicates whether the term is proof by symmetricity of a relation.
Definition Expr.cs:978
bool IsProofSkolemize
Indicates whether the term is a proof for a Skolemization step.
Definition Expr.cs:1367
bool IsBVMul
Indicates whether the term is a bit-vector multiplication (binary)
Definition Expr.cs:608
bool IsLength
Check whether expression is a sequence length.
Definition Expr.cs:915
bool IsFPSub
Indicates whether the term is a floating-point subtraction term.
Definition Expr.cs:1666
bool IsBVUDiv
Indicates whether the term is a bit-vector unsigned division (binary)
Definition Expr.cs:618
bool IsProofCommutativity
Indicates whether the term is a proof by commutativity.
Definition Expr.cs:1223
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:1092
bool IsFPRMExprRNE
Indicates whether the term is the floating-point rounding numeral roundNearestTiesToEven.
Definition Expr.cs:1596
bool IsArithmeticNumeral
Indicates whether the term is an arithmetic numeral.
Definition Expr.cs:409
bool IsProofAndElimination
Indicates whether the term is a proof by elimination of AND.
Definition Expr.cs:1063
bool IsEmptyRelation
Indicates whether the term is an empty relation.
Definition Expr.cs:1427
bool IsProofPushQuant
Indicates whether the term is a proof for pushing quantifiers in.
Definition Expr.cs:1127
bool IsProofDistributivity
Indicates whether the term is a distributivity proof object.
Definition Expr.cs:1053
bool IsBVURem
Indicates whether the term is a bit-vector unsigned remainder (binary)
Definition Expr.cs:628
bool IsBVULE
Indicates whether the term is an unsigned bit-vector less-than-or-equal.
Definition Expr.cs:663
bool IsBVSLT
Indicates whether the term is a signed bit-vector less-than.
Definition Expr.cs:688
bool IsBVExtract
Indicates whether the term is a bit-vector extraction.
Definition Expr.cs:753
bool IsBVSignExtension
Indicates whether the term is a bit-vector sign extension.
Definition Expr.cs:743
bool IsRealIsInt
Indicates whether the term is a check that tests whether a real is integral (unary)
Definition Expr.cs:484
bool IsSetDifference
Indicates whether the term is set difference.
Definition Expr.cs:553
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:693
bool IsPrefix
Check whether expression is a prefix.
Definition Expr.cs:879
bool IsFPRMExprRTP
Indicates whether the term is the floating-point rounding numeral roundTowardPositive.
Definition Expr.cs:1611
bool IsFPAdd
Indicates whether the term is a floating-point addition term.
Definition Expr.cs:1660
bool IsFPRMExpr
Indicates whether the term is a floating-point rounding mode numeral.
Definition Expr.cs:1621
bool IsBVSMod
Indicates whether the term is a bit-vector signed modulus.
Definition Expr.cs:633
bool IsBVBitOne
Indicates whether the term is a one-bit bit-vector with value one.
Definition Expr.cs:583
bool IsFPNeg
Indicates whether the term is a floating-point negation term.
Definition Expr.cs:1671
bool IsArray
Indicates whether the term is of an array sort.
Definition Expr.cs:492
bool IsBVNOT
Indicates whether the term is a bit-wise NOT.
Definition Expr.cs:713
bool IsBVSGT
Indicates whether the term is a signed bit-vector greater-than.
Definition Expr.cs:698
bool IsSetSubset
Indicates whether the term is set subset.
Definition Expr.cs:563
bool IsSetComplement
Indicates whether the term is set complement.
Definition Expr.cs:558
bool IsProofIFFOEQ
Indicates whether the term is a proof iff-oeq.
Definition Expr.cs:1301
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:142
Z3_decl_kind
The different kinds of interpreted function kinds.
Definition z3_api.h:962
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