Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
c8476ae
Proof reordering WIP
FliegendeWurst May 15, 2023
b56e32f
Add a 'shortened' dependency graph view
FliegendeWurst May 20, 2023
3f514d6
Reorder steps in all branches
FliegendeWurst May 20, 2023
4a1c9c2
Disable other button
FliegendeWurst May 22, 2023
af6ec97
Merge remote-tracking branch 'fork/proofCaching' into proofReordering
FliegendeWurst May 22, 2023
2b61197
Merge remote-tracking branch 'origin/main' into proofReordering
FliegendeWurst Jun 5, 2023
5059d72
.
FliegendeWurst Jun 5, 2023
94d8c19
Merge remote-tracking branch 'fork/proofCaching' into proofReordering
FliegendeWurst Jun 5, 2023
cb136f4
Merge branch 'proofCaching' into proofReordering
FliegendeWurst Jun 5, 2023
c2434ab
WIP reordering change
FliegendeWurst Jun 5, 2023
dcf2ae5
.
FliegendeWurst Jun 5, 2023
e019649
Merge remote-tracking branch 'fork/proofReordering' into proofReordering
FliegendeWurst Jun 5, 2023
5ff8320
Fix proof reordering bugs
FliegendeWurst Jun 11, 2023
ff7df07
Regroup rules based on heuristics
FliegendeWurst Jun 11, 2023
985de87
Merge remote-tracking branch 'origin/main' into proofReordering
FliegendeWurst Jun 12, 2023
0f182da
Only group rule apps on the same pos
FliegendeWurst Jun 12, 2023
0ac82bd
Track newly introduced functions correctly
FliegendeWurst Jun 13, 2023
f2002ee
Fix UI issues around regrouping
FliegendeWurst Jun 13, 2023
6522b2f
Javadocs
FliegendeWurst Jun 15, 2023
5837245
Add settings UI and tree node labels
FliegendeWurst Jun 16, 2023
1a4a85b
Merge remote-tracking branch 'origin/main' into proofReordering
FliegendeWurst Jun 21, 2023
01c0d5c
Fix several bugs in reordering
FliegendeWurst Jun 21, 2023
9e3ef4b
Better error handling
FliegendeWurst Jun 22, 2023
9a1d1db
Merge remote-tracking branch 'origin/main' into proofReordering
FliegendeWurst Jul 1, 2023
18076b0
Buttons to add and remove heuristic groups
FliegendeWurst Jul 2, 2023
d79c979
Fix handling of NoPos rule apps
FliegendeWurst Jul 2, 2023
9cf87d5
Merge remote-tracking branch 'origin/main' into proofReordering
FliegendeWurst Nov 6, 2023
f91bf7f
Spotless
FliegendeWurst Nov 8, 2023
ebae922
Fix merge errors
FliegendeWurst Nov 8, 2023
1d1aa1d
Repair reordering functionality
FliegendeWurst Nov 8, 2023
323f331
Merge remote-tracking branch 'origin/main' into proofReordering
FliegendeWurst Nov 12, 2023
c812a7b
Fix proof reordering
FliegendeWurst Nov 12, 2023
1863410
Fix another reordering edge case
FliegendeWurst Nov 12, 2023
f1177a4
Fix pruning after regrouping
FliegendeWurst Nov 12, 2023
3107e20
Move actions to appropriate extension
FliegendeWurst Nov 12, 2023
bd6f108
Merge remote-tracking branch 'origin/main' into proofReordering
FliegendeWurst Mar 8, 2024
7246b1e
Fix merge errors + test for FunctionTracker
FliegendeWurst Mar 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
b1ed8d6bc836ea40f357a839707d41fbb04ed6e2
# commit with manual formatting corrections
a9fcedc6c8d96f2480549254a307b3fbe31f04bd
# formatting
f91bf7fa6d3a63720cbcfee5147a78854faa8e8a
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
import java.util.Set;

import de.uka.ilkd.key.logic.op.ElementaryUpdate;
import de.uka.ilkd.key.logic.op.Operator;

import org.key_project.logic.op.Operator;

/**
* Collects all operators occurring in the traversed term.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* @author weigl
* @deprecated Use the facade new KeyIO(services).parseTerm directly
*/
@Deprecated // java11:(forRemoval = true, since = "2.8.0")
@Deprecated(forRemoval = true, since = "2.8.0")
public final class DefaultTermParser {

/**
Expand Down
21 changes: 20 additions & 1 deletion key.core/src/main/java/de/uka/ilkd/key/proof/BranchLocation.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* @author Arne Keller
*/
public class BranchLocation {
public class BranchLocation implements Comparable<BranchLocation> {
/**
* Branch location of the initial proof branch.
*/
Expand Down Expand Up @@ -82,6 +82,9 @@ public static BranchLocation commonPrefix(BranchLocation... locations) {
* @return the remaining suffix
*/
public BranchLocation stripPrefix(BranchLocation prefix) {
if (prefix.size() == location.size()) {
return BranchLocation.ROOT;
}
return new BranchLocation(location.stripPrefix(prefix.location));
}

Expand All @@ -103,6 +106,9 @@ public BranchLocation append(Pair<Node, Integer> newBranch) {
public BranchLocation removeLast() {
List<Pair<Node, Integer>> list = location.toList();
list.remove(list.size() - 1);
if (list.isEmpty()) {
return BranchLocation.ROOT;
}
return new BranchLocation(ImmutableList.fromList(list));
}

Expand Down Expand Up @@ -170,4 +176,17 @@ public boolean equals(Object o) {
public int hashCode() {
return Objects.hash(location);
}

@Override
public int compareTo(BranchLocation other) {
if (this == other) {
return 0;
} else if (this == BranchLocation.ROOT) {
return -1;
} else if (other == BranchLocation.ROOT) {
return 1;
} else {
return location.compareTo(other.location);
}
}
}
26 changes: 26 additions & 0 deletions key.core/src/main/java/de/uka/ilkd/key/proof/FunctionTracker.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* This file is part of KeY - https://key-project.org
* KeY is licensed under the GNU General Public License Version 2
* SPDX-License-Identifier: GPL-2.0-only */
package de.uka.ilkd.key.proof;

import java.lang.ref.WeakReference;
import java.util.WeakHashMap;

import org.key_project.logic.op.Function;

public final class FunctionTracker {
private static final WeakHashMap<Function, WeakReference<Node>> MAPPING = new WeakHashMap<>();

private FunctionTracker() {

}

public static void setIntroducedBy(Function f, Node n) {
MAPPING.put(f, new WeakReference<>(n));
}

public static Node getIntroducedBy(Function f) {
var x = MAPPING.get(f);
return x != null ? x.get() : null;
}
}
4 changes: 4 additions & 0 deletions key.core/src/main/java/de/uka/ilkd/key/proof/Goal.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import de.uka.ilkd.key.util.properties.Properties;
import de.uka.ilkd.key.util.properties.Properties.Property;

import org.key_project.logic.op.Function;
import org.key_project.util.collection.ImmutableList;
import org.key_project.util.collection.ImmutableSLList;

Expand Down Expand Up @@ -657,6 +658,9 @@ private void adaptNamespacesNewGoals(final ImmutableList<Goal> goalList) {
boolean first = true;
for (Goal goal : goalList) {
goal.node().addLocalProgVars(newProgVars);
for (Function f : newFunctions) {
FunctionTracker.setIntroducedBy(f, goal.node.parent());
}
goal.node().addLocalFunctions(newFunctions);

if (first) {
Expand Down
44 changes: 43 additions & 1 deletion key.core/src/main/java/de/uka/ilkd/key/proof/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.Nullable;

public class Node implements Iterable<Node> {
public class Node implements Iterable<Node>, Comparable<Node> {
private static final String RULE_WITHOUT_NAME = "rule without name";

private static final String RULE_APPLICATION_WITHOUT_RULE = "rule application without rule";
Expand Down Expand Up @@ -113,6 +113,10 @@ public class Node implements Iterable<Node> {
@Nullable
private Lookup userData = null;

private List<Node> group = null;
private boolean hideInProofTree = false;
private String extraNodeLabel = null;


/**
* If the rule base has been extended e.g. by loading a new taclet as lemma or by applying a
Expand Down Expand Up @@ -837,4 +841,42 @@ public int getStepIndex() {
void setStepIndex(int stepIndex) {
this.stepIndex = stepIndex;
}

public Node getFirstInBranch() {
Node candidate = this;
while (candidate.parent != null
&& candidate.parent.getBranchLocation().equals(candidate.getBranchLocation())) {
candidate = candidate.parent;
}
return candidate;
}

public List<Node> getGroup() {
return group;
}

public void setGroup(List<Node> group) {
this.group = group;
}

public String getExtraNodeLabel() {
return extraNodeLabel;
}

public void setExtraNodeLabel(String extraNodeLabel) {
this.extraNodeLabel = extraNodeLabel;
}

public boolean isHideInProofTree() {
return hideInProofTree;
}

public void setHideInProofTree(boolean hideInProofTree) {
this.hideInProofTree = hideInProofTree;
}

@Override
public int compareTo(Node node) {
return Integer.compare(this.serialNr, node.serialNr);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public abstract class AbstractProofReplayer {
/**
* The new proof.
*/
private final Proof proof;
protected final Proof proof;

/**
* Instantiate a new replayer.
Expand All @@ -93,6 +93,7 @@ protected ImmutableList<Goal> reApplyRuleApp(Node node, Goal openGoal)
throws IntermediateProofReplayer.BuiltInConstructionException {
RuleApp ruleApp = node.getAppliedRuleApp();
ImmutableList<Goal> nextGoals;

if (ruleApp.rule() instanceof BuiltInRule) {
IBuiltInRuleApp builtInRuleApp = constructBuiltinApp(node, openGoal);
if (!builtInRuleApp.complete()) {
Expand Down Expand Up @@ -318,6 +319,7 @@ private TacletApp constructTacletApp(Node originalStep, Goal currGoal) {
}

if (!ourApp.complete()) {
System.out.println("incomplete!");
ourApp = ourApp.tryToInstantiate(proof.getServices());
}

Expand Down
18 changes: 18 additions & 0 deletions key.core/src/main/java/de/uka/ilkd/key/rule/PosRuleApp.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* This file is part of KeY - https://key-project.org
* KeY is licensed under the GNU General Public License Version 2
* SPDX-License-Identifier: GPL-2.0-only */
package de.uka.ilkd.key.rule;

import de.uka.ilkd.key.logic.PosInOccurrence;

/**
* Interface for rule applications with associated position information.
*
* @author Arne Keller
*/
public interface PosRuleApp {
/**
* @return the position the rule was applied on
*/
PosInOccurrence posInOccurrence();
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* ({@link de.uka.ilkd.key.rule.NoPosTacletApp}) is used to keep track of the (partial)
* instantiation information.
*/
public class PosTacletApp extends TacletApp {
public class PosTacletApp extends TacletApp implements PosRuleApp {

/**
* stores the information where the Taclet is to be applied. This means where the find section
Expand Down
6 changes: 3 additions & 3 deletions key.core/src/main/java/de/uka/ilkd/key/rule/Taclet.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import de.uka.ilkd.key.java.Services;
import de.uka.ilkd.key.logic.*;
import de.uka.ilkd.key.logic.label.TermLabel;
import de.uka.ilkd.key.logic.op.Operator;
import de.uka.ilkd.key.logic.op.QuantifiableVariable;
import de.uka.ilkd.key.logic.op.SchemaVariable;
import de.uka.ilkd.key.proof.Goal;
Expand All @@ -23,6 +22,7 @@

import org.key_project.logic.Name;
import org.key_project.logic.Named;
import org.key_project.logic.op.Operator;
import org.key_project.util.EqualsModProofIrrelevancy;
import org.key_project.util.collection.DefaultImmutableSet;
import org.key_project.util.collection.ImmutableList;
Expand Down Expand Up @@ -728,8 +728,8 @@ public Set<SchemaVariable> collectSchemaVars() {
}

for (Operator op : oc.ops()) {
if (op instanceof SchemaVariable) {
result.add((SchemaVariable) op);
if (op instanceof SchemaVariable sv) {
result.add(sv);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ private TermAndBoundVarPair replaceBoundLogicVars(Term t, TermServices services)
final OpCollector oc = new OpCollector();
oc.visit(t);
final Set<Name> usedNames = new LinkedHashSet<>();
for (Operator op : oc.ops()) {
for (var op : oc.ops()) {
usedNames.add(op.name());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ public void addSettings(Settings settings) {
settings.addPropertyChangeListener(settingsListener);
if (lastReadedProperties != null) {
settings.readSettings(lastReadedProperties);
} else {
// special case: no settings file present
settings.readSettings(new Properties());
}
if (lastReadedConfiguration != null) {
settings.readSettings(lastReadedConfiguration);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1806,7 +1806,7 @@
\then(aePseudoRight * aePseudoTargetFactor
= aePseudoTargetRight * aePseudoLeftCoeff)
\else(aePseudoTargetLeft = aePseudoTargetRight))
\heuristics(polySimp_leftNonUnit, polySimp_applyEqPseudo, notHumanReadable, notHumanReadable)
\heuristics(polySimp_leftNonUnit, polySimp_applyEqPseudo, notHumanReadable)
};

apply_eq_pseudo_leq {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,7 @@ apply_eq_pseudo_eq {
\assumes ([equals(mul(aePseudoLeft,aePseudoLeftCoeff),aePseudoRight)]==>[])
\find(equals(aePseudoTargetLeft,aePseudoTargetRight))
\sameUpdateLevel\replacewith(if-then-else(and(equals(aePseudoTargetLeft,mul(aePseudoLeft,aePseudoTargetFactor)),not(equals(aePseudoLeftCoeff,Z(0(#))))),equals(mul(aePseudoRight,aePseudoTargetFactor),mul(aePseudoTargetRight,aePseudoLeftCoeff)),equals(aePseudoTargetLeft,aePseudoTargetRight)))
\heuristics(notHumanReadable, notHumanReadable, polySimp_applyEqPseudo, polySimp_leftNonUnit)
\heuristics(notHumanReadable, polySimp_applyEqPseudo, polySimp_leftNonUnit)
Choices: true}
-----------------------------------------------------
== apply_eq_pseudo_geq (apply_eq_pseudo_geq) =========================================
Expand Down
70 changes: 0 additions & 70 deletions key.ui/src/main/java/de/uka/ilkd/key/gui/MainWindowTabbedPane.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ public TreeNode[] getPath() {
LinkedList<TreeNode> path = new LinkedList<>();
TreeNode n = this;
path.addFirst(n);
while ((n = n.getParent()) != null) {
// walk up the parent chain
// (robustness: do not continue indefinitely for self-parents)
while (n.getParent() != n && (n = n.getParent()) != null) {
path.addFirst(n);
}
return path.toArray(new TreeNode[0]);
Expand Down
Loading