Skip to content

Commit b04e7f8

Browse files
1 parent b1893fd commit b04e7f8

13 files changed

Lines changed: 332 additions & 6 deletions

File tree

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
========================================================================
2+
Tactic: `hoare split`
3+
========================================================================
4+
5+
The `hoare split` tactic applies to **Hoare-logic goals only** whose
6+
postcondition is a conjunction.
7+
8+
In this situation, the program is required to establish *both* components of
9+
the postcondition. The `hoare split` tactic makes this explicit by splitting
10+
the original goal into independent Hoare goals, one for each conjunct.
11+
12+
Applying `hoare split` does not modify the program or the precondition. It
13+
only decomposes the logical structure of the postcondition.
14+
15+
.. note::
16+
17+
The `hoare split` tactic is new and subject to change. Its interface and
18+
behavior may evolve in future versions of EasyCrypt.
19+
20+
Currently, it only splits the top-most conjunction into two conjuncts.
21+
If you have nested conjunctions in the postcondition, you can
22+
apply `hoare split` multiple times to fully decompose the postcondition.
23+
24+
.. contents::
25+
:local:
26+
27+
------------------------------------------------------------------------
28+
Syntax
29+
------------------------------------------------------------------------
30+
31+
.. admonition:: Syntax
32+
33+
`hoare split`
34+
35+
This tactic takes no arguments. It can be applied whenever the conclusion
36+
of a Hoare goal is a conjunction.
37+
38+
------------------------------------------------------------------------
39+
Example
40+
------------------------------------------------------------------------
41+
42+
.. ecproof::
43+
:title: Splitting a conjunctive postcondition
44+
45+
require import AllCore.
46+
47+
module M = {
48+
proc incr(x : int) : int = {
49+
var y : int;
50+
y <- x + 1;
51+
return y;
52+
}
53+
}.
54+
55+
lemma L (n : int) : 0 <= n =>
56+
hoare [M.incr : x = n ==> n < res /\ 0 <= res].
57+
proof.
58+
move=> ge0_n; proc.
59+
60+
(*$*) (* Split the conjunctive postcondition *)
61+
hoare split.
62+
63+
- (* First conjunct: n < y *)
64+
wp; skip; smt().
65+
66+
- (* Second conjunct: 0 <= y *)
67+
wp; skip; smt().
68+
qed.
69+
70+
------------------------------------------------------------------------
71+
Note
72+
------------------------------------------------------------------------
73+
74+
This tactic is specific to Hoare logic. An analogous transformation would be
75+
unsound in other program logics supported by EasyCrypt (such as probabilistic
76+
or relational program logics), where a conjunctive postcondition does not, in
77+
general, decompose into independent proof obligations.

refman/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ <h1>EasyCrypt reference manual<a class="headerlink" href="#easycrypt-reference-m
8080
<ul>
8181
<li class="toctree-l1"><a class="reference internal" href="tactics.html">Proof tactics reference</a><ul>
8282
<li class="toctree-l2"><a class="reference internal" href="tactics/clear.html">Tactic: <code class="code highlight easycrypt docutils literal highlight-easycrypt"><span class="kr">clear</span></code></a></li>
83+
<li class="toctree-l2"><a class="reference internal" href="tactics/hoare-split.html">Tactic: <code class="code highlight easycrypt docutils literal highlight-easycrypt"><span class="kr">hoare</span><span class="w"> </span><span class="kr">split</span></code></a></li>
8384
<li class="toctree-l2"><a class="reference internal" href="tactics/if.html">Tactic: <code class="docutils literal notranslate"><span class="pre">if</span></code></a></li>
8485
<li class="toctree-l2"><a class="reference internal" href="tactics/proc.html">Tactic: <code class="code highlight easycrypt docutils literal highlight-easycrypt"><span class="kr">proc</span></code></a></li>
8586
<li class="toctree-l2"><a class="reference internal" href="tactics/procstar.html">Tactic: <code class="code highlight easycrypt docutils literal highlight-easycrypt"><span class="kr">proc</span><span class="o">*</span></code></a></li>

refman/objects.inv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# Project: EasyCrypt refman
33
# Version:
44
# The remainder of this file is compressed using zlib.
5-
xڅ��n� �w���"�Q׬Q��"�/@�Q1 J��5����Y������A ��;�N�|���;�}�(�G�D��i�6⦳���8XP�HԝH4j�`�.b§fw i���:Ol� ���jd��-��?�̀&_'?hU/��X:�bdѹ�����>��$���<�r�����v,Č�o ZM�[��#8ڞ��^K�������+�� ��aZn�Hь�1��UZ�Z�E+��� �5f�˘ ���
5+
xڅ��N� ��<��L���^�&��/�0�DZ�Y����7��|�f�E, ~�u�,�H<��1������#*mLQ�Tu����U;l������r#͊u�uȅ���MB����38B����=��?<������'T�g�eu�Z� X �N�Yt��~!#�t��gJ�F)�Q��읨��:v,Č���vsR��`���W�6%p(�Y��"oM�Q��=��V�����o����c����'E�Ob�pOޫ��bET����26�~��7P

refman/searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

refman/tactics.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
<ul class="current">
5151
<li class="toctree-l1 current"><a class="current reference internal" href="#">Proof tactics reference</a><ul>
5252
<li class="toctree-l2"><a class="reference internal" href="tactics/clear.html">Tactic: <code class="code highlight easycrypt docutils literal highlight-easycrypt"><span class="kr">clear</span></code></a></li>
53+
<li class="toctree-l2"><a class="reference internal" href="tactics/hoare-split.html">Tactic: <code class="code highlight easycrypt docutils literal highlight-easycrypt"><span class="kr">hoare</span><span class="w"> </span><span class="kr">split</span></code></a></li>
5354
<li class="toctree-l2"><a class="reference internal" href="tactics/if.html">Tactic: <code class="docutils literal notranslate"><span class="pre">if</span></code></a></li>
5455
<li class="toctree-l2"><a class="reference internal" href="tactics/proc.html">Tactic: <code class="code highlight easycrypt docutils literal highlight-easycrypt"><span class="kr">proc</span></code></a></li>
5556
<li class="toctree-l2"><a class="reference internal" href="tactics/procstar.html">Tactic: <code class="code highlight easycrypt docutils literal highlight-easycrypt"><span class="kr">proc</span><span class="o">*</span></code></a></li>
@@ -89,6 +90,7 @@ <h1>Proof tactics reference<a class="headerlink" href="#proof-tactics-reference"
8990
<div class="toctree-wrapper compound">
9091
<ul>
9192
<li class="toctree-l1"><a class="reference internal" href="tactics/clear.html">Tactic: <code class="code highlight easycrypt docutils literal highlight-easycrypt"><span class="kr">clear</span></code></a></li>
93+
<li class="toctree-l1"><a class="reference internal" href="tactics/hoare-split.html">Tactic: <code class="code highlight easycrypt docutils literal highlight-easycrypt"><span class="kr">hoare</span><span class="w"> </span><span class="kr">split</span></code></a></li>
9294
<li class="toctree-l1"><a class="reference internal" href="tactics/if.html">Tactic: <code class="docutils literal notranslate"><span class="pre">if</span></code></a></li>
9395
<li class="toctree-l1"><a class="reference internal" href="tactics/proc.html">Tactic: <code class="code highlight easycrypt docutils literal highlight-easycrypt"><span class="kr">proc</span></code></a></li>
9496
<li class="toctree-l1"><a class="reference internal" href="tactics/procstar.html">Tactic: <code class="code highlight easycrypt docutils literal highlight-easycrypt"><span class="kr">proc</span><span class="o">*</span></code></a></li>

refman/tactics/clear.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<script src="../_static/js/theme.js"></script>
2525
<link rel="index" title="Index" href="../genindex.html" />
2626
<link rel="search" title="Search" href="../search.html" />
27-
<link rel="next" title="Tactic: if" href="if.html" />
27+
<link rel="next" title="Tactic: hoare split" href="hoare-split.html" />
2828
<link rel="prev" title="Proof tactics reference" href="../tactics.html" />
2929
</head>
3030

@@ -50,6 +50,7 @@
5050
<ul class="current">
5151
<li class="toctree-l1 current"><a class="reference internal" href="../tactics.html">Proof tactics reference</a><ul class="current">
5252
<li class="toctree-l2 current"><a class="current reference internal" href="#">Tactic: <code class="code highlight easycrypt docutils literal highlight-easycrypt"><span class="kr">clear</span></code></a></li>
53+
<li class="toctree-l2"><a class="reference internal" href="hoare-split.html">Tactic: <code class="code highlight easycrypt docutils literal highlight-easycrypt"><span class="kr">hoare</span><span class="w"> </span><span class="kr">split</span></code></a></li>
5354
<li class="toctree-l2"><a class="reference internal" href="if.html">Tactic: <code class="docutils literal notranslate"><span class="pre">if</span></code></a></li>
5455
<li class="toctree-l2"><a class="reference internal" href="proc.html">Tactic: <code class="code highlight easycrypt docutils literal highlight-easycrypt"><span class="kr">proc</span></code></a></li>
5556
<li class="toctree-l2"><a class="reference internal" href="procstar.html">Tactic: <code class="code highlight easycrypt docutils literal highlight-easycrypt"><span class="kr">proc</span><span class="o">*</span></code></a></li>
@@ -244,7 +245,7 @@ <h1>Tactic: <code class="code highlight easycrypt docutils literal highlight-eas
244245
</div>
245246
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
246247
<a href="../tactics.html" class="btn btn-neutral float-left" title="Proof tactics reference" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
247-
<a href="if.html" class="btn btn-neutral float-right" title="Tactic: if" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
248+
<a href="hoare-split.html" class="btn btn-neutral float-right" title="Tactic: hoare split" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
248249
</div>
249250

250251
<hr/>

0 commit comments

Comments
 (0)