Typechecking a Table
Contents
Overview
The main feature of tabular expressions is the facilitation of the inspection of completness and disjointness conditions. This tool has support for external tools to automate this process. currerntly two different tools based on seperate ideas and technologies are supported. In order to typecheck a table at least one of these tools must be installed on the system, see the System Requirements in the Getting Started Guide.
It is recommened that both systems be installed as they have different advantages and disadvantages, additionaly with both installed a single point of failure for typechecking the table is avoided.
The default typechecker is CVC3 as it is easier to install and available for more platforms. however this can be changed from the typecheck menu, see screenshot below.
Both tools will appear to opperate the same way to the user. If a table is valid the user will be notified with a message box as seen below. if the table is not valid a typechecking report will be generated see below for more details.
CVC3
CVC3 is the third iteration of a SMT solver deveoped at NYU.
PVS
PVS is a general purpose theorem prover developed by SRI.
PVS Typecehck
typecheck the current table using pvs, will call the syntax check first.
PVS Settings
a few settings for running the pvs commands can be adjusted using the pvs settings window. See the screenshot below.
- Imports: Allows to specify one or more pvs files to import, can be used if other functions or types are referenced.
- Test Count: Used to adjust the number of attempts when generating a counterexample to an unproven theorem. Increasing this will increase the chances of finding a counterexample but will also increase the time taken to find a counter example.
- Test Range: Used to adjust the range of possible counterexamples found. the range of numbers to test will be in the range (-size..size). for example if your theorem is only false for the value 500 then you would require a range value >= 500 in order to find the counter example.
PVS Check Status
Check if the current file has already been typechecked, used when a table has had to be manually proven in pvs rather than being automatically proven using the tool. If the tool fails to generate a counter example it is possible that the theorem is true but the automatic strategies were not sufficient to prove the table, in this case it may be neccessary to prove the table manually using the pvs interface.
PVS Generate File
generate a pvs file representing the table. Calling the typecheck function will also do this, but this function will not attempt to prove the file.
PVS Typecheck SimTypes
Typechecking the table with regards to the Simulink types will ignore any typing information in the inputs or function name fields. typng information will be taken from the simulink diagram, so any port datatypes specified in the ports and data manager window will be used. inorder to determine any inherited types the tool will compile the simulink diagram. Therefore any errors in the diagram (alegbraic loops, etc.) will need to be resolved before being able to use this mode of typechecking.
Typechecking Report
If a table fails to be proven valid a typechecking report will be generated. The report serves a number of functions it shows the user what the unproven sequent (logical statement) was, it will also display a counter example should one be generated. The report will also highlight on the table the cells which are either true or false for the given counterexamples, this makes it very easy to see where the error was made.
Below is the report for a CVC3 typecheck then for a PVS typecheck.
There is a minor difference between the CVC3 and the PVS report. The PVS report has a button called "Open" this will open the current theory in PVS allowing for the user to attempt to prove the theorems.
If more than one sequent is unproveable, the "next" button will be enabled, this allows the user to view the other unprovable sequents and possible counterexamples.
When viewing a sequent that has a counterexample the report will highlight on the table window the state of the conditions.
- A Red colour indicates that the given cell has evaulated to False for the current counterexample.
- A Green colour indicates that the given cell has evaulated to True for the current counterexample.
Ideally you want one and only one green cell in each grid. Some examples follow:
non-disjoint tables
incomplete tables