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

Add prove_prop command #1656

Merged
merged 5 commits into from
May 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions src/SAWScript/Builtins.hs
Original file line number Diff line number Diff line change
Expand Up @@ -924,13 +924,13 @@ provePrim script t = do
_ -> return ()
return res

provePrintPrim ::
proveHelper ::
ProofScript () ->
TypedTerm ->
(Term -> TopLevel Prop) ->
TopLevel Theorem
provePrintPrim script t = do
sc <- getSharedContext
prop <- io $ predicateToProp sc Universal (ttTerm t)
proveHelper script t f = do
prop <- f $ ttTerm t
let goal = ProofGoal 0 "prove" "prove" prop
opts <- rwPPOpts <$> getTopLevelRW
res <- SV.runProofScript script goal Nothing "prove_print_prim"
Expand All @@ -944,6 +944,22 @@ provePrintPrim script t = do
InvalidProof _stats _cex pst -> failProof pst
UnfinishedProof pst -> failProof pst

provePrintPrim ::
ProofScript () ->
TypedTerm ->
TopLevel Theorem
provePrintPrim script t = do
sc <- getSharedContext
proveHelper script t $ io . predicateToProp sc Universal

provePropPrim ::
ProofScript () ->
TypedTerm ->
TopLevel Theorem
provePropPrim script t = do
chameco marked this conversation as resolved.
Show resolved Hide resolved
sc <- getSharedContext
proveHelper script t $ io . termToProp sc

satPrim ::
ProofScript () ->
TypedTerm ->
Expand Down
9 changes: 9 additions & 0 deletions src/SAWScript/Interpreter.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1313,6 +1313,15 @@ primitives = Map.fromList
, "if unsuccessful."
]

, prim "prove_extcore" "ProofScript () -> Term -> TopLevel Theorem"
(pureVal provePropPrim)
Current
[ "Use the given proof script to attempt to prove that a term representing"
, "a proposition is valid. For example, this is useful for proving a goal"
, "obtained with 'offline_extcore'. Returns a Theorem if successful, and"
, "aborts if unsuccessful."
]

, prim "sat" "ProofScript () -> Term -> TopLevel SatResult"
(pureVal satPrim)
Current
Expand Down