{-# 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 i n l c1 c2 = PlonkupVerifierSetup
    { forall {k} {k} (i :: Natural) (n :: Natural) (l :: Natural)
       (c1 :: k) (c2 :: k).
PlonkupVerifierSetup i n l c1 c2 -> ScalarField c1
omega       :: ScalarField c1
    , forall {k} {k} (i :: Natural) (n :: Natural) (l :: Natural)
       (c1 :: k) (c2 :: k).
PlonkupVerifierSetup i n l c1 c2 -> ScalarField c1
k1          :: ScalarField c1
    , forall {k} {k} (i :: Natural) (n :: Natural) (l :: Natural)
       (c1 :: k) (c2 :: k).
PlonkupVerifierSetup i n l c1 c2 -> ScalarField c1
k2          :: ScalarField c1
    , forall {k} {k} (i :: Natural) (n :: Natural) (l :: Natural)
       (c1 :: k) (c2 :: k).
PlonkupVerifierSetup i n l c1 c2 -> Point c2
h1          :: Point c2
    , forall {k} {k} (i :: Natural) (n :: Natural) (l :: Natural)
       (c1 :: k) (c2 :: k).
PlonkupVerifierSetup i n l c1 c2 -> PolyVec (ScalarField c1) n
sigma1s     :: PolyVec (ScalarField c1) n
    , forall {k} {k} (i :: Natural) (n :: Natural) (l :: Natural)
       (c1 :: k) (c2 :: k).
PlonkupVerifierSetup i n l c1 c2 -> PolyVec (ScalarField c1) n
sigma2s     :: PolyVec (ScalarField c1) n
    , forall {k} {k} (i :: Natural) (n :: Natural) (l :: Natural)
       (c1 :: k) (c2 :: k).
PlonkupVerifierSetup i n l c1 c2 -> PolyVec (ScalarField c1) n
sigma3s     :: PolyVec (ScalarField c1) n
    , forall {k} {k} (i :: Natural) (n :: Natural) (l :: Natural)
       (c1 :: k) (c2 :: k).
PlonkupVerifierSetup i n l c1 c2
-> PlonkupRelation i n l (ScalarField c1)
relation    :: PlonkupRelation i n l (ScalarField c1)
    , forall {k} {k} (i :: Natural) (n :: Natural) (l :: Natural)
       (c1 :: k) (c2 :: k).
PlonkupVerifierSetup 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 i n l (ScalarField c1))
        ) => Show (PlonkupVerifierSetup i n l c1 c2) where
    show :: PlonkupVerifierSetup i n l c1 c2 -> String
show PlonkupVerifierSetup {ScalarField c1
Point c2
PlonkupCircuitCommitments c1
PolyVec (ScalarField c1) n
PlonkupRelation i n l (ScalarField c1)
omega :: forall {k} {k} (i :: Natural) (n :: Natural) (l :: Natural)
       (c1 :: k) (c2 :: k).
PlonkupVerifierSetup i n l c1 c2 -> ScalarField c1
k1 :: forall {k} {k} (i :: Natural) (n :: Natural) (l :: Natural)
       (c1 :: k) (c2 :: k).
PlonkupVerifierSetup i n l c1 c2 -> ScalarField c1
k2 :: forall {k} {k} (i :: Natural) (n :: Natural) (l :: Natural)
       (c1 :: k) (c2 :: k).
PlonkupVerifierSetup i n l c1 c2 -> ScalarField c1
h1 :: forall {k} {k} (i :: Natural) (n :: Natural) (l :: Natural)
       (c1 :: k) (c2 :: k).
PlonkupVerifierSetup i n l c1 c2 -> Point c2
sigma1s :: forall {k} {k} (i :: Natural) (n :: Natural) (l :: Natural)
       (c1 :: k) (c2 :: k).
PlonkupVerifierSetup i n l c1 c2 -> PolyVec (ScalarField c1) n
sigma2s :: forall {k} {k} (i :: Natural) (n :: Natural) (l :: Natural)
       (c1 :: k) (c2 :: k).
PlonkupVerifierSetup i n l c1 c2 -> PolyVec (ScalarField c1) n
sigma3s :: forall {k} {k} (i :: Natural) (n :: Natural) (l :: Natural)
       (c1 :: k) (c2 :: k).
PlonkupVerifierSetup i n l c1 c2 -> PolyVec (ScalarField c1) n
relation :: forall {k} {k} (i :: Natural) (n :: Natural) (l :: Natural)
       (c1 :: k) (c2 :: k).
PlonkupVerifierSetup i n l c1 c2
-> PlonkupRelation i n l (ScalarField c1)
commitments :: forall {k} {k} (i :: Natural) (n :: Natural) (l :: Natural)
       (c1 :: k) (c2 :: k).
PlonkupVerifierSetup 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 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 i n l (ScalarField c1) -> String
forall a. Show a => a -> String
show PlonkupRelation 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