Skip to content

Commit 5eec835

Browse files
mattulbrichwadoon
authored andcommitted
introducing the script-aware prep macro
1 parent b44bff9 commit 5eec835

4 files changed

Lines changed: 71 additions & 7 deletions

File tree

key.core/src/main/java/de/uka/ilkd/key/macros/ApplyScriptsMacro.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public class ApplyScriptsMacro extends AbstractProofMacro {
5050

5151
private static final Logger LOGGER = LoggerFactory.getLogger(ApplyScriptsMacro.class);
5252

53-
private final ProofMacro fallBackMacro;
53+
private final @Nullable ProofMacro fallBackMacro;
5454

5555
public ApplyScriptsMacro(ProofMacro fallBackMacro) {
5656
this.fallBackMacro = fallBackMacro;
@@ -74,7 +74,7 @@ public String getDescription() {
7474
@Override
7575
public boolean canApplyTo(Proof proof, ImmutableList<@NonNull Goal> goals,
7676
PosInOccurrence posInOcc) {
77-
return fallBackMacro.canApplyTo(proof, goals, posInOcc)
77+
return fallBackMacro != null && fallBackMacro.canApplyTo(proof, goals, posInOcc)
7878
|| goals.exists(g -> getJmlAssert(g.node()) != null);
7979
}
8080

@@ -137,7 +137,9 @@ public ProofMacroFinishedInfo applyTo(UserInterfaceControl uic, Proof proof,
137137
if (Thread.interrupted()) {
138138
throw new InterruptedException();
139139
}
140-
fallBackMacro.applyTo(uic, proof, ImmutableList.of(goal), posInOcc, listener);
140+
if(fallBackMacro != null) {
141+
fallBackMacro.applyTo(uic, proof, ImmutableList.of(goal), posInOcc, listener);
142+
}
141143

142144
}
143145

key.core/src/main/java/de/uka/ilkd/key/macros/ScriptAwareMacro.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@
1818

1919
/**
2020
* This class captures a proof macro which is meant to fully automise KeY proof
21-
* workflow.
21+
* workflow if scripts are present in the JML code.
2222
*
2323
* It is experimental.
2424
*
2525
* It performs the following steps:
2626
* <ol>
2727
* <li>Finish symbolic execution
28-
* <li>>Separate proof obligations" +
29-
* <li>Expand invariant definitions
30-
* <li>Try to close all proof obligations
28+
* <li>Apply macros
29+
* <li>Try to close provable goals
3130
* </ol>
3231
*
3332
* @author mattias ulbrich
33+
* @see ScriptAwarePrepMacro
3434
*/
3535
public class ScriptAwareMacro extends SequentialProofMacro {
3636

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// This file is part of KeY - Integrated Deductive Software Design
2+
//
3+
// Copyright (C) 2001-2011 Universitaet Karlsruhe (TH), Germany
4+
// Universitaet Koblenz-Landau, Germany
5+
// Chalmers University of Technology, Sweden
6+
// Copyright (C) 2011-2014 Karlsruhe Institute of Technology, Germany
7+
// Technical University Darmstadt, Germany
8+
// Chalmers University of Technology, Sweden
9+
//
10+
// The KeY system is protected by the GNU General
11+
// Public License. See LICENSE.TXT for details.
12+
//
13+
14+
package de.uka.ilkd.key.macros;
15+
16+
/**
17+
* This class captures a proof macro which is meant to automise KeY proof
18+
* workflow if scripts are present in the JML code.
19+
*
20+
* It is experimental.
21+
*
22+
* It performs the following steps:
23+
* <ol>
24+
* <li>Finish symbolic execution
25+
* <li>Apply macros
26+
* <li>It does not try to close provable goals
27+
* </ol>
28+
*
29+
* @author mattias ulbrich
30+
* @see ScriptAwareMacro
31+
*/
32+
public class ScriptAwarePrepMacro extends SequentialProofMacro {
33+
34+
private final ProofMacro autoMacro = new FinishSymbolicExecutionMacro();
35+
private final ApplyScriptsMacro applyMacro = new ApplyScriptsMacro(null);
36+
37+
@Override
38+
public String getScriptCommandName() {
39+
return "script-prep-auto";
40+
}
41+
42+
@Override
43+
public String getName() {
44+
return "Script-aware Prep Auto";
45+
}
46+
47+
@Override
48+
public String getCategory() {
49+
return "Auto Pilot";
50+
}
51+
52+
@Override
53+
public String getDescription() {
54+
return "TODO";
55+
}
56+
57+
@Override
58+
protected ProofMacro[] createProofMacroArray() {
59+
return new ProofMacro[] { autoMacro, applyMacro };
60+
}
61+
}

key.core/src/main/resources/META-INF/services/de.uka.ilkd.key.macros.ProofMacro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ de.uka.ilkd.key.macros.WellDefinednessMacro
3131
de.uka.ilkd.key.macros.UpdateSimplificationMacro
3232
de.uka.ilkd.key.macros.TranscendentalFloatSMTMacro
3333
de.uka.ilkd.key.macros.ScriptAwareMacro
34+
de.uka.ilkd.key.macros.ScriptAwarePrepMacro

0 commit comments

Comments
 (0)