From 6fdc71b40ac47c215eee8d03a6c29e7f8c1e5031 Mon Sep 17 00:00:00 2001 From: Murat Kasimov Date: Sat, 13 Apr 2024 11:10:09 +0700 Subject: [PATCH] Fix rebasing artifacts --- src/ZkFold/Base/Algebra/Basic/Field.hs | 10 +--------- .../Algebra/Polynomials/Multivariate/Monomial.hs | 1 + .../Polynomials/Multivariate/Polynomial.hs | 16 +--------------- .../Base/Algebra/Polynomials/Univariate.hs | 1 + 4 files changed, 4 insertions(+), 24 deletions(-) diff --git a/src/ZkFold/Base/Algebra/Basic/Field.hs b/src/ZkFold/Base/Algebra/Basic/Field.hs index 8bd7532f8..7c2415dc4 100644 --- a/src/ZkFold/Base/Algebra/Basic/Field.hs +++ b/src/ZkFold/Base/Algebra/Basic/Field.hs @@ -266,19 +266,11 @@ instance Field (Ext3 f e) => Exponent (Ext3 f e) Integer where instance (Field f, Eq f, IrreduciblePoly f e) => Field (Ext3 f e) where finv (Ext3 a b c) = let (g, s) = eea (toPoly [a, b, c]) (irreduciblePoly @f @e) -<<<<<<< HEAD - in case scaleP (one // lt g) 0 s of - P [] -> Ext3 zero zero zero - P [x] -> Ext3 x zero zero - P [x, y] -> Ext3 x y zero - P v -> Ext3 (v V.! 0) (v V.! 1) (v V.! 2) -======= - in case fromPoly $ scaleP (one / lt g) 0 s of + in case fromPoly $ scaleP (one // lt g) 0 s of [] -> Ext3 zero zero zero [x] -> Ext3 x zero zero [x, y] -> Ext3 x y zero v -> Ext3 (v V.! 0) (v V.! 1) (v V.! 2) ->>>>>>> 60f8d34 (Hide `P`/`PV` constructors for polymonials) rootOfUnity n = (\r -> Ext3 r zero zero) <$> rootOfUnity n diff --git a/src/ZkFold/Base/Algebra/Polynomials/Multivariate/Monomial.hs b/src/ZkFold/Base/Algebra/Polynomials/Multivariate/Monomial.hs index f87e85b36..e3569bad1 100644 --- a/src/ZkFold/Base/Algebra/Polynomials/Multivariate/Monomial.hs +++ b/src/ZkFold/Base/Algebra/Polynomials/Multivariate/Monomial.hs @@ -12,6 +12,7 @@ import Data.Aeson (FromJSON, ToJSON) import Data.List (intercalate) import Data.Map (Map, toList, unionWith, differenceWith, empty, fromListWith) import qualified Data.Map as Map +import Numeric.Natural (Natural) import GHC.Generics (Generic) import Prelude hiding (Num(..), (/), (!!), lcm, length, sum, take, drop) import Test.QuickCheck (Arbitrary (..)) diff --git a/src/ZkFold/Base/Algebra/Polynomials/Multivariate/Polynomial.hs b/src/ZkFold/Base/Algebra/Polynomials/Multivariate/Polynomial.hs index 5fd8a97d3..df4e5e373 100644 --- a/src/ZkFold/Base/Algebra/Polynomials/Multivariate/Polynomial.hs +++ b/src/ZkFold/Base/Algebra/Polynomials/Multivariate/Polynomial.hs @@ -13,6 +13,7 @@ import Data.Functor ((<&>)) import Data.Bifunctor (Bifunctor(..)) import Data.List (intercalate, foldl') import Data.Map (Map, empty) +import Numeric.Natural (Natural) import GHC.Generics (Generic) import Prelude hiding (Num(..), (/), (!!), lcm, length, sum, take, drop) import Test.QuickCheck (Arbitrary (..)) @@ -77,14 +78,10 @@ instance (Polynomial c i j, m ~ Map i j, p ~ [(c, M i j m)]) => AdditiveSemigrou | ml > mr = (cl, ml) : go ls ((cr, mr):rs) | otherwise = (cr, mr) : go ((cl, ml):ls) rs -<<<<<<< HEAD instance (Scale c' c, m ~ Map i j, p ~ [(c, M i j m)]) => Scale c' (P c i j m p) where scale c' (P p) = P $ map (first (scale c')) p instance forall c i j m p . (Polynomial c i j, m ~ Map i j, p ~ [(c, M i j m)]) => AdditiveMonoid (P c i j m p) where -======= -instance (Polynomial c i j, m ~ Map i j, p ~ [(c, M i j m)]) => AdditiveMonoid (P c i j m p) where ->>>>>>> 5de0359 (Remove `Monomial.Class`/`Polynomial.Class` modules) zero = P [] instance (Polynomial c i j, m ~ Map i j, p ~ [(c, M i j m)]) => AdditiveGroup (P c i j m p) where @@ -94,14 +91,10 @@ instance (Polynomial c i j, m ~ Map i j, p ~ [(c, M i j m)]) => MultiplicativeSe P l * r = foldl' (+) (P []) $ map (f r) l where f (P p) (c, m) = P $ map (bimap (* c) (* m)) p -<<<<<<< HEAD instance MultiplicativeMonoid (P c i j m p) => Exponent (P c i j m p) Natural where (^) = natPow instance forall c i j m p . (Polynomial c i j, m ~ Map i j, p ~ [(c, M i j m)]) => MultiplicativeMonoid (P c i j m p) where -======= -instance (Polynomial c i j, m ~ Map i j, p ~ [(c, M i j m)]) => MultiplicativeMonoid (P c i j m p) where ->>>>>>> 5de0359 (Remove `Monomial.Class`/`Polynomial.Class` modules) one = P [(one, M empty)] instance (FromConstant c' c, m ~ Map i j, p ~ [(c, M i j m)]) => FromConstant c' (P c i j m p) where @@ -109,11 +102,4 @@ instance (FromConstant c' c, m ~ Map i j, p ~ [(c, M i j m)]) => FromConstant c' instance (Polynomial c i j, m ~ Map i j, p ~ [(c, M i j m)]) => Semiring (P c i j m p) -<<<<<<< HEAD instance forall c i j m p . (Polynomial c i j, m ~ Map i j, p ~ [(c, M i j m)]) => Ring (P c i j m p) -======= -instance (Polynomial c i j, m ~ Map i j, p ~ [(c, M i j m)]) => Ring (P c i j m p) - -instance (Polynomial c i j, m ~ Map i j, p ~ [(c, M i j m)]) => Scale (P c i j m p) c where - scale c (P p) = P $ map (first (*c)) p ->>>>>>> 5de0359 (Remove `Monomial.Class`/`Polynomial.Class` modules) diff --git a/src/ZkFold/Base/Algebra/Polynomials/Univariate.hs b/src/ZkFold/Base/Algebra/Polynomials/Univariate.hs index c98b16385..62235bd1f 100644 --- a/src/ZkFold/Base/Algebra/Polynomials/Univariate.hs +++ b/src/ZkFold/Base/Algebra/Polynomials/Univariate.hs @@ -20,6 +20,7 @@ module ZkFold.Base.Algebra.Polynomials.Univariate , evalPolyVec , scalePV , polyVecZero + , polyVecDiv , polyVecLinear , polyVecLagrange , polyVecGrandProduct