Commit db44f34a authored by Alexander Weigl's avatar Alexander Weigl 🐼
Browse files

Merge branch 'masterToMerge' into 'master'

Master to merge

See merge request !8
parents a4d6ca6e a7a05d05
Pipeline #17466 failed with stages
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>smt</title>
</head>
<body>
<h2 id="smt">smt</h2>
<blockquote>
<p>Synopsis: <code>smt solver=&lt;STRING&gt;</code></p>
</blockquote>
<p></strong>Description:</strong>
Invoke an external SMT solver. That solver must be adequately
configured outside the script mechanism. By default, Z3 is invoked,
but that can be chosen.
</p>
<p><strong>Arguments:</strong></p>
<ul>
<li>solver : <em>STRING</em> comma separated list of SMT solvers (currently supported: "z3", "yices")</li>
</ul>
</body>
</html>
\ No newline at end of file
......@@ -2,12 +2,12 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>autopilot-prep</title>
<title>autopilot_prep</title>
</head>
<body>
<h2 id="autopilot-prep">autopilot-prep</h2>
<h2 id="autopilot-prep">autopilot_prep</h2>
<blockquote>
<p>Synopsis: <code>autopilot-prep;</code></p>
<p>Synopsis: <code>autopilot_prep;</code></p>
</blockquote>
<p><strong></strong>Description:</strong></strong></p>
This macro performs the following steps:
......
......@@ -2,12 +2,12 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>infflow-autopilot</title>
<title>infflow_autopilot</title>
</head>
<body>
<h2 id="infflow-autopilot">infflow-autopilot</h2>
<h2 id="infflow-autopilot">infflow_autopilot</h2>
<blockquote>
<p>Synopsis: <code>infflow-autopilot;</code></p>
<p>Synopsis: <code>infflow_autopilot;</code></p>
</blockquote>
<p><strong></strong>Description:</strong></strong></p>
This macro is tailored to information flow problems.
......
......@@ -2,12 +2,12 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>nosplit-prop</title>
<title>nosplit_prop</title>
</head>
<body>
<h2 id="symbex">nosplit-prop</h2>
<h2 id="symbex">nosplit_prop</h2>
<blockquote>
<p>Synopsis: <code>nosplit-prop;</code></p>
<p>Synopsis: <code>nosplit_prop;</code></p>
</blockquote>
<p><strong></strong>Description:</strong></strong></p>
This macros applies rules to decompose propositional toplevel formulas without applying splitting rules.
......
......@@ -2,12 +2,12 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>simp-heap</title>
<title>simp_heap</title>
</head>
<body>
<h2 id="symbex">simp-heap</h2>
<h2 id="symbex">simp_heap</h2>
<blockquote>
<p>Synopsis: <code>simp-heap;</code></p>
<p>Synopsis: <code>simp_heap;</code></p>
</blockquote>
<p><strong></strong>Description:</strong></strong></p>
This macro performs simplification of Heap and LocSet terms.
......
......@@ -2,12 +2,12 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>simp-int</title>
<title>simp_int</title>
</head>
<body>
<h2 id="symbex">simp-int</h2>
<h2 id="symbex">simp_int</h2>
<blockquote>
<p>Synopsis: <code>simp-int;</code></p>
<p>Synopsis: <code>simp_int;</code></p>
</blockquote>
<p><strong></strong>Description:</strong></strong></p>
This macro performs simplification of integers and terms with integers.
......
......@@ -2,12 +2,12 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>simp-upd</title>
<title>simp_upd</title>
</head>
<body>
<h2 id="simp-upd">simp-upd</h2>
<h2 id="simp-upd">simp_upd</h2>
<blockquote>
<p>Synopsis: <code>simp-upd;</code></p>
<p>Synopsis: <code>simp_upd;</code></p>
</blockquote>
<p><strong></strong>Description:</strong></strong></p>
This macro applies only update simplification rules, i.e., that simplify the update term.
......
......@@ -5,9 +5,9 @@
<title>split-prop</title>
</head>
<body>
<h2 id="symbex">split-prop</h2>
<h2 id="symbex">split_prop</h2>
<blockquote>
<p>Synopsis: <code>split-prop;</code></p>
<p>Synopsis: <code>split_prop;</code></p>
</blockquote>
<p><strong></strong>Description:</strong></strong></p>
This macros applies rules to decompose propositional toplevel formulas and also applies splitting rules.
......
......@@ -72,6 +72,31 @@
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>edu.kit.iti.formal.psdbg.gui.ProofScriptDebugger</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<!--HIER EVTL. PLUGIN HIN-->
<plugin>
<groupId>org.lesscss</groupId>
<artifactId>lesscss-maven-plugin</artifactId>
......@@ -92,12 +117,12 @@
</plugin>
<!--
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<!-- put your configurations here -->
</configuration>
<executions>
<execution>
......@@ -120,6 +145,7 @@
</execution>
</executions>
</plugin>
-->
<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
......@@ -149,10 +175,10 @@
<name>bintray</name>
<url>http://dl.bintray.com/jerady/maven</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
</repositories>
......
......@@ -15,9 +15,12 @@ import java.nio.charset.Charset;
public class JavaExample extends Example {
private URL projectFile;
public void setJavaFile(URL javaFile) {
this.javaFile = javaFile;
}
//public void setProjectFile(URL projectFile){this.projectFile = projectFile;}
protected URL javaFile;
......
......@@ -9,7 +9,7 @@ public class QuickSort extends JavaExample {
setName("Quicksort example");
setHelpText(null);
setHelpText(getClass().getResource("help.html"));
setJavaFile(getClass().
......
......@@ -6,7 +6,7 @@ public class JavaSimpleExample extends JavaExample {
public JavaSimpleExample() {
setName("Simple Java Example");
setJavaFile(this.getClass().getResource("Test.java"));
setJavaFile(this.getClass().getResource("Simple.java"));
defaultInit(getClass());
}
}
package edu.kit.iti.formal.psdbg.examples.lulu.bigIntProof;
import edu.kit.iti.formal.psdbg.examples.JavaExample;
public class BigIntExample extends JavaExample {
public BigIntExample() {
}
}
......@@ -29,7 +29,7 @@ import java.util.Locale;
public class ProofScriptDebugger extends Application {
public static final String NAME = "Proof Script Debugger";
public static final String VERSION = "0.1";
public static final String VERSION = "1.0-FM";
public static final String KEY_VERSION = KeYConstants.VERSION;
......
......@@ -442,9 +442,8 @@ public class DebuggerMain implements Initializable {
// wait a second!
future.get(1, TimeUnit.SECONDS);
// ungently stop
// urgently stop
model.getDebuggerFramework().hardStop();
} catch (InterruptedException | ExecutionException | TimeoutException e) {
e.printStackTrace();
} finally {
......@@ -453,6 +452,7 @@ public class DebuggerMain implements Initializable {
} else {
LOGGER.info("no interpreter running");
}
assert model.getDebuggerFramework() == null;
}
@FXML
......
......@@ -13,10 +13,12 @@ import de.uka.ilkd.key.proof.Goal;
import de.uka.ilkd.key.proof.Node;
import de.uka.ilkd.key.proof.Proof;
import edu.kit.iti.formal.psdbg.LabelFactory;
import edu.kit.iti.formal.psdbg.RuleCommandHelper;
import edu.kit.iti.formal.psdbg.gui.controls.ScriptArea;
import edu.kit.iti.formal.psdbg.gui.controls.ScriptController;
import edu.kit.iti.formal.psdbg.gui.controls.Utils;
import edu.kit.iti.formal.psdbg.gui.model.InspectionModel;
import edu.kit.iti.formal.psdbg.interpreter.Evaluator;
import edu.kit.iti.formal.psdbg.interpreter.data.GoalNode;
import edu.kit.iti.formal.psdbg.interpreter.data.KeyData;
import edu.kit.iti.formal.psdbg.interpreter.data.VariableAssignment;
......@@ -25,8 +27,7 @@ import edu.kit.iti.formal.psdbg.interpreter.dbg.PTreeNode;
import edu.kit.iti.formal.psdbg.interpreter.exceptions.ScriptCommandNotApplicableException;
import edu.kit.iti.formal.psdbg.parser.PrettyPrinter;
import edu.kit.iti.formal.psdbg.parser.ast.*;
import edu.kit.iti.formal.psdbg.termmatcher.MatcherFacade;
import edu.kit.iti.formal.psdbg.termmatcher.Matchings;
import edu.kit.iti.formal.psdbg.parser.data.Value;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.collections.ObservableList;
......@@ -39,6 +40,7 @@ import org.apache.logging.log4j.Logger;
import org.key_project.util.collection.ImmutableList;
import recoder.util.Debug;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
......@@ -68,6 +70,8 @@ public class InteractiveModeController {
private Proof currentProof;
private Services keYServices;
private boolean moreThanOneMatch = false;
public void start(Proof currentProof, InspectionModel model) {
Events.register(this);
cases.clear();
......@@ -134,31 +138,57 @@ public class InteractiveModeController {
@Subscribe
public void handle(Events.TacletApplicationEvent tap) {
LOGGER.debug("Handling {}", tap);
moreThanOneMatch = false;
String tapName = tap.getApp().taclet().displayName();
Goal g = tap.getCurrentGoal();
SequentFormula seqForm = tap.getPio().sequentFormula();
//transform term to parsable string representation
Sequent seq = g.sequent();
String term = edu.kit.iti.formal.psdbg.termmatcher.Utils.toPrettyTerm(seqForm.formula());
String sfTerm = edu.kit.iti.formal.psdbg.termmatcher.Utils.toPrettyTerm(seqForm.formula());
String onTerm = edu.kit.iti.formal.psdbg.termmatcher.Utils.toPrettyTerm(tap.getPio().subTerm());
//check whether more than one possibility for match
Matchings matches = MatcherFacade.matches(term, seq, true, keYServices);
//Matchings matches = MatcherFacade.matches(term, seq, true, keYServices);
Parameters params = new Parameters();
/*Parameters params = new Parameters();
params.put(new Variable("formula"), new TermLiteral(term));
/* if(matches.size() > 1) {
System.out.println("matches = " + matches);
Integer integ = new Integer(tap.getPio().sequentFormula().formula().serialNumber());
System.out.println("integ = " + integ);
params.put(new Variable("occ"), new IntegerLiteral(BigInteger.valueOf(integ)));
if (matches.size() > 1) {
moreThanOneMatch = true;
params.put(new Variable("occ"), new StringLiteral("0"));
}*/
RuleCommand.Parameters params = new RuleCommand.Parameters();
params.formula = seqForm.formula();
params.rulename = tap.getApp().taclet().name().toString();
params.on = tap.getPio().subTerm();
RuleCommandHelper rch = new RuleCommandHelper(g, params);
int occ = rch.getOccurence(tap.getApp());
Parameters callp = new Parameters();
// callp.put(new Variable("formula"), new TermLiteral(sfTerm));
callp.put(new Variable("formula"), new TermLiteral(sfTerm));
callp.put(new Variable("occ"), new IntegerLiteral(BigInteger.valueOf(occ)));
callp.put(new Variable("on"), new TermLiteral(onTerm));
VariableAssignment va = new VariableAssignment(null);
CallStatement call = new CallStatement(tapName, params);
CallStatement call = new CallStatement(tapName, callp);
/*
Iterator<ImmutableMapEntry<SchemaVariable, InstantiationEntry<?>>> iter = tap.getApp().instantiations().pairIterator();
while (iter.hasNext()) {
ImmutableMapEntry<SchemaVariable, InstantiationEntry<?>> entry = iter.next();
String p = "inst_" + entry.key().proofToString();
String v = edu.kit.iti.formal.psdbg.termmatcher.Utils.toPrettyTerm((Term) entry.value().getInstantiation());
call.getParameters().put(new Variable(p), new TermLiteral(v));
}*/
try {
applyRule(call, g);
// Insert into the right cases
Node currentNode = g.node();
......@@ -174,14 +204,20 @@ public class InteractiveModeController {
} catch (ScriptCommandNotApplicableException e) {
Utils.showExceptionDialog("Proof Command was not Applicable",
"Proof Command was not Applicable",
"The script command " + call.getCommand().toString() + " was not applicable. " + e.getMessage(), e);
StringBuilder sb = new StringBuilder("The script command ");
sb.append(call.getCommand()).append(" was not applicable.");
sb.append("\nSequent Formula: formula=").append(sfTerm);
sb.append("\nOn Sub Term: on=").append(onTerm);
Utils.showExceptionDialog("Proof Command was not applicable",
"Proof Command was not applicable.",
sb.toString(), e);
}
}
private Node findRoot(Node cur) {
while (cur != null) {
if (cases.keySet().contains(cur))
......@@ -237,15 +273,27 @@ public class InteractiveModeController {
}
RuleCommand c = new RuleCommand();
// KeyData kd = g.getData();
Evaluator eval = new Evaluator(expandedNode.getAssignments(), expandedNode);
Map<String, String> map = new HashMap<>();
// call.getParameters().forEach((k, v) -> map.put(k.getIdentifier(), v.getData().toString()));
call.getParameters().forEach((variable, expression) -> {
Value exp = eval.eval(expression);
map.put(variable.getIdentifier(), exp.getData().toString());
});
// call.getParameters().forEach((k, v) -> map.put(k.getIdentifier(),));
LOGGER.info("Execute {} with {}", call, map);
try {
KeyData kd = expandedNode.getData();
map.put("#2", call.getCommand());
EngineState estate = new EngineState(g.proof());
estate.setGoal(g);
System.out.println("on = " + map.get("on"));
System.out.println("formula = " + map.get("formula"));
System.out.println("occ = " + map.get("occ"));
RuleCommand.Parameters cc = c.evaluateArguments(estate, map); //reflection exception
AbstractUserInterfaceControl uiControl = new DefaultUserInterfaceControl();
c.execute(uiControl, cc, estate);
......@@ -286,4 +334,6 @@ public class InteractiveModeController {
public void setKeYServices(Services keYServices) {
this.keYServices = keYServices;
}
}
......@@ -121,9 +121,20 @@ public class CommandHelp extends BorderPane {
class CommandEntry {
String name, additionalInformation;
@Override
public String toString() {
return name + " (" + additionalInformation + ")";
return beautifyName(name) + " (" + additionalInformation + ")";
}
private String beautifyName(String cname) {
String ret;
if (cname.contains("-")) {
ret = cname.replace("-", "_");
return ret;
} else {
return cname;
}
}
}
}
......@@ -317,7 +317,7 @@ public class ScriptController {
lastScriptArea = area;
lastRegion = r;
} else {
logger.error("Could not find editor for: " + node.getOrigin());
logger.error("Could not find editor for the node to highlight: " + node.getOrigin());
}
}
......
......@@ -26,9 +26,7 @@ import javafx.scene.input.MouseEvent;
import javafx.scene.layout.BorderPane;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
public class SequentMatcher extends BorderPane {
......@@ -86,7 +84,7 @@ public class SequentMatcher extends BorderPane {
Range r = cursorPosition.get(pio);
sequentView.setStyleClass(r.start(), r.end(), "sequent-highlight");
System.out.println("Highlight " + r.start() + " " + r.end());
//System.out.println("Highlight " + r.start() + " " + r.end());
});
}
......
......@@ -206,6 +206,14 @@ public class TacletContextMenu extends ContextMenu {
toAdd.addAll(noFindTaclets);
}
/*toAdd=toAdd.stream().filter(tapp->{
try{
return tapp.isExecutable(goal.proof().getServices());
}catch (NullPointerException e) {
return false;
}
}).collect(Collectors.toList());*/
if (rulesAvailable) {
createMenuItems(toAdd);
} else {
......@@ -338,7 +346,6 @@ public class TacletContextMenu extends ContextMenu {
pos.getPosInOccurrence());*/
//System.out.println("event = [" + event + "]");
Events.fire(new Events.TacletApplicationEvent(event, pos.getPosInOccurrence(), goal));
}
......
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