Skip to Main Content Skip to Search
Product Documentation

Proving Properties in a Model

About This Example

The following sections describe a Simulink model, for which you prove a property that you specify using a Proof Objective block. This example demonstrates the property-proving capabilities of the Simulink Design Verifier software.

In this example, you perform the following tasks.

TaskDescriptionSee...
1

Construct the example model.

Constructing the Example Model

2

Verify that your model is compatible with the Simulink Design Verifier software.

Checking Compatibility of the Example Model

3

Add a Proof Objective block to your model to prepare for its proof.

Instrumenting the Example Model

4

Configure the Simulink Design Verifier software to prove properties.

Configuring Property-Proving Options

5

Prove a property of your model.

Analyzing the Example Model

6

Review the analysis results.

Reviewing the Analysis Results

7

Add proof assumptions to specify analysis constraints.

Customizing the Example Proof

8

Prove a property of the customized model and interpret the results.

Reanalyzing the Example Model

Constructing the Example Model

Construct a Simulink model to use in this example:

  1. Create an empty Simulink model.

  2. Copy the following blocks into your empty model window:

    • From the Sources library, an Inport block to initiate the input signal whose value the Simulink Design Verifier software controls

    • From the Logic and Bit Operations library, a Compare To Zero block to provide simple logic

    • From the Sinks library, an Outport block to receive the output signal

  3. Connect these blocks such so your model appears similar to the following model:

  4. In the model window, select Simulation > Configuration Parameters.

  5. On the left side of the Configuration Parameters dialog box, in the Select tree, click the Solver category. On the right side, under Solver options:

    • Set the Type option to Fixed-step.

    • Set the Solver option to Discrete (no continuous states).

    The Simulink Design Verifier can analyze only models that use a fixed-step solver.

  6. Click OK to save your changes and close the Configuration Parameters dialog box.

  7. Save your model with the name ex_property_proving_example_basic.

Checking Compatibility of the Example Model

Every time Simulink Design Verifier software analyzes a model, before the analysis begins, the software performs a compatibility check. If your model is not compatible, the software cannot analyze it.

You can also make sure you model is compatible with the Simulink Design Verifier software before you start the analysis:

  1. Open the ex_property_proving_example_basic model.

  2. In the model window, select Tools > Design Verifier > Check Model Compatibility.

    The Simulink Design Verifier software displays the log window, which states whether or not your model is compatible.

    The model you just created is compatible.

What If a Model Is Partially Compatible?

If the compatibility check indicates that your model is partially compatible, your model contains at least one object that the Simulink Design Verifier software does not support. You can analyze a partially compatible model, but, by default, unsupported objects are stubbed out. The results of the analysis may be incomplete. For detailed information about automatic stubbing, see Handling Incompatibilities with Automatic Stubbing.

Instrumenting the Example Model

Prepare your example model so that you can prove its properties with the Simulink Design Verifier software. Specifically, instrument the model by adding and configuring a Proof Objective block:

  1. In the MATLAB Command Window, enter sldvlib.

    The Simulink Design Verifier library appears.

  2. Open the Objectives and Constraints sublibrary.

  3. Copy the Proof Objective block to your model and insert it between the Compare To Zero and Outport blocks.

  4. In your model, double-click the Proof Objective block.

    The Proof Objective block parameters dialog box opens.

  5. In the Values box, enter 1.

    The Simulink Design Verifier software will attempt to prove that the signal output by the Compare To Zero block always attains this value for any signals that it receives.

  6. Click OK to apply your changes and close the Proof Objective block parameters dialog box.

  7. Save your model and keep it open.

Configuring Property-Proving Options

Configure the Simulink Design Verifier software to prove properties of the ex_property_proving_example_basic model that you instrumented:

  1. Open the ex_property_proving_example_basic model.

  2. In your Simulink model window, select Tools > Design Verifier > Options.

  3. On the left side of the Configuration Parameters dialog box, in the Select tree, select the Design Verifier category. Under Analysis options on the right side, set the Mode parameter to Property proving.

  4. Click OK to apply your changes and close the Configuration Parameters dialog box.

      Note   On the Property Proving pane, you can optionally specify values for other parameters that control how the Simulink Design Verifier software proves properties of your model. For more information, see Design Verifier Pane: Property Proving.

  5. Save the ex_property_proving_example_basic model.

Analyzing the Example Model

