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.3.8</version>
</dependency>
Add the following dependency DSL to your build.gradle
file:
implementation 'edu.uiowa.cs.clc:kind2-java-api:0.3.8'
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.xml
file:
<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.xml
file:
<dependency>
<groupId>edu.uiowa.cs.clc</groupId>
<artifactId>kind2-java-api</artifactId>
<version>0.3.8</version>
</dependency>
- Authenticate to GitHub Packages. For more information, see "Authenticating to GitHub Packages."
- Add the following repository DSL to your
build.gradle
file:
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/kind2-mc/kind2-java-api")
}
- Add the following dependency DSL to your
build.gradle
file:
implementation 'edu.uiowa.cs.clc:kind2-java-api:0.3.8'
git clone https://github.com/kind2-mc/kind2-java-api.git
cd kind2-java-api
./gradlew build
To 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-api
artifact following the steps in the above section. - Import
edu.uiowa.cs.clc.kind2
package in your source code. - Construct a lustre
Program
object using the following utilities:- Builder objects:
ProgramBuilder
,ComponentBuilder
, etc. - Utility classes:
TypeUtil
andExprUtil
.
- Builder objects:
- Construct a
Kind2Api
object and callKind2Api.execute
, passing the constructed program object. - Analyze the
Result
object returned byKind2Api.execute
.
Result
contains the following features:
-
Result
features:getValidProperties
,getReachableProperties
,getFalsifiedProperties
,getUnreachableProperties
, andgetUnknownProperties
return properties for all components.getNodeResult
returns an object ofNodeResult
that summarizes all analyses done by Kind 2 for a given component.
-
NodeResult
features:getSuggestions
returns an object ofSuggestion
that provides explanations and suggestions based on Kind 2 analyses for the current component.getValidProperties
,getReachableProperties
,getFalsifiedProperties
,getUnreachableProperties
, andgetUnknownProperties
return properties for the current component, and all its subcomponents.
-
Suggestion
contains explanations and a suggestion for the associated component. IfN
is the current component, andM
is 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
: fixM
s contract becauseN
is 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 componentN
satisfies its current contract and one or more assumptions ofM
are not satisfied byN
.makeWeakerOrFixDefinition
: either make assumptionA
weaker, or fixN
's definition to satisfyA
, because componentN
doesn't satisfy its contract after refinement, and assumptionA
ofM
is not satisfied byN
.makeAssumptionStrongerOrFixDefinition
: Either makeN
's assumptions stronger, or fixN
's definition to satisfyN
's guarantees, because componentN
doesn't satisfy its contract after refinement, and eitherN
has no subcomponents, or all its subcomponents satisfy their contract.fixSubComponentIssues
: fix reported issues forN
's subcomponents, because componentN
doesn'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.