@@ -56,6 +56,7 @@ import Options.Applicative
56
56
, value
57
57
)
58
58
import qualified Options.Applicative as Options
59
+ import qualified Options.Applicative.Help.Pretty as OptPretty
59
60
import System.Clock
60
61
( Clock (Monotonic )
61
62
, TimeSpec
@@ -82,7 +83,6 @@ import System.IO
82
83
, withFile
83
84
)
84
85
85
- import qualified Data.Limit as Limit
86
86
import Kore.Attribute.Symbol as Attribute
87
87
import Kore.BugReport
88
88
import Kore.Exec
@@ -148,9 +148,6 @@ import Kore.Reachability
148
148
import qualified Kore.Reachability.Claim as Claim
149
149
import Kore.Rewriting.RewritingVariable
150
150
import Kore.Step
151
- import Kore.Step.RulePattern
152
- ( RewriteRule
153
- )
154
151
import Kore.Step.Search
155
152
( SearchType (.. )
156
153
)
@@ -268,9 +265,6 @@ applyKoreSearchOptions Nothing koreExecOpts = koreExecOpts
268
265
applyKoreSearchOptions koreSearchOptions@ (Just koreSearchOpts) koreExecOpts =
269
266
koreExecOpts
270
267
{ koreSearchOptions
271
- , strategy =
272
- -- Search relies on exploring the entire space of states.
273
- (" all" , priorityAllStrategy)
274
268
, depthLimit = min depthLimit searchTypeDepthLimit
275
269
}
276
270
where
@@ -293,7 +287,7 @@ data KoreExecOptions = KoreExecOptions
293
287
-- ^ The name of the main module in the definition
294
288
, breadthLimit :: ! (Limit Natural )
295
289
, depthLimit :: ! (Limit Natural )
296
- , strategy :: ! ( String , [ RewriteRule RewritingVariableName ] -> Strategy ( Prim ( RewriteRule RewritingVariableName )))
290
+ , strategy :: ! ExecutionMode
297
291
, koreSolverOptions :: ! KoreSolverOptions
298
292
, koreLogOptions :: ! KoreLogOptions
299
293
, koreSearchOptions :: ! (Maybe KoreSearchOptions )
@@ -346,17 +340,12 @@ parseKoreExecOptions startTime =
346
340
parseBreadthLimit = Limit <$> breadth <|> pure Unlimited
347
341
parseDepthLimit = Limit <$> depth <|> pure Unlimited
348
342
parseStrategy =
349
- option (readSum " strategy " strategies)
343
+ option parseExecutionMode
350
344
( metavar " STRATEGY"
351
345
<> long " strategy"
352
- <> value ( " all " , priorityAllStrategy)
346
+ <> value All
353
347
<> help " Select rewrites using STRATEGY."
354
348
)
355
- where
356
- strategies =
357
- [ (" any" , priorityAnyStrategy)
358
- , (" all" , priorityAllStrategy)
359
- ]
360
349
361
350
breadth =
362
351
option auto
@@ -384,6 +373,20 @@ parseKoreExecOptions startTime =
384
373
, long " rts-statistics"
385
374
, help " Write runtime statistics to FILENAME in JSON format."
386
375
]
376
+ parseExecutionMode = do
377
+ val <- str
378
+ case val :: String of
379
+ " all" -> return All
380
+ " any" -> return Any
381
+ _ ->
382
+ readerError
383
+ $ show
384
+ $ OptPretty. hsep
385
+ [ " Unknown option"
386
+ , OptPretty. squotes (OptPretty. text val)
387
+ <> OptPretty. dot
388
+ , " Known options are 'all' and 'any'."
389
+ ]
387
390
388
391
-- | modifiers for the Command line parser description
389
392
parserInfoModifiers :: InfoMod options
@@ -462,7 +465,7 @@ koreExecSh
462
465
<$> maybeLimit Nothing Just breadthLimit
463
466
, (\ limit -> unwords [" --depth" , show limit])
464
467
<$> maybeLimit Nothing Just depthLimit
465
- , pure $ unwords [" --strategy" , fst strategy]
468
+ , pure $ unwords [" --strategy" , unparseExecutionMode strategy]
466
469
, rtsStatistics $>
467
470
unwords [" --rts-statistics" , defaultRtsStatisticsFilePath]
468
471
]
@@ -472,6 +475,8 @@ koreExecSh
472
475
, maybe mempty unparseKoreProveOptions koreProveOptions
473
476
, maybe mempty unparseKoreMergeOptions koreMergeOptions
474
477
]
478
+ unparseExecutionMode All = " all"
479
+ unparseExecutionMode Any = " any"
475
480
476
481
defaultDefinitionFilePath :: KoreExecOptions -> FilePath
477
482
defaultDefinitionFilePath KoreExecOptions { koreProveOptions }
@@ -615,14 +620,13 @@ koreSearch execOptions searchOptions = do
615
620
initial <- loadPattern mainModule patternFileName
616
621
final <-
617
622
execute execOptions mainModule
618
- $ search breadthLimit mainModule strategy' initial target config
623
+ $ search depthLimit breadthLimit mainModule initial target config
619
624
lift $ renderResult execOptions (unparse final)
620
625
return ExitSuccess
621
626
where
622
627
KoreSearchOptions { bound, searchType } = searchOptions
623
628
config = Search. Config { bound, searchType }
624
- KoreExecOptions { breadthLimit, depthLimit, strategy } = execOptions
625
- strategy' = Limit. replicate depthLimit . snd strategy
629
+ KoreExecOptions { breadthLimit, depthLimit } = execOptions
626
630
627
631
koreRun :: KoreExecOptions -> Main ExitCode
628
632
koreRun execOptions = do
@@ -634,12 +638,11 @@ koreRun execOptions = do
634
638
initial <- loadPattern mainModule patternFileName
635
639
(exitCode, final) <-
636
640
execute execOptions mainModule
637
- $ exec breadthLimit mainModule strategy' initial
641
+ $ exec depthLimit breadthLimit mainModule strategy initial
638
642
lift $ renderResult execOptions (unparse final)
639
643
return exitCode
640
644
where
641
645
KoreExecOptions { breadthLimit, depthLimit, strategy } = execOptions
642
- strategy' = Limit. replicate depthLimit . snd strategy
643
646
644
647
koreProve :: KoreExecOptions -> KoreProveOptions -> Main ExitCode
645
648
koreProve execOptions proveOptions = do
0 commit comments