diff --git a/egison.cabal b/egison.cabal
--- a/egison.cabal
+++ b/egison.cabal
@@ -1,5 +1,5 @@
 Name:                egison
-Version:             4.1.3
+Version:             4.2.0
 Synopsis:            Programming language with non-linear pattern-matching against non-free data
 Description:
   An interpreter for Egison, a **pattern-matching-oriented**, purely functional programming language.
@@ -82,28 +82,28 @@
   location: https://github.com/egison/egison.git
 
 Library
-  default-language:    Haskell2010
+  default-language:    GHC2021
   Build-Depends:
       base                 >= 4.8     && < 5
-    , random               == 1.*
-    , containers           == 0.6.*
+    , random               >= 1.0     && < 2.0
+    , containers           >= 0.6     && < 0.8
     , unordered-containers >= 0.1.0.0 && < 0.3
     , haskeline            >= 0.7     && < 0.9
-    , transformers         >= 0.4     && < 0.6
+    , transformers         >= 0.4     && < 0.7
     , mtl                  >= 2.2.2   && < 3.0
-    , parsec               >= 3.0
+    , parsec               >= 3.0     && < 4.0
     , megaparsec           >= 7.0.0   && < 12.0
     , parser-combinators   >= 1.0     && < 2.0
-    , directory            >= 1.3.0
-    , text                 >= 0.2     && < 1.3
-    , regex-tdfa           >= 1.2.0
+    , directory            >= 1.3.0   && < 2.0
+    , text                 >= 0.2     && < 2.2
+    , regex-tdfa           >= 1.2.0   && < 2.0
     , process              >= 1.0     && < 2.0
-    , vector               == 0.12.*
+    , vector               >= 0.12    && < 0.14
     , hashable             >= 1.0     && < 2.0
     , optparse-applicative >= 0.14    && < 0.20
     , prettyprinter        >= 1.0     && < 2.0
-    , unicode-show         == 0.1.*
-    , sweet-egison         == 0.1.1.3
+    , unicode-show         >= 0.1     && < 0.2
+    , sweet-egison         >= 0.1.2.1 && < 0.2
   if !impl(ghc > 8.0)
     Build-Depends: fail
   Hs-Source-Dirs:  hs-src
@@ -150,7 +150,7 @@
   ghc-options:  -O3 -Wall -Wno-name-shadowing -Wno-incomplete-patterns
 
 Test-Suite test
-  default-language:    Haskell2010
+  default-language:    GHC2021
   Type:           exitcode-stdio-1.0
   Hs-Source-Dirs: test
   Main-Is:        Test.hs
@@ -169,7 +169,7 @@
   ghc-options:  -Wall -Wno-name-shadowing
 
 Test-Suite test-cli
-  default-language:    Haskell2010
+  default-language:    GHC2021
   Type:           exitcode-stdio-1.0
   Hs-Source-Dirs: test
   Main-Is:        CLITest.hs
@@ -185,7 +185,7 @@
   ghc-options:  -Wall -Wno-name-shadowing
 
 Benchmark benchmark
-  default-language:    Haskell2010
+  default-language:    GHC2021
   Type: exitcode-stdio-1.0
   Hs-Source-Dirs:  benchmark
   Main-Is: Benchmark.hs
@@ -199,16 +199,16 @@
   ghc-options:  -Wall -Wno-name-shadowing
 
 Executable egison
-  default-language:    Haskell2010
+  default-language:    GHC2021
   Main-is:             egison.hs
   Build-depends:
       egison
     , base >= 4.0 && < 5
-    , exceptions
+    , exceptions           >= 0.10    && < 0.11
     , haskeline
     , mtl
     , directory
-    , filepath
+    , filepath             >= 1.4     && < 2.0
     , text
     , regex-tdfa
     , optparse-applicative
@@ -217,10 +217,10 @@
   Hs-Source-Dirs:      hs-src/Interpreter
   Other-modules:       Paths_egison
   autogen-modules: Paths_egison
-  ghc-options:  -O3 -threaded -eventlog -rtsopts -Wall -Wno-name-shadowing
+  ghc-options:  -O3 -threaded -rtsopts -Wall -Wno-name-shadowing
 
 Executable egison-translate
-  default-language:    Haskell2010
+  default-language:    GHC2021
   Main-is:          translator.hs
   Build-depends:
       egison
diff --git a/hs-src/Interpreter/egison.hs b/hs-src/Interpreter/egison.hs
--- a/hs-src/Interpreter/egison.hs
+++ b/hs-src/Interpreter/egison.hs
@@ -3,8 +3,8 @@
 module Main where
 
 import           Control.Exception                (AsyncException (..))
+import           Control.Monad                    (when)
 import           Control.Monad.Catch              (catch)
-import           Control.Monad.Except
 import           Control.Monad.Reader
 
 import           Data.List                        (intercalate)
diff --git a/hs-src/Language/Egison/Core.hs b/hs-src/Language/Egison/Core.hs
--- a/hs-src/Language/Egison/Core.hs
+++ b/hs-src/Language/Egison/Core.hs
@@ -25,8 +25,9 @@
 import           Prelude                         hiding (mapM, mappend, mconcat)
 
 import           Control.Arrow
+import           Control.Monad                   (forM_, when, zipWithM, (>=>))
 import           Control.Monad.Except            (throwError)
-import           Control.Monad.State             hiding (join, mapM)
+import           Control.Monad.State
 import           Control.Monad.Trans.Maybe
 
 import           Data.Char                       (isUpper)
diff --git a/hs-src/Language/Egison/Data.hs b/hs-src/Language/Egison/Data.hs
--- a/hs-src/Language/Egison/Data.hs
+++ b/hs-src/Language/Egison/Data.hs
@@ -50,10 +50,12 @@
 
 import           Control.Exception
 
-import           Control.Monad.Except             hiding (join)
+import           Control.Monad                    (liftM2)
+import           Control.Monad.Except
+import           Control.Monad.Trans.Class        (lift)
 import           Control.Monad.Trans.State.Strict
 
-import           Data.Foldable                    (toList)
+import           Data.Foldable                    (msum, toList)
 import           Data.HashMap.Strict              (HashMap)
 import qualified Data.HashMap.Strict              as HashMap
 import           Data.IORef
diff --git a/hs-src/Language/Egison/Data/Collection.hs b/hs-src/Language/Egison/Data/Collection.hs
--- a/hs-src/Language/Egison/Data/Collection.hs
+++ b/hs-src/Language/Egison/Data/Collection.hs
@@ -18,7 +18,8 @@
   , makeICollection
   ) where
 
-import           Control.Monad.Except       (lift, liftIO)
+import           Control.Monad.IO.Class     (liftIO)
+import           Control.Monad.Trans.Class  (lift)
 import           Control.Monad.Trans.Maybe  (runMaybeT)
 
 import           Data.Foldable              (toList)
diff --git a/hs-src/Language/Egison/Eval.hs b/hs-src/Language/Egison/Eval.hs
--- a/hs-src/Language/Egison/Eval.hs
+++ b/hs-src/Language/Egison/Eval.hs
@@ -22,6 +22,7 @@
   , loadEgisonFile
   ) where
 
+import           Control.Monad              (forM_, when)
 import           Control.Monad.Except       (throwError)
 import           Control.Monad.Reader       (ask, asks)
 import           Control.Monad.State
