SF4ZFNFOVLPGZN4AZPLZNDTE3WHP6CTZEAGNW5A46PCOFAWCNOYQC
{-# language
ConstraintKinds,
DataKinds,
DeriveDataTypeable,
DeriveGeneric,
DeriveTraversable,
GADTs,
ImportQualifiedPost,
LambdaCase,
NoImplicitPrelude,
RankNTypes,
Safe,
StandaloneDeriving
#-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE Safe #-}
{-# LANGUAGE StandaloneDeriving #-}
newtype OrderedBoundedList n a =
OrderedBoundedList { unorderedBoundedList :: BoundedList n a }
deriving (Foldable)
newtype OrderedBoundedList n a = OrderedBoundedList
{ unorderedBoundedList :: BoundedList n a
}
deriving stock (Foldable)
data MultivariatePolynomial f maximumDegree c vars
-- |
--
-- __NB__: We could keep @vars@ universal here, but we'd then have to wrap
-- it in another @data@ declaration in order to use it in other
-- structures. We shuld re-evaluate this later.
= MultivariatePolynomial
data MultivariatePolynomial f maximumDegree c vars = MultivariatePolynomial
evaluateMultivariatePolynomial
:: (Field f, Nat.SNatI r)
=> MultivariatePolynomial f maximumDegree c vars
-> Circuit f c r maximumDegree
-> Fin r
-> f
evaluateMultivariatePolynomial ::
(Field f, Nat.SNatI r) =>
MultivariatePolynomial f maximumDegree c vars ->
Circuit f c r maximumDegree ->
Fin r ->
f
addEqualityConstraint
:: (Fin c, Fin r)
-> (Fin c, Fin r)
-> Circuit f c r mcd
-> Either (NonEmpty (EqualityConstraintFailure c r)) (Circuit f c r mcd)
addEqualityConstraint ::
(Fin c, Fin r) ->
(Fin c, Fin r) ->
Circuit f c r mcd ->
Either (NonEmpty (EqualityConstraintFailure c r)) (Circuit f c r mcd)
( pure $ circuit {
equalityConstraints' =
Set.insert (orderedPair a b) (equalityConstraints' circuit)
}
( pure $
circuit
{ equalityConstraints' =
Set.insert (orderedPair a b) (equalityConstraints' circuit)
}
validateEqualityConstraint
:: Configuration f c mcd
-> (Fin c, Fin r)
-> (Fin c, Fin r)
-> [EqualityConstraintFailure c r]
validateEqualityConstraint ::
forall f c mcd r.
Configuration f c mcd ->
(Fin c, Fin r) ->
(Fin c, Fin r) ->
[EqualityConstraintFailure c r]