Browse Source

Add another simplification of DRAs - remove any state in a K_i set that does not occur in a non-trivial SCC of the DRA. This also allows more DRAs to be simplified to DFAs.

git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@10013 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Dave Parker 11 years ago
parent
commit
d2c08418db
  1. 26
      prism/src/prism/DASimplifyAcceptance.java

26
prism/src/prism/DASimplifyAcceptance.java

@ -2,10 +2,12 @@ package prism;
import java.util.BitSet; import java.util.BitSet;
import explicit.SCCComputer;
import acceptance.AcceptanceOmega; import acceptance.AcceptanceOmega;
import acceptance.AcceptanceRabin; import acceptance.AcceptanceRabin;
import acceptance.AcceptanceReach; import acceptance.AcceptanceReach;
import acceptance.AcceptanceType; import acceptance.AcceptanceType;
import acceptance.AcceptanceRabin.RabinPair;
public class DASimplifyAcceptance public class DASimplifyAcceptance
{ {
@ -15,13 +17,25 @@ public class DASimplifyAcceptance
* Note that the passed parameter {@code da} may be destroyed by this function. * Note that the passed parameter {@code da} may be destroyed by this function.
* @param da the DA to be simplified (may be destroyed) * @param da the DA to be simplified (may be destroyed)
* @param allowedAcceptance the allowed acceptance types * @param allowedAcceptance the allowed acceptance types
* @return
*/ */
public static DA<BitSet, ? extends AcceptanceOmega> simplifyAcceptance(DA<BitSet, ? extends AcceptanceOmega> da, AcceptanceType... allowedAcceptance) {
@SuppressWarnings("unchecked")
public static DA<BitSet, ? extends AcceptanceOmega> simplifyAcceptance(DA<BitSet, ? extends AcceptanceOmega> da, AcceptanceType... allowedAcceptance)
throws PrismException
{
// Simplifications for DRAs
if (da.getAcceptance() instanceof AcceptanceRabin) { if (da.getAcceptance() instanceof AcceptanceRabin) {
DA<BitSet,AcceptanceRabin> dra = (DA<BitSet,AcceptanceRabin>)da;
if (AcceptanceType.contains(allowedAcceptance, AcceptanceType.REACH) &&
isDFA(dra)) {
DA<BitSet, AcceptanceRabin> dra = (DA<BitSet, AcceptanceRabin>) da;
// K_i states that do not occur in a (non-trivial) SCC of the DRA may as well be removed
SCCComputer sccComp = explicit.SCCComputer.createSCCComputer(null, new LTSFromDA(da));
sccComp.computeBSCCs();
BitSet trivial = sccComp.getNotInSCCs();
for (RabinPair pair : dra.getAcceptance()) {
if (pair.getK().intersects(trivial)) {
pair.getK().andNot(trivial);
}
}
// See if the DRA is actually a DFA
if (AcceptanceType.contains(allowedAcceptance, AcceptanceType.REACH) && isDFA(dra)) {
// we can switch to AcceptanceReach // we can switch to AcceptanceReach
AcceptanceReach reachAcceptance = new AcceptanceReach(getDFAGoalStatesForRabin(dra.getAcceptance())); AcceptanceReach reachAcceptance = new AcceptanceReach(getDFAGoalStatesForRabin(dra.getAcceptance()));
DA.switchAcceptance(dra, reachAcceptance); DA.switchAcceptance(dra, reachAcceptance);
@ -36,7 +50,7 @@ public class DASimplifyAcceptance
* it returns true if every transition from a K_i state goes to another K_i state. * it returns true if every transition from a K_i state goes to another K_i state.
* We also require that there are no L_i states overlapping with any K_j states. * We also require that there are no L_i states overlapping with any K_j states.
*/ */
public static boolean isDFA(DA<BitSet,AcceptanceRabin> dra)
public static boolean isDFA(DA<BitSet, AcceptanceRabin> dra)
{ {
AcceptanceRabin acceptance = dra.getAcceptance(); AcceptanceRabin acceptance = dra.getAcceptance();
// Compute potential set of goal states as the union of all K_i sets // Compute potential set of goal states as the union of all K_i sets

Loading…
Cancel
Save