nil::crypto3::zk::snark::bacs_circuit< FieldType > Struct Template Reference

#include <bacs.hpp>

+ Collaboration diagram for nil::crypto3::zk::snark::bacs_circuit< FieldType >:

Public Types

typedef FieldType field_type
 

Public Member Functions

void add_gate (const bacs_gate< FieldType > &g)
 
void add_gate (const bacs_gate< FieldType > &g, const std::string &annotation)
 
 bacs_circuit ()
 
std::size_t depth () const
 
bacs_variable_assignment< FieldType > get_all_outputs (const bacs_primary_input< FieldType > &primary_input, const bacs_auxiliary_input< FieldType > &auxiliary_input) const
 
bacs_variable_assignment< FieldType > get_all_wires (const bacs_primary_input< FieldType > &primary_input, const bacs_auxiliary_input< FieldType > &auxiliary_input) const
 
bool is_satisfied (const bacs_primary_input< FieldType > &primary_input, const bacs_auxiliary_input< FieldType > &auxiliary_input) const
 
bool is_valid () const
 
std::size_t num_gates () const
 
std::size_t num_inputs () const
 
std::size_t num_wires () const
 
bool operator== (const bacs_circuit< FieldType > &other) const
 
std::vector< std::size_t > wire_depths () const
 

Public Attributes

std::size_t auxiliary_input_size
 
std::vector< bacs_gate< FieldType > > gates
 
std::size_t primary_input_size
 

Detailed Description

template<typename FieldType>
struct nil::crypto3::zk::snark::bacs_circuit< FieldType >

A BACS circuit is an arithmetic circuit in which every gate is a BACS gate.

Given a BACS primary input and a BACS auxiliary input, the circuit can be evaluated. If every output evaluates to zero, then the circuit is satisfied.

NOTE: The 0-th variable (i.e., "x_{0}") always represents the constant 1. Thus, the 0-th variable is not included in num_variables.

Member Typedef Documentation

◆ field_type

template<typename FieldType >
typedef FieldType nil::crypto3::zk::snark::bacs_circuit< FieldType >::field_type

Constructor & Destructor Documentation

◆ bacs_circuit()

template<typename FieldType >
nil::crypto3::zk::snark::bacs_circuit< FieldType >::bacs_circuit ( )
inline

Member Function Documentation

◆ add_gate() [1/2]

template<typename FieldType >
void nil::crypto3::zk::snark::bacs_circuit< FieldType >::add_gate ( const bacs_gate< FieldType > &  g)
inline

◆ add_gate() [2/2]

template<typename FieldType >
void nil::crypto3::zk::snark::bacs_circuit< FieldType >::add_gate ( const bacs_gate< FieldType > &  g,
const std::string &  annotation 
)
inline

◆ depth()

template<typename FieldType >
std::size_t nil::crypto3::zk::snark::bacs_circuit< FieldType >::depth ( ) const
inline

◆ get_all_outputs()

template<typename FieldType >
bacs_variable_assignment<FieldType> nil::crypto3::zk::snark::bacs_circuit< FieldType >::get_all_outputs ( const bacs_primary_input< FieldType > &  primary_input,
const bacs_auxiliary_input< FieldType > &  auxiliary_input 
) const
inline

◆ get_all_wires()

template<typename FieldType >
bacs_variable_assignment<FieldType> nil::crypto3::zk::snark::bacs_circuit< FieldType >::get_all_wires ( const bacs_primary_input< FieldType > &  primary_input,
const bacs_auxiliary_input< FieldType > &  auxiliary_input 
) const
inline

◆ is_satisfied()

template<typename FieldType >
bool nil::crypto3::zk::snark::bacs_circuit< FieldType >::is_satisfied ( const bacs_primary_input< FieldType > &  primary_input,
const bacs_auxiliary_input< FieldType > &  auxiliary_input 
) const
inline

◆ is_valid()

template<typename FieldType >
bool nil::crypto3::zk::snark::bacs_circuit< FieldType >::is_valid ( ) const
inline

The output wire of gates[i] must have index 1+num_inputs+i. (The '1+' accounts for the the index of the constant wire.)

Gates must be topologically sorted.

◆ num_gates()

template<typename FieldType >
std::size_t nil::crypto3::zk::snark::bacs_circuit< FieldType >::num_gates ( ) const
inline

◆ num_inputs()

template<typename FieldType >
std::size_t nil::crypto3::zk::snark::bacs_circuit< FieldType >::num_inputs ( ) const
inline

◆ num_wires()

template<typename FieldType >
std::size_t nil::crypto3::zk::snark::bacs_circuit< FieldType >::num_wires ( ) const
inline

◆ operator==()

template<typename FieldType >
bool nil::crypto3::zk::snark::bacs_circuit< FieldType >::operator== ( const bacs_circuit< FieldType > &  other) const
inline

◆ wire_depths()

template<typename FieldType >
std::vector<std::size_t> nil::crypto3::zk::snark::bacs_circuit< FieldType >::wire_depths ( ) const
inline

Member Data Documentation

◆ auxiliary_input_size

template<typename FieldType >
std::size_t nil::crypto3::zk::snark::bacs_circuit< FieldType >::auxiliary_input_size

◆ gates

template<typename FieldType >
std::vector<bacs_gate<FieldType> > nil::crypto3::zk::snark::bacs_circuit< FieldType >::gates

◆ primary_input_size

template<typename FieldType >
std::size_t nil::crypto3::zk::snark::bacs_circuit< FieldType >::primary_input_size

The documentation for this struct was generated from the following file: