主要内容

Review Polyspace Code Prover Results Using Polyspace Copilot

R2026b

When reviewing Polyspace® Code Prover™ results, you can use Polyspace Copilot to help you understand checks, trace their root causes, and generate suggested fixes. Polyspace Copilot is available in the right panel of the Polyspace Platform user interface.

To use Polyspace Copilot, you must log in to your MathWorks account and have a valid Polyspace Copilot license. To log in, click the Login button in the top-right corner of the Polyspace Platform user interface. After you log in, the Polyspace Copilot chat window opens. You can enter commands or questions in this chat window or follow the progress of Copilot actions.

Explain a Check

To generate an explanation of a check, use one of these methods:

  • In the Result Details pane, click the Explain Check button.

  • In the Results List pane, right-click a result and select Explain Check from the context menu.

Polyspace Copilot opens and provides an explanation of the selected check, including the nature of the run-time error, the conditions under which it occurs, and the relevant variable values.

Trace Root Cause

To trace the root cause of a check, select a result in the Results List pane, then type a prompt such as Trace the root cause in the Polyspace Copilot chat panel.

Polyspace Copilot analyzes the data flow and control flow leading to the check and identifies the sequence of operations that cause the run-time error. The response traces variable values and function calls from their origin to the point where the check occurs.

Propose a Fix

To get a suggested code fix for a check, select a result in the Results List pane, then type a prompt such as Propose a fix in the Polyspace Copilot chat panel.

Polyspace Copilot generates a suggested code change that addresses the run-time error. Review the suggested fix before applying it to your source code.

Propose a Justification

To get a suggested justification for a check, select a result in the Results List pane, then type a prompt such as Propose a justification in the Polyspace Copilot chat panel.

Polyspace Copilot generates a justification explaining why the check does not represent a true defect in your code. If you accept the justification, Polyspace Copilot sets the Status of the result to Justified and adds the justification text as a comment in the Result Details pane.