This repository has been archived by the owner on May 7, 2021. It is now read-only.
/
cvc4cpp.h
3288 lines (2828 loc) · 94.9 KB
/
cvc4cpp.h
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
/********************* */
/*! \file cvc4cpp.h
** \verbatim
** Top contributors (to current version):
** Aina Niemetz, Andrew Reynolds, Abdalrhman Mohamed
** This file is part of the CVC4 project.
** Copyright (c) 2009-2020 by the authors listed in the file AUTHORS
** in the top-level source directory) and their institutional affiliations.
** All rights reserved. See the file COPYING in the top-level source
** directory for licensing information.\endverbatim
**
** \brief The CVC4 C++ API.
**
** The CVC4 C++ API.
**/
#include "cvc4_public.h"
#ifndef CVC4__API__CVC4CPP_H
#define CVC4__API__CVC4CPP_H
#include "api/cvc4cppkind.h"
// !!! Only temporarily public until the parser is fully migrated to the new
// API. !!!
#include "expr/kind.h"
// !!!
#include <map>
#include <memory>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
namespace CVC4 {
class Expr;
class Datatype;
class DatatypeConstructor;
class DatatypeConstructorArg;
class ExprManager;
class SmtEngine;
class Type;
class Options;
class Random;
class Result;
namespace api {
class Solver;
/* -------------------------------------------------------------------------- */
/* Exception */
/* -------------------------------------------------------------------------- */
class CVC4_PUBLIC CVC4ApiException : public std::exception
{
public:
CVC4ApiException(const std::string& str) : d_msg(str) {}
CVC4ApiException(const std::stringstream& stream) : d_msg(stream.str()) {}
std::string getMessage() const { return d_msg; }
const char* what() const noexcept override { return d_msg.c_str(); }
private:
std::string d_msg;
};
/* -------------------------------------------------------------------------- */
/* Result */
/* -------------------------------------------------------------------------- */
/**
* Encapsulation of a three-valued solver result, with explanations.
*/
class CVC4_PUBLIC Result
{
friend class Solver;
public:
// !!! This constructor is only temporarily public until the parser is fully
// migrated to the new API. !!!
/**
* Constructor.
* @param r the internal result that is to be wrapped by this result
* @return the Result
*/
Result(const CVC4::Result& r);
/** Constructor. */
Result();
/**
* Return true if Result is empty, i.e., a nullary Result, and not an actual
* result returned from a checkSat() (and friends) query.
*/
bool isNull() const;
/**
* Return true if query was a satisfiable checkSat() or checkSatAssuming()
* query.
*/
bool isSat() const;
/**
* Return true if query was an unsatisfiable checkSat() or
* checkSatAssuming() query.
*/
bool isUnsat() const;
/**
* Return true if query was a checkSat() or checkSatAssuming() query and
* CVC4 was not able to determine (un)satisfiability.
*/
bool isSatUnknown() const;
/**
* Return true if corresponding query was an entailed checkEntailed() query.
*/
bool isEntailed() const;
/**
* Return true if corresponding query was a checkEntailed() query that is
* not entailed.
*/
bool isNotEntailed() const;
/**
* Return true if query was a checkEntailed() () query and CVC4 was not able
* to determine if it is entailed.
*/
bool isEntailmentUnknown() const;
/**
* Operator overloading for equality of two results.
* @param r the result to compare to for equality
* @return true if the results are equal
*/
bool operator==(const Result& r) const;
/**
* Operator overloading for disequality of two results.
* @param r the result to compare to for disequality
* @return true if the results are disequal
*/
bool operator!=(const Result& r) const;
/**
* @return an explanation for an unknown query result.
*/
std::string getUnknownExplanation() const;
/**
* @return a string representation of this result.
*/
std::string toString() const;
// !!! This is only temporarily available until the parser is fully migrated
// to the new API. !!!
CVC4::Result getResult(void) const;
private:
/**
* The interal result wrapped by this result.
* This is a shared_ptr rather than a unique_ptr since CVC4::Result is
* not ref counted.
*/
std::shared_ptr<CVC4::Result> d_result;
};
/**
* Serialize a result to given stream.
* @param out the output stream
* @param r the result to be serialized to the given output stream
* @return the output stream
*/
std::ostream& operator<<(std::ostream& out, const Result& r) CVC4_PUBLIC;
/* -------------------------------------------------------------------------- */
/* Sort */
/* -------------------------------------------------------------------------- */
class Datatype;
/**
* The sort of a CVC4 term.
*/
class CVC4_PUBLIC Sort
{
friend class DatatypeConstructorDecl;
friend class DatatypeDecl;
friend class Op;
friend class Solver;
friend class Grammar;
friend struct SortHashFunction;
friend class Term;
public:
// !!! This constructor is only temporarily public until the parser is fully
// migrated to the new API. !!!
/**
* Constructor.
* @param slv the associated solver object
* @param t the internal type that is to be wrapped by this sort
* @return the Sort
*/
Sort(const Solver* slv, const CVC4::Type& t);
/**
* Constructor.
*/
Sort();
/**
* Destructor.
*/
~Sort();
/**
* Comparison for structural equality.
* @param s the sort to compare to
* @return true if the sorts are equal
*/
bool operator==(const Sort& s) const;
/**
* Comparison for structural disequality.
* @param s the sort to compare to
* @return true if the sorts are not equal
*/
bool operator!=(const Sort& s) const;
/**
* Comparison for ordering on sorts.
* @param s the sort to compare to
* @return true if this sort is less than s
*/
bool operator<(const Sort& s) const;
/**
* Comparison for ordering on sorts.
* @param s the sort to compare to
* @return true if this sort is greater than s
*/
bool operator>(const Sort& s) const;
/**
* Comparison for ordering on sorts.
* @param s the sort to compare to
* @return true if this sort is less than or equal to s
*/
bool operator<=(const Sort& s) const;
/**
* Comparison for ordering on sorts.
* @param s the sort to compare to
* @return true if this sort is greater than or equal to s
*/
bool operator>=(const Sort& s) const;
/**
* @return true if this Sort is a null sort.
*/
bool isNull() const;
/**
* Is this a Boolean sort?
* @return true if the sort is a Boolean sort
*/
bool isBoolean() const;
/**
* Is this a integer sort?
* @return true if the sort is a integer sort
*/
bool isInteger() const;
/**
* Is this a real sort?
* @return true if the sort is a real sort
*/
bool isReal() const;
/**
* Is this a string sort?
* @return true if the sort is the string sort
*/
bool isString() const;
/**
* Is this a regexp sort?
* @return true if the sort is the regexp sort
*/
bool isRegExp() const;
/**
* Is this a rounding mode sort?
* @return true if the sort is the rounding mode sort
*/
bool isRoundingMode() const;
/**
* Is this a bit-vector sort?
* @return true if the sort is a bit-vector sort
*/
bool isBitVector() const;
/**
* Is this a floating-point sort?
* @return true if the sort is a floating-point sort
*/
bool isFloatingPoint() const;
/**
* Is this a datatype sort?
* @return true if the sort is a datatype sort
*/
bool isDatatype() const;
/**
* Is this a parametric datatype sort?
* @return true if the sort is a parametric datatype sort
*/
bool isParametricDatatype() const;
/**
* Is this a constructor sort?
* @return true if the sort is a constructor sort
*/
bool isConstructor() const;
/**
* Is this a selector sort?
* @return true if the sort is a selector sort
*/
bool isSelector() const;
/**
* Is this a tester sort?
* @return true if the sort is a tester sort
*/
bool isTester() const;
/**
* Is this a function sort?
* @return true if the sort is a function sort
*/
bool isFunction() const;
/**
* Is this a predicate sort?
* That is, is this a function sort mapping to Boolean? All predicate
* sorts are also function sorts.
* @return true if the sort is a predicate sort
*/
bool isPredicate() const;
/**
* Is this a tuple sort?
* @return true if the sort is a tuple sort
*/
bool isTuple() const;
/**
* Is this a record sort?
* @return true if the sort is a record sort
*/
bool isRecord() const;
/**
* Is this an array sort?
* @return true if the sort is a array sort
*/
bool isArray() const;
/**
* Is this a Set sort?
* @return true if the sort is a Set sort
*/
bool isSet() const;
/**
* Is this a sort kind?
* @return true if this is a sort kind
*/
bool isUninterpretedSort() const;
/**
* Is this a sort constructor kind?
* @return true if this is a sort constructor kind
*/
bool isSortConstructor() const;
/**
* Is this a first-class sort?
* First-class sorts are sorts for which:
* (1) we handle equalities between terms of that type, and
* (2) they are allowed to be parameters of parametric sorts (e.g. index or
* element sorts of arrays).
*
* Examples of sorts that are not first-class include sort constructor sorts
* and regular expression sorts.
*
* @return true if this is a first-class sort
*/
bool isFirstClass() const;
/**
* Is this a function-LIKE sort?
*
* Anything function-like except arrays (e.g., datatype selectors) is
* considered a function here. Function-like terms can not be the argument
* or return value for any term that is function-like.
* This is mainly to avoid higher order.
*
* Note that arrays are explicitly not considered function-like here.
*
* @return true if this is a function-like sort
*/
bool isFunctionLike() const;
/**
* Is this sort a subsort of the given sort?
* @return true if this sort is a subsort of s
*/
bool isSubsortOf(Sort s) const;
/**
* Is this sort comparable to the given sort (i.e., do they share
* a common ancestor in the subsort tree)?
* @return true if this sort is comparable to s
*/
bool isComparableTo(Sort s) const;
/**
* @return the underlying datatype of a datatype sort
*/
Datatype getDatatype() const;
/**
* Instantiate a parameterized datatype/sort sort.
* Create sorts parameter with Solver::mkParamSort().
* @param params the list of sort parameters to instantiate with
*/
Sort instantiate(const std::vector<Sort>& params) const;
/**
* Output a string representation of this sort to a given stream.
* @param out the output stream
*/
void toStream(std::ostream& out) const;
/**
* @return a string representation of this sort
*/
std::string toString() const;
// !!! This is only temporarily available until the parser is fully migrated
// to the new API. !!!
CVC4::Type getType(void) const;
/* Constructor sort ------------------------------------------------------- */
/**
* @return the arity of a constructor sort
*/
size_t getConstructorArity() const;
/**
* @return the domain sorts of a constructor sort
*/
std::vector<Sort> getConstructorDomainSorts() const;
/**
* @return the codomain sort of a constructor sort
*/
Sort getConstructorCodomainSort() const;
/* Function sort ------------------------------------------------------- */
/**
* @return the arity of a function sort
*/
size_t getFunctionArity() const;
/**
* @return the domain sorts of a function sort
*/
std::vector<Sort> getFunctionDomainSorts() const;
/**
* @return the codomain sort of a function sort
*/
Sort getFunctionCodomainSort() const;
/* Array sort ---------------------------------------------------------- */
/**
* @return the array index sort of an array sort
*/
Sort getArrayIndexSort() const;
/**
* @return the array element sort of an array element sort
*/
Sort getArrayElementSort() const;
/* Set sort ------------------------------------------------------------ */
/**
* @return the element sort of a set sort
*/
Sort getSetElementSort() const;
/* Uninterpreted sort -------------------------------------------------- */
/**
* @return the name of an uninterpreted sort
*/
std::string getUninterpretedSortName() const;
/**
* @return true if an uninterpreted sort is parameterezied
*/
bool isUninterpretedSortParameterized() const;
/**
* @return the parameter sorts of an uninterpreted sort
*/
std::vector<Sort> getUninterpretedSortParamSorts() const;
/* Sort constructor sort ----------------------------------------------- */
/**
* @return the name of a sort constructor sort
*/
std::string getSortConstructorName() const;
/**
* @return the arity of a sort constructor sort
*/
size_t getSortConstructorArity() const;
/* Bit-vector sort ----------------------------------------------------- */
/**
* @return the bit-width of the bit-vector sort
*/
uint32_t getBVSize() const;
/* Floating-point sort ------------------------------------------------- */
/**
* @return the bit-width of the exponent of the floating-point sort
*/
uint32_t getFPExponentSize() const;
/**
* @return the width of the significand of the floating-point sort
*/
uint32_t getFPSignificandSize() const;
/* Datatype sort ------------------------------------------------------- */
/**
* @return the parameter sorts of a datatype sort
*/
std::vector<Sort> getDatatypeParamSorts() const;
/**
* @return the arity of a datatype sort
*/
size_t getDatatypeArity() const;
/* Tuple sort ---------------------------------------------------------- */
/**
* @return the length of a tuple sort
*/
size_t getTupleLength() const;
/**
* @return the element sorts of a tuple sort
*/
std::vector<Sort> getTupleSorts() const;
private:
/**
* Helper for isNull checks. This prevents calling an API function with
* CVC4_API_CHECK_NOT_NULL
*/
bool isNullHelper() const;
/**
* The associated solver object.
*/
const Solver* d_solver;
/**
* The interal type wrapped by this sort.
* This is a shared_ptr rather than a unique_ptr to avoid overhead due to
* memory allocation (CVC4::Type is already ref counted, so this could be
* a unique_ptr instead).
*/
std::shared_ptr<CVC4::Type> d_type;
};
/**
* Serialize a sort to given stream.
* @param out the output stream
* @param s the sort to be serialized to the given output stream
* @return the output stream
*/
std::ostream& operator<<(std::ostream& out, const Sort& s) CVC4_PUBLIC;
/**
* Hash function for Sorts.
*/
struct CVC4_PUBLIC SortHashFunction
{
size_t operator()(const Sort& s) const;
};
/* -------------------------------------------------------------------------- */
/* Op */
/* -------------------------------------------------------------------------- */
/**
* A CVC4 operator.
* An operator is a term that represents certain operators, instantiated
* with its required parameters, e.g., a term of kind BITVECTOR_EXTRACT.
*/
class CVC4_PUBLIC Op
{
friend class Solver;
friend struct OpHashFunction;
public:
/**
* Constructor.
*/
Op();
// !!! This constructor is only temporarily public until the parser is fully
// migrated to the new API. !!!
/**
* Constructor for a single kind (non-indexed operator).
* @param slv the associated solver object
* @param k the kind of this Op
*/
Op(const Solver* slv, const Kind k);
// !!! This constructor is only temporarily public until the parser is fully
// migrated to the new API. !!!
/**
* Constructor.
* @param slv the associated solver object
* @param k the kind of this Op
* @param e the internal expression that is to be wrapped by this term
* @return the Term
*/
Op(const Solver* slv, const Kind k, const CVC4::Expr& e);
/**
* Destructor.
*/
~Op();
/**
* Syntactic equality operator.
* Return true if both operators are syntactically identical.
* Both operators must belong to the same solver object.
* @param t the operator to compare to for equality
* @return true if the operators are equal
*/
bool operator==(const Op& t) const;
/**
* Syntactic disequality operator.
* Return true if both operators differ syntactically.
* Both terms must belong to the same solver object.
* @param t the operator to compare to for disequality
* @return true if operators are disequal
*/
bool operator!=(const Op& t) const;
/**
* @return the kind of this operator
*/
Kind getKind() const;
/**
* @return true if this operator is a null term
*/
bool isNull() const;
/**
* @return true iff this operator is indexed
*/
bool isIndexed() const;
/**
* Get the indices used to create this Op.
* Supports the following template arguments:
* - string
* - Kind
* - uint32_t
* - pair<uint32_t, uint32_t>
* Check the Op Kind with getKind() to determine which argument to use.
* @return the indices used to create this Op
*/
template <typename T>
T getIndices() const;
/**
* @return a string representation of this operator
*/
std::string toString() const;
// !!! This is only temporarily available until the parser is fully migrated
// to the new API. !!!
CVC4::Expr getExpr(void) const;
private:
/**
* Helper for isNull checks. This prevents calling an API function with
* CVC4_API_CHECK_NOT_NULL
*/
bool isNullHelper() const;
/**
* Note: An indexed operator has a non-null internal expr, d_expr
* Note 2: We use a helper method to avoid having API functions call
* other API functions (we need to call this internally)
* @return true iff this Op is indexed
*/
bool isIndexedHelper() const;
/**
* The associated solver object.
*/
const Solver* d_solver;
/* The kind of this operator. */
Kind d_kind;
/**
* The internal expression wrapped by this operator.
* This is a shared_ptr rather than a unique_ptr to avoid overhead due to
* memory allocation (CVC4::Expr is already ref counted, so this could be
* a unique_ptr instead).
*/
std::shared_ptr<CVC4::Expr> d_expr;
};
/* -------------------------------------------------------------------------- */
/* Term */
/* -------------------------------------------------------------------------- */
/**
* A CVC4 Term.
*/
class CVC4_PUBLIC Term
{
friend class Datatype;
friend class DatatypeConstructor;
friend class Solver;
friend class Grammar;
friend struct TermHashFunction;
public:
// !!! This constructor is only temporarily public until the parser is fully
// migrated to the new API. !!!
/**
* Constructor.
* @param slv the associated solver object
* @param e the internal expression that is to be wrapped by this term
* @return the Term
*/
Term(const Solver* slv, const CVC4::Expr& e);
/**
* Constructor.
*/
Term();
/**
* Destructor.
*/
~Term();
/**
* Syntactic equality operator.
* Return true if both terms are syntactically identical.
* Both terms must belong to the same solver object.
* @param t the term to compare to for equality
* @return true if the terms are equal
*/
bool operator==(const Term& t) const;
/**
* Syntactic disequality operator.
* Return true if both terms differ syntactically.
* Both terms must belong to the same solver object.
* @param t the term to compare to for disequality
* @return true if terms are disequal
*/
bool operator!=(const Term& t) const;
/**
* Comparison for ordering on terms.
* @param t the term to compare to
* @return true if this term is less than t
*/
bool operator<(const Term& t) const;
/**
* Comparison for ordering on terms.
* @param t the term to compare to
* @return true if this term is greater than t
*/
bool operator>(const Term& t) const;
/**
* Comparison for ordering on terms.
* @param t the term to compare to
* @return true if this term is less than or equal to t
*/
bool operator<=(const Term& t) const;
/**
* Comparison for ordering on terms.
* @param t the term to compare to
* @return true if this term is greater than or equal to t
*/
bool operator>=(const Term& t) const;
/**
* Returns the number of children of this term.
*
* @return the number of term
*/
size_t getNumChildren() const;
/**
* Get the child term at a given index.
* @param index the index of the child term to return
* @return the child term with the given index
*/
Term operator[](size_t index) const;
/**
* @return the id of this term
*/
uint64_t getId() const;
/**
* @return the kind of this term
*/
Kind getKind() const;
/**
* @return the sort of this term
*/
Sort getSort() const;
/**
* @return the result of replacing "e" by "replacement" in this term
*/
Term substitute(Term e, Term replacement) const;
/**
* @return the result of simulatenously replacing "es" by "replacements" in
* this term
*/
Term substitute(const std::vector<Term> es,
const std::vector<Term>& replacements) const;
/**
* @return true iff this term has an operator
*/
bool hasOp() const;
/**
* @return the Op used to create this term
* Note: This is safe to call when hasOp() returns true.
*/
Op getOp() const;
/**
* @return true if this Term is a null term
*/
bool isNull() const;
/**
* Check if this is a Term representing a constant.
*
* @return true if a constant Term
*/
bool isConst() const;
/**
* Return the base (element stored at all indices) of a constant array
* throws an exception if the kind is not CONST_ARRAY
* @return the base value
*/
Term getConstArrayBase() const;
/**
* Boolean negation.
* @return the Boolean negation of this term
*/
Term notTerm() const;
/**
* Boolean and.
* @param t a Boolean term
* @return the conjunction of this term and the given term
*/
Term andTerm(const Term& t) const;
/**
* Boolean or.
* @param t a Boolean term
* @return the disjunction of this term and the given term
*/
Term orTerm(const Term& t) const;
/**
* Boolean exclusive or.
* @param t a Boolean term
* @return the exclusive disjunction of this term and the given term
*/
Term xorTerm(const Term& t) const;
/**
* Equality.
* @param t a Boolean term
* @return the Boolean equivalence of this term and the given term
*/
Term eqTerm(const Term& t) const;
/**
* Boolean implication.
* @param t a Boolean term
* @return the implication of this term and the given term
*/
Term impTerm(const Term& t) const;
/**
* If-then-else with this term as the Boolean condition.
* @param then_t the 'then' term
* @param else_t the 'else' term
* @return the if-then-else term with this term as the Boolean condition
*/
Term iteTerm(const Term& then_t, const Term& else_t) const;
/**
* @return a string representation of this term
*/
std::string toString() const;
/**
* Iterator for the children of a Term.
* Note: This treats uninterpreted functions as Term just like any other term
* for example, the term f(x, y) will have Kind APPLY_UF and three
* children: f, x, and y
*/
class const_iterator : public std::iterator<std::input_iterator_tag, Term>
{
friend class Term;
public:
/**
* Null Constructor.
*/
const_iterator();
/**
* Constructor
* @param slv the associated solver object
* @param e a shared pointer to the expression that we're iterating over
* @param p the position of the iterator (e.g. which child it's on)
*/
const_iterator(const Solver* slv,
const std::shared_ptr<CVC4::Expr>& e,
uint32_t p);
/**
* Copy constructor.
*/
const_iterator(const const_iterator& it);
/**
* Assignment operator.
* @param it the iterator to assign to
* @return the reference to the iterator after assignment
*/
const_iterator& operator=(const const_iterator& it);