Clearmatics Libsnark  0.1
C++ library for zkSNARK proofs
Classes | Namespaces | Typedefs | Enumerations | Functions
gadget.hpp File Reference
#include <libsnark/gadgetlib2/gadgetMacros.hpp>
#include <libsnark/gadgetlib2/protoboard.hpp>
#include <libsnark/gadgetlib2/variable.hpp>
#include <vector>
Include dependency graph for gadget.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  gadgetlib2::Gadget
 
class  gadgetlib2::R1P_Gadget
 
class  gadgetlib2::BinaryAND_Gadget
 Specific case for and AND with two inputs. Field agnostic. More...
 
class  gadgetlib2::R1P_AND_Gadget
 
class  gadgetlib2::AND_Gadget
 
class  gadgetlib2::BinaryOR_Gadget
 Specific case for and OR with two inputs. Field agnostic. More...
 
class  gadgetlib2::R1P_OR_Gadget
 
class  gadgetlib2::OR_Gadget
 
class  gadgetlib2::R1P_InnerProduct_Gadget
 
class  gadgetlib2::LooseMUX_GadgetBase
 
class  gadgetlib2::R1P_LooseMUX_Gadget
 
class  gadgetlib2::LooseMUX_Gadget
 
class  gadgetlib2::R1P_CompressionPacking_Gadget
 
class  gadgetlib2::R1P_IntegerPacking_Gadget
 
class  gadgetlib2::R1P_EqualsConst_Gadget
 
class  gadgetlib2::DualWord_Gadget
 
class  gadgetlib2::DualWordArray_Gadget
 
class  gadgetlib2::Toggle_Gadget
 
class  gadgetlib2::ConditionalFlag_Gadget
 
class  gadgetlib2::LogicImplication_Gadget
 
class  gadgetlib2::R1P_Comparison_Gadget
 

Namespaces

 gadgetlib2
 

Typedefs

typedef ::std::shared_ptr< Gadget > gadgetlib2::GadgetPtr
 

Enumerations

enum  gadgetlib2::PackingMode : bool { gadgetlib2::PackingMode::PACK, gadgetlib2::PackingMode::UNPACK }
 

Functions

 gadgetlib2::CREATE_GADGET_BASE_CLASS (AND_GadgetBase)
 
 gadgetlib2::CREATE_GADGET_BASE_CLASS (OR_GadgetBase)
 
 gadgetlib2::CREATE_GADGET_BASE_CLASS (InnerProduct_GadgetBase)
 
 gadgetlib2::CREATE_GADGET_FACTORY_CLASS_3 (InnerProduct_Gadget, VariableArray, A, VariableArray, B, Variable, result)
 
 gadgetlib2::CREATE_GADGET_BASE_CLASS (CompressionPacking_GadgetBase)
 
 gadgetlib2::CREATE_GADGET_FACTORY_CLASS_3 (CompressionPacking_Gadget, VariableArray, unpacked, VariableArray, packed, PackingMode, packingMode)
 
 gadgetlib2::CREATE_GADGET_BASE_CLASS (IntegerPacking_GadgetBase)
 
 gadgetlib2::CREATE_GADGET_FACTORY_CLASS_3 (IntegerPacking_Gadget, VariableArray, unpacked, VariableArray, packed, PackingMode, packingMode)
 
 gadgetlib2::CREATE_GADGET_BASE_CLASS (EqualsConst_GadgetBase)
 
 gadgetlib2::CREATE_GADGET_FACTORY_CLASS_3 (EqualsConst_Gadget, FElem, n, LinearCombination, input, Variable, result)
 
 gadgetlib2::CREATE_GADGET_BASE_CLASS (Comparison_GadgetBase)
 
 gadgetlib2::CREATE_GADGET_FACTORY_CLASS_5 (Comparison_Gadget, size_t, wordBitSize, PackedWord, lhs, PackedWord, rhs, FlagVariable, less, FlagVariable, lessOrEqual)
 

Detailed Description

Interfaces and basic gadgets for R1P (Rank 1 prime characteristic) constraint systems.

These interfaces have been designed to allow later adding other fields or constraint structures while allowing high level design to stay put.

A gadget represents (and generates) the constraints, constraint "wiring", and witness for a logical task. This is best explained using the physical design of a printed circuit. The Protoboard is the board on which we will "solder" our circuit. The wires (implemented by Variables) can hold any element of the underlying field. Each constraint enforces a relation between wires. These can be thought of as gates.

The delegation of tasks is as follows:

Definition in file gadget.hpp.