Skip to content

Commit

Permalink
more refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
unp1 committed Jun 12, 2024
1 parent b0220bd commit 704070f
Show file tree
Hide file tree
Showing 24 changed files with 99 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import de.uka.ilkd.key.rule.BuiltInRule;
import de.uka.ilkd.key.rule.DefaultBuiltInRuleApp;
import de.uka.ilkd.key.rule.IBuiltInRuleApp;
import de.uka.ilkd.key.rule.RuleAbortException;
import org.key_project.ncore.rules.RuleAbortException;
import de.uka.ilkd.key.rule.RuleApp;
import de.uka.ilkd.key.symbolic_execution.util.SymbolicExecutionSideProofUtil;
import de.uka.ilkd.key.symbolic_execution.util.SymbolicExecutionUtil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import de.uka.ilkd.key.rule.DefaultBuiltInRuleApp;
import de.uka.ilkd.key.rule.IBuiltInRuleApp;
import de.uka.ilkd.key.rule.QueryExpand;
import de.uka.ilkd.key.rule.RuleAbortException;
import org.key_project.ncore.rules.RuleAbortException;
import de.uka.ilkd.key.rule.RuleApp;
import de.uka.ilkd.key.symbolic_execution.util.SymbolicExecutionSideProofUtil;
import de.uka.ilkd.key.util.Triple;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import de.uka.ilkd.key.logic.op.LocationVariable;
import de.uka.ilkd.key.proof.Goal;

import org.key_project.ncore.rules.RuleAbortException;
import org.key_project.util.collection.ImmutableList;
import org.key_project.util.collection.ImmutableSLList;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import de.uka.ilkd.key.util.MiscTools;

import org.key_project.logic.Name;
import org.key_project.ncore.rules.RuleAbortException;
import org.key_project.util.collection.ImmutableList;
import org.key_project.util.collection.ImmutableSLList;
import org.key_project.util.collection.ImmutableSet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import de.uka.ilkd.key.util.MiscTools;

import org.key_project.logic.Name;
import org.key_project.ncore.rules.RuleAbortException;
import org.key_project.util.collection.ImmutableList;
import org.key_project.util.collection.ImmutableSet;
import org.key_project.util.java.ArrayUtil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import de.uka.ilkd.key.util.MiscTools;

import org.key_project.logic.Name;
import org.key_project.ncore.rules.RuleAbortException;
import org.key_project.util.collection.ImmutableList;
import org.key_project.util.collection.ImmutableSet;
import org.key_project.util.java.ArrayUtil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import de.uka.ilkd.key.util.MiscTools;

import org.key_project.logic.Name;
import org.key_project.ncore.rules.RuleAbortException;
import org.key_project.util.collection.ImmutableList;

import org.jspecify.annotations.NonNull;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import de.uka.ilkd.key.speclang.LoopContractImpl;

import org.key_project.logic.Name;
import org.key_project.ncore.rules.RuleAbortException;
import org.key_project.util.collection.ImmutableList;
import org.key_project.util.collection.ImmutableSLList;
import org.key_project.util.collection.ImmutableSet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import de.uka.ilkd.key.util.MiscTools;

import org.key_project.logic.Name;
import org.key_project.ncore.rules.RuleAbortException;
import org.key_project.util.collection.ImmutableList;
import org.key_project.util.collection.ImmutableSet;
import org.key_project.util.java.ArrayUtil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import de.uka.ilkd.key.util.MiscTools;

import org.key_project.logic.Name;
import org.key_project.ncore.rules.RuleAbortException;
import org.key_project.util.collection.ImmutableList;
import org.key_project.util.collection.ImmutableSet;
import org.key_project.util.java.ArrayUtil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import de.uka.ilkd.key.speclang.WellDefinednessCheck;

import org.key_project.logic.Name;
import org.key_project.ncore.rules.RuleAbortException;
import org.key_project.util.collection.ImmutableArray;
import org.key_project.util.collection.ImmutableList;
import org.key_project.util.collection.Pair;
Expand Down
8 changes: 7 additions & 1 deletion key.core/src/main/java/de/uka/ilkd/key/rule/Rule.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@

import org.key_project.logic.HasOrigin;
import org.key_project.logic.Name;
import org.key_project.ncore.rules.RuleAbortException;
import org.key_project.util.collection.ImmutableList;

import org.jspecify.annotations.NonNull;

