Skip to content

Commit f538ea7

Browse files
committed
saw-script: let-inlining only works with incremental memoization
1 parent fad4f4a commit f538ea7

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/SAWScript/Builtins.hs

+13-1
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ import qualified Verifier.SAW.SCTypeCheck as TC (TypedTerm(..))
8080
import Verifier.SAW.Recognizer
8181
import Verifier.SAW.Prelude (scEq)
8282
import Verifier.SAW.SharedTerm
83+
import Verifier.SAW.Term.Pretty (MemoStyle(..))
8384
import Verifier.SAW.TypedTerm
8485
import qualified Verifier.SAW.Simulator.Concrete as Concrete
8586
import Verifier.SAW.Prim (rethrowEvalError)
@@ -478,11 +479,22 @@ print_goal_inline noInline =
478479
execTactic $ tacticId $ \goal ->
479480
do
480481
opts <- getTopLevelPPOpts
481-
let opts' = opts { ppNoInlineMemoFresh = sort noInline }
482+
opts' <-
483+
case ppMemoStyle opts of
484+
Incremental -> pure opts { ppNoInlineMemoFresh = sort noInline }
485+
HashIncremental _ -> pure opts { ppNoInlineMemoFresh = sort noInline }
486+
Hash _ -> warnIncremental >> pure opts
482487
sc <- getSharedContext
483488
nenv <- io (scGetNamingEnv sc)
484489
let output = prettySequent opts' nenv (goalSequent goal)
485490
printOutLnTop Info (unlines [goalSummary goal, output])
491+
where
492+
warnIncremental =
493+
printOutLnTop Warn $
494+
unlines
495+
[ "`print_goal_inline` is incompatible with non-incremental"
496+
, "memoization strategies. Printing goal without inlining..."
497+
]
486498

487499
print_goal_summary :: ProofScript ()
488500
print_goal_summary =

src/SAWScript/Interpreter.hs

+3
Original file line numberDiff line numberDiff line change
@@ -2230,6 +2230,9 @@ primitives = Map.fromList
22302230
, " `x@9`, and `x@3`. These indices are assigned deterministically with"
22312231
, "regard to a particular goal, but are not persistent across goals. As"
22322232
, "such, this should be used primarily when debugging a proof."
2233+
, ""
2234+
, "Note: incompatible with non-incremental memoization strategies - see"
2235+
, "`set_memoization_incremental` and `set_memoization_hash_incremental`."
22332236
]
22342237
, prim "write_goal" "String -> ProofScript ()"
22352238
(pureVal write_goal)

0 commit comments

Comments
 (0)