Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #21

Merged
merged 2 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
12 changes: 6 additions & 6 deletions ialib/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.5.0'
id 'org.jetbrains.kotlin.jvm' version '1.6.0'
}

repositories {
Expand All @@ -9,17 +9,17 @@ repositories {
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib'
implementation 'log4j:log4j:1.2.17'
implementation 'com.google.guava:guava:30.1-jre'
implementation 'org.jgrapht:jgrapht-core:1.5.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0'
implementation 'com.google.guava:guava:31.0.1-jre'
implementation 'org.jgrapht:jgrapht-core:1.5.1'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0'
}
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
jvmTarget = "11"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
jvmTarget = "11"
}
}
2 changes: 2 additions & 0 deletions run-assemble.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/bash
export JAVA_HOME=`/usr/libexec/java_home -v 11`

cd "$(dirname "$0")" || exit
./gradlew clean assemble || exit

Expand Down
2 changes: 2 additions & 0 deletions run-test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/bash
export JAVA_HOME=`/usr/libexec/java_home -v 11`

cd "$(dirname "$0")" || exit
./gradlew swtia:clean swtia:test || exit

Expand Down
37 changes: 37 additions & 0 deletions samples/ey-examples/Example-Alternating.ia
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Example to test the alternating simulation

actions { a, b}
var x : int

proc ClientSpec {
act { a?, b? }

a?
}

proc ClientImpl {
act { a?, b? }

a?
b?
}

proc Server {
act { a!, b! }

a!
b!
}

init {
sys clientSpec = ClientSpec()
sys clientImpl = ClientImpl()
refinement(clientImpl, clientSpec)

sys server = Server()

sys compositionSpec = composition(server, clientSpec)
sys compositionImpl = composition(server, clientImpl)
refinement(compositionImpl, compositionSpec)

}
42 changes: 42 additions & 0 deletions samples/ey-examples/Example-ClientServer.ia
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
actions { snd, ok, fail, trnsmt, ack, nack }
var x: int

proc Client1 {
act { snd!, ok?, fail? }
while {
x == 1 -> { snd! => ok? }
ok? -> {}
}
}

proc Client2 {
act { snd!, ok?, fail? }
loop {
case {
x > 0 -> snd!
x < 0 -> snd!
ok? -> tau
}
}

}

proc Server {
act { snd?, trnsmt!, ack?, nack?, ok!, fail! }
while {
snd? -> {
trnsmt!
case {
ack? -> ok!
nack? -> fail!
}
}
}
}

init {
sys c1 = Client1()
refinement(Client1(), Client2())
sys prod = product(c1, Server())
sys comp = prune(prod)
}
29 changes: 29 additions & 0 deletions samples/ey-examples/Example-Demo.ia
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
actions { coin, atVM }
type Drink { Coffee, Tea }
var drink : Drink
var value : int

proc MachineSpec {
act { coin? }
value < 2 => { coin? guarantee(value' >= value) }
}

proc MachineImpl {
act { coin? }
value < 3 => { coin? guarantee(value' > value) }
}

proc Customer {
act { atVM?, coin! }
drink == Coffee => atVM?
value < 2 => { coin! assume(value' > value) }
}

init {
sys machineSpec = MachineSpec()
sys customer = Customer()
sys comp = composition(machineSpec, customer)

sys machineImpl = MachineImpl()
refinement(machineImpl, machineSpec)
}
34 changes: 34 additions & 0 deletions samples/ey-examples/Example-EY1.ia
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Example to test the generation of families during alternating simulation

actions { a, b, c, d, e }
var x : int

proc Spec {
act { a?, b?, c!, d! }

x > 5 => a? guarantee(x' > 2*x)

case {
x >= 1 -> { c! assume(x' != 1) }
x == 0 -> { c! assume(x' == 1) }
}
}

proc Impl {
act { a?, b?, c!, d! }

case {
x == 5 -> { a? guarantee(x' > 2*x) }
x == 6 -> { a? guarantee(x' > 3*x) }
x > 6 -> { a? guarantee(x' > 4*x) }
}

x == 0 => { c! assume(x' > 0) }
}

init {
sys impl = Impl()
sys spec = Spec()

refinement(impl, spec)
}
36 changes: 36 additions & 0 deletions samples/ey-examples/Example-EY2.ia
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Example to test the creation of a product automaton from a
// specification and from its implementation

actions { b }
var x : int

proc P {
act { b! }

x > 0 => { b! assume(x' < 3) }
}

proc Q {
act { b! }

x > -2 => { b! assume(x' < 2) }
}

proc A {
act { b? }

x > -4 => { b? guarantee(x' < 0) }
}

init {
sys p = P()
sys q = Q()
sys a = A()

refinement(p, q)

sys pa = composition(p, a)
sys qa = composition(q, a)

refinement(pa, qa)
}
23 changes: 23 additions & 0 deletions samples/ey-examples/Example-EY3.ia
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
actions {a, b}

proc P {
act {a!}

true => a!
}

proc Q {
act {a?, b?}

true => b?
true => a?
}

init {
sys p = P()
sys q = Q()

refinement(p, q)

sys pq = composition(p, q)
}
28 changes: 28 additions & 0 deletions samples/ey-examples/Example-EY4.ia
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Example to test the preservation of error states when
// computing a product

actions { b }
var x : int

proc P {
act { b? }

b?
}

proc A {
act { b! }

case {
true -> { b! }
true -> { b! error }
}
}

init {
sys p = P()
sys a = A()

sys prod = product(p, a)
sys pruned = prune(prod)
}
26 changes: 26 additions & 0 deletions samples/ey-examples/Example-EY5.ia
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Example to test the pruning of communication errors in
// a product automaton

actions { b }

proc P {
act { b? }

b?
}

proc A {
act { b! }

case {
true -> { b! }
true -> { b! => b! }
}
}

init {
sys p = P()
sys a = A()

sys prod = product(p, a)
}
51 changes: 51 additions & 0 deletions samples/ey-examples/Example-Fig7.ia
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Example in the Gareis2019 paper
// Fig. 5 (page 13)

actions { a, b }
var x: int

proc P {
act { a!, b? }
case {
x == 2 -> {
a!
assume(x' != 2)
}
x == -2 -> {
a!
assume(x' != -2)
}
true -> {
b?
case {
x >= 0 -> {
a!
assume(x' == 0)
}
x == 2 -> a!
}
}
}
}

proc Q {
act { a? }
case {
x > 0 -> {
a?
guarantee(x' < 0)
}
x < 0 -> {
a?
guarantee(x' > 0)
}
}
}

init {
sys p = P()
sys q = Q()

sys prod = product(p, q)
sys comp = prune(prod)
}
Loading
Loading