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

ZkFold.Symbolic.Compiler.ArithmeticCircuit.Combinators

Synopsis

Documentation

boolCheckC :: Arithmetic a => ArithmeticCircuit a -> ArithmeticCircuit a Source #

boolCheckC r computes r (r - 1) in one PLONK constraint.

expansion :: MonadBlueprint i a m => Natural -> i -> m [i] Source #

expansion n k computes a binary expansion of k if it fits in n bits.

splitExpansion :: MonadBlueprint i a m => Natural -> Natural -> i -> m (i, i) Source #

splitExpansion n1 n2 k computes two values (l, h) such that k = 2^n1 h + l, l fits in n1 bits and h fits in n2 bits (if such values exist).

horner :: MonadBlueprint i a m => [i] -> m i Source #

horner [b0,...,bn] computes the sum b0 + 2 b1 + ... + 2^n bn using Horner's scheme.