Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- class Iso b a => Iso a b where
- from :: a -> b
- class Extend a b where
- extend :: a -> b
- class Shrink a b where
- shrink :: a -> b
- toBits :: forall a. ArithmeticCircuit a -> [ArithmeticCircuit a] -> Natural -> Natural -> forall i m. MonadBlueprint i a m => m [i]
- fromBits :: forall a. Natural -> Natural -> forall i m. MonadBlueprint i a m => [i] -> m [i]
- maxOverflow :: forall a n. (Finite a, KnownNat n) => Natural
- highRegisterSize :: forall a n. (Finite a, KnownNat n) => Natural
- registerSize :: forall a n. (Finite a, KnownNat n) => Natural
- numberOfRegisters :: forall a n. (Finite a, KnownNat n) => Natural
- log2 :: Natural -> Double
- getNatural :: forall n. KnownNat n => Natural
- maxBitsPerFieldElement :: forall p. Finite p => Natural
- maxBitsPerRegister :: forall p n. (Finite p, KnownNat n) => Natural
- highRegisterBits :: forall p n. (Finite p, KnownNat n) => Natural
- minNumberOfRegisters :: forall p n. (Finite p, KnownNat n) => Natural
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
Instances
(Finite (Zp p), KnownNat n) => Iso (ByteString n (Zp p)) (UInt n (Zp p)) Source # | |
Defined in ZkFold.Symbolic.Data.ByteString | |
(Arithmetic a, KnownNat n) => Iso (ByteString n (ArithmeticCircuit a)) (UInt n (ArithmeticCircuit a)) Source # | |
Defined in ZkFold.Symbolic.Data.ByteString from :: ByteString n (ArithmeticCircuit a) -> UInt n (ArithmeticCircuit a) Source # | |
(Finite (Zp p), KnownNat n) => Iso (UInt n (Zp p)) (ByteString n (Zp p)) Source # | |
Defined in ZkFold.Symbolic.Data.ByteString | |
(Arithmetic a, KnownNat n) => Iso (UInt n (ArithmeticCircuit a)) (ByteString n (ArithmeticCircuit a)) Source # | |
Defined in ZkFold.Symbolic.Data.ByteString from :: UInt n (ArithmeticCircuit a) -> ByteString n (ArithmeticCircuit a) Source # |
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).
Instances
(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. |
Defined in ZkFold.Symbolic.Data.ByteString 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 # | |
Defined in ZkFold.Symbolic.Data.ByteString extend :: ByteString m (ArithmeticCircuit a) -> ByteString n (ArithmeticCircuit a) Source # | |
(Finite (Zp p), KnownNat n, KnownNat m, n <= m) => 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 # | |
Defined in ZkFold.Symbolic.Data.UInt extend :: UInt n (ArithmeticCircuit a) -> UInt m (ArithmeticCircuit a) Source # |
class Shrink a b where Source #
Describes types that can shrink their capacity by removing higher bits.
Instances
(Finite (Zp p), KnownNat n, KnownNat m, m <= n) => 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 # | |
Defined in ZkFold.Symbolic.Data.UInt shrink :: UInt n (ArithmeticCircuit a) -> UInt k (ArithmeticCircuit a) Source # |
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
.
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.