/**
* This interface has to be implemented by all classes that want to act as a rule in the calculus.
*/
public interface Rule extends HasOrigin {
public interface Rule extends org.key_project.ncore.rules.Rule, HasOrigin {

/**
* the rule is applied on the given goal using the information of rule application.
Expand All @@ -31,6 +32,11 @@ public interface Rule extends HasOrigin {
ImmutableList<Goal> apply(Goal goal, Services services, RuleApp ruleApp)
throws RuleAbortException;

@NonNull
default ImmutableList<Goal> apply(Goal goal, RuleApp ruleApp) throws RuleAbortException {
return apply(goal, goal.proof().getServices(), ruleApp);
};

/**
* the name of the rule
*/
Expand Down
17 changes: 4 additions & 13 deletions key.core/src/main/java/de/uka/ilkd/key/rule/RuleApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/**
* rule application with specific information how and where the rule has to be applied
*/
public interface RuleApp extends EqualsModProofIrrelevancy {
public interface RuleApp extends org.key_project.ncore.rules.RuleApp, EqualsModProofIrrelevancy {

/**
* returns the rule of this rule application
Expand All @@ -39,18 +39,9 @@ public interface RuleApp extends EqualsModProofIrrelevancy {
@Nullable
ImmutableList<Goal> execute(Goal goal, Services services);

/**
* returns true if all variables are instantiated
*
* @return true if all variables are instantiated
*/
boolean complete();

/**
* @return user-friendly name for this rule-application
*/
default String displayName() {
return rule().displayName();
@Nullable
default ImmutableList<Goal> execute(Goal goal) {
return execute(goal, goal.proof().getServices());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import de.uka.ilkd.key.util.MiscTools;

import org.key_project.logic.Name;
import org.key_project.ncore.rules.RuleAbortException;
import org.key_project.util.collection.ImmutableList;

import org.jspecify.annotations.NonNull;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import de.uka.ilkd.key.util.Triple;

import org.key_project.logic.Name;
import org.key_project.ncore.rules.RuleAbortException;
import org.key_project.util.collection.ImmutableArray;
import org.key_project.util.collection.ImmutableList;
import org.key_project.util.collection.ImmutableSLList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import de.uka.ilkd.key.proof.ProofTreeEvent;
import de.uka.ilkd.key.rule.BuiltInRule;
import de.uka.ilkd.key.rule.IBuiltInRuleApp;
import de.uka.ilkd.key.rule.RuleAbortException;
import org.key_project.ncore.rules.RuleAbortException;
import de.uka.ilkd.key.rule.RuleApp;
import de.uka.ilkd.key.util.mergerule.SymbolicExecutionState;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import de.uka.ilkd.key.rule.BuiltInRule;
import de.uka.ilkd.key.rule.IBuiltInRuleApp;
import de.uka.ilkd.key.rule.NoPosTacletApp;
import de.uka.ilkd.key.rule.RuleAbortException;
import org.key_project.ncore.rules.RuleAbortException;
import de.uka.ilkd.key.rule.RuleApp;
import de.uka.ilkd.key.rule.merge.MergeProcedure.ValuesMergeResult;
import de.uka.ilkd.key.rule.merge.procedures.MergeByIfThenElse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import de.uka.ilkd.key.proof.init.Profile;
import de.uka.ilkd.key.proof.io.ProblemLoaderException;
import de.uka.ilkd.key.rule.Rule;
import de.uka.ilkd.key.rule.RuleAbortException;
import org.key_project.ncore.rules.RuleAbortException;
import de.uka.ilkd.key.rule.RuleApp;
import de.uka.ilkd.key.rule.label.ChildTermLabelPolicy;
import de.uka.ilkd.key.rule.label.TermLabelPolicy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* SPDX-License-Identifier: GPL-2.0-only */
package org.key_project.ncore.proof;


/**
* <p>
* A proof object provides an interface to the current proof status.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package org.key_project.ncore.rules;

import org.jspecify.annotations.NonNull;
import org.key_project.logic.Name;
import org.key_project.logic.Named;
import org.key_project.ncore.proof.ProofGoal;
import org.key_project.util.collection.ImmutableList;

public interface Rule extends Named {
/**
* the rule is applied on the given goal using the information of rule application.
*
* @param goal the Goal on which to apply <tt>ruleApp</tt>
* @param ruleApp the rule application to be executed
* @return all open goals below \old(goal.node()), i.e. the goals resulting from the rule
* application
* @throws RuleAbortException when this rule was aborted
*/
@NonNull
<G extends ProofGoal> ImmutableList<G> apply(G goal, RuleApp ruleApp)
throws RuleAbortException;

/**
* the name of the rule
*/
Name name();

/**
* returns the display name of the rule
*/
String displayName();
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* 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;
package org.key_project.ncore.rules;

/**
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package org.key_project.ncore.rules;

import org.jspecify.annotations.Nullable;
import org.key_project.ncore.proof.ProofGoal;
import org.key_project.util.collection.ImmutableList;

public interface RuleApp {
/**
* returns the rule of this rule application
*/
Rule rule();

/**
* applies the specified rule at the specified position if all schema variables have been
* instantiated
*
* @param goal the Goal where to apply the rule
* @return list of new created goals
*/
@Nullable
<G extends ProofGoal> ImmutableList<G> execute(G goal);

/**
* returns true if all variables are instantiated
*
* @return true if all variables are instantiated
*/
boolean complete();

/**
* @return user-friendly name for this rule-application
*/
default String displayName() {
return rule().displayName();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import de.uka.ilkd.key.pp.AbbrevMap;
import de.uka.ilkd.key.pp.PrettyPrinter;
import de.uka.ilkd.key.proof.io.OutputStreamProofSaver;
import de.uka.ilkd.key.rule.RuleAbortException;
import org.key_project.ncore.rules.RuleAbortException;
import de.uka.ilkd.key.speclang.LoopSpecification;
import de.uka.ilkd.key.util.InfFlowSpec;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import de.uka.ilkd.key.speclang.LoopSpecImpl;
import de.uka.ilkd.key.speclang.LoopSpecification;
import de.uka.ilkd.key.util.MiscTools;
import org.key_project.ncore.rules.RuleAbortException;

/**
* This class completes the instantiations of the loop invariant rule applications.
Expand Down

0 comments on commit 704070f

Please sign in to comment.