Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
81b3256
some functions for tff
wadoon Oct 4, 2023
7b8ca78
different clients
wadoon Oct 8, 2023
13b6f11
wip
wadoon Oct 13, 2023
ffe5b00
Creating an JSON-RPC API
wadoon Oct 15, 2023
ab3ca5e
working on a working minimal version
wadoon Oct 29, 2023
1178d46
more doc and py generation
wadoon Oct 29, 2023
51aeccb
running for primitive data types, somethings wrong in de-/serialization
wadoon Nov 1, 2023
e89f9eb
add throwable adapter
wadoon Nov 3, 2023
47f6efe
spotless and merge errors
wadoon Nov 18, 2023
f37f26b
fix after refactoring + spotless
wadoon Jun 26, 2024
c3cc7a6
wip
wadoon Oct 20, 2024
512eb2b
start of a simple Java client
wadoon Nov 22, 2024
5ccc708
- Shutdown Callbacks
samysweb Feb 19, 2025
f1c196e
Error message for python generation
samysweb Feb 19, 2025
b9ff3e7
Updated library and example
samysweb Feb 19, 2025
94d55ce
Added proof api endpoint
samysweb Feb 20, 2025
8b7bfbd
Attempt at reseting proof control
samysweb Feb 20, 2025
571ea42
First (incomplete) working proof management endpoint
samysweb Feb 20, 2025
4f73928
Updated python client for proof endpoint
samysweb Feb 20, 2025
48212f4
Improved interface, environment disposal
samysweb Feb 20, 2025
9880710
Fixed JSON type annotation&retrieval
samysweb Mar 24, 2025
661cf5f
Updated json type annotation on codegen/python side
samysweb Mar 24, 2025
7fb5af4
Merge branch 'steuber/jsonrpc' into weigl/jsonrpc
samysweb Mar 24, 2025
8a92b1d
Configurable Strategy (not Streategy) options for proof auto mode
samysweb Mar 24, 2025
3eff422
Extracted node description function
samysweb Mar 24, 2025
25688ec
Null serialization (necessary due to python class initialization), no…
samysweb Mar 24, 2025
18e3985
reformat / remove weakrefs from the data model
wadoon Apr 6, 2025
f5f69e9
fix compile error
wadoon Jul 8, 2025
b16e7da
spotless
wadoon Aug 24, 2025
751bd54
fixing the missing javadoc in the api generator
wadoon Nov 28, 2025
b7fdfec
better documentation
wadoon Nov 29, 2025
d656017
working on documentation, now with json examples
wadoon Nov 30, 2025
a1d86dd
try to make the documentation better
wadoon Dec 21, 2025
ffa453c
better documentation
wadoon Dec 27, 2025
7adc9a1
repair branch after rewriting
wadoon Feb 1, 2026
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
4 changes: 3 additions & 1 deletion key.core.example/src/main/java/org/key_project/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ private static void proveEnvironmemt(KeYEnvironment<?> env) {
LOGGER.info("Found contract '" + contract.getDisplayName());
proveContract(env, contract);
}
} catch (InterruptedException ignored) {
} finally {
env.dispose(); // Ensure always that all instances of KeYEnvironment are disposed
}
Expand Down Expand Up @@ -135,7 +136,8 @@ private static List<Contract> getContracts(KeYEnvironment<?> env) {
* @param env the {@link KeYEnvironment} in which to prove the contract
* @param contract the {@link Contract} to be proven
*/
private static void proveContract(KeYEnvironment<?> env, Contract contract) {
private static void proveContract(KeYEnvironment<?> env, Contract contract)
throws InterruptedException {
Proof proof = null;
try {
// Create proof
Expand Down
14 changes: 14 additions & 0 deletions key.core/src/main/java/de/uka/ilkd/key/Identifiable.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* 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;

/**
* @author Alexander Weigl
* @version 1 (14.10.23)
*/
public interface Identifiable {
default String identification() {
return getClass().getName() + "_" + hashCode();
}
}
40 changes: 40 additions & 0 deletions key.core/src/main/java/de/uka/ilkd/key/control/KeYEnvironment.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import de.uka.ilkd.key.proof.io.AbstractProblemLoader.ReplayResult;
import de.uka.ilkd.key.proof.io.ProblemLoaderException;
import de.uka.ilkd.key.proof.mgt.SpecificationRepository;
import de.uka.ilkd.key.rule.Rule;
import de.uka.ilkd.key.speclang.Contract;
import de.uka.ilkd.key.util.KeYTypeUtil;

Expand Down Expand Up @@ -333,6 +334,45 @@ public boolean isDisposed() {
return proofScript;
}

/**
* Retrieve a list of all available contracts for all known Java types.
*
* @return a non-null list, possible empty
*/
public List<Contract> getAvailableContracts() {
List<Contract> proofContracts = new ArrayList<>(512);
Set<KeYJavaType> kjts = getJavaInfo().getAllKeYJavaTypes();
for (KeYJavaType type : kjts) {
if (!KeYTypeUtil.isLibraryClass(type)) {
ImmutableSet<IObserverFunction> targets =
getSpecificationRepository().getContractTargets(type);
for (IObserverFunction target : targets) {
ImmutableSet<Contract> contracts =
getSpecificationRepository().getContracts(type, target);
for (Contract contract : contracts) {
proofContracts.add(contract);
}
}
}
}
return proofContracts;
}


/**
* Constructs a list containing all known rules that are registered in the current
* environment.
*
* @return always returns a non-null list
*/
public List<Rule> getRules() {
var rules = new ArrayList<Rule>(4096);
rules.addAll(getInitConfig().activatedTaclets());
getInitConfig().builtInRules().forEach(rules::add);
return rules;
}


/**
* constructs the possible proof contracts from the java info in the environment.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void taskStarted(TaskStartedInfo info) {
numOfInvokedMacros++;
if (superordinateListener != null) {
superordinateListener.taskStarted(new DefaultTaskStartedInfo(TaskKind.Macro,
macroName + (macroName.length() == 0 ? "" : " -- ") + info.message(),
macroName + (macroName.isEmpty() ? "" : " -- ") + info.message(),
info.size()));
}
}
Expand Down
47 changes: 43 additions & 4 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 @@ -13,16 +13,15 @@
import de.uka.ilkd.key.logic.op.ProgramVariable;
import de.uka.ilkd.key.pp.LogicPrinter;
import de.uka.ilkd.key.pp.NotationInfo;
import de.uka.ilkd.key.proof.mgt.RuleJustification;
import de.uka.ilkd.key.proof.proofevent.NodeChangeJournal;
import de.uka.ilkd.key.proof.proofevent.RuleAppInfo;
import de.uka.ilkd.key.rule.AbstractExternalSolverRuleApp;
import de.uka.ilkd.key.rule.IBuiltInRuleApp;
import de.uka.ilkd.key.rule.NoPosTacletApp;
import de.uka.ilkd.key.rule.TacletApp;
import de.uka.ilkd.key.rule.*;
import de.uka.ilkd.key.rule.inst.SVInstantiations;
import de.uka.ilkd.key.rule.merge.MergeRule;
import de.uka.ilkd.key.strategy.QueueRuleApplicationManager;
import de.uka.ilkd.key.strategy.Strategy;
import de.uka.ilkd.key.util.MiscTools;
import de.uka.ilkd.key.util.properties.MapProperties;
import de.uka.ilkd.key.util.properties.Properties;
import de.uka.ilkd.key.util.properties.Properties.Property;
Expand Down Expand Up @@ -753,6 +752,13 @@ public List<RuleApp> getAllBuiltInRuleApps() {
return ruleApps;
}

/**
* Return a list with available taclet application on this goal.
*/
public List<TacletApp> getAllTacletApps() {
return getAllTacletApps(proof().getServices());
}

public List<TacletApp> getAllTacletApps(Services services) {
RuleAppIndex index = ruleAppIndex();
index.autoModeStopped();
Expand All @@ -777,4 +783,37 @@ protected boolean filter(Taclet taclet) {
return allApps;
}

/**
* Returns a list with all known rule applications within this proof goal.
*/
public List<RuleApp> getAllAvailableRules() {
var taclets = getAllTacletApps();
var builtin = getAllBuiltInRuleApps();
builtin.addAll(taclets);
return builtin;
}

public List<Rule> getAvailableRules() {
var s = new ArrayList<Rule>(2048);
for (final BuiltInRule br : ruleAppIndex().builtInRuleAppIndex()
.builtInRuleIndex().rules()) {
s.add(br);
}

Set<NoPosTacletApp> set = ruleAppIndex().tacletIndex().allNoPosTacletApps();
OneStepSimplifier simplifier = MiscTools.findOneStepSimplifier(proof());
if (simplifier != null && !simplifier.isShutdown()) {
set.addAll(simplifier.getCapturedTaclets());
}

for (final NoPosTacletApp app : set) {
RuleJustification just = proof().mgt().getJustification(app);
if (just == null) {
continue; // do not break system because of this
}
s.add(app.taclet()); // TODO not good
}
return s;
}

}
6 changes: 6 additions & 0 deletions key.core/src/main/java/de/uka/ilkd/key/proof/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* SPDX-License-Identifier: GPL-2.0-only */
package de.uka.ilkd.key.proof;

import java.util.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
Expand All @@ -12,6 +13,7 @@
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.stream.Stream;

import de.uka.ilkd.key.logic.RenamingTable;
import de.uka.ilkd.key.logic.op.IProgramVariable;
Expand Down Expand Up @@ -838,4 +840,8 @@ public int getStepIndex() {
void setStepIndex(int stepIndex) {
this.stepIndex = stepIndex;
}

public Stream<Node> childrenStream() {
return children.stream();
}
}
14 changes: 11 additions & 3 deletions key.core/src/main/java/de/uka/ilkd/key/proof/Proof.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
import java.util.function.Consumer;
import java.util.function.Predicate;

import de.uka.ilkd.key.Identifiable;
import de.uka.ilkd.key.java.JavaInfo;
import de.uka.ilkd.key.java.Services;
import de.uka.ilkd.key.logic.JTerm;
import de.uka.ilkd.key.logic.NamespaceSet;
import de.uka.ilkd.key.logic.*;
import de.uka.ilkd.key.pp.AbbrevMap;
import de.uka.ilkd.key.proof.calculus.JavaDLSequentKit;
import de.uka.ilkd.key.proof.event.ProofDisposedEvent;
Expand Down Expand Up @@ -58,7 +58,7 @@
* goals, namespaces and several other information about the current state of the proof.
*/
@NullMarked
public class Proof implements ProofObject<Goal>, Named {
public class Proof implements ProofObject<Goal>, Named, Identifiable {

/**
* The time when the {@link Proof} instance was created.
Expand Down Expand Up @@ -1380,4 +1380,12 @@ public void printSymbols(PrintWriter ps) {
public long getCreationTime() {
return creationTime;
}

/**
* {@inheritDoc}
*/
@Override
public String identification() {
return getClass().getName() + "_" + name + "_" + hashCode();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/* 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.io.Serializable;

public class ProofNodeDescription implements Serializable {
/**
* Collects the information from the tree to which branch the current node belongs:
* <ul>
* <li>Invariant Initially Valid</li>
* <li>Body Preserves Invariant</li>
* <li>Use Case</li>
* <li>...</li>
* </ul>
*
* @param node the current node
* @return a String containing the path information to display
*/
public static String collectPathInformation(Node node) {
while (node != null) {
if (node.getNodeInfo() != null && node.getNodeInfo().getBranchLabel() != null) {
String label = node.getNodeInfo().getBranchLabel();
/*
* Are there other interesting labels? Please feel free to add them here.
*/
if (label.equals("Invariant Initially Valid")
|| label.equals("Invariant Preserved and Used") // for loop scope invariant
|| label.equals("Body Preserves Invariant") || label.equals("Use Case")
|| label.equals("Show Axiom Satisfiability") || label.startsWith("Pre (")
|| label.startsWith("Exceptional Post (") // exceptional postcondition
|| label.startsWith("Post (") // postcondition of a method
|| label.contains("Normal Execution") || label.contains("Null Reference")
|| label.contains("Index Out of Bounds") || label.contains("Validity")
|| label.contains("Precondition") || label.contains("Usage")) {
return label;
}
}
node = node.parent();
}
// if no label was found we have to prove the postcondition
return "Show Postcondition/Modifiable";
}
}
22 changes: 12 additions & 10 deletions key.ui/src/main/java/de/uka/ilkd/key/core/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -464,25 +464,27 @@ private AbstractMediatorUserInterfaceControl createUserInterface(List<Path> file
}

public static void ensureExamplesAvailable() {
File examplesDir = getExamplesDir() == null ? ExampleChooser.lookForExamples()
: new File(getExamplesDir());
if (!examplesDir.exists()) {
Path examplesDir =
getExamplesDir() == null ? ExampleChooser.lookForExamples() : getExamplesDir();
if (!Files.exists(examplesDir)) {
examplesDir = setupExamples();
}
setExamplesDir(examplesDir.getAbsolutePath());
if (examplesDir == null) {
setExamplesDir(examplesDir.toAbsolutePath());
}
}

private static File setupExamples() {
private static @Nullable Path setupExamples() {
try {
URL examplesURL = Main.class.getResource("/examples.zip");
if (examplesURL == null) {
throw new IOException("Missing examples.zip in resources");
}

File tempDir = createTempDirectory();
Path tempDir = Files.createTempDirectory("key-examples");

if (tempDir != null) {
IOUtil.extractZip(examplesURL.openStream(), tempDir.toPath());
IOUtil.extractZip(examplesURL.openStream(), tempDir);
}
return tempDir;
} catch (IOException e) {
Expand Down Expand Up @@ -555,9 +557,9 @@ private void preProcessInput()
}
}

private static String EXAMPLE_DIR = null;
private static Path EXAMPLE_DIR = null;

public static @Nullable String getExamplesDir() {
public static @Nullable Path getExamplesDir() {
return EXAMPLE_DIR;
}

Expand All @@ -568,7 +570,7 @@ private void preProcessInput()
*
* @param newExamplesDir The new examples directory to use.
*/
public static void setExamplesDir(String newExamplesDir) {
public static void setExamplesDir(Path newExamplesDir) {
EXAMPLE_DIR = newExamplesDir;
}
}
Loading
Loading