Skip to content

Commit 5c7566a

Browse files
committed
removed default implementations for AbstractExternalSolverRuleApp around RULE field
1 parent 3bdb527 commit 5c7566a

File tree

2 files changed

+3
-72
lines changed

2 files changed

+3
-72
lines changed

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

Lines changed: 1 addition & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,9 @@
33
* SPDX-License-Identifier: GPL-2.0-only */
44
package de.uka.ilkd.key.rule;
55

6-
import java.util.ArrayList;
7-
import java.util.List;
8-
9-
import de.uka.ilkd.key.java.Services;
106
import de.uka.ilkd.key.logic.*;
117
import de.uka.ilkd.key.proof.Goal;
128

13-
import org.key_project.logic.Name;
149
import org.key_project.util.collection.ImmutableList;
1510

1611
/**
@@ -20,7 +15,6 @@
2015
* {@link de.uka.ilkd.key.smt.SMTRuleApp}
2116
*/
2217
public abstract class AbstractExternalSolverRuleApp extends AbstractBuiltInRuleApp {
23-
protected final ExternalSolverRule rule;
2418
protected final String title;
2519
protected final String successfulSolverName;
2620

@@ -38,7 +32,6 @@ protected AbstractExternalSolverRuleApp(ExternalSolverRule rule, PosInOccurrence
3832
ImmutableList<PosInOccurrence> unsatCore,
3933
String successfulSolverName, String title) {
4034
super(rule, pio, unsatCore);
41-
this.rule = rule.newRule();
4235
this.title = title;
4336
this.successfulSolverName = successfulSolverName;
4437
}
@@ -61,11 +54,6 @@ public String getSuccessfulSolverName() {
6154
return successfulSolverName;
6255
}
6356

64-
@Override
65-
public BuiltInRule rule() {
66-
return rule;
67-
}
68-
6957
@Override
7058
public String displayName() {
7159
return title;
@@ -75,10 +63,6 @@ public String displayName() {
7563
* Interface for the rules of external solvers
7664
*/
7765
public interface ExternalSolverRule extends BuiltInRule {
78-
Name name = new Name("ExternalSolverRule");
79-
80-
ExternalSolverRule newRule();
81-
8266
AbstractExternalSolverRuleApp createApp(String successfulSolverName);
8367

8468
/**
@@ -100,42 +84,16 @@ default boolean isApplicable(Goal goal, PosInOccurrence pio) {
10084
return false;
10185
}
10286

103-
104-
/**
105-
* Create a new goal (to be closed in {@link Goal#apply(RuleApp)} directly afterwards)
106-
* with the same sequent as the given one.
107-
*
108-
* @param goal the Goal on which to apply <tt>ruleApp</tt>
109-
* @param services the Services with the necessary information about the java programs
110-
* @param ruleApp the rule application to be executed
111-
* @return a list with an identical goal as the given <tt>goal</tt>
112-
*/
113-
@Override
114-
default ImmutableList<Goal> apply(Goal goal, Services services, RuleApp ruleApp) {
115-
if (goal.proof().getInitConfig().getJustifInfo().getJustification(newRule()) == null) {
116-
goal.proof().getInitConfig().registerRule(newRule(), () -> false);
117-
}
118-
return goal.split(1);
119-
}
120-
12187
@Override
12288
default boolean isApplicableOnSubTerms() {
12389
return false;
12490
}
12591

12692
@Override
127-
default String displayName() {
128-
return "ExternalSolver";
129-
}
93+
String displayName();
13094

13195
@Override
13296
String toString();
133-
134-
@Override
135-
default Name name() {
136-
return name;
137-
}
138-
13997
}
14098

14199
/**
@@ -151,28 +109,4 @@ public AbstractExternalSolverRuleApp setIfInsts(ImmutableList<PosInOccurrence> i
151109
setMutable(ifInsts);
152110
return this;
153111
}
154-
155-
/**
156-
* Create a new RuleApp with the same pio (in this case, that will probably be null as the
157-
* AbstractExternalSolver rule is applied to the complete sequent) as this one.
158-
* Add all top level formulas of the goal
159-
* to the RuleApp's ifInsts.
160-
*
161-
* @param goal the goal to instantiate the current RuleApp on
162-
* @return a new RuleApp with the same pio and all top level formulas of the goal as ifInsts
163-
*/
164-
@Override
165-
public AbstractExternalSolverRuleApp tryToInstantiate(Goal goal) {
166-
AbstractExternalSolverRuleApp app = rule.createApp(pio, goal.proof().getServices());
167-
Sequent seq = goal.sequent();
168-
List<PosInOccurrence> ifInsts = new ArrayList<>();
169-
for (SequentFormula ante : seq.antecedent()) {
170-
ifInsts.add(new PosInOccurrence(ante, PosInTerm.getTopLevel(), true));
171-
}
172-
for (SequentFormula succ : seq.succedent()) {
173-
ifInsts.add(new PosInOccurrence(succ, PosInTerm.getTopLevel(), false));
174-
}
175-
return app.setIfInsts(ImmutableList.fromList(ifInsts));
176-
}
177-
178112
}

key.core/src/main/java/de/uka/ilkd/key/smt/SMTRuleApp.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import de.uka.ilkd.key.rule.BuiltInRule;
1414
import de.uka.ilkd.key.rule.RuleApp;
1515

16+
import org.jspecify.annotations.NonNull;
1617
import org.key_project.logic.Name;
1718
import org.key_project.util.collection.ImmutableList;
1819

@@ -53,11 +54,6 @@ public BuiltInRule rule() {
5354
public static class SMTRule implements ExternalSolverRule {
5455
public static final Name name = new Name("SMTRule");
5556

56-
@Override
57-
public ExternalSolverRule newRule() {
58-
return new SMTRule();
59-
}
60-
6157
@Override
6258
public SMTRuleApp createApp(String successfulSolverName) {
6359
return new SMTRuleApp(this, null, successfulSolverName);
@@ -91,6 +87,7 @@ public SMTRuleApp createApp(PosInOccurrence pos, TermServices services) {
9187
* @return a list with an identical goal as the given <tt>goal</tt>
9288
*/
9389
@Override
90+
@NonNull
9491
public ImmutableList<Goal> apply(Goal goal, Services services, RuleApp ruleApp) {
9592
if (goal.proof().getInitConfig().getJustifInfo().getJustification(RULE) == null) {
9693
goal.proof().getInitConfig().registerRule(RULE, () -> false);

0 commit comments

Comments
 (0)