LLZK 0.1.0
Veridise's ZK Language IR
Loading...
Searching...
No Matches
llzk::Field Class Reference

Information about the prime finite field used for the interval analysis. More...

#include <IntervalAnalysis.h>

Public Member Functions

 Field ()=delete
 
 Field (const Field &)=default
 
 Field (Field &&)=default
 
Fieldoperator= (const Field &)=default
 
llvm::APSInt prime () const
 For the prime field p, returns p.
 
llvm::APSInt half () const
 Returns p / 2.
 
llvm::APSInt felt (unsigned i) const
 Returns i as a field element.
 
llvm::APSInt zero () const
 Returns 0 at the bitwidth of the field.
 
llvm::APSInt one () const
 Returns 1 at the bitwidth of the field.
 
llvm::APSInt maxVal () const
 Returns p - 1, which is the max value possible in a prime field described by p.
 
llvm::APSInt reduce (llvm::APSInt i) const
 Returns i mod p and reduces the result into the appropriate bitwidth.
 
llvm::APSInt reduce (unsigned i) const
 
unsigned bitWidth () const
 
llvm::SMTExprRef createSymbol (llvm::SMTSolverRef solver, const char *name) const
 Create a SMT solver symbol with the current field's bitwidth.
 

Static Public Member Functions

static const FieldgetField (const char *fieldName)
 Get a Field from a given field name string.
 

Friends

bool operator== (const Field &lhs, const Field &rhs)
 

Detailed Description

Information about the prime finite field used for the interval analysis.

Note
Seem implementation of initKnownFields for supported primes.

Definition at line 43 of file IntervalAnalysis.h.

Constructor & Destructor Documentation

◆ Field() [1/3]

llzk::Field::Field ( )
delete

◆ Field() [2/3]

llzk::Field::Field ( const Field & )
default

◆ Field() [3/3]

llzk::Field::Field ( Field && )
default

Member Function Documentation

◆ bitWidth()

unsigned llzk::Field::bitWidth ( ) const
inline

Definition at line 76 of file IntervalAnalysis.h.

◆ createSymbol()

llvm::SMTExprRef llzk::Field::createSymbol ( llvm::SMTSolverRef solver,
const char * name ) const
inline

Create a SMT solver symbol with the current field's bitwidth.

Definition at line 79 of file IntervalAnalysis.h.

◆ felt()

llvm::APSInt llzk::Field::felt ( unsigned i) const
inline

Returns i as a field element.

Definition at line 61 of file IntervalAnalysis.h.

◆ getField()

const Field & llzk::Field::getField ( const char * fieldName)
static

Get a Field from a given field name string.

Parameters
fieldNameThe name of the field.

Definition at line 33 of file IntervalAnalysis.cpp.

◆ half()

llvm::APSInt llzk::Field::half ( ) const
inline

Returns p / 2.

Definition at line 58 of file IntervalAnalysis.h.

◆ maxVal()

llvm::APSInt llzk::Field::maxVal ( ) const
inline

Returns p - 1, which is the max value possible in a prime field described by p.

Definition at line 70 of file IntervalAnalysis.h.

◆ one()

llvm::APSInt llzk::Field::one ( ) const
inline

Returns 1 at the bitwidth of the field.

Definition at line 67 of file IntervalAnalysis.h.

◆ operator=()

Field & llzk::Field::operator= ( const Field & )
default

◆ prime()

llvm::APSInt llzk::Field::prime ( ) const
inline

For the prime field p, returns p.

Definition at line 55 of file IntervalAnalysis.h.

◆ reduce() [1/2]

llvm::APSInt llzk::Field::reduce ( llvm::APSInt i) const

Returns i mod p and reduces the result into the appropriate bitwidth.

Definition at line 59 of file IntervalAnalysis.cpp.

◆ reduce() [2/2]

llvm::APSInt llzk::Field::reduce ( unsigned i) const

Definition at line 68 of file IntervalAnalysis.cpp.

◆ zero()

llvm::APSInt llzk::Field::zero ( ) const
inline

Returns 0 at the bitwidth of the field.

Definition at line 64 of file IntervalAnalysis.h.

Friends And Related Symbol Documentation

◆ operator==

bool operator== ( const Field & lhs,
const Field & rhs )
friend

Definition at line 83 of file IntervalAnalysis.h.


The documentation for this class was generated from the following files: