@@ -1886,7 +1886,7 @@ llvm_verify :
1886
1886
String ->
1887
1887
[CrucibleMethodSpec] ->
1888
1888
Bool ->
1889
- CrucibleSetup () ->
1889
+ LLVMSetup () ->
1890
1890
ProofScript SatResult ->
1891
1891
TopLevel CrucibleMethodSpec
1892
1892
~~~~
@@ -1915,7 +1915,7 @@ jvm_verify :
1915
1915
TopLevel JVMMethodSpec
1916
1916
~~~~
1917
1917
1918
- Now we describe how to construct a value of type ` CrucibleSetup ()` (or
1918
+ Now we describe how to construct a value of type ` LLVMSetup ()` (or
1919
1919
` JVMSetup () ` ).
1920
1920
1921
1921
## Structure of a Specification
@@ -1929,7 +1929,7 @@ A specifications for Crucible consists of three logical components:
1929
1929
* A specification of the expected final value of the program state.
1930
1930
1931
1931
These three portions of the specification are written in sequence within
1932
- a ` do ` block of ` CrucibleSetup ` (or ` JVMSetup ` ) type. The command
1932
+ a ` do ` block of ` LLVMSetup ` (or ` JVMSetup ` ) type. The command
1933
1933
` llvm_execute_func ` (or ` jvm_execute_func ` ) separates the
1934
1934
specification of the initial state from the specification of the final
1935
1935
state, and specifies the arguments to the function in terms of the
@@ -1946,7 +1946,7 @@ contain fresh variables. These are created in a specification with the
1946
1946
` llvm_fresh_var ` and ` jvm_fresh_var ` commands rather than
1947
1947
` fresh_symbolic ` .
1948
1948
1949
- * ` llvm_fresh_var : String -> LLVMType -> CrucibleSetup Term `
1949
+ * ` llvm_fresh_var : String -> LLVMType -> LLVMSetup Term `
1950
1950
1951
1951
* ` jvm_fresh_var : String -> JavaType -> JVMSetup Term `
1952
1952
@@ -2022,14 +2022,14 @@ Once the initial state has been configured, the `llvm_execute_func`
2022
2022
command specifies the parameters of the function being analyzed in terms
2023
2023
of the state elements already configured.
2024
2024
2025
- * ` llvm_execute_func : [SetupValue] -> CrucibleSetup () `
2025
+ * ` llvm_execute_func : [SetupValue] -> LLVMSetup () `
2026
2026
2027
2027
## Return Values
2028
2028
2029
2029
To specify the value that should be returned by the function being
2030
2030
verified use the ` llvm_return ` or ` jvm_return ` command.
2031
2031
2032
- * ` llvm_return : SetupValue -> CrucibleSetup () `
2032
+ * ` llvm_return : SetupValue -> LLVMSetup () `
2033
2033
* ` jvm_return : JVMValue -> JVMSetup () `
2034
2034
2035
2035
## A First Simple Example
@@ -2076,7 +2076,7 @@ and more complex systems than otherwise possible.
2076
2076
The ` llvm_verify ` and ` jvm_verify ` functions return values of
2077
2077
type ` CrucibleMethodSpec ` and ` JVMMethodSpec ` , respectively. These
2078
2078
values are opaque objects that internally contain both the information
2079
- provided in the associated ` JVMSetup ` or ` CrucibleSetup ` blocks and
2079
+ provided in the associated ` JVMSetup ` or ` LLVMSetup ` blocks and
2080
2080
the results of the verification process.
2081
2081
2082
2082
Any of these ` MethodSpec ` objects can be passed in via the third
@@ -2128,7 +2128,7 @@ point to allocated memory before they are called. The `llvm_alloc`
2128
2128
command allows you to specify that a function expects a particular
2129
2129
pointer to refer to an allocated region appropriate for a specific type.
2130
2130
2131
- * ` llvm_alloc : LLVMType -> CrucibleSetup SetupValue `
2131
+ * ` llvm_alloc : LLVMType -> LLVMSetup SetupValue `
2132
2132
2133
2133
This command returns a ` SetupValue ` consisting of a pointer to the
2134
2134
allocated space, which can be used wherever a pointer-valued
@@ -2151,7 +2151,7 @@ In LLVM, it's also possible to construct fresh pointers that do not
2151
2151
point to allocated memory (which can be useful for functions that
2152
2152
manipulate pointers but not the values they point to):
2153
2153
2154
- * ` llvm_fresh_pointer : LLVMType -> CrucibleSetup SetupValue `
2154
+ * ` llvm_fresh_pointer : LLVMType -> LLVMSetup SetupValue `
2155
2155
2156
2156
The NULL pointer is called ` llvm_null ` in LLVM and ` jvm_null ` in
2157
2157
JVM:
@@ -2161,7 +2161,7 @@ JVM:
2161
2161
2162
2162
One final, slightly more obscure command is the following:
2163
2163
2164
- * ` llvm_alloc_readonly : LLVMType -> CrucibleSetup SetupValue `
2164
+ * ` llvm_alloc_readonly : LLVMType -> LLVMSetup SetupValue `
2165
2165
2166
2166
This works like ` llvm_alloc ` except that writes to the space
2167
2167
allocated are forbidden. This can be useful for specifying that a
@@ -2181,7 +2181,7 @@ appropriate. In most cases, however, it's more useful to state that a
2181
2181
pointer points to some specific (usually symbolic) value, which you can
2182
2182
do with the ` llvm_points_to ` command.
2183
2183
2184
- * ` llvm_points_to : SetupValue -> SetupValue -> CrucibleSetup () `
2184
+ * ` llvm_points_to : SetupValue -> SetupValue -> LLVMSetup () `
2185
2185
takes two ` SetupValue ` arguments, the first of which must be a pointer,
2186
2186
and states that the memory specified by that pointer should contain the
2187
2187
value given in the second argument (which may be any type of
@@ -2196,7 +2196,7 @@ type as another through casts, it can be useful to specify that a
2196
2196
pointer points to a value that does not agree with its static type.
2197
2197
2198
2198
* `llvm_points_to_untyped : SetupValue -> SetupValue ->
2199
- CrucibleSetup ()` works like ` llvm_points_to` but omits type
2199
+ LLVMSetup ()` works like ` llvm_points_to` but omits type
2200
2200
checking. Rather than omitting type checking across the board, we
2201
2201
introduced this additional function to make it clear when a type
2202
2202
reinterpretation is intentional. As an alternative, one
@@ -2231,7 +2231,7 @@ of `llvm_fresh_var` and `llvm_elem` or `llvm_field` commands.
2231
2231
However, the following function can simplify the common case
2232
2232
where you want every element or field to have a fresh value.
2233
2233
2234
- * ` llvm_fresh_expanded_val : LLVMType -> CrucibleSetup SetupValue `
2234
+ * ` llvm_fresh_expanded_val : LLVMType -> LLVMSetup SetupValue `
2235
2235
2236
2236
The ` llvm_struct_value ` function normally creates a ` struct ` whose layout
2237
2237
obeys the alignment rules of the platform specified in the LLVM file
@@ -2300,7 +2300,7 @@ special care is required to write SAW specifications involving bitfields. For
2300
2300
this reason, there is a dedicated ` llvm_points_to_bitfield ` function for this
2301
2301
purpose:
2302
2302
2303
- * ` llvm_points_to_bitfield : SetupValue -> String -> SetupValue -> CrucibleSetup () `
2303
+ * ` llvm_points_to_bitfield : SetupValue -> String -> SetupValue -> LLVMSetup () `
2304
2304
2305
2305
The type of ` llvm_points_to_bitfield ` is similar that of ` llvm_points_to ` ,
2306
2306
except that it takes the name of a field within a bitfield as an additional
@@ -2356,7 +2356,7 @@ them.
2356
2356
Mutable global variables that are accessed in a function must first be allocated
2357
2357
by calling ` llvm_alloc_global ` on the name of the global.
2358
2358
2359
- * ` llvm_alloc_global : String -> CrucibleSetup () `
2359
+ * ` llvm_alloc_global : String -> LLVMSetup () `
2360
2360
2361
2361
This ensures that all global variables that might influence the function are
2362
2362
accounted for explicitly in the specification: if ` llvm_alloc_global ` is
@@ -2461,17 +2461,21 @@ rise to specific final conditions. For these cases, you can specify an
2461
2461
arbitrary predicate as a precondition or post-condition, using any
2462
2462
values in scope at the time.
2463
2463
2464
- * ` llvm_precond : Term -> CrucibleSetup () `
2465
- * ` llvm_postcond : Term -> CrucibleSetup () `
2464
+ * ` llvm_precond : Term -> LLVMSetup () `
2465
+ * ` llvm_postcond : Term -> LLVMSetup () `
2466
+ * ` llvm_assert : Term -> LLVMSetup () `
2466
2467
* ` jvm_precond : Term -> JVMSetup () `
2467
2468
* ` jvm_postcond : Term -> JVMSetup () `
2469
+ * ` jvm_assert : Term -> JVMSetup () `
2468
2470
2469
- These two commands take ` Term ` arguments, and therefore cannot describe
2470
- the values of pointers. The ` llvm_equal ` command states that two
2471
- ` SetupValue ` s should be equal, and can be used in either the initial or
2472
- the final state.
2471
+ These commands take ` Term ` arguments, and therefore cannot describe
2472
+ the values of pointers. The "assert" variants will work in either pre-
2473
+ or post-conditions, and are useful when defining helper functions
2474
+ that, e.g., state datastructure invariants that make sense in both
2475
+ phases. The ` llvm_equal ` command states that two ` SetupValue ` s should
2476
+ be equal, and can be used in either the initial or the final state.
2473
2477
2474
- * ` llvm_equal : SetupValue -> SetupValue -> CrucibleSetup () `
2478
+ * ` llvm_equal : SetupValue -> SetupValue -> LLVMSetup () `
2475
2479
2476
2480
The use of ` llvm_equal ` can also sometimes lead to more efficient
2477
2481
symbolic execution when the predicate of interest is an equality.
@@ -2487,7 +2491,7 @@ simulation of the function. To skip simulation altogether, one can use:
2487
2491
2488
2492
~~~
2489
2493
llvm_unsafe_assume_spec :
2490
- LLVMModule -> String -> CrucibleSetup () -> TopLevel CrucibleMethodSpec
2494
+ LLVMModule -> String -> LLVMSetup () -> TopLevel CrucibleMethodSpec
2491
2495
~~~
2492
2496
2493
2497
Or, in the experimental JVM implementation:
@@ -2634,7 +2638,7 @@ Ghost state variables do not initially have any particluar type, and can
2634
2638
store data of any type. Given an existing ghost variable the following
2635
2639
function can be used to specify its value:
2636
2640
2637
- * `llvm_ghost_value : Ghost -> Term -> CrucibleSetup ()`
2641
+ * `llvm_ghost_value : Ghost -> Term -> LLVMSetup ()`
2638
2642
2639
2643
Currently, this function can only be used for LLVM verification, though
2640
2644
that will likely be generalized in the future. It can be used in either
@@ -2679,7 +2683,7 @@ above.
2679
2683
#### Utility Functions
2680
2684
2681
2685
We first define the function
2682
- `alloc_init : LLVMType -> Term -> CrucibleSetup SetupValue`.
2686
+ `alloc_init : LLVMType -> Term -> LLVMSetup SetupValue`.
2683
2687
2684
2688
`alloc_init ty v` returns a `SetupValue` consisting of a pointer to memory
2685
2689
allocated and initialized to a value `v` of type `ty`. `alloc_init_readonly`
@@ -2702,7 +2706,7 @@ let alloc_init_readonly ty v = do {
2702
2706
~~~~
2703
2707
2704
2708
We now define
2705
- `ptr_to_fresh : String -> LLVMType -> CrucibleSetup (Term, SetupValue)`.
2709
+ `ptr_to_fresh : String -> LLVMType -> LLVMSetup (Term, SetupValue)`.
2706
2710
2707
2711
`ptr_to_fresh n ty` returns a pair `(x, p)` consisting of a fresh symbolic
2708
2712
variable `x` of type `ty` and a pointer `p` to it. `n` specifies the
@@ -2724,7 +2728,7 @@ let ptr_to_fresh_readonly n ty = do {
2724
2728
~~~~
2725
2729
2726
2730
Finally, we define
2727
- `oneptr_update_func : String -> LLVMType -> Term -> CrucibleSetup ()`.
2731
+ `oneptr_update_func : String -> LLVMType -> Term -> LLVMSetup ()`.
2728
2732
2729
2733
`oneptr_update_func n ty f` specifies the behavior of a function that takes
2730
2734
a single pointer (with a printable name given by `n`) to memory containing a
@@ -2753,7 +2757,7 @@ Cryptol implementation and it is asserted that the pointers do in fact point to
2753
2757
these expected values.
2754
2758
2755
2759
~~~~
2756
- let quarterround_setup : CrucibleSetup () = do {
2760
+ let quarterround_setup : LLVMSetup () = do {
2757
2761
(y0, p0) <- ptr_to_fresh "y0" (llvm_int 32);
2758
2762
(y1, p1) <- ptr_to_fresh "y1" (llvm_int 32);
2759
2763
(y2, p2) <- ptr_to_fresh "y2" (llvm_int 32);
0 commit comments