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
|
/******************************************************************************
* Top contributors (to current version):
* Andrew Reynolds
*
* This file is part of the cvc5 project.
*
* Copyright (c) 2009-2021 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.
* ****************************************************************************
*
* The cardinality constraint operator
*/
#include "cvc5_public.h"
#ifndef CVC5__EXPR__CARDINALITY_CONSTRAINT_H
#define CVC5__EXPR__CARDINALITY_CONSTRAINT_H
#include <iosfwd>
#include <memory>
#include "util/integer.h"
#include "util/hash.h"
namespace cvc5 {
class TypeNode;
/**
* A cardinality constraint, handled in the cardinality extension of the UF
* solver, used for finite model finding.
*/
class CardinalityConstraint
{
public:
/**
* Constructs a cardinality constraint of the specified type, which should
* be an uninterpreted sort.
*/
CardinalityConstraint(const TypeNode& ufType, const Integer& ub);
~CardinalityConstraint();
CardinalityConstraint(const CardinalityConstraint& other);
/** Get the type of the cardinality constraint */
const TypeNode& getType() const;
/** Get the upper bound value of the cardinality constraint */
const Integer& getUpperBound() const;
bool operator==(const CardinalityConstraint& cc) const;
bool operator!=(const CardinalityConstraint& cc) const;
private:
/** The type that the cardinality constraint is for */
std::unique_ptr<TypeNode> d_type;
/** The upper bound on the cardinality of the above type */
const Integer d_ubound;
};
std::ostream& operator<<(std::ostream& out, const CardinalityConstraint& cc);
using CardinalityConstraintHashFunction = PairHashFunction<TypeNode,
Integer,
std::hash<TypeNode>,
IntegerHashFunction>;
/**
* A combined cardinality constraint, handled in the cardinality extension of
* the UF solver, used for finite model finding for bounding the sum of
* cardinalities of all uninterpreted sorts.
*/
class CombinedCardinalityConstraint
{
public:
/**
* Constructs a cardinality constraint of the specified type, which should
* be an uninterpreted sort.
*/
CombinedCardinalityConstraint(const Integer& ub);
~CombinedCardinalityConstraint();
CombinedCardinalityConstraint(const CombinedCardinalityConstraint& other);
/** Get the upper bound value of the cardinality constraint */
const Integer& getUpperBound() const;
bool operator==(const CombinedCardinalityConstraint& cc) const;
bool operator!=(const CombinedCardinalityConstraint& cc) const;
private:
/** The upper bound on the cardinality of the above type */
const Integer d_ubound;
};
std::ostream& operator<<(std::ostream& out,
const CombinedCardinalityConstraint& cc);
struct CombinedCardinalityConstraintHashFunction
{
size_t operator()(const CombinedCardinalityConstraint& cc) const;
};
} // namespace cvc5
#endif
|