Skip to content

Commit

Permalink
Incorporate crucible fancy assumptions
Browse files Browse the repository at this point in the history
  • Loading branch information
glguy committed Jul 19, 2021
1 parent 292aafd commit be25449
Show file tree
Hide file tree
Showing 12 changed files with 64 additions and 50 deletions.
2 changes: 1 addition & 1 deletion deps/crucible
Submodule crucible updated 51 files
+0 −4 crucible-concurrency/crucibles/Main.hs
+1 −3 crucible-concurrency/src/Cruces/CrucesMain.hs
+0 −2 crucible-concurrency/src/Cruces/ExploreCrux.hs
+6 −10 crucible-concurrency/src/Crucibles/Explore.hs
+0 −6 crucible-concurrency/src/Crucibles/ExploreTypes.hs
+1 −2 crucible-go/src/Lang/Crucible/Go/Overrides.hs
+2 −2 crucible-jvm/tool/Main.hs
+3 −5 crucible-llvm/src/Lang/Crucible/LLVM/MemModel.hs
+1 −1 crucible-llvm/src/Lang/Crucible/LLVM/MemModel/Partial.hs
+0 −1 crucible-llvm/src/Lang/Crucible/LLVM/Translation/Monad.hs
+1 −2 crucible-llvm/test/TestMemory.hs
+4 −5 crucible-syntax/src/Lang/Crucible/Syntax/Overrides.hs
+3 −5 crucible-syntax/src/Lang/Crucible/Syntax/Prog.hs
+3 −3 crucible-syntax/test-data/simulator-tests/override-test2.out.good
+8 −8 crucible-syntax/test-data/simulator-tests/seq-test3.out.good
+2 −4 crucible-wasm/tool/Main.hs
+1 −0 crucible/crucible.cabal
+275 −81 crucible/src/Lang/Crucible/Backend.hs
+30 −111 crucible/src/Lang/Crucible/Backend/AssumptionStack.hs
+41 −38 crucible/src/Lang/Crucible/Backend/Online.hs
+32 −34 crucible/src/Lang/Crucible/Backend/ProofGoals.hs
+10 −8 crucible/src/Lang/Crucible/Backend/Simple.hs
+1 −1 crucible/src/Lang/Crucible/Simulator/BoundedExec.hs
+1 −1 crucible/src/Lang/Crucible/Simulator/BoundedRecursion.hs
+2 −1 crucible/src/Lang/Crucible/Simulator/EvalStmt.hs
+2 −3 crucible/src/Lang/Crucible/Simulator/ExecutionTree.hs
+6 −30 crucible/src/Lang/Crucible/Simulator/Operations.hs
+5 −4 crucible/src/Lang/Crucible/Simulator/PathSatisfiability.hs
+2 −2 crucible/src/Lang/Crucible/Simulator/PathSplitting.hs
+50 −0 crucible/src/Lang/Crucible/Simulator/PositionTracking.hs
+46 −30 crux-llvm/src/Crux/LLVM/Compile.hs
+20 −23 crux-llvm/src/Crux/LLVM/Overrides.hs
+3 −4 crux-llvm/src/Crux/LLVM/Simulate.hs
+22 −0 crux-llvm/test-data/golden/cex-test.c
+3 −0 crux-llvm/test-data/golden/cex-test.config
+9 −0 crux-llvm/test-data/golden/cex-test.good
+0 −9 crux-mir/src/Mir/Intrinsics.hs
+20 −24 crux-mir/src/Mir/Language.hs
+13 −12 crux-mir/src/Mir/Overrides.hs
+22 −36 crux/src/Crux.hs
+9 −0 crux/src/Crux/Config/Common.hs
+48 −30 crux/src/Crux/FormatOut.hs
+138 −142 crux/src/Crux/Goal.hs
+2 −7 crux/src/Crux/Log.hs
+4 −56 crux/src/Crux/Model.hs
+109 −70 crux/src/Crux/Report.hs
+25 −51 crux/src/Crux/Types.hs
+3 −3 crux/src/Crux/UI/JS.hs
+4 −6 uc-crux-llvm/src/UCCrux/LLVM/Overrides/Skip.hs
+1 −4 uc-crux-llvm/src/UCCrux/LLVM/Overrides/Unsound.hs
+7 −9 uc-crux-llvm/src/UCCrux/LLVM/Run/Simulate.hs
2 changes: 2 additions & 0 deletions heapster-saw/src/Verifier/SAW/Heapster/SAWTranslation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,8 @@ instance TransInfo info =>
return $ error "translate: RealValRepr"
[nuMP| ComplexRealRepr |] ->
return $ error "translate: ComplexRealRepr"
[nuMP| SequenceRepr{} |] ->
return $ error "translate: SequenceRepr"
[nuMP| BVRepr w |] ->
returnType1 =<< bitvectorTransM (translate w)

