summaryrefslogtreecommitdiff
path: root/src/theory/unconstrained_simplifier.h
blob: 5edbdb682e93d3a04a1be93f2c57251cf63f947f (plain)
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
/*********************                                                        */
/*! \file unconstrained_simplifier.h
 ** \verbatim
 ** Original author: barrett
 ** Major contributors: none
 ** Minor contributors (to current version): none
 ** This file is part of the CVC4 prototype.
 ** Copyright (c) 2009-2012  New York University and The University of Iowa
 ** See the file COPYING in the top-level source directory for licensing
 ** information.\endverbatim
 **
 ** \brief Simplifications based on unconstrained variables
 **
 ** This module implements a preprocessing phase which replaces certain "unconstrained" expressions
 ** by variables.  Based on Roberto Bruttomesso's PhD thesis.
 **/

#include "cvc4_private.h"

#ifndef __CVC4__UNCONSTRAINED_SIMPLIFIER_H
#define __CVC4__UNCONSTRAINED_SIMPLIFIER_H

#include <vector>
#include <utility>

#include "expr/node.h"
#include "theory/theory.h"
#include "theory/substitutions.h"

namespace CVC4 {

class UnconstrainedSimplifier {

  /** number of expressions eliminated due to unconstrained simplification */
  IntStat d_numUnconstrainedElim;

  typedef std::hash_map<TNode, unsigned, TNodeHashFunction> TNodeCountMap;
  typedef std::hash_map<TNode, TNode, TNodeHashFunction> TNodeMap;
  typedef std::hash_set<TNode, TNodeHashFunction> TNodeSet;

  TNodeCountMap d_visited;
  TNodeMap d_visitedOnce;
  TNodeSet d_unconstrained;

  context::Context* d_context;
  theory::SubstitutionMap d_substitutions;

  const LogicInfo& d_logicInfo;

  void visitAll(TNode assertion);
  Node newUnconstrainedVar(TypeNode t, TNode var);
  void processUnconstrained();

public:
  UnconstrainedSimplifier(context::Context* context, const LogicInfo& logicInfo);
  ~UnconstrainedSimplifier();
  void processAssertions(std::vector<Node>& assertions);
};

}

#endif
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback