Skip to content

Commit c1a78dc

Browse files
authored
Merge pull request #27 from FliegendeWurst/misc2
Extend HowToTaclet with information on the new tagging mechanism
2 parents b753a47 + f89bcad commit c1a78dc

File tree

8 files changed

+82
-3
lines changed

8 files changed

+82
-3
lines changed

docs/devel/HowToTaclet.md

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ system. In particular, the following topics are discussed:
1919

2020
The standard location for `.key` files containing taclets is in the `key.core`
2121
project, location `resources/de/uka/ilkd/key/proof/rules` (*note*: unless stated
22-
otherwise, all locations in this article are relative to `key.core`). The file
23-
`standardRules.key` lists all the taclet files that are are loaded as defaults
22+
otherwise, all locations in this article are relative to the main source root of `key.core`).
23+
The file `standardRules.key` lists all the taclet files that are are loaded as defaults
2424
when starting KeY with the Java profile. New taclets can be added to either of
2525
the existing files listed there (if they fit into the scope), or can be added to
2626
a new file which is then referred to in `standardRules.key`.
@@ -36,6 +36,55 @@ Taclets can be added to "rule sets" which are used, e.g., by strategy
3636
heuristics. Default rule sets are defined in the file
3737
`resources/de/uka/ilkd/key/proof/rules/ruleSetDeclarations.key`.
3838

39+
### Quick example
40+
41+
Consider the definition of `cut_direct` below (part of `propRule.key`).
42+
43+
```
44+
\schemaVariables {
45+
\formula cutFormula;
46+
}
47+
48+
\rules {
49+
cut_direct {
50+
\find(cutFormula)
51+
\sameUpdateLevel
52+
"CUT: #cutFormula TRUE" [main]:
53+
\replacewith(true) \add(cutFormula ==>);
54+
"CUT: #cutFormula FALSE":
55+
\replacewith(false) \add( ==> cutFormula)
56+
\heuristics(cut_direct)
57+
};
58+
}
59+
```
60+
61+
First, we need to define the variables we want to use in the taclet.
62+
This is the `\schemaVariables` block at the start of the `.key` file.
63+
We only require a single `\formula` type schema variable called `cutFormula`.
64+
65+
Then, we define the actual taclets in this file by creating a `\rules` block.
66+
For the purposes of this example, we limit ourselves to the cut_direct taclet.
67+
`propRule.key` contains many more taclets.
68+
The `\rules` block contains the taclet definitions, each of which begins with the name of the taclet
69+
("cut_direct"), creating a new block defined by curly brackets and a semicolon at the end.
70+
71+
Since the `\find(...)` part of the taclet definition does not contain a `==>`, the `cut_direct` taclet finds (matches) a sub-term anywhere in a sequent formula.
72+
The `\sameUpdateLevel` essentially ensures it doesn't match under an update application.
73+
74+
The taclet creates two new branches, which are defined directly afterwards.
75+
The first branch is labeled "CUT: #cutFormula TRUE".
76+
In this branch, the found sub-term is replaced with true (`\replacewith(true)`), and the found sub-term is added as a new sequent formula to the antecedent: `\add(cutFormula ==>)`.
77+
78+
A particular branch of the taclet can be tagged by enclosing the tag in brackets.
79+
This tag must be written after the branch label.
80+
The first branch in this example is tagged with "main".
81+
This particular value causes the branch to be visually continued on the parent branch if [the linearized Proof Tree mode](../../user/ProofTreeLinearMode/) is active.
82+
83+
The second branch of the taclet is labeled "CUT: #cutFormula FALSE".
84+
In this branch, the found sub-term is replaced with false (`\replacewith(false)`), and the found sub-term is added as a new sequent formula to the succedent: `\add( ==> cutFormula)`.
85+
86+
Finally, the taclet is added to the `cut_direct` heuristics group.
87+
3988
## How to extend the taclet language
4089

4190
!!! danger

docs/user/ProofCaching/index.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ Without condition 1, the replay may fail.
3939
In KeY's settings dialog, enable the Proof Caching extension.
4040
You can toggle the automatic search for references in the "Proof Caching" section (on by default).
4141

42+
### Enabling/disabling the functionality
43+
44+
In the toolbar, a new Proof Caching toggle button is added.
45+
In the options menu, a Proof Caching checkbox is synchronized to the same state.
46+
When these are not activated, the automated reference search is disabled.
47+
4248
## Automated reference search
4349

4450
When running the auto pilot or a strategy macro, KeY will automatically search for references
@@ -53,6 +59,11 @@ Right-click on an open goal in the proof tree and select "close by reference".
5359
If a matching branch is found, the goal will be closed.
5460
Otherwise, a dialog with an error message will open.
5561

62+
## Re-opening cached proof branches
63+
64+
It is possible to re-open proof goals closed by the cache.
65+
To do so, just activate the "Re-open cached goal" context menu entry on the goal you wish to re-open.
66+
5667
## Copying referenced proof steps
5768

5869
In the status line, a button indicates whether cached goals are present:

docs/user/ProofTreeLinearMode.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Proof Tree: linearized mode
2+
3+
In the proof tree settings, you can enable the "Linearize Proof Tree" option.
4+
5+
![Screenshot of option](ProofTreeLinearMode_enable.png)
6+
7+
## Effect when enabled
8+
9+
For symbolic execution steps, the "Normal Execution" branch will (visually) continue on the parent branch. See the screenshot below for a quick example.
10+
The exceptional case branches (e.g. Null Reference, Index Out of Bounds) are therefore placed above the steps of the Normal Execution branch.
11+
12+
![Screenshot of tree with option enabled](ProofTreeLinearMode_example.png)
13+
14+
Additionally, the TRUE branch of cut_direct applications will visually continue on the parent branch.
15+
This mechanism may be extended further by other taclets tagging their "main" created branch.
16+
17+
![Screenshot of tree with cut_direct](ProofTreeLinearMode_example2.png)
49.8 KB
Loading
23.3 KB
Loading
28.6 KB
Loading

docs/user/UiFeatures/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
- [Exploration](../Exploration)
22
- [Node Differences](../NodeDiff)
33
- [Proof Slicing](../ProofSlicing)
4-
- [Proof Caching](../ProofCaching)
4+
- [Proof Caching](../ProofCaching)
5+
- [Proof Tree: linearized mode](../ProofTreeLinearMode)

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ nav:
112112
- user/NodeDiff.md
113113
- user/ProofSlicing/index.md
114114
- user/ProofCaching/index.md
115+
- user/ProofTreeLinearMode.md
115116
- Languages:
116117
- user/HowToTaclet.md
117118
- user/JMLGrammar.md

0 commit comments

Comments
 (0)