Permalink
Browse files

Fix typos

  • Loading branch information...
rex4539 committed Apr 9, 2018
1 parent 634dd45 commit 00654744013883c88cdf5c1cf42b9e4cbd121c45
Showing with 53 additions and 53 deletions.
  1. +2 −2 README.md
  2. +1 −1 libsnark/common/data_structures/integer_permutation.hpp
  3. +1 −1 libsnark/common/data_structures/merkle_tree.tcc
  4. +1 −1 libsnark/common/data_structures/sparse_vector.hpp
  5. +1 −1 libsnark/common/libsnark_serialization.hpp
  6. +1 −1 libsnark/common/routing_algorithms/as_waksman_routing_algorithm.cpp
  7. +1 −1 libsnark/common/routing_algorithms/benes_routing_algorithm.cpp
  8. +1 −1 libsnark/gadgetlib1/gadgets/cpu_checkers/fooram/components/bar_gadget.tcc
  9. +1 −1 libsnark/gadgetlib1/gadgets/hashes/knapsack/knapsack_gadget.hpp
  10. +1 −1 libsnark/gadgetlib2/adapters.cpp
  11. +6 −6 libsnark/gadgetlib2/examples/tutorial.cpp
  12. +2 −2 libsnark/gadgetlib2/gadget.cpp
  13. +2 −2 libsnark/gadgetlib2/gadget.hpp
  14. +4 −4 libsnark/gadgetlib2/integration.cpp
  15. +1 −1 libsnark/gadgetlib2/protoboard.cpp
  16. +6 −6 libsnark/gadgetlib2/variable.hpp
  17. +1 −1 libsnark/reductions/r1cs_to_qap/r1cs_to_qap.hpp
  18. +1 −1 libsnark/reductions/r1cs_to_sap/r1cs_to_sap.tcc
  19. +2 −2 libsnark/reductions/ram_to_r1cs/gadgets/ram_universal_gadget.hpp
  20. +1 −1 libsnark/reductions/ram_to_r1cs/gadgets/ram_universal_gadget.tcc
  21. +1 −1 libsnark/reductions/uscs_to_ssp/uscs_to_ssp.hpp
  22. +1 −1 libsnark/relations/circuit_satisfaction_problems/bacs/bacs.hpp
  23. +1 −1 libsnark/relations/circuit_satisfaction_problems/bacs/bacs.tcc
  24. +1 −1 libsnark/relations/circuit_satisfaction_problems/tbcs/tbcs.cpp
  25. +1 −1 libsnark/relations/circuit_satisfaction_problems/tbcs/tbcs.hpp
  26. +1 −1 libsnark/relations/ram_computations/memory/memory_interface.hpp
  27. +1 −1 libsnark/relations/variable.hpp
  28. +1 −1 libsnark/zk_proof_systems/pcd/r1cs_pcd/r1cs_mp_ppzkpcd/mp_pcd_circuits.tcc
  29. +1 −1 libsnark/zk_proof_systems/ppzkadsnark/r1cs_ppzkadsnark/r1cs_ppzkadsnark.hpp
  30. +1 −1 libsnark/zk_proof_systems/ppzkadsnark/r1cs_ppzkadsnark/r1cs_ppzkadsnark.tcc
  31. +1 −1 libsnark/zk_proof_systems/ppzksnark/r1cs_gg_ppzksnark/r1cs_gg_ppzksnark.hpp
  32. +1 −1 libsnark/zk_proof_systems/ppzksnark/r1cs_ppzksnark/r1cs_ppzksnark.hpp
  33. +1 −1 libsnark/zk_proof_systems/ppzksnark/r1cs_se_ppzksnark/r1cs_se_ppzksnark.hpp
  34. +1 −1 libsnark/zk_proof_systems/ppzksnark/uscs_ppzksnark/uscs_ppzksnark.hpp
  35. +2 −2 libsnark/zk_proof_systems/zksnark/ram_zksnark/ram_compliance_predicate.hpp
@@ -76,7 +76,7 @@ The libsnark library currently provides a C++ implementation of:
contribution of \[DFGK14]
4. A preprocessing SNARK for a language of Boolean circuits, "TBCS"
(_Two-input Boolean Circuit Satisfiability_). Internally, it reduces to USCS.
This is much more efficient than going through R1CS.
This is much more efficient than going through R1CS.
5. A simulation-extractable preprocessing SNARK for R1CS.
This construction uses the approach described in \[GM17]. For arithmetic
circuits, it is slower than the \[BCTV14a] approach, but produces shorter
@@ -298,7 +298,7 @@ This will install `libsnark.a` into `/install/path/lib`; so your application sho

