Commit 85a8dd1a authored by Sarah Grebing's avatar Sarah Grebing

Testcase for bug in termmatcher

parent c795e38a
Pipeline #13421 failed with stage
in 2 minutes and 44 seconds
...@@ -196,7 +196,7 @@ public class MatcherFacadeTest { ...@@ -196,7 +196,7 @@ public class MatcherFacadeTest {
"fint2(1,2), fint2(2,3), !p ==> pred(a), p", "fint2(1,2), fint2(2,3), !p ==> pred(a), p",
"fint2(1, ?X), fint2(?X, ?Y) ==> p", "fint2(1, ?X), fint2(?X, ?Y) ==> p",
"[{EMPTY_MATCH=null, ?X=Z(2(#)), ?Y=Z(3(#))}]"); "[{EMPTY_MATCH=null, ?X=Z(2(#)), ?Y=Z(3(#))}]");
shouldMatchSeq("2 >= 1, h2(1,2) = h2(2,3), h2(2,3) = 0 ==> p, !p", "?X=0 ==>", "[{?X= h2(2,3)}]");
} }
private void shouldMatchSeq(String seq, String seqPattern, String exp) throws ParserException { private void shouldMatchSeq(String seq, String seqPattern, String exp) throws ParserException {
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
S f(S); S f(S);
S g(S); S g(S);
S h(S, S); S h(S, S);
int h2(int, int);
int fint(int); int fint(int);
} }
......
...@@ -24,5 +24,10 @@ ...@@ -24,5 +24,10 @@
<artifactId>keydeps</artifactId> <artifactId>keydeps</artifactId>
<version>1.0</version> <version>1.0</version>
</dependency> </dependency>
<dependency>
<groupId>edu.kit.iti.formal.psdbg</groupId>
<artifactId>matcher</artifactId>
<version>0.1-SNAPSHOT</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
...@@ -46,6 +46,7 @@ public abstract class Example { ...@@ -46,6 +46,7 @@ public abstract class Example {
String content = IOUtils.toString(helpText, Charset.defaultCharset()); String content = IOUtils.toString(helpText, Charset.defaultCharset());
debuggerMain.openNewHelpDock(getName() + " Example", content); debuggerMain.openNewHelpDock(getName() + " Example", content);
} }
debuggerMain.getWelcomePaneDock().close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -27,14 +27,17 @@ public class JavaExample extends Example { ...@@ -27,14 +27,17 @@ public class JavaExample extends Example {
// Loading via key file, or using an automatic contract selector? // Loading via key file, or using an automatic contract selector?
try { try {
File script = newTempFile(scriptFile, getName() + ".kps"); File script = newTempFile(scriptFile, getName() + ".kps");
debuggerMain.openScript(script); debuggerMain.openScript(script);
debuggerMain.getWelcomePaneDock().close();
//File key = newTempFile(keyFile, "project.key"); //File key = newTempFile(keyFile, "project.key");
File java = newTempFile(javaFile, getName() + ".java"); File java = newTempFile(javaFile, getName() + ".java");
//System.out.println(java.getAbsolutePath()); //System.out.println(java.getAbsolutePath());
//debuggerMain.openKeyFile(key); //debuggerMain.openKeyFile(key);
debuggerMain.openJavaFile(java); debuggerMain.openJavaFile(java);
debuggerMain.showActiveInspector(null);
if (helpText != null) { if (helpText != null) {
String content = IOUtils.toString(helpText, Charset.defaultCharset()); String content = IOUtils.toString(helpText, Charset.defaultCharset());
debuggerMain.openNewHelpDock(getName() + " Example", content); debuggerMain.openNewHelpDock(getName() + " Example", content);
......
package edu.kit.iti.formal.psdbg.examples.java; package edu.kit.iti.formal.psdbg.examples.java.simple;
import edu.kit.iti.formal.psdbg.examples.JavaExample; import edu.kit.iti.formal.psdbg.examples.JavaExample;
public class JavaSimpleExample extends JavaExample { public class JavaSimpleExample extends JavaExample {
public JavaSimpleExample() { public JavaSimpleExample() {
setName("Test"); setName("Simple Java Example");
setJavaFile(this.getClass().getResource("Test.java")); setJavaFile(this.getClass().getResource("Test.java"));
......
package edu.kit.iti.formal.psdbg.examples.java.transitive;
import edu.kit.iti.formal.psdbg.examples.JavaExample;
public class PaperExample extends JavaExample {
public PaperExample() {
setName("Transitive Permutation");
setJavaFile(this.getClass().getResource("Simple.java"));
defaultInit(getClass());
System.out.println(this);
}
}
...@@ -39,7 +39,7 @@ public class WelcomePane extends AnchorPane { ...@@ -39,7 +39,7 @@ public class WelcomePane extends AnchorPane {
proofScriptDebugger.getWelcomePaneDock().close(); proofScriptDebugger.getWelcomePaneDock().close();
proofScriptDebugger.showActiveInspector(null); proofScriptDebugger.showActiveInspector(null);
Examples.loadExamples().forEach(example -> { Examples.loadExamples().forEach(example -> {
if (example.getName().equals("Test")) if (example.getName().equals("Transitive Permutation"))
example.open(proofScriptDebugger); example.open(proofScriptDebugger);
}); });
......
edu.kit.iti.formal.psdbg.examples.contraposition.ContrapositionExample edu.kit.iti.formal.psdbg.examples.contraposition.ContrapositionExample
edu.kit.iti.formal.psdbg.examples.fol.FirstOrderLogicExample edu.kit.iti.formal.psdbg.examples.fol.FirstOrderLogicExample
edu.kit.iti.formal.psdbg.examples.java.JavaSimpleExample edu.kit.iti.formal.psdbg.examples.java.simple.JavaSimpleExample
\ No newline at end of file edu.kit.iti.formal.psdbg.examples.java.transitive.PaperExample
\ No newline at end of file
script t(){
symbex;
cases{
case match `?X = 0 ==>`:
eqSymm on=`?X=0`[?X/?X];
}
}
script t1(){ script t1(){
symbex; symbex;
cases{ cases{
......
public final class Simple {
boolean b1;
boolean b2;
/*@ public normal_behavior
@ ensures \dl_seqPerm(\dl_array2seq(\result), \old(\dl_array2seq(aarr)));
@ assignable \everything;
*/
public int[] transitive(int[] aarr){
aarr = Simple.copyArray(aarr);
sort(aarr);
int[] barr = Simple.copyArray(aarr);
if(b1){barr = Simple.copyArray(aarr);}
if(b2){log(barr);}
return barr;
}
/*@ public normal_behavior
@ ensures \dl_seqPerm(\dl_array2seq(a), \old(\dl_array2seq(a)));
@ assignable a[*];
*/
public void sort(int[] a){};
/*@ public normal_behavior
@ ensures (\forall int i; 0 <= i < input.length; input[i] == \result[i])
@ && \result.length == input.length;
@ ensures \fresh(\result);
@ ensures \dl_seqPerm(\dl_array2seq(\result), \dl_array2seq(input));
@ assignable \nothing;
*/
public /*@helper@*/ static int[] copyArray(int[] input){}
/*@ public normal_behavior
@ assignable \strictly_nothing;
*/
public void log(int[] a){};
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Java Example: Transitive Permutation</title>
This is a simple Java example showing that the method transitive() preserves the permutation of teh input array.
</head>
<body>
</body>
</html>
\ No newline at end of file
script prove_transitive(){
symbex;
cases{
case match
`seqPerm(?Res0Copy, ?Arr),
seqPerm(?Res0Sort, ?Res0Copy),
seqPerm(?Res1Copy0, ?Res0Sort),
seqPerm(?Res2Copy1, ?Res0Sort) ==>
seqPerm(?Res2Copy1, ?Arr)` using [ ?Res0Copy: Seq, ?Arr: Seq,?Res0Sort: Seq, ?Res1Copy0: Seq, ?Res2Copy1: Seq, ?Res0Sort: Seq ]:
{SeqPermSym on=`seqPerm(?Res0Copy, ?Arr) ==>`;
SeqPermSym on=`seqPerm(?Res0Sort, ?Res0Copy) ==>`;
SeqPermSym on=`seqPerm(?Res1Copy0, ?Res0Sort)==>`;
SeqPermSym on=`seqPerm(?Res2Copy1, ?Res0Sort) ==>`;
SeqPermTrans on=`seqPerm(?Res0Copy, ?Arr) ==>`;
SeqPermTrans on=`seqPerm(?Arr, ?Res0Sort) ==>`
with=`seqPerm(?Arr,?Res2Copy1)`;
SeqPermSym on=`seqPerm(?Arr,?Res2Copy1)`;
auto;
}
case match
`seqPerm(?Res0Copy, ?Arr),
seqPerm(?Res0Sort, ?Res0Copy),
seqPerm(?Res1Copy0, ?Res0Sort) ==>
seqPerm(?Res1Copy0, ?Arr)` using [ ?Res0Copy: Seq, ?Arr: Seq,?Res0Sort: Seq, ?Res1Copy0: Seq, ?Res0Sort: Seq ]:
{SeqPermSym on=`seqPerm(?Res0Copy, ?Arr)`;
SeqPermSym on=`seqPerm(?Res0Sort, ?Res0Copy)`;
SeqPermSym on=`seqPerm(?Res1Copy0, ?Res0Sort)`;
SeqPermTrans on=`seqPerm(?Res0Copy, ?Arr)`;
SeqPermTrans on=`seqPerm(?Arr, ?Res0Sort)`
SeqPermSym on=`==> seqPerm(?Res1Copy0, ?Arr)`;
auto;
}
default:{
auto;
}
}
}
...@@ -34,30 +34,31 @@ ...@@ -34,30 +34,31 @@
<div id="content"> <div id="content">
<h1>Proof Script Debugger</h1> <h1>Proof Script Debugger for the KeY System</h1>
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et <p>The proof script debugger is a prototypical implementation
dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet of an interaction concept for program verification systems that are rule based and
clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, use a program logic.
consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed The prototype is implemented on top of the interactive program verification system
diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea <a href="http://www.key-project.org">KeY</a>. KeY is an interactive program verification
takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed system for Java program annotated with the Java Modeling Language (JML).
diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et
accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum
dolor sit amet.
</p> </p>
<p> <p>
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu The protypical implementation includes a proof scripting language that is tailored to the
feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril problem domain of program verification.
delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, The language particualrily allows to:
sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. <ol>
<li></li>
<li></li>
<li></li>
<li></li>
</ol>
Together with the proof scripting language a debugging concept for failed proof attempts
is implemented that leverages well-known concepts from program debugging to
the analysis of failed proof attempts.
</p> </p>
<p> Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea
commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel
illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent
luptatum zzril delenit augue duis dolore te feugait nulla facilisi. </p>
<h2>Features</h2> <h2>Features</h2>
<div class="column"> <div class="column">
...@@ -103,19 +104,20 @@ ...@@ -103,19 +104,20 @@
</div> </div>
<div style="clear: both;"/> <div style="clear: both;"/>
<h2>Getting Started</h2>
<!-- <h2>Getting Started</h2>
<h2>Downloads</h2>
<ul> <h2>Downloads</h2>
<li>Version 1.0
<p>
<a href="#">psdb-0.9-alpha.jar</a>
</p>
</li>
</ul>
<ul>
<li>Version 1.0
<p>
<a href="#">psdb-0.9-alpha.jar</a>
</p>
</li>
</ul>
-->
<footer style="border-top: #ccc 1px solid"> <footer style="border-top: #ccc 1px solid">
Contact: <a href="https://formal.iti.kit.edu/~grebing/">Sarah Grebing</a> Contact: <a href="https://formal.iti.kit.edu/~grebing/">Sarah Grebing</a>
</footer> </footer>
......
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