{-# LANGUAGE UndecidableInstances #-}

module ZkFold.Base.Protocol.Plonkup.Verifier.Setup where

import           Prelude                                           hiding (Num (..), drop, length, sum, take, (!!), (/),
                                                                    (^))

import           ZkFold.Base.Algebra.EllipticCurve.Class           (EllipticCurve (..), Point)
import           ZkFold.Base.Algebra.Polynomials.Univariate        hiding (qr)
import           ZkFold.Base.Protocol.Plonkup.Relation             (PlonkupRelation (..))
import           ZkFold.Base.Protocol.Plonkup.Verifier.Commitments (PlonkupCircuitCommitments (..))

data PlonkupVerifierSetup p i n l c1 c2 = PlonkupVerifierSetup
    { forall {k} {k} (p :: Type -> Type) (i :: Type -> Type)
       (n :: Natural) (l :: Type -> Type) (c1 :: k) (c2 :: k).
PlonkupVerifierSetup p i n l c1 c2 -> ScalarField c1
omega       :: ScalarField c1
    , forall {k} {k} (p :: Type -> Type) (i :: Type -> Type)
       (n :: Natural) (l :: Type -> Type) (c1 :: k) (c2 :: k).
PlonkupVerifierSetup p i n l c1 c2 -> ScalarField c1
k1          :: ScalarField c1
    , forall {k} {k} (p :: Type -> Type) (i :: Type -> Type)
       (n :: Natural) (l :: Type -> Type) (c1 :: k) (c2 :: k).
PlonkupVerifierSetup p i n l c1 c2 -> ScalarField c1
k2          :: ScalarField c1
    , forall {k} {k} (p :: Type -> Type) (i :: Type -> Type)
       (n :: Natural) (l :: Type -> Type) (c1 :: k) (c2 :: k).
PlonkupVerifierSetup p i n l c1 c2 -> Point c2
h1          :: Point c2
    , forall {k} {k} (p :: Type -> Type) (i :: Type -> Type)
       (n :: Natural) (l :: Type -> Type) (c1 :: k) (c2 :: k).
PlonkupVerifierSetup p i n l c1 c2 -> PolyVec (ScalarField c1) n
sigma1s     :: PolyVec (ScalarField c1) n
    , forall {k} {k} (p :: Type -> Type) (i :: Type -> Type)
       (n :: Natural) (l :: Type -> Type) (c1 :: k) (c2 :: k).
PlonkupVerifierSetup p i n l c1 c2 -> PolyVec (ScalarField c1) n
sigma2s     :: PolyVec (ScalarField c1) n
    , forall {k} {k} (p :: Type -> Type) (i :: Type -> Type)
       (n :: Natural) (l :: Type -> Type) (c1 :: k) (c2 :: k).
PlonkupVerifierSetup p i n l c1 c2 -> PolyVec (ScalarField c1) n
sigma3s     :: PolyVec (ScalarField c1) n
    , forall {k} {k} (p :: Type -> Type) (i :: Type -> Type)
       (n :: Natural) (l :: Type -> Type) (c1 :: k) (c2 :: k).
PlonkupVerifierSetup p i n l c1 c2
-> PlonkupRelation p i n l (ScalarField c1)
relation    :: PlonkupRelation p i n l (ScalarField c1)
    , forall {k} {k} (p :: Type -> Type) (i :: Type -> Type)
       (n :: Natural) (l :: Type -> Type) (c1 :: k) (c2 :: k).
PlonkupVerifierSetup p i n l c1 c2 -> PlonkupCircuitCommitments c1
commitments :: PlonkupCircuitCommitments c1
    }

instance
        ( EllipticCurve c1
        , EllipticCurve c2
        , Show (BaseField c1)
        , Show (BaseField c2)
        , Show (ScalarField c1)
        , Show (PlonkupRelation p i n l (ScalarField c1))
        ) => Show (PlonkupVerifierSetup p i n l c1 c2) where
    show :: PlonkupVerifierSetup p i n l c1 c2 -> String
show PlonkupVerifierSetup {ScalarField c1
Point c2
PlonkupCircuitCommitments c1
PolyVec (ScalarField c1) n
PlonkupRelation p i n l (ScalarField c1)
omega :: forall {k} {k} (p :: Type -> Type) (i :: Type -> Type)
       (n :: Natural) (l :: Type -> Type) (c1 :: k) (c2 :: k).
PlonkupVerifierSetup p i n l c1 c2 -> ScalarField c1
k1 :: forall {k} {k} (p :: Type -> Type) (i :: Type -> Type)
       (n :: Natural) (l :: Type -> Type) (c1 :: k) (c2 :: k).
PlonkupVerifierSetup p i n l c1 c2 -> ScalarField c1
k2 :: forall {k} {k} (p :: Type -> Type) (i :: Type -> Type)
       (n :: Natural) (l :: Type -> Type) (c1 :: k) (c2 :: k).
PlonkupVerifierSetup p i n l c1 c2 -> ScalarField c1
h1 :: forall {k} {k} (p :: Type -> Type) (i :: Type -> Type)
       (n :: Natural) (l :: Type -> Type) (c1 :: k) (c2 :: k).
PlonkupVerifierSetup p i n l c1 c2 -> Point c2
sigma1s :: forall {k} {k} (p :: Type -> Type) (i :: Type -> Type)
       (n :: Natural) (l :: Type -> Type) (c1 :: k) (c2 :: k).
PlonkupVerifierSetup p i n l c1 c2 -> PolyVec (ScalarField c1) n
sigma2s :: forall {k} {k} (p :: Type -> Type) (i :: Type -> Type)
       (n :: Natural) (l :: Type -> Type) (c1 :: k) (c2 :: k).
PlonkupVerifierSetup p i n l c1 c2 -> PolyVec (ScalarField c1) n
sigma3s :: forall {k} {k} (p :: Type -> Type) (i :: Type -> Type)
       (n :: Natural) (l :: Type -> Type) (c1 :: k) (c2 :: k).
PlonkupVerifierSetup p i n l c1 c2 -> PolyVec (ScalarField c1) n
relation :: forall {k} {k} (p :: Type -> Type) (i :: Type -> Type)
       (n :: Natural) (l :: Type -> Type) (c1 :: k) (c2 :: k).
PlonkupVerifierSetup p i n l c1 c2
-> PlonkupRelation p i n l (ScalarField c1)
commitments :: forall {k} {k} (p :: Type -> Type) (i :: Type -> Type)
       (n :: Natural) (l :: Type -> Type) (c1 :: k) (c2 :: k).
PlonkupVerifierSetup p i n l c1 c2 -> PlonkupCircuitCommitments c1
omega :: ScalarField c1
k1 :: ScalarField c1
k2 :: ScalarField c1
h1 :: Point c2
sigma1s :: PolyVec (ScalarField c1) n
sigma2s :: PolyVec (ScalarField c1) n
sigma3s :: PolyVec (ScalarField c1) n
relation :: PlonkupRelation p i n l (ScalarField c1)
commitments :: PlonkupCircuitCommitments c1
..} =
        String
"Verifier setup: "
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ ScalarField c1 -> String
forall a. Show a => a -> String
show ScalarField c1
omega String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
" "
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ ScalarField c1 -> String
forall a. Show a => a -> String
show ScalarField c1
k1 String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
" "
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ ScalarField c1 -> String
forall a. Show a => a -> String
show ScalarField c1
k2 String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
" "
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ Point c2 -> String
forall a. Show a => a -> String
show Point c2
h1 String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
" "
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ PolyVec (ScalarField c1) n -> String
forall a. Show a => a -> String
show PolyVec (ScalarField c1) n
sigma1s String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
" "
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ PolyVec (ScalarField c1) n -> String
forall a. Show a => a -> String
show PolyVec (ScalarField c1) n
sigma2s String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
" "
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ PolyVec (ScalarField c1) n -> String
forall a. Show a => a -> String
show PolyVec (ScalarField c1) n
sigma3s String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
" "
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ PlonkupRelation p i n l (ScalarField c1) -> String
forall a. Show a => a -> String
show PlonkupRelation p i n l (ScalarField c1)
relation String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
" "
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ PlonkupCircuitCommitments c1 -> String
forall a. Show a => a -> String
show PlonkupCircuitCommitments c1
commitments