{-# LANGUAGE TypeOperators        #-}
{-# 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         (CyclicGroup (..))
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 g1 g2 = PlonkupProverSetup
    { forall {k} (p :: Type -> Type) (i :: Type -> Type) (n :: Natural)
       (l :: Type -> Type) g1 (g2 :: k).
PlonkupProverSetup p i n l g1 g2 -> ScalarFieldOf g1
omega       :: ScalarFieldOf g1
    , forall {k} (p :: Type -> Type) (i :: Type -> Type) (n :: Natural)
       (l :: Type -> Type) g1 (g2 :: k).
PlonkupProverSetup p i n l g1 g2 -> ScalarFieldOf g1
k1          :: ScalarFieldOf g1
    , forall {k} (p :: Type -> Type) (i :: Type -> Type) (n :: Natural)
       (l :: Type -> Type) g1 (g2 :: k).
PlonkupProverSetup p i n l g1 g2 -> ScalarFieldOf g1
k2          :: ScalarFieldOf g1
    , forall {k} (p :: Type -> Type) (i :: Type -> Type) (n :: Natural)
       (l :: Type -> Type) g1 (g2 :: k).
PlonkupProverSetup p i n l g1 g2 -> Vector g1
gs          :: V.Vector g1
    , forall {k} (p :: Type -> Type) (i :: Type -> Type) (n :: Natural)
       (l :: Type -> Type) g1 (g2 :: k).
PlonkupProverSetup p i n l g1 g2 -> PolyVec (ScalarFieldOf g1) n
sigma1s     :: PolyVec (ScalarFieldOf g1) n
    , forall {k} (p :: Type -> Type) (i :: Type -> Type) (n :: Natural)
       (l :: Type -> Type) g1 (g2 :: k).
PlonkupProverSetup p i n l g1 g2 -> PolyVec (ScalarFieldOf g1) n
sigma2s     :: PolyVec (ScalarFieldOf g1) n
    , forall {k} (p :: Type -> Type) (i :: Type -> Type) (n :: Natural)
       (l :: Type -> Type) g1 (g2 :: k).
PlonkupProverSetup p i n l g1 g2 -> PolyVec (ScalarFieldOf g1) n
sigma3s     :: PolyVec (ScalarFieldOf g1) n
    , forall {k} (p :: Type -> Type) (i :: Type -> Type) (n :: Natural)
       (l :: Type -> Type) g1 (g2 :: k).
PlonkupProverSetup p i n l g1 g2
-> PlonkupRelation p i n l (ScalarFieldOf g1)
relation    :: PlonkupRelation p i n l (ScalarFieldOf g1)
    , forall {k} (p :: Type -> Type) (i :: Type -> Type) (n :: Natural)
       (l :: Type -> Type) g1 (g2 :: k).
PlonkupProverSetup p i n l g1 g2 -> PlonkupCircuitPolynomials n g1
polynomials :: PlonkupCircuitPolynomials n g1
    }

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