G2 performs lazy symbolic execution of Haskell programs to detect state reachability. It is capable of generating assertion failure counterexamples and solving for higher-order functions.
bash base_setup.sh.cabal run G2 ./tests/Samples/Peano.hs add
cabal run G2LH ./tests/Liquid/Peano.hs add
--n number of reduction steps to run--max-outputs number of inputs/results to display--smt Pass "z3" or "cvc5" to select a solver [Default: Z3]--time Set a timeout in secondsRunning G2 on code in cabal packages can be done by means of a plugin. To do this:
package *
ghc-options: -fexpose-all-unfoldings
this instructs GHC to make the Core of every function from every package available, which is needed to symbolically execute code in dependencies.
ghc-options: -fplugin=G2.Plugin -fplugin-opt=G2.Plugin:[Optionally, arguments for G2 here]
to the project's cabal file.
{-# ANN f SymEx #-}
f :: MyInt -> Int -> Int
{-# ANN recCall (SymExWithConfig "--n 10000") #-}
recCall :: Int -> Int
After following these steps, building the project will symbolically execute f and recCall.
recCall will be executed according to the command line arguments passed in SymExWithConfig.
Haskell
83.2%
SMT
13.9%
Python
2.9%
G2 performs lazy symbolic execution of Haskell programs to detect state reachability. It is capable of generating assertion failure counterexamples and solving for higher-order functions.
bash base_setup.sh.cabal run G2 ./tests/Samples/Peano.hs add
cabal run G2LH ./tests/Liquid/Peano.hs add
--n number of reduction steps to run--max-outputs number of inputs/results to display--smt Pass "z3" or "cvc5" to select a solver [Default: Z3]--time Set a timeout in secondsRunning G2 on code in cabal packages can be done by means of a plugin. To do this:
package *
ghc-options: -fexpose-all-unfoldings
this instructs GHC to make the Core of every function from every package available, which is needed to symbolically execute code in dependencies.
ghc-options: -fplugin=G2.Plugin -fplugin-opt=G2.Plugin:[Optionally, arguments for G2 here]
to the project's cabal file.
{-# ANN f SymEx #-}
f :: MyInt -> Int -> Int
{-# ANN recCall (SymExWithConfig "--n 10000") #-}
recCall :: Int -> Int
After following these steps, building the project will symbolically execute f and recCall.
recCall will be executed according to the command line arguments passed in SymExWithConfig.
Haskell
83.2%
SMT
13.9%
Python
2.9%