Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
sarah.grebing
ProofScriptParser
Commits
a4d6ca6e
Commit
a4d6ca6e
authored
Jan 23, 2018
by
Sarah Grebing
Browse files
Ideas for fixing interactive rule applications
parent
d312cfbf
Pipeline
#17195
passed with stages
in 9 minutes and 30 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
matcher/src/main/java/edu/kit/iti/formal/psdbg/termmatcher/Utils.java
View file @
a4d6ca6e
...
@@ -47,4 +47,5 @@ public class Utils {
...
@@ -47,4 +47,5 @@ public class Utils {
return
sb
.
toString
();
return
sb
.
toString
();
}
}
}
}
ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controller/DebuggerMain.java
View file @
a4d6ca6e
...
@@ -1057,6 +1057,7 @@ public class DebuggerMain implements Initializable {
...
@@ -1057,6 +1057,7 @@ public class DebuggerMain implements Initializable {
if
(
btnInteractiveMode
.
isSelected
())
{
if
(
btnInteractiveMode
.
isSelected
())
{
assert
model
.
getDebuggerFramework
()
!=
null
;
assert
model
.
getDebuggerFramework
()
!=
null
;
interactiveModeController
.
setDebuggerFramework
(
model
.
getDebuggerFramework
());
interactiveModeController
.
setDebuggerFramework
(
model
.
getDebuggerFramework
());
interactiveModeController
.
setKeYServices
(
this
.
getFacade
().
getService
());
interactiveModeController
.
setActivated
(
true
);
interactiveModeController
.
setActivated
(
true
);
//SaG: this needs to be set to filter inapplicable rules
//SaG: this needs to be set to filter inapplicable rules
this
.
getFacade
().
getEnvironment
().
getProofControl
().
setMinimizeInteraction
(
true
);
this
.
getFacade
().
getEnvironment
().
getProofControl
().
setMinimizeInteraction
(
true
);
...
...
ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controller/InteractiveModeController.java
View file @
a4d6ca6e
...
@@ -3,6 +3,8 @@ package edu.kit.iti.formal.psdbg.gui.controller;
...
@@ -3,6 +3,8 @@ package edu.kit.iti.formal.psdbg.gui.controller;
import
com.google.common.eventbus.Subscribe
;
import
com.google.common.eventbus.Subscribe
;
import
de.uka.ilkd.key.control.AbstractUserInterfaceControl
;
import
de.uka.ilkd.key.control.AbstractUserInterfaceControl
;
import
de.uka.ilkd.key.control.DefaultUserInterfaceControl
;
import
de.uka.ilkd.key.control.DefaultUserInterfaceControl
;
import
de.uka.ilkd.key.java.Services
;
import
de.uka.ilkd.key.logic.Sequent
;
import
de.uka.ilkd.key.logic.SequentFormula
;
import
de.uka.ilkd.key.logic.SequentFormula
;
import
de.uka.ilkd.key.macros.scripts.EngineState
;
import
de.uka.ilkd.key.macros.scripts.EngineState
;
import
de.uka.ilkd.key.macros.scripts.RuleCommand
;
import
de.uka.ilkd.key.macros.scripts.RuleCommand
;
...
@@ -13,6 +15,7 @@ import de.uka.ilkd.key.proof.Proof;
...
@@ -13,6 +15,7 @@ import de.uka.ilkd.key.proof.Proof;
import
edu.kit.iti.formal.psdbg.LabelFactory
;
import
edu.kit.iti.formal.psdbg.LabelFactory
;
import
edu.kit.iti.formal.psdbg.gui.controls.ScriptArea
;
import
edu.kit.iti.formal.psdbg.gui.controls.ScriptArea
;
import
edu.kit.iti.formal.psdbg.gui.controls.ScriptController
;
import
edu.kit.iti.formal.psdbg.gui.controls.ScriptController
;
import
edu.kit.iti.formal.psdbg.gui.controls.Utils
;
import
edu.kit.iti.formal.psdbg.gui.model.InspectionModel
;
import
edu.kit.iti.formal.psdbg.gui.model.InspectionModel
;
import
edu.kit.iti.formal.psdbg.interpreter.data.GoalNode
;
import
edu.kit.iti.formal.psdbg.interpreter.data.GoalNode
;
import
edu.kit.iti.formal.psdbg.interpreter.data.KeyData
;
import
edu.kit.iti.formal.psdbg.interpreter.data.KeyData
;
...
@@ -22,6 +25,8 @@ import edu.kit.iti.formal.psdbg.interpreter.dbg.PTreeNode;
...
@@ -22,6 +25,8 @@ import edu.kit.iti.formal.psdbg.interpreter.dbg.PTreeNode;
import
edu.kit.iti.formal.psdbg.interpreter.exceptions.ScriptCommandNotApplicableException
;
import
edu.kit.iti.formal.psdbg.interpreter.exceptions.ScriptCommandNotApplicableException
;
import
edu.kit.iti.formal.psdbg.parser.PrettyPrinter
;
import
edu.kit.iti.formal.psdbg.parser.PrettyPrinter
;
import
edu.kit.iti.formal.psdbg.parser.ast.*
;
import
edu.kit.iti.formal.psdbg.parser.ast.*
;
import
edu.kit.iti.formal.psdbg.termmatcher.MatcherFacade
;
import
edu.kit.iti.formal.psdbg.termmatcher.Matchings
;
import
javafx.beans.property.BooleanProperty
;
import
javafx.beans.property.BooleanProperty
;
import
javafx.beans.property.SimpleBooleanProperty
;
import
javafx.beans.property.SimpleBooleanProperty
;
import
javafx.collections.ObservableList
;
import
javafx.collections.ObservableList
;
...
@@ -61,6 +66,7 @@ public class InteractiveModeController {
...
@@ -61,6 +66,7 @@ public class InteractiveModeController {
private
ArrayList
<
Node
>
savepointslist
;
private
ArrayList
<
Node
>
savepointslist
;
private
Proof
currentProof
;
private
Proof
currentProof
;
private
Services
keYServices
;
public
void
start
(
Proof
currentProof
,
InspectionModel
model
)
{
public
void
start
(
Proof
currentProof
,
InspectionModel
model
)
{
Events
.
register
(
this
);
Events
.
register
(
this
);
...
@@ -83,12 +89,12 @@ public class InteractiveModeController {
...
@@ -83,12 +89,12 @@ public class InteractiveModeController {
* Undo the application of the last rule
* Undo the application of the last rule
*/
*/
public
void
undo
(
javafx
.
event
.
ActionEvent
actionEvent
)
{
public
void
undo
(
javafx
.
event
.
ActionEvent
actionEvent
)
{
if
(
savepointslist
.
isEmpty
())
{
if
(
savepointslist
.
isEmpty
())
{
Debug
.
log
(
"Kein vorheriger Zustand."
);
//TODO: events fire
Debug
.
log
(
"Kein vorheriger Zustand."
);
//TODO: events fire
return
;
return
;
}
}
val
pruneNode
=
savepointslist
.
get
(
savepointslist
.
size
()
-
1
);
val
pruneNode
=
savepointslist
.
get
(
savepointslist
.
size
()
-
1
);
savepointslist
.
remove
(
pruneNode
);
savepointslist
.
remove
(
pruneNode
);
ImmutableList
<
Goal
>
goalsbeforePrune
=
currentProof
.
getSubtreeGoals
(
pruneNode
);
ImmutableList
<
Goal
>
goalsbeforePrune
=
currentProof
.
getSubtreeGoals
(
pruneNode
);
...
@@ -109,10 +115,10 @@ public class InteractiveModeController {
...
@@ -109,10 +115,10 @@ public class InteractiveModeController {
lastGoalNode
=
new
GoalNode
<>(
prunedChildren
.
get
(
0
).
getParent
().
getParent
(),
kdn
,
kdn
.
getNode
().
isClosed
()));
lastGoalNode
=
new
GoalNode
<>(
prunedChildren
.
get
(
0
).
getParent
().
getParent
(),
kdn
,
kdn
.
getNode
().
isClosed
()));
}
}
model
.
setSelectedGoalNodeToShow
(
lastGoalNode
);
model
.
setSelectedGoalNodeToShow
(
lastGoalNode
);
val
pruneStatement
=
savepointsstatement
.
get
(
savepointsstatement
.
size
()
-
1
);
val
pruneStatement
=
savepointsstatement
.
get
(
savepointsstatement
.
size
()
-
1
);
cases
.
forEach
((
k
,
v
)
->
v
.
remove
(
pruneStatement
));
cases
.
forEach
((
k
,
v
)
->
v
.
remove
(
pruneStatement
));
String
c
=
getCasesAsString
();
String
c
=
getCasesAsString
();
scriptArea
.
setText
(
""
+
scriptArea
.
setText
(
""
+
...
@@ -134,26 +140,46 @@ public class InteractiveModeController {
...
@@ -134,26 +140,46 @@ public class InteractiveModeController {
SequentFormula
seqForm
=
tap
.
getPio
().
sequentFormula
();
SequentFormula
seqForm
=
tap
.
getPio
().
sequentFormula
();
//transform term to parsable string representation
//transform term to parsable string representation
Sequent
seq
=
g
.
sequent
();
String
term
=
edu
.
kit
.
iti
.
formal
.
psdbg
.
termmatcher
.
Utils
.
toPrettyTerm
(
seqForm
.
formula
());
String
term
=
edu
.
kit
.
iti
.
formal
.
psdbg
.
termmatcher
.
Utils
.
toPrettyTerm
(
seqForm
.
formula
());
//check whether more than one possibility for match
Matchings
matches
=
MatcherFacade
.
matches
(
term
,
seq
,
true
,
keYServices
);
Parameters
params
=
new
Parameters
();
Parameters
params
=
new
Parameters
();
params
.
put
(
new
Variable
(
"formula"
),
new
TermLiteral
(
term
));
params
.
put
(
new
Variable
(
"formula"
),
new
TermLiteral
(
term
));
/* if(matches.size() > 1) {
System.out.println("matches = " + matches);
Integer integ = new Integer(tap.getPio().sequentFormula().formula().serialNumber());
System.out.println("integ = " + integ);
params.put(new Variable("occ"), new IntegerLiteral(BigInteger.valueOf(integ)));
}*/
VariableAssignment
va
=
new
VariableAssignment
(
null
);
VariableAssignment
va
=
new
VariableAssignment
(
null
);
CallStatement
call
=
new
CallStatement
(
tapName
,
params
);
CallStatement
call
=
new
CallStatement
(
tapName
,
params
);
try
{
applyRule
(
call
,
g
);
// Insert into the right cases
Node
currentNode
=
g
.
node
();
cases
.
get
(
findRoot
(
currentNode
)).
add
(
call
);
// Insert into the right cases
// How to Play this on the Proof?
Node
currentNode
=
g
.
node
();
// How to Build a new StatePointer? Is it still possible?
cases
.
get
(
findRoot
(
currentNode
)).
add
(
call
);
// or only at #stop()?
// How to Play this on the Proof?
String
c
=
getCasesAsString
();
// How to Build a new StatePointer? Is it still possible?
scriptArea
.
setText
(
""
+
// or only at #stop()?
"//Preview \n"
+
c
);
}
catch
(
ScriptCommandNotApplicableException
e
)
{
Utils
.
showExceptionDialog
(
"Proof Command was not Applicable"
,
"Proof Command was not Applicable"
,
"The script command "
+
call
.
getCommand
().
toString
()
+
" was not applicable. "
+
e
.
getMessage
(),
e
);
}
String
c
=
getCasesAsString
();
scriptArea
.
setText
(
""
+
"//Preview \n"
+
c
);
applyRule
(
call
,
g
);
}
}
private
Node
findRoot
(
Node
cur
)
{
private
Node
findRoot
(
Node
cur
)
{
...
@@ -195,7 +221,7 @@ public class InteractiveModeController {
...
@@ -195,7 +221,7 @@ public class InteractiveModeController {
}
}
private
void
applyRule
(
CallStatement
call
,
Goal
g
)
{
private
void
applyRule
(
CallStatement
call
,
Goal
g
)
throws
ScriptCommandNotApplicableException
{
savepointslist
.
add
(
g
.
node
());
savepointslist
.
add
(
g
.
node
());
savepointsstatement
.
add
(
call
);
savepointsstatement
.
add
(
call
);
...
@@ -256,4 +282,8 @@ public class InteractiveModeController {
...
@@ -256,4 +282,8 @@ public class InteractiveModeController {
public
BooleanProperty
activatedProperty
()
{
public
BooleanProperty
activatedProperty
()
{
return
activated
;
return
activated
;
}
}
public
void
setKeYServices
(
Services
keYServices
)
{
this
.
keYServices
=
keYServices
;
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment