@@ -44,7 +44,7 @@ import Booster.Definition.Base qualified as Definition (RewriteRule (..))
44
44
import Booster.LLVM as LLVM (API )
45
45
import Booster.Log
46
46
import Booster.Pattern.ApplyEquations qualified as ApplyEquations
47
- import Booster.Pattern.Base (Pattern (.. ), Sort (SortApp ), Term , Variable )
47
+ import Booster.Pattern.Base (Pattern (.. ), Predicate , Sort (SortApp ), Term , Variable )
48
48
import Booster.Pattern.Base qualified as Pattern
49
49
import Booster.Pattern.Implies (runImplies )
50
50
import Booster.Pattern.Pretty
@@ -483,11 +483,14 @@ execResponse req (d, traces, rr) originalSubstitution unsupported = case rr of
483
483
{ reason = RpcTypes. Branching
484
484
, depth
485
485
, logs
486
- , state = toExecState p originalSubstitution unsupported Nothing
486
+ , state = toExecState p originalSubstitution unsupported Nothing Nothing Nothing
487
487
, nextStates =
488
- Just $
489
- map (\ (_, muid, p') -> toExecState p' originalSubstitution unsupported (Just muid)) $
490
- toList nexts
488
+ -- FIXME return _ruleSubst in the response, removing '#'s from the variable names to make pyk happy
489
+ Just
490
+ $ map
491
+ ( \ (_, muid, p', mrulePred, _ruleSubst) -> toExecState p' originalSubstitution unsupported (Just muid) mrulePred Nothing
492
+ )
493
+ $ toList nexts
491
494
, rule = Nothing
492
495
, unknownPredicate = Nothing
493
496
}
@@ -498,7 +501,7 @@ execResponse req (d, traces, rr) originalSubstitution unsupported = case rr of
498
501
{ reason = RpcTypes. Stuck
499
502
, depth
500
503
, logs
501
- , state = toExecState p originalSubstitution unsupported Nothing
504
+ , state = toExecState p originalSubstitution unsupported Nothing Nothing Nothing
502
505
, nextStates = Nothing
503
506
, rule = Nothing
504
507
, unknownPredicate = Nothing
@@ -510,7 +513,7 @@ execResponse req (d, traces, rr) originalSubstitution unsupported = case rr of
510
513
{ reason = RpcTypes. Vacuous
511
514
, depth
512
515
, logs
513
- , state = toExecState p originalSubstitution unsupported Nothing
516
+ , state = toExecState p originalSubstitution unsupported Nothing Nothing Nothing
514
517
, nextStates = Nothing
515
518
, rule = Nothing
516
519
, unknownPredicate = Nothing
@@ -522,8 +525,8 @@ execResponse req (d, traces, rr) originalSubstitution unsupported = case rr of
522
525
{ reason = RpcTypes. CutPointRule
523
526
, depth
524
527
, logs
525
- , state = toExecState p originalSubstitution unsupported Nothing
526
- , nextStates = Just [toExecState next originalSubstitution unsupported Nothing ]
528
+ , state = toExecState p originalSubstitution unsupported Nothing Nothing Nothing
529
+ , nextStates = Just [toExecState next originalSubstitution unsupported Nothing Nothing Nothing ]
527
530
, rule = Just lbl
528
531
, unknownPredicate = Nothing
529
532
}
@@ -534,7 +537,7 @@ execResponse req (d, traces, rr) originalSubstitution unsupported = case rr of
534
537
{ reason = RpcTypes. TerminalRule
535
538
, depth
536
539
, logs
537
- , state = toExecState p originalSubstitution unsupported Nothing
540
+ , state = toExecState p originalSubstitution unsupported Nothing Nothing Nothing
538
541
, nextStates = Nothing
539
542
, rule = Just lbl
540
543
, unknownPredicate = Nothing
@@ -546,7 +549,7 @@ execResponse req (d, traces, rr) originalSubstitution unsupported = case rr of
546
549
{ reason = RpcTypes. DepthBound
547
550
, depth
548
551
, logs
549
- , state = toExecState p originalSubstitution unsupported Nothing
552
+ , state = toExecState p originalSubstitution unsupported Nothing Nothing Nothing
550
553
, nextStates = Nothing
551
554
, rule = Nothing
552
555
, unknownPredicate = Nothing
@@ -563,7 +566,7 @@ execResponse req (d, traces, rr) originalSubstitution unsupported = case rr of
563
566
(logSuccessfulRewrites, logFailedRewrites)
564
567
(RewriteStepFailed failure)
565
568
in logs <|> abortRewriteLog
566
- , state = toExecState p originalSubstitution unsupported Nothing
569
+ , state = toExecState p originalSubstitution unsupported Nothing Nothing Nothing
567
570
, nextStates = Nothing
568
571
, rule = Nothing
569
572
, unknownPredicate = Nothing
@@ -586,19 +589,32 @@ execResponse req (d, traces, rr) originalSubstitution unsupported = case rr of
586
589
xs@ (_ : _) -> Just xs
587
590
588
591
toExecState ::
589
- Pattern -> Map Variable Term -> [Syntax. KorePattern ] -> Maybe UniqueId -> RpcTypes. ExecuteState
590
- toExecState pat sub unsupported muid =
592
+ Pattern ->
593
+ Map Variable Term ->
594
+ [Syntax. KorePattern ] ->
595
+ Maybe UniqueId ->
596
+ Maybe Predicate ->
597
+ Maybe (Map Variable Term ) ->
598
+ RpcTypes. ExecuteState
599
+ toExecState pat sub unsupported muid mrulePredicate mruleSubst =
591
600
RpcTypes. ExecuteState
592
601
{ term = addHeader t
593
602
, predicate = addHeader <$> addUnsupported p
594
603
, substitution = addHeader <$> s
595
- , ruleSubstitution = Nothing
596
- , rulePredicate = Nothing
604
+ , ruleSubstitution = addHeader <$> mruleSubstExt
605
+ , rulePredicate = addHeader <$> mrulePredExt
597
606
, ruleId = getUniqueId <$> muid
598
607
}
599
608
where
609
+ mrulePredExt = externalisePredicate termSort <$> mrulePredicate
610
+ mruleSubstExt =
611
+ Syntax. KJAnd predicateSort
612
+ . map (uncurry $ externaliseSubstitution predicateSort)
613
+ . Map. toList
614
+ <$> mruleSubst
600
615
(t, p, s) = externalisePattern pat sub
601
616
termSort = externaliseSort $ sortOfPattern pat
617
+ predicateSort = externaliseSort Pattern. SortBool
602
618
allUnsupported = Syntax. KJAnd termSort unsupported
603
619
addUnsupported
604
620
| null unsupported = id
0 commit comments