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

ZkFold.Base.Algebra.Basic.Number

Synopsis

Documentation

data Natural #

Natural number

Invariant: numbers <= 0xffffffffffffffff use the NS constructor

Instances

Instances details
FromJSON Natural 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSONKey Natural 
Instance details

Defined in Data.Aeson.Types.FromJSON

ToJSON Natural 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSONKey Natural 
Instance details

Defined in Data.Aeson.Types.ToJSON

Data Natural

Since: base-4.8.0.0

Instance details

Defined in Data.Data

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Natural -> c Natural #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Natural #

toConstr :: Natural -> Constr #

dataTypeOf :: Natural -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Natural) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Natural) #

gmapT :: (forall b. Data b => b -> b) -> Natural -> Natural #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Natural -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Natural -> r #

gmapQ :: (forall d. Data d => d -> u) -> Natural -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Natural -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Natural -> m Natural #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Natural -> m Natural #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Natural -> m Natural #

Bits Natural

Since: base-4.8.0

Instance details

Defined in GHC.Bits

Enum Natural

Since: base-4.8.0.0

Instance details

Defined in GHC.Enum

Num Natural

Note that Natural's Num instance isn't a ring: no element but 0 has an additive inverse. It is a semiring though.

Since: base-4.8.0.0

Instance details

Defined in GHC.Num

Read Natural

Since: base-4.8.0.0

Instance details

Defined in GHC.Read

Integral Natural

Since: base-4.8.0.0

Instance details

Defined in GHC.Real

Real Natural

Since: base-4.8.0.0

Instance details

Defined in GHC.Real

Show Natural

Since: base-4.8.0.0

Instance details

Defined in GHC.Show

Binary Natural

Since: binary-0.7.3.0

Instance details

Defined in Data.Binary.Class

Methods

put :: Natural -> Put #

get :: Get Natural #

putList :: [Natural] -> Put #

NFData Natural

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: Natural -> () #

Eq Natural 
Instance details

Defined in GHC.Num.Natural

Methods

(==) :: Natural -> Natural -> Bool #

(/=) :: Natural -> Natural -> Bool #

Ord Natural 
Instance details

Defined in GHC.Num.Natural

Hashable Natural 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Natural -> Int #

hash :: Natural -> Int #

Pretty Natural 
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Natural -> Doc ann #

prettyList :: [Natural] -> Doc ann #

UniformRange Natural 
Instance details

Defined in System.Random.Internal

Methods

uniformRM :: StatefulGen g m => (Natural, Natural) -> g -> m Natural #

ToParamSchema Natural 
Instance details

Defined in Data.Swagger.Internal.ParamSchema

Methods

toParamSchema :: forall (t :: SwaggerKind Type). Proxy Natural -> ParamSchema t #

ToSchema Natural 
Instance details

Defined in Data.Swagger.Internal.Schema

AdditiveMonoid Natural Source # 
Instance details

Defined in ZkFold.Base.Algebra.Basic.Class

Methods

zero :: Natural Source #

AdditiveSemigroup Natural Source # 
Instance details

Defined in ZkFold.Base.Algebra.Basic.Class

Methods

(+) :: Natural -> Natural -> Natural Source #

BinaryExpansion Natural Source # 
Instance details

Defined in ZkFold.Base.Algebra.Basic.Class

Associated Types

type Bits Natural Source #

MultiplicativeMonoid Natural Source # 
Instance details

Defined in ZkFold.Base.Algebra.Basic.Class

Methods

one :: Natural Source #

MultiplicativeSemigroup Natural Source # 
Instance details

Defined in ZkFold.Base.Algebra.Basic.Class

Methods

(*) :: Natural -> Natural -> Natural Source #

SemiEuclidean Natural Source # 
Instance details

Defined in ZkFold.Base.Algebra.Basic.Class

Semiring Natural Source # 
Instance details

Defined in ZkFold.Base.Algebra.Basic.Class

TestCoercion SNat

Since: base-4.18.0.0

Instance details

Defined in GHC.TypeNats

Methods

testCoercion :: forall (a :: k) (b :: k). SNat a -> SNat b -> Maybe (Coercion a b) #

TestEquality SNat

Since: base-4.18.0.0

Instance details

Defined in GHC.TypeNats

Methods

testEquality :: forall (a :: k) (b :: k). SNat a -> SNat b -> Maybe (a :~: b) #

Exponent Rational Natural Source # 
Instance details

Defined in ZkFold.Base.Algebra.Basic.Class

Exponent BLS12_381_GT Natural Source # 
Instance details

Defined in ZkFold.Base.Algebra.EllipticCurve.BLS12_381

Exponent BN254_GT Natural Source # 
Instance details

Defined in ZkFold.Base.Algebra.EllipticCurve.BN254

Exponent Integer Natural Source # 
Instance details

Defined in ZkFold.Base.Algebra.Basic.Class

Methods

(^) :: Integer -> Natural -> Integer Source #

Exponent Natural Natural Source # 
Instance details

Defined in ZkFold.Base.Algebra.Basic.Class

Methods

(^) :: Natural -> Natural -> Natural Source #

FromConstant Natural Rational Source # 
Instance details

Defined in ZkFold.Base.Algebra.Basic.Class

FromConstant Natural Integer Source # 
Instance details

Defined in ZkFold.Base.Algebra.Basic.Class

FromConstant Natural Bool Source # 
Instance details

Defined in ZkFold.Base.Algebra.Basic.Class

Scale Natural Rational Source # 
Instance details

Defined in ZkFold.Base.Algebra.Basic.Class

Scale Natural Integer Source # 
Instance details

Defined in ZkFold.Base.Algebra.Basic.Class

Scale Natural Bool Source # 
Instance details

Defined in ZkFold.Base.Algebra.Basic.Class

Methods

scale :: Natural -> Bool -> Bool Source #

Eq Bool Natural Source # 
Instance details

Defined in ZkFold.Symbolic.Data.Eq

Lift Natural 
Instance details

Defined in Language.Haskell.TH.Syntax

Methods

lift :: Quote m => Natural -> m Exp #

liftTyped :: forall (m :: Type -> Type). Quote m => Natural -> Code m Natural #

KnownNat n => Reifies (n :: Nat) Integer 
Instance details

Defined in Data.Reflection

Methods

reflect :: proxy n -> Integer #

() :=> (Bits Natural) 
Instance details

Defined in Data.Constraint

Methods

ins :: () :- Bits Natural #

() :=> (Enum Natural) 
Instance details

Defined in Data.Constraint

Methods

ins :: () :- Enum Natural #

() :=> (Num Natural) 
Instance details

Defined in Data.Constraint

Methods

ins :: () :- Num Natural #

() :=> (Read Natural) 
Instance details

Defined in Data.Constraint

Methods

ins :: () :- Read Natural #

() :=> (Integral Natural) 
Instance details

Defined in Data.Constraint

Methods

ins :: () :- Integral Natural #

() :=> (Real Natural) 
Instance details

Defined in Data.Constraint

Methods

ins :: () :- Real Natural #

() :=> (Show Natural) 
Instance details

Defined in Data.Constraint

Methods

ins :: () :- Show Natural #

() :=> (Eq Natural) 
Instance details

Defined in Data.Constraint

Methods

ins :: () :- Eq Natural #

() :=> (Ord Natural) 
Instance details

Defined in Data.Constraint

Methods

ins :: () :- Ord Natural #

KnownNat p => FromConstant Natural (Zp p) Source # 
Instance details

Defined in ZkFold.Base.Algebra.Basic.Field

Methods

fromConstant :: Natural -> Zp p Source #

