8#include "../bigfield/bigfield.hpp"
9#include "../circuit_builders/circuit_builders_fwd.hpp"
10#include "../field/field.hpp"
52 limbs[0].context = parent_context;
53 limbs[1].context = parent_context;
91 result.set_free_witness_tag();
100 for (
auto& limb :
limbs) {
101 limb.convert_constant_to_fixed_witness(
builder);
111 for (
auto& limb :
limbs) {
143 return limbs[0].get_context();
145 return limbs[1].get_context();
155 limbs[0].set_origin_tag(tag);
156 limbs[1].set_origin_tag(tag);
164 for (
auto& limb :
limbs) {
165 limb.set_free_witness_tag();
174 for (
auto& limb :
limbs) {
175 limb.unset_free_witness_tag();
188 BigFq bigfield_equivalent(
limbs[0],
limbs[1]);
189 const uint32_t start_idx = bigfield_equivalent.set_public();
206 return os <<
"{ " << v.
limbs[0] <<
" , " << v.
limbs[1] <<
" }";
constexpr uint256_t slice(uint64_t start, uint64_t end) const
Implements boolean logic in-circuit.
static field_t conditional_assign(const bool_t< Builder > &predicate, const field_t &lhs, const field_t &rhs)
If predicate == true then return lhs, else return rhs.
static field_t from_witness(Builder *ctx, const bb::fr &input)
goblin_field wraps x/y coordinates of bn254 group elements when using goblin
void set_free_witness_tag()
Set the free witness flag for the goblin field's tags.
goblin_field(bb::fq input)
static goblin_field reconstruct_from_public(const std::span< const field_ct, PUBLIC_INPUTS_SIZE > &limbs)
Reconstruct goblin field from its representation as limbs as stored in the public inputs.
OriginTag get_origin_tag() const
static constexpr size_t PUBLIC_INPUTS_SIZE
void assert_is_in_field()
Builder * get_context() const
std::array< field_ct, 2 > limbs
static goblin_field from_witness(Builder *ctx, bb::fq input)
static goblin_field construct_from_limbs(field_ct lolo, field_ct lohi, field_ct hilo, field_ct hihi, bool can_overflow=false)
static goblin_field zero()
static constexpr size_t NUM_LAST_LIMB_BITS
goblin_field(field_ct lo, field_ct hi)
static constexpr size_t NUM_LIMBS
void convert_constant_to_fixed_witness(Builder *builder)
goblin_field(Builder *parent_context, const uint256_t &value)
uint32_t set_public() const
Set the witness indices for the limbs of the goblin field to public.
void assert_equal(const goblin_field &other) const
void unset_free_witness_tag()
Unset the free witness flag for the goblin field's tags.
uint512_t get_value() const
static constexpr size_t NUM_LIMB_BITS
static const uint1024_t DEFAULT_MAXIMUM_REMAINDER
void set_origin_tag(const OriginTag &tag) const
static goblin_field conditional_assign(const bool_ct &predicate, const goblin_field &lhs, goblin_field &rhs)
uint512_t get_maximum_value() const
std::ostream & operator<<(std::ostream &os, uint256_t const &a)
field< Bn254FrParams > fr
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
This file contains part of the logic for the Origin Tag mechanism that tracks the use of in-circuit p...