|
smats
0.0.1
Satisfability Modulo Arithmetic Theories Symbols
|
#include <expression_cell.h>
Public Types | |
using | ExpressionMap = std::map<Expression<T>, Expression<T>> |
Public Member Functions | |
NEW_OPERATOR_PARAMS (ExpressionMul, PARAMS(T constant, ExpressionMap expr_to_coeff_map), PARAMS(constant, expr_to_coeff_map)) | |
void | hash (DelegatingHasher &) const override |
bool | equal_to (const ExpressionCell< T > &o) const override |
bool | less (const ExpressionCell< T > &o) const override |
T | evaluate (const Environment< T > &env) const override |
Expression< T > | evaluate_partial (const Environment< T > &env) const override |
Expression< T > | expand () const override |
Expression< T > | substitute (const Substitution< T > &s) const override |
Expression< T > | differentiate (const Variable &x) const override |
std::ostream & | display (std::ostream &os) const override |
const T & | constant () const |
T & | m_constant () |
const ExpressionMap & | base_to_exponent_map () const |
ExpressionMap & | m_base_to_exponent_map () |
![]() | |
long | use_count () const |
ExpressionKind | kind () const |
const Variables & | variables () const |
bool | is_polynomial () const |
bool | is_expanded () const |
void | set_expanded () |
template<template< class > class E> | |
const E< T > & | to () const |
template<template< class > class E> | |
E< T > & | to () |
Expression< T > | to_expression () const |
void | invalidate_cache () |
Static Public Attributes | |
static const ExpressionKind | expression_kind = ExpressionKind::Mul |
Private Member Functions | |
void | compute_variables (std::optional< Variables > &variables) const override |
void | compute_is_polynomial (std::optional< bool > &is_polynomial) const override |
std::ostream & | display_term (std::ostream &os, bool print_mul, const Expression< T > &base, const Expression< T > &exponent) const |
Static Private Member Functions | |
static Variables | extract_variables (const ExpressionMap &base_to_exponent_map) |
Private Attributes | |
const T | constant_ |
Constant term of the multiplication. | |
const ExpressionMap | base_to_exponent_map_ |
Map from expressions to their exponent. | |
Additional Inherited Members | |
![]() | |
ExpressionCell (ExpressionKind kind, bool is_expanded) | |
ExpressionCell (ExpressionKind kind, bool is_polynomial, bool is_expanded) | |
Symbolic expression representing a multiplication of powers.
The expression holds a constant term and a map from expressions to their coefficients. Let \( k \) be the constant term and \( E \) be the set of pairs \((b, e)\) where \( b \) is the base and \( e \) is the exponent. The ExpressionMul cell represents the following expression:
\[ k \cdot \prod_{(b, e) \in E} b^e \]
|
inlinenodiscard |
Get read-only access to the map of the multiplication expression.
|
overrideprivatevirtual |
Implements smats::ExpressionCell< T >.
|
overrideprivatevirtual |
Implements smats::ExpressionCell< T >.
|
inlinenodiscard |
Get read-only access to the constant of the multiplication expression.
|
nodiscardoverridevirtual |
Differentiates this symbolic expression with respect to the variable var
.
x | variable |
std::runtime_exception | if it is not differentiable. |
Implements smats::ExpressionCell< T >.
|
overridevirtual |
Displays the expression in a human-readable format.
os | output stream |
Implements smats::ExpressionCell< T >.
|
private |
Utility function used to display a single term in a pretty format.
os | output stream |
print_mul | whether to print a multiplication symbol at the beginning |
base | base of the term |
exponent | exponent of the term |
|
nodiscardoverridevirtual |
Compare two expression cells to determine if they are equal.
o | other object to compare against |
Implements smats::ExpressionCell< T >.
|
nodiscardoverridevirtual |
Evaluates under a given environment (by default, an empty environment).
env | environment |
std::runtime_exception | if NaN is detected during evaluation. |
Implements smats::ExpressionCell< T >.
|
nodiscardoverridevirtual |
Returns an Expression obtained by replacing all occurrences of the variables in env
in the current expression cell with the corresponding values in env
.
env | environment |
std::runtime_exception | if NaN is detected during substitution. |
Implements smats::ExpressionCell< T >.
|
nodiscardoverridevirtual |
Expands out products and positive integer powers in expression.
std::runtime_exception | if NaN is detected during expansion. |
Implements smats::ExpressionCell< T >.
|
overridevirtual |
Sends all hash-relevant bytes for this ExpressionCell type into the given hasher, per the hash_append concept, except for kind(), because Expression already sends that.
Implements smats::ExpressionCell< T >.
|
nodiscardoverridevirtual |
Compare two expression cells to determine the order between them.
o | other object to compare against |
Implements smats::ExpressionCell< T >.
ExpressionMul< T >::ExpressionMap & smats::ExpressionMul< T >::m_base_to_exponent_map | ( | ) |
Get read-write access to the map of the multiplication expression.
T & smats::ExpressionMul< T >::m_constant | ( | ) |
Get read-write access to the constant of the multiplication expression.
|
nodiscardoverridevirtual |
Returns an Expression obtained by replacing all occurrences of the variables in s
in the current expression cell with the corresponding expressions in s
.
s | substitution |
std::runtime_exception | if NaN is detected during substitution. |
Implements smats::ExpressionCell< T >.