Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
sarah.grebing
ProofScriptParser
Commits
e7bb515b
Commit
e7bb515b
authored
Aug 20, 2017
by
Sarah Grebing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Matching of Sequent interimstate
parent
d6247320
Pipeline
#12958
failed with stage
in 1 minute and 35 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
4 deletions
+30
-4
src/main/java/edu/kit/formal/psdb/termmatcher/MatcherFacade.java
...n/java/edu/kit/formal/psdb/termmatcher/MatcherFacade.java
+15
-1
src/test/java/edu/kit/formal/psdb/termmatcher/MatcherFacadeTest.java
...va/edu/kit/formal/psdb/termmatcher/MatcherFacadeTest.java
+15
-3
No files found.
src/main/java/edu/kit/formal/psdb/termmatcher/MatcherFacade.java
View file @
e7bb515b
...
...
@@ -107,6 +107,10 @@ public class MatcherFacade {
* @return
*/
private
static
List
<
MatchInfo
>
reduceCompatibleMatches
(
List
<
List
<
MatchInfo
>>
allMatches
)
{
if
(
allMatches
.
size
()
==
1
)
{
return
allMatches
.
get
(
0
);
}
if
(
allMatches
.
size
()
==
2
)
{
return
MatcherImpl
.
reduceConform
(
allMatches
.
get
(
0
),
allMatches
.
get
(
1
));
}
else
{
...
...
@@ -131,10 +135,20 @@ public class MatcherFacade {
MatcherImpl
matcher
=
new
MatcherImpl
();
MatchPatternParser
mpp
=
getParser
(
pattern
);
SequentPatternContext
ctx
=
mpp
.
sequentPattern
();
Semisequent
antec
=
sequent
.
antecedent
();
Semisequent
succ
=
sequent
.
succedent
();
SemiSeqPatternContext
antecPattern
=
ctx
.
antec
;
SemiSeqPatternContext
succPattern
=
ctx
.
succ
;
System
.
out
.
println
(
"SuccPattern "
+
succPattern
);
Matchings
mAntec
=
matches
(
antecPattern
,
antec
);
Matchings
mSucc
=
matches
(
succPattern
,
succ
);
Matchings
newMatching
=
MatcherImpl
.
reduceConform
(
mAntec
,
mSucc
);
//return MatcherImpl.NO_MATCH;
return
matches
(
pattern
,
antec
)
;
return
newMatching
;
}
}
src/test/java/edu/kit/formal/psdb/termmatcher/MatcherFacadeTest.java
View file @
e7bb515b
...
...
@@ -42,10 +42,16 @@ public class MatcherFacadeTest {
shouldMatch
(
"f(a)"
,
"f(a)"
);
shouldMatchForm
(
"pred(a)"
,
"_"
);
shouldMatchForm
(
"pred(a)"
,
"pred(?X)"
,
"[{?X=a}]"
);
shouldMatchSeq
(
"pred(a), pred(b) ==> pred(b)"
,
"pred(?X), pred(?Z) ==> pred(?Y)"
);
shouldMatchSeq
(
"pred(a), pred(b) ==> pred(b)"
,
"pred(?X), pred(?Z) ==> pred(?X)"
);
shouldMatchSemiSeq
(
"pred(a), pred(b) ==>"
,
"pred(?X), pred(?Y)"
,
"[{?X=a, ?Y=b}, {?X=b, ?Y=a}]"
);
shouldMatchSemiSeq
(
"pred(a), pred(b) ==>"
,
"pred(?X), pred(?X)"
,
"[]"
);
shouldMatchSemiSeq
(
"pred(a), pred(f(a)) ==>"
,
"pred(?X), pred(f(?X))"
,
"[{?X=a}]"
);
shouldMatchSemiSeq
(
"pred(b), pred(f(a)) ==>"
,
"pred(?X), pred(f(?X))"
,
"[]"
);
// shouldMatchSemiSeq("pred(a), pred(b) ==>", "pred(?X), pred(?X)", "[]");
// shouldMatchSemiSeq("pred(a), pred(f(a)) ==>", "pred(?X), pred(f(?X))", "[{?X=a}]");
// shouldMatchSemiSeq("pred(b), pred(f(a)) ==>", "pred(?X), pred(f(?X))", "[]");
// shouldMatchSemiSeq("pred(a), pred(b) ==> qpred(a,b)", "pred(a), pred(b)");
//shouldMatchSemiSeq("pred(a), pred(b) ==> qpred(a,b)", "pred(?X), pred(?Y)", "[{?X=a}, {?Y:=b}]");
...
...
@@ -85,6 +91,12 @@ public class MatcherFacadeTest {
Assert
.
assertEquals
(
exp
,
m
.
toString
());
}
private
void
shouldMatchSeq
(
String
seq
,
String
seqPattern
)
throws
ParserException
{
Sequent
sequent
=
parseSeq
(
seq
);
Matchings
m
=
MatcherFacade
.
matches
(
seqPattern
,
sequent
);
System
.
out
.
println
(
m
);
}
private
void
shouldMatchSemiSeq
(
String
s
,
String
s1
,
String
exp
)
throws
ParserException
{
Sequent
term
=
parseSeq
(
s
);
Matchings
m
=
MatcherFacade
.
matches
(
s1
,
term
);
...
...
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