| name | pvs-cli |
| description | Command-line interface to PVS for typechecking, proving, and ground evaluation (PVSio). Use this skill when: the user wants to typecheck PVS files, start or manage proof sessions, send proof commands interactively, evaluate ground expressions using PVSio, or work with PVS from the command line without the GUI.
|
PVS-CLI: Command-Line Interface for PVS
This skill provides guidance for using pvs-cli.sh, a Python-based command-line tool for interacting with PVS (Prototype Verification System) in server mode.
Prerequisites
PVS Server Must Be Running
pvs-cli.sh requires a PVS server. If you get "Could not connect to PVS server", the server is not running.
Check if server is running:
pvs-cli.sh --status
If you see "Could not connect", ask the user to start the server in a separate terminal:
pvs -raw -port 23456
Or if the project depends on specific libraries:
export PVS_LIBRARY_PATH=/path/to/libraries
pvs -raw -port 23456
Important: The PVS server runs in the foreground and must stay running. The user should start it in a separate terminal window or use nohup:
nohup pvs -raw -port 23456 > /dev/null 2>&1 &
First-Time Setup
Initialize the virtual environment (only needed once):
pvs-cli.sh --init-venv
Core Commands
Typechecking
pvs-cli.sh --typecheck "/path/to/file.pvs"
pvs-cli.sh --parse "/path/to/file.pvs"
Starting a Proof
pvs-cli.sh --prove "/path/to/file.pvs#theory#formula"
Example output:
Starting proof session for lemma_1
lemma_1 :
|-------
{1} FORALL (x: nat): x >= 0
Proof ID: lemma_1-0
Ready to receive proof commands
Sending Proof Commands
pvs-cli.sh --proof-command "(skolem!)"
pvs-cli.sh --proof-command "(grind)"
pvs-cli.sh --proof-command "(apply (grind) :timeout 10)"
If a command doesn't close the branch or times out:
pvs-cli.sh --proof-command "(undo)"
Managing Proof Sessions
pvs-cli.sh --list-active-proofs
pvs-cli.sh --status
pvs-cli.sh --set-active-proof lemma_1-1
pvs-cli.sh --quit-proof
pvs-cli.sh --quit-all-proofs
Saving Proofs
pvs-cli.sh --save-all-proofs "/path/to/file.pvs#theory"
pvs-cli.sh --mark-proof-as-default "/path/to/file.pvs#theory#formula" "proof-id"
Complete Proof Workflow
pvs-cli.sh --typecheck "/path/to/example.pvs"
pvs-cli.sh --prove "/path/to/example.pvs#example#lemma_1"
pvs-cli.sh --proof-command "(skeep)"
pvs-cli.sh --proof-command "(apply (grind) :timeout 10)"
pvs-cli.sh --proof-command "(expand \"definition_name\")"
pvs-cli.sh --proof-command "(apply (inst?) :timeout 10)"
pvs-cli.sh --quit-proof
pvs-cli.sh --save-all-proofs "/path/to/example.pvs#example"
pvs-cli.sh --mark-proof-as-default "/path/to/example.pvs#example#lemma_1" "lemma_1-0"
Formula References (FORMREF)
Formula references can be specified in different formats:
| Format | Example | When to Use |
|---|
| Full path | /path/to/file.pvs#theory#formula | Most reliable |
| Formula only | formula | When context is clear |
| Theory#formula | theory#formula | When file is already typechecked |
Always use absolute paths to avoid ambiguity.
Common Proof Commands
Fast Tactics (no timeout needed)
(skeep) ; Skolemize keeping names
(flatten) ; Flatten sequent
(assert) ; Simple assertion
(prop) ; Propositional simplification
(expand "name") ; Expand a definition
(rewrite "lemma") ; Apply rewrite rule
(inst -1 "term") ; Instantiate formula -1
(case "formula") ; Case split
(subtype-tcc) ; Prove subtype TCC
Slow Tactics (ALWAYS use timeout)
(apply (grind) :timeout 10) ; Powerful automation
(apply (inst?) :timeout 10) ; Auto-instantiate
(apply (grind-reals) :timeout 10) ; Reals automation
(apply (reduce) :timeout 10) ; Reduction
Control Commands
(undo) ; Undo last step
(postpone) ; Postpone current branch
(skip) ; Do nothing (for debugging)
(quit) ; Abort proof
TCC Handling (PVS 8.1)
; Wrap commands that generate unexpected TCCs
(with-tccs (case "formula"))
(with-tccs (induct "var"))
(with-tccs (inst?))
; For existence TCCs: EXISTS (x: below(N)): TRUE
(inst 1 "0")
Verbose Mode
Enable verbose output for debugging:
pvs-cli.sh -v --proof-command "(skolem!)"
Shows host, port, message prefixes, and active proof IDs.
Troubleshooting
"Could not connect to PVS server"
Ensure PVS is running:
pvs -raw -port 23456
"No active proof session"
Start a proof first:
pvs-cli.sh --prove "file.pvs#theory#formula"
Keepalive Timeout
Server may be slow. Add a delay and retry:
sleep 3 && pvs-cli.sh --typecheck "file.pvs"
Changes Not Reflected
PVS server may have cached old version. Restart the server:
pkill pvs
pvs -raw -port 23456
Proof Hangs
Use timeouts! Never use bare (grind):
pvs-cli.sh --proof-command "(grind)"
pvs-cli.sh --proof-command "(apply (grind) :timeout 10)"
If it still hangs, interrupt with Ctrl+C and restart with:
pvs-cli.sh --quit-proof
Ground Evaluation with PVSio
PVSio is the PVS utility for ground evaluation (computing concrete values from PVS expressions).
Starting a PVSio Session
pvs-cli.sh --typecheck "/path/to/file.pvs"
pvs-cli.sh --call pvsio-start "/path/to/file.pvs#theory"
Evaluating Expressions
pvs-cli.sh --call pvsio-eval "2 + 3"
pvs-cli.sh --call pvsio-eval "factorial(10)"
pvs-cli.sh --call pvsio-eval "sqrt(2)"
PVSio Workflow Example
pvs-cli.sh --typecheck "/path/to/arith.pvs"
pvs-cli.sh --call pvsio-start "/path/to/arith.pvs#arith"
pvs-cli.sh --call pvsio-eval "sum(1, 100)"
pvs-cli.sh --call pvsio-eval "is_prime(17)"
Note: PVSio can only evaluate ground expressions (no free variables). The theory must define executable functions (no uninterpreted constants or axioms).
Additional Commands
pvs-cli.sh --proof-help "grind"
pvs-cli.sh --help-method typecheck
pvs-cli.sh --describe-server-methods
pvs-cli.sh --lisp "(+ 1 2)"
pvs-cli.sh --show-tccs "file.pvs"
pvs-cli.sh --find-declaration "some_lemma"
pvs-cli.sh --change-workspace "/path/to/workspace"
Tips
- Always use absolute paths for file references
- Use timeouts with
(grind), (inst?), and other slow tactics
- Check status often with
--status or --list-active-proofs
- Save incrementally - don't wait until end to save proofs
- Restart PVS server if it becomes unresponsive
- One command at a time - PVS server processes sequentially