CLI Reference
The imandrax-cli tool provides command-line access to ImandraX for verification, OCaml extraction, interactive sessions, server management, and CI/CD integration.
Commands overview
| Command | Description |
|---|---|
check | Check (verify) files in batch mode |
extract | Extract IML files to valid OCaml |
repl | Open an interactive REPL session |
serve-http | Start an HTTP server for exploring sessions |
lsp | Run the LSP server (used by VS Code extension) |
analyze-dune | Analyze a Dune project |
version | Display the version |
imandrax-cli check
Verify all theorems, lemmas, and verification goals in one or more files:
imandrax-cli check myfile.iml
imandrax-cli check src/model.iml src/properties.imlThis is the primary command for CI/CD pipelines — add it to your build process to ensure all proofs pass before merging.
Key options:
| Option | Description |
|---|---|
--api-key <key> | API key (or set IMANDRAX_API_KEY env var) |
--api-key-file <path> | File containing the API key |
--timeout <seconds> | Timeout in seconds for verification |
-j <n> | Number of worker processes |
--check=false | Parse and type-check only, skip proof verification |
--po-filter="Foo.bar" | Only check proof obligations from symbol Foo.bar |
--po-save-into <dir> | Save proof obligations to a directory |
--db <path> | Store results in a database on disk |
--db-as-cache rw|ro|no | Cache results in the database |
--proof-check <val> | Do proof checking if PO is successful |
--serve=true | Spawn HTTP server in the background alongside checking |
--serve-port <port> | Port for the background HTTP server |
-c <path>, --config <path> | Configuration file |
--dump-eval-results=false | Suppress evaluation results output |
--dump-po-results=false | Suppress proof obligation results output |
--dump-decomp-results=false | Suppress decomposition results output |
--dump-stats=false | Suppress statistics output |
Exit codes:
| Code | Meaning |
|---|---|
0 | Success — all goals verified |
123 | Errors reported on standard error |
124 | Command-line parsing errors |
125 | Unexpected internal errors |
imandrax-cli extract
Extract IML definitions to valid OCaml source code:
# Extract to stdout
imandrax-cli extract myfile.iml
# Extract to a file
imandrax-cli extract myfile.iml -o myfile.ml
# Add deriving annotations
imandrax-cli extract myfile.iml --deriving yojsonThis generates OCaml code from your verified IML definitions, suitable for integration with Dune build projects. See Evaluation & Extraction for details on the extraction workflow.
Key options:
| Option | Description |
|---|---|
-o <file>, --out <file> | Output file (default: stdout) |
--deriving <val> | Add [@@deriving ...] annotations |
--no-line-numbers | Omit line number directives in output |
--no-prelude | Do not open the prelude |
imandrax-cli repl
Open an interactive REPL (read-eval-print loop) session:
# Start a fresh REPL
imandrax-cli repl
# Load files before starting
imandrax-cli repl -l prelude.iml -l model.imlThe REPL lets you interactively define functions, run verifications, and explore your models. It supports all IML commands including verify, instance, theorem, and eval.
Key options:
| Option | Description |
|---|---|
--api-key <key> | API key (or set IMANDRAX_API_KEY env var) |
-l <files>, --load <files> | Files to load before starting the REPL |
-j <n> | Number of worker processes |
--prelude=false | Do not load the prelude |
--syntax <val> | Syntax for the code |
--color=false | Disable colorized output |
--proof-check <val> | Do proof checking if PO is successful |
--serve=true | Spawn HTTP server in the background |
--serve-port <port> | Port for the background HTTP server |
-c <path>, --config <path> | Configuration file |
imandrax-cli serve-http
Start an HTTP server for exploring existing sessions:
imandrax-cli serve-http -p 8080Key options:
| Option | Description |
|---|---|
--api-key <key> | API key (or set IMANDRAX_API_KEY env var) |
-p <port>, --port <port> | Port for the HTTP server |
-j <n> | Number of worker processes |
--db <path> | Database path |
--db-as-cache rw|ro|no | Cache results in the database |
-c <path>, --config <path> | Configuration file |
See HTTP API for details on the API endpoints.
imandrax-cli lsp
Run the Language Server Protocol server. This is used internally by the VS Code extension — you typically don't need to run it directly:
imandrax-cli lspimandrax-cli analyze-dune
Analyze a Dune project to discover IML files and their dependencies:
imandrax-cli analyze-dune --from-dir ./my-projectimandrax-cli version
Display the installed version:
imandrax-cli versionCI/CD integration
GitHub Actions
- name: Verify IML files
run: |
imandrax-cli check src/model.iml
imandrax-cli check src/properties.iml
env:
IMANDRAX_API_KEY: ${{ secrets.IMANDRAX_API_KEY }}General CI
#!/bin/bash
set -e
# Verify all .iml files
for f in src/*.iml; do
echo "Checking $f..."
imandrax-cli check "$f"
done
echo "All verifications passed!"Extract and build
#!/bin/bash
set -e
# Extract verified IML to OCaml
imandrax-cli extract src/model.iml -o src/model.ml
# Build with Dune
dune buildEnvironment variables
| Variable | Description |
|---|---|
IMANDRAX_API_KEY | Your ImandraX API key (also checks IMANDRA_UNI_KEY and IMANDRA_KEY) |
IMANDRAX_DEPLOYMENT | Deployment target: local, prod, or net |
IMANDRAX_BACKTRACES | Enable backtraces for debugging |
Common options
These options are available across most commands:
| Option | Description |
|---|---|
--help | Show help for a command |
-d, --debug | Enable debug mode |
--log-level <val> | Set log level |
--log-file <file> | Log to a file |
--log-stderr | Log to stderr |
--gc-space-overhead <n> | GC space overhead (default: 60) |
--thread-pool-size <n> | Size of internal thread pool |