{-# LANGUAGE TypeOperators        #-}
{-# LANGUAGE UndecidableInstances #-}

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

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

import           ZkFold.Base.Algebra.EllipticCurve.Class           (CyclicGroup (..))
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 g1 g2 = PlonkupVerifierSetup
    { forall (p :: Type -> Type) (i :: Type -> Type) (n :: Natural)
       (l :: Type -> Type) g1 g2.
PlonkupVerifierSetup p i n l g1 g2 -> ScalarFieldOf g1
omega       :: ScalarFieldOf g1
    , forall (p :: Type -> Type) (i :: Type -> Type) (n :: Natural)
       (l :: Type -> Type) g1 g2.
PlonkupVerifierSetup p i n l g1 g2 -> ScalarFieldOf g1
k1          :: ScalarFieldOf g1
    , forall (p :: Type -> Type) (i :: Type -> Type) (n :: Natural)
       (l :: Type -> Type) g1 g2.
PlonkupVerifierSetup p i n l g1 g2 -> ScalarFieldOf g1
k2          :: ScalarFieldOf g1
    , forall (p :: Type -> Type) (i :: Type -> Type) (n :: Natural)
       (l :: Type -> Type) g1 g2.
PlonkupVerifierSetup p i n l g1 g2 -> g2
h1          :: g2
    , forall (p :: Type -> Type) (i :: Type -> Type) (n :: Natural)
       (l :: Type -> Type) g1 g2.
PlonkupVerifierSetup p i n l g1 g2 -> PolyVec (ScalarFieldOf g1) n
sigma1s     :: PolyVec (ScalarFieldOf g1) n
    , forall (p :: Type -> Type) (i :: Type -> Type) (n :: Natural)
       (l :: Type -> Type) g1 g2.
PlonkupVerifierSetup p i n l g1 g2 -> PolyVec (ScalarFieldOf g1) n
sigma2s     :: PolyVec (ScalarFieldOf g1) n
    , forall (p :: Type -> Type) (i :: Type -> Type) (n :: Natural)
       (l :: Type -> Type) g1 g2.
PlonkupVerifierSetup p i n l g1 g2 -> PolyVec (ScalarFieldOf g1) n
sigma3s     :: PolyVec (ScalarFieldOf g1) n
    , forall (p :: Type -> Type) (i :: Type -> Type) (n :: Natural)
       (l :: Type -> Type) g1 g2.
PlonkupVerifierSetup p i n l g1 g2
-> PlonkupRelation p i n l (ScalarFieldOf g1)
relation    :: PlonkupRelation p i n l (ScalarFieldOf g1)
    , forall (p :: Type -> Type) (i :: Type -> Type) (n :: Natural)
       (l :: Type -> Type) g1 g2.
PlonkupVerifierSetup p i n l g1 g2 -> PlonkupCircuitCommitments g1
commitments :: PlonkupCircuitCommitments g1
    }

instance
        ( CyclicGroup g1
        , Show g1
        , Show g2
        , Show (ScalarFieldOf g1)
        , Show (PlonkupRelation p i n l (ScalarFieldOf g1))
        ) => Show (PlonkupVerifierSetup p i n l g1 g2) where
    show :: PlonkupVerifierSetup p i n l g1 g2 -> String
show PlonkupVerifierSetup {g2
PlonkupCircuitCommitments g1
PolyVec (ScalarFieldOf g1) n
ScalarFieldOf g1
PlonkupRelation p i n l (ScalarFieldOf g1)
omega :: forall (p :: Type -> Type) (i :: Type -> Type) (n :: Natural)
       (l :: Type -> Type) g1 g2.
PlonkupVerifierSetup p i n l g1 g2 -> ScalarFieldOf g1
k1 :: forall (p :: Type -> Type) (i :: Type -> Type) (n :: Natural)
       (l :: Type -> Type) g1 g2.
PlonkupVerifierSetup p i n l g1 g2 -> ScalarFieldOf g1
k2 :: forall (p :: Type -> Type) (i :: Type -> Type) (n :: Natural)
       (l :: Type -> Type) g1 g2.
PlonkupVerifierSetup p i n l g1 g2 -> ScalarFieldOf g1
h1 :: forall (p :: Type -> Type) (i :: Type -> Type) (n :: Natural)
       (l :: Type -> Type) g1 g2.
PlonkupVerifierSetup p i n l g1 g2 -> g2
sigma1s :: forall (p :: Type -> Type) (i :: Type -> Type) (n :: Natural)
       (l :: Type -> Type) g1 g2.
PlonkupVerifierSetup p i n l g1 g2 -> PolyVec (ScalarFieldOf g1) n
sigma2s :: forall (p :: Type -> Type) (i :: Type -> Type) (n :: Natural)
       (l :: Type -> Type) g1 g2.
PlonkupVerifierSetup p i n l g1 g2 -> PolyVec (ScalarFieldOf g1) n
sigma3s :: forall (p :: Type -> Type) (i :: Type -> Type) (n :: Natural)
       (l :: Type -> Type) g1 g2.
PlonkupVerifierSetup p i n l g1 g2 -> PolyVec (ScalarFieldOf g1) n
relation :: forall (p :: Type -> Type) (i :: Type -> Type) (n :: Natural)
       (l :: Type -> Type) g1 g2.
PlonkupVerifierSetup p i n l g1 g2
-> PlonkupRelation p i n l (ScalarFieldOf g1)
commitments :: forall (p :: Type -> Type) (i :: Type -> Type) (n :: Natural)
       (l :: Type -> Type) g1 g2.
PlonkupVerifierSetup p i n l g1 g2 -> PlonkupCircuitCommitments g1
omega :: ScalarFieldOf g1
k1 :: ScalarFieldOf g1
k2 :: ScalarFieldOf g1
h1 :: g2
sigma1s :: PolyVec (ScalarFieldOf g1) n
sigma2s :: PolyVec (ScalarFieldOf g1) n
sigma3s :: PolyVec (ScalarFieldOf g1) n
relation :: PlonkupRelation p i n l (ScalarFieldOf g1)
commitments :: PlonkupCircuitCommitments g1
..} =
        String
"Verifier setup: "
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ ScalarFieldOf g1 -> String
forall a. Show a => a -> String
show ScalarFieldOf g1
omega String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
" "
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ ScalarFieldOf g1 -> String
forall a. Show a => a -> String
show ScalarFieldOf g1
k1 String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
" "
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ ScalarFieldOf g1 -> String
forall a. Show a => a -> String
show ScalarFieldOf g1
k2 String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
" "
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ g2 -> String
forall a. Show a => a -> String
show g2
h1 String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
" "
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ PolyVec (ScalarFieldOf g1) n -> String
forall a. Show a => a -> String
show PolyVec (ScalarFieldOf g1) n
sigma1s String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
" "
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ PolyVec (ScalarFieldOf g1) n -> String
forall a. Show a => a -> String
show PolyVec (ScalarFieldOf g1) n
sigma2s String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
" "
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ PolyVec (ScalarFieldOf g1) n -> String
forall a. Show a => a -> String
show PolyVec (ScalarFieldOf g1) n
sigma3s String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
" "
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ PlonkupRelation p i n l (ScalarFieldOf g1) -> String
forall a. Show a => a -> String
show PlonkupRelation p i n l (ScalarFieldOf g1)
relation String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
" "
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ PlonkupCircuitCommitments g1 -> String
forall a. Show a => a -> String
show PlonkupCircuitCommitments g1
commitments