Note: The SAW API is still in flux and is not yet fully documented.
As with the Cryptol methods, server state is propagated as described in the protocol overview.
Methods implemented against the SAW API may throw :ref:`a variety of SAW-related
errors <saw-server-errors>`, with codes in the range of 10000
-19999
.
Additionally, SAW verification relies on Cryptol, and some SAW methods may throw
:ref:`Cryptol server errors <cryptol-server-errors>` when appropriate.
Method name: |
|
---|---|
Parameters: |
|
Method name: |
|
---|---|
Parameters: |
|
Method name: |
|
---|---|
Parameters: |
|
NOTE: The following represents an aspirational view of the JVM-specific protocol; currently, the code underlying these methods is incomplete and does not work.
Method name: |
|
---|---|
Parameters: |
|
Method name: |
|
---|---|
Parameters: |
|
Method name: |
|
---|---|
Parameters: |
|
Method name: |
|
---|---|
Parameters: |
|
Method name: |
|
---|---|
Parameters: |
|
Method name: |
|
---|---|
Parameters: |
|
Method name: |
|
---|---|
Parameters: |
|
Method name: |
|
---|---|
Parameters: |
|
Method name: |
|
---|---|
Parameters: |
|
Return fields: |
|
Method name: |
|
---|---|
Parameters: |
|
SAW verification relies on the provision of specifications to verify against. In the API, these specifications are represented by a JSON object with the following fields:
pre vars
- A list of symbolic variables introduced in the initial state section of the specification. These variables are represented by a JSON object containing three fields:
server name
: The name of the variable on the server.name
: The "display name" of the variable, used in debugging output.type
: The :ref:`LLVM<llvm-types>` or :ref:`JVM<jvm-types>` type of this variable.
pre conds
- A list of the specification's preconditions, as :ref:`Cryptol terms<cryptol-json-expression>`.
pre allocated
- A list of allocations in the initial state section of the specification. In preconditions, allocations specify that the function being verified expects a pointer to the allocated memory to exist. An allocation is a JSON object containing four fields, one of which is optional:
server name
: The name by which the allocation is referred to on the server.type
: The :ref:`LLVM<llvm-types>` or :ref:`JVM<jvm-types>` type of the data for which space is being allocated.mutable
: A Boolean value indicating whether the allocated memory is mutable or not.alignment
: An integer value indicating where the start of the allocated memory should be aligned. This value must be a power of two, and the allocated memory may be aligned at any multiple of it. The field must benull
in JVM specifications, and may benull
in LLVM specifications.
pre points to
- A list of 'points-to' relationships in the initial state section of the specification. These relationships are captured in a JSON object containing four fields, two of which are optional:
pointer
: A :ref:`Crucible Setup value<setup-values>` representing the pointer.points to
: A :ref:`Crucible Setup value<setup-values>` representing the referent ofpointer
.check points to type
: An optional description of a type to check thepoints to
value against. If the description isnull
, then this has no effect. The description is represented as a JSON object containing a tag namedcheck against
, with any further fields determined by this tag. These tag values can be:
pointer type
: Check the type of thepoints to
value against the type that thepointer
value's type points to.casted type
: Check the type of thepoints to
value against the provided type. There is an additional fieldtype
, which contains the :ref:`LLVM<llvm-types>` or :ref:`JVM<jvm-types>` type to check against.condition
: An optional condition, represented as a :ref:`Cryptol term<cryptol-json-expression>`. If thecondition
is notnull
, then thepointer
value will only point to thepoints to
value if thecondition
holds.
argument vals
- A list of :ref:`Crucible Setup values<setup-values>` representing the arguments to the function being verified.
post vars
- A list of variables in the final state section of the specification. While in many cases this list will be empty, it is sometimes useful to specify that functions return arbitrary values. These variables are represented in the same way as :ref:`above<contract-vars>`.
post conds
- A list of the specification's postconditions, as :ref:`Cryptol terms<cryptol-json-expression>`.
post allocated
- A list of allocations in the final state section of the specification. In postconditions, allocations specify that the function being verified allocated memory. An allocation is represented in the same was as :ref:`above<allocation>`.
post points tos
- A list of 'points-to' relationships in the final state section of the specification. These relationships are represented in the same was as :ref:`above<points-to>`.
return val
- An optional :ref:`Crucible Setup value<setup-values>` specifying the expected return value of the function being verified.
SAW allows one to direct a verification task using a proof script, which is simply a sequence of proof tactics to apply. Very commonly, the proof script provided in a verification task is simply an instruction to use an external SAT/SMT solver such as ABC, Yices, or Z3.
A proof script is represented as a JSON object with a single field:
tactics
A list of proof tactics to apply to the context/goal. A proof tactic is represented as a JSON object containing a tag named
tactic
, with any further fields determined by this tag. These tag values can be:use prover
- Apply an external prover to the goal. There is an additional field
prover
which is a JSON object with a fieldname
specifying what prover to use (one ofabc
,cvc4
,rme
,yices
, orz3
), and a fielduninterpreted functions
whenname
is one ofcvc4
,yices
, orz3
. This field is a list of names of functions taken as uninterpreted/abstract. unfold
- Unfold terms in the context/goal. There is an additional field
names
, a list of the names bound on the server to unfold. beta reduce goal
- Perform a single beta reduction on the proof goal.
evaluate goal
- Fully evaluate the proof goal. There is an additional field
uninterpreted functions
, a list of names of functions taken as uninterpreted/abstract. simplify
- Simplify the context/goal. There is an additional field
rules
, a name bound to a simpset on the server. assume unsat
- Assume the goal is unsatisfiable, which in the current implementation of SAW should be interpreted as assuming the property being checked to be true. This is likely to change in the future.
trivial
- States that the goal should be trivially true (either the constant
True
or a function that immediately returnsTrue
. This tactic fails if that is not the case.
Setup Values encompass all values that can occur during symbolic execution, including Cryptol terms,
pointers, arrays, and structures. They are used extensively when writing the specifications provided to the
verify
commands. Setup Values are represented as JSON objects containing a tag field, setup value
,
that determines the other fields. This tag value can be:
named
- A term previously saved on the server. There is an additional field
name
giving the name bound to the term on the server. null
- A null/empty value.
Cryptol
- A Cryptol term. There is an additional field
expression
containing a Cryptol expression. array
- An array value. There is an additional field
elements
which is a list of :ref:`Crucible Setup values<setup-values>` to populate the array with. struct
- A struct value. There is an additional field
fields
which is a list of :ref:`Crucible Setup values<setup-values>` to populate the struct with. field
A field of a struct. There are two additional fields:
base
: A :ref:`Crucible Setup value<setup-values>`, the structure containing the field to assign to.field
: The name of the field to assign to.
element lvalue
An element of an array. Theer are two additional fields:
base
: A :ref:`Crucible Setup value<setup-values>`, the array to be indexed for assignment.index
: An integer giving the index into the array to be assigned to.
global initializer
- A constant global initializer value. There is an additional field
name
giving the name of the global variable on the server to access the initializer of. global lvalue
- A global variable to be assigned to. There is an additional field
name
giving the name of the global variable on the server that is to be assigned to.
For most commands involving the introduction of variables or the allocation of space, the type of data to be stored must be provided. Since SAW supports both LLVM and JVM verification, the types from these respective architectures must have JSON representations. Both LLVM and JVM types are represented as JSON objects with a tag field to indicate any additional information that must/might be present.
The tag field is named type
. This tag value can be:
primitive type
An LLVM primitive type. This is an additional field
primitive
which can be any of the following:label
: An LLVM label.void
: The LLVM void type.integer
: An LLVM integer. There is an additional fieldsize
, an integer giving the number of bytes in the integer type.float
: An LLVM float. There is an additional fieldfloat type
which can be any of the following:half
float
double
fp128
x86_fp80
PPC_fp128
X86mmx
: An x86 SIMD instruction.metadata
: LLVM metadata.
type alias
- A type alias. There is an additional field
alias of
, which identifies the type being aliased by name. array
An LLVM array. There are two additional fields:
size
: An integer giving the length of the array.element type
: An :ref:`LLVM type<llvm-types>` describing the array elements.
function
A function type. There are three additional fields:
return type
: An :ref:`LLVM type<llvm-types>` describing the return type of the function.argument types
: A list of :ref:`LLVM types<llvm-types>` describing the arguments of the function.varargs
: A Boolean indicating whether this function takes a variable number of arguments.
pointer
- A pointer type. There is an additional field
to type
, an :ref:`LLVM type<llvm-types>` describing the referent type of the pointer. struct
- A structure type. There is an additional field
fields
, a list of :ref:`LLVM types<llvm-types>` describing the structure fields. packed struct
- A packed structure type. There is an additional field
fields
, a list of :ref:`LLVM types<llvm-types>` describing the structure fields. vector
An LLVM vector. There are two additional fields:
size
: An integer giving the length of the array.element type
: An :ref:`LLVM type<llvm-types>` describing the array elements.
opaque
- An opaque structure type.
As with LLVM types, there is a tag field named type
. This tag value can be:
primitive type
A JVM primitive type. There is an additional field
primitive
which can be any of the following:boolean
: A JVM Boolean.byte
: A JVM byte.char
: A JVM character.double
: A JVM double-precision float.float
: A JVM single-precsion float.int
: A JVM integer.long
: A JVM long integer.short
: A JVM short integer.
array type
A JVM array. There are two additional fields:
size
: An integer giving the length of the array.element type
: An :ref:`JVM type<jvm-types>` describing the array elements.
class type
- A JVM class. There is an additional field
class name
which identifies the class. Class names are encoded using dots.