33 * SPDX-License-Identifier: GPL-2.0-only */
44package 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 ;
106import de .uka .ilkd .key .logic .*;
117import de .uka .ilkd .key .proof .Goal ;
128
13- import org .key_project .logic .Name ;
149import org .key_project .util .collection .ImmutableList ;
1510
1611/**
2015 * {@link de.uka.ilkd.key.smt.SMTRuleApp}
2116 */
2217public 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}
0 commit comments