diff --git a/hs-src/Language/Egison/EvalState.hs b/hs-src/Language/Egison/EvalState.hs
--- a/hs-src/Language/Egison/EvalState.hs
+++ b/hs-src/Language/Egison/EvalState.hs
@@ -15,6 +15,7 @@
   ) where
 
 import           Control.Monad.Except
+import           Control.Monad.Trans.Class        (lift)
 import           Control.Monad.Trans.State.Strict
 
 import           Language.Egison.IExpr
diff --git a/hs-src/Language/Egison/Math/Expr.hs b/hs-src/Language/Egison/Math/Expr.hs
--- a/hs-src/Language/Egison/Math/Expr.hs
+++ b/hs-src/Language/Egison/Math/Expr.hs
@@ -94,8 +94,8 @@
 
 term :: Pattern (PP Integer, PP Monomial) TermM TermExpr (Integer, Monomial)
 term _ _ (Term a mono) = pure (a, mono)
-termM :: TermM -> TermExpr -> (Eql, Multiset (Pair SymbolM Eql))
-termM TermM _ = (Eql, Multiset (Pair SymbolM Eql))
+termM :: TermM -> TermExpr -> (Eql, Multiset (SymbolM, Eql))
+termM TermM _ = (Eql, Multiset (SymbolM, Eql))
 
 symbol :: Pattern (PP String) SymbolM SymbolExpr String
 symbol _ _ (Symbol _ name []) = pure name
@@ -126,13 +126,13 @@
 negQuoteM :: SymbolM -> p -> ScalarM
 negQuoteM SymbolM _ = ScalarM
 
-equalMonomial :: Pattern (PP Integer, PP Monomial) (Multiset (Pair SymbolM Eql)) Monomial (Integer, Monomial)
+equalMonomial :: Pattern (PP Integer, PP Monomial) (Multiset (SymbolM, Eql)) Monomial (Integer, Monomial)
 equalMonomial (_, VP xs) _ ys = case isEqualMonomial xs ys of
                                   Just sgn -> pure (sgn, xs)
                                   Nothing  -> mzero
 equalMonomial _ _ _ = mzero
-equalMonomialM :: Multiset (Pair SymbolM Eql) -> p -> (Eql, Multiset (Pair SymbolM Eql))
-equalMonomialM (Multiset (Pair SymbolM Eql)) _ = (Eql, Multiset (Pair SymbolM Eql))
+equalMonomialM :: Multiset (SymbolM, Eql) -> p -> (Eql, Multiset (SymbolM, Eql))
+equalMonomialM (Multiset (SymbolM, Eql)) _ = (Eql, Multiset (SymbolM, Eql))
 
 zero :: Pattern () ScalarM ScalarData ()
 zero _ _ (Div (Plus []) _) = pure ()
@@ -143,8 +143,8 @@
 singleTerm :: Pattern (PP Integer, PP Integer, PP Monomial) ScalarM ScalarData (Integer, Integer, Monomial)
 singleTerm _ _ (Div (Plus [Term c mono]) (Plus [Term c2 []])) = pure (c, c2, mono)
 singleTerm _ _ _                                              = mzero
-singleTermM :: ScalarM -> p -> (Eql, Eql, Multiset (Pair SymbolM Eql))
-singleTermM ScalarM _ = (Eql, Eql, Multiset (Pair SymbolM Eql))
+singleTermM :: ScalarM -> p -> (Eql, Eql, Multiset (SymbolM, Eql))
+singleTermM ScalarM _ = (Eql, Eql, Multiset (SymbolM, Eql))
 
 
 instance ValuePattern ScalarM ScalarData where
@@ -178,7 +178,7 @@
 
 isEqualMonomial :: Monomial -> Monomial -> Maybe Integer
 isEqualMonomial xs ys =
