AGENTS.md — how to modify this module
Invariants, conventions and change recipes for contributors — and for AI coding assistants, which load this file automatically when editing the module. Largely derived from the source and verified against it.
Mirrored from subprojects/xsts/xsts-analysis/AGENTS.md — edit it there, not here.
xsts/xsts-analysis — notes for editing this module
Gradle module: :theta-xsts-analysis. Binds XSTS models (xsts) to the algorithms of common/analysis: CEGAR through XstsConfigBuilder, the monolithic checkers (bounded, IC3, MDD) through XstsToMonolithicAdapter, CHC through XSTS.toRelations(), and trace generation. The user-facing tool is xsts-cli. Overview: README.md.
Build and test
./gradlew :theta-xsts-analysis:test. Most tests parse asrc/test/resources/model/*.xstsfile concatenated with aproperty/*.propfile (XstsDslManager.createXsts). The checker tests are parameterized over adata()table, so a regression model is a new pair plus a row there. They run on the bundled Z3.XstsHornTestinstalls SMT-LIB solvers (z3, eldarica, golem) and skips when it cannot; the rootverifySolverInstallationstask then fails the build.- The tests of
:theta-analysis,:theta-ltl,:theta-multi-testsand:theta-petrinet-xstsalso use this module. Run them after an API change.
Layout
The package hu.bme.mit.theta.xsts.analysis is split across src/main/java/ and src/main/kotlin/, and both hold Kotlin files: search both.
XstsState,XstsAction,XstsLts, and theXstsAnalysiswrapper (withXstsOrd,XstsInitFunc,XstsTransFunc) that lifts aStmtActionanalysis to XSTS.config/(XstsConfigBuilder: CEGAR domains and refinements, init precisions frominitprec/,autoexpl/),concretizer/,tracegeneration/,pipeline/(XstsPipelineCheckeroverXstsToMonolithicAdapter).- Kotlin side:
XstsToRelations.kt(CHC encoding),XstsToMonolithicAdapter.kt,passes/(XSTS-to-XSTS transformers such asXstsStmtFlatteningTransformer).
Invariants / gotchas
- A run is
init, thenenvandtranalternating.XstsStatecarriesisInitialized()andlastActionWasEnv(),XstsLtspicks the statement set from them, andXstsOrdcompares only states with equal flags.XstsToMonolithicAdapterfuses oneenv; tranpair into one monolithic step, andXstsTraceConcretizerUtil.concretizeexpands such a trace back. A change to the step structure must update all of these. - Declaration initializers live in
xsts.getInitFormula(), not in theinitstatement. Seed every analysis, trace checker and encoding with it, asXstsConfigBuilder,XstsTracegenBuilder, the concretizers,toRelations()andXstsToMonolithicAdapterdo. Seeding withTrue()loses the declared initial values: every variable starts at top. - Locals are not state.
getVars()also holds the transition-scoped locals; concretized traces go throughVarFilter, which keeps onlygetStateVars(). A pass that rebuilds an XSTS uses the 8-argument constructor withstateVarsandlocalVars, as those inpasses/do: the 6-argument one treats every variable as state. - Names are not identities. Two locals, or a local and a global, may share a name, so never key a variable by name.
toRelations()suffixes each CHC parameter with the variable's position (|a_1|,|a_1_new|), because solvers identify bound parameters by name.
Change recipe: a new CEGAR domain or refinement
Add the value to XstsConfigBuilder.Domain or Refinement (xsts-cli exposes both enums directly as options). List it in getSupportedDomains()/getSupportedRefinements() of the BuilderStrategy that handles it (the strategy constructors reject anything else), and dispatch to that strategy in build(). A new precision type also needs a method on XstsInitPrec and in each of its implementations under initprec/.