99import de .uka .ilkd .key .java .Services ;
1010import de .uka .ilkd .key .logic .*;
1111import de .uka .ilkd .key .proof .Goal ;
12- import de .uka .ilkd .key .rule .AbstractBuiltInRuleApp ;
12+ import de .uka .ilkd .key .rule .AbstractExternalSolverRuleApp ;
1313import de .uka .ilkd .key .rule .BuiltInRule ;
1414import de .uka .ilkd .key .rule .RuleApp ;
1515
1616import org .key_project .logic .Name ;
1717import org .key_project .util .collection .ImmutableList ;
1818
19+ import org .jspecify .annotations .NonNull ;
20+
1921/**
20- * The rule application that is used when a goal is closed by means of an external solver. So far it
22+ * The rule application that is used when a goal is closed by means of an SMT solver. So far it
2123 * stores the rule that that has been used and a title containing some information for the user.
2224 */
23- public class SMTRuleApp extends AbstractBuiltInRuleApp {
24-
25+ public class SMTRuleApp extends AbstractExternalSolverRuleApp {
2526 public static final SMTRule RULE = new SMTRule ();
26- private final String title ;
27- private final String successfulSolverName ;
2827
2928 /**
3029 * Create a new rule app without ifInsts (will be null).
@@ -37,39 +36,26 @@ public class SMTRuleApp extends AbstractBuiltInRuleApp {
3736 this (rule , pio , null , successfulSolverName );
3837 }
3938
40- SMTRuleApp (SMTRule rule , PosInOccurrence pio , ImmutableList <PosInOccurrence > unsatCore ,
39+ SMTRuleApp (ExternalSolverRule rule , PosInOccurrence pio ,
40+ ImmutableList <PosInOccurrence > unsatCore ,
4141 String successfulSolverName ) {
42- super (rule , pio , unsatCore );
43- this .title = "SMT: " + successfulSolverName ;
44- this .successfulSolverName = successfulSolverName ;
42+ super (rule , pio , unsatCore , successfulSolverName , "SMT: " + successfulSolverName );
4543 }
4644
4745 @ Override
4846 public SMTRuleApp replacePos (PosInOccurrence newPos ) {
4947 return new SMTRuleApp (RULE , newPos , ifInsts , successfulSolverName );
5048 }
5149
52- public String getTitle () {
53- return title ;
54- }
55-
56- public String getSuccessfulSolverName () {
57- return successfulSolverName ;
58- }
59-
6050 @ Override
6151 public BuiltInRule rule () {
6252 return RULE ;
6353 }
6454
65- @ Override
66- public String displayName () {
67- return title ;
68- }
69-
70- public static class SMTRule implements BuiltInRule {
55+ public static class SMTRule implements ExternalSolverRule {
7156 public static final Name name = new Name ("SMTRule" );
7257
58+ @ Override
7359 public SMTRuleApp createApp (String successfulSolverName ) {
7460 return new SMTRuleApp (this , null , successfulSolverName );
7561 }
@@ -81,6 +67,7 @@ public SMTRuleApp createApp(String successfulSolverName) {
8167 * @param unsatCore formulas required to prove the result
8268 * @return rule application instance
8369 */
70+ @ Override
8471 public SMTRuleApp createApp (String successfulSolverName ,
8572 ImmutableList <PosInOccurrence > unsatCore ) {
8673 return new SMTRuleApp (this , null , unsatCore , successfulSolverName );
@@ -91,13 +78,6 @@ public SMTRuleApp createApp(PosInOccurrence pos, TermServices services) {
9178 return new SMTRuleApp (this , null , "" );
9279 }
9380
94-
95- @ Override
96- public boolean isApplicable (Goal goal , PosInOccurrence pio ) {
97- return false ;
98- }
99-
100-
10181 /**
10282 * Create a new goal (to be closed in {@link Goal#apply(RuleApp)} directly afterwards)
10383 * with the same sequent as the given one.
@@ -108,23 +88,20 @@ public boolean isApplicable(Goal goal, PosInOccurrence pio) {
10888 * @return a list with an identical goal as the given <tt>goal</tt>
10989 */
11090 @ Override
91+ @ NonNull
11192 public ImmutableList <Goal > apply (Goal goal , Services services , RuleApp ruleApp ) {
11293 if (goal .proof ().getInitConfig ().getJustifInfo ().getJustification (RULE ) == null ) {
11394 goal .proof ().getInitConfig ().registerRule (RULE , () -> false );
11495 }
11596 return goal .split (1 );
11697 }
11798
118- @ Override
119- public boolean isApplicableOnSubTerms () {
120- return false ;
121- }
122-
12399 @ Override
124100 public String displayName () {
125101 return "SMT" ;
126102 }
127103
104+ @ Override
128105 public String toString () {
129106 return displayName ();
130107 }
@@ -133,9 +110,9 @@ public String toString() {
133110 public Name name () {
134111 return name ;
135112 }
136-
137113 }
138114
115+ @ Override
139116 public SMTRuleApp setTitle (String title ) {
140117 return new SMTRuleApp (RULE , pio , ifInsts , title );
141118 }
@@ -168,5 +145,4 @@ public SMTRuleApp tryToInstantiate(Goal goal) {
168145 }
169146 return app .setIfInsts (ImmutableList .fromList (ifInsts ));
170147 }
171-
172148}
0 commit comments