Skip to content

Commit 087b1c7

Browse files
committed
Moved up some features and slightly generalized others
1 parent fef3051 commit 087b1c7

15 files changed

Lines changed: 67 additions & 26 deletions

File tree

key.core.symbolic_execution/src/main/java/de/uka/ilkd/key/symbolic_execution/strategy/SymbolicExecutionStrategy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import de.uka.ilkd.key.strategy.definition.OneOfStrategyPropertyDefinition;
1616
import de.uka.ilkd.key.strategy.definition.StrategyPropertyValueDefinition;
1717
import de.uka.ilkd.key.strategy.definition.StrategySettingsDefinition;
18-
import de.uka.ilkd.key.strategy.feature.*;
1918
import de.uka.ilkd.key.strategy.feature.instantiator.OneOfCP;
2019
import de.uka.ilkd.key.strategy.termProjection.FocusProjection;
2120
import de.uka.ilkd.key.symbolic_execution.rule.ModalitySideProofRule;
@@ -33,6 +32,7 @@
3332
import org.key_project.prover.strategy.costbased.TopRuleAppCost;
3433
import org.key_project.prover.strategy.costbased.feature.BinaryFeature;
3534
import org.key_project.prover.strategy.costbased.feature.ConditionalFeature;
35+
import org.key_project.prover.strategy.costbased.feature.CountBranchFeature;
3636
import org.key_project.prover.strategy.costbased.feature.Feature;
3737
import org.key_project.prover.strategy.costbased.feature.RuleSetDispatchFeature;
3838
import org.key_project.prover.strategy.costbased.feature.ScaleFeature;