To analyze the ex_property_proving_example_basic model, in the model window, select Tools > Design Verifier > Prove Properties. The Simulink Design Verifier software begins a property-proving analysis.

During the analysis, the log window shows the progress of the analysis. It displays information such as the number of objectives processed and which objectives were satisfied or falsified.

To terminate the analysis at any time, in the log window, click Stop.

Reviewing the Analysis Results

When the analysis is complete, the log window displays the following options for reviewing the results:

You can also view the Simulink Design Verifier data file. For detailed information about the data file, see Simulink Design Verifier Data Files.

The following sections describe how you can review the analysis results:

Reviewing the Results on the Model

You can review the analysis results at a glance by viewing the blocks that are highlighted in the model window. The highlighting can have four colors:

Highlight the analysis results on the example model:

  1. In the log window for the ex_property_proving_example_basic analysis, click Highlight analysis results on model.

    The Proof Objective block is highlighted in red, which indicates that a proof objective was falsified with a counterexample.

    The Simulink Design Verifier Results window appears. As you click objects in the model, this window changes to display detailed analysis results for that object.

      Tip   By default, the Simulink Design Verifier Results window is always the topmost visible window. To allow the window to move behind other window, click and clear Always on top.

  2. Click the highlighted Proof Objective block.

    The Simulink Design Verifier Results window indicates that the proof objective that the output signal from the Compare to Zero was not 1 was disproved with a counterexample.

Reviewing the Detailed Analysis Report

To create a detailed HTML analysis report:

  1. In the Simulink Design Verifier log window, click Generate detailed analysis report.

    The HTML report opens in a browser window.

  2. The report includes the following Table of Contents. Click a hyperlink to navigate to particular section in the report.

  3. In the Table of Contents, click Summary.

    The Summary provides an overview of the analysis results, and it indicates that the Simulink Design Verifier software identified a counterexample that falsifies an objective in your model.

  4. Scroll back to the top of the browser window. In the Table of Contents, click Proof Objectives Status.

    The Objectives Falsified with Counterexamples table lists the proof objectives that the Simulink Design Verifier software disproved using a counterexample that it generated. You can locate the objective in your model window by clicking Proof Objective; the software highlights the corresponding Proof Objective block in your model window.

  5. In the Objectives Falsified with Counterexamples table, under the Counterexample column, click 1.

    This section displays information about proof objective 1 and provides details about the counterexample that the Simulink Design Verifier software generated to disprove that objective. In this counterexample, a signal value of 99 falsifies the objective that you specified using the Proof Objective block. That is, 99 is not less than or equal to 0, which causes the Compare To Zero block to return 0 (false) instead of 1 (true).

Reviewing the Harness Model

Create a harness model with counterexamples that falsify the proof objectives in your model:

  1. In the Simulink Design Verifier log window, click Create harness model.

    The software creates a harness model named ex_property_proving_example_basic_harness.mdl.

    The harness model contains the following items:

    • Signal Builder block named Inputs — A group of signals that falsify proof objectives.

    • Subsystem block named Test Unit — A copy of your model.

    • DocBlock named Test Case Explanation — A textual description of the counterexamples that the analysis generates.

    • A Size-Type block — A subsystem that transmits signals from the Inputs block to the Test Unit block. This block verifies that the size and data type of the signals are consistent with the Test Unit block.

  2. Double-click the Inputs block.

    The input signal 1 causes the output of the Compare to Zero block to be 0. This counterexample violates the proof objective that specifies that the output of the Compare to Zero block be 1.

Simulation the Model with the Counterexample

Simulate the harness model to observe the counterexample that falsifies the proof objective in your model:

  1. In the ex_property_proving_example_basic model window, select View > Library Browser

  2. From the Sinks library, copy a Scope block into your harness model window. The Scope block allows you to see the value of the signal output by the Compare To Zero block in your model.

  3. In your harness model window, connect the output signal of the Test Unit subsystem to the Scope block.

  4. In your harness model window, select Simulation > Start to begin the simulation.

    The Simulink software simulates the harness model.

  5. In your harness model window, double-click the Scope block to open its display window.

    The Scope block displays the value of the signal output by the Compare To Zero block in your model. In this example, the Compare To Zero block returns 0 (false) throughout the simulation, which falsifies the proof objective that the output of the Compare to Zero block be 1 (true). The counterexample that the Signal Builder block supplies falsifies the proof objective.

