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
e7011fc1
Commit
e7011fc1
authored
Jul 15, 2017
by
Sarah Grebing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merge
parent
c4a4bf4b
Pipeline
#12139
failed with stage
in 1 minute and 33 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
216 additions
and
106 deletions
+216
-106
src/main/antlr4/edu/kit/formal/proofscriptparser/ScriptLanguage.g4
...antlr4/edu/kit/formal/proofscriptparser/ScriptLanguage.g4
+2
-0
src/main/java/edu/kit/formal/gui/controls/InspectionView.java
...main/java/edu/kit/formal/gui/controls/InspectionView.java
+9
-9
src/main/java/edu/kit/formal/gui/controls/ScriptController.java
...in/java/edu/kit/formal/gui/controls/ScriptController.java
+5
-5
src/main/java/edu/kit/formal/gui/controls/WelcomePane.java
src/main/java/edu/kit/formal/gui/controls/WelcomePane.java
+0
-1
src/main/java/edu/kit/formal/gui/model/InspectionModel.java
src/main/java/edu/kit/formal/gui/model/InspectionModel.java
+42
-44
src/main/java/edu/kit/formal/interpreter/data/KeyData.java
src/main/java/edu/kit/formal/interpreter/data/KeyData.java
+3
-3
src/test/resources/edu/kit/formal/interpreter/paperExample/Simple.java
...urces/edu/kit/formal/interpreter/paperExample/Simple.java
+155
-44
No files found.
src/main/antlr4/edu/kit/formal/proofscriptparser/ScriptLanguage.g4
View file @
e7011fc1
...
@@ -149,6 +149,8 @@ BOOL: 'bool' ;
...
@@ -149,6 +149,8 @@ BOOL: 'bool' ;
TERMTYPE : 'term' ;*/
TERMTYPE : 'term' ;*/
FOREACH : 'foreach' ;
FOREACH : 'foreach' ;
THEONLY : 'theonly' ;
THEONLY : 'theonly' ;
CLOSED_BY : 'closed_by';
DERIVABLE : 'derivable';
INDENT : '{' ;
INDENT : '{' ;
DEDENT : '}' ;
DEDENT : '}' ;
SEMICOLON : ';' ;
SEMICOLON : ';' ;
...
...
src/main/java/edu/kit/formal/gui/controls/InspectionView.java
View file @
e7011fc1
...
@@ -4,7 +4,6 @@ import edu.kit.formal.gui.model.InspectionModel;
...
@@ -4,7 +4,6 @@ import edu.kit.formal.gui.model.InspectionModel;
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
javafx.beans.Observable
;
import
javafx.beans.Observable
;
import
javafx.beans.property.ObjectProperty
;
import
javafx.beans.property.ReadOnlyObjectProperty
;
import
javafx.beans.property.ReadOnlyObjectProperty
;
import
javafx.beans.property.SimpleObjectProperty
;
import
javafx.beans.property.SimpleObjectProperty
;
import
javafx.fxml.FXML
;
import
javafx.fxml.FXML
;
...
@@ -20,18 +19,15 @@ import javafx.scene.layout.BorderPane;
...
@@ -20,18 +19,15 @@ import javafx.scene.layout.BorderPane;
* @author S. Grebing
* @author S. Grebing
*/
*/
public
class
InspectionView
extends
BorderPane
{
public
class
InspectionView
extends
BorderPane
{
private
final
ReadOnlyObjectProperty
<
InspectionModel
>
model
=
new
SimpleObjectProperty
<>(
new
InspectionModel
()
);
public
GoalOptionsMenu
goalOptionsMenu
=
new
GoalOptionsMenu
();
public
GoalOptionsMenu
goalOptionsMenu
=
new
GoalOptionsMenu
();
@FXML
@FXML
private
SequentView
sequentView
;
private
SequentView
sequentView
;
@FXML
@FXML
private
ListView
<
GoalNode
<
KeyData
>>
goalView
;
private
ListView
<
GoalNode
<
KeyData
>>
goalView
;
private
ObjectProperty
<
InspectionModel
>
model
=
new
SimpleObjectProperty
<>(
new
InspectionModel
()
);
public
InspectionView
()
{
public
InspectionView
()
{
Utils
.
createWithFXML
(
this
);
Utils
.
createWithFXML
(
this
);
...
@@ -42,7 +38,7 @@ public class InspectionView extends BorderPane {
...
@@ -42,7 +38,7 @@ public class InspectionView extends BorderPane {
model
.
get
().
setSelectedGoalNodeToShow
(
b
);
model
.
get
().
setSelectedGoalNodeToShow
(
b
);
});
});
model
.
get
().
selectedGoalNodeToShow
Property
().
addListener
(
model
.
get
().
currentInterpreterGoal
Property
().
addListener
(
(
observable
,
oldValue
,
newValue
)
->
{
(
observable
,
oldValue
,
newValue
)
->
{
goalView
.
getSelectionModel
().
select
(
newValue
);
goalView
.
getSelectionModel
().
select
(
newValue
);
if
(
newValue
!=
null
&&
newValue
.
getData
()
!=
null
)
{
if
(
newValue
!=
null
&&
newValue
.
getData
()
!=
null
)
{
...
@@ -57,6 +53,10 @@ public class InspectionView extends BorderPane {
...
@@ -57,6 +53,10 @@ public class InspectionView extends BorderPane {
model
.
get
().
goalsProperty
().
bindBidirectional
(
goalView
.
itemsProperty
());
model
.
get
().
goalsProperty
().
bindBidirectional
(
goalView
.
itemsProperty
());
getGoalView
().
setCellFactory
(
GoalNodeListCell:
:
new
);
getGoalView
().
setCellFactory
(
GoalNodeListCell:
:
new
);
Utils
.
addDebugListener
(
model
.
get
().
goalsProperty
());
Utils
.
addDebugListener
(
model
.
get
().
selectedGoalNodeToShowProperty
());
Utils
.
addDebugListener
(
model
.
get
().
currentInterpreterGoalProperty
());
/*TODO redefine CSS bases on selected mode
/*TODO redefine CSS bases on selected mode
mode.addListener(o -> {
mode.addListener(o -> {
getStyleClass().removeAll(
getStyleClass().removeAll(
...
@@ -118,4 +118,4 @@ public class InspectionView extends BorderPane {
...
@@ -118,4 +118,4 @@ public class InspectionView extends BorderPane {
setText
(
text
);
setText
(
text
);
}
}
}
}
}
}
\ No newline at end of file
src/main/java/edu/kit/formal/gui/controls/ScriptController.java
View file @
e7011fc1
...
@@ -31,7 +31,7 @@ import java.nio.charset.Charset;
...
@@ -31,7 +31,7 @@ import java.nio.charset.Charset;
import
java.util.*
;
import
java.util.*
;
/**
/**
* A controller for manag
e
ing the open script files in the dock nodes.
* A controller for managing the open script files in the dock nodes.
*
*
* @author Sarah Grebing
* @author Sarah Grebing
*/
*/
...
@@ -185,14 +185,14 @@ public class ScriptController {
...
@@ -185,14 +185,14 @@ public class ScriptController {
return
mainScript
.
get
();
return
mainScript
.
get
();
}
}
public
ObjectProperty
<
MainScriptIdentifier
>
mainScriptProperty
()
{
return
mainScript
;
}
public
void
setMainScript
(
MainScriptIdentifier
mainScript
)
{
public
void
setMainScript
(
MainScriptIdentifier
mainScript
)
{
this
.
mainScript
.
set
(
mainScript
);
this
.
mainScript
.
set
(
mainScript
);
}
}
public
ObjectProperty
<
MainScriptIdentifier
>
mainScriptProperty
()
{
return
mainScript
;
}
private
ScriptArea
findEditor
(
ASTNode
node
)
{
private
ScriptArea
findEditor
(
ASTNode
node
)
{
File
f
=
new
File
(
node
.
getRuleContext
().
getStart
().
getInputStream
().
getSourceName
());
File
f
=
new
File
(
node
.
getRuleContext
().
getStart
().
getInputStream
().
getSourceName
());
return
findEditor
(
f
);
return
findEditor
(
f
);
...
...
src/main/java/edu/kit/formal/gui/controls/WelcomePane.java
View file @
e7011fc1
...
@@ -21,7 +21,6 @@ public class WelcomePane extends AnchorPane {
...
@@ -21,7 +21,6 @@ public class WelcomePane extends AnchorPane {
proofScriptDebugger
.
getWelcomePaneDock
().
close
();
proofScriptDebugger
.
getWelcomePaneDock
().
close
();
proofScriptDebugger
.
showActiveInspector
(
null
);
proofScriptDebugger
.
showActiveInspector
(
null
);
proofScriptDebugger
.
openScript
(
proofScriptDebugger
.
openScript
(
// new File("src/test/resources/edu/kit/formal/interpreter/contraposition/test.kps")
new
File
(
"src/test/resources/edu/kit/formal/interpreter/contraposition/wo_branching.kps"
)
new
File
(
"src/test/resources/edu/kit/formal/interpreter/contraposition/wo_branching.kps"
)
);
);
...
...
src/main/java/edu/kit/formal/gui/model/InspectionModel.java
View file @
e7011fc1
...
@@ -17,15 +17,10 @@ import javafx.scene.paint.Color;
...
@@ -17,15 +17,10 @@ import javafx.scene.paint.Color;
* @author Alexander Weigl
* @author Alexander Weigl
*/
*/
public
class
InspectionModel
{
public
class
InspectionModel
{
enum
Mode
{
private
final
ObjectProperty
<
ASTNode
>
node
=
new
SimpleObjectProperty
<>(
this
,
"node"
);
LIVING
,
DEAD
,
POSTMORTEM
,
private
final
ListProperty
<
GoalNode
<
KeyData
>>
goals
=
new
SimpleListProperty
<>(
this
,
"goals"
);
}
private
final
ObjectProperty
<
GoalNode
<
KeyData
>>
selectedGoalNodeToShow
=
new
SimpleObjectProperty
<>(
this
,
"selectedGoalNodeToShow"
);
private
final
ObjectProperty
<
GoalNode
<
KeyData
>>
currentInterpreterGoal
=
new
SimpleObjectProperty
<>(
this
,
"currentInterpreterGoal"
);
private
final
ObjectProperty
<
ASTNode
>
node
=
new
SimpleObjectProperty
<>();
private
final
ListProperty
<
GoalNode
<
KeyData
>>
goals
=
new
SimpleListProperty
<>();
private
final
ObjectProperty
<
GoalNode
<
KeyData
>>
selectedGoalNodeToShow
=
new
SimpleObjectProperty
<>();
private
final
ObjectProperty
<
GoalNode
<
KeyData
>>
currentInterpreterGoal
=
new
SimpleObjectProperty
<>();
private
final
MapProperty
<
GoalNode
,
Color
>
colorofEachGoalNodeinListView
=
new
SimpleMapProperty
<>(
FXCollections
.
observableHashMap
());
private
final
MapProperty
<
GoalNode
,
Color
>
colorofEachGoalNodeinListView
=
new
SimpleMapProperty
<>(
FXCollections
.
observableHashMap
());
//private final StringProperty javaString = new SimpleStringProperty();
//private final StringProperty javaString = new SimpleStringProperty();
private
final
SetProperty
<
Integer
>
highlightedJavaLines
=
new
SimpleSetProperty
<>(
FXCollections
.
observableSet
());
private
final
SetProperty
<
Integer
>
highlightedJavaLines
=
new
SimpleSetProperty
<>(
FXCollections
.
observableSet
());
...
@@ -33,79 +28,78 @@ public class InspectionModel {
...
@@ -33,79 +28,78 @@ public class InspectionModel {
private
final
BooleanProperty
isInterpreterTab
=
new
SimpleBooleanProperty
();
private
final
BooleanProperty
isInterpreterTab
=
new
SimpleBooleanProperty
();
private
ObjectProperty
<
Mode
>
mode
=
new
SimpleObjectProperty
<>();
private
ObjectProperty
<
Mode
>
mode
=
new
SimpleObjectProperty
<>();
public
GoalNode
<
KeyData
>
getCurrentInterpreterGoal
()
{
public
GoalNode
<
KeyData
>
getCurrentInterpreterGoal
()
{
return
currentInterpreterGoal
.
get
();
return
currentInterpreterGoal
.
get
();
}
}
public
ObjectProperty
<
GoalNode
<
KeyData
>>
currentInterpreterGoalProperty
()
{
return
currentInterpreterGoal
;
}
public
void
setCurrentInterpreterGoal
(
GoalNode
<
KeyData
>
currentInterpreterGoal
)
{
public
void
setCurrentInterpreterGoal
(
GoalNode
<
KeyData
>
currentInterpreterGoal
)
{
this
.
currentInterpreterGoal
.
set
(
currentInterpreterGoal
);
this
.
currentInterpreterGoal
.
set
(
currentInterpreterGoal
);
}
}
public
Mode
getMode
()
{
public
ObjectProperty
<
GoalNode
<
KeyData
>>
currentInterpreterGoalProperty
()
{
return
mode
.
get
()
;
return
currentInterpreterGoal
;
}
}
public
ObjectProperty
<
Mode
>
modeProperty
()
{
public
Mode
getMode
()
{
return
mode
;
return
mode
.
get
()
;
}
}
public
void
setMode
(
Mode
mode
)
{
public
void
setMode
(
Mode
mode
)
{
this
.
mode
.
set
(
mode
);
this
.
mode
.
set
(
mode
);
}
}
public
ASTNode
getNode
()
{
public
ObjectProperty
<
Mode
>
modeProperty
()
{
return
node
.
get
()
;
return
mode
;
}
}
public
ObjectProperty
<
ASTNode
>
nodeProperty
()
{
public
ASTNode
getNode
()
{
return
node
;
return
node
.
get
()
;
}
}
public
void
setNode
(
ASTNode
node
)
{
public
void
setNode
(
ASTNode
node
)
{
this
.
node
.
set
(
node
);
this
.
node
.
set
(
node
);
}
}
public
Ob
servableList
<
GoalNode
<
KeyData
>>
getGoals
()
{
public
Ob
jectProperty
<
ASTNode
>
nodeProperty
()
{
return
goals
.
get
()
;
return
node
;
}
}
public
ListProperty
<
GoalNode
<
KeyData
>>
goalsProperty
()
{
public
ObservableList
<
GoalNode
<
KeyData
>>
getGoals
()
{
return
goals
;
return
goals
.
get
()
;
}
}
public
void
setGoals
(
ObservableList
<
GoalNode
<
KeyData
>>
goals
)
{
public
void
setGoals
(
ObservableList
<
GoalNode
<
KeyData
>>
goals
)
{
this
.
goals
.
set
(
goals
);
this
.
goals
.
set
(
goals
);
}
}
public
GoalNode
getSelectedGoalNodeToShow
()
{
public
ListProperty
<
GoalNode
<
KeyData
>>
goalsProperty
()
{
return
selectedGoalNodeToShow
.
get
()
;
return
goals
;
}
}
public
ObjectProperty
<
GoalNode
<
KeyData
>>
selectedGoalNodeToShowProperty
()
{
public
GoalNode
getSelectedGoalNodeToShow
()
{
return
selectedGoalNodeToShow
;
return
selectedGoalNodeToShow
.
get
()
;
}
}
public
void
setSelectedGoalNodeToShow
(
GoalNode
selectedGoalNodeToShow
)
{
public
void
setSelectedGoalNodeToShow
(
GoalNode
selectedGoalNodeToShow
)
{
this
.
selectedGoalNodeToShow
.
set
(
selectedGoalNodeToShow
);
this
.
selectedGoalNodeToShow
.
set
(
selectedGoalNodeToShow
);
}
}
public
Ob
servableMap
<
GoalNode
,
Color
>
getColorofEachGoalNodeinListView
()
{
public
Ob
jectProperty
<
GoalNode
<
KeyData
>>
selectedGoalNodeToShowProperty
()
{
return
colorofEachGoalNodeinListView
.
get
()
;
return
selectedGoalNodeToShow
;
}
}
public
MapProperty
<
GoalNode
,
Color
>
colorofEachGoalNodeinListViewProperty
()
{
public
ObservableMap
<
GoalNode
,
Color
>
getColorofEachGoalNodeinListView
()
{
return
colorofEachGoalNodeinListView
;
return
colorofEachGoalNodeinListView
.
get
()
;
}
}
public
void
setColorofEachGoalNodeinListView
(
ObservableMap
<
GoalNode
,
Color
>
colorofEachGoalNodeinListView
)
{
public
void
setColorofEachGoalNodeinListView
(
ObservableMap
<
GoalNode
,
Color
>
colorofEachGoalNodeinListView
)
{
this
.
colorofEachGoalNodeinListView
.
set
(
colorofEachGoalNodeinListView
);
this
.
colorofEachGoalNodeinListView
.
set
(
colorofEachGoalNodeinListView
);
}
}
public
MapProperty
<
GoalNode
,
Color
>
colorofEachGoalNodeinListViewProperty
()
{
return
colorofEachGoalNodeinListView
;
}
/*
/*
public String getJavaString() {
public String getJavaString() {
return javaString.get();
return javaString.get();
...
@@ -123,35 +117,39 @@ public class InspectionModel {
...
@@ -123,35 +117,39 @@ public class InspectionModel {
return
highlightedJavaLines
.
get
();
return
highlightedJavaLines
.
get
();
}
}
public
SetProperty
<
Integer
>
highlightedJavaLinesProperty
()
{
return
highlightedJavaLines
;
}
public
void
setHighlightedJavaLines
(
ObservableSet
<
Integer
>
highlightedJavaLines
)
{
public
void
setHighlightedJavaLines
(
ObservableSet
<
Integer
>
highlightedJavaLines
)
{
this
.
highlightedJavaLines
.
set
(
highlightedJavaLines
);
this
.
highlightedJavaLines
.
set
(
highlightedJavaLines
);
}
}
public
boolean
isClosable
()
{
public
SetProperty
<
Integer
>
highlightedJavaLinesProperty
()
{
return
closable
.
get
()
;
return
highlightedJavaLines
;
}
}
public
BooleanProperty
closableProperty
()
{
public
boolean
isClosable
()
{
return
closable
;
return
closable
.
get
()
;
}
}
public
void
setClosable
(
boolean
closable
)
{
public
void
setClosable
(
boolean
closable
)
{
this
.
closable
.
set
(
closable
);
this
.
closable
.
set
(
closable
);
}
}
public
BooleanProperty
closableProperty
()
{
return
closable
;
}
public
boolean
isIsInterpreterTab
()
{
public
boolean
isIsInterpreterTab
()
{
return
isInterpreterTab
.
get
();
return
isInterpreterTab
.
get
();
}
}
public
void
setIsInterpreterTab
(
boolean
isInterpreterTab
)
{
this
.
isInterpreterTab
.
set
(
isInterpreterTab
);
}
public
BooleanProperty
isInterpreterTabProperty
()
{
public
BooleanProperty
isInterpreterTabProperty
()
{
return
isInterpreterTab
;
return
isInterpreterTab
;
}
}
public
void
setIsInterpreterTab
(
boolean
isInterpreterTab
)
{
enum
Mode
{
this
.
isInterpreterTab
.
set
(
isInterpreterTab
);
LIVING
,
DEAD
,
POSTMORTEM
,
}
}
}
}
src/main/java/edu/kit/formal/interpreter/data/KeyData.java
View file @
e7011fc1
...
@@ -21,14 +21,13 @@ public class KeyData {
...
@@ -21,14 +21,13 @@ public class KeyData {
private
static
final
String
SEPARATOR
=
" // "
;
private
static
final
String
SEPARATOR
=
" // "
;
private
final
KeYEnvironment
env
;
private
final
KeYEnvironment
env
;
private
final
Proof
proof
;
private
final
Proof
proof
;
private
Node
node
;
private
String
branchingLabel
,
private
String
branchingLabel
,
ruleLabel
,
ruleLabel
,
programLinesLabel
,
programLinesLabel
,
programStatementsLabel
,
programStatementsLabel
,
nameLabel
;
nameLabel
;
private
Node
node
;
private
Goal
goal
;
private
Goal
goal
;
public
KeyData
(
KeyData
data
,
Goal
node
)
{
public
KeyData
(
KeyData
data
,
Goal
node
)
{
...
@@ -117,6 +116,7 @@ public class KeyData {
...
@@ -117,6 +116,7 @@ public class KeyData {
}
}
public
Node
getNode
()
{
public
Node
getNode
()
{
return
getGoal
().
node
();
return
node
;
//return getGoal().node();
}
}
}
}
src/test/resources/edu/kit/formal/interpreter/paperExample/Simple.java
View file @
e7011fc1
public
class
Simple
{
public
final
class
Simple
{
/*@ public invariant log != null && log.length == 100; @*/
public
int
[]
log
=
new
int
[
100
];
//@ ghost \seq c_seq;
//@ ghost \seq b_seq;
/*@ public invariant n >= 0; @*/
public
int
n
;
private
/*@spec_public*/
static
int
[]
barr
;
private
/*@spec_public*/
static
int
[]
carr
;
/*@ public normal_behavior
@ requires log != null;
@ ensures n == 0 && log != null;
@*/
public
void
init
()
{
for
(
int
i
=
0
;
i
<
log
.
length
;
i
++)
{
log
[
i
]
=
0
;
}
n
=
0
;
}
/*@ public normal_behavior
/*@ public normal_behavior
@ requires n < 100;
@ requires carr.length == barr.length;
@ ensures log[n] == x+y;
@ requires aarr != barr && aarr != carr;
@ assignable log.*;
@ //requires c_seq == \dl_array2seq(carr);
@*/
@ //ensures \dl_array2seq(carr) == \dl_array2seq(barr);
public
void
logging
(
int
x
,
int
y
)
{
@ ensures \dl_seqPerm(\dl_array2seq(barr), \dl_array2seq(carr));
if
(
n
<
100
)
{
@ assignable \everything;
log
[
n
]
=
x
+
y
;
*/
}
public
int
[]
transitive
(
int
[]
aarr
){
aarr
=
Simple
.
copyArray
(
carr
);
// a=c && perm a,c
sort
(
aarr
);
//perm(a,c)
// --> result0@aftercopyArray perm result0@aftersort
barr
=
Simple
.
copyArray
(
aarr
);
//b = perm(a)
//carr@aftercopy2 = carr@aftercopy1
//carr@aftersort = carr@aftercopy2
//result0@aftersort = result1@aftercopyarray2
//barr@aftercopyarray2 = result0@aftersort
/*@ //set b_seq = \dl_array2seq(barr);@*/
return
barr
;
}
}
/*@ public normal_behavior
/*@ public normal_behavior
@ requires x >= 0 && y >= 0 && n <100;
@ ensures \dl_seqPerm(\dl_array2seq(a), \old(\dl_array2seq(a)));
@ ensures \result >=0;
@ assignable a[*];
@ assignable log.*;
*/
@*/
public
abstract
void
sort
(
int
[]
a
);
public
int
example
(
int
x
,
int
y
)
{
/*@ public normal_behavior
@ //ensures \dl_array2seq(input) == \dl_array2seq(\result);
if
(
log
[
n
]
==
0
)
{
@ // ensures (\forall int i; 0 <= i < input.length; input[i] == \result[i]) && \result.length == input.length;
logging
(
x
,
y
);
@ ensures \fresh(\result);
return
x
+
y
;
@ ensures \dl_seqPerm(\dl_array2seq(\result), \dl_array2seq(input));
}
else
{
@ assignable \nothing;
return
x
+
y
;
*/
public
/*@helper@*/
static
int
[]
copyArray
(
int
[]
input
){
int
[]
temp
=
new
int
[
input
.
length
];
/*@ loop_invariant 0 <= i && i <= temp.length && (\forall int j; 0 <= j < i; temp[j] == input[j]) ;
@ assignable temp[*];
@ decreases temp.length-i;
*/
for
(
int
i
=
0
;
i
<
input
.
length
;
i
++)
{
temp
[
i
]
=
input
[
i
];
}
}
return
temp
;
}
}
/*@ public normal_behavior
@ requires a != null && b != null && (\forall int i; 0 <= i < a.length; a[i] != b[i]);
@ ensures (\forall int i; 0 <= i < a.length; a[i] != b[i]) && \old(a) == \result;
@*/
public
int
[]
compare
(
int
[]
a
,
int
[]
b
){
return
a
;
// /*@ public normal_behavior
// @ requires c.length == b.length;
// @ ensures \dl_seqPerm(\dl_array2seq(\result), \dl_array2seq(c));
// @ assignable b[*];
// */
// public int[] foo(int[] a){
// a = Simple.copyArray(c);
////hier weiß ich: \dl_array2seq(c) == \dl_array2seq(a);
//
// /*@ loop_invariant 0 <= i && i <= a.length && (\forall int j; 0 <= j < i; a[j] == b[j]) ;
// @ assignable b[*];
// @ decreases a.length -i;
// */
// for (int i = 0; i < a.length; i++) {
// b[i]= a[i];
// }
// //hier sollte ich wissen a = b
// sort(a);
// //hier sollte ich wissen permutation a,b
// return b;
// }
/*@ public normal_behavior
@ requires a[0] >= 0;
@ ensures \result > 0;
@ assignable \nothing;
*/
public
int
getter
(
int
[]
a
){
int
test
=
a
[
0
];
a
[
0
]
=
a
[
1
];
a
[
1
]
=
test
;
int
ret
=
test
+
1
;
return
test
;
}
}
/*@ public normal_behavior
@ requires a[1] >= 0;
@ ensures \result > 0;
@ assignable \nothing;
*/
public
int
getter2
(
int
[]
a
){
int
test
=
a
[
1
];
a
[
1
]
=
a
[
0
];
a
[
0
]
=
test
;
int
ret
=
test
+
1
;
return
test
;
}
// /*@ public invariant log != null && log.length == 100; @*/
// public int[] log = new int[100];
//
// /*@ public invariant n >= 0; @*/
// public int n;
//
// /*@ public normal_behavior
// @ requires log != null;
// @ ensures n == 0 && log != null;
// @*/
//
// public void init() {
// for (int i = 0; i < log.length; i++) {
// log[i] = 0;
// }
// n = 0;
// }
//
// /*@ public normal_behavior
// @ requires n < 100;
// @ ensures log[n] == x+y;
// @ assignable log.*;
// @*/
// public void logging(int x, int y) {
// if (n < 100) {
// log[n] = x + y;