Expand Down
1 change: 1 addition & 0 deletions heapster-saw/src/Verifier/SAW/Heapster/TypeChecker.hs
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ tcExpr WordMapRepr {} e = tcError (pos e) "Expected wordmap"
tcExpr StringMapRepr {} e = tcError (pos e) "Expected stringmap"
tcExpr SymbolicArrayRepr {} e = tcError (pos e) "Expected symbolicarray"
tcExpr SymbolicStructRepr{} e = tcError (pos e) "Expected symbolicstruct"
tcExpr SequenceRepr {} e = tcError (pos e) "Expected sequencerepr"

-- | Check for a unit literal
tcUnit :: AstExpr -> Tc (PermExpr UnitType)
Expand Down
2 changes: 1 addition & 1 deletion src/SAWScript/Crucible/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ sawCoreState sym = pure (onlineUserState (W4.sbUserState sym))
ppAbortedResult :: (forall l args. GlobalPair Sym (SimFrame Sym ext l args) -> PP.Doc ann)
-> AbortedResult Sym ext
-> PP.Doc ann
ppAbortedResult _ (AbortedExec InfeasibleBranch _) =
ppAbortedResult _ (AbortedExec InfeasibleBranch{} _) =
PP.pretty "Infeasible branch"
ppAbortedResult ppGP (AbortedExec abt gp) = do
PP.vcat
Expand Down
25 changes: 13 additions & 12 deletions src/SAWScript/Crucible/JVM/Builtins.hs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ import qualified Data.Map as Map
import Data.Maybe (fromMaybe, isNothing)
import Data.Set (Set)
import qualified Data.Set as Set
import qualified Data.Sequence as Seq
import Data.Text (Text)
import qualified Data.Text as Text
import Data.Time.Clock (getCurrentTime, diffUTCTime)
Expand Down Expand Up @@ -132,6 +131,7 @@ import SAWScript.Crucible.JVM.Override
import SAWScript.Crucible.JVM.ResolveSetupValue
import SAWScript.Crucible.JVM.BuiltinsJVM ()

type AssumptionReason = (W4.ProgramLoc, String)
type SetupValue = MS.SetupValue CJ.JVM
type Lemma = MS.ProvedSpec CJ.JVM
type MethodSpec = MS.CrucibleMethodSpecIR CJ.JVM
Expand Down Expand Up @@ -276,7 +276,7 @@ verifyObligations ::
JVMCrucibleContext ->
MethodSpec ->
ProofScript () ->
[Crucible.LabeledPred Term Crucible.AssumptionReason] ->
[Crucible.LabeledPred Term AssumptionReason] ->
[(String, W4.ProgramLoc, Term)] ->
TopLevel (SolverStats, Set TheoremNonce)
verifyObligations cc mspec tactic assumes asserts =
Expand Down Expand Up @@ -333,7 +333,7 @@ verifyPrestate ::
MethodSpec ->
Crucible.SymGlobalState Sym ->
IO ([(J.Type, JVMVal)],
[Crucible.LabeledPred Term Crucible.AssumptionReason],
[Crucible.LabeledPred Term AssumptionReason],
Map AllocIndex JVMRefVal,
Crucible.SymGlobalState Sym)
verifyPrestate cc mspec globals0 =
Expand Down Expand Up @@ -511,7 +511,7 @@ setupPrestateConditions ::
JVMCrucibleContext ->
Map AllocIndex JVMRefVal ->
[SetupCondition] ->
IO [Crucible.LabeledPred Term Crucible.AssumptionReason]
IO [Crucible.LabeledPred Term AssumptionReason]
setupPrestateConditions mspec cc env = aux []
where
tyenv = MS.csAllocations mspec
Expand All @@ -523,11 +523,11 @@ setupPrestateConditions mspec cc env = aux []
do val1' <- resolveSetupVal cc env tyenv nameEnv val1
val2' <- resolveSetupVal cc env tyenv nameEnv val2
t <- assertEqualVals cc val1' val2'
let lp = Crucible.LabeledPred t (Crucible.AssumptionReason loc "equality precondition")
let lp = Crucible.LabeledPred t (loc, "equality precondition")
aux (lp:acc) xs

