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

Uclid5-based LF Verifier #1271

Merged
merged 189 commits into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from 186 commits
Commits
Show all changes
189 commits
Select commit Hold shift + click to select a range
f03bf86
Begin the Java port of the UclidGenerator
lsk567 Jun 19, 2022
905bbcc
Do some more porting
lsk567 Jun 24, 2022
e8fe270
Finish generating traces
lsk567 Jun 24, 2022
b09633f
Minor fixes
lsk567 Jun 24, 2022
9a73349
Start to generate reaction and state variable declarations
lsk567 Jun 24, 2022
7b31537
Ensure that when building the reaction instance graph, nodes are not …
lsk567 Jun 26, 2022
f3d9cc8
Generate state variables and triggers
lsk567 Jun 26, 2022
21d1718
Generate up to reactor semantics
lsk567 Jun 27, 2022
c5bc411
Generate runner script and refactor a few things. TODO: Triggers, rea…
lsk567 Jun 27, 2022
d704e51
Uclid bug fixes
lsk567 Jun 28, 2022
7e1a726
Start to generate reactions and triggers
lsk567 Jun 28, 2022
f3a54c6
Continue generating reactions
lsk567 Jun 30, 2022
5d8d9a4
Start populating state variables and triggers
lsk567 Jun 30, 2022
c2bccb5
Keep generating lists
lsk567 Jul 1, 2022
7bba94a
Remove dead code
lsk567 Jul 1, 2022
1e8e401
Finish generating actions
lsk567 Jul 1, 2022
49d11e3
Deprecate reaction instance graph
lsk567 Jul 1, 2022
646ba72
Generate connections
lsk567 Jul 2, 2022
13db2db
Bug fix
lsk567 Jul 2, 2022
60c5700
Start a C subset target
lsk567 Jul 2, 2022
8baa668
Remove the super.doGenerate() call.
lsk567 Jul 2, 2022
faa5203
Remove the new target. Invoke the uclid generator when @property is i…
lsk567 Jul 2, 2022
7d79196
Add an instance class for state variables
lsk567 Jul 2, 2022
f194a01
Add Antlr4 to the gradle project
lsk567 Jul 6, 2022
7c9274c
Move Antlr grammar
lsk567 Jul 6, 2022
301ed16
Fix Antlr generated file location, start MTL transpiler
lsk567 Jul 6, 2022
52040d0
Start to generate properties based on property attributes
lsk567 Jul 7, 2022
21efab8
Use the MTLParser to generate parse trees
lsk567 Jul 7, 2022
38a31ff
Update syntax to include expressions
lsk567 Jul 7, 2022
47ab696
Start to transpile MTL using a visitor
lsk567 Jul 7, 2022
511d3a8
Keep working on transpiling
lsk567 Jul 8, 2022
59b23f5
Transpile Until
lsk567 Jul 8, 2022
66edad4
Refactor timing related visitor helper functions
lsk567 Jul 8, 2022
666e70f
Checkpoint. Transpile up to Expr.
lsk567 Jul 8, 2022
6e2a180
Transpile up to Quotient
lsk567 Jul 8, 2022
a531123
Generate properties
lsk567 Jul 9, 2022
ba15655
Add C grammar and AST visitors
lsk567 Jul 20, 2022
4f8c27e
Integrate C parser with the UclidGenerator
lsk567 Jul 20, 2022
6bedfcc
Start generating uclid axioms. Generate up to TriggerValue.
lsk567 Jul 20, 2022
aeb9867
Lift more AST nodes to Uclid
lsk567 Jul 20, 2022
4fc7147
Generate more Uclid axioms from C
lsk567 Jul 20, 2022
be621d5
Removed the relaxation fragment in the connection axiom. Add dedicate…
lsk567 Jul 20, 2022
d9e2b4b
Bug fixes
lsk567 Jul 21, 2022
f29cf78
Fix bugs and generate more axioms
lsk567 Jul 21, 2022
60df7ce
Fix bugs on setting a port while scheduling an action, reset unused p…
lsk567 Jul 21, 2022
965eca5
Prune dead code, attach value to action
lsk567 Jul 21, 2022
712efb9
Add CAst utils
lsk567 Jul 21, 2022
f5915f3
Fix tag_schedule, action one-to-one correspondence, and startup axioms
lsk567 Jul 22, 2022
4d20a64
Add a (temporary) fix for variable precedence.
lsk567 Jul 22, 2022
b64e3f4
Add precedence visitor
lsk567 Jul 22, 2022
5a1a2b3
Update schedule action mechanism and variable precedence. Verifier v0.1.
lsk567 Jul 22, 2022
4bcb0cf
Update benchmarks
lsk567 Jul 23, 2022
a4d373e
Update comments
lsk567 Aug 8, 2022
70511bf
Add comments
lsk567 Aug 8, 2022
07a8c8d
Minor update
lsk567 Aug 9, 2022
f53d45d
Generate verification models in a "model-gen" directory.
lsk567 Nov 22, 2022
9845797
Use arrays instead of tuples to represent traces
lsk567 Nov 22, 2022
cb667aa
Start to work on a state space explorer
lsk567 Dec 1, 2022
80f7c09
Detect back loop in the state space diagram.
lsk567 Dec 1, 2022
b69209e
Add trace padding to account for partial trace
lsk567 Dec 2, 2022
5baf0c7
Add UclidRunner that runs uclid models and parses CEX traces
lsk567 Dec 3, 2022
66da9c7
Start to work on the logical time based semantics.
lsk567 Dec 5, 2022
0c8ab2d
More robust CEX parsing, fix an axiom bug related to END_TRACE.
lsk567 Dec 5, 2022
8d9d091
Support timers
lsk567 Dec 7, 2022
57eda6f
Update CT estimation, clean up println.
lsk567 Dec 14, 2022
9423212
Refactor uclid, C ast, and state space into an analyses package.
lsk567 Dec 14, 2022
72eb050
Make loop detection more efficient
lsk567 Dec 15, 2022
65560ab
Fix loop period, generate dot file from state space diagram.
lsk567 Dec 16, 2022
4f5e416
Update dot formatting
lsk567 Dec 17, 2022
b2fddc1
Add an option to generate compact state space diagrams
lsk567 Dec 28, 2022
cd7fda8
Support negative numbers in C code
lsk567 Dec 28, 2022
83a4f48
Address the case when the state space diagram only has one node.
lsk567 Dec 28, 2022
03ae166
Update comments
lsk567 Dec 28, 2022
0a55dda
Differentiate how tags increment for actions and connections
lsk567 Dec 28, 2022
185f6f2
Fix CT calculation, fix state space node insertion, support manually …
lsk567 Jan 3, 2023
a1b27ea
Compare timestamps only to match MTL semantics.
lsk567 Jan 4, 2023
cf69123
Ensure uniqueness of reactions and events during state space exploration
lsk567 Jan 12, 2023
1794136
Fix the FOL encoding of Globally.
lsk567 Feb 4, 2023
78baf93
Support lf_schedule_int()
lsk567 Feb 5, 2023
344c34a
Add a uniqueness axiom, update CEX parser to support let bindings
lsk567 Feb 7, 2023
2b99656
Add happen-before relations based on priorities, fix C AST generation.
lsk567 Feb 7, 2023
f5e12da
Add preliminary github action workflow
lsk567 Feb 18, 2023
e16592c
Merge branch 'master' into verifier
lsk567 Feb 18, 2023
ff47ed0
Try to trigger CI
lsk567 Feb 18, 2023
fdff6b5
Try again
lsk567 Feb 18, 2023
5a13516
Debug workflows
lsk567 Feb 19, 2023
a232244
Setup ssh after installing sbt
lsk567 Feb 19, 2023
22ec9ff
Attempt to fix a directory issue
lsk567 Feb 19, 2023
d208f4c
Add an 'expect' field to @property
lsk567 Feb 21, 2023
6b760c8
Update CI to run the test script
lsk567 Feb 21, 2023
d23906f
Relocate the CI script.
lsk567 Feb 21, 2023
ac43a76
Specify version
lsk567 Feb 21, 2023
e77e60c
Fix version
lsk567 Feb 21, 2023
489a563
Fix typo
lsk567 Feb 21, 2023
11d985f
Relocate the yml file.
lsk567 Feb 21, 2023
c02b3b1
Emphasize local workflow
lsk567 Feb 21, 2023
5c725d8
Remove caching
lsk567 Feb 21, 2023
276811b
Fix branch name
lsk567 Feb 21, 2023
662867e
Fetch history
lsk567 Feb 21, 2023
6ad8f4b
Remove SSH and update CI
lsk567 Feb 21, 2023
4a38b8f
Fix Globally
lsk567 Feb 21, 2023
407a787
Merge branch 'master' into verifier
lhstrh Mar 2, 2023
c8df9d1
Merge branch 'master' into verifier
lsk567 Mar 3, 2023
17828a2
Let the event queue sort based on both tags and trigger names
lsk567 Mar 3, 2023
22a7b11
Prune dead code
lsk567 Mar 3, 2023
46e84c6
Temporarily remove the author tag for Shaokai.
lsk567 Mar 23, 2023
8ba0f96
Minor MTL grammar update
lsk567 Mar 23, 2023
7802314
Minor update
lsk567 Mar 23, 2023
db8c044
Merge branch 'master' into verifier
lsk567 Mar 23, 2023
7672fb2
Make --no-verify work again
lsk567 Mar 24, 2023
c079327
Remove unused lib
lsk567 Mar 24, 2023
95e8743
Revert "Minor MTL grammar update"
lsk567 Mar 24, 2023
40b9ce2
Only extend horizon when it becomes larger
lsk567 Jun 4, 2023
4c0bb09
Merge branch 'master' into verifier
lsk567 Jun 4, 2023
a36c991
Remove top level org.lflang
lsk567 Jun 4, 2023
8b20b53
Update gradle and relocate analyses and dsl folders
lsk567 Jun 4, 2023
2241047
Update CI and spotless
lsk567 Jun 5, 2023
00172c7
Fix git merge issues
lsk567 Jun 7, 2023
a297808
Add warnings and check dependencies
lsk567 Jun 7, 2023
a0634ee
Merge branch 'master' into verifier
lsk567 Jun 7, 2023
8525fb0
Update CI
lsk567 Jun 7, 2023
9cc84c3
Update CI
lsk567 Jun 7, 2023
aa7ed02
Update CI
lsk567 Jun 7, 2023
622b496
Format Java files.
petervdonovan Jun 7, 2023
95ca972
Merge branch 'master' into verifier
petervdonovan Jun 7, 2023
3d0670b
use the antlr gradle plugin
cmnrd Jun 18, 2023
3f9cc88
Merge branch 'master' into verifier
lhstrh Jun 18, 2023
fd9a94c
Update gradle.properties
lhstrh Jun 18, 2023
fff61cf
don't format generated java files
cmnrd Jun 19, 2023
5612775
fix kotlin antlr dependencies
cmnrd Jun 19, 2023
2d9d653
clean up source sets
cmnrd Jun 19, 2023
34837e5
Merge branch 'master' into verifier
lsk567 Jun 20, 2023
93e021b
Merge branch 'master' into verifier
lsk567 Jun 21, 2023
80b7983
Merge branch 'master' into verifier
lsk567 Jun 22, 2023
be77b45
Apply suggestions from @petervdonovan
lsk567 Jun 22, 2023
d4ed4d5
Apply more suggestions from @petervdonovan
lsk567 Jun 22, 2023
6d92a9e
Apply spotless
lsk567 Jun 22, 2023
d0bd104
Merge branch 'master' into verifier
lsk567 Jun 22, 2023
02b2bc6
Apply spotless
lsk567 Jun 22, 2023
77b5aa1
Relocate doc comments
lsk567 Jun 22, 2023
baa5061
Remove some inconsistent comments
lsk567 Jun 22, 2023
df25bc0
Throw exceptions instead of printf
lsk567 Jun 23, 2023
b1308b0
Apply suggestions from @petervdonovan
lsk567 Jun 23, 2023
a859a66
Do not check models by default, based on suggestions from @lhstrh
lsk567 Jun 23, 2023
8ac1d04
Merge branch 'master' into verifier
lsk567 Jun 27, 2023
b37b09d
Merge branch 'master' into verifier
lsk567 Jun 30, 2023
ec0198c
Factor out createMainInstantiation()
lsk567 Jun 30, 2023
f7d94f5
Factor generateTriggersAndReactions() into multiple smaller functions…
lsk567 Jun 30, 2023
f422a2a
Separate public from private variables
lsk567 Jun 30, 2023
877ce36
Improve pattern matching and apply spotless
lsk567 Jun 30, 2023
52288a4
Merge branch 'master' into verifier
lsk567 Jul 1, 2023
b1d35c0
Use more getters and setters, and mark certain variables final
lsk567 Jul 1, 2023
2e687e6
Remove sneakyThrow and apply spotless
lsk567 Jul 1, 2023
7c74e08
Report warnings using messageReporter
lsk567 Jul 1, 2023
0256af6
Apply more suggestions from @petervdonovan
lsk567 Jul 1, 2023
41b8b7d
Merge branch 'master' into verifier
lsk567 Jul 2, 2023
be3ca98
Merge branch 'master' into verifier
lsk567 Jul 3, 2023
01d7ddd
Merge branch 'master' into verifier
lsk567 Jul 4, 2023
b4540ba
Throw error when looking up named instances
lsk567 Jul 1, 2023
5043e30
Handle the equals() issue
lsk567 Jul 4, 2023
55583e1
Prune unused code
lsk567 Jul 4, 2023
e1556ea
Merge branch 'master' into verifier
lsk567 Jul 5, 2023
9bb39cf
Apply suggestions from @lhstrh
lsk567 Jul 5, 2023
9b5a6f8
Apply suggestions from @lhstrh
lsk567 Jul 5, 2023
eeedef7
Fix typo
lsk567 Jul 5, 2023
6a1109e
Remove the unused global variable
lsk567 Jul 5, 2023
202c15c
Fix get macro, SendToDownstream, and Correspondence axioms
lsk567 Jul 8, 2023
55435bd
Use END_TRACE in a few more places since it is the default
lsk567 Jul 8, 2023
bbf27ac
Merge branch 'master' into verifier
lsk567 Jul 10, 2023
a9d44ff
Rename workflow
lsk567 Jul 10, 2023
233a741
Apply spotless
lsk567 Jul 10, 2023
119e046
Merge branch 'master' into verifier
lsk567 Jul 11, 2023
97e2897
Add verifier tests for CI
lsk567 Jul 12, 2023
e588226
Apply spotless
lsk567 Jul 12, 2023
11b423e
Merge branch 'master' into verifier
lsk567 Jul 12, 2023
197c323
rename ping pong test to make the name unique
cmnrd Jul 12, 2023
00c04f7
add the verifier test category
cmnrd Jul 12, 2023
4b83bcf
add verifier test class
cmnrd Jul 12, 2023
4db4404
exclude the verifier tests from zephyr and multithreaded
cmnrd Jul 12, 2023
c9f80aa
update CI
cmnrd Jul 12, 2023
2747157
ensure correct directory
cmnrd Jul 12, 2023
d07e029
Output error message when dependencies are not installed.
lsk567 Jul 12, 2023
06a8944
actually ensure correct directory
cmnrd Jul 12, 2023
4696ee0
bring workflow up to standard and add debug info
cmnrd Jul 13, 2023
ad4daeb
Fix the assertion error.
lsk567 Jul 13, 2023
2e7cfb0
Adjust platform and test level
lsk567 Jul 14, 2023
d87763f
Update core/src/main/java/org/lflang/generator/LFGenerator.java
lhstrh Jul 18, 2023
5a13524
Merge branch 'master' into verifier
lsk567 Jul 19, 2023
35f0887
Apply spotless
lsk567 Jul 19, 2023
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
73 changes: 73 additions & 0 deletions .github/workflows/c-verifier-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Uclid5-based Verifier Tests

on:
# Trigger this workflow also on workflow_call events.
workflow_call:
inputs:
compiler-ref:
required: false
type: string
runtime-ref:
required: false
type: string

jobs:
run:
strategy:
matrix:
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Check out lingua-franca repository
uses: actions/checkout@v3
with:
repository: lf-lang/lingua-franca
submodules: true
ref: ${{ inputs.compiler-ref }}
fetch-depth: 0
- name: Prepare build environment
uses: ./.github/actions/prepare-build-env
- name: Check out specific ref of reactor-c
uses: actions/checkout@v3
with:
repository: lf-lang/reactor-c
path: core/src/main/resources/lib/c/reactor-c
ref: ${{ inputs.runtime-ref }}
if: ${{ inputs.runtime-ref }}
- name: Check out Uclid5 repository
uses: actions/checkout@v3
with:
repository: uclid-org/uclid
ref: 4fd5e566c5f87b052f92e9b23723a85e1c4d8c1c
path: uclid
- name: Download Z3
working-directory: uclid/
if: steps.cache-z3.outputs.cache-hit != 'true'
run: ./get-z3-linux.sh
- name: Add Z3 to Path
working-directory: uclid/
run: |
echo "$(pwd)/z3/bin/" >> $GITHUB_PATH
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/z3/bin/" >> $GITHUB_ENV
- name: Print Z3 Version
run: z3 --version
- name: Install Uclid5
working-directory: uclid/
run: |
sbt update clean compile
sbt universal:packageBin
cd target/universal/
unzip uclid-0.9.5.zip
./uclid-0.9.5/bin/uclid --help
echo "$(pwd)/uclid-0.9.5/bin" >> $GITHUB_PATH
cd ../..
- name: Run verifier tests
run: |
echo "$pwd"
ls -la
./gradlew core:integrationTest --tests org.lflang.tests.runtime.CVerifierTest.* core:integrationTestCodeCoverageReport
- name: Report to CodeCov
uses: ./.github/actions/report-code-coverage
with:
files: core/build/reports/jacoco/integrationTestCodeCoverageReport/integrationTestCodeCoverageReport.xml
if: ${{ github.repository == 'lf-lang/lingua-franca' }}
4 changes: 4 additions & 0 deletions .github/workflows/only-c.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,7 @@ jobs:
with:
use-cpp: true
all-platforms: ${{ !github.event.pull_request.draft }}

# Run the Uclid-based LF Verifier benchmarks.
verifier:
uses: ./.github/workflows/c-verifier-tests.yml
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ gradle-app.setting
### Gradle Patch ###
**/build/

### Antlr 4 ###
**/.antlr/
**/generated/

# End of https://www.toptal.com/developers/gitignore/api/intellij,gradle,eclipse,maven,visualstudiocode

### xtext artifaccts
Expand Down
16 changes: 16 additions & 0 deletions buildSrc/src/main/groovy/org.lflang.antlr-conventions.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
plugins {
id 'antlr'
}

repositories {
mavenCentral()
}

dependencies {
antlr "org.antlr:antlr4:${antlrVersion}"
}

if (project.tasks.findByName('compileKotlin')) {
// make all kotlin compile tasks dependent on the antl generation tasks
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).each(it -> it.dependsOn(tasks.withType(AntlrTask)))
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repositories {

spotless {
java {
targetExclude 'src-gen/**', 'test-gen/**'
targetExclude 'src-gen/**', 'test-gen/**', 'build/**'
// The following is quoted from https://github.com/google/google-java-format
// "Note: There is no configurability as to the formatter's algorithm for formatting.
// This is a deliberate design decision to unify our code formatting on a single format."
Expand Down
10 changes: 10 additions & 0 deletions cli/lfc/src/main/java/org/lflang/cli/Lfc.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ public class Lfc extends CliBase {
description = "Do not invoke target compiler.")
private boolean noCompile;

@Option(
names = {"--verify"},
arity = "0",
description = "Run the generated verification models.")
private boolean verify;

@Option(
names = {"--print-statistics"},
arity = "0",
Expand Down Expand Up @@ -250,6 +256,10 @@ public Properties getGeneratorArgs() {
props.setProperty(BuildParm.NO_COMPILE.getKey(), "true");
}

if (verify) {
props.setProperty(BuildParm.VERIFY.getKey(), "true");
}

if (targetCompiler != null) {
props.setProperty(BuildParm.TARGET_COMPILER.getKey(), targetCompiler);
}
Expand Down
9 changes: 9 additions & 0 deletions core/build.gradle
lsk567 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id 'org.lflang.java-library-conventions'
id 'org.lflang.kotlin-conventions'
id 'org.lflang.antlr-conventions'
}

sourceSets {
Expand Down Expand Up @@ -34,6 +35,8 @@ dependencies {
exclude group: 'de.cau.cs.kieler.swt.mock'
}

implementation "org.json:json:$jsonVersion"

testImplementation "org.junit.jupiter:junit-jupiter-api:$jupiterVersion"
testImplementation "org.junit.jupiter:junit-jupiter-engine:$jupiterVersion"
testImplementation "org.junit.platform:junit-platform-commons:$jUnitPlatformVersion"
Expand Down Expand Up @@ -73,6 +76,12 @@ clean.dependsOn(cleanGenerateXtextLanguage)
spotlessJava.mustRunAfter(generateXtextLanguage)
rootProject.spotlessMisc.mustRunAfter(generateXtextLanguage)


// antlr4 configuration
generateGrammarSource {
arguments += ['-visitor', '-package', 'org.lflang.dsl']
}

tasks.register('getSubmoduleVersions', Exec) {
description('Run a Git command to get the current status of submodules')
workingDir project.rootDir
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ private static boolean isExcludedFromCCpp(TestCategory category) {
excluded |= category == TestCategory.ZEPHYR_THREADED;
excluded |= category == TestCategory.ARDUINO;
excluded |= category == TestCategory.NO_INLINING;
excluded |= category == TestCategory.VERIFIER;
return !excluded;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package org.lflang.tests.runtime;

import java.util.List;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.Test;
import org.lflang.Target;
import org.lflang.tests.TestBase;
import org.lflang.tests.TestRegistry;

public class CVerifierTest extends TestBase {
protected CVerifierTest() {
super(Target.C);
}

@Test
public void runVerifierTests() {
Assumptions.assumeTrue(isLinux() || isMac(), "Verifier tests only run on Linux or macOS");

super.runTestsFor(
List.of(Target.C),
Message.DESC_VERIFIER,
TestRegistry.TestCategory.VERIFIER::equals,
test -> {
test.getContext().getTargetConfig().verify = true;
return true;
},
TestLevel.BUILD,
false);
}
}
Loading