Skip to content

Commit

Permalink
Use substitution in Implies
Browse files Browse the repository at this point in the history
  • Loading branch information
geo2a committed Oct 22, 2024
1 parent bc72188 commit b2ea0f8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 5 additions & 3 deletions booster/library/Booster/Pattern/Implies.hs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ runImplies def mLlvmLibrary mSMTOptions antecedent consequent =
, substitution = substitutionR
}

SMT.isSat solver (Set.toList substPatL.constraints) >>= \case
SMT.isSat solver (Set.toList substPatL.constraints) substPatL.substitution >>= \case
SMT.IsUnsat ->
let sort = externaliseSort $ sortOfPattern substPatL
in implies' (Kore.Syntax.KJBottom sort) sort antecedent.term consequent.term mempty
Expand Down Expand Up @@ -159,8 +159,10 @@ runImplies def mLlvmLibrary mSMTOptions antecedent consequent =
pure . Left . RpcError.backendError $ RpcError.Aborted (Text.pack . constructorName $ err)
MatchSuccess subst -> do
let filteredConsequentPreds =
Set.map (Substitution.substituteInPredicate subst) substPatR.constraints
`Set.difference` substPatL.constraints
Set.map
(Substitution.substituteInPredicate subst)
(substPatR.constraints <> (Set.fromList $ Substitution.asEquations substPatR.substitution))
`Set.difference` (substPatL.constraints <> (Set.fromList $ Substitution.asEquations substPatL.substitution))

if null filteredConsequentPreds
then
Expand Down
3 changes: 2 additions & 1 deletion booster/library/Booster/SMT/Interface.hs
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,9 @@ isSat ::
Log.LoggerMIO io =>
SMT.SMTContext ->
[Predicate] ->
Map Variable Term -> -- supplied substitution
io (IsSatResult ())
isSat ctxt ps = fmap void <$> (isSatReturnTransState ctxt ps mempty)
isSat ctxt ps subst = fmap void <$> (isSatReturnTransState ctxt ps subst)

{- |
Implementation of get-model request
Expand Down

0 comments on commit b2ea0f8

Please sign in to comment.