Class SBAs
- java.lang.Object
-
- net.automatalib.util.automaton.procedural.SBAs
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <I> Map<I,Word<I>>computeAccessSequences(SBA<?,I> sba, ProceduralInputAlphabet<I> alphabet, Map<I,Word<I>> terminatingSequences)static <I> ATSequences<I>computeATSequences(SBA<?,I> sba)Computes a set of access sequences and terminating sequences for a givenSBA.static <I> ATSequences<I>computeATSequences(SBA<?,I> sba, ProceduralInputAlphabet<I> alphabet)Computes a set of access sequences and terminating sequences for a givenSBAlimited to the symbols of the givenProceduralInputAlphabet.static <I> Map<I,Word<I>>computeTerminatingSequences(SBA<?,I> sba, ProceduralInputAlphabet<I> alphabet)static <I> @Nullable Word<I>findSeparatingWord(SBA<?,I> sba1, SBA<?,I> sba2, ProceduralInputAlphabet<I> alphabet)Computes a separating word for the two givenSBAs, if existent.static <I> booleanisValid(SBA<?,I> sba)Checks whether the givenSBAis valid, This is a convenience method forisValid(SBA, ProceduralInputAlphabet)that uses theinput alphabetof the givenSBA.static <I> booleanisValid(SBA<?,I> sba, ProceduralInputAlphabet<I> alphabet)Checks whether the givenSBAis valid with respect to the givenProceduralInputAlphabet, i.e., whether itsproceduresare prefix-closed, return-closed, and call-closed.static <I> SPA<?,I>reduce(SBA<?,I> sba)Reduces a givenSBAto its well-matched language.static <I> SPA<?,I>reduce(SBA<?,I> sba, ProceduralInputAlphabet<I> alphabet)Reduces a givenSBAto its well-matched language restricted to the symbols of the givenProceduralInputAlphabet.static <I> booleantestEquivalence(SBA<?,I> sba1, SBA<?,I> sba2, ProceduralInputAlphabet<I> alphabet)Checks if the two givenSBAs are equivalent, i.e. whether there exists aseparating wordfor them.static <I> ContextFreeModalProcessSystem<I,Void>toCFMPS(SBA<?,I> sba)Returns aContextFreeModalProcessSystem-based view on the language of a givenSBAsuch that there exists aw-labeled path in the returned CFMPS if and only ifwis accepted by the givenSBA.
-
-
-
Method Detail
-
computeATSequences
public static <I> ATSequences<I> computeATSequences(SBA<?,I> sba)
Computes a set of access sequences and terminating sequences for a givenSBA. This is a convenience method forcomputeATSequences(SBA, ProceduralInputAlphabet)that automatically uses theinput alphabetof the givensba.- Type Parameters:
I- input symbol type- Parameters:
sba- theSBAfor which the sequences should be computed- Returns:
- an
ATSequencesobject which contains the respective sequences. - See Also:
computeATSequences(SBA, ProceduralInputAlphabet)
-
computeATSequences
public static <I> ATSequences<I> computeATSequences(SBA<?,I> sba, ProceduralInputAlphabet<I> alphabet)
Computes a set of access sequences and terminating sequences for a givenSBAlimited to the symbols of the givenProceduralInputAlphabet.- Type Parameters:
I- input symbol type- Parameters:
sba- theSBAfor which the sequences should be computedalphabet- theProceduralInputAlphabetwhose symbols should be used for computing the respective sequences- Returns:
- an
ATSequencesobject which contains the respective sequences. - See Also:
computeAccessSequences(SBA, ProceduralInputAlphabet, Map),computeTerminatingSequences(SBA, ProceduralInputAlphabet)
-
computeTerminatingSequences
public static <I> Map<I,Word<I>> computeTerminatingSequences(SBA<?,I> sba, ProceduralInputAlphabet<I> alphabet)
Computes for a givenSBAa set of terminating sequences using the givenalphabet. Terminating sequences transfer a procedure from its initial state to a returnable 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:
sba- theSBAto 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.
-
computeAccessSequences
public static <I> Map<I,Word<I>> computeAccessSequences(SBA<?,I> sba, ProceduralInputAlphabet<I> alphabet, Map<I,Word<I>> terminatingSequences)
Computes for a givenSBAa set of access sequences using the givenalphabet. An access sequence (for procedure p) transfers anSBAfrom its initial state to a state that is able to successfully execute a run of p. This method furthermore checks that potentially nested calls are well-defined, i.e. it only includes procedural invocations p for determining access sequences if p has a valid terminating sequence and therefore can be expanded correctly.- Type Parameters:
I- input symbol type- Parameters:
sba- theSBAto 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.
-
isValid
public static <I> boolean isValid(SBA<?,I> sba)
Checks whether the givenSBAis valid, This is a convenience method forisValid(SBA, ProceduralInputAlphabet)that uses theinput alphabetof the givenSBA.- Type Parameters:
I- input symbol type- Parameters:
sba- theSBAto analyze- Returns:
trueifsbais valid,falseotherwise.- See Also:
isValid(SBA, ProceduralInputAlphabet)
-
isValid
public static <I> boolean isValid(SBA<?,I> sba, ProceduralInputAlphabet<I> alphabet)
Checks whether the givenSBAis valid with respect to the givenProceduralInputAlphabet, i.e., whether itsproceduresare prefix-closed, return-closed, and call-closed.A procedure is considered prefix-closed iff any continuation of a rejected word is rejected as well.
A procedure is considered return-closed iff any continuation beyond the
return symbolis rejected.A procedure is considered call-closed iff any continuation beyond a non-terminating
call symbolis rejected.- Type Parameters:
I- input symbol type- Parameters:
sba- theSBAto analyzealphabet- theProceduralInputAlphabetwhose symbols should be used for checking validity- Returns:
trueifsbais valid,falseotherwise.
-
testEquivalence
public static <I> boolean testEquivalence(SBA<?,I> sba1, SBA<?,I> sba2, ProceduralInputAlphabet<I> alphabet)
Checks if the two givenSBAs are equivalent, i.e. whether there exists aseparating wordfor them.- Type Parameters:
I- input symbol type- Parameters:
sba1- the firstSPMMsba2- the secondSPMMalphabet- theProceduralInputAlphabetwhose symbols should be used for checking equivalence- Returns:
trueif the twoSBAs are equivalent,falseotherwise.- See Also:
findSeparatingWord(SBA, SBA, ProceduralInputAlphabet)
-
findSeparatingWord
public static <I> @Nullable Word<I> findSeparatingWord(SBA<?,I> sba1, SBA<?,I> sba2, ProceduralInputAlphabet<I> alphabet)
Computes a separating word for the two givenSBAs, if existent. A separating word is aWordsuch that oneSBAbehavesdifferent from the other.- Type Parameters:
I- input symbol type- Parameters:
sba1- the firstSBAsba2- the secondSBAalphabet- theProceduralInputAlphabetwhose symbols should be considered for computing the separating word- Returns:
- a separating word, if existent,
nullotherwise.
-
reduce
public static <I> SPA<?,I> reduce(SBA<?,I> sba)
Reduces a givenSBAto its well-matched language. This is a convenience method forreduce(SBA, ProceduralInputAlphabet)that uses theinput alphabetof the givenSBA.- Type Parameters:
I- input symbol type- Parameters:
sba- theSBAto reduce- Returns:
- the reduced
SBAin form of anSPA - See Also:
reduce(SBA, ProceduralInputAlphabet)
-
reduce
public static <I> SPA<?,I> reduce(SBA<?,I> sba, ProceduralInputAlphabet<I> alphabet)
Reduces a givenSBAto its well-matched language restricted to the symbols of the givenProceduralInputAlphabet. The reducedSBAonly accepts aWordiff it is (minimally) well-matched and accepted by the originalSBAas well.- Type Parameters:
I- input symbol type- Parameters:
sba- theSBAto reducealphabet- theProceduralInputAlphabetwhose symbols should be considered for reduction- Returns:
- the reduced
SBAin form of anSPA
-
toCFMPS
public static <I> ContextFreeModalProcessSystem<I,Void> toCFMPS(SBA<?,I> sba)
Returns aContextFreeModalProcessSystem-based view on the language of a givenSBAsuch that there exists aw-labeled path in the returned CFMPS if and only ifwis accepted by the givenSBA. This allows one to model-check language properties ofSBAs with tools such as M3C.- Type Parameters:
I- input symbol type- Parameters:
sba- theSBAto convert- Returns:
- the
ContextFreeModalProcessSystem-based view on the givensba.
-
-