|
barretenberg
|
Public Member Functions | |
| bool_t (const bool value=false) | |
| bool_t (Builder *parent_context) | |
| bool_t (Builder *parent_context, const bool value) | |
| bool_t (const witness_t< Builder > &value) | |
| bool_t (const bool_t &other) | |
| bool_t (bool_t &&other) | |
| bool_t & | operator= (const bool other) |
| bool_t & | operator= (const witness_t< Builder > &other) |
| bool_t & | operator= (const bool_t &other) |
| bool_t & | operator= (bool_t &&other) |
| bool_t | operator& (const bool_t &other) const |
| bool_t | operator| (const bool_t &other) const |
| bool_t | operator^ (const bool_t &other) const |
| bool_t | operator! () const |
| bool_t | operator== (const bool_t &other) const |
| bool_t | operator!= (const bool_t &other) const |
| bool_t | operator~ () const |
| bool_t | operator&& (const bool_t &other) const |
| bool_t | operator|| (const bool_t &other) const |
| bool_t | implies (const bool_t &other) const |
| bool_t | implies_both_ways (const bool_t &other) const |
| void | operator|= (const bool_t &other) |
| void | operator&= (const bool_t &other) |
| void | operator^= (const bool_t &other) |
| void | assert_equal (const bool_t &rhs, std::string const &msg="bool_t::assert_equal") const |
| void | must_imply (const bool_t &other, std::string const &msg="bool_t::must_imply") const |
| void | must_imply (const std::vector< std::pair< bool_t, std::string > > &conds) const |
| bool | get_value () const |
| bool | is_constant () const |
| bool_t | normalize () const |
| Builder * | get_context () const |
Static Public Member Functions | |
| static bool_t | conditional_assign (const bool_t< Builder > &predicate, const bool_t &lhs, const bool_t &rhs) |
Public Attributes | |
| Builder * | context = nullptr |
| bool | witness_bool = false |
| bool | witness_inverted = false |
| uint32_t | witness_index = IS_CONSTANT |
| void proof_system::plonk::stdlib::bool_t< Builder >::must_imply | ( | const bool_t< Builder > & | other, |
| std::string const & | msg = "bool_t< Builder >::must_imply" |
||
| ) | const |
(P => Q) && (P => R)
<=> (!P || Q) && (!P || R) <=> !P || (Q && R) [by distributivity of propositional logic] <=> P => (Q && R) [a.k.a. distribution of implication over conjunction]
| void proof_system::plonk::stdlib::bool_t< Builder >::must_imply | ( | const std::vector< std::pair< bool_t< Builder >, std::string > > & | conds | ) | const |
Process many implications all at once, for readablity, and as an optimization.
| conds | - each pair is a boolean condition that we want to constrain to be "implied", and an error message if it is not implied. |
Why this works: (P => Q) && (P => R) <=> (!P || Q) && (!P || R) <=> !P || (Q && R) [by distributivity of propositional logic] <=> P => (Q && R) [a.k.a. distribution of implication over conjunction]
| bool_t< Builder > proof_system::plonk::stdlib::bool_t< Builder >::operator& | ( | const bool_t< Builder > & | other | ) | const |
A bool can be represented by a witness value w and an 'inverted' flag i
A bool's value is defined via the equation: w + i - 2.i.w
| w | i | w + i - 2.i.w |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
For two bools (w_a, i_a), (w_b, i_b), the & operation is expressed as:
(w_a + i_a - 2.i_a.w_a).(w_b + i_b - 2.i_b.w_b)
This can be rearranged to:
w_a.w_b.(1 - 2.i_b - 2.i_a + 4.i_a.i_b) -> q_m coefficient