aux acc (MS.SetupCond_Pred loc tm : xs) =
let lp = Crucible.LabeledPred (ttTerm tm) (Crucible.AssumptionReason loc "precondition") in
let lp = Crucible.LabeledPred (ttTerm tm) (loc, "precondition") in
aux (lp:acc) xs

aux _ (MS.SetupCond_Ghost empty_ _ _ _ : _) = absurd empty_
Expand Down Expand Up @@ -593,7 +593,7 @@ verifySimulate ::
[Crucible.GenericExecutionFeature Sym] ->
MethodSpec ->
[(a, JVMVal)] ->
[Crucible.LabeledPred Term Crucible.AssumptionReason] ->
[Crucible.LabeledPred Term AssumptionReason] ->
W4.ProgramLoc ->
[Lemma] ->
Crucible.SymGlobalState Sym ->
Expand Down Expand Up @@ -630,9 +630,10 @@ verifySimulate opts cc pfs mspec args assumes top_loc lemmas globals _checkSat =
mapM_ (registerOverride opts cc simctx top_loc)
(groupOn (view csMethodName) (map (view MS.psSpec) lemmas))
liftIO $ putStrLn "registering assumptions"
liftIO $ do
preds <- (traverse . Crucible.labeledPred) (resolveSAWPred cc) assumes
Crucible.addAssumptions sym (Seq.fromList preds)
liftIO $
for_ assumes $ \(Crucible.LabeledPred p (loc, reason)) ->
do expr <- resolveSAWPred cc p
Crucible.addAssumption sym (Crucible.GenericAssumption loc reason expr)
liftIO $ putStrLn "simulating function"
fnCall
Crucible.executeCrucible (map Crucible.genericToExecutionFeature feats)
Expand Down Expand Up @@ -731,14 +732,14 @@ verifyPoststate cc mspec env0 globals ret =

obligations <- io $ Crucible.getProofObligations sym
io $ Crucible.clearProofObligations sym
io $ mapM (verifyObligation sc) (Crucible.proofGoalsToList obligations)
io $ mapM (verifyObligation sc) (maybe [] Crucible.goalsToList obligations)

where
sym = cc^.jccBackend

verifyObligation sc (Crucible.ProofGoal hyps (Crucible.LabeledPred concl (Crucible.SimError loc err))) =
do st <- sawCoreState sym
hypTerm <- scAndList sc =<< mapM (toSC sym st) (toListOf (folded . Crucible.labeledPred) hyps)
hypTerm <- toSC sym st =<< Crucible.assumptionsPred sym hyps
conclTerm <- toSC sym st concl
obligation <- scImplies sc hypTerm conclTerm
return ("safety assertion: " ++ Crucible.simErrorReasonMsg err, loc, obligation)
Expand Down
10 changes: 6 additions & 4 deletions src/SAWScript/Crucible/JVM/Override.hs
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,15 @@ methodSpecHandler opts sc cc top_loc css h = do
case res of
Left (OF loc rsn) ->
-- TODO, better pretty printing for reasons
liftIO $ Crucible.abortExecBecause
(Crucible.AssumedFalse (Crucible.AssumptionReason loc (show rsn)))
liftIO
$ Crucible.abortExecBecause
$ Crucible.AssertionFailure
$ Crucible.SimError loc
$ Crucible.AssertFailureSimError "assumed false" (show rsn)
Right (ret,st') ->
do liftIO $ forM_ (st'^.osAssumes) $ \asum ->
Crucible.addAssumption (cc ^. jccBackend)
(Crucible.LabeledPred asum
(Crucible.AssumptionReason (st^.osLocation) "override postcondition"))
$ Crucible.GenericAssumption (st^.osLocation) "override postcondition" asum
Crucible.writeGlobals (st'^.overrideGlobals)
Crucible.overrideReturn' (Crucible.RegEntry retTy ret)
, Just (W4.plSourceLoc (cs ^. MS.csLoc))
Expand Down
34 changes: 19 additions & 15 deletions src/SAWScript/Crucible/LLVM/Builtins.hs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ import SAWScript.Crucible.LLVM.Override
import SAWScript.Crucible.LLVM.ResolveSetupValue
import SAWScript.Crucible.LLVM.MethodSpecIR

type AssumptionReason = (W4.ProgramLoc, String)

type MemImpl = Crucible.MemImpl Sym

data LLVMVerificationException
Expand Down Expand Up @@ -603,7 +605,7 @@ verifyMethodSpec cc methodSpec lemmas checkSat tactic asp =
verifyObligations :: LLVMCrucibleContext arch
-> MS.CrucibleMethodSpecIR (LLVM arch)
-> ProofScript ()
-> [Crucible.LabeledPred Term Crucible.AssumptionReason]
-> [Crucible.LabeledPred Term AssumptionReason]
-> [(String, W4.ProgramLoc, Term)]
-> TopLevel (SolverStats, Set TheoremNonce)
verifyObligations cc mspec tactic assumes asserts =
Expand Down Expand Up @@ -738,7 +740,7 @@ verifyPrestate ::
MS.CrucibleMethodSpecIR (LLVM arch) ->
Crucible.SymGlobalState Sym ->
IO ([(Crucible.MemType, LLVMVal)],
[Crucible.LabeledPred Term Crucible.AssumptionReason],
[Crucible.LabeledPred Term AssumptionReason],
Map AllocIndex (LLVMPtr (Crucible.ArchWidth arch)),
Crucible.SymGlobalState Sym)
verifyPrestate opts cc mspec globals =
Expand Down Expand Up @@ -772,7 +774,7 @@ assumptionsContainContradiction ::
(Crucible.HasPtrWidth (Crucible.ArchWidth arch), Crucible.HasLLVMAnn Sym) =>
LLVMCrucibleContext arch ->
ProofScript () ->
[Crucible.LabeledPred Term Crucible.AssumptionReason] ->
[Crucible.LabeledPred Term AssumptionReason] ->
TopLevel Bool
assumptionsContainContradiction cc tactic assumptions =
do
Expand Down Expand Up @@ -803,7 +805,7 @@ computeMinimalContradictingCore ::
(Crucible.HasPtrWidth (Crucible.ArchWidth arch), Crucible.HasLLVMAnn Sym) =>
LLVMCrucibleContext arch ->
ProofScript () ->
[Crucible.LabeledPred Term Crucible.AssumptionReason] ->
[Crucible.LabeledPred Term AssumptionReason] ->
TopLevel ()
computeMinimalContradictingCore cc tactic assumes =
do
Expand All @@ -814,8 +816,9 @@ computeMinimalContradictingCore cc tactic assumes =
findM (assumptionsContainContradiction cc tactic) cores >>= \case
Nothing -> printOutLnTop Warn "No minimal core: the assumptions did not contains a contradiction."
Just core ->
forM_ core $ \ assumption ->
printOutLnTop Warn (show . Crucible.ppAssumptionReason $ assumption ^. Crucible.labeledPredMsg)
forM_ core $ \assume ->
case assume^.Crucible.labeledPredMsg of
(loc, reason) -> printOutLnTop Warn (show loc ++ ": " ++ reason)
printOutLnTop Warn "Because of the contradiction, the following proofs may be vacuous."

-- | Checks whether the given list of assumptions contains a contradiction, and
Expand All @@ -824,7 +827,7 @@ checkAssumptionsForContradictions ::
(Crucible.HasPtrWidth (Crucible.ArchWidth arch), Crucible.HasLLVMAnn Sym) =>
LLVMCrucibleContext arch ->
ProofScript () ->
[Crucible.LabeledPred Term Crucible.AssumptionReason] ->
[Crucible.LabeledPred Term AssumptionReason] ->
TopLevel ()
checkAssumptionsForContradictions cc tactic assumes =
whenM
Expand Down Expand Up @@ -953,7 +956,7 @@ setupPrestateConditions ::
Map AllocIndex (LLVMPtr (Crucible.ArchWidth arch)) ->
Crucible.SymGlobalState Sym ->
[MS.SetupCondition (LLVM arch)] ->
IO (Crucible.SymGlobalState Sym, [Crucible.LabeledPred Term Crucible.AssumptionReason])
IO (Crucible.SymGlobalState Sym, [Crucible.LabeledPred Term AssumptionReason])
setupPrestateConditions mspec cc mem env = aux []
where
tyenv = MS.csAllocations mspec
Expand All @@ -965,11 +968,11 @@ setupPrestateConditions mspec cc mem env = aux []
do val1' <- resolveSetupVal cc mem env tyenv nameEnv val1
val2' <- resolveSetupVal cc mem env tyenv nameEnv val2
t <- assertEqualVals cc val1' val2'
let lp = Crucible.LabeledPred t (Crucible.AssumptionReason loc "equality precondition")
let lp = Crucible.LabeledPred t (loc, "equality precondition")
aux (lp:acc) globals xs

aux acc globals (MS.SetupCond_Pred loc tm : xs) =
let lp = Crucible.LabeledPred (ttTerm tm) (Crucible.AssumptionReason loc "precondition") in
let lp = Crucible.LabeledPred (ttTerm tm) (loc, "precondition") in
aux (lp:acc) globals xs

aux acc globals (MS.SetupCond_Ghost () _loc var val : xs) =
Expand Down Expand Up @@ -1155,7 +1158,7 @@ verifySimulate ::
[Crucible.GenericExecutionFeature Sym] ->
MS.CrucibleMethodSpecIR (LLVM arch) ->
[(Crucible.MemType, LLVMVal)] ->
[Crucible.LabeledPred Term Crucible.AssumptionReason] ->
[Crucible.LabeledPred Term AssumptionReason] ->
W4.ProgramLoc ->
[MS.ProvedSpec (LLVM arch)] ->
Crucible.SymGlobalState Sym ->
Expand Down Expand Up @@ -1209,8 +1212,9 @@ verifySimulate opts cc pfs mspec args assumes top_loc lemmas globals checkSat as
do mapM_ (registerOverride opts cc simCtx top_loc)
(groupOn (view csName) funcLemmas)
liftIO $
do preds <- (traverse . Crucible.labeledPred) (resolveSAWPred cc) assumes
Crucible.addAssumptions sym (Seq.fromList preds)
for_ assumes $ \(Crucible.LabeledPred p (loc, reason)) ->
do expr <- resolveSAWPred cc p
Crucible.addAssumption sym (Crucible.GenericAssumption loc reason expr)
Crucible.regValue <$> (Crucible.callBlock cfg entryId args')
res <- Crucible.executeCrucible execFeatures initExecState
case res of
Expand Down Expand Up @@ -1302,15 +1306,15 @@ verifyPoststate cc mspec env0 globals ret =

obligations <- io $ Crucible.getProofObligations sym
io $ Crucible.clearProofObligations sym
sc_obligations <- io $ mapM (verifyObligation sc) (Crucible.proofGoalsToList obligations)
sc_obligations <- io $ mapM (verifyObligation sc) (maybe [] Crucible.goalsToList obligations)
return (sc_obligations, st)

where
sym = cc^.ccBackend

verifyObligation sc (Crucible.ProofGoal hyps (Crucible.LabeledPred concl err@(Crucible.SimError loc _))) =
do st <- Common.sawCoreState sym
hypTerm <- toSC sym st =<< W4.andAllOf sym (folded . Crucible.labeledPred) hyps
hypTerm <- toSC sym st =<< Crucible.assumptionsPred sym hyps
conclTerm <- toSC sym st concl
obligation <- scImplies sc hypTerm conclTerm
return (unlines ["safety assertion:", show err], loc, obligation)
Expand Down
10 changes: 6 additions & 4 deletions src/SAWScript/Crucible/LLVM/Override.hs
Original file line number Diff line number Diff line change
Expand Up @@ -475,13 +475,15 @@ methodSpecHandler opts sc cc top_loc css h = do
case res of
Left (OF loc rsn) ->
-- TODO, better pretty printing for reasons
liftIO $ Crucible.abortExecBecause
(Crucible.AssumedFalse (Crucible.AssumptionReason loc (show rsn)))
liftIO
$ Crucible.abortExecBecause
$ Crucible.AssertionFailure
$ Crucible.SimError loc
$ Crucible.AssertFailureSimError "assumed false" (show rsn)
Right (ret,st') ->
do liftIO $ forM_ (st'^.osAssumes) $ \asum ->
Crucible.addAssumption (cc^.ccBackend)
(Crucible.LabeledPred asum
(Crucible.AssumptionReason (st^.osLocation) "override postcondition"))
$ Crucible.GenericAssumption (st^.osLocation) "override postcondition" asum
Crucible.writeGlobals (st'^.overrideGlobals)
Crucible.overrideReturn' (Crucible.RegEntry retTy ret)
, Just (W4.plSourceLoc (cs ^. MS.csLoc))
Expand Down
4 changes: 2 additions & 2 deletions src/SAWScript/Crucible/LLVM/X86.hs
Original file line number Diff line number Diff line change
Expand Up @@ -914,8 +914,8 @@ assertPost globals env premem preregs = do
st <- case result of
Left err -> throwX86 $ show err
Right (_, st) -> pure st
liftIO . forM_ (view O.osAssumes st) $ \p ->
C.addAssumption sym . C.LabeledPred p $ C.AssumptionReason (st ^. O.osLocation) "precondition"
liftIO . forM_ (view O.osAssumes st) $
C.addAssumption sym . C.GenericAssumption (st ^. O.osLocation) "precondition"
liftIO . forM_ (view LO.osAsserts st) $ \(W4.LabeledPred p r) ->
C.addAssertion sym $ C.LabeledPred p r

Expand Down
11 changes: 6 additions & 5 deletions src/SAWScript/X86.hs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module SAWScript.X86
) where


import Control.Lens (toListOf, folded, (^.))
import Control.Lens ((^.))
import Control.Exception(Exception(..),throwIO)
import Control.Monad.IO.Class(liftIO)

Expand Down Expand Up @@ -72,7 +72,8 @@ import Lang.Crucible.Simulator.ExecutionTree
)
import Lang.Crucible.Simulator.SimError(SimError(..), SimErrorReason)
import Lang.Crucible.Backend
(getProofObligations,ProofGoal(..),labeledPredMsg,labeledPred,proofGoalsToList)
(getProofObligations,ProofGoal(..),labeledPredMsg,labeledPred,goalsToList
,assumptionsPred)
import Lang.Crucible.FunctionHandle(HandleAllocator,newHandleAllocator,insertHandleMap,emptyHandleMap)


Expand Down Expand Up @@ -564,15 +565,15 @@ gGoal sc g0 = boolToProp sc [] =<< go (gAssumes g)

getGoals :: Sym -> IO [Goal]
getGoals sym =
do obls <- proofGoalsToList <$> getProofObligations sym
do obls <- maybe [] goalsToList <$> getProofObligations sym
st <- sawCoreState sym
mapM (toGoal st) obls
where
toGoal st (ProofGoal asmps g) =
do as <- mapM (toSC sym st) (toListOf (folded . labeledPred) asmps)
do a1 <- toSC sym st =<< assumptionsPred sym asmps
p <- toSC sym st (g ^. labeledPred)
let SimError loc msg = g^.labeledPredMsg
return Goal { gAssumes = as
return Goal { gAssumes = [a1]
, gShows = p
, gLoc = loc
, gMessage = msg
Expand Down
11 changes: 6 additions & 5 deletions src/SAWScript/X86Spec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ import qualified Lang.Crucible.LLVM.MemModel as Crucible

import Lang.Crucible.Simulator.SimError(SimErrorReason(AssertFailureSimError))
import Lang.Crucible.Backend
(addAssumption, getProofObligations, proofGoalsToList
,assert, AssumptionReason(..)
(addAssumption, getProofObligations, goalsToList
,assert, CrucibleAssumption(..)
,LabeledPred(..), ProofGoal(..), labeledPredMsg)

import Lang.Crucible.Simulator.ExecutionTree
Expand Down Expand Up @@ -826,7 +826,8 @@ makeEquiv opts s (Pair (Rep t _) (Equiv xs ys)) =
let same a =
do p <- evalSame sym t v a
let loc = mkProgramLoc "<makeEquiv>" InternalPos
addAssumption sym (LabeledPred p (AssumptionReason loc "equivalance class assumption"))
addAssumption sym
$ GenericAssumption loc "equivalance class assumption" p

mapM_ same rest

Expand All @@ -847,7 +848,7 @@ addAsmp opts s (msg,p) =

_ -> do p' <- evalProp opts p s
let loc = mkProgramLoc "<addAssmp>" InternalPos -- FIXME
addAssumption (optsSym opts) (LabeledPred p' (AssumptionReason loc msg))
addAssumption (optsSym opts) (GenericAssumption loc msg p')

setCryPost :: forall p. (Eval p, Crucible.HasLLVMAnn Sym) => Opts -> S p -> (String,Prop p) -> IO (S p)
setCryPost opts s (_nm,p) =
Expand Down Expand Up @@ -1132,7 +1133,7 @@ debugPPReg r s =

_debugDumpGoals :: Sym -> IO ()
_debugDumpGoals sym =
do obls <- proofGoalsToList <$> getProofObligations sym
do obls <- maybe [] goalsToList <$> getProofObligations sym
mapM_ sh (toList obls)
where
sh (ProofGoal _hyps g) = print (view labeledPredMsg g)
Expand Down

0 comments on commit be25449

Please sign in to comment.