extractor

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2023 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayInit

func ArrayInit(f schema.Field, v reflect.Value, op Operand) error

func ArrayToSlice

func ArrayToSlice(v reflect.Value) []frontend.Variable

func CircuitInit

func CircuitInit(class any, schema *schema.Schema) error

func CircuitToLean

func CircuitToLean(circuit abstractor.Circuit, field ecc.ID) (string, error)

func ExportCircuit

func ExportCircuit(circuit ExCircuit) string

func ExportFooter

func ExportFooter(name string) string

func ExportGadget

func ExportGadget(gadget ExGadget) string

func ExportGadgets added in v1.1.0

func ExportGadgets(exGadgets []ExGadget) string

func ExportPrelude

func ExportPrelude(name string, order *big.Int) string

func GadgetToLean added in v1.1.0

func GadgetToLean(circuit abstractor.GadgetDefinition, field ecc.ID) (string, error)

func GetSchema

func GetSchema(circuit any) (*schema.Schema, error)

Cloned version of NewSchema without constraints

func KindOfField

func KindOfField(a any, s string) reflect.Kind

Types

type App

type App struct {
	Op   Op
	Args []Operand
}

type Code

type Code struct {
	Gates []App
}

type CodeExtractor

type CodeExtractor struct {
	Code    []App
	Gadgets []ExGadget
	Field   ecc.ID
}

func (*CodeExtractor) Add

func (*CodeExtractor) AddApp

func (ce *CodeExtractor) AddApp(op Op, args ...frontend.Variable) Operand

func (*CodeExtractor) And

func (*CodeExtractor) AssertIsBoolean

func (ce *CodeExtractor) AssertIsBoolean(i1 frontend.Variable)

func (*CodeExtractor) AssertIsDifferent

func (ce *CodeExtractor) AssertIsDifferent(i1, i2 frontend.Variable)

func (*CodeExtractor) AssertIsEqual

func (ce *CodeExtractor) AssertIsEqual(i1, i2 frontend.Variable)

func (*CodeExtractor) AssertIsLessOrEqual

func (ce *CodeExtractor) AssertIsLessOrEqual(v frontend.Variable, bound frontend.Variable)

func (*CodeExtractor) Call

func (*CodeExtractor) Cmp

func (*CodeExtractor) Compiler

func (ce *CodeExtractor) Compiler() frontend.Compiler

func (*CodeExtractor) ConstantValue

func (ce *CodeExtractor) ConstantValue(v frontend.Variable) (*big.Int, bool)

func (*CodeExtractor) DefineGadget

func (ce *CodeExtractor) DefineGadget(gadget abstractor.GadgetDefinition) abstractor.Gadget

func (*CodeExtractor) Div

func (*CodeExtractor) DivUnchecked

func (ce *CodeExtractor) DivUnchecked(i1, i2 frontend.Variable) frontend.Variable

func (*CodeExtractor) FromBinary

func (ce *CodeExtractor) FromBinary(b ...frontend.Variable) frontend.Variable

func (*CodeExtractor) Inverse

func (*CodeExtractor) IsZero

func (*CodeExtractor) Lookup2

func (ce *CodeExtractor) Lookup2(b0, b1 frontend.Variable, i0, i1, i2, i3 frontend.Variable) frontend.Variable

func (*CodeExtractor) Mul

func (*CodeExtractor) MulAcc

func (ce *CodeExtractor) MulAcc(a, b, c frontend.Variable) frontend.Variable

func (*CodeExtractor) Neg

func (*CodeExtractor) NewHint

func (ce *CodeExtractor) NewHint(f hint.Function, nbOutputs int, inputs ...frontend.Variable) ([]frontend.Variable, error)

func (*CodeExtractor) Or

func (*CodeExtractor) Println

func (ce *CodeExtractor) Println(a ...frontend.Variable)

func (*CodeExtractor) Select

func (*CodeExtractor) Sub

func (*CodeExtractor) ToBinary

func (ce *CodeExtractor) ToBinary(i1 frontend.Variable, n ...int) []frontend.Variable

func (*CodeExtractor) Xor

type Const

type Const struct {
	Value *big.Int
}

type ExArg

type ExArg struct {
	Name string
	Kind reflect.Kind
	Type ExArgType
}

func GetExArgs

func GetExArgs(circuit any, fields []schema.Field) []ExArg

type ExArgType

type ExArgType struct {
	Size int
	Type *ExArgType
}

func CircuitArgs

func CircuitArgs(field schema.Field) ExArgType

type ExCircuit

type ExCircuit struct {
	Inputs  []ExArg
	Gadgets []ExGadget
	Code    []App
	Field   ecc.ID
	Name    string
}

type ExGadget

type ExGadget struct {
	Name      string
	Arity     int
	Code      []App
	Outputs   []Operand
	Extractor *CodeExtractor
	Fields    []schema.Field
	Args      []ExArg
}

func (*ExGadget) Call

type Gate

type Gate struct {
	Index int
}

type Input

type Input struct {
	Index int
}

Input is used to save the position of the argument in the list of arguments of the circuit function.

type Op

type Op interface {
	// contains filtered or unexported methods
}

type OpKind

type OpKind int
const (
	OpAdd OpKind = iota
	OpMulAcc
	OpNegative
	OpSub
	OpMul
	OpDiv
	OpDivUnchecked
	OpInverse
	OpToBinary
	OpFromBinary
	OpXor
	OpOr
	OpAnd
	OpSelect
	OpLookup
	OpIsZero
	OpCmp
	OpAssertEq
	OpAssertNotEq
	OpAssertIsBool
	OpAssertLessEqual
)

type Operand

type Operand interface {
	// contains filtered or unexported methods
}

type Proj

type Proj struct {
	Operand Operand
	Index   int
}

Index is the index to be accessed in the array Operand[Index]

type ProjArray

type ProjArray struct {
	Proj []Operand
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL