Commit e6361f70 authored by Sarah Grebing's avatar Sarah Grebing

Communication Bugfix and added example for quantifier instantiation

parent 22c5c2ac
Pipeline #14661 failed with stage
in 2 minutes and 59 seconds
# Execute this in this folder.
# Set to key/key/deployment/components/
COMPONENTS=${COMPONENTS:-~/work/key/key/deployment/components/}
COMPONENTS=${COMPONENTS:-/home/sarah/Documents/KIT_Mitarbeiter/KeYDevelopment/KeYGitDir/key/key/deployment/components/}
mvn install:install-file -Dfile=$COMPONENTS/key.core.jar \
......
......@@ -200,6 +200,14 @@ public class KeyData {
return set;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("Node with SerNr: ");
sb.append(this.getNode().serialNr() + " and sequent \n");
sb.append(this.getNode().sequent() + " and RuleLabels\n");
sb.append(this.getRuleLabel());
return sb.toString();
}
}
package edu.kit.iti.formal.psdbg.interpreter;
import edu.kit.iti.formal.psdbg.interpreter.data.State;
import edu.kit.iti.formal.psdbg.interpreter.graphs.PTreeNode;
import lombok.Getter;
public class StateAddedEvent {
@Getter
PTreeNode changedNode;
@Getter
State addedState;
public StateAddedEvent(PTreeNode addedNode, State addedState) {
this.changedNode = addedNode;
this.addedState = addedState;
}
public String toString() {
return "State added to " + changedNode.getScriptstmt().getNodeName() + changedNode.getScriptstmt().getStartPosition();
}
}
......@@ -50,15 +50,11 @@ public class InterpreterExtendedState<T> {
public InterpreterExtendedState(InterpreterExtendedState<T> pred) {
if (pred == null) {
this.predecessor = null;
} else {
this.predecessor = pred;
}
this.predecessor = pred;
}
public InterpreterExtendedState copy() {
InterpreterExtendedState ext = new InterpreterExtendedState();
public InterpreterExtendedState<T> copy() {
InterpreterExtendedState<T> ext = new InterpreterExtendedState<>();
if (this.predecessor != null) {
ext.setPredecessor(this.predecessor.copy());
} else {
......@@ -95,21 +91,19 @@ public class InterpreterExtendedState<T> {
@Override
public String toString() {
StringBuilder sb = new StringBuilder("\n%%%%%%%%%%%%%%%%%%%%%\nExtended State ");
if (getStmt() != null) {
sb.append(getStmt().getNodeName() + ": \n");
}
sb.append("State before Statement: \n");
if (stateBeforeStmt != null) {
stateBeforeStmt.getGoals().stream().map(tGoalNode -> tGoalNode.getData()).forEach(sb::append);
stateBeforeStmt.getGoals().stream().map(GoalNode::getData).forEach(sb::append);
} else {
sb.append("Before is Empty");
}
sb.append("\nAfter Statement:\n");
if (stateAfterStmt != null) {
stateAfterStmt.getGoals().stream().map(tGoalNode -> tGoalNode.getData()).forEach(sb::append);
stateAfterStmt.getGoals().stream().map(GoalNode::getData).forEach(sb::append);
} else {
sb.append("After is empty");
}
......
......@@ -15,14 +15,12 @@ import java.util.List;
public class State<T> {
/**
* All goalnodes in this state
*/
@Getter
private List<GoalNode<T>> goals;
/**
* Currently selected GoalNode
*/
......@@ -34,14 +32,12 @@ public class State<T> {
@Setter
private boolean errorState;
public State(Collection<GoalNode<T>> goals, GoalNode selected) {
this.goals = new ArrayList<>(goals);
this.selectedGoalNode = selected;
assert selected == null || goals.contains(selected);
}
public State(List<GoalNode<T>> goals, int n) {
this(goals, goals.get(n));
}
......
package edu.kit.iti.formal.psdbg.interpreter.graphs;
import edu.kit.iti.formal.psdbg.interpreter.NodeAddedEvent;
import edu.kit.iti.formal.psdbg.interpreter.StateAddedEvent;
/**
* Listener for Change events in the state graph
......@@ -10,5 +11,7 @@ public interface GraphChangedListener {
abstract void graphChanged(NodeAddedEvent nodeAddedEvent);
abstract void graphChanged(StateAddedEvent stateAddedEvent);
}
......@@ -16,8 +16,8 @@ public class PTreeNode<T> {
*/
private State<T> state;
private InterpreterExtendedState<T> extendedState = new InterpreterExtendedState<>();
private InterpreterExtendedState<T> extendedState;
/**
* Statement
*/
......@@ -31,9 +31,7 @@ public class PTreeNode<T> {
private boolean root;
public PTreeNode(ASTNode node) {
PTreeNode(ASTNode node) {
this.setScriptstmt(node);
}
......@@ -49,7 +47,7 @@ public class PTreeNode<T> {
return scriptstmt;
}
public void setScriptstmt(ASTNode scriptstmt) {
private void setScriptstmt(ASTNode scriptstmt) {
this.scriptstmt = scriptstmt;
}
......@@ -61,11 +59,11 @@ public class PTreeNode<T> {
this.context = context;
}
public InterpreterExtendedState<T> getExtendedState() {
InterpreterExtendedState<T> getExtendedState() {
return extendedState;
}
public void setExtendedState(InterpreterExtendedState<T> extendedState) {
void setExtendedState(InterpreterExtendedState<T> extendedState) {
this.extendedState = extendedState;
}
......@@ -90,7 +88,6 @@ public class PTreeNode<T> {
return state != null;
}
public String extendedStateToString() {
return this.extendedState.toString();
}
......
......@@ -14,8 +14,6 @@ import edu.kit.iti.formal.psdbg.gui.model.MainScriptIdentifier;
import edu.kit.iti.formal.psdbg.interpreter.InterpreterBuilder;
import edu.kit.iti.formal.psdbg.interpreter.KeYProofFacade;
import edu.kit.iti.formal.psdbg.interpreter.KeyInterpreter;
import edu.kit.iti.formal.psdbg.interpreter.data.KeyData;
import edu.kit.iti.formal.psdbg.interpreter.graphs.PTreeNode;
import edu.kit.iti.formal.psdbg.parser.ast.ProofScript;
import javafx.beans.property.*;
import javafx.beans.value.ChangeListener;
......@@ -196,6 +194,7 @@ public class DebuggerMain implements Initializable {
proofTreeController.currentHighlightNodeProperty().addListener((observable, oldValue, newValue) -> {
if (newValue != null) {
System.out.println("Highlight" + newValue);
scriptController.getDebugPositionHighlighter().highlight(newValue);
}
......@@ -648,12 +647,12 @@ public class DebuggerMain implements Initializable {
/**
* Perform a step over
*TODO Uebergabe des selctirkten Knotens damit richtiges ausgewählt
*TODO Uebergabe des selektierten Knotens damit richtiges ausgewählt
* @param actionEvent
*/
public void stepOver(ActionEvent actionEvent) {
LOGGER.debug("DebuggerMain.stepOver");
PTreeNode newState = proofTreeController.stepOver();
proofTreeController.stepOver();
}
/**
......@@ -663,7 +662,7 @@ public class DebuggerMain implements Initializable {
*/
public void stepBack(ActionEvent actionEvent) {
LOGGER.debug("DebuggerMain.stepBack");
PTreeNode<KeyData> newState = proofTreeController.stepBack();
proofTreeController.stepBack();
}
//region Property
......
......@@ -32,6 +32,20 @@ public class PuppetMaster {
*/
private final SimpleObjectProperty<List<GoalNode<KeyData>>> currentGoals = new SimpleObjectProperty<>();
private final SimpleObjectProperty<GoalNode<KeyData>> currentSelectedGoal = new SimpleObjectProperty<>();
private final SimpleObjectProperty<State<KeyData>> currentState = new SimpleObjectProperty<>();
public State<KeyData> getCurrentState() {
return currentState.get();
}
public void setCurrentState(State<KeyData> currentState) {
this.currentState.set(currentState);
}
public SimpleObjectProperty<State<KeyData>> currentStateProperty() {
return currentState;
}
private KeyInterpreter puppet;
private AtomicInteger stepUntilBlock = new AtomicInteger(-1);
private HistoryListener historyLogger;
......@@ -103,7 +117,7 @@ public class PuppetMaster {
//filter whether all goals are closed
Object[] arr = state.getGoals().stream().filter(keyDataGoalNode -> !keyDataGoalNode.isClosed()).toArray();
currentState.set(state);
if (state.getSelectedGoalNode() == null) {
if (arr.length == 0) {
currentGoals.set(Collections.emptyList());
......@@ -123,6 +137,7 @@ public class PuppetMaster {
//if puppet is null an empty state may be reached therefore state get goals etc returns null
Platform.runLater(() -> {
setCurrentState(new State<KeyData>(Collections.emptyList(), null));
currentGoals.set(Collections.emptyList());
currentSelectedGoal.set(null);
});
......
// This file is not written yet!!
script main() {
impRight;
//instantiate with ...
//instantiate var=`x` with=`c`;
//allLeft formula=`\forall` with=`a`;
allLeft on=`\forall s x; f(f(x)) = f(x)` inst_t=`c`;
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment