GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/theory/logic_info.cpp Lines: 385 424 90.8 %
Date: 2021-09-29 Branches: 412 710 58.0 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Morgan Deters, Tim King, Andrew Reynolds
4
 *
5
 * This file is part of the cvc5 project.
6
 *
7
 * Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
8
 * in the top-level source directory and their institutional affiliations.
9
 * All rights reserved.  See the file COPYING in the top-level source
10
 * directory for licensing information.
11
 * ****************************************************************************
12
 *
13
 * A class giving information about a logic (group a theory modules
14
 * and configuration information)
15
 */
16
#include "theory/logic_info.h"
17
18
#include <cstring>
19
#include <iostream>
20
#include <sstream>
21
#include <string>
22
23
#include "base/check.h"
24
#include "base/configuration.h"
25
#include "expr/kind.h"
26
27
using namespace std;
28
using namespace cvc5::theory;
29
30
namespace cvc5 {
31
32
69845
LogicInfo::LogicInfo()
33
    : d_logicString(""),
34
      d_theories(THEORY_LAST, false),
35
      d_sharingTheories(0),
36
      d_integers(true),
37
      d_reals(true),
38
      d_transcendentals(true),
39
      d_linear(false),
40
      d_differenceLogic(false),
41
      d_cardinalityConstraints(false),
42
      d_higherOrder(false),
43
69845
      d_locked(false)
44
{
45
977830
  for (TheoryId id = THEORY_FIRST; id < THEORY_LAST; ++id)
46
  {
47
907985
    enableTheory(id);
48
  }
49
69845
}
50
51
7914
LogicInfo::LogicInfo(std::string logicString)
52
    : d_logicString(""),
53
      d_theories(THEORY_LAST, false),
54
      d_sharingTheories(0),
55
      d_integers(false),
56
      d_reals(false),
57
      d_transcendentals(false),
58
      d_linear(false),
59
      d_differenceLogic(false),
60
      d_cardinalityConstraints(false),
61
      d_higherOrder(false),
62
7916
      d_locked(false)
63
{
64
7916
  setLogicString(logicString);
65
7912
  lock();
66
7912
}
67
68
8721
LogicInfo::LogicInfo(const char* logicString)
69
    : d_logicString(""),
70
      d_theories(THEORY_LAST, false),
71
      d_sharingTheories(0),
72
      d_integers(false),
73
      d_reals(false),
74
      d_transcendentals(false),
75
      d_linear(false),
76
      d_differenceLogic(false),
77
      d_cardinalityConstraints(false),
78
      d_higherOrder(false),
79
8721
      d_locked(false)
80
{
81
8721
  setLogicString(logicString);
82
8721
  lock();
83
8721
}
84
85
/** Is sharing enabled for this logic? */
86
42561573
bool LogicInfo::isSharingEnabled() const {
87
42561573
  PrettyCheckArgument(d_locked, *this,
88
                      "This LogicInfo isn't locked yet, and cannot be queried");
89
42561573
  return d_sharingTheories > 1;
90
}
91
92
93
/** Is the given theory module active in this logic? */
94
53850382
bool LogicInfo::isTheoryEnabled(theory::TheoryId theory) const {
95
53850382
  PrettyCheckArgument(d_locked, *this,
96
                      "This LogicInfo isn't locked yet, and cannot be queried");
97
53850366
  return d_theories[theory];
98
}
99
100
/** Is this a quantified logic? */
101
166354
bool LogicInfo::isQuantified() const {
102
166354
  PrettyCheckArgument(d_locked, *this,
103
                      "This LogicInfo isn't locked yet, and cannot be queried");
104
166352
  return isTheoryEnabled(theory::THEORY_QUANTIFIERS);
105
}
106
107
/** Is this a higher-order logic? */
108
5582362
bool LogicInfo::isHigherOrder() const
109
{
110
5582362
  PrettyCheckArgument(d_locked,
111
                      *this,
112
                      "This LogicInfo isn't locked yet, and cannot be queried");
113
5582362
  return d_higherOrder;
114
}
115
116
20613
bool LogicInfo::hasEverything() const
117
{
118
20613
  PrettyCheckArgument(d_locked,
119
                      *this,
120
                      "This LogicInfo isn't locked yet, and cannot be queried");
121
41226
  LogicInfo everything;
122
20613
  everything.enableEverything(isHigherOrder());
123
20613
  everything.lock();
124
41226
  return (*this == everything);
125
}
126
127
/** Is this the all-exclusive logic?  (Here, that means propositional logic) */
128
52
bool LogicInfo::hasNothing() const {
129
52
  PrettyCheckArgument(d_locked, *this,
130
                      "This LogicInfo isn't locked yet, and cannot be queried");
131
104
  LogicInfo nothing("");
132
52
  nothing.lock();
133
104
  return *this == nothing;
134
}
135
136
69142
bool LogicInfo::isPure(theory::TheoryId theory) const {
137
69142
  PrettyCheckArgument(d_locked, *this,
138
                      "This LogicInfo isn't locked yet, and cannot be queried");
139
  // the third and fourth conjucts are really just to rule out the misleading
140
  // case where you ask isPure(THEORY_BOOL) and get true even in e.g. QF_LIA
141
131027
  return isTheoryEnabled(theory) && !isSharingEnabled() &&
142
83549
      ( !isTrueTheory(theory) || d_sharingTheories == 1 ) &&
143
74153
      ( isTrueTheory(theory) || d_sharingTheories == 0 );
144
}
145
146
12447
bool LogicInfo::areIntegersUsed() const {
147
12447
  PrettyCheckArgument(d_locked, *this,
148
                      "This LogicInfo isn't locked yet, and cannot be queried");
149
12445
  PrettyCheckArgument(
150
      isTheoryEnabled(theory::THEORY_ARITH), *this,
151
      "Arithmetic not used in this LogicInfo; cannot ask whether integers are used");
152
12441
  return d_integers;
153
}
154
155
7047
bool LogicInfo::areRealsUsed() const {
156
7047
  PrettyCheckArgument(d_locked, *this,
157
                      "This LogicInfo isn't locked yet, and cannot be queried");
158
7045
  PrettyCheckArgument(
159
      isTheoryEnabled(theory::THEORY_ARITH), *this,
160
      "Arithmetic not used in this LogicInfo; cannot ask whether reals are used");
161
7041
  return d_reals;
162
}
163
164
9524
bool LogicInfo::areTranscendentalsUsed() const
165
{
166
9524
  PrettyCheckArgument(d_locked,
167
                      *this,
168
                      "This LogicInfo isn't locked yet, and cannot be queried");
169
9524
  PrettyCheckArgument(isTheoryEnabled(theory::THEORY_ARITH),
170
                      *this,
171
                      "Arithmetic not used in this LogicInfo; cannot ask "
172
                      "whether transcendentals are used");
173
9520
  return d_transcendentals;
174
}
175
176
110455
bool LogicInfo::isLinear() const {
177
110455
  PrettyCheckArgument(d_locked, *this,
178
                      "This LogicInfo isn't locked yet, and cannot be queried");
179
110453
  PrettyCheckArgument(
180
      isTheoryEnabled(theory::THEORY_ARITH), *this,
181
      "Arithmetic not used in this LogicInfo; cannot ask whether it's linear");
182
110449
  return d_linear || d_differenceLogic;
183
}
184
185
5328
bool LogicInfo::isDifferenceLogic() const {
186
5328
  PrettyCheckArgument(d_locked, *this,
187
                      "This LogicInfo isn't locked yet, and cannot be queried");
188
5328
  PrettyCheckArgument(
189
      isTheoryEnabled(theory::THEORY_ARITH), *this,
190
      "Arithmetic not used in this LogicInfo; cannot ask whether it's difference logic");
191
5324
  return d_differenceLogic;
192
}
193
194
8634
bool LogicInfo::hasCardinalityConstraints() const {
195
8634
  PrettyCheckArgument(d_locked, *this,
196
                      "This LogicInfo isn't locked yet, and cannot be queried");
197
8634
  return d_cardinalityConstraints;
198
}
199
200
201
35267
bool LogicInfo::operator==(const LogicInfo& other) const {
202
35267
  PrettyCheckArgument(isLocked() && other.isLocked(), *this,
203
                      "This LogicInfo isn't locked yet, and cannot be queried");
204
282337
  for(theory::TheoryId id = theory::THEORY_FIRST; id < theory::THEORY_LAST; ++id) {
205
271710
    if(d_theories[id] != other.d_theories[id]) {
206
24640
      return false;
207
    }
208
  }
209
210
10627
  PrettyCheckArgument(d_sharingTheories == other.d_sharingTheories, *this,
211
                      "LogicInfo internal inconsistency");
212
21210
  if (d_cardinalityConstraints != other.d_cardinalityConstraints ||
213
10583
             d_higherOrder != other.d_higherOrder )
214
  {
215
68
    return false;
216
  }
217
10559
  if(isTheoryEnabled(theory::THEORY_ARITH)) {
218
20567
    return d_integers == other.d_integers && d_reals == other.d_reals
219
9978
           && d_transcendentals == other.d_transcendentals
220
9897
           && d_linear == other.d_linear
221
20186
           && d_differenceLogic == other.d_differenceLogic;
222
  }
223
66
  return true;
224
}
225
226
7044
bool LogicInfo::operator<=(const LogicInfo& other) const {
227
7044
  PrettyCheckArgument(isLocked() && other.isLocked(), *this,
228
                      "This LogicInfo isn't locked yet, and cannot be queried");
229
63594
  for(theory::TheoryId id = theory::THEORY_FIRST; id < theory::THEORY_LAST; ++id) {
230
60672
    if(d_theories[id] && !other.d_theories[id]) {
231
4122
      return false;
232
    }
233
  }
234
2922
  PrettyCheckArgument(d_sharingTheories <= other.d_sharingTheories, *this,
235
                      "LogicInfo internal inconsistency");
236
5868
  bool res = (!d_cardinalityConstraints || other.d_cardinalityConstraints)
237
5820
             && (!d_higherOrder || other.d_higherOrder);
238
2922
  if(isTheoryEnabled(theory::THEORY_ARITH) && other.isTheoryEnabled(theory::THEORY_ARITH)) {
239
4128
    return (!d_integers || other.d_integers) && (!d_reals || other.d_reals)
240
1722
           && (!d_transcendentals || other.d_transcendentals)
241
1704
           && (d_linear || !other.d_linear)
242
4038
           && (d_differenceLogic || !other.d_differenceLogic) && res;
243
  } else {
244
288
    return res;
245
  }
246
}
247
248
6510
bool LogicInfo::operator>=(const LogicInfo& other) const {
249
6510
  PrettyCheckArgument(isLocked() && other.isLocked(), *this,
250
                      "This LogicInfo isn't locked yet, and cannot be queried");
251
59092
  for(theory::TheoryId id = theory::THEORY_FIRST; id < theory::THEORY_LAST; ++id) {
252
56338
    if(!d_theories[id] && other.d_theories[id]) {
253
3756
      return false;
254
    }
255
  }
256
2754
  PrettyCheckArgument(d_sharingTheories >= other.d_sharingTheories, *this,
257
                      "LogicInfo internal inconsistency");
258
8232
  bool res = (d_cardinalityConstraints || !other.d_cardinalityConstraints)
259
5490
             && (d_higherOrder || !other.d_higherOrder);
260
2754
  if(isTheoryEnabled(theory::THEORY_ARITH) && other.isTheoryEnabled(theory::THEORY_ARITH)) {
261
3186
    return (d_integers || !other.d_integers) && (d_reals || !other.d_reals)
262
1594
           && (d_transcendentals || !other.d_transcendentals)
263
1582
           && (!d_linear || other.d_linear)
264
3800
           && (!d_differenceLogic || other.d_differenceLogic) && res;
265
    } else {
266
264
      return res;
267
  }
268
}
269
270
8738
std::string LogicInfo::getLogicString() const {
271
8738
  PrettyCheckArgument(
272
      d_locked, *this,
273
      "This LogicInfo isn't locked yet, and cannot be queried");
274
8736
  if(d_logicString == "") {
275
5134
    LogicInfo qf_all_supported;
276
2567
    qf_all_supported.disableQuantifiers();
277
2567
    qf_all_supported.lock();
278
5134
    stringstream ss;
279
2567
    if (isHigherOrder())
280
    {
281
26
      ss << "HO_";
282
    }
283
2567
    if (!isQuantified())
284
    {
285
321
      ss << "QF_";
286
    }
287
2567
    if (*this == qf_all_supported || hasEverything())
288
    {
289
1334
      ss << "ALL";
290
    }
291
    else
292
    {
293
1233
      size_t seen = 0; // make sure we support all the active theories
294
1233
      if (d_theories[THEORY_SEP])
295
      {
296
8
        ss << "SEP_";
297
8
        ++seen;
298
      }
299
1233
      if(d_theories[THEORY_ARRAYS]) {
300
63
        ss << (d_sharingTheories == 1 ? "AX" : "A");
301
63
        ++seen;
302
      }
303
1233
      if(d_theories[THEORY_UF]) {
304
1198
        ss << "UF";
305
1198
        ++seen;
306
      }
307
1233
      if( d_cardinalityConstraints ){
308
        ss << "C";
309
      }
310
1233
      if(d_theories[THEORY_BV]) {
311
254
        ss << "BV";
312
254
        ++seen;
313
      }
314
1233
      if(d_theories[THEORY_FP]) {
315
42
        ss << "FP";
316
42
        ++seen;
317
      }
318
1233
      if(d_theories[THEORY_DATATYPES]) {
319
594
        ss << "DT";
320
594
        ++seen;
321
      }
322
1233
      if(d_theories[THEORY_STRINGS]) {
323
360
        ss << "S";
324
360
        ++seen;
325
      }
326
1233
      if(d_theories[THEORY_ARITH]) {
327
1140
        if(isDifferenceLogic()) {
328
          ss << (areIntegersUsed() ? "I" : "");
329
          ss << (areRealsUsed() ? "R" : "");
330
          ss << "DL";
331
        } else {
332
1140
          ss << (isLinear() ? "L" : "N");
333
1140
          ss << (areIntegersUsed() ? "I" : "");
334
1140
          ss << (areRealsUsed() ? "R" : "");
335
1140
          ss << "A";
336
1140
          ss << (areTranscendentalsUsed() ? "T" : "");
337
        }
338
1140
        ++seen;
339
      }
340
1233
      if(d_theories[THEORY_SETS]) {
341
11
        ss << "FS";
342
11
        ++seen;
343
      }
344
1233
      if (d_theories[THEORY_BAGS])
345
      {
346
2
        ss << "FB";
347
2
        ++seen;
348
      }
349
1233
      if(seen != d_sharingTheories) {
350
        Unhandled()
351
            << "can't extract a logic string from LogicInfo; at least one "
352
               "active theory is unknown to LogicInfo::getLogicString() !";
353
      }
354
355
1233
      if(seen == 0) {
356
        ss << "SAT";
357
      }
358
    }
359
2567
    d_logicString = ss.str();
360
  }
361
8736
  return d_logicString;
362
}
363
364
16635
void LogicInfo::setLogicString(std::string logicString)
365
{
366
16635
  PrettyCheckArgument(!d_locked, *this,
367
                      "This LogicInfo is locked, and cannot be modified");
368
232890
  for(TheoryId id = THEORY_FIRST; id < THEORY_LAST; ++id) {
369
216255
    d_theories[id] = false;// ensure it's cleared
370
  }
371
16635
  d_sharingTheories = 0;
372
373
  // Below, ONLY use enableTheory()/disableTheory() rather than
374
  // accessing d_theories[] directly.  This makes sure to set up
375
  // sharing properly.
376
377
16635
  enableTheory(THEORY_BUILTIN);
378
16635
  enableTheory(THEORY_BOOL);
379
380
16635
  const char* p = logicString.c_str();
381
16635
  if (!strncmp(p, "HO_", 3))
382
  {
383
181
    enableHigherOrder();
384
181
    p += 3;
385
  }
386
16635
  if(*p == '\0') {
387
    // propositional logic only; we're done.
388
16581
  } else if(!strcmp(p, "QF_SAT")) {
389
    // propositional logic only; we're done.
390
12
    p += 6;
391
16569
  } else if(!strcmp(p, "SAT")) {
392
    // quantified Boolean formulas only; we're done.
393
22
    enableQuantifiers();
394
22
    p += 3;
395
16547
  } else if(!strcmp(p, "QF_ALL")) {
396
    // the "all theories included" logic, no quantifiers.
397
207
    enableEverything(d_higherOrder);
398
207
    disableQuantifiers();
399
207
    arithNonLinear();
400
207
    p += 6;
401
16340
  } else if(!strcmp(p, "ALL")) {
402
    // the "all theories included" logic, with quantifiers.
403
2762
    enableEverything(d_higherOrder);
404
2762
    enableQuantifiers();
405
2762
    arithNonLinear();
406
2762
    p += 3;
407
  }
408
13578
  else if (!strcmp(p, "HORN"))
409
  {
410
    // the HORN logic
411
    enableEverything(d_higherOrder);
412
    enableQuantifiers();
413
    arithNonLinear();
414
    p += 4;
415
  } else {
416
13578
    if(!strncmp(p, "QF_", 3)) {
417
11521
      disableQuantifiers();
418
11521
      p += 3;
419
    } else {
420
2057
      enableQuantifiers();
421
    }
422
13578
    if (!strncmp(p, "SEP_", 4))
423
    {
424
4
      enableSeparationLogic();
425
4
      p += 4;
426
    }
427
13578
    if(!strncmp(p, "AX", 2)) {
428
26
      enableTheory(THEORY_ARRAYS);
429
26
      p += 2;
430
    } else {
431
13552
      if(*p == 'A') {
432
1572
        enableTheory(THEORY_ARRAYS);
433
1572
        ++p;
434
      }
435
13552
      if(!strncmp(p, "UF", 2)) {
436
9350
        enableTheory(THEORY_UF);
437
9350
        p += 2;
438
      }
439
13552
      if(!strncmp(p, "C", 1 )) {
440
38
        d_cardinalityConstraints = true;
441
38
        p += 1;
442
      }
443
      // allow BV or DT in either order
444
13552
      if(!strncmp(p, "BV", 2)) {
445
1836
        enableTheory(THEORY_BV);
446
1836
        p += 2;
447
      }
448
13552
      if(!strncmp(p, "FP", 2)) {
449
70
        enableTheory(THEORY_FP);
450
70
        p += 2;
451
      }
452
13552
      if(!strncmp(p, "DT", 2)) {
453
80
        enableTheory(THEORY_DATATYPES);
454
80
        p += 2;
455
      }
456
13552
      if(!d_theories[THEORY_BV] && !strncmp(p, "BV", 2)) {
457
        enableTheory(THEORY_BV);
458
        p += 2;
459
      }
460
13552
      if(*p == 'S') {
461
648
        enableTheory(THEORY_STRINGS);
462
648
        ++p;
463
      }
464
13552
      if(!strncmp(p, "IDL", 3)) {
465
217
        enableIntegers();
466
217
        disableReals();
467
217
        arithOnlyDifference();
468
217
        p += 3;
469
13335
      } else if(!strncmp(p, "RDL", 3)) {
470
108
        disableIntegers();
471
108
        enableReals();
472
108
        arithOnlyDifference();
473
108
        p += 3;
474
13227
      } else if(!strncmp(p, "IRDL", 4)) {
475
        // "IRDL" ?! --not very useful, but getLogicString() can produce
476
        // that string, so we really had better be able to read it back in.
477
        enableIntegers();
478
        enableReals();
479
        arithOnlyDifference();
480
        p += 4;
481
13227
      } else if(!strncmp(p, "LIA", 3)) {
482
2144
        enableIntegers();
483
2144
        disableReals();
484
2144
        arithOnlyLinear();
485
2144
        p += 3;
486
11083
      } else if(!strncmp(p, "LRA", 3)) {
487
771
        disableIntegers();
488
771
        enableReals();
489
771
        arithOnlyLinear();
490
771
        p += 3;
491
10312
      } else if(!strncmp(p, "LIRA", 4)) {
492
332
        enableIntegers();
493
332
        enableReals();
494
332
        arithOnlyLinear();
495
332
        p += 4;
496
9980
      } else if(!strncmp(p, "NIA", 3)) {
497
574
        enableIntegers();
498
574
        disableReals();
499
574
        arithNonLinear();
500
574
        p += 3;
501
9406
      } else if(!strncmp(p, "NRA", 3)) {
502
6731
        disableIntegers();
503
6731
        enableReals();
504
6731
        arithNonLinear();
505
6731
        p += 3;
506
6731
        if (*p == 'T')
507
        {
508
86
          arithTranscendentals();
509
86
          p += 1;
510
        }
511
2675
      } else if(!strncmp(p, "NIRA", 4)) {
512
256
        enableIntegers();
513
256
        enableReals();
514
256
        arithNonLinear();
515
256
        p += 4;
516
256
        if (*p == 'T')
517
        {
518
6
          arithTranscendentals();
519
6
          p += 1;
520
        }
521
      }
522
13552
      if(!strncmp(p, "FS", 2)) {
523
110
        enableTheory(THEORY_SETS);
524
110
        p += 2;
525
      }
526
    }
527
  }
528
529
16635
  if (d_theories[THEORY_FP])
530
  {
531
    // THEORY_BV is needed for bit-blasting.
532
    // We have to set this here rather than in expandDefinition as it
533
    // is possible to create variables without any theory specific
534
    // operations, so expandDefinition won't be called.
535
3039
    enableTheory(THEORY_BV);
536
  }
537
538
16635
  if(*p != '\0') {
539
4
    stringstream err;
540
2
    err << "LogicInfo::setLogicString(): ";
541
2
    if(p == logicString) {
542
      err << "cannot parse logic string: " << logicString;
543
    } else {
544
2
      err << "junk (\"" << p << "\") at end of logic string: " << logicString;
545
    }
546
2
    IllegalArgument(logicString, err.str().c_str());
547
  }
548
549
  // ensure a getLogic() returns the same thing as was set
550
16633
  d_logicString = logicString;
551
16633
}
552
553
23584
void LogicInfo::enableEverything(bool enableHigherOrder)
554
{
555
23584
  PrettyCheckArgument(!d_locked, *this, "This LogicInfo is locked, and cannot be modified");
556
23584
  *this = LogicInfo();
557
23584
  this->d_higherOrder = enableHigherOrder;
558
23584
}
559
560
2
void LogicInfo::disableEverything() {
561
2
  PrettyCheckArgument(!d_locked, *this, "This LogicInfo is locked, and cannot be modified");
562
2
  *this = LogicInfo("");
563
2
}
564
565
978596
void LogicInfo::enableTheory(theory::TheoryId theory) {
566
978596
  PrettyCheckArgument(!d_locked, *this, "This LogicInfo is locked, and cannot be modified");
567
978596
  if(!d_theories[theory]) {
568
969855
    if(isTrueTheory(theory)) {
569
724580
      ++d_sharingTheories;
570
    }
571
969855
    d_logicString = "";
572
969855
    d_theories[theory] = true;
573
  }
574
978596
}
575
576
21977
void LogicInfo::disableTheory(theory::TheoryId theory) {
577
21977
  PrettyCheckArgument(!d_locked, *this, "This LogicInfo is locked, and cannot be modified");
578
21967
  if(d_theories[theory]) {
579
2830
    if(isTrueTheory(theory)) {
580
54
      Assert(d_sharingTheories > 0);
581
54
      --d_sharingTheories;
582
    }
583
2830
    if(theory == THEORY_BUILTIN ||
584
       theory == THEORY_BOOL) {
585
      return;
586
    }
587
2830
    d_logicString = "";
588
2830
    d_theories[theory] = false;
589
  }
590
}
591
592
689
void LogicInfo::enableSygus()
593
{
594
689
  enableQuantifiers();
595
689
  enableTheory(THEORY_UF);
596
689
  enableTheory(THEORY_DATATYPES);
597
689
  enableIntegers();
598
689
}
599
600
4
void LogicInfo::enableSeparationLogic()
601
{
602
4
  enableTheory(THEORY_SEP);
603
4
  enableTheory(THEORY_UF);
604
4
  enableTheory(THEORY_SETS);
605
4
}
606
607
4318
void LogicInfo::enableIntegers() {
608
4318
  PrettyCheckArgument(!d_locked, *this, "This LogicInfo is locked, and cannot be modified");
609
4316
  d_logicString = "";
610
4316
  enableTheory(THEORY_ARITH);
611
4316
  d_integers = true;
612
4316
}
613
614
7614
void LogicInfo::disableIntegers() {
615
7614
  PrettyCheckArgument(!d_locked, *this, "This LogicInfo is locked, and cannot be modified");
616
7612
  d_logicString = "";
617
7612
  d_integers = false;
618
7612
  if(!d_reals) {
619
7610
    disableTheory(THEORY_ARITH);
620
  }
621
7612
}
622
623
8198
void LogicInfo::enableReals() {
624
8198
  PrettyCheckArgument(!d_locked, *this, "This LogicInfo is locked, and cannot be modified");
625
8198
  d_logicString = "";
626
8198
  enableTheory(THEORY_ARITH);
627
8198
  d_reals = true;
628
8198
}
629
630
2939
void LogicInfo::disableReals() {
631
2939
  PrettyCheckArgument(!d_locked, *this, "This LogicInfo is locked, and cannot be modified");
632
2937
  d_logicString = "";
633
2937
  d_reals = false;
634
2937
  if(!d_integers) {
635
    disableTheory(THEORY_ARITH);
636
  }
637
2937
}
638
639
92
void LogicInfo::arithTranscendentals()
640
{
641
92
  PrettyCheckArgument(
642
      !d_locked, *this, "This LogicInfo is locked, and cannot be modified");
643
92
  d_logicString = "";
644
92
  d_transcendentals = true;
645
92
  if (!d_reals)
646
  {
647
    enableReals();
648
  }
649
92
  if (d_linear)
650
  {
651
    arithNonLinear();
652
  }
653
92
}
654
655
325
void LogicInfo::arithOnlyDifference() {
656
325
  PrettyCheckArgument(!d_locked, *this, "This LogicInfo is locked, and cannot be modified");
657
325
  d_logicString = "";
658
325
  d_linear = true;
659
325
  d_differenceLogic = true;
660
325
  d_transcendentals = false;
661
325
}
662
663
3353
void LogicInfo::arithOnlyLinear() {
664
3353
  PrettyCheckArgument(!d_locked, *this, "This LogicInfo is locked, and cannot be modified");
665
3351
  d_logicString = "";
666
3351
  d_linear = true;
667
3351
  d_differenceLogic = false;
668
3351
  d_transcendentals = false;
669
3351
}
670
671
10616
void LogicInfo::arithNonLinear() {
672
10616
  PrettyCheckArgument(!d_locked, *this, "This LogicInfo is locked, and cannot be modified");
673
10616
  d_logicString = "";
674
10616
  d_linear = false;
675
10616
  d_differenceLogic = false;
676
10616
}
677
678
void LogicInfo::enableCardinalityConstraints()
679
{
680
  PrettyCheckArgument(
681
      !d_locked, *this, "This LogicInfo is locked, and cannot be modified");
682
  d_logicString = "";
683
  d_cardinalityConstraints = true;
684
}
685
686
void LogicInfo::disableCardinalityConstraints()
687
{
688
  PrettyCheckArgument(
689
      !d_locked, *this, "This LogicInfo is locked, and cannot be modified");
690
  d_logicString = "";
691
  d_cardinalityConstraints = false;
692
}
693
694
183
void LogicInfo::enableHigherOrder()
695
{
696
183
  PrettyCheckArgument(
697
      !d_locked, *this, "This LogicInfo is locked, and cannot be modified");
698
183
  d_logicString = "";
699
183
  d_higherOrder = true;
700
183
}
701
702
void LogicInfo::disableHigherOrder()
703
{
704
  PrettyCheckArgument(
705
      !d_locked, *this, "This LogicInfo is locked, and cannot be modified");
706
  d_logicString = "";
707
  d_higherOrder = false;
708
}
709
710
4896
LogicInfo LogicInfo::getUnlockedCopy() const {
711
4896
  if(d_locked) {
712
9792
    LogicInfo info = *this;
713
4896
    info.d_locked = false;
714
4896
    return info;
715
  } else {
716
    return *this;
717
  }
718
}
719
720
2352
std::ostream& operator<<(std::ostream& out, const LogicInfo& logic) {
721
2352
  return out << logic.getLogicString();
722
}
723
724
22746
}  // namespace cvc5