Skip to content

Commit

Permalink
Try inlining by term string
Browse files Browse the repository at this point in the history
  • Loading branch information
samcowger committed Feb 9, 2023
1 parent 88b0ce4 commit ec89833
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/SAWScript/Builtins.hs
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,19 @@ print_goal_inline noInline =
let output = prettySequent opts' nenv (goalSequent goal)
printOutLnTop Info (unlines [goalSummary goal, output])

print_goal_inline_term :: [String] -> ProofScript ()
print_goal_inline_term termStrs =
execTactic $ tacticId $ \goal ->
do
terms <- mapM parseCore termStrs
let idxs = Set.fromList [idx | STApp idx _ _ <- terms]
opts <- getTopLevelPPOpts
let opts' = opts { ppNoInlineIdx = idxs }
sc <- getSharedContext
nenv <- io (scGetNamingEnv sc)
let output = prettySequent opts' nenv (goalSequent goal)
printOutLnTop Info (unlines [goalSummary goal, output])

print_goal_summary :: ProofScript ()
print_goal_summary =
execTactic $ tacticId $ \goal ->
Expand Down
8 changes: 8 additions & 0 deletions src/SAWScript/Interpreter.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1833,6 +1833,14 @@ primitives = Map.fromList
, "inlining the variables that would otherwise be abstracted as `x@1`,"
, " `x@9`, and `x@3`."
]
, prim "print_goal_inline_term" "[String] -> ProofScript ()"
(pureVal print_goal_inline_term)
Experimental
[ "Print the current goal that a proof script is attempting to prove,"
, "without generating `let` bindings for the provided terms. For example"
, "`print_goal_inline [\"Vec 8 Bool\"]` will print the goal without"
, "inlining any occurrence of `Vec 8 Bool`."
]
, prim "write_goal" "String -> ProofScript ()"
(pureVal write_goal)
Current
Expand Down

0 comments on commit ec89833

Please sign in to comment.