Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
sarah.grebing
ProofScriptParser
Commits
0597ba77
Commit
0597ba77
authored
Sep 12, 2017
by
Sarah Grebing
Browse files
Bug Fix: Representation of matched terms was not compatible with KeY representation
parent
b08c1ba4
Pipeline
#13567
failed with stage
in 2 minutes and 38 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
matcher/src/main/java/edu/kit/iti/formal/psdbg/termmatcher/Utils.java
0 → 100644
View file @
0597ba77
package
edu.kit.iti.formal.psdbg.termmatcher
;
import
de.uka.ilkd.key.logic.Term
;
import
de.uka.ilkd.key.logic.op.Equality
;
import
de.uka.ilkd.key.logic.op.Junctor
;
import
de.uka.ilkd.key.logic.op.Operator
;
public
class
Utils
{
/**
* Rewrite toString() representation of Term to a parsable version
*
* @param formula
* @return parsable Stringversion of Term
*/
public
static
String
toPrettyTerm
(
Term
formula
)
{
StringBuilder
sb
=
new
StringBuilder
();
Operator
op
=
formula
.
op
();
//ugly if/else
if
(
op
.
equals
(
Junctor
.
IMP
))
{
sb
.
append
(
"("
+
toPrettyTerm
(
formula
.
sub
(
0
))
+
") -> ("
+
toPrettyTerm
(
formula
.
sub
(
1
))
+
")"
);
}
else
{
if
(
op
.
equals
(
Junctor
.
AND
))
{
sb
.
append
(
"("
+
toPrettyTerm
(
formula
.
sub
(
0
))
+
") && ("
+
toPrettyTerm
(
formula
.
sub
(
1
))
+
")"
);
}
else
{
if
(
op
.
equals
(
Junctor
.
OR
))
{
sb
.
append
(
"("
+
toPrettyTerm
(
formula
.
sub
(
0
))
+
") || ("
+
toPrettyTerm
(
formula
.
sub
(
1
))
+
")"
);
}
else
{
if
(
op
.
equals
(
Equality
.
EQV
))
{
sb
.
append
(
"("
+
toPrettyTerm
(
formula
.
sub
(
0
))
+
") <-> ("
+
toPrettyTerm
(
formula
.
sub
(
1
))
+
")"
);
}
else
{
if
(
op
.
equals
(
Equality
.
EQUALS
))
{
sb
.
append
(
"("
+
toPrettyTerm
(
formula
.
sub
(
0
))
+
") == ("
+
toPrettyTerm
(
formula
.
sub
(
1
))
+
")"
);
}
else
{
if
(
op
.
equals
(
Junctor
.
NOT
))
{
sb
.
append
(
"(!"
+
toPrettyTerm
(
formula
.
sub
(
0
))
+
")"
);
}
else
{
sb
.
append
(
formula
.
toString
());
}
}
}
}
}
}
return
sb
.
toString
();
}
}
rt-key/src/main/java/edu/kit/iti/formal/psdbg/interpreter/KeYMatcher.java
View file @
0597ba77
...
@@ -25,6 +25,7 @@ import edu.kit.iti.formal.psdbg.parser.types.TermType;
...
@@ -25,6 +25,7 @@ import edu.kit.iti.formal.psdbg.parser.types.TermType;
import
edu.kit.iti.formal.psdbg.parser.types.Type
;
import
edu.kit.iti.formal.psdbg.parser.types.Type
;
import
edu.kit.iti.formal.psdbg.termmatcher.MatcherFacade
;
import
edu.kit.iti.formal.psdbg.termmatcher.MatcherFacade
;
import
edu.kit.iti.formal.psdbg.termmatcher.Matchings
;
import
edu.kit.iti.formal.psdbg.termmatcher.Matchings
;
import
edu.kit.iti.formal.psdbg.termmatcher.Utils
;
import
edu.kit.iti.formal.psdbg.termmatcher.mp.MatchPath
;
import
edu.kit.iti.formal.psdbg.termmatcher.mp.MatchPath
;
import
org.key_project.util.collection.ImmutableList
;
import
org.key_project.util.collection.ImmutableList
;
...
@@ -223,6 +224,7 @@ public class KeYMatcher implements MatcherApi<KeyData> {
...
@@ -223,6 +224,7 @@ public class KeYMatcher implements MatcherApi<KeyData> {
s
=
s
.
replaceFirst
(
"\\?"
,
""
);
s
=
s
.
replaceFirst
(
"\\?"
,
""
);
}
}
va
.
declare
(
s
,
new
TermType
());
va
.
declare
(
s
,
new
TermType
());
va
.
assign
(
s
,
Value
.
from
(
from
(
matched
)));
va
.
assign
(
s
,
Value
.
from
(
from
(
matched
)));
System
.
out
.
println
(
"Variable "
+
s
+
" : "
+
Value
.
from
(
from
(
matched
)));
System
.
out
.
println
(
"Variable "
+
s
+
" : "
+
Value
.
from
(
from
(
matched
)));
...
@@ -259,7 +261,8 @@ public class KeYMatcher implements MatcherApi<KeyData> {
...
@@ -259,7 +261,8 @@ public class KeYMatcher implements MatcherApi<KeyData> {
}
}
private
TermLiteral
from
(
Term
t
)
{
private
TermLiteral
from
(
Term
t
)
{
return
new
TermLiteral
(
t
.
toString
());
//TODO rewrite operator
return
new
TermLiteral
(
Utils
.
toPrettyTerm
(
t
));
}
}
private
TermLiteral
from
(
SequentFormula
sf
)
{
private
TermLiteral
from
(
SequentFormula
sf
)
{
...
...
rt-key/src/test/resources/edu/kit/iti/formal/psdbg/interpreter/contraposition/cutTest.kps
View file @
0597ba77
script cutTest(){
script cutTest(){
cut `p`;
//auto step=2;
//cases{
//cut `p`;
// case match `==>?X -> ?Y`:
cases{
case match `==>?X -> ?Y`:
//auto steps=100;
//auto steps=100;
//
cut
formula=
`?
X
`[];
cut `?
Y
`[];
//
}
}
//cut #2=`p`;
//cut #2=`p`;
//auto steps=100;
//auto steps=100;
}
}
\ No newline at end of file
ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controls/ScriptArea.java
View file @
0597ba77
...
@@ -437,7 +437,7 @@ public class ScriptArea extends CodeArea {
...
@@ -437,7 +437,7 @@ public class ScriptArea extends CodeArea {
SequentFormula
seqForm
=
tap
.
getPio
().
sequentFormula
();
SequentFormula
seqForm
=
tap
.
getPio
().
sequentFormula
();
//transform term to parsable string representation
//transform term to parsable string representation
String
term
=
Utils
.
toPrettyTerm
(
seqForm
.
formula
());
String
term
=
edu
.
kit
.
iti
.
formal
.
psdbg
.
termmatcher
.
Utils
.
toPrettyTerm
(
seqForm
.
formula
());
String
text
=
getText
();
String
text
=
getText
();
...
...
ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controls/Utils.java
View file @
0597ba77
package
edu.kit.iti.formal.psdbg.gui.controls
;
package
edu.kit.iti.formal.psdbg.gui.controls
;
import
de.uka.ilkd.key.logic.Term
;
import
de.uka.ilkd.key.logic.op.Equality
;
import
de.uka.ilkd.key.logic.op.IProgramMethod
;
import
de.uka.ilkd.key.logic.op.IProgramMethod
;
import
de.uka.ilkd.key.logic.op.Junctor
;
import
de.uka.ilkd.key.logic.op.Operator
;
import
de.uka.ilkd.key.pp.ProgramPrinter
;
import
de.uka.ilkd.key.pp.ProgramPrinter
;
import
de.uka.ilkd.key.speclang.Contract
;
import
de.uka.ilkd.key.speclang.Contract
;
import
edu.kit.iti.formal.psdbg.interpreter.data.GoalNode
;
import
edu.kit.iti.formal.psdbg.interpreter.data.GoalNode
;
...
@@ -245,37 +241,7 @@ public class Utils {
...
@@ -245,37 +241,7 @@ public class Utils {
* @param formula
* @param formula
* @return parsable Stringversion of Term
* @return parsable Stringversion of Term
*/
*/
public
static
String
toPrettyTerm
(
Term
formula
)
{
/* public static String toPrettyTerm(Term formula) {
StringBuilder
sb
=
new
StringBuilder
();
return KeYUtils.toPrettyTerm(formula);
}*/
Operator
op
=
formula
.
op
();
//ugly if/else
if
(
op
.
equals
(
Junctor
.
IMP
))
{
sb
.
append
(
"("
+
toPrettyTerm
(
formula
.
sub
(
0
))
+
") -> ("
+
toPrettyTerm
(
formula
.
sub
(
1
))
+
")"
);
}
else
{
if
(
op
.
equals
(
Junctor
.
AND
))
{
sb
.
append
(
"("
+
toPrettyTerm
(
formula
.
sub
(
0
))
+
") && ("
+
toPrettyTerm
(
formula
.
sub
(
1
))
+
")"
);
}
else
{
if
(
op
.
equals
(
Junctor
.
OR
))
{
sb
.
append
(
"("
+
toPrettyTerm
(
formula
.
sub
(
0
))
+
") || ("
+
toPrettyTerm
(
formula
.
sub
(
1
))
+
")"
);
}
else
{
if
(
op
.
equals
(
Equality
.
EQV
))
{
sb
.
append
(
"("
+
toPrettyTerm
(
formula
.
sub
(
0
))
+
") <-> ("
+
toPrettyTerm
(
formula
.
sub
(
1
))
+
")"
);
}
else
{
if
(
op
.
equals
(
Equality
.
EQUALS
))
{
sb
.
append
(
"("
+
toPrettyTerm
(
formula
.
sub
(
0
))
+
") == ("
+
toPrettyTerm
(
formula
.
sub
(
1
))
+
")"
);
}
else
{
if
(
op
.
equals
(
Junctor
.
NOT
))
{
sb
.
append
(
"(!"
+
toPrettyTerm
(
formula
.
sub
(
0
))
+
")"
);
}
else
{
sb
.
append
(
formula
.
toString
());
}
}
}
}
}
}
return
sb
.
toString
();
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment