Skip to content

Commit

Permalink
Handle substitution better when simplifying standalone predicates
Browse files Browse the repository at this point in the history
  • Loading branch information
geo2a committed Oct 22, 2024
1 parent f8f956f commit c73a2c9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions booster/library/Booster/JsonRpc.hs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ import Booster.Syntax.Json.Externalise
import Booster.Syntax.Json.Internalise (
InternalisedPredicates (..),
TermOrPredicates (..),
extractSubsitution,
internalisePattern,
internaliseTermOrPredicate,
logPatternError,
Expand Down Expand Up @@ -289,16 +290,17 @@ respond stateVar request =
mLlvmLibrary
solver
mempty
predicates -- TODO include ps.substitution?
(predicates <> Substitution.asEquations ps.substitution)
>>= \case
(Right newPreds, _) -> do
(Right simplified, _) -> do
let predicateSort =
fromMaybe (error "not a predicate") $
sortOfJson req.state.term
(simplifiedSubstitution, simplifiedPredicates) = extractSubsitution simplified
result =
map (externalisePredicate predicateSort) newPreds
map (externalisePredicate predicateSort) (Set.toList simplifiedPredicates)
<> map (externaliseCeil predicateSort) ps.ceilPredicates
<> map (uncurry $ externaliseSubstitution predicateSort) (Map.toList ps.substitution)
<> map (uncurry $ externaliseSubstitution predicateSort) (Map.assocs simplifiedSubstitution)
<> ps.unsupported

pure $ Right (addHeader $ Syntax.KJAnd predicateSort result)
Expand Down

0 comments on commit c73a2c9

Please sign in to comment.