- java.lang.Object
-
- net.automatalib.util.automaton.procedural.SPAs
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <I> Pair<Map<I,Word<I>>,Map<I,Word<I>>>computeAccessAndReturnSequences(SPA<?,I> spa, ProceduralInputAlphabet<I> alphabet, Map<I,Word<I>> terminatingSequences)static <I> ATRSequences<I>computeATRSequences(SPA<?,I> spa)Computes a set of access sequences, terminating sequences, and return sequences for a givenSPA.static <I> ATRSequences<I>computeATRSequences(SPA<?,I> spa, ProceduralInputAlphabet<I> alphabet)Computes a set of access sequences, terminating sequences, and return sequences for a givenSPAlimited to the symbols of the givenProceduralInputAlphabet.static <I> Map<I,Word<I>>computeTerminatingSequences(SPA<?,I> spa, ProceduralInputAlphabet<I> alphabet)static <I> @Nullable Word<I>findSeparatingWord(SPA<?,I> spa1, SPA<?,I> spa2, ProceduralInputAlphabet<I> alphabet)Computes a separating word for the two givenSPAs, if existent.static <I> booleanisMinimal(ProceduralInputAlphabet<I> alphabet, ATRSequences<I> atrSequences)Checks if a pre-computed set ofATRSequencesof anSPAis minimal.static <I> booleanisMinimal(SPA<?,I> spa)Convenience method forisMinimal(SPA, ProceduralInputAlphabet)that usesInputAlphabetHolder.getInputAlphabet()asalphabet.static <I> booleanisMinimal(SPA<?,I> spa, ProceduralInputAlphabet<I> alphabet)Checks if a givenSPAis redundancy-free, i.e. if for allproceduresthere exists an access sequence, terminating sequence, and return sequence.static <I> booleantestEquivalence(SPA<?,I> spa1, SPA<?,I> spa2, ProceduralInputAlphabet<I> alphabet)Checks if the two givenSPAs are equivalent, i.e. whether there exists aseparating wordfor them.static <I> ContextFreeModalProcessSystem<I,Void>toCFMPS(SPA<?,I> spa)Returns aContextFreeModalProcessSystem-based view on the language of a givenSPAsuch that there exists aw-labeled path to the final node of the returned CFMPS' main procedure if and only ifwis accepted by the givenSPA.static <I> SEVPA<?,I>toNSEVPA(SPA<?,I> spa)static <I> OneSEVPA<?,I>toOneSEVPA(SPA<?,I> spa)
-
-
-
Method Detail
-
computeATRSequences
public static <I> ATRSequences<I> computeATRSequences(SPA<?,I> spa)
Computes a set of access sequences, terminating sequences, and return sequences for a givenSPA. This is a convenience method forcomputeATRSequences(SPA, ProceduralInputAlphabet)that automatically uses theinput alphabetof the givenspa.- Type Parameters:
I- input symbol type- Parameters:
spa- theSPAfor which the sequences should be computed- Returns:
- an
ATRSequencesobject which contains the respective sequences. - See Also:
computeATRSequences(SPA, ProceduralInputAlphabet)
-
computeATRSequences
public static <I> ATRSequences<I> computeATRSequences(SPA<?,I> spa, ProceduralInputAlphabet<I> alphabet)
Computes a set of access sequences, terminating sequences, and return sequences for a givenSPAlimited to the symbols of the givenProceduralInputAlphabet.- Type Parameters:
I- input symbol type- Parameters:
spa- theSPAfor which the sequences should be computedalphabet- theProceduralInputAlphabetwhose symbols should be used for computing the respective sequences- Returns:
- an
ATRSequencesobject which contains the respective sequences. - See Also:
computeAccessAndReturnSequences(SPA, ProceduralInputAlphabet, Map),computeTerminatingSequences(SPA, ProceduralInputAlphabet)
-
computeTerminatingSequences
public static <I> Map<I,Word<I>> computeTerminatingSequences(SPA<?,I> spa, ProceduralInputAlphabet<I> alphabet)
Computes for a givenSPAa set of terminating sequences using the givenalphabet. Terminating sequences transfer a procedure from its initial state to an accepting state. This method furthermore checks that the hierarchy of calls is well-defined, i.e. it only includes procedural invocations p for determining a terminating sequence if p has a valid terminating sequence itself.- Type Parameters:
I- input symbol type- Parameters:
spa- theSPAto analyzealphabet- theProceduralInputAlphabetwhose symbols should be used for determining the terminating sequences- Returns:
- A map from procedures (restricted to the call symbols of the given alphabet) to the terminating sequences. This map may be partial as some procedures may not have a well-defined terminating sequence for the given alphabet.
-
computeAccessAndReturnSequences
public static <I> Pair<Map<I,Word<I>>,Map<I,Word<I>>> computeAccessAndReturnSequences(SPA<?,I> spa, ProceduralInputAlphabet<I> alphabet, Map<I,Word<I>> terminatingSequences)
Computes for a givenSPAa set of access sequences and return sequences using the givenalphabet. An access sequence (for procedure p) transfers anSPAfrom its initial state to a state that is able to successfully execute a run of p, whereas the corresponding return sequence transfers theSPAto the global accepting state from an accepting state of p. This method furthermore checks that potentially nested calls are well-defined, i.e. it only includes procedural invocations p for determining access/return sequences if p has a valid terminating sequence and therefore can be expanded correctly.- Type Parameters:
I- input symbol type- Parameters:
spa- theSPAto analyzealphabet- theProceduralInputAlphabetwhose symbols should be used for determining the access and return sequencesterminatingSequences- aMapof call symbols to terminating sequences used to expand nested invocations in access sequences- Returns:
- A pair of maps from procedures (restricted to the call symbols of the given alphabet) to the access/return sequences. These maps may be partial as some procedures may not have well-defined access/terminating sequences for the given alphabet.
-
isMinimal
public static <I> boolean isMinimal(SPA<?,I> spa)
Convenience method forisMinimal(SPA, ProceduralInputAlphabet)that usesInputAlphabetHolder.getInputAlphabet()asalphabet.- Type Parameters:
I- input symbol type- Parameters:
spa- theSPAto check- Returns:
trueifspais redundancy-free,falseotherwise.- See Also:
isMinimal(SPA, ProceduralInputAlphabet)
-
isMinimal
public static <I> boolean isMinimal(SPA<?,I> spa, ProceduralInputAlphabet<I> alphabet)
Checks if a givenSPAis redundancy-free, i.e. if for allproceduresthere exists an access sequence, terminating sequence, and return sequence.
-
isMinimal
public static <I> boolean isMinimal(ProceduralInputAlphabet<I> alphabet, ATRSequences<I> atrSequences)
Checks if a pre-computed set ofATRSequencesof anSPAis minimal.- Type Parameters:
I- input symbol type- Parameters:
alphabet- thealphabetwhich should be used for computing the respective sequencesatrSequences- the pre-computedATRSequences- Returns:
trueifspais redundancy-free,falseotherwise.- See Also:
isMinimal(SPA, ProceduralInputAlphabet)
-
testEquivalence
public static <I> boolean testEquivalence(SPA<?,I> spa1, SPA<?,I> spa2, ProceduralInputAlphabet<I> alphabet)
Checks if the two givenSPAs are equivalent, i.e. whether there exists aseparating wordfor them.- Type Parameters:
I- input symbol type- Parameters:
spa1- the firstSPAspa2- the secondSPAalphabet- theProceduralInputAlphabetwhose symbols should be considered for equivalence testing- Returns:
trueif the twoSPAs are equivalent,falseotherwise.- See Also:
findSeparatingWord(SPA, SPA, ProceduralInputAlphabet)
-
findSeparatingWord
public static <I> @Nullable Word<I> findSeparatingWord(SPA<?,I> spa1, SPA<?,I> spa2, ProceduralInputAlphabet<I> alphabet)
Computes a separating word for the two givenSPAs, if existent. A separating word is aWordsuch that oneSPAbehavesdifferent from the other.- Type Parameters:
I- input symbol type- Parameters:
spa1- the firstSPAspa2- the secondSPAalphabet- theProceduralInputAlphabetwhose symbols should be considered for computing the separating word- Returns:
- a separating word, if existent,
nullotherwise.
-
toCFMPS
public static <I> ContextFreeModalProcessSystem<I,Void> toCFMPS(SPA<?,I> spa)
Returns aContextFreeModalProcessSystem-based view on the language of a givenSPAsuch that there exists aw-labeled path to the final node of the returned CFMPS' main procedure if and only ifwis accepted by the givenSPA. This allows one to model-check language properties ofSPAs with tools such as M3C.- Type Parameters:
I- input symbol type- Parameters:
spa- theSPAto convert- Returns:
- the
ContextFreeModalProcessSystem-based view on the givenspa.
-
-