carl  24.04
Computer ARithmetic Library
ModelFormulaSubstitution.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "../ModelSubstitution.h"
4 #include "../evaluation/ModelEvaluation.h"
5 
6 namespace carl {
7  template<typename Rational, typename Poly>
8  class ModelFormulaSubstitution: public ModelSubstitution<Rational,Poly> {
9  private:
12  public:
14  {}
15  virtual void multiplyBy(const Rational&) {}
16  virtual void add(const Rational&) {}
18  return createSubstitutionPtr<Rational,Poly,ModelFormulaSubstitution>(mFormula);
19  }
21  assert(mv.is_variable());
23  }
25  return evaluate(mFormula, m);
26  }
27  virtual bool dependsOn(const ModelVariable& var) const {
28  if (var.is_variable()) {
29  return mFormula.variables().count(var.asVariable()) > 0;
30  } else if (var.isBVVariable()) {
31 
32  } else if (var.isUVariable()) {
33 
34  } else if (var.isFunction()) {
35 
36  }
37  return false;
38  }
39  virtual void print(std::ostream& os) const {
40  os << mFormula;
41  }
42 
43  const Formula<Poly>& getFormula() const {
44  return mFormula;
45  }
46  };
47 }
mpq_class Rational
Definition: HornerTest.cpp:12
carl is the main namespace for the library.
std::unique_ptr< ModelSubstitution< Rational, Poly > > ModelSubstitutionPtr
Definition: ModelValue.h:24
const Variables & variables() const
Definition: Formula.h:299
Represent a collection of assignments/mappings from variables to values.
Definition: Model.h:19
virtual ModelValue< Rational, Poly > evaluateSubstitution(const Model< Rational, Poly > &m) const
Evaluate this substitution with respect to the given model.
virtual void multiplyBy(const Rational &)
Multiply this model substitution by a rational.
virtual void add(const Rational &)
Add a rational to this model substitution.
virtual Formula< Poly > representingFormula(const ModelVariable &mv)
virtual ModelSubstitutionPtr< Rational, Poly > clone() const
Create a copy of this model substitution.
const Formula< Poly > & getFormula() const
virtual bool dependsOn(const ModelVariable &var) const
Check if this substitution needs the given model variable.
virtual void print(std::ostream &os) const
Print this substitution to the given output stream.
ModelFormulaSubstitution(const Formula< Poly > &f)
Represent a expression for a ModelValue with variables as placeholders, where the final expression's ...
const ModelValue< Rational, Poly > & evaluate(const Model< Rational, Poly > &model) const
Represent a sum type/variant over the different kinds of values that can be assigned to the different...
Definition: ModelValue.h:56
Represent a sum type/variant over the different kinds of variables that exist in CARL to use them in ...
Definition: ModelVariable.h:20
bool is_variable() const
Definition: ModelVariable.h:44
bool isFunction() const
Definition: ModelVariable.h:65
carl::Variable asVariable() const
Definition: ModelVariable.h:72
bool isBVVariable() const
Definition: ModelVariable.h:51
bool isUVariable() const
Definition: ModelVariable.h:58