CBMC
Loading...
Searching...
No Matches
algebraic_number.h
Go to the documentation of this file.
1/*******************************************************************\
2
3Module: Algebraic numbers
4
5Author: Michael Tautschnig
6
7\*******************************************************************/
8
9#ifndef CPROVER_UTIL_ALGEBRAIC_NUMBER_H
10#define CPROVER_UTIL_ALGEBRAIC_NUMBER_H
11
12#include "rational.h"
13#include "std_expr.h"
14
18{
19protected:
20 // the i-th entry is the coefficient of degree i
21 using coefficientst = std::vector<rationalt>;
23
24public:
27 explicit algebraic_numbert(const std::vector<rationalt> &coeff)
28 : coefficients(coeff)
29 {
30 DATA_INVARIANT(coefficients.size() >= 2, "minimum degree is 1");
31 }
32
38
40 explicit algebraic_numbert(const rationalt &r)
42 {
43 }
44
45 constant_exprt as_expr() const;
46
48 {
49 return coefficients;
50 }
51};
52
53std::ostream &operator<<(std::ostream &out, const algebraic_numbert &a);
54
55#endif // CPROVER_UTIL_ALGEBRAIC_NUMBER_H
std::ostream & operator<<(std::ostream &out, const algebraic_numbert &a)
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:562
Represents real numbers as roots (zeros) of a polynomial with rational coefficients.
constant_exprt as_expr() const
algebraic_numbert()
The default constructor builds a algebraic_numbert representing real number 0.
algebraic_numbert(const std::vector< rationalt > &coeff)
Represent a real number as roots of a polynomial with rational coefficients coeff.
coefficientst coefficients
algebraic_numbert(const rationalt &r)
Represent a rational number as algebraic_numbert.
std::vector< rationalt > coefficientst
const coefficientst & get_coefficients() const
A constant literal expression.
Definition std_expr.h:3118
static int8_t r
Definition irep_hash.h:60
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
Definition invariant.h:534
API to expression classes.