Skip to content

Commit bb9f9cd

Browse files
committed
Rename the functions binding to the new simple loop invariant feature.
1 parent 629bf36 commit bb9f9cd

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

src/SAWScript/Crucible/LLVM/X86.hs

+16-16
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Stability : provisional
2727
module SAWScript.Crucible.LLVM.X86
2828
( llvm_verify_x86
2929
, llvm_verify_fixpoint_x86
30-
, llvm_verify_fixpoint_x86_ex
30+
, llvm_verify_x86_with_invariant
3131
, defaultStackBaseAlign
3232
) where
3333

@@ -126,7 +126,7 @@ import qualified Lang.Crucible.LLVM.Intrinsics as C.LLVM
126126
import qualified Lang.Crucible.LLVM.MemModel as C.LLVM
127127
import qualified Lang.Crucible.LLVM.MemType as C.LLVM
128128
import qualified Lang.Crucible.LLVM.SimpleLoopFixpoint as Crucible.LLVM.Fixpoint
129-
import qualified Lang.Crucible.LLVM.SimpleLoopFixpoint2 as Crucible.LLVM.Fixpoint2
129+
import qualified Lang.Crucible.LLVM.SimpleLoopInvariant as SimpleInvariant
130130
import qualified Lang.Crucible.LLVM.Translation as C.LLVM
131131
import qualified Lang.Crucible.LLVM.TypeContext as C.LLVM
132132

