Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

symbolic: Use new Crucible goal-proving helpers #391

Closed
langston-barrett opened this issue Jul 3, 2024 · 0 comments · Fixed by #399
Closed

symbolic: Use new Crucible goal-proving helpers #391

langston-barrett opened this issue Jul 3, 2024 · 0 comments · Fixed by #399
Labels
symbolic-execution Issues relating to macaw-symbolic and symbolic execution

Comments

@langston-barrett
Copy link
Contributor

Soon, Crucible will have a new API for dispatching proof obligations. Uses of that API could replace the following code in macaw-symbolic:

proveOneGoal
:: ( CB.IsSymInterface sym
, sym ~ WE.ExprBuilder t st fs
)
=> WS.SolverAdapter st
-> sym
-> CB.Assumptions sym
-> WL.LabeledPred (WI.Pred sym) CS.SimError
-> IO ()
proveOneGoal goalSolver sym asmps lp = do
assumptions <- CB.assumptionsPred sym asmps
goal <- WI.notPred sym (lp L.^. WL.labeledPred)
WS.solver_adapter_check_sat goalSolver sym WS.defaultLogData [assumptions, goal] $ \satRes ->
case satRes of
WSR.Unsat {} -> return ()
WSR.Sat {} -> error ("Failed to prove goal: " ++ show (lp L.^. WL.labeledPredMsg))
WSR.Unknown {} -> error ("Failed to prove goal: " ++ show (lp L.^. WL.labeledPredMsg))
return ()
proveGoals
:: ( CB.IsSymInterface sym, sym ~ WE.ExprBuilder t st fs )
=> WS.SolverAdapter st
-> sym
-> Maybe (CB.Goals (CB.Assumptions sym) (CB.Assertion sym))
-> IO ()
proveGoals goalSolver sym = mapM_ (go mempty)
where
go asmps gs =
case gs of
CB.Assuming as gs1 -> go (asmps <> as) gs1
CB.Prove lp -> proveOneGoal goalSolver sym asmps lp
CB.ProveConj g1 g2 -> do
go asmps g1
go asmps g2
return ()

@RyanGlScott RyanGlScott added the symbolic-execution Issues relating to macaw-symbolic and symbolic execution label Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
symbolic-execution Issues relating to macaw-symbolic and symbolic execution
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants