{-# LANGUAGE UndecidableInstances #-}

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

import qualified Data.Vector                                     as V
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.Prover.Polynomials
import           ZkFold.Base.Protocol.Plonkup.Relation           (PlonkupRelation (..))

data PlonkupProverSetup p i n l c1 c2 = PlonkupProverSetup
    { forall {k} {k} (p :: Type -> Type) (i :: Type -> Type)
       (n :: Natural) (l :: Type -> Type) (c1 :: k) (c2 :: k).
PlonkupProverSetup 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).
PlonkupProverSetup 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).
PlonkupProverSetup 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).
PlonkupProverSetup p i n l c1 c2 -> Vector (Point c1)
gs          :: V.Vector (Point c1)
    , forall {k} {k} (p :: Type -> Type) (i :: Type -> Type)
       (n :: Natural) (l :: Type -> Type) (c1 :: k) (c2 :: k).
PlonkupProverSetup 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).
PlonkupProverSetup 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).
PlonkupProverSetup 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).
PlonkupProverSetup 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).
PlonkupProverSetup p i n l c1 c2 -> PlonkupCircuitPolynomials n c1
polynomials :: PlonkupCircuitPolynomials n c1
    }

instance
        ( EllipticCurve c1
        , EllipticCurve c2
        , Show (BaseField c1)
        , Show (BaseField c2)
        , Show (ScalarField c1)
        , Show (PlonkupRelation p i n l (ScalarField c1))
        ) => Show (PlonkupProverSetup p i n l c1 c2) where
    show :: PlonkupProverSetup p i n l c1 c2 -> String
show PlonkupProverSetup {Vector (Point c1)
ScalarField c1
PolyVec (ScalarField c1) n
PlonkupRelation p i n l (ScalarField c1)
PlonkupCircuitPolynomials n c1
omega :: forall {k} {k} (p :: Type -> Type) (i :: Type -> Type)
       (n :: Natural) (l :: Type -> Type) (c1 :: k) (c2 :: k).
PlonkupProverSetup 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).
PlonkupProverSetup 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).
PlonkupProverSetup p i n l c1 c2 -> ScalarField c1
gs :: forall {k} {k} (p :: Type -> Type) (i :: Type -> Type)
       (n :: Natural) (l :: Type -> Type) (c1 :: k) (c2 :: k).
PlonkupProverSetup p i n l c1 c2 -> Vector (Point c1)
sigma1s :: forall {k} {k} (p :: Type -> Type) (i :: Type -> Type)
       (n :: Natural) (l :: Type -> Type) (c1 :: k) (c2 :: k).
PlonkupProverSetup 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).
PlonkupProverSetup 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).
PlonkupProverSetup 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).
PlonkupProverSetup p i n l c1 c2
-> PlonkupRelation p i n l (ScalarField c1)
polynomials :: forall {k} {k} (p :: Type -> Type) (i :: Type -> Type)
       (n :: Natural) (l :: Type -> Type) (c1 :: k) (c2 :: k).
PlonkupProverSetup p i n l c1 c2 -> PlonkupCircuitPolynomials n c1
omega :: ScalarField c1
k1 :: ScalarField c1
k2 :: ScalarField c1
gs :: Vector (Point c1)
sigma1s :: PolyVec (ScalarField c1) n
sigma2s :: PolyVec (ScalarField c1) n
sigma3s :: PolyVec (ScalarField c1) n
relation :: PlonkupRelation p i n l (ScalarField c1)
polynomials :: PlonkupCircuitPolynomials n c1
..} =
        String
"Prover 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]
++ Vector (Point c1) -> String
forall a. Show a => a -> String
show Vector (Point c1)
gs 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]
++ PlonkupCircuitPolynomials n c1 -> String
forall a. Show a => a -> String
show PlonkupCircuitPolynomials n c1
polynomials