zkfold-base-0.1.0.0: ZkFold Symbolic compiler and zero-knowledge proof protocols
Safe HaskellSafe-Inferred
LanguageHaskell2010

ZkFold.Symbolic.Data.Combinators

Synopsis

Documentation

class Iso b a => Iso a b where Source #

A class for isomorphic types. The Iso b a context ensures that transformations in both directions are defined

Methods

from :: a -> b Source #

Instances

Instances details
(Finite (Zp p), KnownNat n) => Iso (ByteString n (Zp p)) (UInt n (Zp p)) Source # 
Instance details

Defined in ZkFold.Symbolic.Data.ByteString

Methods

from :: ByteString n (Zp p) -> UInt n (Zp p) Source #

(Arithmetic a, KnownNat n) => Iso (ByteString n (ArithmeticCircuit a)) (UInt n (ArithmeticCircuit a)) Source # 
Instance details

Defined in ZkFold.Symbolic.Data.ByteString

(Finite (Zp p), KnownNat n) => Iso (UInt n (Zp p)) (ByteString n (Zp p)) Source # 
Instance details

Defined in ZkFold.Symbolic.Data.ByteString

Methods

from :: UInt n (Zp p) -> ByteString n (Zp p) Source #

(Arithmetic a, KnownNat n) => Iso (UInt n (ArithmeticCircuit a)) (ByteString n (ArithmeticCircuit a)) Source # 
Instance details

Defined in ZkFold.Symbolic.Data.ByteString

class Extend a b where Source #

Describes types that can increase their capacity by adding zero bits to the beginning (i.e. before the higher register).

Methods

extend :: a -> b Source #

Instances

Instances details
(KnownNat n, m <= n, Finite (Zp p)) => Extend (ByteString m (Zp p)) (ByteString n (Zp p)) Source #

Only a smaller ByteString can be extended into a bigger one.

Instance details

Defined in ZkFold.Symbolic.Data.ByteString

Methods

extend :: ByteString m (Zp p) -> ByteString n (Zp p) Source #

(KnownNat m, KnownNat n, m <= n, Arithmetic a) => Extend (ByteString m (ArithmeticCircuit a)) (ByteString n (ArithmeticCircuit a)) Source # 
Instance details

Defined in ZkFold.Symbolic.Data.ByteString

(Finite (Zp p), KnownNat n, KnownNat m, n <= m) => Extend (UInt n (Zp p)) (UInt m (Zp p)) Source # 
Instance details

Defined in ZkFold.Symbolic.Data.UInt

Methods

extend :: UInt n (Zp p) -> UInt m (Zp p) Source #

(Arithmetic a, KnownNat n, KnownNat m, n <= m) => Extend (UInt n (ArithmeticCircuit a)) (UInt m (ArithmeticCircuit a)) Source # 
Instance details

Defined in ZkFold.Symbolic.Data.UInt

class Shrink a b where Source #

Describes types that can shrink their capacity by removing higher bits.

Methods

shrink :: a -> b Source #

Instances

Instances details
(Finite (Zp p), KnownNat n, KnownNat m, m <= n) => Shrink (UInt n (Zp p)) (UInt m (Zp p)) Source # 
Instance details

Defined in ZkFold.Symbolic.Data.UInt

Methods

shrink :: UInt n (Zp p) -> UInt m (Zp p) Source #

(Arithmetic a, KnownNat n, KnownNat k, k <= n) => Shrink (UInt n (ArithmeticCircuit a)) (UInt k (ArithmeticCircuit a)) Source # 
Instance details

Defined in ZkFold.Symbolic.Data.UInt

toBits :: forall a. ArithmeticCircuit a -> [ArithmeticCircuit a] -> Natural -> Natural -> forall i m. MonadBlueprint i a m => m [i] Source #

Convert an ArithmeticCircuit to bits and return their corresponding variables.

fromBits :: forall a. Natural -> Natural -> forall i m. MonadBlueprint i a m => [i] -> m [i] Source #

The inverse of toBits.

maxOverflow :: forall a n. (Finite a, KnownNat n) => Natural Source #

highRegisterSize :: forall a n. (Finite a, KnownNat n) => Natural Source #

registerSize :: forall a n. (Finite a, KnownNat n) => Natural Source #

numberOfRegisters :: forall a n. (Finite a, KnownNat n) => Natural Source #

getNatural :: forall n. KnownNat n => Natural Source #

maxBitsPerFieldElement :: forall p. Finite p => Natural Source #

The maximum number of bits a Field element can encode.

maxBitsPerRegister :: forall p n. (Finite p, KnownNat n) => Natural Source #

The maximum number of bits it makes sense to encode in a register. That is, if the field elements can encode more bits than required, choose the smaller number.

highRegisterBits :: forall p n. (Finite p, KnownNat n) => Natural Source #

The number of bits remaining for the higher register assuming that all smaller registers have the same optimal number of bits.

minNumberOfRegisters :: forall p n. (Finite p, KnownNat n) => Natural Source #

The lowest possible number of registers to encode n bits using Field elements from p assuming that each register storest the largest possible number of bits.