carl  24.04
Computer ARithmetic Library
aux.h
Go to the documentation of this file.
1 #pragma once
2 
3 namespace carl::formula::aux {
4 
5 /**
6  * [Auxiliary method]
7  * @return The formula combining the first to the second last sub-formula of this formula by the
8  * same operator as the one of this formula.
9  * Example: this = (op a1 a2 .. an) -> return = (op a1 .. an-1)
10  * If n = 2, return = a1
11  */
12 template<typename Pol>
14  assert( f.is_nary() );
15  if( f.subformulas().size() > 2 )
16  {
17  Formulas<Pol> tmpSubformulas;
18  auto iter = f.subformulas().rbegin();
19  ++iter;
20  for( ; iter != f.subformulas().rend(); ++iter )
21  tmpSubformulas.push_back( *iter );
22  return Formula<Pol>( f.type(), tmpSubformulas );
23  }
24  else
25  {
26  assert( f.subformulas().size() == 2 );
27  return *(f.subformulas().begin());
28  }
29 }
30 
31 }
std::vector< Formula< Poly > > Formulas
Formula< Pol > connectPrecedingSubformulas(const Formula< Pol > &f)
[Auxiliary method]
Definition: aux.h:13
Represent an SMT formula, which can be an atom for some background theory or a boolean combination of...
Definition: Formula.h:47
bool is_nary() const
Definition: Formula.h:576
const Formulas< Pol > & subformulas() const
Definition: Formula.h:400
FormulaType type() const
Definition: Formula.h:254