dlinear  0.0.1
Delta-complete SMT solver for linear programming
Loading...
Searching...
No Matches
symbolic_expression.h
1#pragma once
2
3#include <algorithm> // for cpplint only
4#include <cstddef>
5#include <functional>
6#include <limits>
7#include <map>
8#include <ostream>
9#include <string>
10#include <type_traits>
11#include <unordered_map>
12#include <utility>
13#include <vector>
14
15#include "dlinear/libs/libgmp.h"
16#include "dlinear/symbolic/hash.h"
17#include "dlinear/symbolic/symbolic_environment.h"
18#include "dlinear/symbolic/symbolic_variable.h"
19#include "dlinear/symbolic/symbolic_variables.h"
20
21namespace dlinear::drake {
22namespace symbolic {
23
25enum class ExpressionKind {
26 Constant,
27 Var,
28 Add,
29 Mul,
30 Div,
31 Log,
32 Abs,
33 Exp,
34 Sqrt,
35 Pow,
36 Sin,
37 Cos,
38 Tan,
39 Asin,
40 Acos,
41 Atan,
42 Atan2,
43 Sinh,
44 Cosh,
45 Tanh,
46 Min,
47 Max,
48 IfThenElse,
49 NaN,
50 Infty,
51 UninterpretedFunction,
52 // TODO(soonho): add Integral
53};
54
56bool operator<(ExpressionKind k1, ExpressionKind k2);
57
58class ExpressionCell; // In symbolic_expression_cell.h
59class ExpressionConstant; // In symbolic_expression_cell.h
60class ExpressionInfty; // In symbolic_expression_cell.h
61class ExpressionVar; // In symbolic_expression_cell.h
62class UnaryExpressionCell; // In symbolic_expression_cell.h
63class BinaryExpressionCell; // In symbolic_expression_cell.h
64class ExpressionAdd; // In symbolic_expression_cell.h
65class ExpressionMul; // In symbolic_expression_cell.h
66class ExpressionDiv; // In symbolic_expression_cell.h
67class ExpressionLog; // In symbolic_expression_cell.h
68class ExpressionAbs; // In symbolic_expression_cell.h
69class ExpressionExp; // In symbolic_expression_cell.h
70class ExpressionSqrt; // In symbolic_expression_cell.h
71class ExpressionPow; // In symbolic_expression_cell.h
72class ExpressionSin; // In symbolic_expression_cell.h
73class ExpressionCos; // In symbolic_expression_cell.h
74class ExpressionTan; // In symbolic_expression_cell.h
75class ExpressionAsin; // In symbolic_expression_cell.h
76class ExpressionAcos; // In symbolic_expression_cell.h
77class ExpressionAtan; // In symbolic_expression_cell.h
78class ExpressionAtan2; // In symbolic_expression_cell.h
79class ExpressionSinh; // In symbolic_expression_cell.h
80class ExpressionCosh; // In symbolic_expression_cell.h
81class ExpressionTanh; // In symbolic_expression_cell.h
82class ExpressionMin; // In symbolic_expression_cell.h
83class ExpressionMax; // In symbolic_expression_cell.h
84class ExpressionIfThenElse; // In symbolic_expression_cell.h
85class ExpressionUninterpretedFunction; // In symbolic_expression_cell.h
86class Formula; // In symbolic_formula.h
87class Expression;
88
89// ExpressionSubstitution is a map from a Variable to a symbolic expression. It
90// is used in Expression::Substitute and Formula::Substitute methods as an
91// argument.
92using ExpressionSubstitution = std::unordered_map<Variable, Expression, hash_value<Variable>>;
93
94// FormulaSubstitution is a map from a Variable to a symbolic formula. It
95// is used in Expression::Substitute and Formula::Substitute methods as an
96// argument.
97using FormulaSubstitution = std::unordered_map<Variable, Formula, hash_value<Variable>>;
98
163 public:
164 Expression(const Expression &);
165 Expression &operator=(const Expression &);
166 Expression(Expression &&) noexcept;
167 Expression &operator=(Expression &&) noexcept;
168 ~Expression();
169
172
174 // NOLINTNEXTLINE(runtime/explicit): This conversion is desirable.
175 Expression(const mpq_class &d);
176 // NOLINTNEXTLINE(runtime/explicit): This conversion is desirable.
177 Expression(const double d);
178 Expression(int d);
179 Expression(long d);
180 Expression(uint32_t d);
181 Expression(uint64_t d);
185 // NOLINTNEXTLINE(runtime/explicit): This conversion is desirable.
186 Expression(const Variable &var);
188 ExpressionKind get_kind() const;
190 size_t get_hash() const;
192 const Variables &GetVariables() const;
193
194 void Swap(Expression &e);
195
223 bool EqualTo(const Expression &e) const;
224
228 bool Less(const Expression &e) const;
229
231 bool is_polynomial() const;
232
235 bool include_ite() const;
236
240 mpq_class Evaluate(const Environment &env = Environment{}) const;
241
249
260
265 Expression Substitute(const Variable &var, const Expression &e) const;
266
277 Expression Substitute(const ExpressionSubstitution &expr_subst,
278 const FormulaSubstitution &formula_subst) const;
279
286 Expression Substitute(const ExpressionSubstitution &expr_subst) const;
287
295 Expression Substitute(const FormulaSubstitution &formula_subst) const;
296
302
304 std::string to_string() const;
305 std::string to_smt2_string() const;
306
308 static Expression Zero();
310 static Expression One();
312 static Expression Pi();
314 static Expression E();
316 static Expression NaN();
321
322 friend Expression operator+(const Expression &lhs, const Expression &rhs);
323 friend Expression operator+(const Expression &lhs, Expression &&rhs);
324 friend Expression operator+(Expression &&lhs, const Expression &rhs);
325 friend Expression operator+(Expression &&lhs, Expression &&rhs);
326 // NOLINTNEXTLINE(runtime/references) per C++ standard signature.
327 friend Expression &operator+=(Expression &lhs, const Expression &rhs);
328
333
334 friend Expression operator-(const Expression &lhs, const Expression &rhs);
335 friend Expression operator-(const Expression &lhs, Expression &&rhs);
336 friend Expression operator-(Expression &&lhs, const Expression &rhs);
337 friend Expression operator-(Expression &&lhs, Expression &&rhs);
338 // NOLINTNEXTLINE(runtime/references) per C++ standard signature.
339 friend Expression &operator-=(Expression &lhs, const Expression &rhs);
340
343
346 friend Expression operator-(Expression &&e);
347
352
353 friend Expression operator*(const Expression &lhs, const Expression &rhs);
354 friend Expression operator*(const Expression &lhs, Expression &&rhs);
355 friend Expression operator*(Expression &&lhs, const Expression &rhs);
356 friend Expression operator*(Expression &&lhs, Expression &&rhs);
357 // NOLINTNEXTLINE(runtime/references) per C++ standard signature.
358 friend Expression &operator*=(Expression &lhs, const Expression &rhs);
359
360 friend Expression operator/(Expression lhs, const Expression &rhs);
361 // NOLINTNEXTLINE(runtime/references) per C++ standard signature.
362 friend Expression &operator/=(Expression &lhs, const Expression &rhs);
363
368 friend Expression log(const Expression &e);
369 friend Expression abs(const Expression &e);
370 friend Expression exp(const Expression &e);
371 friend Expression sqrt(const Expression &e);
372 friend Expression pow(const Expression &e1, const Expression &e2);
373 friend Expression sin(const Expression &e);
374 friend Expression cos(const Expression &e);
375 friend Expression tan(const Expression &e);
376 friend Expression asin(const Expression &e);
377 friend Expression acos(const Expression &e);
378 friend Expression atan(const Expression &e);
379 friend Expression atan2(const Expression &e1, const Expression &e2);
380 friend Expression sinh(const Expression &e);
381 friend Expression cosh(const Expression &e);
382 friend Expression tanh(const Expression &e);
383 friend Expression min(const Expression &e1, const Expression &e2);
384 friend Expression max(const Expression &e1, const Expression &e2);
385
423 friend Expression if_then_else(const Formula &f_cond,
424 const Expression &e_then,
425 const Expression &e_else);
426 friend Expression uninterpreted_function(const std::string &name,
427 const Variables &vars);
428
429 friend std::ostream &operator<<(std::ostream &os, const Expression &e);
430 friend void swap(Expression &a, Expression &b) { std::swap(a.ptr_, b.ptr_); }
431
432 friend bool is_constant(const Expression &e);
433 friend bool is_variable(const Expression &e);
434 friend bool is_addition(const Expression &e);
435 friend bool is_multiplication(const Expression &e);
436 friend bool is_division(const Expression &e);
437 friend bool is_log(const Expression &e);
438 friend bool is_abs(const Expression &e);
439 friend bool is_exp(const Expression &e);
440 friend bool is_sqrt(const Expression &e);
441 friend bool is_pow(const Expression &e);
442 friend bool is_sin(const Expression &e);
443 friend bool is_cos(const Expression &e);
444 friend bool is_tan(const Expression &e);
445 friend bool is_asin(const Expression &e);
446 friend bool is_acos(const Expression &e);
447 friend bool is_atan(const Expression &e);
448 friend bool is_atan2(const Expression &e);
449 friend bool is_sinh(const Expression &e);
450 friend bool is_cosh(const Expression &e);
451 friend bool is_tanh(const Expression &e);
452 friend bool is_min(const Expression &e);
453 friend bool is_max(const Expression &e);
454 friend bool is_if_then_else(const Expression &e);
456
457 // Note that the following cast functions are only for low-level operations
458 // and not exposed to the user of symbolic/symbolic_expression.h
459 // header. These functions are declared in
460 // symbolic/symbolic_expression_cell.h header.
462 friend const ExpressionInfty *to_infty(const Expression &e);
463 friend const ExpressionVar *to_variable(const Expression &e);
464 friend const UnaryExpressionCell *to_unary(const Expression &e);
466 friend const ExpressionAdd *to_addition(const Expression &e);
470 friend const ExpressionDiv *to_division(const Expression &e);
471 friend const ExpressionLog *to_log(const Expression &e);
472 friend const ExpressionAbs *to_abs(const Expression &e);
473 friend const ExpressionExp *to_exp(const Expression &e);
474 friend const ExpressionSqrt *to_sqrt(const Expression &e);
475 friend const ExpressionPow *to_pow(const Expression &e);
476 friend const ExpressionSin *to_sin(const Expression &e);
477 friend const ExpressionCos *to_cos(const Expression &e);
478 friend const ExpressionTan *to_tan(const Expression &e);
479 friend const ExpressionAsin *to_asin(const Expression &e);
480 friend const ExpressionAcos *to_acos(const Expression &e);
481 friend const ExpressionAtan *to_atan(const Expression &e);
482 friend const ExpressionAtan2 *to_atan2(const Expression &e);
483 friend const ExpressionSinh *to_sinh(const Expression &e);
484 friend const ExpressionCosh *to_cosh(const Expression &e);
485 friend const ExpressionTanh *to_tanh(const Expression &e);
486 friend const ExpressionMin *to_min(const Expression &e);
487 friend const ExpressionMax *to_max(const Expression &e);
490 const Expression &e);
491
492 friend class ExpressionAddFactory;
493 friend class ExpressionMulFactory;
494 friend class ExpressionCell;
495
496 private:
497 static ExpressionCell *make_cell(const mpq_class &d);
498 static ExpressionCell *make_cell(const double d);
499
500 explicit Expression(ExpressionCell *ptr);
501
502 ExpressionCell *ptr_{nullptr};
503};
504
505Expression operator+(const Expression &lhs, const Expression &rhs);
506Expression operator+(const Expression &lhs, Expression &&rhs);
507Expression operator+(Expression &&lhs, const Expression &rhs);
508Expression operator+(Expression &&lhs, Expression &&rhs);
509// NOLINTNEXTLINE(runtime/references) per C++ standard signature.
510Expression &operator+=(Expression &lhs, const Expression &rhs);
511
512Expression operator-(const Expression &lhs, const Expression &rhs);
513Expression operator-(const Expression &lhs, Expression &&rhs);
514Expression operator-(Expression &&lhs, const Expression &rhs);
516// NOLINTNEXTLINE(runtime/references) per C++ standard signature.
517Expression &operator-=(Expression &lhs, const Expression &rhs);
518
519Expression operator+(const Expression &e);
520
523
524Expression operator*(const Expression &lhs, const Expression &rhs);
525Expression operator*(const Expression &lhs, Expression &&rhs);
526Expression operator*(Expression &&lhs, const Expression &rhs);
527Expression operator*(Expression &&lhs, Expression &&rhs);
528// NOLINTNEXTLINE(runtime/references) per C++ standard signature.
529Expression &operator*=(Expression &lhs, const Expression &rhs);
530
531Expression operator/(Expression lhs, const Expression &rhs);
532// NOLINTNEXTLINE(runtime/references) per C++ standard signature.
533Expression &operator/=(Expression &lhs, const Expression &rhs);
534
537Expression Sum(const std::vector<Expression> &expressions);
538
541Expression Prod(const std::vector<Expression> &expressions);
542
543Expression log(const Expression &e);
544Expression abs(const Expression &e);
545Expression exp(const Expression &e);
546Expression sqrt(const Expression &e);
547Expression pow(const Expression &e1, const Expression &e2);
548Expression sin(const Expression &e);
549Expression cos(const Expression &e);
550Expression tan(const Expression &e);
551Expression asin(const Expression &e);
552Expression acos(const Expression &e);
553Expression atan(const Expression &e);
554Expression atan2(const Expression &e1, const Expression &e2);
555Expression sinh(const Expression &e);
556Expression cosh(const Expression &e);
557Expression tanh(const Expression &e);
558Expression min(const Expression &e1, const Expression &e2);
559Expression max(const Expression &e1, const Expression &e2);
560Expression if_then_else(const Formula &f_cond, const Expression &e_then,
561 const Expression &e_else);
562
572Expression uninterpreted_function(const std::string &name, const Variables &vars);
573void swap(Expression &a, Expression &b);
574
575std::ostream &operator<<(std::ostream &os, const Expression &e);
576
578bool is_constant(const Expression &e);
580bool is_constant(const Expression &e, const mpq_class &v);
582bool is_zero(const Expression &e);
584bool is_one(const Expression &e);
586bool is_neg_one(const Expression &e);
588bool is_two(const Expression &e);
590bool is_nan(const Expression &e);
592bool is_infinite(const Expression &e);
594bool is_infinity(const Expression &e);
596bool is_negative_infinity(const Expression &e);
598bool is_variable(const Expression &e);
600bool is_addition(const Expression &e);
602bool is_multiplication(const Expression &e);
604bool is_division(const Expression &e);
606bool is_log(const Expression &e);
608bool is_abs(const Expression &e);
610bool is_exp(const Expression &e);
612bool is_sqrt(const Expression &e);
614bool is_pow(const Expression &e);
616bool is_sin(const Expression &e);
618bool is_cos(const Expression &e);
620bool is_tan(const Expression &e);
622bool is_asin(const Expression &e);
624bool is_acos(const Expression &e);
626bool is_atan(const Expression &e);
628bool is_atan2(const Expression &e);
630bool is_sinh(const Expression &e);
632bool is_cosh(const Expression &e);
634bool is_tanh(const Expression &e);
636bool is_min(const Expression &e);
638bool is_max(const Expression &e);
640bool is_if_then_else(const Expression &e);
642bool is_uninterpreted_function(const Expression &e);
643
647const mpq_class& get_constant_value(const Expression &e);
651const Variable &get_variable(const Expression &e);
655const Expression &get_argument(const Expression &e);
659const Expression &get_first_argument(const Expression &e);
663const Expression &get_second_argument(const Expression &e);
668const mpq_class& get_constant_in_addition(const Expression &e);
674const std::map<Expression, mpq_class> &get_expr_to_coeff_map_in_addition(
675 const Expression &e);
680const mpq_class& get_constant_in_multiplication(const Expression &e);
686const std::map<Expression, Expression> &
687get_base_to_exponent_map_in_multiplication(const Expression &e);
688
692const Formula &get_conditional_formula(const Expression &e);
693
697const Expression &get_then_expression(const Expression &e);
698
702const Expression &get_else_expression(const Expression &e);
703
707const std::string &get_uninterpreted_function_name(const Expression &e);
708
709Expression operator+(const Variable &var);
710Expression operator-(const Variable &var);
711
712} // namespace symbolic
713
714} // namespace dlinear::drake
715
716
717namespace std {
718/* Provides std::less<dlinear::drake::symbolic::Expression>. */
719template<>
720struct less<dlinear::drake::symbolic::Expression> {
721 bool operator()(const dlinear::drake::symbolic::Expression &lhs,
722 const dlinear::drake::symbolic::Expression &rhs) const {
723 return lhs.Less(rhs);
724 }
725};
726
727/* Provides std::equal_to<dlinear::drake::symbolic::Expression>. */
728template<>
729struct equal_to<dlinear::drake::symbolic::Expression> {
730 bool operator()(const dlinear::drake::symbolic::Expression &lhs,
731 const dlinear::drake::symbolic::Expression &rhs) const {
732 return lhs.EqualTo(rhs);
733 }
734};
735
736template<>
737struct hash<dlinear::drake::symbolic::Expression> {
738 size_t operator()(const dlinear::drake::symbolic::Expression &e) const {
739 return e.get_hash();
740 }
741};
742
743/* Provides std::numeric_limits<dlinear::drake::symbolic::Expression>. */
744template<>
745struct numeric_limits<dlinear::drake::symbolic::Expression>
746 : public numeric_limits<mpq_class> {
747 static const bool has_infinity = true;
748 static mpq_class infinity();
749};
750
751} // namespace std
Represents the base class for binary expressions.
Represents a symbolic environment (mapping from a variable to a value).
Symbolic expression representing absolute value function.
Symbolic expression representing arccosine function.
Factory class to help build ExpressionAdd expressions.
Symbolic expression representing an addition which is a sum of products.
Symbolic expression representing arcsine function.
Symbolic expression representing atan2 function (arctangent function with two arguments).
Symbolic expression representing arctangent function.
Represents an abstract class which is the base of concrete symbolic-expression classes.
Symbolic expression representing a rational constant (mpq_class).
Symbolic expression representing cosine function.
Symbolic expression representing hyperbolic cosine function.
Symbolic expression representing division.
Symbolic expression representing exponentiation using the base of natural logarithms.
Symbolic expression representing if-then-else expression.
Symbolic expression representing infinities.
Symbolic expression representing logarithms.
Symbolic expression representing max function.
Symbolic expression representing min function.
Factory class to help build ExpressionMul expressions.
Symbolic expression representing a multiplication of powers.
Symbolic expression representing power function.
Symbolic expression representing sine function.
Symbolic expression representing hyperbolic sine function.
Symbolic expression representing square-root.
Symbolic expression representing tangent function.
Symbolic expression representing hyperbolic tangent function.
Symbolic expression representing an uninterpreted function.
Symbolic expression representing a variable.
Represents a symbolic form of an expression.
size_t get_hash() const
Returns hash value.
friend const ExpressionSin * to_sin(const Expression &e)
Casts e of Expression to const ExpressionSin*.
friend const ExpressionSinh * to_sinh(const Expression &e)
Casts e of Expression to const ExpressionSinh*.
friend const ExpressionSqrt * to_sqrt(const Expression &e)
Casts e of Expression to const ExpressionSqrt*.
friend Expression operator+(const Expression &e)
Provides unary plus operator.
friend bool is_cos(const Expression &e)
Checks if e is a cosine expression.
friend bool is_sin(const Expression &e)
Checks if e is a sine expression.
Expression Substitute(const Variable &var, const Expression &e) const
Returns a copy of this expression replacing all occurrences of var with e.
friend Expression log(const Expression &e)
Creates an real-constant expression represented by [lb, ub].
friend const ExpressionCos * to_cos(const Expression &e)
Casts e of Expression to const ExpressionCos*.
friend const ExpressionUninterpretedFunction * to_uninterpreted_function(const Expression &e)
Casts e of Expression to const ExpressionUninterpretedFunction*.
bool include_ite() const
Returns true if this symbolic expression includes an ITE (If-Then-Else) expression.
friend const ExpressionIfThenElse * to_if_then_else(const Expression &e)
Casts e of Expression to const ExpressionIfThenElse*.
friend bool is_max(const Expression &e)
Checks if e is a max expression.
Expression & operator--()
Provides prefix decrement operator (i.e.
friend bool is_variable(const Expression &e)
Checks if e is a variable expression.
Expression Substitute(const FormulaSubstitution &formula_subst) const
Returns a copy of this expression replacing all occurrences of the variables in formula_subst with co...
friend const BinaryExpressionCell * to_binary(const Expression &e)
Casts e of Expression to const BinaryExpressionCell*.
friend const ExpressionPow * to_pow(const Expression &e)
Casts e of Expression to const ExpressionPow*.
friend const ExpressionAtan2 * to_atan2(const Expression &e)
Casts e of Expression to const ExpressionAtan2*.
friend bool is_acos(const Expression &e)
Checks if e is an arccosine expression.
friend const ExpressionVar * to_variable(const Expression &e)
Casts e of Expression to const ExpressionVar*.
friend const ExpressionMin * to_min(const Expression &e)
Casts e of Expression to const ExpressionMin*.
friend bool is_sinh(const Expression &e)
Checks if e is a hyperbolic-sine expression.
friend bool is_if_then_else(const Expression &e)
Checks if e is an if-then-else expression.
friend const ExpressionCosh * to_cosh(const Expression &e)
Casts e of Expression to const ExpressionCosh*.
friend bool is_asin(const Expression &e)
Checks if e is an arcsine expression.
static Expression Zero()
Returns zero.
Expression Substitute(const ExpressionSubstitution &expr_subst, const FormulaSubstitution &formula_subst) const
Returns a copy of this expression replacing all occurrences of the variables in expr_subst with corre...
friend const ExpressionAbs * to_abs(const Expression &e)
Casts e of Expression to const ExpressionAbs*.
friend bool is_addition(const Expression &e)
Checks if e is an addition expression.
bool Less(const Expression &e) const
Provides lexicographical ordering between expressions.
friend const ExpressionExp * to_exp(const Expression &e)
Casts e of Expression to const ExpressionExp*.
static Expression One()
Returns one.
friend bool is_atan2(const Expression &e)
Checks if e is an arctangent2 expression.
ExpressionKind get_kind() const
Returns expression kind.
friend const ExpressionTan * to_tan(const Expression &e)
Casts e of Expression to const ExpressionTan*.
friend const ExpressionDiv * to_division(const Expression &e)
Casts e of Expression to const ExpressionDiv*.
mpq_class Evaluate(const Environment &env=Environment{}) const
Evaluates under a given environment (by default, an empty environment).
static Expression NaN()
Returns NaN (Not-a-Number).
friend const UnaryExpressionCell * to_unary(const Expression &e)
Casts e of Expression to const UnaryExpressionCell*.
friend bool is_exp(const Expression &e)
Checks if e is an exp expression.
Expression operator++(int)
Provides postfix increment operator (i.e.
Expression(const Variable &var)
Constructs an expression from var.
friend bool is_atan(const Expression &e)
Checks if e is an arctangent expression.
friend const ExpressionMax * to_max(const Expression &e)
Casts e of Expression to const ExpressionMax*.
static Expression Infty()
Returns positive infinity.
const Variables & GetVariables() const
Collects variables in expression.
friend const ExpressionTanh * to_tanh(const Expression &e)
Casts e of Expression to const ExpressionTanh*.
friend const ExpressionAdd * to_addition(const Expression &e)
Casts e of Expression to const ExpressionAdd*.
Expression & operator++()
Provides prefix increment operator (i.e.
static Expression NInfty()
Returns negative infinity.
friend const ExpressionConstant * to_constant(const Expression &e)
Casts e of Expression to const ExpressionConstant*.
friend const ExpressionLog * to_log(const Expression &e)
Casts e of Expression to const ExpressionLog*.
friend bool is_uninterpreted_function(const Expression &e)
Checks if e is an uninterpreted-function expression.
Expression(const mpq_class &d)
Constructs a constant (rational).
Expression Expand() const
Expands out products and positive integer powers in expression.
Expression Substitute(const ExpressionSubstitution &expr_subst) const
Returns a copy of this expression replacing all occurrences of the variables in expr_subst with corre...
friend bool is_tan(const Expression &e)
Checks if e is a tangent expression.
static Expression Pi()
Returns Pi, the ratio of a circle’s circumference to its diameter.
friend bool is_pow(const Expression &e)
Checks if e is a power-function expression.
friend Expression uninterpreted_function(const std::string &name, const Variables &vars)
Constructs an uninterpreted-function expression with name and vars.
friend bool is_tanh(const Expression &e)
Checks if e is a hyperbolic-tangent expression.
Expression()
Default constructor.
static Expression E()
Return e, the base of natural logarithms.
friend bool is_log(const Expression &e)
Checks if e is a log expression.
friend bool is_division(const Expression &e)
Checks if e is a division expression.
friend bool is_cosh(const Expression &e)
Checks if e is a hyperbolic-cosine expression.
Expression EvaluatePartial(const Environment &env) const
Partially evaluates this expression using an environment env.
Expression Differentiate(const Variable &x) const
Differentiates this symbolic expression with respect to the variable var.
friend bool is_abs(const Expression &e)
Checks if e is an abs expression.
friend ExpressionAdd * to_addition(Expression &e)
Casts e of Expression to ExpressionAdd*.
friend const ExpressionMul * to_multiplication(const Expression &e)
Casts e of Expression to const ExpressionMul*.
friend ExpressionMul * to_multiplication(Expression &e)
Casts e of Expression to ExpressionMul*.
friend const ExpressionInfty * to_infty(const Expression &e)
Casts e of Expression to const ExpressionInfty*.
std::string to_string() const
Returns string representation of Expression.
Expression operator--(int)
Provides postfix decrement operator (i.e.
friend const ExpressionAcos * to_acos(const Expression &e)
Casts e of Expression to const ExpressionAcos*.
friend bool is_constant(const Expression &e)
Checks if e is a rational constant expression.
friend bool is_min(const Expression &e)
Checks if e is a min expression.
friend bool is_multiplication(const Expression &e)
Checks if e is a multiplication expression.
bool is_polynomial() const
Checks if this symbolic expression is convertible to Polynomial.
friend Expression operator-(const Expression &e)
Provides unary minus operator.
friend bool is_sqrt(const Expression &e)
Checks if e is a square-root expression.
bool EqualTo(const Expression &e) const
Checks structural equality.
friend Expression if_then_else(const Formula &f_cond, const Expression &e_then, const Expression &e_else)
Constructs if-then-else expression.
friend const ExpressionAsin * to_asin(const Expression &e)
Casts e of Expression to const ExpressionAsin*.
friend const ExpressionAtan * to_atan(const Expression &e)
Casts e of Expression to const ExpressionAtan*.
Represents a symbolic form of a first-order logic formula.
Represents the base class for unary expressions.
Represents a symbolic variable.
Represents a set of variables.
@ Abs
Absolute value.
@ Mul
Multiplication.
Global namespace for the dlinear library.
LpColBound operator-(LpColBound bound)
Invert the bound with delta > 0.
STL namespace.