Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
ProofScriptParser
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
24
Issues
24
List
Boards
Labels
Service Desk
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sarah.grebing
ProofScriptParser
Commits
4085d7a3
Commit
4085d7a3
authored
Jul 15, 2017
by
Alexander Weigl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first draft impl for isDerivable
parent
5298d521
Pipeline
#12137
failed with stage
in 1 minute and 23 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
4 deletions
+55
-4
src/main/java/edu/kit/formal/interpreter/KeYMatcher.java
src/main/java/edu/kit/formal/interpreter/KeYMatcher.java
+55
-4
No files found.
src/main/java/edu/kit/formal/interpreter/KeYMatcher.java
View file @
4085d7a3
...
@@ -2,7 +2,16 @@ package edu.kit.formal.interpreter;
...
@@ -2,7 +2,16 @@ package edu.kit.formal.interpreter;
import
de.uka.ilkd.key.api.ScriptApi
;
import
de.uka.ilkd.key.api.ScriptApi
;
import
de.uka.ilkd.key.api.VariableAssignments
;
import
de.uka.ilkd.key.api.VariableAssignments
;
import
de.uka.ilkd.key.logic.Name
;
import
de.uka.ilkd.key.logic.Term
;
import
de.uka.ilkd.key.logic.Term
;
import
de.uka.ilkd.key.logic.op.SchemaVariable
;
import
de.uka.ilkd.key.proof.ApplyStrategy
;
import
de.uka.ilkd.key.proof.Goal
;
import
de.uka.ilkd.key.proof.Proof
;
import
de.uka.ilkd.key.proof.init.Profile
;
import
de.uka.ilkd.key.rule.NoPosTacletApp
;
import
de.uka.ilkd.key.rule.Taclet
;
import
de.uka.ilkd.key.rule.TacletApp
;
import
edu.kit.formal.interpreter.data.GoalNode
;
import
edu.kit.formal.interpreter.data.GoalNode
;
import
edu.kit.formal.interpreter.data.KeyData
;
import
edu.kit.formal.interpreter.data.KeyData
;
import
edu.kit.formal.interpreter.data.Value
;
import
edu.kit.formal.interpreter.data.Value
;
...
@@ -11,11 +20,10 @@ import edu.kit.formal.proofscriptparser.ast.Signature;
...
@@ -11,11 +20,10 @@ import edu.kit.formal.proofscriptparser.ast.Signature;
import
edu.kit.formal.proofscriptparser.ast.TermLiteral
;
import
edu.kit.formal.proofscriptparser.ast.TermLiteral
;
import
edu.kit.formal.proofscriptparser.ast.Type
;
import
edu.kit.formal.proofscriptparser.ast.Type
;
import
edu.kit.formal.proofscriptparser.ast.Variable
;
import
edu.kit.formal.proofscriptparser.ast.Variable
;
import
org.key_project.util.collection.ImmutableList
;
import
org.key_project.util.collection.ImmutableSLList
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
/**
/**
* Interface to KeY Matcher Api
* Interface to KeY Matcher Api
...
@@ -23,6 +31,7 @@ import java.util.Set;
...
@@ -23,6 +31,7 @@ import java.util.Set;
* @author S. Grebing
* @author S. Grebing
*/
*/
public
class
KeYMatcher
implements
MatcherApi
<
KeyData
>
{
public
class
KeYMatcher
implements
MatcherApi
<
KeyData
>
{
private
static
final
Name
CUT_TACLET_NAME
=
new
Name
(
"cut"
);
private
ScriptApi
scrapi
;
private
ScriptApi
scrapi
;
private
Interpreter
<
KeyData
>
interpreter
;
private
Interpreter
<
KeyData
>
interpreter
;
...
@@ -101,4 +110,46 @@ public class KeYMatcher implements MatcherApi<KeyData> {
...
@@ -101,4 +110,46 @@ public class KeYMatcher implements MatcherApi<KeyData> {
private
TermLiteral
from
(
Term
t
)
{
private
TermLiteral
from
(
Term
t
)
{
return
new
TermLiteral
(
t
.
toString
());
return
new
TermLiteral
(
t
.
toString
());
}
}
/**
* @param proof
* @param kd
* @param term
* @return null if the term is not derivable or the new state
*/
public
GoalNode
<
KeyData
>
isDerivable
(
Proof
proof
,
GoalNode
<
KeyData
>
kd
,
Term
term
)
{
Taclet
cut
=
proof
.
getEnv
().
getInitConfigForEnvironment
().
lookupActiveTaclet
(
CUT_TACLET_NAME
);
TacletApp
app
=
NoPosTacletApp
.
createNoPosTacletApp
(
cut
);
SchemaVariable
sv
=
(
SchemaVariable
)
app
.
uninstantiatedVars
().
iterator
().
next
();
TacletApp
cutApp
=
app
.
addCheckedInstantiation
(
sv
,
term
,
proof
.
getServices
(),
true
);
ImmutableList
<
Goal
>
goalList
=
kd
.
getData
().
getGoal
().
apply
(
app
);
if
(
goalList
.
size
()
!=
2
)
{
throw
new
IllegalStateException
(
"Cut created more than two sub goals!"
);
}
// apply auto on the first (hope that is the "to show" case.
Goal
toShow
=
goalList
.
head
();
//apply auto to close this branch, from AutoCommand.java
Profile
profile
=
proof
.
getServices
().
getProfile
();
ApplyStrategy
applyStrategy
=
new
ApplyStrategy
(
profile
.
getSelectedGoalChooserBuilder
().
create
());
applyStrategy
.
start
(
proof
,
toShow
);
//check if there are no goals under toShow
boolean
isDerivable
=
proof
.
getSubtreeGoals
(
toShow
.
node
()).
size
()
==
0
;
// maybe we should prune
//proof.pruneProof(kd.getData().getNode(), false);
// or not prune?
if
(
isDerivable
)
{
GoalNode
<
KeyData
>
newGoalNode
=
new
GoalNode
<
KeyData
>(
kd
,
new
KeyData
(
kd
.
getData
(),
goalList
.
head
()));
return
newGoalNode
;
}
else
{
return
null
;
}
}
}
}
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