In addition, unless you use `WITH_SUPERCOP=OFF`, `libsnark_adsnark.a` will be installed and should be linked in using `-lsnark_adsnark`.

When you use compile you application against `libsnark`, you must have the same conditional defines (`#define FOO` or `g++ -DFOO`) as when you compiled `libsnark`, due to the use of templates. One way to figure out the correct conditional defines is to look at `build/libsnark/CMakeFiles/snark.dir/flags.make` after running `cmake`. ([Issue #21](https://github.com/scipr-lab/libsnark/issues/21))
When you use compile your application against `libsnark`, you must have the same conditional defines (`#define FOO` or `g++ -DFOO`) as when you compiled `libsnark`, due to the use of templates. One way to figure out the correct conditional defines is to look at `build/libsnark/CMakeFiles/snark.dir/flags.make` after running `cmake`. ([Issue #21](https://github.com/scipr-lab/libsnark/issues/21))

### Building on Windows using Cygwin

@@ -41,7 +41,7 @@ class integer_permutation {
integer_permutation slice(const size_t slice_min_element, const size_t slice_max_element) const;

/* Similarly to std::next_permutation this transforms the current
integer permutation into the next lexicographically oredered
integer permutation into the next lexicographically ordered
permutation; returns false if the last permutation was reached and
this is now the identity permutation on [min_element .. max_element] */
bool next_permutation();
@@ -138,7 +138,7 @@ merkle_tree<HashT>::merkle_tree(const size_t depth,
}
else
{
// typical case: this is the left child of the parent and adjecent to it there is a right child
// typical case: this is the left child of the parent and adjacent to it there is a right child
hashes[(idx-1)/2] = two_to_one_CRH<HashT>(hash, std::next(it)->second);
++it;
}
@@ -57,7 +57,7 @@ struct sparse_vector {
size_t size() const; // return the number of indices (representing the number of non-zero entries)
size_t size_in_bits() const; // return the number bits needed to store the sparse vector

/* return a pair consisting of the accumulated value and the sparse vector of non-accumuated values */
/* return a pair consisting of the accumulated value and the sparse vector of non-accumulated values */
template<typename FieldT>
std::pair<T, sparse_vector<T> > accumulate(const typename std::vector<FieldT>::const_iterator &it_begin,
const typename std::vector<FieldT>::const_iterator &it_end,
@@ -1,7 +1,7 @@
/** @file
*****************************************************************************
Temporary import serialization operators from libff in libsnark namspace;
Temporary import serialization operators from libff in libsnark namespace;
*****************************************************************************
* @author This file is part of libsnark, developed by SCIPR Lab
@@ -147,7 +147,7 @@ void construct_as_waksman_inner(const size_t left,
/**
* Odd special case:
* the last wire is not connected to any switch,
* and the the wire is mereley routed "straight".
* and the wire is merely routed "straight".
*/
neighbors[left][hi].first = neighbors[left][hi].second = hi;
neighbors[right][hi].first = neighbors[right][hi].second = rhs_dests[hi-lo];
@@ -265,7 +265,7 @@ benes_routing get_benes_routing(const integer_permutation &permutation)
return routing;
}

/* auxuliary function that is used in valid_benes_routing below */
/* auxiliary function that is used in valid_benes_routing below */
template<typename T>
std::vector<std::vector<T> > route_by_benes(const benes_routing &routing, const std::vector<T> &start)
{
@@ -1,7 +1,7 @@
/** @file
*****************************************************************************
Implementation of interfaces for an auxiliarry gadget for the FOORAM CPU.
Implementation of interfaces for an auxiliary gadget for the FOORAM CPU.
See bar_gadget.hpp .
@@ -18,7 +18,7 @@
In both cases, a method ("sample_randomness") allows to sample M.
The parameter d (the dimension) is fixed at compile time in the struct
knapsack_dimension below. The parameter m (the input lenght) can be chosen
knapsack_dimension below. The parameter m (the input length) can be chosen
at run time (in either gadget).
@@ -67,7 +67,7 @@ This limitation is to prevent a logic bug that may occur if the variables used a
The indices are assigned on the Variable constructor, using the global variable nextFreeIndex. Thus, creating two protoboards in the same program may cause
unexpected behavior when converting.
Moreover, the bug will create more variables than needed in the converted system, e.g. if variables 0,1,3,4 were used in the gadgetlib2
generated system, than the conversion will create a new r1cs system with variables 0,1,2,3,4 and assign variable 2 the value zero
generated system, then the conversion will create a new r1cs system with variables 0,1,2,3,4 and assign variable 2 the value zero
(when converting the assignment).
Everything should be fixed soon.
If you are sure you know what you are doing, you can comment out the ASSERT line.
@@ -75,7 +75,7 @@ TEST(Examples, ProtoboardUsage) {
// Notice the protoboard stores the assignment values.
pb->val(input[0]) = pb->val(input[1]) = pb->val(input[2]) = pb->val(output) = 42;
EXPECT_FALSE(pb->isSatisfied());
// The constraint system is not satisfied. Now lets try values which satisfy the two equations
// The constraint system is not satisfied. Now let's try values which satisfy the two equations
// above:
pb->val(input[0]) = 1;
pb->val(input[1]) = pb->val(output) = 42; // input[1] - output == 0
@@ -203,20 +203,20 @@ TEST(Examples, NAND_Gadget) {
// if we try to evaluate the circuit now, an exception will be thrown, because we will
// be attempting to evaluate unassigned variables.
EXPECT_ANY_THROW(pb->isSatisfied());
// so lets assign the input variables for NAND and try again after creating the witness
// so let's assign the input variables for NAND and try again after creating the witness
for (const auto& input : inputs) {
pb->val(input) = 1;
}
nandGadget->generateWitness();
EXPECT_TRUE(pb->isSatisfied());
EXPECT_TRUE(pb->val(output) == 0);
// now lets try to ruin something and see what happens
// now let's try to ruin something and see what happens
pb->val(inputs[2]) = 0;
EXPECT_FALSE(pb->isSatisfied());
// now let try to cheat. If we hadn't enforced booleanity, this would have worked!
// now let's try to cheat. If we hadn't enforced booleanity, this would have worked!
pb->val(inputs[1]) = 2;
EXPECT_FALSE(pb->isSatisfied());
// now lets reset inputs[1] to a valid value
// now let's reset inputs[1] to a valid value
pb->val(inputs[1]) = 1;
// before, we set both the inputs and the output. Notice the output is still set to '0'
EXPECT_TRUE(pb->val(output) == 0);
@@ -339,7 +339,7 @@ TEST(Examples, HashDifficultyEnforcer_Gadget) {

/*
In this example we will construct a gadget which builds a circuit for proof (witness) and
validation (constraints) that a bitcoin transaction's sum of inputs equals the the sum of
validation (constraints) that a bitcoin transaction's sum of inputs equals the sum of
outputs + miners fee. Construction of the proof will include finding the miners'
fee. This fee can be thought of as an output of the circuit.
@@ -484,7 +484,7 @@ GadgetPtr LooseMUX_Gadget::create(ProtoboardPtr pb,
Compression Packing gadgets have two modes, which differ in the way the witness and constraints
are created. In PACK mode gerateWitness() will take the bits and create a packed element (or
number of elements) while generateConstraints() will not enforce that bits are indeed Boolean.
In UNPACK mode generateWitness() will take the packed repreentation and unpack it to bits while
In UNPACK mode generateWitness() will take the packed representation and unpack it to bits while
generateConstraints will in addition enforce that unpacked bits are indeed Boolean.
*/

@@ -562,7 +562,7 @@ void R1P_CompressionPacking_Gadget::generateWitness() {
Arithmetic Packing gadgets have two modes, which differ in the way the witness and constraints
are created. In PACK mode gerateWitness() will take the bits and create a packed element (or
number of elements) while generateConstraints() will not enforce that bits are indeed Boolean.
In UNPACK mode generateWitness() will take the packed repreentation and unpack it to bits while
In UNPACK mode generateWitness() will take the packed representation and unpack it to bits while
generateConstraints will in addition enforce that unpacked bits are indeed Boolean.
*/

@@ -57,7 +57,7 @@ namespace gadgetlib2 {
Gadget hierarchy:
(Here and elsewhere: R1P = Rank 1 constraints over a prime-characteristic field.)
Gadgets have a somewhat cumbursome class heirarchy, for the sake of clean gadget construction.
Gadgets have a somewhat cumbersome class hierarchy, for the sake of clean gadget construction.
(1) A field agnostic, concrete (as opposed to interface) gadget will derive from Gadget. For
instance NAND needs only AND and NOT and does not care about the field, thus it derives from
Gadget.
@@ -72,7 +72,7 @@ namespace gadgetlib2 {
(4) These field specific gadgets will have a factory class with static method create, such as
AND_Gadget::create(...) in order to agnostically create this gadget for use by a field
agnostic gadget.
(5) Concrete field dependant gadgets derive via multiple inheritance from two interfaces.
(5) Concrete field dependent gadgets derive via multiple inheritance from two interfaces.
e.g. R1P_AND_Gadget derives from both AND_Gadget and R1P_Gadget. This was done to allow usage
of AND_Gadget's field agnostic create() method and R1P_Gadget's field specific val() method.
*/
@@ -39,8 +39,8 @@ r1cs_constraint_system<libff::Fr<libff::default_ec_pp> > get_constraint_system_f
convert_gadgetlib2_linear_combination(std::get<1>(constr)),
convert_gadgetlib2_linear_combination(std::get<2>(constr))));
}
//The numbers of variables is the highest index created.
//TODO: If there are multiple protoboard, or variables not assigned to a protoboard, then getNextFreeIndex() is *not* the number of variables! See also in get_variable_assignment_from_gadgetlib2.
//The number of variables is the highest index created.
//TODO: If there are multiple protoboards, or variables not assigned to a protoboard, then getNextFreeIndex() is *not* the number of variables! See also in get_variable_assignment_from_gadgetlib2.
const size_t num_variables = GLA::getNextFreeIndex();
result.primary_input_size = pb.numInputs();
result.auxiliary_input_size = num_variables - pb.numInputs();
@@ -52,8 +52,8 @@ r1cs_variable_assignment<libff::Fr<libff::default_ec_pp> > get_variable_assignme
typedef libff::Fr<libff::default_ec_pp> FieldT;
typedef gadgetlib2::GadgetLibAdapter GLA;

//The numbers of variables is the highest index created. This is also the required size for the assignment vector.
//TODO: If there are multiple protoboard, or variables not assigned to a protoboard, then getNextFreeIndex() is *not* the number of variables! See also in get_constraint_system_from_gadgetlib2.
//The number of variables is the highest index created. This is also the required size for the assignment vector.
//TODO: If there are multiple protoboards, or variables not assigned to a protoboard, then getNextFreeIndex() is *not* the number of variables! See also in get_constraint_system_from_gadgetlib2.
const size_t num_vars = GLA::getNextFreeIndex();
const GLA adapter;
r1cs_variable_assignment<FieldT> result(num_vars, FieldT::zero());
@@ -43,7 +43,7 @@ FElem Protoboard::val(const LinearCombination& lc) const {

void Protoboard::setValuesAsBitArray(const VariableArray& varArray, const size_t srcValue) {
GADGETLIB_ASSERT(varArray.size() >= Log2ceil(srcValue),
GADGETLIB2_FMT("Variable array of size %u to small to hold value %u. Array must be of size "
GADGETLIB2_FMT("Variable array of size %u too small to hold value %u. Array must be of size "
"at least %u", varArray.size(), srcValue, Log2ceil(srcValue)));
size_t i = 0;
for(i = 0; i < Log2ceil(srcValue); ++i) {
@@ -213,8 +213,8 @@ class FConst : public FElemInterface {
/*************************************************************************************************/
/*************************************************************************************************/
/**
Holds elements of a prime characteristic field. Currently implemented using the gmp (linux) and
mpir (windows) libraries.
Holds elements of a prime characteristic field. Currently implemented using the gmp (Linux) and
mpir (Windows) libraries.
*/
class R1P_Elem : public FElemInterface {
private:
@@ -349,15 +349,15 @@ class VariableArray : public VariableArrayContents {
/*************************************************************************************************/
/*************************************************************************************************/

typedef Variable FlagVariable; ///< Holds variable whos purpose is to be populated with a boolean
typedef Variable FlagVariable; ///< Holds variable whose purpose is to be populated with a boolean
///< value, Field(0) or Field(1)
typedef VariableArray FlagVariableArray;
typedef Variable PackedWord; ///< Represents a packed word that can fit in a field element.
///< For a word representing an unsigned integer for instance this
///< means we require (int < fieldSize)
typedef VariableArray PackedWordArray;

/// Holds variables whos purpose is to be populated with the unpacked form of some word, bit by bit
/// Holds variables whose purpose is to be populated with the unpacked form of some word, bit by bit
class UnpackedWord : public VariableArray {
public:
UnpackedWord() : VariableArray() {}
@@ -366,7 +366,7 @@ class UnpackedWord : public VariableArray {

typedef ::std::vector<UnpackedWord> UnpackedWordArray;

/// Holds variables whos purpose is to be populated with the packed form of some word.
/// Holds variables whose purpose is to be populated with the packed form of some word.
/// word representation can be larger than a single field element in small enough fields
class MultiPackedWord : public VariableArray {
private:
@@ -400,7 +400,7 @@ class DualWord {

class DualWordArray {
private:
// kept as 2 seperate arrays because the more common usecase will be to request one of these,
// kept as 2 separate arrays because the more common usecase will be to request one of these,
// and not dereference a specific DualWord
MultiPackedWordArray multipackedContents_;
UnpackedWordArray unpackedContents_;
@@ -4,7 +4,7 @@
Declaration of interfaces for a R1CS-to-QAP reduction, that is, constructing
a QAP ("Quadratic Arithmetic Program") from a R1CS ("Rank-1 Constraint System").
QAPs are defined in \[GGPR13], and construced for R1CS also in \[GGPR13].
QAPs are defined in \[GGPR13], and constructed for R1CS also in \[GGPR13].
The implementation of the reduction follows, extends, and optimizes
the efficient approach described in Appendix E of \[BCGTV13].
@@ -314,7 +314,7 @@ sap_witness<FieldT> r1cs_to_sap_witness_map(const r1cs_constraint_system<FieldT>
*
* note: below, we pass full_variable_assignment into the .evaluate()
* method of the R1CS constraints. however, these extra variables shouldn't
* be a problem, because .evaluate() only accessess the variables that are
* be a problem, because .evaluate() only accesses the variables that are
* actually used in the constraint.
*/
for (size_t i = 0; i < cs.num_constraints(); ++i)
@@ -7,14 +7,14 @@
size bound, and time bound), the "RAM universal gadget" checks the correct
execution of any RAM computation that fits the bounds.
The implementaiton follows, extends, and optimizes the approach described
The implementation follows, extends, and optimizes the approach described
in \[BCTV14] (itself building on \[BCGTV13]). The code is parameterized by
the template parameter ramT, in order to support any RAM that fits certain
abstract interfaces.
Roughly, the gadget has three main components:
- For each time step, a copy of a *execution checker* (which is the RAM CPU checker).
- For each time step, a copy of a *memory checker* (which verifies memory consitency
- For each time step, a copy of a *memory checker* (which verifies memory consistency
between two 'memory lines' that are adjacent in a memory sort).
- A single *routing network* (specifically, an arbitrary-size Waksman network),
which is used check that memory accesses are permutated according to some permutation.
@@ -54,7 +54,7 @@ ram_universal_gadget<ramT>::ram_universal_gadget(ram_protoboard<ramT> &pb,
libff::leave_block("Allocate boot lines");

libff::enter_block("Allocate instruction fetch and execution lines");
load_instruction_lines.reserve(time_bound+1); /* the last line is NOT a memory line, but here just for uniform coding (i.e. the (unusued) result of next PC) */
load_instruction_lines.reserve(time_bound+1); /* the last line is NOT a memory line, but here just for uniform coding (i.e. the (unused) result of next PC) */
for (size_t i = 0; i < time_bound; ++i)
{
load_instruction_lines.emplace_back(memory_line_variable_gadget<ramT>(pb, timestamp_size, pb.ap, FMT(annotation_prefix, " load_instruction_lines_%zu", i)));
@@ -4,7 +4,7 @@
Declaration of interfaces for a USCS-to-SSP reduction, that is, constructing
a SSP ("Square Span Program") from a USCS ("boolean circuit with 2-input gates").
SSPs are defined in \[DFGK14], and construced for USCS also in \[DFGK14].
SSPs are defined in \[DFGK14], and constructed for USCS also in \[DFGK14].
The implementation of the reduction adapts to \[DFGK14], extends, and optimizes
the efficient QAP-based approach described in Appendix E of \[BCGTV13].
@@ -2,7 +2,7 @@
*****************************************************************************
Declaration of interfaces for:
- a BACS variable assigment,
- a BACS variable assignment,
- a BACS gate,
- a BACS primary input,
- a BACS auxiliary input,
@@ -2,7 +2,7 @@
*****************************************************************************
Implementation of interfaces for:
- a BACS variable assigment,
- a BACS variable assignment,
- a BACS gate,
- a BACS primary input,
- a BACS auxiliary input,
Oops, something went wrong.

0 comments on commit 0065474

Please sign in to comment.