Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
2f7858f
Modularize Feature strategies
Drodt Jul 3, 2025
a1a4dfc
Cleanup of IntegerStrategy
unp1 Jul 3, 2025
4c9a0ea
Factor out reasoning about strings in own strategy
unp1 Jul 3, 2025
66a7559
Moves FormulaTag manager to ncore (start of generalizing the indexing…
unp1 Jun 13, 2025
bc6a855
Move RuleIndex to ncore
unp1 Jun 13, 2025
c516fda
Cleanup TacletApp implementations
unp1 Jun 13, 2025
1492521
Minor cleanup and nullness annotations
unp1 Jun 13, 2025
7e70c11
Simplify "union" logic in SVInstantiations
unp1 Jun 13, 2025
1e357fa
Nullness and cleanup of code
unp1 Jun 13, 2025
07a92f6
Renaming from ifInstantiation to assumesFormulaInstantiation
unp1 Jun 13, 2025
0c14224
Avoid duplicate check of equal sv instantiations
unp1 Jun 13, 2025
0e8be5e
Rewrite recursion to iterative solution (in this case the intend is c…
unp1 Jun 13, 2025
5baa666
Nullness fixes and removal of unnecessary casts
unp1 Jun 13, 2025
48c4621
Nullness annotations
unp1 Jun 14, 2025
ee40d81
Added and updated comments
unp1 Jun 14, 2025
a65e4b0
Cleanup TacletApp (and subclasses)
unp1 Jun 15, 2025
a79aba3
Move RuleIndex to ncore
Drodt Jul 3, 2025
d9c79e6
Try to distribute responsibilities for features; this commit has errors
Drodt Jul 14, 2025
bd01ba2
Added javadoc
unp1 Jul 17, 2025
bf7249a
Intermediate commit: Move common features to modular strat; fix: inst…
Drodt Jul 17, 2025
4be0bf7
Clean up
Drodt Jul 17, 2025
231bc41
Modular UI Strategy panel
Drodt Jul 17, 2025
42c9d2a
Add responsibilities to StringStrategy
unp1 Jul 17, 2025
434e58f
Rename UI text
Drodt Jul 23, 2025
71bb95d
Add SymEx strat
Drodt Jul 24, 2025
219f1ce
Finish SymExStrategy
Drodt Jul 25, 2025
2fd419c
Split program rules from normal rule sets
Drodt Jul 25, 2025
9f3ae8b
Simplify
Drodt Jul 30, 2025
7988fb5
Modularize int assign rules
Drodt Jul 30, 2025
7c5f40f
Conflict resolution
Drodt Jul 30, 2025
b388496
Spotless
Drodt Aug 13, 2025
7e37d27
Add conflict resolution for int
Drodt Aug 13, 2025
ccf8c0e
Add FOL Strat
Drodt Aug 13, 2025
50ca4c5
Nullability
Drodt Aug 13, 2025
40a5c31
Remove LocSet handling from FOLStrat
Drodt Aug 13, 2025
dc08d1b
Add JFOLStrat
Drodt Aug 13, 2025
6139be0
Merge branch 'main' into modular-features
Drodt Aug 13, 2025
d24d116
Merge branch 'main' into modular-features
Drodt Sep 5, 2025
bd2caaf
Split up int rules; fix relative paths in JARs
Drodt Oct 16, 2025
ab5073a
Split sequence
Drodt Oct 16, 2025
f263c6a
Make paths relative by default; split more rules and headers
Drodt Oct 16, 2025
e017ced
Merge branch 'main' into modular-features
Drodt Oct 23, 2025
c0b1a62
Documentation
Drodt Oct 23, 2025
c32da1e
Add proof settings to float files; use correct strategy factory for m…
Drodt Oct 30, 2025
700f0ef
Remove printing
Drodt Oct 30, 2025
ba7fde6
Spotless
Drodt Oct 30, 2025
3e81c70
Add .key file ending to relative paths
Drodt Nov 6, 2025
9a66b0b
Merge branch 'main' into modular-features
Drodt Nov 6, 2025
1d1c228
Slight performance improvement
Drodt Nov 6, 2025
62f4da9
Simplify
Drodt Nov 7, 2025
cc0df1a
Fix OSS
Drodt Nov 7, 2025
9d8f11f
Simplify conflict resolution
Drodt Nov 7, 2025
dc90f0c
Handle built-in rules
Drodt Nov 19, 2025
9aba243
Fix ExprTests (relative paths)
Drodt Nov 19, 2025
393cee7
Regenerate taclet oracle
Drodt Nov 19, 2025
f3d3aa1
Fix OSS
Drodt Nov 19, 2025
1c2967d
Add missing Builtin rule to JavaDL strat
Drodt Nov 19, 2025
59f8432
Strategy Dispatcher API refactoring (work-in-progress; does not yet c…
unp1 Nov 20, 2025
54c9618
Fix reworked dispatch seprataion
Drodt Nov 20, 2025
f8d79b3
Fix performance regression (add fail fast in approval logic)
unp1 Nov 20, 2025
164065d
Minor cleanup and correction (approval feature and cost feature were …
unp1 Nov 21, 2025
ee753fe
added some comments
unp1 Nov 21, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import java.util.ArrayList;

import de.uka.ilkd.key.logic.JTerm;
import de.uka.ilkd.key.proof.Goal;
import de.uka.ilkd.key.proof.Proof;
import de.uka.ilkd.key.strategy.JavaCardDLStrategy;
Expand Down Expand Up @@ -85,7 +84,7 @@ private SymbolicExecutionStrategy(Proof proof, StrategyProperties sp) {
.equals(sp.get(StrategyProperties.SYMBOLIC_EXECUTION_ALIAS_CHECK_OPTIONS_KEY))) {
// Make sure that an immediately alias check is performed by doing cuts of objects to
// find out if they can be the same or not
RuleSetDispatchFeature instRsd = getInstantiationDispatcher();
RuleSetDispatchFeature instRsd = getDispatcher(StrategyAspect.Instantiation);
enableInstantiate();
final TermBuffer<Goal> buffer = new TermBuffer<>();
Feature originalCut = instRsd.get(getHeuristic("cut"));
Expand All @@ -106,7 +105,7 @@ private SymbolicExecutionStrategy(Proof proof, StrategyProperties sp) {
* {@inheritDoc}
*/
@Override
protected Feature setupApprovalF() {
protected @NonNull Feature setupApprovalF() {
Feature result = super.setupApprovalF();
// Make sure that cuts are only applied if the cut term is not already part of the sequent.
// This check is performed exactly before the rule is applied because the sequent might has
Expand All @@ -122,17 +121,17 @@ protected Feature setupApprovalF() {
* {@inheritDoc}
*/
@Override
protected Feature setupGlobalF(Feature dispatcher) {
protected @NonNull Feature setupGlobalF(@NonNull Feature dispatcher) {
Feature globalF = super.setupGlobalF(dispatcher);
// Make sure that modalities without symbolic execution label are executed first because
// they might forbid rule application on modalities with symbolic execution label (see loop
// body branches)
globalF = add(globalF, ifZero(not(new BinaryFeature() {
@Override
protected <Goal extends ProofGoal<@NonNull Goal>> boolean filter(RuleApp app,
PosInOccurrence pos, Goal goal, MutableState mState) {
protected <GOAL extends ProofGoal<@NonNull GOAL>> boolean filter(RuleApp app,
PosInOccurrence pos, GOAL goal, MutableState mState) {
return pos != null
&& SymbolicExecutionUtil.hasSymbolicExecutionLabel((JTerm) pos.subTerm());
&& SymbolicExecutionUtil.hasSymbolicExecutionLabel(pos.subTerm());
}
}), longConst(-3000)));
// Make sure that the modality which executes a loop body is preferred against the
Expand All @@ -141,9 +140,9 @@ protected Feature setupGlobalF(Feature dispatcher) {
add(globalF,
ifZero(add(new Feature() {
@Override
public <Goal extends ProofGoal<@NonNull Goal>> RuleAppCost computeCost(
public <GOAL extends ProofGoal<@NonNull GOAL>> RuleAppCost computeCost(
RuleApp app, PosInOccurrence pos,
Goal goal, MutableState mState) {
GOAL goal, MutableState mState) {
return pos != null ? cost(0) : TopRuleAppCost.INSTANCE;
}
},
Expand Down Expand Up @@ -302,7 +301,7 @@ public static class Factory implements StrategyFactory {
* {@inheritDoc}
*/
@Override
public StrategySettingsDefinition getSettingsDefinition() {
public @NonNull StrategySettingsDefinition getSettingsDefinition() {
// Properties
OneOfStrategyPropertyDefinition methodTreatment = new OneOfStrategyPropertyDefinition(
StrategyProperties.METHOD_OPTIONS_KEY, "Method Treatment",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
import de.uka.ilkd.key.settings.StrategySettings;
import de.uka.ilkd.key.speclang.Contract;
import de.uka.ilkd.key.speclang.OperationContract;
import de.uka.ilkd.key.strategy.JavaCardDLStrategyFactory;
import de.uka.ilkd.key.strategy.ModularJavaDLStrategyFactory;
import de.uka.ilkd.key.strategy.Strategy;
import de.uka.ilkd.key.strategy.StrategyProperties;
import de.uka.ilkd.key.symbolic_execution.ExecutionVariableExtractor;
Expand Down Expand Up @@ -4325,7 +4325,7 @@ public static void initializeStrategy(SymbolicExecutionTreeBuilder builder) {
new SymbolicExecutionStrategy.Factory().create(proof, strategyProperties));
} else {
proof.setActiveStrategy(
new JavaCardDLStrategyFactory().create(proof, strategyProperties));
new ModularJavaDLStrategyFactory().create(proof, strategyProperties));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@
import de.uka.ilkd.key.proof.Goal;
import de.uka.ilkd.key.proof.Proof;
import de.uka.ilkd.key.proof.init.ProofOblInput;
import de.uka.ilkd.key.strategy.JavaCardDLStrategyFactory;
import de.uka.ilkd.key.strategy.RuleAppCostCollector;
import de.uka.ilkd.key.strategy.Strategy;
import de.uka.ilkd.key.strategy.StrategyProperties;
import de.uka.ilkd.key.strategy.*;

import org.key_project.logic.Name;
import org.key_project.prover.proof.ProofGoal;
Expand Down Expand Up @@ -136,10 +133,10 @@ public Name name() {
String name = ruleApp.rule().name().toString();
if ((admittedRuleNames.contains(name) || name.startsWith(INF_FLOW_UNFOLD_PREFIX))
&& ruleApplicationInContextAllowed(ruleApp, pio, goal)) {
JavaCardDLStrategyFactory strategyFactory = new JavaCardDLStrategyFactory();
Strategy<@NonNull Goal> javaDlStrategy =
ModularJavaDLStrategyFactory strategyFactory = new ModularJavaDLStrategyFactory();
Strategy<@NonNull Goal> dlStrategy =
strategyFactory.create(goal.proof(), new StrategyProperties());
RuleAppCost costs = javaDlStrategy.computeCost(ruleApp, pio, goal, mState);
RuleAppCost costs = dlStrategy.computeCost(ruleApp, pio, goal, mState);
if ("orLeft".equals(name)) {
costs = costs.add(NumberRuleAppCost.create(100));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ protected boolean ruleApplicationInContextAllowed(RuleApp ruleApp,
* rejects everything else.
*/
private static class PropExpansionStrategy implements Strategy<Goal> {

private final Name NAME = new Name(PropExpansionStrategy.class.getSimpleName());

private final Set<String> admittedRuleNames;
Expand Down Expand Up @@ -142,6 +141,5 @@ public void instantiateApp(RuleApp app, PosInOccurrence pio, Goal goal,
public boolean isStopAtFirstNonCloseableGoal() {
return false;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -137,17 +137,9 @@ private String getAppRuleName(Node parent) {
return parentRuleName;
}


@Override
protected RuleAppCost instantiateApp(RuleApp app, PosInOccurrence pio, Goal goal,
MutableState mState) {
return computeCost(app, pio, goal, mState);
}

@Override
public boolean isStopAtFirstNonCloseableGoal() {
return false;
}
}

}
4 changes: 2 additions & 2 deletions key.core/src/main/java/de/uka/ilkd/key/nparser/KeyAst.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -129,7 +129,7 @@ public static class File extends KeyAst<KeYParser.FileContext> {

/// Returns the includes (possible empty but not null) computed from the underlying parse
/// tree.
public Includes getIncludes(URL base) {
public Includes getIncludes(Path base) {
IncludeFinder finder = new IncludeFinder(base);
accept(finder);
return finder.getIncludes();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.io.BufferedInputStream;
import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
Expand Down Expand Up @@ -70,7 +71,14 @@ public static List<KeyAst.File> parseFiles(URL url) throws IOException {
reached.add(url);
KeyAst.File ctx = parseFile(url);
ctxs.add(ctx);
Collection<RuleSource> includes = ctx.getIncludes(url).getRuleSets();
Path path = null;
try {
path = Path.of(url.toURI());
} catch (URISyntaxException e) {
throw new IOException(e);
}
path = path.getParent();
Collection<RuleSource> includes = ctx.getIncludes(path).getRuleSets();
for (RuleSource u : includes) {
if (!reached.contains(u.url())) {
queue.push(u.url());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

import java.io.File;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.nio.file.Path;

import de.uka.ilkd.key.nparser.KeYParser;
import de.uka.ilkd.key.proof.init.Includes;
Expand All @@ -22,15 +24,12 @@
* @see #getIncludes()
*/
public class IncludeFinder extends AbstractBuilder<Void> {
private final URL base;
private final Path base;
private final Includes includes = new Includes();
private final String basePath;
private boolean ldt = false;

public IncludeFinder(URL base) {
public IncludeFinder(Path base) {
this.base = base;
String a = base.getPath();
basePath = a.substring(0, a.lastIndexOf('/'));
}

@Override
Expand All @@ -44,29 +43,29 @@ public Void visitOne_include_statement(KeYParser.One_include_statementContext ct
public Void visitOne_include(KeYParser.One_includeContext ctx) {
String value = StringUtil.trim(ctx.getText(), "\"'");
try {
addInclude(value, ctx.relfile != null);
addInclude(value);
} catch (MalformedURLException e) {
throw new BuildingException(ctx, e);
}
return null;
}

private void addInclude(String filename, boolean relativePath) throws MalformedURLException {
private void addInclude(String filename) throws MalformedURLException {
RuleSource source;
if (!filename.endsWith(".key")) {
filename += ".key";
}

if (relativePath) {
filename = filename.replace('/', File.separatorChar); // Not required for Windows, but
// whatsoever
filename = filename.replace('\\', File.separatorChar); // Special handling for Linux
URL path = new URL(base.getProtocol(), base.getHost(), base.getPort(),
basePath + "/" + filename);
source = RuleSourceFactory.initRuleFile(path);
} else {
source = RuleSourceFactory.fromDefaultLocation(filename);
filename = filename.replace('/', File.separatorChar); // Not required for Windows, but
// whatsoever
filename = filename.replace('\\', File.separatorChar); // Special handling for Linux
var path = base.resolve(filename).normalize();
var uri = URI.create(path.toString());
if (uri.getScheme() == null) {
uri = URI.create("file:///" + path);
}
URL url = uri.toURL();
source = RuleSourceFactory.initRuleFile(url);
if (ldt) {
includes.putLDT(filename, source);
} else {
Expand Down
5 changes: 5 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 @@ -637,6 +637,11 @@ public ImmutableList<Goal> apply(@NonNull final RuleApp ruleApp) {
removeLastAppliedRuleApp();
node().setAppliedRuleApp(null);
return null;
} catch (IndexOutOfBoundsException e) {
System.out.println(ruleApp.rule().displayName());
removeLastAppliedRuleApp();
node().setAppliedRuleApp(null);
return null;
} finally {
PERF_APP_EXECUTE.getAndAdd(System.nanoTime() - time);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import de.uka.ilkd.key.rule.label.TermLabelRefactoring;
import de.uka.ilkd.key.rule.merge.MergeRule;
import de.uka.ilkd.key.smt.newsmt2.DefinedSymbolsHandler;
import de.uka.ilkd.key.strategy.JavaCardDLStrategyFactory;
import de.uka.ilkd.key.strategy.ModularJavaDLStrategyFactory;
import de.uka.ilkd.key.strategy.StrategyFactory;

import org.key_project.prover.rules.RuleApp;
Expand Down Expand Up @@ -48,7 +48,7 @@ public class JavaProfile extends AbstractProfile {
public static JavaProfile defaultInstance;
public static JavaProfile defaultInstancePermissions;

public static final StrategyFactory DEFAULT = new JavaCardDLStrategyFactory();
public static final StrategyFactory DEFAULT = new ModularJavaDLStrategyFactory();

private boolean permissions = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public Includes readIncludes() throws ProofInputException {
if (includes == null) {
try {
KeyAst.File ctx = getParseContext();
includes = ctx.getIncludes(file.file().getParent().toUri().toURL());
includes = ctx.getIncludes(file.file().getParent());
} catch (ParseCancellationException e) {
throw new ParseCancellationException(e);
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,11 @@ public Path file() {
try {
return Paths.get(uri);
} catch (FileSystemNotFoundException e) {
URI rootFs = URI.create(StringUtil.takeUntil(uri.toString(), "!"));
String internal = StringUtil.takeAfter(uri.toString(), "!");
FileSystem zipfs = FileSystems.newFileSystem(rootFs, new HashMap<>());
return zipfs.getPath(internal);
URI rootFs = URI.create(StringUtil.takeUntil(uri.toString(), "\\!"));
String internal = StringUtil.takeAfter(uri.toString(), "\\!");
try (FileSystem zipfs = FileSystems.newFileSystem(rootFs, new HashMap<>())) {
return zipfs.getPath(internal);
}
}
} catch (URISyntaxException | IOException e) {
throw new RuntimeException(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,11 @@ public static final class Protocol extends ArrayList<RuleApp> {
* "evaluate_instanceof"; in any case there was a measurable slowdown. -- DB 03/06/14
*/
private static final ImmutableList<String> ruleSets = ImmutableSLList.<String>nil()
.append("concrete").append("update_elim").append("update_apply_on_update")
.append("concrete").append("concrete_java").append("update_elim")
.append("update_apply_on_update")
.append("update_apply").append("update_join").append("elimQuantifier");

private static final boolean[] bottomUp = { false, false, true, true, true, false };
private static final boolean[] bottomUp = { false, false, false, true, true, true, false };
private final Map<SequentFormula, Boolean> applicabilityCache =
new LRUCache<>(APPLICABILITY_CACHE_SIZE);

Expand Down Expand Up @@ -688,7 +689,6 @@ public Set<NoPosTacletApp> getCapturedTaclets() {
return result;
}


// -------------------------------------------------------------------------
// inner classes
// -------------------------------------------------------------------------
Expand Down
Loading
Loading