|
LLZK 3.0.0
An open-source IR for Zero Knowledge (ZK) circuits
|
A dialect for zkexpr
The ZKExpr dialect defines types and operations for ZK Expressions from the ZK Lean project.
Addition operation between ZK Expressions.
Syntax:
Traits: AlwaysSpeculatableImplTrait, Elementwise, SameOperandsAndResultType, Scalarizable, Tensorizable, Vectorizable
Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
| Operand | Description |
|---|---|
| lhs | ZK Expressions |
| rhs | ZK Expressions |
| Result | Description |
|---|---|
| output | ZK Expressions |
Introduce ZK literal
Syntax:
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
| Operand | Description |
|---|---|
| literal | finite field element |
| Result | Description |
|---|---|
| output | ZK Expressions |
Multiplication operation between ZK Expressions.
Syntax:
Traits: AlwaysSpeculatableImplTrait, Elementwise, SameOperandsAndResultType, Scalarizable, Tensorizable, Vectorizable
Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
| Operand | Description |
|---|---|
| lhs | ZK Expressions |
| rhs | ZK Expressions |
| Result | Description |
|---|---|
| output | ZK Expressions |
Negate a ZK Expression
Syntax:
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
| Operand | Description |
|---|---|
| value | ZK Expressions |
| Result | Description |
|---|---|
| output | ZK Expressions |
Subtraction operation between ZK Expressions.
Syntax:
Traits: AlwaysSpeculatableImplTrait, Elementwise, SameOperandsAndResultType, Scalarizable, Tensorizable, Vectorizable
Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
| Operand | Description |
|---|---|
| lhs | ZK Expressions |
| rhs | ZK Expressions |
| Result | Description |
|---|---|
| output | ZK Expressions |
Lookup table parameterized by table dimensions
Syntax:
| Parameter | C++ type | Description |
|---|---|---|
| cols | int | |
| rows | int |
WitnessID
Syntax: !ZKExpr.Witnessid
ZK Expressions
Syntax: !ZKExpr.zkexpr
Dialect for ZKBuilder
The ZKBuilder dialect defines types and operations for ZK Builders from the ZK Lean project.
Allocate a witness value
Syntax:
Traits: ConstantLike
Interfaces: InferTypeOpInterface
| Result | Description |
|---|---|
| output | ZK Expressions |
Constrain two ZK Expressions to be equal
Syntax:
Interfaces: InferTypeOpInterface
| Operand | Description |
|---|---|
| lhs | ZK Expressions |
| rhs | ZK Expressions |
| Result | Description |
|---|---|
| output | State of the ZKBuilder |
Constrain R1CS in the Builder State
Syntax:
Interfaces: InferTypeOpInterface
| Operand | Description |
|---|---|
| a | ZK Expressions |
| b | ZK Expressions |
| c | ZK Expressions |
| Result | Description |
|---|---|
| output | State of the ZKBuilder |
State of the ZKBuilder
Syntax: !ZKBuilder.zkbuilderstate
A dialect for ZKLean Lean primitives
The ZKLeanLean dialect defines types and operations for Lean-facing primitives, including struct definitions, field access, and function calls.
Access member of a struct
Syntax:
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
| Attribute | MLIR Type | Description |
|---|---|---|
member_name | ::mlir::FlatSymbolRefAttr | flat symbol reference attribute |
| Operand | Description |
|---|---|
| component | ZKLean struct value type |
| Result | Description |
|---|---|
| value | ZK Expressions |
Call a Lean function
Syntax:
Represents a call to a Lean function by name with explicit argument and result types.
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
| Attribute | MLIR Type | Description |
|---|---|---|
callee | ::mlir::SymbolRefAttr | symbol reference attribute |
| Operand | Description |
|---|---|
| args | variadic of any type |
| Result | Description |
|---|---|
| results | variadic of any type |
ZKLean struct member definition
Syntax:
Traits: HasParent<::llzk::zkleanlean::StructDefOp>
Interfaces: Symbol
| Attribute | MLIR Type | Description |
|---|---|---|
sym_name | ::mlir::StringAttr | string attribute |
type | ::mlir::TypeAttr | type attribute of ZK Expressions |
ZKLean struct definition
Syntax:
Defines a ZKLean struct with named members. Only member definitions are allowed in the body region.
Traits: HasOnlyGraphRegion, HasParent<::mlir::ModuleOp>, IsolatedFromAbove, NoRegionArguments, NoTerminator, SingleBlock, SymbolTable
Interfaces: RegionKindInterface, Symbol
| Attribute | MLIR Type | Description |
|---|---|---|
sym_name | ::mlir::StringAttr | string attribute |
ZKLean struct value type
Syntax:
Type of a ZKLean struct instance. The referenced struct definition is identified by a symbol reference.
| Parameter | C++ type | Description |
|---|---|---|
| nameRef | ::mlir::SymbolRefAttr | Fully-qualified name of the struct definition. |