@@ -333,7 +333,7 @@ llvm_verify_fixpoint_x86 llvmModule path nm globsyms checkSat f =
333333
-- | Verify that an x86_64 function (following the System V AMD64 ABI) conforms
334334
-- to an LLVM specification. This allows for compositional verification of LLVM
335335
-- functions that call x86_64 functions (but not the other way around).
336-
llvm_verify_fixpoint_x86_ex ::
336+
llvm_verify_x86_with_invariant ::
337337
Some LLVMModule {- ^ Module to associate with method spec -} ->
338338
FilePath {- ^ Path to ELF file -} ->
339339
String {- ^ Function's symbol in ELF file -} ->
@@ -343,14 +343,14 @@ llvm_verify_fixpoint_x86_ex ::
343343
LLVMCrucibleSetupM () {- ^ Specification to verify against -} ->
344344
ProofScript () {- ^ Tactic used to use when discharging goals -} ->
345345
TopLevel (SomeLLVM MS.ProvedSpec)
346-
llvm_verify_fixpoint_x86_ex llvmModule path nm globsyms checkSat (loopName,loopNum,f) =
346+
llvm_verify_x86_with_invariant llvmModule path nm globsyms checkSat (loopName,loopNum,f) =
347347
llvm_verify_x86_common llvmModule path nm globsyms checkSat
348-
(SimpleFixpoint2 loopName loopNum f)
348+
(SimpleInvariant loopName loopNum f)
349349

350350
data FixpointSelect
351351
= NoFixpoint
352352
| SimpleFixpoint TypedTerm
353-
| SimpleFixpoint2 String Integer TypedTerm
353+
| SimpleInvariant String Integer TypedTerm
354354

355355
llvm_verify_x86_common ::
356356
Some LLVMModule {- ^ Module to associate with method spec -} ->
@@ -547,15 +547,15 @@ llvm_verify_x86_common (Some (llvmModule :: LLVMModule x)) path nm globsyms chec
547547
SimpleFixpoint func ->
548548
do f <- liftIO (setupSimpleLoopFixpointFeature sym sc sawst cfg mvar func)
549549
return [f]
550-
SimpleFixpoint2 loopFixpointSymbol loopNum func ->
550+
SimpleInvariant loopFixpointSymbol loopNum func ->
551551
do (loopaddr :: Macaw.MemSegmentOff 64) <-
552552
case findSymbols (symMap relf) . encodeUtf8 $ Text.pack loopFixpointSymbol of
553553
(loopaddr:_) -> pure loopaddr
554554
_ -> fail $ mconcat ["Could not find symbol \"", nm, "\""]
555555
case Map.lookup loopaddr cfgs of
556556
Nothing -> throwX86 $ "Unable to discover looping CFG from address " <> show loopaddr
557557
Just (C.SomeCFG loopcfg) ->
558-
do f <- liftIO (setupSimpleLoopFixpointFeature2 sym loopNum sc sawst mdMap loopcfg mvar func)
558+
do f <- liftIO (setupSimpleLoopInvariantFeature sym loopNum sc sawst mdMap loopcfg mvar func)
559559
return [f]
560560

561561
let execFeatures = simpleLoopFixpointFeature ++ psatf
@@ -656,7 +656,7 @@ setupSimpleLoopFixpointFeature sym sc sawst cfg mvar func =
656656
return (result_substitution, result_condition)
657657

658658

659-
setupSimpleLoopFixpointFeature2 ::
659+
setupSimpleLoopInvariantFeature ::
660660
( sym ~ W4.B.ExprBuilder n st fs
661661
, C.IsSymInterface sym
662662
, n ~ GlobalNonceGenerator
@@ -674,8 +674,8 @@ setupSimpleLoopFixpointFeature2 ::
674674
TypedTerm ->
675675
IO (C.ExecutionFeature p sym ext rtp)
676676

677-
setupSimpleLoopFixpointFeature2 sym loopNum sc sawst mdMap cfg mvar func =
678-
Crucible.LLVM.Fixpoint2.simpleLoopFixpoint sym loopNum cfg mvar invariant_func
677+
setupSimpleLoopInvariantFeature sym loopNum sc sawst mdMap cfg mvar func =
678+
SimpleInvariant.simpleLoopInvariant sym loopNum cfg mvar invariant_func
679679

680680
where
681681
invariant_func phase implicit_params invariant_substitution =
@@ -693,11 +693,11 @@ setupSimpleLoopFixpointFeature2 sym loopNum sc sawst mdMap cfg mvar func =
693693
implicit_params' <- mapM (scExtCns sc) $ Set.toList $ foldMap getAllExtSet body_tms
694694
initial_exprs <-
695695
forM subst_pairs $
696-
\ (MapF.Pair _var (Crucible.LLVM.Fixpoint2.FixpointEntry initVal _current)) ->
696+
\ (MapF.Pair _var (SimpleInvariant.InvariantEntry initVal _current)) ->
697697
toSC sym sawst initVal
698698
current_exprs <-
699699
forM subst_pairs $
700-
\ (MapF.Pair _var (Crucible.LLVM.Fixpoint2.FixpointEntry _init current)) ->
700+
\ (MapF.Pair _var (SimpleInvariant.InvariantEntry _init current)) ->
701701
toSC sym sawst current
702702

703703
initial_tuple <- scTuple sc initial_exprs
@@ -730,8 +730,8 @@ setupSimpleLoopFixpointFeature2 sym loopNum sc sawst mdMap cfg mvar func =
730730

731731
-- Add goal metadata for the initial and inductive invariants
732732
case phase of
733-
Crucible.LLVM.Fixpoint2.HypotheticalInvariant -> return b
734-
Crucible.LLVM.Fixpoint2.InitialInvariant ->
733+
SimpleInvariant.HypotheticalInvariant -> return b
734+
SimpleInvariant.InitialInvariant ->
735735
do (ann,b') <- W4.annotateTerm sym b
736736
loc <- W4.getCurrentProgramLoc sym
737737
let md = MS.ConditionMetadata
@@ -742,7 +742,7 @@ setupSimpleLoopFixpointFeature2 sym loopNum sc sawst mdMap cfg mvar func =
742742
}
743743
modifyIORef mdMap (Map.insert ann md)
744744
return b'
745-
Crucible.LLVM.Fixpoint2.InductiveInvariant ->
745+
SimpleInvariant.InductiveInvariant ->
746746
do (ann,b') <- W4.annotateTerm sym b
747747
loc <- W4.getCurrentProgramLoc sym
748748
let md = MS.ConditionMetadata

src/SAWScript/Interpreter.hs

+4-4
Original file line numberDiff line numberDiff line change
@@ -3180,13 +3180,13 @@ primitives = Map.fromList
31803180
, "the live variables in the loop evolve as the loop computes."
31813181
]
31823182

3183-
, prim "llvm_verify_fixpoint_x86_ex"
3183+
, prim "llvm_verify_x86_with_invariant"
31843184
"LLVMModule -> String -> String -> [(String, Int)] -> Bool -> (String, Int, Term) -> LLVMSetup () -> ProofScript () -> TopLevel LLVMSpec"
3185-
(pureVal llvm_verify_fixpoint_x86_ex)
3185+
(pureVal llvm_verify_x86_with_invariant)
31863186
Experimental
31873187
[ "An experimental variant of 'llvm_verify_x86'. This variant can prove some properties"
3188-
, "involving simple loops with the help of a user-provided term that describes how"
3189-
, "the live variables in the loop evolve as the loop computes."
3188+
, "involving simple loops with the help of a user-provided loop invariant describes"
3189+
, "how the live variables in the loop evolve as the loop computes."
31903190
]
31913191

31923192
, prim "enable_x86_what4_hash_consing" "TopLevel ()"

0 commit comments

Comments
 (0)