-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContext.java
More file actions
3094 lines (2656 loc) · 95.2 KB
/
Context.java
File metadata and controls
3094 lines (2656 loc) · 95.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* This file was automatically generated from Context.cs
* w/ further modifications by:
* @author Christoph M. Wintersteiger (cwinter)
**/
package com.microsoft.z3;
import com.microsoft.z3.enumerations.Z3_ast_print_mode;
import java.util.Map;
/**
* The main interaction with Z3 happens via the Context.
**/
public class Context extends IDisposable
{
/**
* Constructor.
**/
public Context() throws Z3Exception
{
super();
m_ctx = Native.mkContextRc(0);
initContext();
}
/**
* Constructor.
* <remarks>
* The following parameters can be set:
* - proof (Boolean) Enable proof generation
* - debug_ref_count (Boolean) Enable debug support for Z3_ast reference counting
* - trace (Boolean) Tracing support for VCC
* - trace_file_name (String) Trace out file for VCC traces
* - timeout (unsigned) default timeout (in milliseconds) used for solvers
* - well_sorted_check type checker
* - auto_config use heuristics to automatically select solver and configure it
* - model model generation for solvers, this parameter can be overwritten when creating a solver
* - model_validate validate models produced by solvers
* - unsat_core unsat-core generation for solvers, this parameter can be overwritten when creating a solver
* Note that in previous versions of Z3, this constructor was also used to set global and
* module parameters. For this purpose we should now use <see cref="Global.setParameter"/>
* </remarks>
**/
public Context(Map<String, String> settings) throws Z3Exception
{
super();
long cfg = Native.mkConfig();
for (Map.Entry<String, String> kv : settings.entrySet())
Native.setParamValue(cfg, kv.getKey(), kv.getValue());
m_ctx = Native.mkContextRc(cfg);
Native.delConfig(cfg);
initContext();
}
/**
* Creates a new symbol using an integer. <remarks> Not all integers can be
* passed to this function. The legal range of unsigned integers is 0 to
* 2^30-1. </remarks>
**/
public IntSymbol mkSymbol(int i) throws Z3Exception
{
return new IntSymbol(this, i);
}
/**
* Create a symbol using a string.
**/
public StringSymbol mkSymbol(String name) throws Z3Exception
{
return new StringSymbol(this, name);
}
/**
* Create an array of symbols.
**/
Symbol[] MkSymbols(String[] names) throws Z3Exception
{
if (names == null)
return null;
Symbol[] result = new Symbol[names.length];
for (int i = 0; i < names.length; ++i)
result[i] = mkSymbol(names[i]);
return result;
}
private BoolSort m_boolSort = null;
private IntSort m_intSort = null;
private RealSort m_realSort = null;
/**
* Retrieves the Boolean sort of the context.
**/
public BoolSort getBoolSort() throws Z3Exception
{
if (m_boolSort == null)
m_boolSort = new BoolSort(this);
return m_boolSort;
}
/**
* Retrieves the Integer sort of the context.
**/
public IntSort getIntSort() throws Z3Exception
{
if (m_intSort == null)
m_intSort = new IntSort(this);
return m_intSort;
}
/**
* Retrieves the Real sort of the context.
**/
public RealSort getRealSort() throws Z3Exception
{
if (m_realSort == null)
m_realSort = new RealSort(this);
return m_realSort;
}
/**
* Create a new Boolean sort.
**/
public BoolSort mkBoolSort() throws Z3Exception
{
return new BoolSort(this);
}
/**
* Create a new uninterpreted sort.
**/
public UninterpretedSort mkUninterpretedSort(Symbol s) throws Z3Exception
{
checkContextMatch(s);
return new UninterpretedSort(this, s);
}
/**
* Create a new uninterpreted sort.
**/
public UninterpretedSort mkUninterpretedSort(String str) throws Z3Exception
{
return mkUninterpretedSort(mkSymbol(str));
}
/**
* Create a new integer sort.
**/
public IntSort mkIntSort() throws Z3Exception
{
return new IntSort(this);
}
/**
* Create a real sort.
**/
public RealSort mkRealSort() throws Z3Exception
{
return new RealSort(this);
}
/**
* Create a new bit-vector sort.
**/
public BitVecSort mkBitVecSort(int size) throws Z3Exception
{
return new BitVecSort(this, Native.mkBvSort(nCtx(), size));
}
/**
* Create a new array sort.
**/
public ArraySort mkArraySort(Sort domain, Sort range) throws Z3Exception
{
checkContextMatch(domain);
checkContextMatch(range);
return new ArraySort(this, domain, range);
}
/**
* Create a new tuple sort.
**/
public TupleSort mkTupleSort(Symbol name, Symbol[] fieldNames,
Sort[] fieldSorts) throws Z3Exception
{
checkContextMatch(name);
checkContextMatch(fieldNames);
checkContextMatch(fieldSorts);
return new TupleSort(this, name, (int) fieldNames.length, fieldNames,
fieldSorts);
}
/**
* Create a new enumeration sort.
**/
public EnumSort mkEnumSort(Symbol name, Symbol... enumNames)
throws Z3Exception
{
checkContextMatch(name);
checkContextMatch(enumNames);
return new EnumSort(this, name, enumNames);
}
/**
* Create a new enumeration sort.
**/
public EnumSort mkEnumSort(String name, String... enumNames)
throws Z3Exception
{
return new EnumSort(this, mkSymbol(name), MkSymbols(enumNames));
}
/**
* Create a new list sort.
**/
public ListSort mkListSort(Symbol name, Sort elemSort) throws Z3Exception
{
checkContextMatch(name);
checkContextMatch(elemSort);
return new ListSort(this, name, elemSort);
}
/**
* Create a new list sort.
**/
public ListSort mkListSort(String name, Sort elemSort) throws Z3Exception
{
checkContextMatch(elemSort);
return new ListSort(this, mkSymbol(name), elemSort);
}
/**
* Create a new finite domain sort.
**/
public FiniteDomainSort mkFiniteDomainSort(Symbol name, long size)
throws Z3Exception
{
checkContextMatch(name);
return new FiniteDomainSort(this, name, size);
}
/**
* Create a new finite domain sort.
**/
public FiniteDomainSort mkFiniteDomainSort(String name, long size)
throws Z3Exception
{
return new FiniteDomainSort(this, mkSymbol(name), size);
}
/**
* Create a datatype constructor. <param name="name">constructor
* name</param> <param name="recognizer">name of recognizer
* function.</param> <param name="fieldNames">names of the constructor
* fields.</param> <param name="sorts">field sorts, 0 if the field sort
* refers to a recursive sort.</param> <param name="sortRefs">reference to
* datatype sort that is an argument to the constructor; if the
* corresponding sort reference is 0, then the value in sort_refs should be
* an index referring to one of the recursive datatypes that is
* declared.</param>
**/
public Constructor mkConstructor(Symbol name, Symbol recognizer,
Symbol[] fieldNames, Sort[] sorts, int[] sortRefs)
throws Z3Exception
{
return new Constructor(this, name, recognizer, fieldNames, sorts,
sortRefs);
}
/**
* Create a datatype constructor. <param name="name"></param> <param
* name="recognizer"></param> <param name="fieldNames"></param> <param
* name="sorts"></param> <param name="sortRefs"></param>
*
* @return
**/
public Constructor mkConstructor(String name, String recognizer,
String[] fieldNames, Sort[] sorts, int[] sortRefs)
throws Z3Exception
{
return new Constructor(this, mkSymbol(name), mkSymbol(recognizer),
MkSymbols(fieldNames), sorts, sortRefs);
}
/**
* Create a new datatype sort.
**/
public DatatypeSort mkDatatypeSort(Symbol name, Constructor[] constructors)
throws Z3Exception
{
checkContextMatch(name);
checkContextMatch(constructors);
return new DatatypeSort(this, name, constructors);
}
/**
* Create a new datatype sort.
**/
public DatatypeSort mkDatatypeSort(String name, Constructor[] constructors)
throws Z3Exception
{
checkContextMatch(constructors);
return new DatatypeSort(this, mkSymbol(name), constructors);
}
/**
* Create mutually recursive datatypes. <param name="names">names of
* datatype sorts</param> <param name="c">list of constructors, one list per
* sort.</param>
**/
public DatatypeSort[] mkDatatypeSorts(Symbol[] names, Constructor[][] c)
throws Z3Exception
{
checkContextMatch(names);
int n = (int) names.length;
ConstructorList[] cla = new ConstructorList[n];
long[] n_constr = new long[n];
for (int i = 0; i < n; i++)
{
Constructor[] constructor = c[i];
checkContextMatch(constructor);
cla[i] = new ConstructorList(this, constructor);
n_constr[i] = cla[i].getNativeObject();
}
long[] n_res = new long[n];
Native.mkDatatypes(nCtx(), n, Symbol.arrayToNative(names), n_res,
n_constr);
DatatypeSort[] res = new DatatypeSort[n];
for (int i = 0; i < n; i++)
res[i] = new DatatypeSort(this, n_res[i]);
return res;
}
/**
* Create mutually recursive data-types. <param name="names"></param> <param
* name="c"></param>
*
* @return
**/
public DatatypeSort[] mkDatatypeSorts(String[] names, Constructor[][] c)
throws Z3Exception
{
return mkDatatypeSorts(MkSymbols(names), c);
}
/**
* Creates a new function declaration.
**/
public FuncDecl mkFuncDecl(Symbol name, Sort[] domain, Sort range)
throws Z3Exception
{
checkContextMatch(name);
checkContextMatch(domain);
checkContextMatch(range);
return new FuncDecl(this, name, domain, range);
}
/**
* Creates a new function declaration.
**/
public FuncDecl mkFuncDecl(Symbol name, Sort domain, Sort range)
throws Z3Exception
{
checkContextMatch(name);
checkContextMatch(domain);
checkContextMatch(range);
Sort[] q = new Sort[] { domain };
return new FuncDecl(this, name, q, range);
}
/**
* Creates a new function declaration.
**/
public FuncDecl mkFuncDecl(String name, Sort[] domain, Sort range)
throws Z3Exception
{
checkContextMatch(domain);
checkContextMatch(range);
return new FuncDecl(this, mkSymbol(name), domain, range);
}
/**
* Creates a new function declaration.
**/
public FuncDecl mkFuncDecl(String name, Sort domain, Sort range)
throws Z3Exception
{
checkContextMatch(domain);
checkContextMatch(range);
Sort[] q = new Sort[] { domain };
return new FuncDecl(this, mkSymbol(name), q, range);
}
/**
* Creates a fresh function declaration with a name prefixed with <paramref
* name="prefix"/>. <seealso cref="MkFuncDecl(string,Sort,Sort)"/> <seealso
* cref="MkFuncDecl(string,Sort[],Sort)"/>
**/
public FuncDecl mkFreshFuncDecl(String prefix, Sort[] domain, Sort range)
throws Z3Exception
{
checkContextMatch(domain);
checkContextMatch(range);
return new FuncDecl(this, prefix, domain, range);
}
/**
* Creates a new constant function declaration.
**/
public FuncDecl mkConstDecl(Symbol name, Sort range) throws Z3Exception
{
checkContextMatch(name);
checkContextMatch(range);
return new FuncDecl(this, name, null, range);
}
/**
* Creates a new constant function declaration.
**/
public FuncDecl mkConstDecl(String name, Sort range) throws Z3Exception
{
checkContextMatch(range);
return new FuncDecl(this, mkSymbol(name), null, range);
}
/**
* Creates a fresh constant function declaration with a name prefixed with
* <paramref name="prefix"/>. <seealso cref="MkFuncDecl(string,Sort,Sort)"/>
* <seealso cref="MkFuncDecl(string,Sort[],Sort)"/>
**/
public FuncDecl mkFreshConstDecl(String prefix, Sort range)
throws Z3Exception
{
checkContextMatch(range);
return new FuncDecl(this, prefix, null, range);
}
/**
* Creates a new bound variable. <param name="index">The de-Bruijn index of
* the variable</param> <param name="ty">The sort of the variable</param>
**/
public Expr mkBound(int index, Sort ty) throws Z3Exception
{
return Expr.create(this,
Native.mkBound(nCtx(), index, ty.getNativeObject()));
}
/**
* Create a quantifier pattern.
**/
public Pattern mkPattern(Expr... terms) throws Z3Exception
{
if (terms.length == 0)
throw new Z3Exception("Cannot create a pattern from zero terms");
long[] termsNative = AST.arrayToNative(terms);
return new Pattern(this, Native.mkPattern(nCtx(), (int) terms.length,
termsNative));
}
/**
* Creates a new Constant of sort <paramref name="range"/> and named
* <paramref name="name"/>.
**/
public Expr mkConst(Symbol name, Sort range) throws Z3Exception
{
checkContextMatch(name);
checkContextMatch(range);
return Expr.create(
this,
Native.mkConst(nCtx(), name.getNativeObject(),
range.getNativeObject()));
}
/**
* Creates a new Constant of sort <paramref name="range"/> and named
* <paramref name="name"/>.
**/
public Expr mkConst(String name, Sort range) throws Z3Exception
{
return mkConst(mkSymbol(name), range);
}
/**
* Creates a fresh Constant of sort <paramref name="range"/> and a name
* prefixed with <paramref name="prefix"/>.
**/
public Expr mkFreshConst(String prefix, Sort range) throws Z3Exception
{
checkContextMatch(range);
return Expr.create(this,
Native.mkFreshConst(nCtx(), prefix, range.getNativeObject()));
}
/**
* Creates a fresh constant from the FuncDecl <paramref name="f"/>. <param
* name="f">A decl of a 0-arity function</param>
**/
public Expr mkConst(FuncDecl f) throws Z3Exception
{
return mkApp(f, (Expr[]) null);
}
/**
* Create a Boolean constant.
**/
public BoolExpr mkBoolConst(Symbol name) throws Z3Exception
{
return (BoolExpr) mkConst(name, getBoolSort());
}
/**
* Create a Boolean constant.
**/
public BoolExpr mkBoolConst(String name) throws Z3Exception
{
return (BoolExpr) mkConst(mkSymbol(name), getBoolSort());
}
/**
* Creates an integer constant.
**/
public IntExpr mkIntConst(Symbol name) throws Z3Exception
{
return (IntExpr) mkConst(name, getIntSort());
}
/**
* Creates an integer constant.
**/
public IntExpr mkIntConst(String name) throws Z3Exception
{
return (IntExpr) mkConst(name, getIntSort());
}
/**
* Creates a real constant.
**/
public RealExpr mkRealConst(Symbol name) throws Z3Exception
{
return (RealExpr) mkConst(name, getRealSort());
}
/**
* Creates a real constant.
**/
public RealExpr mkRealConst(String name) throws Z3Exception
{
return (RealExpr) mkConst(name, getRealSort());
}
/**
* Creates a bit-vector constant.
**/
public BitVecExpr mkBVConst(Symbol name, int size) throws Z3Exception
{
return (BitVecExpr) mkConst(name, mkBitVecSort(size));
}
/**
* Creates a bit-vector constant.
**/
public BitVecExpr mkBVConst(String name, int size) throws Z3Exception
{
return (BitVecExpr) mkConst(name, mkBitVecSort(size));
}
/**
* Create a new function application.
**/
public Expr mkApp(FuncDecl f, Expr... args) throws Z3Exception
{
checkContextMatch(f);
checkContextMatch(args);
return Expr.create(this, f, args);
}
/**
* The true Term.
**/
public BoolExpr mkTrue() throws Z3Exception
{
return new BoolExpr(this, Native.mkTrue(nCtx()));
}
/**
* The false Term.
**/
public BoolExpr mkFalse() throws Z3Exception
{
return new BoolExpr(this, Native.mkFalse(nCtx()));
}
/**
* Creates a Boolean value.
**/
public BoolExpr mkBool(boolean value) throws Z3Exception
{
return value ? mkTrue() : mkFalse();
}
/**
* Creates the equality <paramref name="x"/> = <paramref name="y"/>.
**/
public BoolExpr mkEq(Expr x, Expr y) throws Z3Exception
{
checkContextMatch(x);
checkContextMatch(y);
return new BoolExpr(this, Native.mkEq(nCtx(), x.getNativeObject(),
y.getNativeObject()));
}
/**
* Creates a <code>distinct</code> term.
**/
public BoolExpr mkDistinct(Expr... args) throws Z3Exception
{
checkContextMatch(args);
return new BoolExpr(this, Native.mkDistinct(nCtx(), (int) args.length,
AST.arrayToNative(args)));
}
/**
* Mk an expression representing <code>not(a)</code>.
**/
public BoolExpr mkNot(BoolExpr a) throws Z3Exception
{
checkContextMatch(a);
return new BoolExpr(this, Native.mkNot(nCtx(), a.getNativeObject()));
}
/**
* Create an expression representing an if-then-else:
* <code>ite(t1, t2, t3)</code>. <param name="t1">An expression with Boolean
* sort</param> <param name="t2">An expression </param> <param name="t3">An
* expression with the same sort as <paramref name="t2"/></param>
**/
public Expr mkITE(BoolExpr t1, Expr t2, Expr t3) throws Z3Exception
{
checkContextMatch(t1);
checkContextMatch(t2);
checkContextMatch(t3);
return Expr.create(this, Native.mkIte(nCtx(), t1.getNativeObject(),
t2.getNativeObject(), t3.getNativeObject()));
}
/**
* Create an expression representing <code>t1 iff t2</code>.
**/
public BoolExpr mkIff(BoolExpr t1, BoolExpr t2) throws Z3Exception
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BoolExpr(this, Native.mkIff(nCtx(), t1.getNativeObject(),
t2.getNativeObject()));
}
/**
* Create an expression representing <code>t1 -> t2</code>.
**/
public BoolExpr mkImplies(BoolExpr t1, BoolExpr t2) throws Z3Exception
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BoolExpr(this, Native.mkImplies(nCtx(),
t1.getNativeObject(), t2.getNativeObject()));
}
/**
* Create an expression representing <code>t1 xor t2</code>.
**/
public BoolExpr mkXor(BoolExpr t1, BoolExpr t2) throws Z3Exception
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BoolExpr(this, Native.mkXor(nCtx(), t1.getNativeObject(),
t2.getNativeObject()));
}
/**
* Create an expression representing <code>t[0] and t[1] and ...</code>.
**/
public BoolExpr mkAnd(BoolExpr... t) throws Z3Exception
{
checkContextMatch(t);
return new BoolExpr(this, Native.mkAnd(nCtx(), (int) t.length,
AST.arrayToNative(t)));
}
/**
* Create an expression representing <code>t[0] or t[1] or ...</code>.
**/
public BoolExpr mkOr(BoolExpr... t) throws Z3Exception
{
checkContextMatch(t);
return new BoolExpr(this, Native.mkOr(nCtx(), (int) t.length,
AST.arrayToNative(t)));
}
/**
* Create an expression representing <code>t[0] + t[1] + ...</code>.
**/
public ArithExpr mkAdd(ArithExpr... t) throws Z3Exception
{
checkContextMatch(t);
return (ArithExpr) Expr.create(this,
Native.mkAdd(nCtx(), (int) t.length, AST.arrayToNative(t)));
}
/**
* Create an expression representing <code>t[0] * t[1] * ...</code>.
**/
public ArithExpr mkMul(ArithExpr... t) throws Z3Exception
{
checkContextMatch(t);
return (ArithExpr) Expr.create(this,
Native.mkMul(nCtx(), (int) t.length, AST.arrayToNative(t)));
}
/**
* Create an expression representing <code>t[0] - t[1] - ...</code>.
**/
public ArithExpr mkSub(ArithExpr... t) throws Z3Exception
{
checkContextMatch(t);
return (ArithExpr) Expr.create(this,
Native.mkSub(nCtx(), (int) t.length, AST.arrayToNative(t)));
}
/**
* Create an expression representing <code>-t</code>.
**/
public ArithExpr mkUnaryMinus(ArithExpr t) throws Z3Exception
{
checkContextMatch(t);
return (ArithExpr) Expr.create(this,
Native.mkUnaryMinus(nCtx(), t.getNativeObject()));
}
/**
* Create an expression representing <code>t1 / t2</code>.
**/
public ArithExpr mkDiv(ArithExpr t1, ArithExpr t2) throws Z3Exception
{
checkContextMatch(t1);
checkContextMatch(t2);
return (ArithExpr) Expr.create(this, Native.mkDiv(nCtx(),
t1.getNativeObject(), t2.getNativeObject()));
}
/**
* Create an expression representing <code>t1 mod t2</code>. <remarks>The
* arguments must have int type.</remarks>
**/
public IntExpr mkMod(IntExpr t1, IntExpr t2) throws Z3Exception
{
checkContextMatch(t1);
checkContextMatch(t2);
return new IntExpr(this, Native.mkMod(nCtx(), t1.getNativeObject(),
t2.getNativeObject()));
}
/**
* Create an expression representing <code>t1 rem t2</code>. <remarks>The
* arguments must have int type.</remarks>
**/
public IntExpr mkRem(IntExpr t1, IntExpr t2) throws Z3Exception
{
checkContextMatch(t1);
checkContextMatch(t2);
return new IntExpr(this, Native.mkRem(nCtx(), t1.getNativeObject(),
t2.getNativeObject()));
}
/**
* Create an expression representing <code>t1 ^ t2</code>.
**/
public ArithExpr mkPower(ArithExpr t1, ArithExpr t2) throws Z3Exception
{
checkContextMatch(t1);
checkContextMatch(t2);
return (ArithExpr) Expr.create(
this,
Native.mkPower(nCtx(), t1.getNativeObject(),
t2.getNativeObject()));
}
/**
* Create an expression representing <code>t1 < t2</code>
**/
public BoolExpr mkLt(ArithExpr t1, ArithExpr t2) throws Z3Exception
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BoolExpr(this, Native.mkLt(nCtx(), t1.getNativeObject(),
t2.getNativeObject()));
}
/**
* Create an expression representing <code>t1 <= t2</code>
**/
public BoolExpr mkLe(ArithExpr t1, ArithExpr t2) throws Z3Exception
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BoolExpr(this, Native.mkLe(nCtx(), t1.getNativeObject(),
t2.getNativeObject()));
}
/**
* Create an expression representing <code>t1 > t2</code>
**/
public BoolExpr mkGt(ArithExpr t1, ArithExpr t2) throws Z3Exception
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BoolExpr(this, Native.mkGt(nCtx(), t1.getNativeObject(),
t2.getNativeObject()));
}
/**
* Create an expression representing <code>t1 >= t2</code>
**/
public BoolExpr mkGe(ArithExpr t1, ArithExpr t2) throws Z3Exception
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BoolExpr(this, Native.mkGe(nCtx(), t1.getNativeObject(),
t2.getNativeObject()));
}
/**
* Coerce an integer to a real. <remarks> There is also a converse operation
* exposed. It follows the semantics prescribed by the SMT-LIB standard.
*
* You can take the floor of a real by creating an auxiliary integer Term
* <code>k</code> and and asserting
* <code>MakeInt2Real(k) <= t1 < MkInt2Real(k)+1</code>. The argument
* must be of integer sort. </remarks>
**/
public RealExpr mkInt2Real(IntExpr t) throws Z3Exception
{
checkContextMatch(t);
return new RealExpr(this,
Native.mkInt2real(nCtx(), t.getNativeObject()));
}
/**
* Coerce a real to an integer. <remarks> The semantics of this function
* follows the SMT-LIB standard for the function to_int. The argument must
* be of real sort. </remarks>
**/
public IntExpr mkReal2Int(RealExpr t) throws Z3Exception
{
checkContextMatch(t);
return new IntExpr(this, Native.mkReal2int(nCtx(), t.getNativeObject()));
}
/**
* Creates an expression that checks whether a real number is an integer.
**/
public BoolExpr mkIsInteger(RealExpr t) throws Z3Exception
{
checkContextMatch(t);
return new BoolExpr(this, Native.mkIsInt(nCtx(), t.getNativeObject()));
}
/**
* Bitwise negation. <remarks>The argument must have a bit-vector
* sort.</remarks>
**/
public BitVecExpr mkBVNot(BitVecExpr t) throws Z3Exception
{
checkContextMatch(t);
return new BitVecExpr(this, Native.mkBvnot(nCtx(), t.getNativeObject()));
}
/**
* Take conjunction of bits in a vector, return vector of length 1.
* <remarks>The argument must have a bit-vector sort.</remarks>
**/
public BitVecExpr mkBVRedAND(BitVecExpr t) throws Z3Exception
{
checkContextMatch(t);
return new BitVecExpr(this, Native.mkBvredand(nCtx(),
t.getNativeObject()));
}
/**
* Take disjunction of bits in a vector, return vector of length 1.
* <remarks>The argument must have a bit-vector sort.</remarks>
**/
public BitVecExpr mkBVRedOR(BitVecExpr t) throws Z3Exception
{
checkContextMatch(t);
return new BitVecExpr(this, Native.mkBvredor(nCtx(),
t.getNativeObject()));
}
/**
* Bitwise conjunction. <remarks>The arguments must have a bit-vector
* sort.</remarks>
**/
public BitVecExpr mkBVAND(BitVecExpr t1, BitVecExpr t2) throws Z3Exception
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BitVecExpr(this, Native.mkBvand(nCtx(),
t1.getNativeObject(), t2.getNativeObject()));
}
/**
* Bitwise disjunction. <remarks>The arguments must have a bit-vector
* sort.</remarks>
**/
public BitVecExpr mkBVOR(BitVecExpr t1, BitVecExpr t2) throws Z3Exception
{
checkContextMatch(t1);
checkContextMatch(t2);
return new BitVecExpr(this, Native.mkBvor(nCtx(), t1.getNativeObject(),
t2.getNativeObject()));
}
/**
* Bitwise XOR. <remarks>The arguments must have a bit-vector
* sort.</remarks>
**/
public BitVecExpr mkBVXOR(BitVecExpr t1, BitVecExpr t2) throws Z3Exception
{
checkContextMatch(t1);