key.core/src/main/java/de/uka/ilkd/key/rule/TacletApp.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,11 +440,11 @@ public TacletApp addCheckedInstantiation(SchemaVariable sv, JTerm term, Services
440440
*
441441
* @return ImmutableSet<SchemaVariable> with SchemaVariables that have not been instantiated yet
442442
*/
443+
@Override
443444
public @NonNull ImmutableSet<SchemaVariable> uninstantiatedVars() {
444445
return calculateNonInstantiatedSV();
445446
}
446447

447-
448448
/**
449449
* returns true if the given {@link SchemaVariable} must be explicitly instantiated it does not
450450
* check whether sv is already instantiated or not
@@ -957,6 +957,7 @@ public PosTacletApp setPosInOccurrence(PosInOccurrence pos,
957957
/**
958958
* @return true iff the if-instantiation list is not null or no if sequent is needed
959959
*/
960+
@Override
960961
public boolean assumesInstantionsComplete() {
961962
return assumesFormulaInstantiations != null || taclet().assumesSequent().isEmpty();
962963
}

key.core/src/main/java/de/uka/ilkd/key/strategy/IntroducedSymbolBy.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
import org.key_project.prover.strategy.costbased.feature.Feature;
1818
import org.key_project.prover.strategy.costbased.termProjection.ProjectionToTerm;
1919

20+
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
21+
2022
public class IntroducedSymbolBy extends BinaryTacletAppFeature {
2123
private final Name ruleSetName;
2224
private final Name schemaVar;
@@ -37,7 +39,8 @@ protected IntroducedSymbolBy(ProjectionToTerm<Goal> termWithTopLevelOpToCheck, N
3739
}
3840

3941
@Override
40-
protected boolean filter(TacletApp app, PosInOccurrence pos, Goal goal, MutableState mState) {
42+
protected boolean filter(@MonotonicNonNull TacletApp app, PosInOccurrence pos, Goal goal,
43+
MutableState mState) {
4144
final Node root = goal.proof().root();
4245

4346
Node n = goal.node();

key.core/src/main/java/de/uka/ilkd/key/strategy/feature/BinaryTacletAppFeature.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import de.uka.ilkd.key.rule.TacletApp;
88

99
import org.key_project.prover.proof.ProofGoal;
10+
import org.key_project.prover.rules.ITacletApp;
1011
import org.key_project.prover.rules.RuleApp;
1112
import org.key_project.prover.sequent.PosInOccurrence;
1213
import org.key_project.prover.strategy.costbased.MutableState;
@@ -37,7 +38,7 @@ protected BinaryTacletAppFeature(boolean p_nonTacletValue) {
3738
final protected <PGoal extends ProofGoal<@NonNull PGoal>> boolean filter(RuleApp app,
3839
PosInOccurrence pos,
3940
PGoal goal, MutableState mState) {
40-
if (app instanceof TacletApp tacletApp) {
41+
if (app instanceof ITacletApp tacletApp) {
4142
return filter(tacletApp, pos, (Goal) goal, mState);
4243
}
4344
return nonTacletValue;
@@ -51,7 +52,7 @@ protected BinaryTacletAppFeature(boolean p_nonTacletValue) {
5152
* @param pos position where <code>app</code> is to be applied
5253
* @param goal the goal on which <code>app</code> is to be applied
5354
* @param mState the MutableState used to store modifiable information
54-
* @return true iff the the result of the feature is supposed to be zero.
55+
* @return true iff the result of the feature is supposed to be zero.
5556
*/
5657
protected abstract boolean filter(TacletApp app, PosInOccurrence pos, Goal goal,
5758
MutableState mState);

key.core/src/main/java/de/uka/ilkd/key/strategy/feature/CheckApplyEqFeature.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
import org.key_project.prover.strategy.costbased.MutableState;
1616
import org.key_project.prover.strategy.costbased.feature.Feature;
1717

18+
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
19+
1820
/**
1921
* This feature checks that an equation is not applied to itself. This means that the focus of the
2022
* rule application must not be one side of an equation that is the instantiation of the first
@@ -27,7 +29,8 @@ public class CheckApplyEqFeature extends BinaryTacletAppFeature {
2729
private CheckApplyEqFeature() {}
2830

2931
@Override
30-
protected boolean filter(TacletApp p_app, PosInOccurrence pos, Goal goal, MutableState mState) {
32+
protected boolean filter(@MonotonicNonNull TacletApp p_app, PosInOccurrence pos, Goal goal,
33+
MutableState mState) {
3134
assert pos != null : "Need to know the position of " + "the application of the taclet";
3235

3336
AssumesFormulaInstantiation ifInst = p_app.assumesFormulaInstantiations().head();

key.core/src/main/java/de/uka/ilkd/key/strategy/feature/DiffFindAndIfFeature.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
import org.key_project.prover.strategy.costbased.feature.Feature;
1515
import org.key_project.util.collection.ImmutableList;
1616

17+
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
18+
1719
/**
1820
* Binary feature that returns zero iff the <tt>\assumes</tt>- and find-formula of a Taclet are
1921
* matched to different members of the sequent. If a taclet has more than one formula in its
@@ -27,7 +29,8 @@ public class DiffFindAndIfFeature extends BinaryTacletAppFeature {
2729
private DiffFindAndIfFeature() {}
2830

2931
@Override
30-
protected boolean filter(TacletApp app, PosInOccurrence pos, Goal goal, MutableState mState) {
32+
protected boolean filter(@MonotonicNonNull TacletApp app, PosInOccurrence pos, Goal goal,
33+
MutableState mState) {
3134
assert pos != null : "Feature is only applicable to rules with find";
3235

3336
ImmutableList<AssumesFormulaInstantiation> list = app.assumesFormulaInstantiations();

key.core/src/main/java/de/uka/ilkd/key/strategy/feature/DiffFindAndReplacewithFeature.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
import org.key_project.prover.strategy.costbased.MutableState;
1515
import org.key_project.prover.strategy.costbased.feature.Feature;
1616

17+
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
18+
1719
import static de.uka.ilkd.key.logic.equality.IrrelevantTermLabelsProperty.IRRELEVANT_TERM_LABELS_PROPERTY;
1820

1921
/**
@@ -28,15 +30,18 @@ public class DiffFindAndReplacewithFeature extends BinaryTacletAppFeature {
2830
private DiffFindAndReplacewithFeature() {}
2931

3032
@Override
31-
protected boolean filter(TacletApp app, PosInOccurrence pos, Goal goal, MutableState mState) {
33+
protected boolean filter(@MonotonicNonNull TacletApp app, PosInOccurrence pos, Goal goal,
34+
MutableState mState) {
3235
assert pos != null && app.rule() instanceof RewriteTaclet
3336
: "Feature is only applicable to rewrite taclets";
3437

35-
for (TacletGoalTemplate template : app.rule().goalTemplates()) {
36-
final JTerm replaceWith = ((RewriteTacletGoalTemplate) template).replaceWith();
37-
if (replaceWith.equalsModProperty(pos.subTerm(),
38-
IRRELEVANT_TERM_LABELS_PROPERTY)) {
39-
return false;
38+
for (TacletGoalTemplate template : app.taclet().goalTemplates()) {
39+
if (template instanceof RewriteTacletGoalTemplate rwTGT) {
40+
final JTerm replaceWith = rwTGT.replaceWith();
41+
if (replaceWith.equalsModProperty(pos.subTerm(),
42+
IRRELEVANT_TERM_LABELS_PROPERTY)) {
43+
return false;
44+
}
4045
}
4146
}
4247
return true;

key.core/src/main/java/de/uka/ilkd/key/strategy/feature/EqNonDuplicateAppFeature.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
import org.key_project.prover.strategy.costbased.MutableState;
1111
import org.key_project.prover.strategy.costbased.feature.Feature;
1212

13+
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
14+
1315

1416
/**
1517
* Binary feature that returns zero iff a certain Taclet app has not already been performed.
@@ -24,7 +26,7 @@ public class EqNonDuplicateAppFeature extends AbstractNonDuplicateAppFeature {
2426
private EqNonDuplicateAppFeature() {}
2527

2628
@Override
27-
public boolean filter(TacletApp app, PosInOccurrence pos,
29+
public boolean filter(@MonotonicNonNull TacletApp app, PosInOccurrence pos,
2830
Goal goal, MutableState mState) {
2931
assert pos != null : "Feature is only applicable to rules with find";
3032

key.core/src/main/java/de/uka/ilkd/key/strategy/feature/MatchedAssumesFeature.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
import org.key_project.prover.strategy.costbased.MutableState;
1111
import org.key_project.prover.strategy.costbased.feature.Feature;
1212

13+
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
14+
1315
/**
1416
* Binary features that returns zero iff the if-formulas of a Taclet are instantiated or the Taclet
1517
* does not have any if-formulas.
@@ -21,7 +23,8 @@ public final class MatchedAssumesFeature extends BinaryTacletAppFeature {
2123
private MatchedAssumesFeature() {}
2224

2325
@Override
24-
protected boolean filter(TacletApp app, PosInOccurrence pos, Goal goal, MutableState mState) {
26+
protected boolean filter(@MonotonicNonNull TacletApp app, PosInOccurrence pos, Goal goal,
27+
MutableState mState) {
2528
return app.assumesInstantionsComplete();
2629
}
2730

key.core/src/main/java/de/uka/ilkd/key/strategy/feature/NoSelfApplicationFeature.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
import org.key_project.prover.strategy.costbased.feature.Feature;
1313
import org.key_project.util.collection.ImmutableList;
1414

15+
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
16+
1517
/**
1618
* This feature checks that the position of application is not contained in the if-formulas. If the
1719
* rule application is admissible, zero is returned.
@@ -23,7 +25,8 @@ public class NoSelfApplicationFeature extends BinaryTacletAppFeature {
2325
private NoSelfApplicationFeature() {}
2426

2527
@Override
26-
protected boolean filter(TacletApp p_app, PosInOccurrence pos, Goal goal, MutableState mState) {
28+
protected boolean filter(@MonotonicNonNull TacletApp p_app, PosInOccurrence pos, Goal goal,
29+
MutableState mState) {
2730
assert pos != null
2831
: "NoSelfApplicationFeature: Need to know the position of the application of the taclet";
2932

0 commit comments

Comments
 (0)