CVC reads input in a presentation language. The input is a sequence of commands. Each command ends in a semi-colon.
CVC's presentation language is typed. In a typical example, constant symbols, function symbols, and predicate symbols are declared, with their types. Then some formulas are asserted. Finally, some queries are posed, to determine whether or not the asserted formulas logically imply some other formulas.
CVC detects two types types of errors processing input. Parse errors result when CVC's parser is unable to make sense of the input. Currently, parse errors appear with just the line number where they occurred. Type errors are reported in a somewhat more informative way.
Examples of valid input to CVC are given in green below.
This section describes the commands of CVC's presentation language.
New basic types can be declared in CVC using the following
syntax:
New types may be defined in terms of old ones using the following
syntax:
For example, the following defines rPair to be an abbreviation
for the tuple type [ REAL, REAL ]:
rPair : TYPE = [ REAL, REAL];
For example, the following defines msg_type to be the scalar type
{ PING, DATA, ACK }:
msg_type : TYPE = { PING, DATA, ACK };
The expression "{ PING, DATA, ACK }" cannot be used anywhere except as
the right hand side to a type definition like this one.
Constant, function, and predicate symbols, as they are used in
first-order logic, are all referred to here as constants. Constants
may be declared using the following syntax:
For example, the following declarations declare c to be a triple, f to
be a function from tuples to tuples, and p to be a predicate on REALs
(see the documentation on types for more
information on the syntax for types).
c : [ REAL, BOOLEAN, BOOLEAN ];
f : [ [REAL, REAL] -> [BOOLEAN, BOOLEAN] ];
p : [ REAL -> BOOLEAN ];
Constants (see above) may be defined using
the following syntax:
For example, the following declares r to be a record with a "width"
field, and then defines r_width to be "r.width".
r : [# width : REAL, height : REAL #];
r_width : REAL = r.width;
A formula can be added to the current logical context using
the following syntax:
For example, the following is a valid assertion (given suitable
declarations or definitions of x, y, and z).
ASSERT x + 2 * y = z;
faster than
QUERY F_1 => F_2;
QUERY F_1 => F_3;
("=>" is the syntax for "implies") because work performed to handle
the assertion of F_1 will not be duplicated in the former case, but
may be duplicated in the latter. This remark does not apply when
using Chaff, where at most one query can be performed in a single
execution of CVC.
CVC can be queried to determine whether or not a formula is logically
implied by the formulas (if there are any) in the current logical
context using the following syntax:
Currently, if CVC is in SAT mode only
one QUERY command can be processed in a given execution of CVC.
Any expression can be simplified with respect to the current logical
context (see ASSERT and QUERY) using the following syntax:
An expression can be printed without simplification using the
following syntax:
CVC can be told to print a string to stdout using the following
syntax:
CVC may be directed to process another file using the INCLUDE
command. The name of the file is given in double quotation marks.
For example:
INCLUDE "processor_def.cvc";
INCLUDE "queries.cvc";
This command prints the formulas in the current logical context (see
ASSERT and QUERY). The
syntax is just
Note that at any given point, the logical context can be different, depending on whether or not CVC is in SAT mode. This command is most useful when CVC has reported a formula that has been queried with a QUERY command is invalid. In that case, WHERE will print the assumptions under which CVC believes the negation of the formula is satisfied.
In SAT mode, many new constants are added. These new constants may
appear in the formulas printed by WHERE. To print the declarations of
those constants, set the TRACE option "Vars" before calling WHERE.
For example:
TRACE "Vars";
WHERE;
In some cases, constructs may appear in the formulas produced by WHERE which currently are not valid input to CVC. These constructs are introduced by the decision procedures (particularly, the decision procedure for arrays) as they run. Explaining these constructs is currently beyond the scope of this documentation.
WHERE also prints the scope level of the current scope (see PUSH, etc. below for an explanation of scopes).
Various options for tracing the execution of CVC may be turned on and
off using the TRACE command. With no arguments, TRACE prints a list
of those options. With the name of an option (in double quotation
marks), it toggles the option. ALL and NONE are special options that
turn on and off, respectively, all the options. TRACE will probably
not be used by typical users of CVC.
If a CVC reports that a queried (with QUERY) formula is valid, this command will dump a proof of that formula. For DUMP_PROOF to be available, CVC must not be in SAT mode, and CVC must have been invoked with the command-line option +proofs.
DUMP_PROOF may be called like this:
The proof produced will generally depend on the assertions (added with ASSERT) in the current logical context, and on the declarations of types and constants. Those declarations are dumped separately using the DUMP_SIG command, which may also be called with the name of a file to use or with no arguments.
See the section on checking proofs with flea
for information on how to check the proofs produced by DUMP_PROOF.
DUMP_ASSUMPTIONS is available under the same conditions as DUMP_PROOF, and may be called in the same way.
It dumps all the assumptions that were relevant to the validity of a
queried (with QUERY) formula which CVC reports to
be valid.
More than one logical context (see ASSERT and QUERY) can exist at the same time. To switch
contexts, the CONTEXT command is used:
With no arguments, CONTEXT prints the name of the current context.
PUSH, POP, and POPTO can be called with no arguments, in which case a default argument of 1 is supplied. CVC is always in a scope, so it is not allowed to pop the first scope (which is the one with scope level 1). RESET is just a synonym for POPTO with no arguments.
WHERE prints the scope level of the current scope.
If CVC reports that a queried (with QUERY)
formula is invalid, it will remain in the scope where the invalidity
was detected.