An API for constructing Lustre programs, running Kind 2, and showing results/suggestions.
There are three ways to install the Java API artifact for Kind 2 for use in your development environment. The instructions for each are listed below:
Add the following dependency tag to your pom.xml file:
<dependency>
<groupId>edu.uiowa.cs.clc</groupId>
<artifactId>kind2-java-api</artifactId>
<version>0.5.5</version>
</dependency>Add the following dependency DSL to your build.gradle file:
implementation 'edu.uiowa.cs.clc:kind2-java-api:0.5.5'Go to Maven Central and copy the appropriate code snippet for your build management tool.
- Authenticate to GitHub Packages. For more information, see "Authenticating to GitHub Packages."
- Add the following repository tag to your
pom.xmlfile:
<repository>
<id>github</id>
<name>GitHub kind2-mc Apache Maven Packages</name>
<url>https://maven.pkg.github.com/kind2-mc/kind2-java-api</url>
</repository>- Add the following dependency tag to your
pom.xmlfile:
<dependency>
<groupId>edu.uiowa.cs.clc</groupId>
<artifactId>kind2-java-api</artifactId>
<version>0.5.5</version>
</dependency>- Authenticate to GitHub Packages. For more information, see "Authenticating to GitHub Packages."
- Add the following repository DSL to your
build.gradlefile:
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/kind2-mc/kind2-java-api")
}- Add the following dependency DSL to your
build.gradlefile:
implementation 'edu.uiowa.cs.clc:kind2-java-api:0.5.5'git clone https://github.com/kind2-mc/kind2-java-api.git
cd kind2-java-api
./gradlew buildTo import the API, use the jar file build/libs/kind2-java-api.jar.
Alternatively, you can just copy the package edu.uiowa.cs.clc.kind2 to your source code.
An example of how to use the API is provided in StopWatch.java. Follow these steps when using the API:
- Install
kind2-java-apiartifact following the steps in the above section. - Import
edu.uiowa.cs.clc.kind2package in your source code. - Construct a lustre
Programobject using the following utilities:- Builder objects:
ProgramBuilder,ComponentBuilder, etc. - Utility classes:
TypeUtilandExprUtil.
- Builder objects:
- Construct a
Kind2Apiobject and callKind2Api.execute, passing the constructed program object. - Analyze the
Resultobject returned byKind2Api.execute.
Result contains the following features:
-
Resultfeatures:getValidProperties,getReachableProperties,getFalsifiedProperties,getUnreachableProperties, andgetUnknownPropertiesreturn properties for all components.getNodeResultreturns an object ofNodeResultthat summarizes all analyses done by Kind 2 for a given component.
-
NodeResultfeatures:getSuggestionsreturns an object ofSuggestionthat provides explanations and suggestions based on Kind 2 analyses for the current component.getValidProperties,getReachableProperties,getFalsifiedProperties,getUnreachableProperties, andgetUnknownPropertiesreturn properties for the current component, and all its subcomponents.
-
Suggestioncontains explanations and a suggestion for the associated component. IfNis the current component, andMis possibly a subcomponent ofN, then the suggestion is one of the following:noActionRequired: no action required because all components of the system satisfy their contracts, and no component was refined.strengthenSubComponentContract: fixMs contract becauseNis correct after refinement, butM's contract is too weak to proveN's contract, butM's definition is strong enough.completeSpecificationOrRemoveComponent: Either complete specification ofN's contract, or remove componentM, because componentNsatisfies its current contract and one or more assumptions ofMare not satisfied byN.makeWeakerOrFixDefinition: either make assumptionAweaker, or fixN's definition to satisfyA, because componentNdoesn't satisfy its contract after refinement, and assumptionAofMis not satisfied byN.makeAssumptionStrongerOrFixDefinition: Either makeN's assumptions stronger, or fixN's definition to satisfyN's guarantees, because componentNdoesn't satisfy its contract after refinement, and eitherNhas no subcomponents, or all its subcomponents satisfy their contract.fixSubComponentIssues: fix reported issues forN's subcomponents, because componentNdoesn't satisfy its contract after refinement, and One or more subcomponents of N don't satisfy their contract.fixOneModeActive: define all modes of componentN, because Kind 2 found a state that is not covered by any of the modes inN's contract.increaseTimeout: increase the timeout for Kind 2, because it fails to prove or disprove one of the properties with the previous timeout.
This project borrows heavily from the loonworks/jkind repo.