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/xcfa/xcfa-analysis/AGENTS.md — edit it there, not here.
xcfa/xcfa-analysis — notes for editing this module
Gradle module: :theta-xcfa-analysis. Binds XCFAs to the generic algorithms of common/analysis. Checkers are assembled from these parts in xcfa-cli's checkers/. The module has no README of its own; the papers behind por/ and coi/ are listed in xcfa/README.md.
Layout
Paths are relative to src/main/java/hu/bme/mit/theta/xcfa/analysis/.
XcfaState(per-process location stacks and variable lookups),XcfaAction(aPtrActionover one edge),XcfaPrec.XcfaAnalysis.kt: the LTS (getXcfaLts), the abstract analyses (ExplXcfaAnalysis,PredXcfaAnalysis, ...), the abstractor andgetBoundedXcfaChecker.- Refinement:
XcfaSingleExprTraceRefiner,XcfaPrecRefiner. Error detection:XcfaErrorDetector.kt,XcfaDataRaceCheck.kt. por/(partial-order reduction LTSs),coi/(cone of influence),oc/(the OC checker),monolithic/(XCFA toMonolithicExprfor the bounded and other monolithic checkers),autoexpl/,proof/.
Build and test
./gradlew :theta-xcfa-analysis:test. Tests parse the C programs in src/test/resources/ with c2xcfa's getXcfaFromC (a test-only dependency) and run on the legacy Z3 (Z3LegacySolverFactory), whose native libraries the Gradle test task puts on the library path from lib/. The default, parse-only canaryTest never reaches this module. The verdict fixtures of :theta-xcfa-cli:fixtureTest do, as they run the STABLE portfolio, and so does canaryTest with -Ptheta.canary.mode=full.
Invariants / gotchas
- Memory writes must be threaded along a path. An abstract
XcfaActionknows only its own writes. On a concrete path, a memory read therefore binds to the unconstrained initial memory unless the path's write triples are re-threaded. Every consumer of a path does this: - the ARG refiner, through
threadWriteTriples(Trace); - the liveness refiner, through
threadWriteTriples(ASGTrace)passed as itstraceEnricher; getBoundedXcfaChecker, through itsactionEnricher;- xcfa-cli's
XcfaTraceConcretizer.
A new trace checker or concretizer must do the same (XcfaAction.withLastWrites).
2. Refutation indices are trace positions. XcfaPrecRefiner maps procedure-local variable instances back through the varLookup of the state at each index, and pruning uses the index as a node position. Every trace checker must therefore index its refutation by position, not by SSA version; ExprTraceUnsatCoreChecker in common/analysis converts its unsat core itself (toTracePositions).
3. findDataRace must return null on bottom states, because the ARG builder tests those as targets too. Its address query reads nested dereferences in the addresses and the preconditions at uniqueness index 0 on a repatched state, and leaves out a precondition that follows a memory write of the same label. An address that itself reads memory after such a write cannot be evaluated before the label, so it is answered "may alias" without a query (addressAfterMemoryWrite), and so is any exception. That is sound, because the trace check refutes a false candidate, but an exception that recurs brings the candidate back after every refinement, and the run times out. Treat such an exception as an encoding bug.
4. A Safe result on a model with unsafeUnrollUsed is unreliable. XcfaPipelineChecker and XcfaOcChecker check the flag before they report Safe.