GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/theory/quantifiers/sygus/rcons_type_info.h Lines: 1 1 100.0 %
Date: 2021-08-16 Branches: 1 2 50.0 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Abdalrhman Mohamed
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
 * Utility class for Sygus Reconstruct module.
14
 */
15
16
#include "cvc5_private.h"
17
18
#ifndef CVC5__THEORY__QUANTIFIERS__RCONS_TYPE_INFO_H
19
#define CVC5__THEORY__QUANTIFIERS__RCONS_TYPE_INFO_H
20
21
#include "theory/quantifiers/sygus/sygus_enumerator.h"
22
23
namespace cvc5 {
24
namespace theory {
25
namespace quantifiers {
26
27
class RConsObligation;
28
29
/**
30
 * A utility class for Sygus Reconstruct datatype types (grammar non-terminals).
31
 * This class is mainly responsible for enumerating sygus datatype type terms
32
 * and building sets of equivalent builtin terms for the rcons algorithm.
33
 */
34
106
class RConsTypeInfo
35
{
36
 public:
37
  /**
38
   * Initialize a sygus enumerator and a candidate rewrite database for this
39
   * class' sygus datatype type.
40
   *
41
   * @param tds Database for sygus terms
42
   * @param s Statistics managed for the synth engine
43
   * @param stn The sygus datatype type encoding the syntax restrictions
44
   * @param builtinVars A list containing the builtin analog of sygus variable
45
   *                    list for the sygus datatype type
46
   */
47
  void initialize(TermDbSygus* tds,
48
                  SygusStatistics& s,
49
                  TypeNode stn,
50
                  const std::vector<Node>& builtinVars);
51
52
  /**
53
   * Returns the next enumerated term for the given sygus datatype type.
54
   *
55
   * @return The enumerated sygus term
56
   */
57
  Node nextEnum();
58
59
  /**
60
   * Add a pure term to the candidate rewrite database.
61
   *
62
   * @param n The term to add to the database
63
   * @return A previous term `eq_n` added to this class, such that `n` is
64
   * equivalent to `eq_n`. If no previous term equivalent to `n` exists then the
65
   * result is `n` itself
66
   */
67
  Node addTerm(Node n);
68
69
  /**
70
   * Set the obligation responsible for solving the given builtin term.
71
   *
72
   * @param t The builtin term
73
   * @param ob The corresponding obligation
74
   */
75
  void setBuiltinToOb(Node t, RConsObligation* ob);
76
77
  /**
78
   * Return the obligation responsible for solving the given builtin term.
79
   *
80
   * @param t The builtin term
81
   * @return The corresponding obligation
82
   */
83
  RConsObligation* builtinToOb(Node t);
84
85
 private:
86
  /** Sygus terms enumerator for this class' Sygus datatype type */
87
  std::unique_ptr<SygusEnumerator> d_enumerator;
88
  /** Candidate rewrite database for this class' sygus datatype type */
89
  std::unique_ptr<CandidateRewriteDatabase> d_crd;
90
  /** Sygus sampler needed for initializing the candidate rewrite database */
91
  SygusSampler d_sygusSampler;
92
  /** A map from a builtin term to its obligation.
93
   *
94
   * Each sygus datatype type has its own version of this map because it is
95
   * possible to have multiple obligations to reconstruct the same builtin term
96
   * from different sygus datatype types.
97
   */
98
  std::unordered_map<Node, RConsObligation*> d_ob;
99
};
100
101
}  // namespace quantifiers
102
}  // namespace theory
103
}  // namespace cvc5
104
105
#endif  // CVC5__THEORY__QUANTIFIERS__RCONS_TYPE_INFO_H