REPL Commands
Commands
:! COMMANDExecute a command in the shell
:? TOPIC,:help TOPICDisplay a brief description of a function, type, or command. (e.g. :help :help)
- TOPIC can be any of:
Specific REPL colon-commands (e.g.
:help :prove)Functions (e.g.
:help join)Infix operators (e.g.
:help +)Type constructors (e.g.
:help Z)Type constraints (e.g.
:help fin):set-able options (e.g.:help :set base)
:ast EXPRPrint out the pre-typechecked AST of a given term.
:b MODULE,:browse MODULEDisplay information about loaded modules.
With no argument,
:browseshows information about the names in scope. With an argumentM, shows information about the names exported fromM.:cd DIRSet the current working directory.
:check [EXPR]Use random testing to check that the argument always returns true. (If no argument, check all properties.)
By default, this will check up to 100 test cases, or until the possible inputs are exhausted. This value can be changed with
:set tests=[NEW VAL].:debug_specialize EXPRDo type specialization on a closed expression.
:dumptests FILE EXPRDump a tab-separated collection of tests for the given expression into a file. The first column in each line is the expected output, and the remainder are the inputs. The number of tests is determined by the
testsoption.:e FILE,:edit FILEEdit FILE or the currenly loaded module.
:eval EXPREvaluate an expression with the reference evaluator.
:exhaust [EXPR]Use exhaustive testing to prove that the argument always returns true. (If no argument, check all properties.)
:extract-coqPrint out the post-typechecked AST of all currently defined terms, in a Coq- parseable format.
:file-deps FILEShow information about the dependencies of a file.
:generate-foreign-header FILEGenerate a C header file from foreign declarations in a Cryptol file.
Converts all foreign declarations in the given Cryptol file into C function declarations, and writes them to a file with the same name but with a
.hextension.:l FILE,:load FILELoad a module by filename.
:m [MODULE],:module [MODULE]Load a module by its name.
:module-deps MODULEShow information about the dependencies of a module.
:new-seedRandomly generate and set a new seed for the random number generator.
:prove [EXPR]Use an external solver to prove that the argument always returns true. (If no argument, check all properties.)
If the expression is successfully proven, the screen will display
Q.E.D. If not, the screen will display a counterexample that returns false.:q,:quitExit the REPL.
:r,:reloadReload the currently loaded module.
:readByteArray FILERead data from a file as type
fin n => [n][8], binding the value to variableit.:s [OPTION=[VALUE]],:set [OPTION=[VALUE]]Set an environmental option (
:seton its own displays current values).:safe [EXPR]Uses an external solver to prove that an expression is safe (does not encounter run-time errors) for all inputs.
:sat [EXPR]Uses a solver to find a satisfying assignment for which the argument returns true. (If no argument, find an assignment for all properties.)
By default, this will return one assignment, but that can be updated with
:set satNum=VAL:set-seed SEEDSeed the random number generator for operations using randomness.
A seed takes the form of either a single integer or a 4-tuple of unsigned 64-bit integers. Examples of commands using randomness are
:dumpTestsand:check.:t EXPR,:type EXPRCheck the type of an expression.
:time EXPRMeasure the time it takes to evaluate the given expression.
The expression will be evaluated many times to get accurate results. Note that the first evaluation of a binding may take longer due to laziness, and this may affect the reported time. If this is not desired then make sure to evaluate the expression once first before running
:time.The amount of time to spend collecting measurements can be changed with the
timeMeasurementPeriodoption.Reports the average wall clock time, CPU time, and cycles. (Cycles are in unspecified units that may be CPU cycles.)
Binds the result to
it : { avgTime : Float64 , avgCpuTime : Float64 , avgCycles : Integer }
:versionDisplays the version of the Cryptol executable.
:w FILE EXPR,:writeByteArray FILE EXPRWrite data of type
fin n => [n][8]to a file.
:set Options
:set baseDefault value:
16Valid values:
2,8,10,16The base to display words at
:set debugDefault value:
offValid values:
off,on,false,trueEnable debugging output
:set asciiDefault value:
offValid values:
off,on,false,trueWhether to display 7- or 8-bit words using ASCII notation
:set infLengthDefault value:
5Valid values: any positive integer
The number of elements to display for infinite sequences
:set testsDefault value:
100Valid values: any positive integer
The number of random tests to try with
:check:set satNumDefault value:
1Valid values: any positive integer,
allThe maximum number of
:satsolutions to display (“all” for no limits):set proverDefault value:
z3Valid values:
cvc4,cvc5,yices,z3,boolector,mathsat,abc,bitwuzla,offline,any,sbv-cvc4,sbv-cvc5,sbv-yices,sbv-z3,sbv-boolector,sbv-mathsat,sbv-abc,sbv-bitwuzla,sbv-offline,sbv-any,w4-cvc4,w4-cvc5,w4-yices,w4-z3,w4-boolector,w4-abc,w4-bitwuzla,w4-offline,w4-anyThe external SMT solver for
:proveand:sat:set warnDefaultingDefault value:
offValid values:
off,on,false,trueChoose whether to display warnings when defaulting
:set warnShadowingDefault value:
onValid values:
off,on,false,trueChoose whether to display warnings when shadowing symbols
:set warnPrefixAssocDefault value:
onValid values:
off,on,false,trueChoose whether to display warnings when expression association has changed due to new prefix operator fixities
:set warnUninterpDefault value:
onValid values:
off,on,false,trueChoose whether to issue a warning when uninterpreted functions are used to implement primitives in the symbolic simulator
:set warnNonExhaustiveConstraintGuardsDefault value:
onValid values:
off,on,false,trueChoose whether to issue a warning when a use of constraint guards is not determined to be exhaustive
:set smtFileDefault value:
-Valid values: Any file path,
-The file to use for SMT-Lib scripts (for debugging or offline proving). Use
-for stdout:set pathDefault value:
Valid values: Any file path, empty
The search path for finding named Cryptol modules
:set monoBindsDefault value:
onValid values:
off,on,false,trueWhether or not to generalize bindings in a
whereclause:set tcSolverDefault value:
z3 -smt2 -inValid values: a valid executable
The solver that will be used by the type checker
:set tcDebugDefault value:
0Valid values:
0, any positive integer- Enable type-checker debugging output:
0no debug output1show type-checker debug info>1show type-checker debug info and interactions with SMT solver
:set coreLintDefault value:
offValid values:
off,on,false,trueEnable sanity checking of type-checker
:set hashConsingDefault value:
onValid values:
off,on,false,trueEnable hash-consing in the What4 symbolic backends
:set proverStatsDefault value:
onValid values:
off,on,false,trueEnable prover timing statistics
:set proverValidateDefault value:
offValid values:
off,on,false,trueValidate
:satexamples and:provecounter-examples for correctness:set showExamplesDefault value:
onValid values:
off,on,false,truePrint the (counter) examples after
:sator:prove:set fpBaseDefault value:
16Valid values:
2,8,10,16The base to display floating point numbers at
:set fpFormatDefault value:
freeValid values:
free,free+exp,.NUM,NUM,NUM+exp- Specifies the format to use when displaying floating point numbers:
freeshow using as many digits as neededfree+explikefreebut always show exponent.NUMshow NUM (>=1) digits after floating pointNUMshow using NUM (>=1) significant digitsNUM+explike NUM but always show exponent
:set ignoreSafetyDefault value:
offValid values:
off,on,false,trueIgnore safety predicates when performing
:sator:provechecks:set fieldOrderDefault value:
displayValid values:
display,canonical- The order that record fields are displayed in
displaytry to match the order they were written in the source codecanonicaluse a predictable, canonical order
:set timeMeasurementPeriodDefault value:
10Valid values: any positive integer
The period of time in seconds to spend collecting measurements when running
:time.This is a lower bound and the actual time taken may be higher if the evaluation takes a long time.
:set timeQuietDefault value:
offValid values:
off,on,false,trueSuppress output of
:timecommand and only bind result toit