Z3
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
167 new public Expr Translate(Context ctx)
168 {
169 return (Expr)base.Translate(ctx);
170 }
171
178 public Expr Dup() {
179 return Expr.Create(Context, NativeObject);
180 }
181
185 public override string ToString()
186 {
187 return base.ToString();
188 }
189
193 public bool IsNumeral
194 {
195 get { return Native.Z3_is_numeral_ast(Context.nCtx, NativeObject) != 0; }
196 }
197
202 public bool IsWellSorted
203 {
204 get { return Native.Z3_is_well_sorted(Context.nCtx, NativeObject) != 0; }
205 }
206
210 public Sort Sort
211 {
212 get
213 {
214 return Sort.Create(Context, Native.Z3_get_sort(Context.nCtx, NativeObject));
215 }
216 }
217
218 #region Constants
222 public bool IsConst
223 {
224 get { return IsApp && NumArgs == 0 && FuncDecl.DomainSize == 0; }
225 }
226 #endregion
227
228 #region Integer Numerals
232 public bool IsIntNum
233 {
234 get { return IsNumeral && IsInt; }
235 }
236 #endregion
237
238 #region Real Numerals
242 public bool IsRatNum
243 {
244 get { return IsNumeral && IsReal; }
245 }
246 #endregion
247
248 #region Algebraic Numbers
253 {
254 get { return 0 != Native.Z3_is_algebraic_number(Context.nCtx, NativeObject); }
255 }
256 #endregion
257
258 #region Term Kind Tests
259
260 #region Boolean Terms
264 public bool IsBool
265 {
266 get
267 {
268 return (IsExpr &&
269 Native.Z3_is_eq_sort(Context.nCtx,
270 Native.Z3_mk_bool_sort(Context.nCtx),
271 Native.Z3_get_sort(Context.nCtx, NativeObject)) != 0);
272 }
273 }
274
278 public bool IsTrue { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_TRUE; } }
279
283 public bool IsFalse { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FALSE; } }
284
288 public bool IsEq { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_EQ; } }
289
293 public bool IsDistinct { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_DISTINCT; } }
294
298 public bool IsITE { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_ITE; } }
299
303 public bool IsAnd { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_AND; } }
304
308 public bool IsOr { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_OR; } }
309
313 public bool IsIff { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_IFF; } }
314
318 public bool IsXor { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_XOR; } }
319
323 public bool IsNot { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_NOT; } }
324
328 public bool IsImplies { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_IMPLIES; } }
329
333 public bool IsAtMost { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PB_AT_MOST; } }
334
338 public uint AtMostBound { get { Debug.Assert(IsAtMost); return (uint)FuncDecl.Parameters[0].Int; } }
339
343 public bool IsAtLeast { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PB_AT_LEAST; } }
344
348 public uint AtLeastBound { get { Debug.Assert(IsAtLeast); return (uint)FuncDecl.Parameters[0].Int; } }
349
353 public bool IsPbEq { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PB_EQ; } }
354
358 public bool IsPbLe { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PB_LE; } }
359
363 public bool IsPbGe { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PB_GE; } }
364
365 #endregion
366
367 #region Arithmetic Terms
371 public bool IsInt
372 {
373 get { return Native.Z3_get_sort_kind(Context.nCtx, Native.Z3_get_sort(Context.nCtx, NativeObject)) == (uint)Z3_sort_kind.Z3_INT_SORT; }
374 }
375
379 public bool IsReal
380 {
381 get { return Native.Z3_get_sort_kind(Context.nCtx, Native.Z3_get_sort(Context.nCtx, NativeObject)) == (uint)Z3_sort_kind.Z3_REAL_SORT; }
382 }
383
387 public bool IsArithmeticNumeral { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_ANUM; } }
388
392 public bool IsLE { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_LE; } }
393
397 public bool IsGE { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_GE; } }
398
402 public bool IsLT { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_LT; } }
403
407 public bool IsGT { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_GT; } }
408
412 public bool IsAdd { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_ADD; } }
413
417 public bool IsSub { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SUB; } }
418
422 public bool IsUMinus { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_UMINUS; } }
423
427 public bool IsMul { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_MUL; } }
428
432 public bool IsDiv { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_DIV; } }
433
437 public bool IsIDiv { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_IDIV; } }
438
442 public bool IsRemainder { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_REM; } }
443
447 public bool IsModulus { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_MOD; } }
448
452 public bool IsIntToReal { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_TO_REAL; } }
453
457 public bool IsRealToInt { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_TO_INT; } }
458
462 public bool IsRealIsInt { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_IS_INT; } }
463 #endregion
464
465 #region Array Terms
469 public bool IsArray
470 {
471 get
472 {
473 return (Native.Z3_is_app(Context.nCtx, NativeObject) != 0 &&
474 (Z3_sort_kind)Native.Z3_get_sort_kind(Context.nCtx, Native.Z3_get_sort(Context.nCtx, NativeObject))
475 == Z3_sort_kind.Z3_ARRAY_SORT);
476 }
477 }
478
484 public bool IsStore { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_STORE; } }
485
489 public bool IsSelect { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SELECT; } }
490
495 public bool IsConstantArray { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_CONST_ARRAY; } }
496
501 public bool IsDefaultArray { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_ARRAY_DEFAULT; } }
502
507 public bool IsArrayMap { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_ARRAY_MAP; } }
508
514 public bool IsAsArray { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_AS_ARRAY; } }
515 #endregion
516
517 #region Set Terms
521 public bool IsSetUnion { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SET_UNION; } }
522
526 public bool IsSetIntersect { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SET_INTERSECT; } }
527
531 public bool IsSetDifference { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SET_DIFFERENCE; } }
532
536 public bool IsSetComplement { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SET_COMPLEMENT; } }
537
541 public bool IsSetSubset { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SET_SUBSET; } }
542 #endregion
543
544 #region Bit-vector terms
548 public bool IsBV
549 {
550 get { return Native.Z3_get_sort_kind(Context.nCtx, Native.Z3_get_sort(Context.nCtx, NativeObject)) == (uint)Z3_sort_kind.Z3_BV_SORT; }
551 }
552
556 public bool IsBVNumeral { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BNUM; } }
557
561 public bool IsBVBitOne { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BIT1; } }
562
566 public bool IsBVBitZero { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BIT0; } }
567
571 public bool IsBVUMinus { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BNEG; } }
572
576 public bool IsBVAdd { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BADD; } }
577
581 public bool IsBVSub { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BSUB; } }
582
586 public bool IsBVMul { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BMUL; } }
587
591 public bool IsBVSDiv { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BSDIV; } }
592
596 public bool IsBVUDiv { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BUDIV; } }
597
601 public bool IsBVSRem { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BSREM; } }
602
606 public bool IsBVURem { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BUREM; } }
607
611 public bool IsBVSMod { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BSMOD; } }
612
616 internal bool IsBVSDiv0 { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BSDIV0; } }
617
621 internal bool IsBVUDiv0 { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BUDIV0; } }
622
626 internal bool IsBVSRem0 { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BSREM0; } }
627
631 internal bool IsBVURem0 { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BUREM0; } }
632
636 internal bool IsBVSMod0 { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BSMOD0; } }
637
641 public bool IsBVULE { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_ULEQ; } }
642
646 public bool IsBVSLE { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SLEQ; } }
647
651 public bool IsBVUGE { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_UGEQ; } }
652
656 public bool IsBVSGE { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SGEQ; } }
657
661 public bool IsBVULT { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_ULT; } }
662
666 public bool IsBVSLT { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SLT; } }
667
671 public bool IsBVUGT { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_UGT; } }
672
676 public bool IsBVSGT { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SGT; } }
677
681 public bool IsBVAND { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BAND; } }
682
686 public bool IsBVOR { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BOR; } }
687
691 public bool IsBVNOT { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BNOT; } }
692
696 public bool IsBVXOR { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BXOR; } }
697
701 public bool IsBVNAND { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BNAND; } }
702
706 public bool IsBVNOR { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BNOR; } }
707
711 public bool IsBVXNOR { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BXNOR; } }
712
716 public bool IsBVConcat { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_CONCAT; } }
717
721 public bool IsBVSignExtension { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SIGN_EXT; } }
722
726 public bool IsBVZeroExtension { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_ZERO_EXT; } }
727
731 public bool IsBVExtract { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_EXTRACT; } }
732
736 public bool IsBVRepeat { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_REPEAT; } }
737
741 public bool IsBVReduceOR { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BREDOR; } }
742
746 public bool IsBVReduceAND { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BREDAND; } }
747
751 public bool IsBVComp { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BCOMP; } }
752
756 public bool IsBVShiftLeft { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BSHL; } }
757
761 public bool IsBVShiftRightLogical { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BLSHR; } }
762
766 public bool IsBVShiftRightArithmetic { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BASHR; } }
767
771 public bool IsBVRotateLeft { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_ROTATE_LEFT; } }
772
776 public bool IsBVRotateRight { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_ROTATE_RIGHT; } }
777
782 public bool IsBVRotateLeftExtended { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_EXT_ROTATE_LEFT; } }
783
788 public bool IsBVRotateRightExtended { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_EXT_ROTATE_RIGHT; } }
789
795 public bool IsIntToBV { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_INT2BV; } }
796
802 public bool IsBVToInt { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_BV2INT; } }
803
809 public bool IsBVCarry { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_CARRY; } }
810
815 public bool IsBVXOR3 { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_XOR3; } }
816
817 #endregion
818
819 #region Labels
824 public bool IsLabel { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_LABEL; } }
825
830 public bool IsLabelLit { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_LABEL_LIT; } }
831 #endregion
832
833 #region Sequences and Strings
834
839 public bool IsString { get { return IsApp && Native.Z3_is_string(Context.nCtx, NativeObject) != 0; } }
840
845 public string String { get { return Native.Z3_get_string(Context.nCtx, NativeObject); } }
846
851 public bool IsConcat { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_CONCAT; } }
852
857 public bool IsPrefix { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_PREFIX; } }
858
863 public bool IsSuffix { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_SUFFIX; } }
864
869 public bool IsContains { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_CONTAINS; } }
870
875 public bool IsExtract { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_EXTRACT; } }
876
881 public bool IsReplace { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_REPLACE; } }
882
887 public bool IsAt { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_AT; } }
888
893 public bool IsLength { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_LENGTH; } }
894
899 public bool IsIndex { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_SEQ_INDEX; } }
900
901
902 #endregion
903
904 #region Proof Terms
910 public bool IsOEQ { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_OEQ; } }
911
915 public bool IsProofTrue { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_TRUE; } }
916
920 public bool IsProofAsserted { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_ASSERTED; } }
921
925 public bool IsProofGoal { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_GOAL; } }
926
936 public bool IsProofModusPonens { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_MODUS_PONENS; } }
937
945 public bool IsProofReflexivity { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_REFLEXIVITY; } }
946
956 public bool IsProofSymmetry { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_SYMMETRY; } }
957
968 public bool IsProofTransitivity { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_TRANSITIVITY; } }
969
989 public bool IsProofTransitivityStar { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_TRANSITIVITY_STAR; } }
990
991
1003 public bool IsProofMonotonicity { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_MONOTONICITY; } }
1004
1013 public bool IsProofQuantIntro { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_QUANT_INTRO; } }
1014
1031 public bool IsProofDistributivity { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_DISTRIBUTIVITY; } }
1032
1041 public bool IsProofAndElimination { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_AND_ELIM; } }
1042
1051 public bool IsProofOrElimination { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_NOT_OR_ELIM; } }
1052
1070 public bool IsProofRewrite { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_REWRITE; } }
1071
1083 public bool IsProofRewriteStar { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_REWRITE_STAR; } }
1084
1091 public bool IsProofPullQuant { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_PULL_QUANT; } }
1092
1093
1105 public bool IsProofPushQuant { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_PUSH_QUANT; } }
1106
1117 public bool IsProofElimUnusedVars { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_ELIM_UNUSED_VARS; } }
1118
1131 public bool IsProofDER { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_DER; } }
1132
1139 public bool IsProofQuantInst { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_QUANT_INST; } }
1140
1145 public bool IsProofHypothesis { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_HYPOTHESIS; } }
1146
1158 public bool IsProofLemma { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_LEMMA; } }
1159
1170 public bool IsProofUnitResolution { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_UNIT_RESOLUTION; } }
1171
1179 public bool IsProofIFFTrue { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_IFF_TRUE; } }
1180
1188 public bool IsProofIFFFalse { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_IFF_FALSE; } }
1189
1201 public bool IsProofCommutativity { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_COMMUTATIVITY; } }
1202
1237 public bool IsProofDefAxiom { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_DEF_AXIOM; } }
1238
1260 public bool IsProofDefIntro { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_DEF_INTRO; } }
1261
1270 public bool IsProofApplyDef { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_APPLY_DEF; } }
1271
1279 public bool IsProofIFFOEQ { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_IFF_OEQ; } }
1280
1307 public bool IsProofNNFPos { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_NNF_POS; } }
1308
1332 public bool IsProofNNFNeg { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_NNF_NEG; } }
1333
1345 public bool IsProofSkolemize { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_SKOLEMIZE; } }
1346
1356 public bool IsProofModusPonensOEQ { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_MODUS_PONENS_OEQ; } }
1357
1375 public bool IsProofTheoryLemma { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_PR_TH_LEMMA; } }
1376 #endregion
1377
1378 #region Relational Terms
1382 public bool IsRelation
1383 {
1384 get
1385 {
1386 return (Native.Z3_is_app(Context.nCtx, NativeObject) != 0 &&
1387 Native.Z3_get_sort_kind(Context.nCtx, Native.Z3_get_sort(Context.nCtx, NativeObject))
1388 == (uint)Z3_sort_kind.Z3_RELATION_SORT);
1389 }
1390 }
1391
1400 public bool IsRelationStore { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_STORE; } }
1401
1405 public bool IsEmptyRelation { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_EMPTY; } }
1406
1410 public bool IsIsEmptyRelation { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_IS_EMPTY; } }
1411
1415 public bool IsRelationalJoin { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_JOIN; } }
1416
1421 public bool IsRelationUnion { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_UNION; } }
1422
1427 public bool IsRelationWiden { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_WIDEN; } }
1428
1433 public bool IsRelationProject { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_PROJECT; } }
1434
1445 public bool IsRelationFilter { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_FILTER; } }
1446
1461 public bool IsRelationNegationFilter { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_NEGATION_FILTER; } }
1462
1470 public bool IsRelationRename { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_RENAME; } }
1471
1475 public bool IsRelationComplement { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_COMPLEMENT; } }
1476
1485 public bool IsRelationSelect { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_SELECT; } }
1486
1497 public bool IsRelationClone { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_RA_CLONE; } }
1498 #endregion
1499
1500 #region Finite domain terms
1504 public bool IsFiniteDomain
1505 {
1506 get
1507 {
1508 return (Native.Z3_is_app(Context.nCtx, NativeObject) != 0 &&
1509 Native.Z3_get_sort_kind(Context.nCtx, Native.Z3_get_sort(Context.nCtx, NativeObject)) == (uint)Z3_sort_kind.Z3_FINITE_DOMAIN_SORT);
1510 }
1511 }
1512
1516 public bool IsFiniteDomainLT { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FD_LT; } }
1517 #endregion
1518
1519 #region Floating-point terms
1523 public bool IsFP
1524 {
1525 get { return Native.Z3_get_sort_kind(Context.nCtx, Native.Z3_get_sort(Context.nCtx, NativeObject)) == (uint)Z3_sort_kind.Z3_FLOATING_POINT_SORT; }
1526 }
1527
1531 public bool IsFPRM
1532 {
1533 get { return Native.Z3_get_sort_kind(Context.nCtx, Native.Z3_get_sort(Context.nCtx, NativeObject)) == (uint)Z3_sort_kind.Z3_ROUNDING_MODE_SORT; }
1534 }
1535
1539 public bool IsFPNumeral { get { return IsFP && IsNumeral; } }
1540
1544 public bool IsFPRMNumeral { get { return IsFPRM && IsNumeral; } }
1545
1549 public bool IsFPRMRoundNearestTiesToEven{ get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_EVEN; } }
1550
1554 public bool IsFPRMRoundNearestTiesToAway{ get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_AWAY; } }
1555
1559 public bool IsFPRMRoundTowardNegative{ get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_NEGATIVE; } }
1560
1564 public bool IsFPRMRoundTowardPositive{ get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_POSITIVE; } }
1565
1569 public bool IsFPRMRoundTowardZero{ get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_ZERO; } }
1570
1574 public bool IsFPRMExprRNE{ get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_EVEN; } }
1575
1579 public bool IsFPRMExprRNA { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_AWAY; } }
1580
1584 public bool IsFPRMExprRTN { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_NEGATIVE; } }
1585
1589 public bool IsFPRMExprRTP { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_POSITIVE; } }
1590
1594 public bool IsFPRMExprRTZ { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_ZERO; } }
1595
1599 public bool IsFPRMExpr {
1600 get {
1601 return IsApp &&
1602 (FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_AWAY||
1603 FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_NEAREST_TIES_TO_EVEN ||
1604 FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_POSITIVE ||
1605 FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_NEGATIVE ||
1606 FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_RM_TOWARD_ZERO);
1607 }
1608 }
1609
1613 public bool IsFPPlusInfinity{ get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_PLUS_INF; } }
1614
1618 public bool IsFPMinusInfinity{ get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_MINUS_INF; } }
1619
1623 public bool IsFPNaN { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_NAN; } }
1624
1628 public bool IsFPPlusZero { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_PLUS_ZERO; } }
1629
1633 public bool IsFPMinusZero { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_MINUS_ZERO; } }
1634
1638 public bool IsFPAdd { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_ADD; } }
1639
1640
1644 public bool IsFPSub { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_SUB; } }
1645
1649 public bool IsFPNeg { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_NEG; } }
1650
1654 public bool IsFPMul { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_MUL; } }
1655
1659 public bool IsFPDiv { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_DIV; } }
1660
1664 public bool IsFPRem { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_REM; } }
1665
1669 public bool IsFPAbs { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_ABS; } }
1670
1674 public bool IsFPMin { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_MIN; } }
1675
1679 public bool IsFPMax { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_MAX; } }
1680
1684 public bool IsFPFMA { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_FMA; } }
1685
1689 public bool IsFPSqrt { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_SQRT; } }
1690
1694 public bool IsFPRoundToIntegral { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_ROUND_TO_INTEGRAL; } }
1695
1699 public bool IsFPEq { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_EQ; } }
1700
1704 public bool IsFPLt { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_LT; } }
1705
1709 public bool IsFPGt { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_GT; } }
1710
1714 public bool IsFPLe { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_LE; } }
1715
1719 public bool IsFPGe { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_GE; } }
1720
1724 public bool IsFPisNaN { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_IS_NAN; } }
1725
1729 public bool IsFPisInf { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_IS_INF; } }
1730
1734 public bool IsFPisZero { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_IS_ZERO; } }
1735
1739 public bool IsFPisNormal { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_IS_NORMAL; } }
1740
1744 public bool IsFPisSubnormal { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_IS_SUBNORMAL; } }
1745
1749 public bool IsFPisNegative { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_IS_NEGATIVE; } }
1750
1754 public bool IsFPisPositive { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_IS_POSITIVE; } }
1755
1759 public bool IsFPFP { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_FP; } }
1760
1764 public bool IsFPToFp { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_TO_FP; } }
1765
1769 public bool IsFPToFpUnsigned { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_TO_FP_UNSIGNED; } }
1770
1774 public bool IsFPToUBV { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_TO_UBV; } }
1775
1779 public bool IsFPToSBV { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_TO_SBV; } }
1780
1784 public bool IsFPToReal { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_TO_REAL; } }
1785
1786
1790 public bool IsFPToIEEEBV { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_FPA_TO_IEEE_BV; } }
1791
1792 #endregion
1793 #endregion
1794
1795 #region Bound Variables
1815 public uint Index
1816 {
1817 get
1818 {
1819 if (!IsVar)
1820 throw new Z3Exception("Term is not a bound variable.");
1821
1822 return Native.Z3_get_index_value(Context.nCtx, NativeObject);
1823 }
1824 }
1825 #endregion
1826
1827 #region Internal
1831 internal protected Expr(Context ctx, IntPtr obj) : base(ctx, obj) { Debug.Assert(ctx != null); }
1832
1833#if DEBUG
1834 internal override void CheckNativeObject(IntPtr obj)
1835 {
1836 if (Native.Z3_is_app(Context.nCtx, obj) == 0 &&
1837 Native.Z3_get_ast_kind(Context.nCtx, obj) != (uint)Z3_ast_kind.Z3_VAR_AST &&
1838 Native.Z3_get_ast_kind(Context.nCtx, obj) != (uint)Z3_ast_kind.Z3_QUANTIFIER_AST)
1839 throw new Z3Exception("Underlying object is not a term");
1840 base.CheckNativeObject(obj);
1841 }
1842#endif
1843
1844 internal static Expr Create(Context ctx, FuncDecl f, params Expr[] arguments)
1845 {
1846 Debug.Assert(ctx != null);
1847 Debug.Assert(f != null);
1848
1849 IntPtr obj = Native.Z3_mk_app(ctx.nCtx, f.NativeObject,
1850 AST.ArrayLength(arguments),
1851 AST.ArrayToNative(arguments));
1852 return Create(ctx, obj);
1853 }
1854
1855 new internal static Expr Create(Context ctx, IntPtr obj)
1856 {
1857 Debug.Assert(ctx != null);
1858
1859 Z3_ast_kind k = (Z3_ast_kind)Native.Z3_get_ast_kind(ctx.nCtx, obj);
1860 if (k == Z3_ast_kind.Z3_QUANTIFIER_AST)
1861 return new Quantifier(ctx, obj);
1862 IntPtr s = Native.Z3_get_sort(ctx.nCtx, obj);
1863 Z3_sort_kind sk = (Z3_sort_kind)Native.Z3_get_sort_kind(ctx.nCtx, s);
1864
1865 if (0 != Native.Z3_is_algebraic_number(ctx.nCtx, obj)) // is this a numeral ast?
1866 return new AlgebraicNum(ctx, obj);
1867
1868 if (Native.Z3_is_numeral_ast(ctx.nCtx, obj) != 0)
1869 {
1870
1871 switch (sk)
1872 {
1873 case Z3_sort_kind.Z3_INT_SORT: return new IntNum(ctx, obj);
1874 case Z3_sort_kind.Z3_REAL_SORT: return new RatNum(ctx, obj);
1875 case Z3_sort_kind.Z3_BV_SORT: return new BitVecNum(ctx, obj);
1876 case Z3_sort_kind.Z3_FLOATING_POINT_SORT: return new FPNum(ctx, obj);
1877 case Z3_sort_kind.Z3_ROUNDING_MODE_SORT: return new FPRMNum(ctx, obj);
1878 case Z3_sort_kind.Z3_FINITE_DOMAIN_SORT: return new FiniteDomainNum(ctx, obj);
1879 }
1880 }
1881
1882 switch (sk)
1883 {
1884 case Z3_sort_kind.Z3_BOOL_SORT: return new BoolExpr(ctx, obj);
1885 case Z3_sort_kind.Z3_INT_SORT: return new IntExpr(ctx, obj);
1886 case Z3_sort_kind.Z3_REAL_SORT: return new RealExpr(ctx, obj);
1887 case Z3_sort_kind.Z3_BV_SORT: return new BitVecExpr(ctx, obj);
1888 case Z3_sort_kind.Z3_ARRAY_SORT: return new ArrayExpr(ctx, obj);
1889 case Z3_sort_kind.Z3_DATATYPE_SORT: return new DatatypeExpr(ctx, obj);
1890 case Z3_sort_kind.Z3_FLOATING_POINT_SORT: return new FPExpr(ctx, obj);
1891 case Z3_sort_kind.Z3_ROUNDING_MODE_SORT: return new FPRMExpr(ctx, obj);
1892 case Z3_sort_kind.Z3_FINITE_DOMAIN_SORT: return new FiniteDomainExpr(ctx, obj);
1893 case Z3_sort_kind.Z3_RE_SORT: return new ReExpr(ctx, obj);
1894 case Z3_sort_kind.Z3_SEQ_SORT: return new SeqExpr(ctx, obj);
1895 }
1896
1897 return new Expr(ctx, obj);
1898 }
1899 #endregion
1900 }
1901}
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:338
bool IsContains
Check whether expression is a contains.
Definition: Expr.cs:869
bool IsInt
Indicates whether the term is of integer sort.
Definition: Expr.cs:372
bool IsBVXOR3
Indicates whether the term is a bit-vector ternary XOR
Definition: Expr.cs:815
bool IsConst
Indicates whether the term represents a constant.
Definition: Expr.cs:223
bool IsProofTransitivityStar
Indicates whether the term is a proof by condensed transitivity of a relation
Definition: Expr.cs:989
bool IsXor
Indicates whether the term is an exclusive or
Definition: Expr.cs:318
bool IsFPToReal
Indicates whether the term is a floating-point conversion to real term
Definition: Expr.cs:1784
bool IsFPMinusInfinity
Indicates whether the term is a floating-point -oo
Definition: Expr.cs:1618
bool IsBVSLE
Indicates whether the term is a signed bit-vector less-than-or-equal
Definition: Expr.cs:646
bool IsFPRMRoundNearestTiesToAway
Indicates whether the term is the floating-point rounding numeral roundNearestTiesToAway
Definition: Expr.cs:1554
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:1375
bool IsFP
Indicates whether the terms is of floating-point sort.
Definition: Expr.cs:1524
bool IsIntNum
Indicates whether the term is an integer numeral.
Definition: Expr.cs:233
bool IsRelationUnion
Indicates whether the term is the union or convex hull of two relations.
Definition: Expr.cs:1421
bool IsBVConcat
Indicates whether the term is a bit-vector concatenation (binary)
Definition: Expr.cs:716
bool IsFiniteDomain
Indicates whether the term is of an array sort.
Definition: Expr.cs:1505
bool IsProofQuantIntro
Indicates whether the term is a quant-intro proof
Definition: Expr.cs:1013
bool IsConcat
Check whether expression is a concatenation.
Definition: Expr.cs:851
bool IsAt
Check whether expression is an at.
Definition: Expr.cs:887
uint Index
The de-Bruijn index of a bound variable.
Definition: Expr.cs:1816
bool IsProofHypothesis
Indicates whether the term is a hypothesis marker.
Definition: Expr.cs:1145
bool IsProofTrue
Indicates whether the term is a Proof for the expression 'true'.
Definition: Expr.cs:915
bool IsBVBitZero
Indicates whether the term is a one-bit bit-vector with value zero
Definition: Expr.cs:566
bool IsRelationNegationFilter
Indicates whether the term is an intersection of a relation with the negation of another.
Definition: Expr.cs:1461
bool IsBVZeroExtension
Indicates whether the term is a bit-vector zero extension
Definition: Expr.cs:726
Expr Dup()
Create a duplicate of expression. This feature is to allow extending the life-time of expressions tha...
Definition: Expr.cs:178
bool IsProofNNFPos
Indicates whether the term is a proof for a positive NNF step
Definition: Expr.cs:1307
bool IsFPToFpUnsigned
Indicates whether the term is a floating-point conversion from unsigned bit-vector term
Definition: Expr.cs:1769
bool IsFPDiv
Indicates whether the term is a floating-point division term
Definition: Expr.cs:1659
bool IsBVShiftRightLogical
Indicates whether the term is a bit-vector logical shift right
Definition: Expr.cs:761
bool IsPbEq
Indicates whether the term is pbeq
Definition: Expr.cs:353
bool IsFPLe
Indicates whether the term is a floating-point less-than or equal term
Definition: Expr.cs:1714
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:1704
bool IsBVCarry
Indicates whether the term is a bit-vector carry
Definition: Expr.cs:809
bool IsFPRMExprRTN
Indicates whether the term is the floating-point rounding numeral roundTowardNegative
Definition: Expr.cs:1584
bool IsBVRotateLeft
Indicates whether the term is a bit-vector rotate left
Definition: Expr.cs:771
bool IsTrue
Indicates whether the term is the constant true.
Definition: Expr.cs:278
bool IsFPRMRoundTowardPositive
Indicates whether the term is the floating-point rounding numeral roundTowardPositive
Definition: Expr.cs:1564
bool IsBVAdd
Indicates whether the term is a bit-vector addition (binary)
Definition: Expr.cs:576
bool IsFPRoundToIntegral
Indicates whether the term is a floating-point roundToIntegral term
Definition: Expr.cs:1694
bool IsFPEq
Indicates whether the term is a floating-point equality term
Definition: Expr.cs:1699
bool IsRelationStore
Indicates whether the term is an relation store
Definition: Expr.cs:1400
bool IsBVSGE
Indicates whether the term is a signed bit-vector greater-than-or-equal
Definition: Expr.cs:656
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:945
bool IsReplace
Check whether expression is a replace.
Definition: Expr.cs:881
new Expr Translate(Context ctx)
Translates (copies) the term to the Context ctx .
Definition: Expr.cs:167
bool IsProofModusPonensOEQ
Indicates whether the term is a proof by modus ponens for equi-satisfiability.
Definition: Expr.cs:1356
bool IsFPFMA
Indicates whether the term is a floating-point fused multiply-add term
Definition: Expr.cs:1684
bool IsRatNum
Indicates whether the term is a real numeral.
Definition: Expr.cs:243
bool IsNumeral
Indicates whether the term is a numeral
Definition: Expr.cs:194
bool IsBVComp
Indicates whether the term is a bit-vector comparison
Definition: Expr.cs:751
bool IsFPRMExprRTZ
Indicates whether the term is the floating-point rounding numeral roundTowardZero
Definition: Expr.cs:1594
bool IsProofIFFFalse
Indicates whether the term is a proof by iff-false
Definition: Expr.cs:1188
bool IsFPRMRoundTowardZero
Indicates whether the term is the floating-point rounding numeral roundTowardZero
Definition: Expr.cs:1569
bool IsBVULT
Indicates whether the term is an unsigned bit-vector less-than
Definition: Expr.cs:661
bool IsFPisPositive
Indicates whether the term is a floating-point isPositive predicate term
Definition: Expr.cs:1754
bool IsRelationSelect
Indicates whether the term is a relational select
Definition: Expr.cs:1485
bool IsProofElimUnusedVars
Indicates whether the term is a proof for elimination of unused variables.
Definition: Expr.cs:1117
bool IsFPToUBV
Indicates whether the term is a floating-point conversion to unsigned bit-vector term
Definition: Expr.cs:1774
bool IsFalse
Indicates whether the term is the constant false.
Definition: Expr.cs:283
bool IsPbLe
Indicates whether the term is pble
Definition: Expr.cs:358
bool IsEq
Indicates whether the term is an equality predicate.
Definition: Expr.cs:288
bool IsProofLemma
Indicates whether the term is a proof by lemma
Definition: Expr.cs:1158
bool IsBVReduceOR
Indicates whether the term is a bit-vector reduce OR
Definition: Expr.cs:741
bool IsArrayMap
Indicates whether the term is an array map.
Definition: Expr.cs:507
bool IsProofDefIntro
Indicates whether the term is a proof for introduction of a name
Definition: Expr.cs:1260
bool IsBVNumeral
Indicates whether the term is a bit-vector numeral
Definition: Expr.cs:556
bool IsBVAND
Indicates whether the term is a bit-wise AND
Definition: Expr.cs:681
bool IsPbGe
Indicates whether the term is pbge
Definition: Expr.cs:363
bool IsFPAbs
Indicates whether the term is a floating-point term absolute value term
Definition: Expr.cs:1669
bool IsRelationFilter
Indicates whether the term is a relation filter
Definition: Expr.cs:1445
bool IsProofApplyDef
Indicates whether the term is a proof for application of a definition
Definition: Expr.cs:1270
bool IsProofIFFTrue
Indicates whether the term is a proof by iff-true
Definition: Expr.cs:1179
bool IsIntToReal
Indicates whether the term is a coercion of integer to real (unary)
Definition: Expr.cs:452
bool IsFPisNormal
Indicates whether the term is a floating-point isNormal term
Definition: Expr.cs:1739
bool IsString
Check whether expression is a string constant.
Definition: Expr.cs:839
bool IsProofQuantInst
Indicates whether the term is a proof for quantifier instantiation
Definition: Expr.cs:1139
bool IsFPMax
Indicates whether the term is a floating-point maximum term
Definition: Expr.cs:1679
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:313
bool IsBVNOR
Indicates whether the term is a bit-wise NOR
Definition: Expr.cs:706
bool IsFPNaN
Indicates whether the term is a floating-point NaN
Definition: Expr.cs:1623
bool IsBVXOR
Indicates whether the term is a bit-wise XOR
Definition: Expr.cs:696
bool IsBVUGE
Indicates whether the term is an unsigned bit-vector greater-than-or-equal
Definition: Expr.cs:651
bool IsExtract
Check whether expression is an extract.
Definition: Expr.cs:875
bool IsFPisZero
Indicates whether the term is a floating-point isZero predicate term
Definition: Expr.cs:1734
bool IsProofDER
Indicates whether the term is a proof for destructive equality resolution
Definition: Expr.cs:1131
bool IsIndex
Check whether expression is a sequence index.
Definition: Expr.cs:899
bool IsRelationClone
Indicates whether the term is a relational clone (copy)
Definition: Expr.cs:1497
bool IsFiniteDomainLT
Indicates whether the term is a less than predicate over a finite domain.
Definition: Expr.cs:1516
bool IsIntToBV
Indicates whether the term is a coercion from integer to bit-vector
Definition: Expr.cs:795
bool IsLE
Indicates whether the term is a less-than-or-equal
Definition: Expr.cs:392
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:571
bool IsBVShiftRightArithmetic
Indicates whether the term is a bit-vector arithmetic shift left
Definition: Expr.cs:766
Expr(Context ctx, IntPtr obj)
Constructor for Expr
Definition: Expr.cs:1831
bool IsOr
Indicates whether the term is an n-ary disjunction
Definition: Expr.cs:308
bool IsFPToSBV
Indicates whether the term is a floating-point conversion to signed bit-vector term
Definition: Expr.cs:1779
bool IsBVXNOR
Indicates whether the term is a bit-wise XNOR
Definition: Expr.cs:711
bool IsFPRMExprRNA
Indicates whether the term is the floating-point rounding numeral roundNearestTiesToAway
Definition: Expr.cs:1579
bool IsFPGe
Indicates whether the term is a floating-point greater-than or equal term
Definition: Expr.cs:1719
bool IsFPMin
Indicates whether the term is a floating-point minimum term
Definition: Expr.cs:1674
bool IsSetUnion
Indicates whether the term is set union
Definition: Expr.cs:521
bool IsProofModusPonens
Indicates whether the term is proof via modus ponens
Definition: Expr.cs:936
bool IsBVReduceAND
Indicates whether the term is a bit-vector reduce AND
Definition: Expr.cs:746
bool IsAsArray
Indicates whether the term is an as-array term.
Definition: Expr.cs:514
bool IsBVToInt
Indicates whether the term is a coercion from bit-vector to integer
Definition: Expr.cs:802
bool IsIDiv
Indicates whether the term is integer division (binary)
Definition: Expr.cs:437
bool IsFPMul
Indicates whether the term is a floating-point multiplication term
Definition: Expr.cs:1654
bool IsModulus
Indicates whether the term is modulus (binary)
Definition: Expr.cs:447
bool IsFPNumeral
Indicates whether the term is a floating-point numeral
Definition: Expr.cs:1539
bool IsProofRewriteStar
Indicates whether the term is a proof by rewriting
Definition: Expr.cs:1083
bool IsSetIntersect
Indicates whether the term is set intersection
Definition: Expr.cs:526
string String
Retrieve string corresponding to string constant.
Definition: Expr.cs:845
bool IsBVRotateRight
Indicates whether the term is a bit-vector rotate right
Definition: Expr.cs:776
bool IsFPRMRoundNearestTiesToEven
Indicates whether the term is the floating-point rounding numeral roundNearestTiesToEven
Definition: Expr.cs:1549
bool IsFPisSubnormal
Indicates whether the term is a floating-point isSubnormal predicate term
Definition: Expr.cs:1744
bool IsAtLeast
Indicates whether the term is at-least
Definition: Expr.cs:343
bool IsITE
Indicates whether the term is a ternary if-then-else term
Definition: Expr.cs:298
bool IsAdd
Indicates whether the term is addition (binary)
Definition: Expr.cs:412
bool IsLT
Indicates whether the term is a less-than
Definition: Expr.cs:402
bool IsFPRMNumeral
Indicates whether the term is a floating-point rounding mode numeral
Definition: Expr.cs:1544
bool IsStore
Indicates whether the term is an array store.
Definition: Expr.cs:484
bool IsBVNAND
Indicates whether the term is a bit-wise NAND
Definition: Expr.cs:701
bool IsBVShiftLeft
Indicates whether the term is a bit-vector shift left
Definition: Expr.cs:756
bool IsMul
Indicates whether the term is multiplication (binary)
Definition: Expr.cs:427
bool IsFPisNegative
Indicates whether the term is a floating-point isNegative predicate term
Definition: Expr.cs:1749
bool IsFPRem
Indicates whether the term is a floating-point remainder term
Definition: Expr.cs:1664
bool IsAtMost
Indicates whether the term is at-most
Definition: Expr.cs:333
bool IsFPToIEEEBV
Indicates whether the term is a floating-point conversion to IEEE-754 bit-vector term
Definition: Expr.cs:1790
bool IsProofPullQuant
Indicates whether the term is a proof for pulling quantifiers out.
Definition: Expr.cs:1091
bool IsFPGt
Indicates whether the term is a floating-point greater-than term
Definition: Expr.cs:1709
bool IsDistinct
Indicates whether the term is an n-ary distinct predicate (every argument is mutually distinct).
Definition: Expr.cs:293
bool IsRelation
Indicates whether the term is of relation sort.
Definition: Expr.cs:1383
bool IsFPisInf
Indicates whether the term is a floating-point isInf predicate term
Definition: Expr.cs:1729
bool IsProofNNFNeg
Indicates whether the term is a proof for a negative NNF step
Definition: Expr.cs:1332
bool IsDiv
Indicates whether the term is division (binary)
Definition: Expr.cs:432
bool IsBVRotateRightExtended
Indicates whether the term is a bit-vector rotate right (extended)
Definition: Expr.cs:788
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:407
bool IsBVSDiv
Indicates whether the term is a bit-vector signed division (binary)
Definition: Expr.cs:591
bool IsReal
Indicates whether the term is of sort real.
Definition: Expr.cs:380
override string ToString()
Returns a string representation of the expression.
Definition: Expr.cs:185
bool IsLabel
Indicates whether the term is a label (used by the Boogie Verification condition generator).
Definition: Expr.cs:824
bool IsRemainder
Indicates whether the term is remainder (binary)
Definition: Expr.cs:442
bool IsProofTransitivity
Indicates whether the term is a proof by transitivity of a relation
Definition: Expr.cs:968
bool IsRelationalJoin
Indicates whether the term is a relational join
Definition: Expr.cs:1415
bool IsOEQ
Indicates whether the term is a binary equivalence modulo namings.
Definition: Expr.cs:910
bool IsDefaultArray
Indicates whether the term is a default array.
Definition: Expr.cs:501
bool IsConstantArray
Indicates whether the term is a constant array.
Definition: Expr.cs:495
bool IsGE
Indicates whether the term is a greater-than-or-equal
Definition: Expr.cs:397
bool IsRelationRename
Indicates whether the term is the renaming of a column in a relation
Definition: Expr.cs:1470
bool IsIsEmptyRelation
Indicates whether the term is a test for the emptiness of a relation
Definition: Expr.cs:1410
bool IsProofAsserted
Indicates whether the term is a proof for a fact asserted by the user.
Definition: Expr.cs:920
bool IsFPRM
Indicates whether the terms is of floating-point rounding mode sort.
Definition: Expr.cs:1532
bool IsProofOrElimination
Indicates whether the term is a proof by elimination of not-or
Definition: Expr.cs:1051
bool IsRealToInt
Indicates whether the term is a coercion of real to integer (unary)
Definition: Expr.cs:457
bool IsAnd
Indicates whether the term is an n-ary conjunction
Definition: Expr.cs:303
bool IsFPPlusInfinity
Indicates whether the term is a floating-point +oo
Definition: Expr.cs:1613
bool IsBV
Indicates whether the terms is of bit-vector sort.
Definition: Expr.cs:549
bool IsProofMonotonicity
Indicates whether the term is a monotonicity proof object.
Definition: Expr.cs:1003
bool IsFPisNaN
Indicates whether the term is a floating-point isNaN predicate term
Definition: Expr.cs:1724
bool IsBool
Indicates whether the term has Boolean sort.
Definition: Expr.cs:265
bool IsFPRMRoundTowardNegative
Indicates whether the term is the floating-point rounding numeral roundTowardNegative
Definition: Expr.cs:1559
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:1237
bool IsWellSorted
Indicates whether the term is well-sorted.
Definition: Expr.cs:203
bool IsImplies
Indicates whether the term is an implication
Definition: Expr.cs:328
bool IsSuffix
Check whether expression is a suffix.
Definition: Expr.cs:863
bool IsBVSRem
Indicates whether the term is a bit-vector signed remainder (binary)
Definition: Expr.cs:601
bool IsFPToFp
Indicates whether the term is a floating-point conversion term
Definition: Expr.cs:1764
bool IsLabelLit
Indicates whether the term is a label literal (used by the Boogie Verification condition generator).
Definition: Expr.cs:830
uint AtLeastBound
Retrieve bound of at-least
Definition: Expr.cs:348
bool IsProofUnitResolution
Indicates whether the term is a proof by unit resolution
Definition: Expr.cs:1170
bool IsProofGoal
Indicates whether the term is a proof for a fact (tagged as goal) asserted by the user.
Definition: Expr.cs:925
bool IsFPSqrt
Indicates whether the term is a floating-point square root term
Definition: Expr.cs:1689
bool IsSelect
Indicates whether the term is an array select.
Definition: Expr.cs:489
bool IsNot
Indicates whether the term is a negation
Definition: Expr.cs:323
bool IsFPFP
Indicates whether the term is a floating-point constructor term
Definition: Expr.cs:1759
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:1633
bool IsRelationProject
Indicates whether the term is a projection of columns (provided as numbers in the parameters).
Definition: Expr.cs:1433
bool IsUMinus
Indicates whether the term is a unary minus
Definition: Expr.cs:422
bool IsRelationWiden
Indicates whether the term is the widening of two relations
Definition: Expr.cs:1427
bool IsBVRepeat
Indicates whether the term is a bit-vector repetition
Definition: Expr.cs:736
bool IsSub
Indicates whether the term is subtraction (binary)
Definition: Expr.cs:417
bool IsRelationComplement
Indicates whether the term is the complement of a relation
Definition: Expr.cs:1475
bool IsFPPlusZero
Definition: Expr.cs:1628
bool IsBVOR
Indicates whether the term is a bit-wise OR
Definition: Expr.cs:686
bool IsBVSub
Indicates whether the term is a bit-vector subtraction (binary)
Definition: Expr.cs:581
bool IsBVRotateLeftExtended
Indicates whether the term is a bit-vector rotate left (extended)
Definition: Expr.cs:782
bool IsProofSymmetry
Indicates whether the term is proof by symmetricity of a relation
Definition: Expr.cs:956
bool IsProofSkolemize
Indicates whether the term is a proof for a Skolemization step
Definition: Expr.cs:1345
bool IsBVMul
Indicates whether the term is a bit-vector multiplication (binary)
Definition: Expr.cs:586
bool IsLength
Check whether expression is a sequence length.
Definition: Expr.cs:893
bool IsFPSub
Indicates whether the term is a floating-point subtraction term
Definition: Expr.cs:1644
bool IsBVUDiv
Indicates whether the term is a bit-vector unsigned division (binary)
Definition: Expr.cs:596
bool IsProofCommutativity
Indicates whether the term is a proof by commutativity
Definition: Expr.cs:1201
bool IsAlgebraicNumber
Indicates whether the term is an algebraic number
Definition: Expr.cs:253
bool IsProofRewrite
Indicates whether the term is a proof by rewriting
Definition: Expr.cs:1070
bool IsFPRMExprRNE
Indicates whether the term is the floating-point rounding numeral roundNearestTiesToEven
Definition: Expr.cs:1574
bool IsArithmeticNumeral
Indicates whether the term is an arithmetic numeral.
Definition: Expr.cs:387
bool IsProofAndElimination
Indicates whether the term is a proof by elimination of AND
Definition: Expr.cs:1041
bool IsEmptyRelation
Indicates whether the term is an empty relation
Definition: Expr.cs:1405
bool IsProofPushQuant
Indicates whether the term is a proof for pushing quantifiers in.
Definition: Expr.cs:1105
bool IsProofDistributivity
Indicates whether the term is a distributivity proof object.
Definition: Expr.cs:1031
bool IsBVURem
Indicates whether the term is a bit-vector unsigned remainder (binary)
Definition: Expr.cs:606
bool IsBVULE
Indicates whether the term is an unsigned bit-vector less-than-or-equal
Definition: Expr.cs:641
bool IsBVSLT
Indicates whether the term is a signed bit-vector less-than
Definition: Expr.cs:666
bool IsBVExtract
Indicates whether the term is a bit-vector extraction
Definition: Expr.cs:731
bool IsBVSignExtension
Indicates whether the term is a bit-vector sign extension
Definition: Expr.cs:721
bool IsRealIsInt
Indicates whether the term is a check that tests whether a real is integral (unary)
Definition: Expr.cs:462
bool IsSetDifference
Indicates whether the term is set difference
Definition: Expr.cs:531
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:671
bool IsPrefix
Check whether expression is a prefix.
Definition: Expr.cs:857
bool IsFPRMExprRTP
Indicates whether the term is the floating-point rounding numeral roundTowardPositive
Definition: Expr.cs:1589
bool IsFPAdd
Indicates whether the term is a floating-point addition term
Definition: Expr.cs:1638
bool IsFPRMExpr
Indicates whether the term is a floating-point rounding mode numeral
Definition: Expr.cs:1599
bool IsBVSMod
Indicates whether the term is a bit-vector signed modulus
Definition: Expr.cs:611
bool IsBVBitOne
Indicates whether the term is a one-bit bit-vector with value one
Definition: Expr.cs:561
bool IsFPNeg
Indicates whether the term is a floating-point negation term
Definition: Expr.cs:1649
bool IsArray
Indicates whether the term is of an array sort.
Definition: Expr.cs:470
bool IsBVNOT
Indicates whether the term is a bit-wise NOT
Definition: Expr.cs:691
bool IsBVSGT
Indicates whether the term is a signed bit-vector greater-than
Definition: Expr.cs:676
bool IsSetSubset
Indicates whether the term is set subset
Definition: Expr.cs:541
bool IsSetComplement
Indicates whether the term is set complement
Definition: Expr.cs:536
bool IsProofIFFOEQ
Indicates whether the term is a proof iff-oeq
Definition: Expr.cs:1279
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
uint DomainSize
The size of the domain of the function declaration Arity
Definition: FuncDecl.cs:101
Z3_decl_kind DeclKind
The kind of the function declaration.
Definition: FuncDecl.cs:137
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
Definition: Z3Exception.cs:32
Context Context
Access Context object
Definition: Z3Object.cs:120
Z3_ast_kind
The different kinds of Z3 AST (abstract syntax trees). That is, terms, formulas and types.
Definition: z3_api.h:139
Z3_decl_kind
The different kinds of interpreted function kinds.
Definition: z3_api.h:961
Z3_sort_kind
The different kinds of Z3 types (See Z3_get_sort_kind).
Definition: z3_api.h:108
Z3_lbool
Lifted Boolean type: false, undefined, true.
Definition: z3_api.h:60