diff --git a/build.gradle.kts b/build.gradle.kts index e5be05ea9b..3b60d44bbc 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -29,7 +29,7 @@ buildscript { allprojects { group = "hu.bme.mit.theta" - version = "6.7.0" + version = "6.8.0" apply(from = rootDir.resolve("gradle/shared-with-buildSrc/mirrors.gradle.kts")) } diff --git a/settings.gradle.kts b/settings.gradle.kts index 5421f34ea0..c66e3b4fe6 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -21,6 +21,7 @@ include( "common/core", "common/grammar", "common/multi-tests", + "common/ltl", "frontends/c-frontend", "frontends/petrinet-frontend/petrinet-model", diff --git a/subprojects/common/ltl/build.gradle.kts b/subprojects/common/ltl/build.gradle.kts new file mode 100644 index 0000000000..7ba6367682 --- /dev/null +++ b/subprojects/common/ltl/build.gradle.kts @@ -0,0 +1,31 @@ +/* + * Copyright 2024 Budapest University of Technology and Economics + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +plugins { + id("java-common") + id("kotlin-common") +} + +dependencies { + implementation(project(":theta-common")) + implementation(project(":theta-core")) + implementation(project(":theta-solver")) + implementation(project(":theta-analysis")) + implementation(project(mapOf("path" to ":theta-cfa"))) + implementation(project(mapOf("path" to ":theta-cfa-analysis"))) + testImplementation(project(":theta-solver-z3-legacy")) + testImplementation(project(mapOf("path" to ":theta-xsts-analysis"))) + testImplementation(project(mapOf("path" to ":theta-xsts"))) +} diff --git a/subprojects/common/ltl/src/main/kotlin/hu/bme/mit/theta/common/ltl/BuchiUtils.kt b/subprojects/common/ltl/src/main/kotlin/hu/bme/mit/theta/common/ltl/BuchiUtils.kt new file mode 100644 index 0000000000..f0619147e2 --- /dev/null +++ b/subprojects/common/ltl/src/main/kotlin/hu/bme/mit/theta/common/ltl/BuchiUtils.kt @@ -0,0 +1,55 @@ +/* + * Copyright 2024 Budapest University of Technology and Economics + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package hu.bme.mit.theta.common.ltl + +import hu.bme.mit.theta.analysis.InitFunc +import hu.bme.mit.theta.analysis.LTS +import hu.bme.mit.theta.analysis.Prec +import hu.bme.mit.theta.analysis.algorithm.loopchecker.AcceptancePredicate +import hu.bme.mit.theta.analysis.expr.ExprState +import hu.bme.mit.theta.analysis.expr.StmtAction +import hu.bme.mit.theta.analysis.multi.stmt.ExprMultiState +import hu.bme.mit.theta.analysis.multi.stmt.StmtMultiAction +import hu.bme.mit.theta.analysis.unit.UnitState +import hu.bme.mit.theta.cfa.CFA +import hu.bme.mit.theta.cfa.analysis.CfaAction +import hu.bme.mit.theta.cfa.analysis.CfaState + +class BuchiInitFunc
(private val initLoc: CFA.Loc) : InitFunc ,
+ dataRefToPrec: RefutationToPrec , DataP>,
+ > {
+ private val checker:
+ CegarChecker<
+ MultiPrec , DataP>,
+ LDG , DataP>,
+ > =
+ SingleLDGTraceRefiner(
+ refinerStrategy,
+ solverFactory,
+ JoiningPrecRefiner.create(multiRefToPrec),
+ logger,
+ initExpr,
+ )
+ val visualizer =
+ LdgVisualizer<
+ ExprMultiState , DataP>
+ ): SafetyResult<
+ LDG xstsExtractControlPrec(p: P): UnitPrec = UnitPrec.getInstance()
\ No newline at end of file
+fun xstsExtractControlPrec(p: P): UnitPrec = UnitPrec.getInstance()
diff --git a/subprojects/xsts/xsts/src/main/java/hu/bme/mit/theta/xsts/XstsTransformer.kt b/subprojects/xsts/xsts/src/main/java/hu/bme/mit/theta/xsts/XstsTransformer.kt
new file mode 100644
index 0000000000..b878c12e2f
--- /dev/null
+++ b/subprojects/xsts/xsts/src/main/java/hu/bme/mit/theta/xsts/XstsTransformer.kt
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2024 Budapest University of Technology and Economics
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package hu.bme.mit.theta.xsts
+
+import com.google.common.base.Preconditions.checkArgument
+import hu.bme.mit.theta.core.stmt.NonDetStmt
+import hu.bme.mit.theta.core.stmt.SequenceStmt
+import hu.bme.mit.theta.core.stmt.SkipStmt
+import hu.bme.mit.theta.core.stmt.Stmt
+
+fun normalize(rawXsts: XSTS?): XSTS {
+ checkArgument(rawXsts != null, "Can't normalize null")
+ val xstsInput = rawXsts!!
+
+ val normalizedInit = normalize(xstsInput.init)
+ val normalizedTran = normalize(xstsInput.tran)
+ val normalizedEnv = normalize(xstsInput.env)
+
+ return XSTS(
+ xstsInput.ctrlVars,
+ normalizedInit,
+ normalizedTran,
+ normalizedEnv,
+ xstsInput.initFormula,
+ xstsInput.prop,
+ )
+}
+
+private fun normalize(stmt: Stmt): NonDetStmt {
+ val collector = mutableListOf buchiPredicate(
+ buchiAutomaton: CFA
+): AcceptancePredicate,
+ lts: LTS xstsCombineStates(xstsState: XstsState {
- return XstsState.of(dataState, xstsState.lastActionWasEnv(), xstsState.isInitialized)
+ // TODO here initialized should be xstsState.isInitialized, but that fails
+ // LtlCheckTestWithXstsPred
+ return XstsState.of(dataState, xstsState.lastActionWasEnv(), true)
}
fun xstsExtractControlState(xstsState: XstsState<*>): XstsState xstsExtractDataState(xstsState: XstsState): S {
- return xstsState.state
+ return xstsState.state
}
-fun