carl  24.04
Computer ARithmetic Library
Complexity.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "Visit.h"
5 
6 namespace carl {
7 
8 template<typename Pol>
9 size_t complexity(const Formula<Pol>& f) {
10  size_t result = 0;
11  carl::visit(f,
12  [&](const Formula<Pol>& _f)
13  {
14  switch( _f.type() )
15  {
16  case FormulaType::TRUE:
17  case FormulaType::FALSE:
18  break;
19  case FormulaType::CONSTRAINT:
20  result += carl::complexity(_f.constraint().constr()); break;
21  case FormulaType::BITVECTOR:
22  result += _f.bv_constraint().complexity(); break;
23  case FormulaType::UEQ:
24  result += _f.u_equality().complexity(); break;
25  default:
26  ++result;
27  }
28  });
29  return result;
30 }
31 
32 }
carl is the main namespace for the library.
std::size_t complexity(const BasicConstraint< Poly > &c)
Definition: Complexity.h:11
void visit(const Formula< Pol > &formula, Visitor func)
Recursively calls func on every subformula.
Definition: Visit.h:12
Represent an SMT formula, which can be an atom for some background theory or a boolean combination of...
Definition: Formula.h:47
FormulaType type() const
Definition: Formula.h:254