carl  24.04
Computer ARithmetic Library
ModelMVRootSubstitution.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 ModelMVRootSubstitution: public ModelSubstitution<Rational,Poly> {
9  public:
11  private:
14  public:
16  {}
17  virtual void multiplyBy(const Rational&) {}
18  virtual void add(const Rational&) {}
20  return createSubstitutionPtr<Rational,Poly,ModelMVRootSubstitution>(mRoot);
21  }
23  assert(mv.is_variable());
25  }
27  return evaluate(mRoot, m);
28  }
29  virtual bool dependsOn(const ModelVariable& var) const {
30  if (!var.is_variable()) return false;
31  return mRoot.poly().degree(var.asVariable()) > 0;
32  }
33  virtual void print(std::ostream& os) const {
34  os << mRoot;
35  }
36  };
37 }
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 Poly & poly() const noexcept
Represent a sum type/variant of an (in)equality between a variable on the left-hand side and multivar...
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 print(std::ostream &os) const
Print this substitution to the given output stream.
virtual Formula< Poly > representingFormula(const ModelVariable &mv)
virtual bool dependsOn(const ModelVariable &var) const
Check if this substitution needs the given model variable.
virtual void add(const Rational &)
Add a rational to this model substitution.
virtual ModelSubstitutionPtr< Rational, Poly > clone() const
Create a copy of this model substitution.
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
carl::Variable asVariable() const
Definition: ModelVariable.h:72