Skip to content

Fix phiStates ignored in computeAllTransientProbabilities - #985

Open
sjunges with Copilot wants to merge 4 commits into
masterfrom
copilot/storm-542-fix-phistates-usage
Open

Fix phiStates ignored in computeAllTransientProbabilities#985
sjunges with Copilot wants to merge 4 commits into
masterfrom
copilot/storm-542-fix-phistates-usage

Conversation

Copilot AI commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

phiStates was passed to computeAllTransientProbabilities but never applied, causing probability mass to flow through states that violate the φ U ψ path condition. All states outside φ should be absorbing — only paths staying within phiStates until reaching psiStates are valid.

Changes

  • SparseCtmcCslHelper::computeAllTransientProbabilities: Compute absorbingStates = ~phiStates | psiStates and call makeRowsAbsorbing on those states before uniformization. Also set their exit rates to 1, consistent with how psiStates were previously handled.
// Before: only psiStates made absorbing; phiStates unused
transposedMatrix.makeRowsAbsorbing(psiStates);

// After: non-phi states also absorbing, enforcing the phi U psi path condition
storm::storage::BitVector absorbingStates = ~phiStates | psiStates;
transposedMatrix.makeRowsAbsorbing(absorbingStates);
for (auto state : absorbingStates) {
    newRates[state] = storm::utility::one<ValueType>();
}

This matches the pattern already used in computeBoundedUntilProbabilities.

Copilot AI linked an issue Aug 6, 2026 that may be closed by this pull request
…bsorb non-phi states

Co-authored-by: sjunges <13627276+sjunges@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix potential bug with unused phistates Fix phiStates ignored in computeAllTransientProbabilities Aug 6, 2026
Copilot AI requested a review from sjunges August 6, 2026 20:31
@sjunges

sjunges commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

@copilot Add a test that failed without this change and does not fail with this change!

…; fix existing test to use phiStates=all

Co-authored-by: sjunges <13627276+sjunges@users.noreply.github.com>

Copilot AI commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Add a test that failed without this change and does not fail with this change!

Added TransientProbabilitiesWithPhiStates test in CtmcCslModelCheckerTest.cpp: it uses a 3-state chain (0→1→2→0) and verifies that when state 1 is excluded from phiStates, no probability reaches state 2 (since state 1 becomes absorbing). Without the fix, probability would flow freely to state 2. Also fixed the existing TransientProbabilities test to use phiStates=all — the old empty phiStates would have caused all states to be absorbing under the fixed code.

@sjunges
sjunges marked this pull request as ready for review August 8, 2026 20:29
@sjunges

sjunges commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

I've reviewed this. Looks good. @volkm can you have a quick look?

@volkm

volkm commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Looks okay to me.

There is still the issue that all goal states are made absorbing, so only the "first front" of goal states will be considered. If there is a goal state s with successor s', then the probabilities for s' will be set to zero instead of the correct value. So maybe the function should just take absorbing states as argument anyway.
But this was originally used for only one paper anyway, so I think improving a bit is good.

@sjunges

sjunges commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Should we instead remove this if there are still issues with this? I must say that I have a hard time to understand "all transient probabilities".

@volkm

volkm commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

The goal was originally to compute the probability $P_{=?} [F^{= t} s]$ from the initial state but for all $s \in S$ in one go. For goal states we would compute $\leq t$ instead of $=t$ by making them absorbing.

My suggestion would be to replace phiStates and psiStates by absorbingStates in the function header. Then it should be correct.

@sjunges

sjunges commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

with an assertion that the states are in fact absorbing?

@volkm

volkm commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

No, I would still make them absorbing in the function (as we currently do). The name "absorbing" is not a good name then, maybe use "goalStates" instead?

@tquatmann

Copy link
Copy Markdown
Contributor

implicitlyAbsorbingStates maybe?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Phistates never used: Is this a bug

4 participants