Skip to content

Commit f99aff4

Browse files
committed
generify some nomenclature
1 parent 49032b1 commit f99aff4

4 files changed

Lines changed: 29 additions & 28 deletions

File tree

api/src/main/java/net/automatalib/modelchecking/ModelChecker.java

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,27 +23,26 @@
2323
import org.checkerframework.checker.nullness.qual.Nullable;
2424

2525
/**
26-
* A model-checker checks whether a given automaton satisfies a given property. If the property can not be satisfied it
27-
* provides counter examples. In fact, the counter examples is an automaton which language is a subset of the language
28-
* of the given automaton.
26+
* A model-checker checks whether a given model satisfies a given property. If the property can not be satisfied it
27+
* provides counter examples.
2928
*
3029
* @param <I>
3130
* the input type
32-
* @param <A>
33-
* the automaton type
31+
* @param <M>
32+
* the model type
3433
* @param <P>
3534
* the property type
3635
* @param <R>
3736
* the type of counterexample
3837
*/
3938
@FunctionalInterface
40-
public interface ModelChecker<I, A, P, R> {
39+
public interface ModelChecker<I, M, P, R> {
4140

4241
/**
43-
* Try to find counter examples for the given {@code property} and {@code automaton}.
42+
* Try to find counter examples for the given {@code property} and {@code model}.
4443
*
45-
* @param automaton
46-
* the automaton to check the property on.
44+
* @param model
45+
* the model to check the property on.
4746
* @param inputs
4847
* the alphabet.
4948
* @param property
@@ -54,16 +53,16 @@ public interface ModelChecker<I, A, P, R> {
5453
* @throws ModelCheckingException
5554
* when this model checker can not check the property.
5655
*/
57-
@Nullable R findCounterExample(A automaton, Collection<? extends I> inputs, P property);
56+
@Nullable R findCounterExample(M model, Collection<? extends I> inputs, P property);
5857

5958
@FunctionalInterface
6059
interface DFAModelChecker<I, P, R> extends ModelChecker<I, DFA<?, I>, P, R> {}
6160

6261
/**
6362
* A model checker for Mealy machines. Key about the {@link MealyMachine} type here is that it may not be
6463
* input-complete. Implementations of {@link MealyMachine}s should in these cases not return any output for a given
65-
* input sequence. I.e. {@link MealyMachine#computeOutput(Iterable)} should return null when its argument is not
66-
* accepted.
64+
* input sequence, i.e., {@link MealyMachine#computeOutput(Iterable)} should return {@code null} when its argument
65+
* is not accepted.
6766
*
6867
* @see ModelChecker
6968
*/

core/src/main/java/net/automatalib/modelchecking/impl/SizeModelCheckerCache.java

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import java.util.Optional;
2222
import java.util.function.Function;
2323

24-
import net.automatalib.automaton.simple.SimpleAutomaton;
24+
import net.automatalib.automaton.concept.FiniteRepresentation;
2525
import net.automatalib.common.util.Pair;
2626
import net.automatalib.modelchecking.ModelChecker;
2727
import net.automatalib.modelchecking.ModelCheckerCache;
@@ -32,14 +32,14 @@
3232
*
3333
* @param <I>
3434
* the input type
35-
* @param <A>
36-
* the automaton type
35+
* @param <M>
36+
* the model type
3737
* @param <P>
3838
* the property type
3939
* @param <R>
40-
* the result type of call to {@link #findCounterExample(SimpleAutomaton, Collection, Object)}.
40+
* the result type of call to {@link #findCounterExample(FiniteRepresentation, Collection, Object)}.
4141
*/
42-
class SizeModelCheckerCache<I, A extends SimpleAutomaton<?, I>, P, R> implements ModelCheckerCache<I, A, P, R> {
42+
class SizeModelCheckerCache<I, M extends FiniteRepresentation, P, R> implements ModelCheckerCache<I, M, P, R> {
4343

4444
/**
4545
* The actual cache. We need to wrap R in an {@link Optional} because {@link Map#computeIfAbsent(Object, Function)}
@@ -56,15 +56,15 @@ class SizeModelCheckerCache<I, A extends SimpleAutomaton<?, I>, P, R> implements
5656
/**
5757
* A function to any ModelChecker.findCounterExample.
5858
*/
59-
private final ModelChecker<I, A, P, R> modelChecker;
59+
private final ModelChecker<I, M, P, R> modelChecker;
6060

6161
/**
6262
* Constructs a new {@link SizeModelCheckerCache}.
6363
*
6464
* @param modelChecker
6565
* a function to any ModelChecker.findCounterExample.
6666
*/
67-
SizeModelCheckerCache(ModelChecker<I, A, P, R> modelChecker) {
67+
SizeModelCheckerCache(ModelChecker<I, M, P, R> modelChecker) {
6868
this.modelChecker = modelChecker;
6969
}
7070

@@ -74,16 +74,18 @@ class SizeModelCheckerCache<I, A extends SimpleAutomaton<?, I>, P, R> implements
7474
* @see ModelChecker#findCounterExample(Object, Collection, Object)
7575
*/
7676
@Override
77-
public @Nullable R findCounterExample(A automaton, Collection<? extends I> inputs, P property) {
78-
if (automaton.size() > size) {
77+
public @Nullable R findCounterExample(M model, Collection<? extends I> inputs, P property) {
78+
if (model.size() > size) {
7979
counterExamples.clear();
8080
}
8181

82-
size = automaton.size();
82+
size = model.size();
8383

84-
return counterExamples.computeIfAbsent(
85-
Pair.of(inputs, property),
86-
key -> Optional.ofNullable(modelChecker.findCounterExample(automaton, inputs, property))).orElse(null);
84+
return counterExamples.computeIfAbsent(Pair.of(inputs, property),
85+
key -> Optional.ofNullable(modelChecker.findCounterExample(model,
86+
inputs,
87+
property)))
88+
.orElse(null);
8789
}
8890

8991
@Override

core/src/test/java/net/automatalib/modelchecking/impl/cache/ModelCheckerMock.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ public int getChecks() {
5252
}
5353

5454
@Override
55-
public @Nullable R findCounterExample(A automaton, Collection<? extends I> inputs, P property) {
56-
Assert.assertSame(automaton, this.automaton);
55+
public @Nullable R findCounterExample(A model, Collection<? extends I> inputs, P property) {
56+
Assert.assertSame(model, this.automaton);
5757
Assert.assertSame(property, this.property);
5858
checks++;
5959
return this.counterexample;

modelchecking/ltsmin/src/main/java/net/automatalib/modelchecker/ltsmin/ltl/AbstractLTSminLTL.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ protected AbstractLTSminLTL(boolean keepFiles,
6464
unfolder = new AbstractUnfoldingModelChecker<>(minimumUnfolds, multiplier) {
6565

6666
@Override
67-
public @Nullable L findCounterExample(A automaton, Collection<? extends I> inputs, String property) {
67+
public @Nullable L findCounterExample(A model, Collection<? extends I> inputs, String property) {
6868
return null;
6969
}
7070
};

0 commit comments

Comments
 (0)