FromConstant Natural (UInt 11 'Auto c) => FromConstant Natural (UTCTime c) Source # 
Instance details

Defined in ZkFold.Symbolic.Data.UTCTime

FromConstant Natural a => FromConstant Natural (Maybe a) Source # 
Instance details

Defined in ZkFold.Base.Algebra.Basic.Class

KnownNat p => Scale Natural (Zp p) Source # 
Instance details

Defined in ZkFold.Base.Algebra.Basic.Field

Methods

scale :: Natural -> Zp p -> Zp p Source #

EllipticCurve curve => Scale Natural (Point curve) Source # 
Instance details

Defined in ZkFold.Base.Algebra.EllipticCurve.Class

Methods

scale :: Natural -> Point curve -> Point curve Source #

Scale Natural a => Scale Natural (Maybe a) Source # 
Instance details

Defined in ZkFold.Base.Algebra.Basic.Class

Methods

scale :: Natural -> Maybe a -> Maybe a Source #

(FromConstant Natural c, AdditiveMonoid c, KnownNat size) => FromConstant Natural (PolyVec c size) Source # 
Instance details

Defined in ZkFold.Base.Algebra.Polynomials.Univariate

Methods

fromConstant :: Natural -> PolyVec c size Source #

FromConstant Natural (EuclideanF a v) Source # 
Instance details

Defined in ZkFold.Symbolic.Compiler.ArithmeticCircuit.Witness

FromConstant Natural (WitnessF a v) Source # 
Instance details

Defined in ZkFold.Symbolic.Compiler.ArithmeticCircuit.Witness

FromConstant Natural a => FromConstant Natural (UVar a i) Source # 
Instance details

Defined in ZkFold.Symbolic.Compiler.ArithmeticCircuit.WitnessEstimation

Methods

fromConstant :: Natural -> UVar a i Source #

(Symbolic c, KnownNat n) => FromConstant Natural (ByteString n c) Source # 
Instance details

Defined in ZkFold.Symbolic.Data.ByteString

Scale Natural (EuclideanF a v) Source # 
Instance details

Defined in ZkFold.Symbolic.Compiler.ArithmeticCircuit.Witness

Methods

scale :: Natural -> EuclideanF a v -> EuclideanF a v Source #

Scale Natural (WitnessF a v) Source # 
Instance details

Defined in ZkFold.Symbolic.Compiler.ArithmeticCircuit.Witness

Methods

scale :: Natural -> WitnessF a v -> WitnessF a v Source #

(Semiring a, Eq a) => Scale Natural (UVar a i) Source # 
Instance details

Defined in ZkFold.Symbolic.Compiler.ArithmeticCircuit.WitnessEstimation

Methods

scale :: Natural -> UVar a i -> UVar a i Source #

(Symbolic c, KnownNat n, KnownRegisterSize r) => FromConstant Natural (UInt n r c) Source # 
Instance details

Defined in ZkFold.Symbolic.Data.UInt

Methods

fromConstant :: Natural -> UInt n r c Source #

(Symbolic c, KnownNat n, KnownRegisterSize r) => Scale Natural (UInt n r c) Source # 
Instance details

Defined in ZkFold.Symbolic.Data.UInt

Methods

scale :: Natural -> UInt n r c -> UInt n r c Source #

(Symbolic c, KnownNat n, KnownRegisterSize rs) => StrictConv Natural (UInt n rs c) Source # 
Instance details

Defined in ZkFold.Symbolic.Data.UInt

Methods

strictConv :: Natural -> UInt n rs c Source #

AdditiveGroup (MerkleHash ('Just n)) Source # 
Instance details

Defined in ZkFold.Symbolic.Compiler.ArithmeticCircuit.MerkleHash

Field (MerkleHash ('Just n)) Source # 
Instance details

Defined in ZkFold.Symbolic.Compiler.ArithmeticCircuit.MerkleHash

Finite (Zp n) => Finite (MerkleHash ('Just n)) Source # 
Instance details

Defined in ZkFold.Symbolic.Compiler.ArithmeticCircuit.MerkleHash

Associated Types

type Order (MerkleHash ('Just n)) :: Natural Source #

Ring (MerkleHash ('Just n)) Source # 
Instance details

Defined in ZkFold.Symbolic.Compiler.ArithmeticCircuit.MerkleHash

SemiEuclidean (MerkleHash ('Nothing :: Maybe Natural)) Source # 
Instance details

Defined in ZkFold.Symbolic.Compiler.ArithmeticCircuit.MerkleHash

SemiEuclidean Natural => SemiEuclidean (Maybe Natural) Source # 
Instance details

Defined in ZkFold.Base.Algebra.Basic.Class

ToConstant (MerkleHash ('Just n)) Source # 
Instance details

Defined in ZkFold.Symbolic.Compiler.ArithmeticCircuit.MerkleHash

Associated Types

type Const (MerkleHash ('Just n)) Source #

KnownNat p => Exponent (Zp p) Natural Source # 
Instance details

Defined in ZkFold.Base.Algebra.Basic.Field

Methods

(^) :: Zp p -> Natural -> Zp p Source #

(Field c, Eq c) => Exponent (Poly c) Natural Source # 
Instance details

Defined in ZkFold.Base.Algebra.Polynomials.Univariate

Methods

(^) :: Poly c -> Natural -> Poly c Source #

Exponent (MerkleHash n) Natural Source # 
Instance details

Defined in ZkFold.Symbolic.Compiler.ArithmeticCircuit.MerkleHash

Methods

(^) :: MerkleHash n -> Natural -> MerkleHash n Source #

Symbolic c => Exponent (FieldElement c) Natural Source # 
Instance details

Defined in ZkFold.Symbolic.Data.FieldElement

Exponent a Natural => Exponent (Maybe a) Natural Source # 
Instance details

Defined in ZkFold.Base.Algebra.Basic.Class

Methods

(^) :: Maybe a -> Natural -> Maybe a Source #

FromConstant Natural a => FromConstant (Maybe Natural) (Maybe a) Source # 
Instance details

Defined in ZkFold.Base.Algebra.Basic.Class

FromConstant Natural a => FromConstant (Maybe Natural) (UVar a i) Source # 
Instance details

Defined in ZkFold.Symbolic.Compiler.ArithmeticCircuit.WitnessEstimation

MultiplicativeMonoid (Ext2 f e) => Exponent (Ext2 f e) Natural Source # 
Instance details

Defined in ZkFold.Base.Algebra.Basic.Field

Methods

(^) :: Ext2 f e -> Natural -> Ext2 f e Source #

MultiplicativeMonoid (Ext3 f e) => Exponent (Ext3 f e) Natural Source # 
Instance details

Defined in ZkFold.Base.Algebra.Basic.Field

Methods

(^) :: Ext3 f e -> Natural -> Ext3 f e Source #

Monomial i j => Exponent (Mono i j) Natural Source # 
Instance details

Defined in ZkFold.Base.Algebra.Polynomials.Multivariate.Monomial

Methods

(^) :: Mono i j -> Natural -> Mono i j Source #

(Field c, KnownNat size) => Exponent (PolyVec c size) Natural Source # 
Instance details

Defined in ZkFold.Base.Algebra.Polynomials.Univariate

Methods

(^) :: PolyVec c size -> Natural -> PolyVec c size Source #

Exponent (EuclideanF a v) Natural Source # 
Instance details

Defined in ZkFold.Symbolic.Compiler.ArithmeticCircuit.Witness

Methods

(^) :: EuclideanF a v -> Natural -> EuclideanF a v Source #

Exponent (WitnessF a v) Natural Source # 
Instance details

Defined in ZkFold.Symbolic.Compiler.ArithmeticCircuit.Witness

Methods

(^) :: WitnessF a v -> Natural -> WitnessF a v Source #

MultiplicativeMonoid a => Exponent (UVar a i) Natural Source # 
Instance details

Defined in ZkFold.Symbolic.Compiler.ArithmeticCircuit.WitnessEstimation

Methods

(^) :: UVar a i -> Natural -> UVar a i Source #

(KnownNat p, Symbolic c) => Exponent (FFA p c) Natural Source # 
Instance details

Defined in ZkFold.Symbolic.Data.FFA

Methods

(^) :: FFA p c -> Natural -> FFA p c Source #

(path ~ GPositionPath con epath, When (IsLeft epath) (HideReps g h), GFieldProd path g h a b) => GPositionSum ('PathLeaf epath) (M1 C ('MetaCons con fix hs) g) (M1 C ('MetaCons con fix hs) h) a b 
Instance details

Defined in Optics.Internal.Generic

Methods

gpositionSum :: LensVL (M1 C ('MetaCons con fix hs) g x) (M1 C ('MetaCons con fix hs) h x) a b #

Polynomial c i j => Exponent (Poly c i j) Natural Source # 
Instance details

Defined in ZkFold.Base.Algebra.Polynomials.Multivariate.Polynomial

Methods

(^) :: Poly c i j -> Natural -> Poly c i j Source #

MultiplicativeMonoid (UInt n r c) => Exponent (UInt n r c) Natural Source # 
Instance details

Defined in ZkFold.Symbolic.Data.UInt

Methods

(^) :: UInt n r c -> Natural -> UInt n r c Source #

(GPositionSum path1 g1 h1 a b, GPositionSum path2 g2 h2 a b) => GPositionSum ('PathTree path1 path2) (g1 :+: g2) (h1 :+: h2) a b 
Instance details

Defined in Optics.Internal.Generic

Methods

gpositionSum :: LensVL ((g1 :+: g2) x) ((h1 :+: h2) x) a b #

type Bits Natural Source # 
Instance details

Defined in ZkFold.Base.Algebra.Basic.Class

type Compare (a :: Natural) (b :: Natural) 
Instance details

Defined in Data.Type.Ord

type Compare (a :: Natural) (b :: Natural) = CmpNat a b
type Eval (Sum ns :: Nat -> Type) 
Instance details

Defined in Fcf.Class.Foldable

type Eval (Sum ns :: Nat -> Type) = Eval (Foldr (+) 0 ns)
type Eval (Length ('[] :: [a]) :: Nat -> Type) 
Instance details

Defined in Fcf.Data.List

type Eval (Length ('[] :: [a]) :: Nat -> Type) = 0
type Eval (Length (a2 ': as) :: Nat -> Type) 
Instance details

Defined in Fcf.Data.List

type Eval (Length (a2 ': as) :: Nat -> Type) = 1 + Eval (Length as)
type Eval (a * b :: Nat -> Type) 
Instance details

Defined in Fcf.Data.Nat

type Eval (a * b :: Nat -> Type) = a * b
type Eval (a + b :: Nat -> Type) 
Instance details

Defined in Fcf.Data.Nat

type Eval (a + b :: Nat -> Type) = a + b
type Eval (a - b :: Nat -> Type) 
Instance details

Defined in Fcf.Data.Nat

type Eval (a - b :: Nat -> Type) = a - b
type Eval (a ^ b :: Nat -> Type) 
Instance details

Defined in Fcf.Data.Nat

type Eval (a ^ b :: Nat -> Type) = a ^ b
type Const (MerkleHash ('Just n)) Source # 
Instance details

Defined in ZkFold.Symbolic.Compiler.ArithmeticCircuit.MerkleHash

type Order (MerkleHash ('Just n)) Source # 
Instance details

Defined in ZkFold.Symbolic.Compiler.ArithmeticCircuit.MerkleHash

type Order (MerkleHash ('Just n)) = n
type Eval (FindIndex _p ('[] :: [a]) :: Maybe Nat -> Type) 
Instance details

Defined in Fcf.Data.List

type Eval (FindIndex _p ('[] :: [a]) :: Maybe Nat -> Type) = 'Nothing :: Maybe Nat
type Eval (FindIndex p (a2 ': as) :: Maybe Nat -> Type) 
Instance details

Defined in Fcf.Data.List

type Eval (FindIndex p (a2 ': as) :: Maybe Nat -> Type) = Eval (If (Eval (p a2)) (Pure ('Just 0)) ((Map ((+) 1) :: Maybe Nat -> Maybe Nat -> Type) =<< FindIndex p as))
type Eval (NumIter a s :: Maybe (k, Nat) -> Type) 
Instance details

Defined in Fcf.Data.List

type Eval (NumIter a s :: Maybe (k, Nat) -> Type) = If (Eval (s > 0)) ('Just '(a, s - 1)) ('Nothing :: Maybe (k, Natural))

class KnownNat (n :: Nat) #

This class gives the integer associated with a type-level natural. There are instances of the class for every concrete literal: 0, 1, 2, etc.

Since: base-4.7.0.0

Minimal complete definition

natSing

type family KnownPrime p where ... Source #

Equations

KnownPrime p = If (IsPrime p) (() :: Constraint) (TypeError (NotPrimeError p)) 

type family IsPrime p where ... Source #

Equations

IsPrime 0 = 'False 
IsPrime 1 = 'False 
IsPrime 2 = 'True 
IsPrime 3 = 'True 
IsPrime n = NotDividesFromTo n 2 (AtLeastSqrt n) 

type family Log2 (a :: Natural) :: Natural where ... #

Log base 2 (round down) of natural numbers. Log 0 is undefined (i.e., it cannot be reduced).

Since: base-4.11.0.0

type family Mod (a :: Natural) (b :: Natural) :: Natural where ... infixl 7 #

Modulus of natural numbers. Mod x 0 is undefined (i.e., it cannot be reduced).

Since: base-4.11.0.0

type family Div (a :: Natural) (b :: Natural) :: Natural where ... infixl 7 #

Division (round down) of natural numbers. Div x 0 is undefined (i.e., it cannot be reduced).

Since: base-4.11.0.0

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

type (<=) (x :: t) (y :: t) = Assert (x <=? y) (LeErrMsg x y :: Constraint) infix 4 #

Comparison (<=) of comparable types, as a constraint.

Since: base-4.16.0.0

type family (a :: Natural) * (b :: Natural) :: Natural where ... infixl 7 #

Multiplication of type-level naturals.

Since: base-4.7.0.0

type family (a :: Natural) + (b :: Natural) :: Natural where ... infixl 6 #

Addition of type-level naturals.

Since: base-4.7.0.0

type family (a :: Natural) - (b :: Natural) :: Natural where ... infixl 6 #

Subtraction of type-level naturals.

Since: base-4.7.0.0

type family (a :: Natural) ^ (b :: Natural) :: Natural where ... infixr 8 #

Exponentiation of type-level naturals.

Since: base-4.7.0.0