Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/src/equiv.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ act equiv --spec <PATH_TO_SPEC> --code <RUNTIME_BYTECODE> --initcode <CONSTR_BYT
| `--solver` | `cvc5\|z3\|bitwuzla` | `cvc5` | SMT solver to use for verification |
| `--smttimeout` | Integer (ms) | `20000` | Timeout for each SMT query in milliseconds |
| `--debug` | Boolean | `false` | Print verbose output including raw SMT queries |
| `--numsolvers` | Integer | number of cores | Number of solver instances to run in parallel |

<!-- | `--code` | ByteString | - | Runtime bytecode (hexadecimal) for direct verification | -->
<!-- | `--initcode` | ByteString | - | Constructor bytecode (hexadecimal) | -->
Expand Down
13 changes: 8 additions & 5 deletions src/Act/CLI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ data Command w
, solver :: w ::: Maybe Text <?> "SMT solver: cvc5 (default) or z3"
, smttimeout :: w ::: Maybe Integer <?> "Timeout given to SMT solver in milliseconds (default: 20000)"
, debug :: w ::: Bool <?> "Print verbose SMT output (default: False)"
, numsolvers :: w ::: Maybe Int <?> "Number of solver instances to run in parallel (default: number of cores)"
}
deriving (Generic)

Expand Down Expand Up @@ -132,9 +133,9 @@ main = do
Lean f jsn solver' smttimeout' debug' -> do
solver'' <- parseSolver solver'
lean' f jsn solver'' smttimeout' debug'
Equiv spec' sol' vy' code' initcode' layout' sources' solver' smttimeout' debug' -> do
Equiv spec' sol' vy' code' initcode' layout' sources' solver' smttimeout' debug' numsolvers' -> do
solver'' <- parseSolver solver'
equivCheck spec' sol' vy' code' initcode' layout' sources' solver'' smttimeout' debug'
equivCheck spec' sol' vy' code' initcode' layout' sources' solver'' smttimeout' debug' numsolvers'


---------------------------------
Expand Down Expand Up @@ -199,10 +200,12 @@ lean' f jsn solver' smttimeout' debug' = do
TIO.putStr $ lean spec'


equivCheck :: Maybe FilePath -> Maybe FilePath -> Maybe FilePath -> Maybe String -> Maybe String -> Maybe String -> Maybe FilePath -> Solvers.Solver -> Maybe Integer -> Bool -> IO ()
equivCheck actspec sol' vy' code' initcode' layout' sources' solver' timeout debug' = do
equivCheck :: Maybe FilePath -> Maybe FilePath -> Maybe FilePath -> Maybe String -> Maybe String -> Maybe String -> Maybe FilePath -> Solvers.Solver -> Maybe Integer -> Bool -> Maybe Int -> IO ()
equivCheck actspec sol' vy' code' initcode' layout' sources' solver' timeout debug' numsolvers' = do
let config = if debug' then debugActConfig else defaultActConfig
cores <- liftM fromIntegral getNumProcessors
cores <- case numsolvers' of
Just n | n > 0 -> pure (fromIntegral n)
_ -> liftM fromIntegral getNumProcessors
(actspecs, inputsMap) <- processEquivSources sources' actspec sol' vy' code' initcode' layout'
specsContents <- flip zip actspecs <$> mapM readFile actspecs
proceed specsContents (compile specsContents) $ \(Act store contracts, constraints) -> do
Expand Down
Loading