Barretenberg
The ZK-SNARK library at the core of Aztec
|
Symbolic term element class. More...
#include <term.hpp>
Public Member Functions | |
STerm () | |
STerm (const cvc5::Term &term, Solver *s, TermType type) | |
STerm (const std::string &t, Solver *slv, bool isconst=false, uint32_t base=16, TermType type=TermType::FFTerm) | |
STerm (const STerm &other)=default | |
STerm (STerm &&other)=default | |
STerm (bb::fr value, Solver *s, TermType type=TermType::FFTerm) | |
STerm & | operator= (const STerm &right)=default |
STerm & | operator= (STerm &&right)=default |
STerm | operator+ (const STerm &other) const |
void | operator+= (const STerm &other) |
STerm | operator- (const STerm &other) const |
void | operator-= (const STerm &other) |
STerm | operator- () const |
STerm | operator* (const STerm &other) const |
void | operator*= (const STerm &other) |
STerm | operator/ (const STerm &other) const |
Division operation. | |
void | operator/= (const STerm &other) |
STerm | operator% (const STerm &other) const |
void | operator< (const STerm &other) const |
void | operator<= (const STerm &other) const |
void | operator> (const STerm &other) const |
void | operator>= (const STerm &other) const |
void | operator== (const STerm &other) const |
void | operator!= (const STerm &other) const |
STerm | operator^ (const STerm &other) const |
void | operator^= (const STerm &other) |
STerm | operator& (const STerm &other) const |
void | operator&= (const STerm &other) |
STerm | operator| (const STerm &other) const |
void | operator|= (const STerm &other) |
STerm | operator~ () const |
STerm | truncate (const uint32_t &to_size) |
Returns last to_size bits of variable. | |
STerm | extract_bit (const uint32_t &bit_index) |
Returns ith bit of variable. | |
operator std::string () const | |
operator cvc5::Term () const | |
~STerm ()=default | |
STerm | operator+ (const bb::fr &other) const |
void | operator+= (const bb::fr &other) |
STerm | operator- (const bb::fr &other) const |
void | operator-= (const bb::fr &other) |
STerm | operator* (const bb::fr &other) const |
void | operator*= (const bb::fr &other) |
STerm | operator/ (const bb::fr &other) const |
void | operator/= (const bb::fr &other) |
STerm | operator% (const bb::fr &other) const |
void | operator< (const bb::fr &other) const |
void | operator<= (const bb::fr &other) const |
void | operator> (const bb::fr &other) const |
void | operator>= (const bb::fr &other) const |
void | operator== (const bb::fr &other) const |
void | operator!= (const bb::fr &other) const |
STerm | operator^ (const bb::fr &other) const |
void | operator^= (const bb::fr &other) |
STerm | operator& (const bb::fr &other) const |
void | operator&= (const bb::fr &other) |
STerm | operator| (const bb::fr &other) const |
void | operator|= (const bb::fr &other) |
STerm | operator<< (const uint32_t &n) const |
void | operator<<= (const uint32_t &n) |
STerm | operator>> (const uint32_t &n) const |
void | operator>>= (const uint32_t &n) |
STerm | rotr (const uint32_t &n) const |
STerm | rotl (const uint32_t &n) const |
Static Public Member Functions | |
static STerm | Var (const std::string &name, Solver *slv, TermType type=TermType::FFTerm) |
static STerm | Const (const std::string &val, Solver *slv, uint32_t base=16, TermType type=TermType::FFTerm) |
static STerm | Const (const bb::fr &val, Solver *slv, TermType type=TermType::FFTerm) |
static STerm | batch_add (const std::vector< STerm > &children) |
static STerm | batch_mul (const std::vector< STerm > &children) |
Public Attributes | |
Solver * | solver |
cvc5::Term | term |
TermType | type |
std::unordered_map< OpType, cvc5::Kind > | operations |
Private Member Functions | |
STerm | mod () const |
Reduce the term modulo circuit prime. | |
STerm | normalize () const |
Reduce the integer symbolic term modulo circuit prime if needed. | |
Friends | |
class | Bool |
std::ostream & | operator<< (std::ostream &out, const STerm &term) |
Symbolic term element class.
Can be a Finite Field/Integer Mod/BitVector symbolic variable or a constant. Supports basic arithmetic operations: +, -, *, /. Additionally FFITerm and ITerm support inequalities: <, <=, >, >= and % BVTerm further supports bitwise operations: ~,^, &, |, >>, <<, ror, rol, truncate, extract_bit
|
explicit |
|
default |
|
default |
|
inline |
|
default |
|
static |
|
static |
Create constant symbolic variable. i.e. term with predefined constant value
val | String representation of the value. |
slv | Pointer to the global solver. |
base | Base of the string representation. 16 by default. |
type | FFTerm, FFITerm or BVTerm |
STerm smt_terms::STerm::extract_bit | ( | const uint32_t & | bit_index | ) |
|
private |
|
private |
Reduce the integer symbolic term modulo circuit prime if needed.
Sometimes we do not want to add extra reduction constraint due to term being already reduced.
One of the cases is FFITerm type: When we have already performed some operations with it, it needs to be reduced Otherwise it doesn't
|
inline |
void smt_terms::STerm::operator!= | ( | const STerm & | other | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void smt_terms::STerm::operator< | ( | const STerm & | other | ) | const |
STerm smt_terms::STerm::operator<< | ( | const uint32_t & | n | ) | const |
|
inline |
void smt_terms::STerm::operator<= | ( | const STerm & | other | ) | const |
|
inline |
void smt_terms::STerm::operator== | ( | const STerm & | other | ) | const |
|
inline |
void smt_terms::STerm::operator> | ( | const STerm & | other | ) | const |
|
inline |
void smt_terms::STerm::operator>= | ( | const STerm & | other | ) | const |
STerm smt_terms::STerm::operator>> | ( | const uint32_t & | n | ) | const |
|
inline |
|
inline |
STerm smt_terms::STerm::truncate | ( | const uint32_t & | to_size | ) |
|
static |
|
friend |
std::unordered_map<OpType, cvc5::Kind> smt_terms::STerm::operations |