Skip to content
Skills Library
Programming · Testing

run-polyspace-code-prover-analysis

/run-polyspace-code-prover-analysis

Runs Polyspace Code Prover on C/C++ code, producing a results database (.pscp). Use when the user asks to "run Code Prover", "prove absence of run-time errors", "formally verify this code", wants proof-backed guarantees or memory safety, or wants red/orange/green/gray run-time error checks.

Licence
MIT
Last repository change
12.11.2026

Assessment and security

90/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content25 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
3
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 12.11.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Runs Polyspace Code Prover on C/C++ code, producing a results database (.pscp). Use when the user asks to "run Code Prover", "prove absence of run-time errors", "formally verify this code", wants proof-backed guarantees or memory safety, or wants red/orange/green/gray run-time error checks.

Triggers from the description

run Code Proverprove absence of run-time errorsformally verify this code
Original author description

Runs Polyspace Code Prover on C/C++ code, producing a results database (.pscp). Use when the user asks to "run Code Prover", "prove absence of run-time errors", "formally verify this code", wants proof-backed guarantees or memory safety, or wants red/orange/green/gray run-time error checks.

How it works

  1. When to Use
  2. When NOT to Use
  3. Workflow
  4. Handling compilation errors
  5. After a successful run
  6. Conventions
Original SKILL.md headings · 71 lines, 678 words
SKILL.md preview
---
name: run-polyspace-code-prover-analysis
description: Runs Polyspace Code Prover on C/C++ code, producing a results database (.pscp). Use when the user asks to "run Code Prover", "prove absence of run-time errors", "formally verify this code", wants proof-backed guarantees or memory safety, or wants red/orange/green/gray run-time error checks.
license: MathWorks BSD-3-Clause
metadata:
  author: MathWorks
  version: "1.3"
---
# How to Run Polyspace Code Prover

Run Code Prover to formally verify C/C++ code and produce a `.pscp` results database that the review skills consume. Code Prover is a *sound* verifier: it proves whether each operation is safe on **every** execution, not just whether a bug pattern is present.

## When to Use
- The user wants to prove the absence of run-time errors (overflow, out-of-bounds, division by zero, non-initialized reads, invalid pointers).
- The user asks to run Code Prover on a project, file set, or component.

## When NOT to Use
- Fast, file-level defect / coding-standard checking as you edit — use `run-polyspace-as-you-code-analysis` (Polyspace as You Code).
- Finding defects or coding-standard violations (MISRA, CERT, CWE) — use `run-polyspace-bug-finder-analysis` (Polyspace Bug Finder).
- Reading or explaining results that already exist — use `review-polyspace-code-prover-results`.

## Workflow

You need two things before running: the source files and an **options file** describing the build (compiler, target, includes, defines) and the checks. Reuse an existing options file from the project (`.psopts`) or invoke `polyspace-configure-build-options` to create one.

### Choosing how to run — MCP is strongly preferred

Code Prover ships as a **desktop** (`polyspace-code-prover`) or **server**
(`polyspace-code-prover-server`) edition; a user has one or the other. This
affects which run path gives usable results:

- **Polyspace MCP Server available** — best in every case. It exposes full result
  detail (line of each check, traceback, numerical values) for **either** edition.
  Use the MCP tool below.
- **No MCP, server edition** — acceptable. The CLI fallback still gives the detail
  the review skills need. See `references/cli-usage.md`.
- **No MCP, desktop edition only** — the desktop SARIF export omits line-of-check,
  traceback, and numerical values, so downstream review is crippled. **Do not
  silently proceed.** Advise the user to install the Polyspace MCP server (best) or
  the server edition (compromise); run only if they accept degraded results.
  Details in `references/cli-usage.md`.

### Using the MCP tool

**If the Polyspace MCP Server is available**, use the `run_polyspace_code_prover` tool:
- `file_paths` (optional): comma-separated absolute paths to the C/C++ files. Omit it to
  verify the sources already listed in the options file; paths given here are added to that
  list.
- `results_dir` (required): absolute path to the output directory.
- `options_file` (required): absolute path to the Polyspace options file.
- `verification_level` (optional): stop level, default 2. Higher levels prove more (fewer oranges) but cost far more time; values above 4 are unusual.

The tool returns `results_file` — the absolute path to the produced `.pscp`. **Keep this path**; every review skill needs it.

### Otherwise using the binary directly

**If the MCP server is NOT available**, read `references/cli-usage.md` in this folder.

## Handling compilation errors

Code Prover compiles the code before verifying. **A compilation failure is not always fatal, and that is the trap:** by default the analysis skips the file(s) that failed to compile and continues with the rest. The run then "succeeds" and produces results — but a file that never compiled was never analyzed, so its checks are missing and checks elsewhere that depend on data flowing through it can be wrong or strange. Do not trust results until every file compiled.

Always confirm compilation before reviewing: read the analysis log in `results_dir` (e.g. `Polyspace_R*.log`) for `error:` lines. To make a compilation failure stop the run instead of silently skipping the file, add `-stop-if-compile-error` to the options file. When there are errors, fix the **options file** (missing include path, define, wrong target/compiler) — not the source — and re-run.

## After a successful run

Report the `results_file` path and hand off to `review-polyspace-code-prover-results` to read and prioritize the checks. Do not attempt to interpret raw counts here.

## Conventions
- Never modify source files to make compilation pass — fix the options file.
- Always report and keep track of the returned `.pscp` path; it is the key to all downstream review.
- Keep the default stop level (`-to`); a deeper level costs significantly more analysis time — raise it only if the user explicitly asks for deeper verification.

---

Copyright 2026 The MathWorks, Inc.

---
Files in this package (3)
  • SKILL.md 5 KB
  • manifest.yaml 1 KB
  • references/cli-usage.md 3 KB

Versions

The database has no other skills named run-polyspace-code-prover-analysis.

Database snapshot: 13.11.2026 · package version 06d69201dc3d (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 90review-polyspace-code-prover-results
    Reads, explains, and prioritizes Polyspace Code Prover results from a .pscp database. Use when the user asks "what did Code Prover find", "explain this red/orange/green/gray check", "why is this check orange", "was most of my code analyzed", "what are the most critical run-time…
  • 90polyspace-review-findings
    Reads, explains, and prioritizes Polyspace findings — defects and coding-standard violations — from a results database (.psbf for Bug Finder, .payc for Polyspace as You Code). Use when the user asks "what did Bug Finder find", "what did the analysis find", "explain this…
  • 100fix-github-issue
    Turn one known GitHub issue into a merged pull request, headless: a coder and then a prover in the issue's own git worktree, a pull request carrying the proof, an isolated second-engine reviewer, and a serial pull master that checks import-closure staleness against the base…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.