-  match dfs (xs, ys) (Pair (Multiset (Pair SymbolM Eql)) (Multiset (Pair SymbolM Eql)))
+  match dfs (xs, ys) (Multiset (SymbolM, Eql), Multiset (SymbolM, Eql))
     [ [mc| ((quote $s, $n) : $xss, (negQuote #s, #n) : $yss) ->
              case isEqualMonomial xss yss of
                Nothing -> Nothing
diff --git a/hs-src/Language/Egison/Math/Normalize.hs b/hs-src/Language/Egison/Math/Normalize.hs
--- a/hs-src/Language/Egison/Math/Normalize.hs
+++ b/hs-src/Language/Egison/Math/Normalize.hs
@@ -63,7 +63,7 @@
   divMonomial :: Monomial -> Monomial -> (Integer, Monomial)
   divMonomial xs [] = (1, xs)
   divMonomial xs ((y, m):ys) =
-    match dfs (y, xs) (Pair SymbolM (Multiset (Pair SymbolM Eql)))
+    match dfs (y, xs) (SymbolM, Multiset (SymbolM, Eql))
       -- Because we've applied |mathFold|, we can only divide the first matching monomial
       [ [mc| (quote $s, ($x & negQuote #s, $n) : $xss) ->
                let (sgn, xs') = divMonomial xss ys in
@@ -106,7 +106,7 @@
   g :: Monomial -> (Integer, Monomial)
   g [] = (1, [])
   g ((x, m):xs) =
-    match dfs (x, xs) (Pair SymbolM (Multiset (Pair SymbolM Eql)))
+    match dfs (x, xs) (SymbolM, Multiset (SymbolM, Eql))
       [ [mc| (quote $s, (negQuote #s, $n) : $xs) ->
                let (sgn, ys) = g ((x, m + n) : xs) in
                if even n then (sgn, ys) else (- sgn, ys) |]
@@ -121,7 +121,7 @@
   f :: [TermExpr] -> [TermExpr]
   f [] = []
   f (t:ts) =
-    match dfs (t, ts) (Pair TermM (Multiset TermM))
+    match dfs (t, ts) (TermM, Multiset TermM)
       [ [mc| (term $a $xs, term $b (equalMonomial $sgn #xs) : $tss) ->
                f (Term (sgn * a + b) xs : tss) |]
       , [mc| _ -> t : f ts |]
diff --git a/hs-src/Language/Egison/Math/Rewrite.hs b/hs-src/Language/Egison/Math/Rewrite.hs
--- a/hs-src/Language/Egison/Math/Rewrite.hs
+++ b/hs-src/Language/Egison/Math/Rewrite.hs
@@ -39,7 +39,7 @@
 
 mapTerms' :: (TermExpr -> ScalarData) -> ScalarData -> ScalarData
 mapTerms' f (Div (Plus ts1) (Plus ts2)) =
-  mathDiv (foldl1 mathPlus (map f ts1)) (foldl1 mathPlus (map f ts2))
+  mathDiv (foldl mathPlus (Div (Plus []) (Plus [Term 1 []])) (map f ts1)) (foldl mathPlus (Div (Plus []) (Plus [Term 1 []])) (map f ts2))
 
 mapPolys :: (PolyExpr -> PolyExpr) -> ScalarData -> ScalarData
 mapPolys f (Div p1 p2) = Div (f p1) (f p2)
@@ -48,7 +48,7 @@
 rewriteI = mapTerms f
  where
   f term@(Term a xs) =
-    match dfs xs (Multiset (Pair SymbolM Eql))
+    match dfs xs (Multiset (SymbolM, Eql))
       [ [mc| (symbol #"i", $k) : $xss ->
               if even k
                 then Term (a * (-1) ^ (quot k 2)) xss
@@ -60,7 +60,7 @@
 rewriteW = mapPolys g . mapTerms f
  where
   f term@(Term a xs) =
-    match dfs xs (Multiset (Pair SymbolM Eql))
+    match dfs xs (Multiset (SymbolM, Eql))
       [ [mc| (symbol #"w", $k & ?(>= 3)) : $xss ->
                Term a ((Symbol "" "w" [], k `mod` 3) : xss) |]
       , [mc| _ -> term |]
@@ -78,7 +78,7 @@
 rewriteLog = mapTerms f
  where
   f term@(Term a xs) =
-    match dfs xs (Multiset (Pair SymbolM Eql))
+    match dfs xs (Multiset (SymbolM, Eql))
       [ [mc| (apply #"log" [zero], _) : _ -> Term 0 [] |]
       , [mc| (apply #"log" [singleTerm _ #1 [(symbol #"e", $n)]], _) : $xss ->
               Term (n * a) xss |]
@@ -93,7 +93,7 @@
 rewriteExp = mapTerms f
  where
   f term@(Term a xs) =
-    match dfs xs (Multiset (Pair SymbolM Eql))
+    match dfs xs (Multiset (SymbolM, Eql))
       [ [mc| (apply #"exp" [zero], _) : $xss ->
                f (Term a xss) |]
       , [mc| (apply #"exp" [singleTerm #1 #1 []], _) : $xss ->
@@ -111,7 +111,7 @@
 rewritePower = mapTerms f
  where
   f term@(Term a xs) =
-    match dfs xs (Multiset (Pair SymbolM Eql))
+    match dfs xs (Multiset (SymbolM, Eql))
       [ [mc| (apply #"^" [singleTerm #1 #1 [], _], _) : $xss -> f (Term a xss) |]
       , [mc| (apply #"^" [$x, $y], $n & ?(>= 2)) : $xss ->
                f (Term a ((makeApply "^" [x, mathScalarMult n y], 1) : xss)) |]
@@ -124,7 +124,7 @@
 rewriteSinCos = mapTerms' h . mapTerms (g . f)
  where
   f term@(Term a xs) =
-    match dfs xs (Multiset (Pair SymbolM Eql))
+    match dfs xs (Multiset (SymbolM, Eql))
       [ [mc| (apply #"sin" [zero], _) : _ -> Term 0 [] |]
       , [mc| (apply #"sin" [singleTerm _ #1 [(symbol #"π", #1)]], _) : _ ->
                Term 0 [] |]
@@ -133,7 +133,7 @@
       , [mc| _ -> term |]
       ]
   g term@(Term a xs) =
-    match dfs xs (Multiset (Pair SymbolM Eql))
+    match dfs xs (Multiset (SymbolM, Eql))
       [ [mc| (apply #"cos" [zero], _) : $xss -> Term a xss |]
       , [mc| (apply #"cos" [singleTerm _ #2 [(symbol #"π", #1)]], _) : _ ->
               Term 0 [] |]
@@ -142,7 +142,7 @@
       , [mc| _ -> term |]
       ]
   h (Term a xs) =
-    match dfs xs (Multiset (Pair SymbolM Eql))
+    match dfs xs (Multiset (SymbolM, Eql))
       [ [mc| (apply #"cos" [$x], #2) : $mr ->
                mathMult
                  (mathMinus (SingleTerm 1 []) (SingleTerm 1 [(makeApply "sin" [x], 2)]))
@@ -154,7 +154,7 @@
 rewriteSqrt = mapTerms' f
  where
   f (Term a xs) =
-    match dfs xs (Multiset (Pair SymbolM Eql))
+    match dfs xs (Multiset (SymbolM, Eql))
       [ [mc| (apply #"sqrt" [$x], ?(> 1) & $k) : $xss ->
                rewriteSqrt
                  (mathMult (SingleTerm a ((makeApply "sqrt" [x], k `mod` 2) : xss))
@@ -174,7 +174,7 @@
 rewriteRt = mapTerms' f
  where
   f (Term a xs) =
-    match dfs xs (Multiset (Pair SymbolM Eql))
+    match dfs xs (Multiset (SymbolM, Eql))
       [ [mc| (apply #"rt" [singleTerm $n #1 [], $x] & $rtnx, ?(>= n) & $k) : $xss ->
                mathMult (SingleTerm a ((rtnx, k `mod` n) : xss))
                         (mathPower x (div k n)) |]
@@ -185,13 +185,13 @@
 rewriteRtu = mapTerms' g . mapTerms f
  where
   f term@(Term a xs) =
-    match dfs xs (Multiset (Pair SymbolM Eql))
+    match dfs xs (Multiset (SymbolM, Eql))
       [ [mc| (apply #"rtu" [singleTerm $n #1 []] & $rtun, ?(>= n) & $k) : $r ->
                Term a ((rtun, k `mod` n) : r) |]
       , [mc| _ -> term |]
       ]
   g (Term a xs) =
-    match dfs xs (Multiset (Pair SymbolM Eql))
+    match dfs xs (Multiset (SymbolM, Eql))
       [ [mc| (apply #"rtu" [singleTerm $n #1 []] & $rtun, ?(== n - 1)) : $mr ->
                mathMult
                  (foldl mathMinus (SingleTerm (-1) []) (map (\k -> SingleTerm 1 [(rtun, k)]) [1..(n-2)]))
diff --git a/hs-src/Language/Egison/Parser.hs b/hs-src/Language/Egison/Parser.hs
--- a/hs-src/Language/Egison/Parser.hs
+++ b/hs-src/Language/Egison/Parser.hs
@@ -21,9 +21,11 @@
        , readUTF8File
        ) where
 
-import           Control.Monad.Except         (lift, liftIO, throwError)
+import           Control.Monad                 (unless)
+import           Control.Monad.Except         (throwError)
+import           Control.Monad.IO.Class       (liftIO)
 import           Control.Monad.Reader         (asks, local)
-import           Control.Monad.State          (unless)
+import           Control.Monad.Trans.Class    (lift)
 
 import           System.Directory             (doesFileExist, getHomeDirectory)
 import           System.IO
diff --git a/hs-src/Language/Egison/Pretty.hs b/hs-src/Language/Egison/Pretty.hs
--- a/hs-src/Language/Egison/Pretty.hs
+++ b/hs-src/Language/Egison/Pretty.hs
@@ -16,11 +16,11 @@
     , showTSV
     ) where
 
-import           Data.Foldable                           (toList)
-import           Data.List                               (intercalate)
-import           Data.Text.Prettyprint.Doc
-import           Data.Text.Prettyprint.Doc.Render.String (renderString)
-import           Text.Show.Unicode                       (ushow)
+import           Data.Foldable                  (toList)
+import           Data.List                      (intercalate)
+import           Prettyprinter
+import           Prettyprinter.Render.String    (renderString)
+import           Text.Show.Unicode              (ushow)
 
 import           Language.Egison.AST
 import           Language.Egison.Data
diff --git a/hs-src/Language/Egison/Primitives.hs b/hs-src/Language/Egison/Primitives.hs
--- a/hs-src/Language/Egison/Primitives.hs
+++ b/hs-src/Language/Egison/Primitives.hs
@@ -12,7 +12,8 @@
   , primitiveEnvNoIO
   ) where
 
-import           Control.Monad.Except
+import           Control.Monad                     (forM)
+import           Control.Monad.IO.Class            (liftIO)
 
 import           Data.IORef
 
diff --git a/hs-src/Language/Egison/Primitives/IO.hs b/hs-src/Language/Egison/Primitives/IO.hs
--- a/hs-src/Language/Egison/Primitives/IO.hs
+++ b/hs-src/Language/Egison/Primitives/IO.hs
@@ -9,11 +9,11 @@
   ( ioPrimitives
   ) where
 
-import           Control.Monad.Except
+import           Control.Monad.IO.Class           (liftIO)
 
 import           Data.IORef
 
-import           System.IO
+import           System.IO                        hiding (readFile')
 import           System.Process                   (readProcess)
 import           System.Random                    (getStdRandom, randomR)
 
diff --git a/hs-src/Language/Egison/Tensor.hs b/hs-src/Language/Egison/Tensor.hs
--- a/hs-src/Language/Egison/Tensor.hs
+++ b/hs-src/Language/Egison/Tensor.hs
@@ -31,7 +31,8 @@
 
 import           Prelude                    hiding (foldr, mappend, mconcat)
 
-import           Control.Monad.Except       (mzero, throwError, zipWithM)
+import           Control.Monad              (mzero, zipWithM)
+import           Control.Monad.Except       (throwError)
 import           Data.List                  (delete, intersect, partition, (\\))
 import qualified Data.Vector                as V
 
diff --git a/hs-src/Tool/translator.hs b/hs-src/Tool/translator.hs
--- a/hs-src/Tool/translator.hs
+++ b/hs-src/Tool/translator.hs
@@ -3,10 +3,10 @@
 
 module Main where
 
-import           Control.Arrow                         ((***))
-import           Data.Maybe                            (fromJust)
-import           Data.Text.Prettyprint.Doc.Render.Text (putDoc)
-import           System.Environment                    (getArgs)
+import           Control.Arrow              ((***))
+import           Data.Maybe                 (fromJust)
+import           Prettyprinter.Render.Text  (putDoc)
+import           System.Environment         (getArgs)
 
 import           Language.Egison.AST
 import           Language.Egison.Parser                (readUTF8File, removeShebang)
diff --git a/sample/math/geometry/chern-form-of-CP1.egi b/sample/math/geometry/chern-form-of-CP1.egi
new file mode 100644
--- /dev/null
+++ b/sample/math/geometry/chern-form-of-CP1.egi
@@ -0,0 +1,24 @@
+--
+-- This file has been auto-generated by egison-translator.
+--
+
+def params := [|r, θ|]
+
+def u := r * e ^ (2 * π * i * θ)
+
+def ū := r * e ^ ((-2) * π * i * θ)
+
+def d X :=
+  WedgeApplyExpr (ApplyExpr (VarExpr "flip") [VarExpr "\8706/\8706"]) [VarExpr "params",VarExpr "X"]
+
+def ω := ū * d u / 1 + u * ū
+
+ω
+
+def Ω := dfNormalize (d ω)
+
+Ω
+
+def c1 := Ω / ((-2) * π * i)
+
+c1
diff --git a/sample/math/geometry/chern-form-of-CP2.egi b/sample/math/geometry/chern-form-of-CP2.egi
new file mode 100644
--- /dev/null
+++ b/sample/math/geometry/chern-form-of-CP2.egi
@@ -0,0 +1,28 @@
+--
+-- This file has been auto-generated by egison-translator.
+--
+
+def params := [|z1, z2, z1', z2'|]
+
+def params' := [|z1, z2, #, #|]
+
+def params'' := [|#, #, z1', z2'|]
+
+def d X :=
+  WedgeApplyExpr (ApplyExpr (VarExpr "flip") [VarExpr "\8706/\8706"]) [VarExpr "params",VarExpr "X"]
+
+def d' X :=
+  WedgeApplyExpr (ApplyExpr (VarExpr "flip") [VarExpr "\8706/\8706"]) [VarExpr "params'",VarExpr "X"]
+
+def d'' X :=
+  WedgeApplyExpr (ApplyExpr (VarExpr "flip") [VarExpr "\8706/\8706"]) [VarExpr "params''",VarExpr "X"]
+
+def h := 1 + z1 * z1' + z2 * z2'
+
+def ω := d' (log h)
+
+ω
+
+def Ω := d'' ω
+
+Ω
diff --git a/sample/math/geometry/euler-form-of-S2.egi b/sample/math/geometry/euler-form-of-S2.egi
new file mode 100644
--- /dev/null
+++ b/sample/math/geometry/euler-form-of-S2.egi
@@ -0,0 +1,1 @@
+"\"egison\" (line 20, column 12):\nunexpected \"_\"\nexpecting top-level expression"
diff --git a/sample/math/geometry/euler-form-of-T2.egi b/sample/math/geometry/euler-form-of-T2.egi
new file mode 100644
--- /dev/null
+++ b/sample/math/geometry/euler-form-of-T2.egi
@@ -0,0 +1,1 @@
+"\"egison\" (line 20, column 12):\nunexpected \"_\"\nexpecting top-level expression"
diff --git a/sample/math/geometry/exterior-derivative.egi b/sample/math/geometry/exterior-derivative.egi
new file mode 100644
--- /dev/null
+++ b/sample/math/geometry/exterior-derivative.egi
@@ -0,0 +1,18 @@
+--
+-- This file has been auto-generated by egison-translator.
+--
+
+def N := 3
+
+def params := [|x, y, z|]
+
+def g := [|[|1, 0, 0|], [|0, 1, 0|], [|0, 0, 1|]|]
+
+def d X :=
+  WedgeApplyExpr (ApplyExpr (VarExpr "flip") [VarExpr "\8706/\8706"]) [VarExpr "params",VarExpr "X"]
+
+def f := function (x, y, z)
+
+d f
+
+dfNormalize (d (d f))
diff --git a/sample/math/geometry/hodge-E3.egi b/sample/math/geometry/hodge-E3.egi
new file mode 100644
--- /dev/null
+++ b/sample/math/geometry/hodge-E3.egi
@@ -0,0 +1,28 @@
+--
+-- This file has been auto-generated by egison-translator.
+--
+
+def N := 3
+
+def params := [|x, y, z|]
+
+def g := [|[|1, 0, 0|], [|0, 1, 0|], [|0, 0, 1|]|]
+
+def hodge A :=
+  let k := dfOrder A
+   in withSymbols [i, j]
+        sqrt (abs (M.det g_#_#)) *
+        foldl
+          (.)
+          ((ε' N k)_(i_1)..._(i_N) . A..._(j_1)..._(j_k))
+          (map 1#g~(i_%1)~(j_%1) (between 1 k))
+
+def dx := [|1, 0, 0|]
+
+def dy := [|0, 1, 0|]
+
+def dz := [|0, 0, 1|]
+
+hodge dx
+
+hodge (wedge dx dy)
diff --git a/sample/math/geometry/hodge-Minkowski.egi b/sample/math/geometry/hodge-Minkowski.egi
new file mode 100644
--- /dev/null
+++ b/sample/math/geometry/hodge-Minkowski.egi
@@ -0,0 +1,30 @@
+--
+-- This file has been auto-generated by egison-translator.
+--
+
+def N := 4
+
+def params := [|t, x, y, z|]
+
+def g := [|[|-1, 0, 0, 0|], [|0, 1, 0, 0|], [|0, 0, 1, 0|], [|0, 0, 0, 1|]|]
+
+def hodge A :=
+  let k := dfOrder A
+   in withSymbols [i, j]
+        sqrt (abs (M.det g_#_#)) *
+        foldl
+          (.)
+          ((ε' N k)_(i_1)..._(i_N) . A..._(j_1)..._(j_k))
+          (map 1#g~(i_%1)~(j_%1) (between 1 k))
+
+def dt := [|1, 0, 0, 0|]
+
+def dx := [|0, 1, 0, 0|]
+
+def dy := [|0, 0, 1, 0|]
+
+def dz := [|0, 0, 0, 1|]
+
+hodge (wedge dt dx)
+
+hodge (wedge dy dz)
diff --git a/sample/math/geometry/hodge-laplacian-spherical.egi b/sample/math/geometry/hodge-laplacian-spherical.egi
new file mode 100644
--- /dev/null
+++ b/sample/math/geometry/hodge-laplacian-spherical.egi
@@ -0,0 +1,1 @@
+"\"egison\" (line 7, column 12):\nunexpected \"_\"\nexpecting top-level expression"
diff --git a/sample/math/geometry/polar-laplacian-2d-2.egi b/sample/math/geometry/polar-laplacian-2d-2.egi
new file mode 100644
--- /dev/null
+++ b/sample/math/geometry/polar-laplacian-2d-2.egi
@@ -0,0 +1,1 @@
+"\"egison\" (line 23, column 12):\nunexpected \"_\"\nexpecting top-level expression"
diff --git a/sample/math/geometry/polar-laplacian-2d-3.egi b/sample/math/geometry/polar-laplacian-2d-3.egi
new file mode 100644
--- /dev/null
+++ b/sample/math/geometry/polar-laplacian-2d-3.egi
@@ -0,0 +1,1 @@
+"\"egison\" (line 23, column 12):\nunexpected \"_\"\nexpecting top-level expression"
diff --git a/sample/math/geometry/polar-laplacian-2d.egi b/sample/math/geometry/polar-laplacian-2d.egi
new file mode 100644
--- /dev/null
+++ b/sample/math/geometry/polar-laplacian-2d.egi
@@ -0,0 +1,27 @@
+--
+-- This file has been auto-generated by egison-translator.
+--
+
+def x := r * cos θ
+
+def y := r * sin θ
+
+def uR := ∂/∂ (u x y) r
+
+uR
+
+def uRR := ∂/∂ (∂/∂ (u x y) r) r
+
+uRR
+
+def uΘ := ∂/∂ (u x y) θ
+
+uΘ
+
+def uΘΘ := ∂/∂ (∂/∂ (u x y) θ) θ
+
+uΘΘ
+
+uRR + 1 / r ^ 2 * uΘΘ
+
+uRR + 1 / r * uR + 1 / r ^ 2 * uΘΘ
diff --git a/sample/math/geometry/polar-laplacian-3d-2.egi b/sample/math/geometry/polar-laplacian-3d-2.egi
new file mode 100644
--- /dev/null
+++ b/sample/math/geometry/polar-laplacian-3d-2.egi
@@ -0,0 +1,1 @@
+"\"egison\" (line 26, column 12):\nunexpected \"_\"\nexpecting top-level expression"
diff --git a/sample/math/geometry/polar-laplacian-3d-3.egi b/sample/math/geometry/polar-laplacian-3d-3.egi
new file mode 100644
--- /dev/null
+++ b/sample/math/geometry/polar-laplacian-3d-3.egi
@@ -0,0 +1,1 @@
+"\"egison\" (line 26, column 12):\nunexpected \"_\"\nexpecting top-level expression"
diff --git a/sample/math/geometry/polar-laplacian-3d.egi b/sample/math/geometry/polar-laplacian-3d.egi
new file mode 100644
--- /dev/null
+++ b/sample/math/geometry/polar-laplacian-3d.egi
@@ -0,0 +1,36 @@
+--
+-- This file has been auto-generated by egison-translator.
+--
+
+def x := r * sin θ * cos φ
+
+def y := r * sin θ * sin φ
+
+def z := r * cos θ
+
+def uR := ∂/∂ (u x y z) r
+
+uR
+
+def uRR := ∂/∂ (∂/∂ (u x y z) r) r
+
+uRR
+
+def uΘ := ∂/∂ (u x y z) θ
+
+uΘ
+
+def uΘΘ := ∂/∂ (∂/∂ (u x y z) θ) θ
+
+uΘΘ
+
+def uΦ := ∂/∂ (u x y z) φ
+
+uΦ
+
+def uΦΦ := ∂/∂ (∂/∂ (u x y z) φ) φ
+
+uΦΦ
+
+uRR + 2 / r * uR + 1 / r ^ 2 * uΘΘ + cos θ / (r ^ 2 * sin θ) * uΘ +
+1 / (r * sin θ) ^ 2 * uΦΦ
diff --git a/sample/math/geometry/riemann-curvature-tensor-of-FLRW-metric.egi b/sample/math/geometry/riemann-curvature-tensor-of-FLRW-metric.egi
new file mode 100644
--- /dev/null
+++ b/sample/math/geometry/riemann-curvature-tensor-of-FLRW-metric.egi
@@ -0,0 +1,1 @@
+"\"egison\" (line 13, column 12):\nunexpected \"_\"\nexpecting top-level expression"
diff --git a/sample/math/geometry/riemann-curvature-tensor-of-S2xS3.egi b/sample/math/geometry/riemann-curvature-tensor-of-S2xS3.egi
new file mode 100644
--- /dev/null
+++ b/sample/math/geometry/riemann-curvature-tensor-of-S2xS3.egi
@@ -0,0 +1,1 @@
+"\"egison\" (line 11, column 12):\nunexpected \"_\"\nexpecting top-level expression"
diff --git a/sample/math/geometry/riemann-curvature-tensor-of-S3.egi b/sample/math/geometry/riemann-curvature-tensor-of-S3.egi
new file mode 100644
--- /dev/null
+++ b/sample/math/geometry/riemann-curvature-tensor-of-S3.egi
@@ -0,0 +1,1 @@
+"\"egison\" (line 27, column 12):\nunexpected \"_\"\nexpecting top-level expression"
diff --git a/sample/math/geometry/riemann-curvature-tensor-of-S4.egi b/sample/math/geometry/riemann-curvature-tensor-of-S4.egi
new file mode 100644
--- /dev/null
+++ b/sample/math/geometry/riemann-curvature-tensor-of-S4.egi
@@ -0,0 +1,1 @@
+"\"egison\" (line 29, column 12):\nunexpected \"_\"\nexpecting top-level expression"
diff --git a/sample/math/geometry/riemann-curvature-tensor-of-S7.egi b/sample/math/geometry/riemann-curvature-tensor-of-S7.egi
new file mode 100644
--- /dev/null
+++ b/sample/math/geometry/riemann-curvature-tensor-of-S7.egi
@@ -0,0 +1,1 @@
+"\"egison\" (line 28, column 12):\nunexpected \"_\"\nexpecting top-level expression"
diff --git a/sample/math/geometry/riemann-curvature-tensor-of-Schwarzschild-metric.egi b/sample/math/geometry/riemann-curvature-tensor-of-Schwarzschild-metric.egi
new file mode 100644
--- /dev/null
+++ b/sample/math/geometry/riemann-curvature-tensor-of-Schwarzschild-metric.egi
@@ -0,0 +1,1 @@
+"\"egison\" (line 11, column 12):\nunexpected \"_\"\nexpecting top-level expression"
diff --git a/sample/math/geometry/surface.egi b/sample/math/geometry/surface.egi
new file mode 100644
--- /dev/null
+++ b/sample/math/geometry/surface.egi
@@ -0,0 +1,58 @@
+def v1 := [|1, 0, ∂/∂ (f x y) x|]
+
+def v2 := [|0, 1, ∂/∂ (f x y) y|]
+
+v1
+-- [| 1, 0, f|1 x y |]
+
+v2
+-- [| 0, 1, f|2 x y |]
+
+def v3 := crossProduct v1 v2
+
+v3
+-- [| - f|1 x y, - f|2 x y, 1 |]
+
+def e3 := v3 / sqrt '(V.* v3 v3)
+
+e3
+-- [| - f|1 x y / sqrt ((f|1 x y)^2 + (f|2 x y)^2 + 1), - f|2 x y / sqrt ((f|1 x y)^2 + (f|2 x y)^2 + 1), 1 / sqrt ((f|1 x y)^2 + (f|2 x y)^2 + 1) |]
+
+def E := V.* v1 v1
+
+def F := V.* v1 v2
+
+def G := V.* v2 v2
+
+E
+-- 1 + (f|1 x y)^2
+
+F
+-- f|1 x y * f|2 x y
+
+G
+-- 1 + (f|2 x y)^2
+
+def L := V.* (∂/∂ v1 x) e3
+
+def M := V.* (∂/∂ v1 y) e3
+
+def N := V.* (∂/∂ v2 y) e3
+
+L
+-- f|1|1 x y / sqrt ((f|1 x y)^2 + (f|2 x y)^2 + 1)
+
+M
+-- f|1|2 x y / sqrt ((f|1 x y)^2 + (f|2 x y)^2 + 1)
+
+N
+-- f|2|2 x y / sqrt ((f|1 x y)^2 + (f|2 x y)^2 + 1)
+
+def K := (L * N - M ^ 2) / '(E * G - F ^ 2)
+
+def H := ('E * N + 'G * L + (-2) * F * M) / 2 * '(E * G - F ^ 2)
+
+K
+-- (f|1|1 x y * f|2|2 x y * (f|1 x y)^2 + f|1|1 x y * f|2|2 x y * (f|2 x y)^2 + f|1|1 x y * f|2|2 x y - (f|1|2 x y)^2 * (f|1 x y)^2 - (f|1|2 x y)^2 * (f|2 x y)^2 - (f|1|2 x y)^2) / (3 * (f|1 x y)^4 + 3 * (f|1 x y)^4 * (f|2 x y)^2 + (f|1 x y)^6 + 6 * (f|1 x y)^2 * (f|2 x y)^2 + 3 * (f|1 x y)^2 * (f|2 x y)^4 + 3 * (f|1 x y)^2 + 3 * (f|2 x y)^4 + (f|2 x y)^6 + 3 * (f|2 x y)^2 + 1)
+H
+-- (f|2|2 x y + f|2|2 x y * (f|2 x y)^2 + 2 * f|2|2 x y * (f|1 x y)^2 + (f|1 x y)^2 * f|2|2 x y * (f|2 x y)^2 + (f|1 x y)^4 * f|2|2 x y + f|1|1 x y + 2 * f|1|1 x y * (f|2 x y)^2 + f|1|1 x y * (f|1 x y)^2 + (f|2 x y)^4 * f|1|1 x y + (f|2 x y)^2 * f|1|1 x y * (f|1 x y)^2 - 2 * f|1 x y * f|2 x y * f|1|2 x y - 2 * f|1 x y * (f|2 x y)^3 * f|1|2 x y - 2 * (f|1 x y)^3 * f|2 x y * f|1|2 x y) / (2 * sqrt ((f|1 x y)^2 + (f|2 x y)^2 + 1))
diff --git a/sample/math/geometry/wedge-product.egi b/sample/math/geometry/wedge-product.egi
new file mode 100644
--- /dev/null
+++ b/sample/math/geometry/wedge-product.egi
@@ -0,0 +1,25 @@
+--
+-- This file has been auto-generated by egison-translator.
+--
+
+def N := 3
+
+def params := [|x, y, z|]
+
+def g := [|[|1, 0, 0|], [|0, 1, 0|], [|0, 0, 1|]|]
+
+def wedge X Y := X !. Y
+
+def dx := [|1, 0, 0|]
+
+def dy := [|0, 1, 0|]
+
+def dz := [|0, 0, 1|]
+
+wedge dx dy
+
+dfNormalize (wedge dx dy)
+
+wedge dz dz
+
+dfNormalize (wedge dz dz)
diff --git a/sample/math/geometry/yang-mills-equation-of-U1-gauge-theory.egi b/sample/math/geometry/yang-mills-equation-of-U1-gauge-theory.egi
new file mode 100644
--- /dev/null
+++ b/sample/math/geometry/yang-mills-equation-of-U1-gauge-theory.egi
@@ -0,0 +1,47 @@
+--
+-- This file has been auto-generated by egison-translator.
+--
+
+def N := 4
+
+def g := [|[|-1, 0, 0, 0|], [|0, 1, 0, 0|], [|0, 0, 1, 0|], [|0, 0, 0, 1|]|]
+
+def d X :=
+  WedgeApplyExpr (ApplyExpr (VarExpr "flip") [VarExpr "\8706/\8706"]) [VectorExpr [VarExpr "t",VarExpr "x",VarExpr "y",VarExpr "z"],VarExpr "X"]
+
+def hodge A :=
+  let k := dfOrder A
+   in withSymbols [i, j]
+        sqrt (abs (M.det g_#_#)) *
+        foldl
+          (.)
+          ((ε' N k)_(i_1)..._(i_N) . A..._(j_1)..._(j_k))
+          (map 1#g~(i_%1)~(j_%1) (between 1 k))
+
+def δ A :=
+  let r := dfOrder A
+   in (-1) ^ (N * r + 1) * hodge (d (hodge A))
+
+def Δ A :=
+  match dfrOrder A as integer with
+    | #0 -> δ (d A)
+    | #4 -> d (δ A)
+    | _ -> d (δ A) + δ (d A)
+
+def normalize2 A := withSymbols [t1, t2] A_t1_t2 - A_t2_t1
+
+hodge (wedge [|1, 0, 0, 0|] [|0, 1, 0, 0|])
+
+hodge (wedge [|0, 0, 1, 0|] [|0, 0, 0, 1|])
+
+dfNormalize (d [|φ t x y z, Ax t x y z, Ay t x y z, Az t x y z|])
+
+def F :=
+  [|[|0, Ex t x y z, Ey t x y z, Ez t x y z|]
+  , [|- Ex t x y z, 0, Bz t x y z, - By t x y z|]
+  , [|- Ey t x y z, - Bz t x y z, 0, Bx t x y z|]
+  , [|- Ez t x y z, By t x y z, - Bx t x y z, 0|]|]
+
+hodge (d F)
+
+δ F
diff --git a/sample/math/number/eisenstein-primes.egi b/sample/math/number/eisenstein-primes.egi
new file mode 100644
--- /dev/null
+++ b/sample/math/number/eisenstein-primes.egi
@@ -0,0 +1,46 @@
+map (\(x, y) -> (x + y * w, (x + y * w) * (x + y * w ^ 2)))
+    (matchAll take 10 nats as set integer with
+      | $x :: $y :: _ -> (x, y))
+
+[(1 + w, 1), (1 + 2 * w, 3), (2 + w, 3), (1 + 3 * w, 7), (2 + 2 * w, 4),
+ (3 + w, 7), (1 + 4 * w, 13), (2 + 3 * w, 7), (3 + 2 * w, 7), (4 + w, 13),
+ (1 + 5 * w, 21), (2 + 4 * w, 12), (3 + 3 * w, 9), (4 + 2 * w, 12), (5 + w, 21),
+ (1 + 6 * w, 31), (2 + 5 * w, 19), (3 + 4 * w, 13), (4 + 3 * w, 13),
+ (5 + 2 * w, 19), (6 + w, 31), (1 + 7 * w, 43), (2 + 6 * w, 28),
+ (3 + 5 * w, 19), (4 + 4 * w, 16), (5 + 3 * w, 19), (6 + 2 * w, 28),
+ (7 + w, 43), (1 + 8 * w, 57), (2 + 7 * w, 39), (3 + 6 * w, 27),
+ (4 + 5 * w, 21), (5 + 4 * w, 21), (6 + 3 * w, 27), (7 + 2 * w, 39),
+ (8 + w, 57), (1 + 9 * w, 73), (2 + 8 * w, 52), (3 + 7 * w, 37),
+ (4 + 6 * w, 28), (5 + 5 * w, 25), (6 + 4 * w, 28), (7 + 3 * w, 37),
+ (8 + 2 * w, 52), (9 + w, 73), (1 + 10 * w, 91), (2 + 9 * w, 67),
+ (3 + 8 * w, 49), (4 + 7 * w, 37), (5 + 6 * w, 31), (6 + 5 * w, 31),
+ (7 + 4 * w, 37), (8 + 3 * w, 49), (9 + 2 * w, 67), (10 + w, 91),
+ (2 + 10 * w, 84), (3 + 9 * w, 63), (4 + 8 * w, 48), (5 + 7 * w, 39),
+ (6 + 6 * w, 36), (7 + 5 * w, 39), (8 + 4 * w, 48), (9 + 3 * w, 63),
+ (10 + 2 * w, 84), (3 + 10 * w, 79), (4 + 9 * w, 61), (5 + 8 * w, 49),
+ (6 + 7 * w, 43), (7 + 6 * w, 43), (8 + 5 * w, 49), (9 + 4 * w, 61),
+ (10 + 3 * w, 79), (4 + 10 * w, 76), (5 + 9 * w, 61), (6 + 8 * w, 52),
+ (7 + 7 * w, 49), (8 + 6 * w, 52), (9 + 5 * w, 61), (10 + 4 * w, 76),
+ (5 + 10 * w, 75), (6 + 9 * w, 63), (7 + 8 * w, 57), (8 + 7 * w, 57),
+ (9 + 6 * w, 63), (10 + 5 * w, 75), (6 + 10 * w, 76), (7 + 9 * w, 67),
+ (8 + 8 * w, 64), (9 + 7 * w, 67), (10 + 6 * w, 76), (7 + 10 * w, 79),
+ (8 + 9 * w, 73), (9 + 8 * w, 73), (10 + 7 * w, 79), (8 + 10 * w, 84),
+ (9 + 9 * w, 81), (10 + 8 * w, 84), (9 + 10 * w, 91), (10 + 9 * w, 91),
+ (10 + 10 * w, 100)]
+
+filter
+  (\(_, n) -> isPrime n)
+  (map (\(x, y) -> (x + y * w, (x + y * w) * (x + y * w ^ 2)))
+       (matchAll take 10 nats as set integer with
+         | $x :: $y :: _ -> (x, y)))
+
+[(1 + 2 * w, 3), (2 + w, 3), (1 + 3 * w, 7), (3 + w, 7),
+ (1 + 4 * w, 13), (2 + 3 * w, 7), (3 + 2 * w, 7), (4 + w, 13), (1 + 6 * w, 31),
+ (2 + 5 * w, 19), (3 + 4 * w, 13), (4 + 3 * w, 13), (5 + 2 * w, 19),
+ (6 + w, 31), (1 + 7 * w, 43), (3 + 5 * w, 19), (5 + 3 * w, 19), (7 + w, 43),
+ (1 + 9 * w, 73), (3 + 7 * w, 37), (7 + 3 * w, 37), (9 + w, 73),
+ (2 + 9 * w, 67), (4 + 7 * w, 37), (5 + 6 * w, 31), (6 + 5 * w, 31),
+ (7 + 4 * w, 37), (9 + 2 * w, 67), (3 + 10 * w, 79), (4 + 9 * w, 61),
+ (6 + 7 * w, 43), (7 + 6 * w, 43), (9 + 4 * w, 61), (10 + 3 * w, 79),
+ (5 + 9 * w, 61), (9 + 5 * w, 61), (7 + 9 * w, 67), (9 + 7 * w, 67),
+ (7 + 10 * w, 79), (8 + 9 * w, 73), (9 + 8 * w, 73), (10 + 7 * w, 79)]
diff --git a/sample/math/number/euler-totient-function.egi b/sample/math/number/euler-totient-function.egi
new file mode 100644
--- /dev/null
+++ b/sample/math/number/euler-totient-function.egi
@@ -0,0 +1,36 @@
+def φ $n := n * product (map (\$p -> 1 - 1 / p) (unique (pF n)))
+
+take 100 (map2 2#(%1, %2, pF %2) nats (map φ nats))
+
+[(1, 1, []), (2, 1, []), (3, 2, [2]), (4, 2, [2]), (5, 4, [2, 2]), (6, 2, [2]),
+ (7, 6, [2, 3]), (8, 4, [2, 2]), (9, 6, [2, 3]), (10, 4, [2, 2]),
+ (11, 10, [2, 5]), (12, 4, [2, 2]), (13, 12, [2, 2, 3]), (14, 6, [2, 3]),
+ (15, 8, [2, 2, 2]), (16, 8, [2, 2, 2]), (17, 16, [2, 2, 2, 2]),
+ (18, 6, [2, 3]), (19, 18, [2, 3, 3]), (20, 8, [2, 2, 2]), (21, 12, [2, 2, 3]),
+ (22, 10, [2, 5]), (23, 22, [2, 11]), (24, 8, [2, 2, 2]), (25, 20, [2, 2, 5]),
+ (26, 12, [2, 2, 3]), (27, 18, [2, 3, 3]), (28, 12, [2, 2, 3]),
+ (29, 28, [2, 2, 7]), (30, 8, [2, 2, 2]), (31, 30, [2, 3, 5]),
+ (32, 16, [2, 2, 2, 2]), (33, 20, [2, 2, 5]), (34, 16, [2, 2, 2, 2]),
+ (35, 24, [2, 2, 2, 3]), (36, 12, [2, 2, 3]), (37, 36, [2, 2, 3, 3]),
+ (38, 18, [2, 3, 3]), (39, 24, [2, 2, 2, 3]), (40, 16, [2, 2, 2, 2]),
+ (41, 40, [2, 2, 2, 5]), (42, 12, [2, 2, 3]), (43, 42, [2, 3, 7]),
+ (44, 20, [2, 2, 5]), (45, 24, [2, 2, 2, 3]), (46, 22, [2, 11]),
+ (47, 46, [2, 23]), (48, 16, [2, 2, 2, 2]), (49, 42, [2, 3, 7]),
+ (50, 20, [2, 2, 5]), (51, 32, [2, 2, 2, 2, 2]), (52, 24, [2, 2, 2, 3]),
+ (53, 52, [2, 2, 13]), (54, 18, [2, 3, 3]), (55, 40, [2, 2, 2, 5]),
+ (56, 24, [2, 2, 2, 3]), (57, 36, [2, 2, 3, 3]), (58, 28, [2, 2, 7]),
+ (59, 58, [2, 29]), (60, 16, [2, 2, 2, 2]), (61, 60, [2, 2, 3, 5]),
+ (62, 30, [2, 3, 5]), (63, 36, [2, 2, 3, 3]), (64, 32, [2, 2, 2, 2, 2]),
+ (65, 48, [2, 2, 2, 2, 3]), (66, 20, [2, 2, 5]), (67, 66, [2, 3, 11]),
+ (68, 32, [2, 2, 2, 2, 2]), (69, 44, [2, 2, 11]), (70, 24, [2, 2, 2, 3]),
+ (71, 70, [2, 5, 7]), (72, 24, [2, 2, 2, 3]), (73, 72, [2, 2, 2, 3, 3]),
+ (74, 36, [2, 2, 3, 3]), (75, 40, [2, 2, 2, 5]), (76, 36, [2, 2, 3, 3]),
+ (77, 60, [2, 2, 3, 5]), (78, 24, [2, 2, 2, 3]), (79, 78, [2, 3, 13]),
+ (80, 32, [2, 2, 2, 2, 2]), (81, 54, [2, 3, 3, 3]), (82, 40, [2, 2, 2, 5]),
+ (83, 82, [2, 41]), (84, 24, [2, 2, 2, 3]), (85, 64, [2, 2, 2, 2, 2, 2]),
+ (86, 42, [2, 3, 7]), (87, 56, [2, 2, 2, 7]), (88, 40, [2, 2, 2, 5]),
+ (89, 88, [2, 2, 2, 11]), (90, 24, [2, 2, 2, 3]), (91, 72, [2, 2, 2, 3, 3]),
+ (92, 44, [2, 2, 11]), (93, 60, [2, 2, 3, 5]), (94, 46, [2, 23]),
+ (95, 72, [2, 2, 2, 3, 3]), (96, 32, [2, 2, 2, 2, 2]),
+ (97, 96, [2, 2, 2, 2, 2, 3]), (98, 42, [2, 3, 7]), (99, 60, [2, 2, 3, 5]),
+ (100, 40, [2, 2, 2, 5])]
diff --git a/sample/math/number/gaussian-primes.egi b/sample/math/number/gaussian-primes.egi
new file mode 100644
--- /dev/null
+++ b/sample/math/number/gaussian-primes.egi
@@ -0,0 +1,44 @@
+map (\(x, y) -> (x + y * i, (x + y * i) * (x - y * i)))
+    (matchAll take 10 nats as set integer with
+      | $x :: $y :: _ -> (x, y))
+
+[(1 + i, 2), (1 + 2 * i, 5), (2 + i, 5), (1 + 3 * i, 10), (2 + 2 * i, 8),
+ (3 + i, 10), (1 + 4 * i, 17), (2 + 3 * i, 13), (3 + 2 * i, 13), (4 + i, 17),
+ (1 + 5 * i, 26), (2 + 4 * i, 20), (3 + 3 * i, 18), (4 + 2 * i, 20),
+ (5 + i, 26), (1 + 6 * i, 37), (2 + 5 * i, 29), (3 + 4 * i, 25),
+ (4 + 3 * i, 25), (5 + 2 * i, 29), (6 + i, 37), (1 + 7 * i, 50),
+ (2 + 6 * i, 40), (3 + 5 * i, 34), (4 + 4 * i, 32), (5 + 3 * i, 34),
+ (6 + 2 * i, 40), (7 + i, 50), (1 + 8 * i, 65), (2 + 7 * i, 53),
+ (3 + 6 * i, 45), (4 + 5 * i, 41), (5 + 4 * i, 41), (6 + 3 * i, 45),
+ (7 + 2 * i, 53), (8 + i, 65), (1 + 9 * i, 82), (2 + 8 * i, 68),
+ (3 + 7 * i, 58), (4 + 6 * i, 52), (5 + 5 * i, 50), (6 + 4 * i, 52),
+ (7 + 3 * i, 58), (8 + 2 * i, 68), (9 + i, 82), (1 + 10 * i, 101),
+ (2 + 9 * i, 85), (3 + 8 * i, 73), (4 + 7 * i, 65), (5 + 6 * i, 61),
+ (6 + 5 * i, 61), (7 + 4 * i, 65), (8 + 3 * i, 73), (9 + 2 * i, 85),
+ (10 + i, 101), (2 + 10 * i, 104), (3 + 9 * i, 90), (4 + 8 * i, 80),
+ (5 + 7 * i, 74), (6 + 6 * i, 72), (7 + 5 * i, 74), (8 + 4 * i, 80),
+ (9 + 3 * i, 90), (10 + 2 * i, 104), (3 + 10 * i, 109), (4 + 9 * i, 97),
+ (5 + 8 * i, 89), (6 + 7 * i, 85), (7 + 6 * i, 85), (8 + 5 * i, 89),
+ (9 + 4 * i, 97), (10 + 3 * i, 109), (4 + 10 * i, 116), (5 + 9 * i, 106),
+ (6 + 8 * i, 100), (7 + 7 * i, 98), (8 + 6 * i, 100), (9 + 5 * i, 106),
+ (10 + 4 * i, 116), (5 + 10 * i, 125), (6 + 9 * i, 117), (7 + 8 * i, 113),
+ (8 + 7 * i, 113), (9 + 6 * i, 117), (10 + 5 * i, 125), (6 + 10 * i, 136),
+ (7 + 9 * i, 130), (8 + 8 * i, 128), (9 + 7 * i, 130), (10 + 6 * i, 136),
+ (7 + 10 * i, 149), (8 + 9 * i, 145), (9 + 8 * i, 145), (10 + 7 * i, 149),
+ (8 + 10 * i, 164), (9 + 9 * i, 162), (10 + 8 * i, 164), (9 + 10 * i, 181),
+ (10 + 9 * i, 181), (10 + 10 * i, 200)]
+
+filter
+  (\(_, n) -> isPrime n)
+  (map (\(x, y) -> (x + y * i, (x + y * i) * (x - y * i)))
+       (matchAll take 10 nats as set integer with
+         | $x :: $y :: _ -> (x, y)))
+
+[(1 + i, 2), (1 + 2 * i, 5), (2 + i, 5), (1 + 4 * i, 17), (2 + 3 * i, 13),
+ (3 + 2 * i, 13), (4 + i, 17), (1 + 6 * i, 37), (2 + 5 * i, 29),
+ (5 + 2 * i, 29), (6 + i, 37), (2 + 7 * i, 53), (4 + 5 * i, 41),
+ (5 + 4 * i, 41), (7 + 2 * i, 53), (1 + 10 * i, 101), (3 + 8 * i, 73),
+ (5 + 6 * i, 61), (6 + 5 * i, 61), (8 + 3 * i, 73), (10 + i, 101),
+ (3 + 10 * i, 109), (4 + 9 * i, 97), (5 + 8 * i, 89), (8 + 5 * i, 89),
+ (9 + 4 * i, 97), (10 + 3 * i, 109), (7 + 8 * i, 113), (8 + 7 * i, 113),
+ (7 + 10 * i, 149), (10 + 7 * i, 149), (9 + 10 * i, 181), (10 + 9 * i, 181)]
