GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/theory/bags/theory_bags_type_rules.h Lines: 0 2 0.0 %
Date: 2021-05-22 Branches: 0 0 0.0 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Mudathir Mohamed, Aina Niemetz
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
 * Bags theory type rules.
14
 */
15
16
#include "cvc5_private.h"
17
18
#ifndef CVC5__THEORY__BAGS__THEORY_BAGS_TYPE_RULES_H
19
#define CVC5__THEORY__BAGS__THEORY_BAGS_TYPE_RULES_H
20
21
#include "expr/node.h"
22
23
namespace cvc5 {
24
25
class NodeManager;
26
class TypeNode;
27
28
namespace theory {
29
namespace bags {
30
31
/**
32
 * Type rule for binary operators (union_max, union_disjoint, intersection_min
33
 * difference_subtract, difference_remove)
34
 * to check if the two arguments are of the same sort.
35
 */
36
struct BinaryOperatorTypeRule
37
{
38
  static TypeNode computeType(NodeManager* nodeManager, TNode n, bool check);
39
  static bool computeIsConst(NodeManager* nodeManager, TNode n);
40
}; /* struct BinaryOperatorTypeRule */
41
42
/**
43
 * Type rule for binary operator subbag to check if the two arguments have the
44
 * same sort.
45
 */
46
struct SubBagTypeRule
47
{
48
  static TypeNode computeType(NodeManager* nodeManager, TNode n, bool check);
49
}; /* struct SubBagTypeRule */
50
51
/**
52
 * Type rule for binary operator bag.count to check the sort of the first
53
 * argument matches the element sort of the given bag.
54
 */
55
struct CountTypeRule
56
{
57
  static TypeNode computeType(NodeManager* nodeManager, TNode n, bool check);
58
}; /* struct CountTypeRule */
59
60
/**
61
 * Type rule for duplicate_removal to check the argument is of a bag.
62
 */
63
struct DuplicateRemovalTypeRule
64
{
65
  static TypeNode computeType(NodeManager* nodeManager, TNode n, bool check);
66
}; /* struct DuplicateRemovalTypeRule */
67
68
/**
69
 * Type rule for (bag op e) operator to check the sort of e matches the sort
70
 * stored in op.
71
 */
72
struct MkBagTypeRule
73
{
74
  static TypeNode computeType(NodeManager* nm, TNode n, bool check);
75
  static bool computeIsConst(NodeManager* nodeManager, TNode n);
76
}; /* struct MkBagTypeRule */
77
78
/**
79
 * Type rule for bag.is_singleton to check the argument is of a bag.
80
 */
81
struct IsSingletonTypeRule
82
{
83
  static TypeNode computeType(NodeManager* nodeManager, TNode n, bool check);
84
}; /* struct IsMkBagTypeRule */
85
86
/**
87
 * Type rule for (as emptybag (Bag ...))
88
 */
89
struct EmptyBagTypeRule
90
{
91
  static TypeNode computeType(NodeManager* nodeManager, TNode n, bool check);
92
}; /* struct EmptyBagTypeRule */
93
94
/**
95
 * Type rule for (bag.card ..) to check the argument is of a bag.
96
 */
97
struct CardTypeRule
98
{
99
  static TypeNode computeType(NodeManager* nodeManager, TNode n, bool check);
100
}; /* struct CardTypeRule */
101
102
/**
103
 * Type rule for (bag.choose ..) to check the argument is of a bag.
104
 */
105
struct ChooseTypeRule
106
{
107
  static TypeNode computeType(NodeManager* nodeManager, TNode n, bool check);
108
}; /* struct ChooseTypeRule */
109
110
/**
111
 * Type rule for (bag.from_set ..) to check the argument is of a set.
112
 */
113
struct FromSetTypeRule
114
{
115
  static TypeNode computeType(NodeManager* nodeManager, TNode n, bool check);
116
}; /* struct FromSetTypeRule */
117
118
/**
119
 * Type rule for (bag.to_set ..) to check the argument is of a bag.
120
 */
121
struct ToSetTypeRule
122
{
123
  static TypeNode computeType(NodeManager* nodeManager, TNode n, bool check);
124
}; /* struct ToSetTypeRule */
125
126
struct BagsProperties
127
{
128
  static Cardinality computeCardinality(TypeNode type)
129
  {
130
    return Cardinality::INTEGERS;
131
  }
132
133
  static bool isWellFounded(TypeNode type);
134
135
  static Node mkGroundTerm(TypeNode type);
136
}; /* struct BagsProperties */
137
138
}  // namespace bags
139
}  // namespace theory
140
}  // namespace cvc5
141
142
#endif /* CVC5__THEORY__BAGS__THEORY_BAGS_TYPE_RULES_H */