Reviewing Analysis Results in the Model Explorer

If you close the analysis results so you review any falsified objectives, you may need to review the analysis results again. As long as your model remains open, you can view the results of your most recent Simulink Design Verifier analysis results in the Model Explorer. After you close your model, you can no longer view any analysis results.

In the model window, select Tools > Design Verifier > Latest Results. The Model Explorer opens, and the results of the latest Simulink Design Verifier analysis appear in the right-hand pane.

For any Simulink Design Verifier analysis, from the Model Explorer, you can perform any of the following tasks.

TaskFor more information

Highlight the analysis results on the model.

Highlighted Results on the Model

Generate a detailed analysis report.

Simulink Design Verifier Reports

Create the harness model, or if the harness model already exists, open it.

If no counterexamples were created during the analysis, this option is not available.

Harness Model

View the data file.

Simulink Design Verifier Data Files

View the log file.

Simulink Design Verifier Log Files

Customizing the Example Proof

Modify the simple Simulink model whose proof objective the Simulink Design Verifier software disproved in the previous task. Specifically, customize the proof by adding and configuring a Proof Assumption block:

  1. In the MATLAB Command Window, type sldvlib.

    The Simulink Design Verifier library opens.

  2. Open the Objectives and Constraints sublibrary.

  3. Copy the Proof Assumption block to your model.

  4. In your model window, insert the Proof Assumption block between the Inport and Compare To Zero blocks.

  5. In your model, double-click the Proof Assumption block to access its attributes.

    The Proof Assumption block parameter dialog box opens.

  6. In the Values box, enter [-1, 0]. When proving properties of this model, the Simulink Design Verifier software constrains the signal values entering the Compare To Zero block to the specified range. If the input to the Compare to Zero block is always within this range, the output of the Compare to Zero block will always be 1.

  7. Click Apply and then OK to apply your changes and close the Proof Assumption block parameter dialog box.

  8. Save the ex_property_proving_example_basic model and keep it open.

Reanalyzing the Example Model

Analyze the model that you modified to see how the Proof Assumption block affects the property-proving analysis.

In the ex_property_proving_example_basic model window, select Tools > Design Verifier > Prove Properties.

When the analysis is complete, the log window displays the options. There is no option to create a harness model, because the analysis satisfied all proof objectives in your model, so there are no counterexamples.

Reviewing the Results of the Second Analysis

Review the results of the second analysis:

Reviewing the Results on the Model

Highlight the model to see the analysis results:

  1. Click Highlight analysis results on model.

    The Proof Objective is now highlighted in green.

  2. Click the Proof Objective block.

    The Simulink Design Verifier Results window shows that the proof objective that states that the signal be 1 is valid.

Reviewing the Analysis Report

Review the analysis results in the detailed report:

  1. Click Generate detailed analysis report.

  2. In the Table of Contents, click Summary.

    The Summary chapter indicates that the Simulink Design Verifier software proved a proof objective in the model.

  3. The Constraints section lists the analysis constraint you specified in the Proof Assumption block.

  4. Scroll back to the top of the browser window. In the Table of Contents, click Proof Objectives Status.

    The Objectives Proven Valid table lists the proof objectives that the Simulink Design Verifier software proved to be valid.

  5. Scroll down to view the Properties chapter or go to the top of the browser window and in the Table of Contents, click Properties.

    The Proof Objective summary indicates that the Simulink Design Verifier software proved an objective that you specified in your model. The Proof Assumption block restricts the domain of the input signals to the interval [-1, 0]. Therefore, the software proves that this interval does not contain values that are greater than zero, thereby satisfying the proof objective.

Analyzing Contradictory Models

If the analysis produces the error The model is contradictory in its current configuration, the software detected a contradiction in your model and it cannot analyze the model. You can have a contradiction if your model has Proof Assumption blocks with incorrect parameters. For example, an assumption could states that a signal must be between 0 and 5 when the signal is constant 10.

If the software detects a contradiction, all previous results are invalidated and the software reports that all the properties are falsified.

Proving Properties in a Large Model

A thorough proof of your model requires that the Simulink Design Verifier software search through all reachable configurations of your model—even the ones that are reached only after long time delays. The computation time and memory required to search a model completely often make an exhaustive proof impractical.

Techniques for Proving Properties of Large Models gives detailed information about strategies you can use to improve the performance of a property-proving analysis of a large model.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS