summaryrefslogtreecommitdiff
path: root/ws2015/eip/blaetter/03/H3-1.md
diff options
context:
space:
mode:
Diffstat (limited to 'ws2015/eip/blaetter/03/H3-1.md')
-rw-r--r--ws2015/eip/blaetter/03/H3-1.md39
1 files changed, 39 insertions, 0 deletions
diff --git a/ws2015/eip/blaetter/03/H3-1.md b/ws2015/eip/blaetter/03/H3-1.md
new file mode 100644
index 0000000..bb3d2ca
--- /dev/null
+++ b/ws2015/eip/blaetter/03/H3-1.md
@@ -0,0 +1,39 @@
1---
2header-includes:
3 - \usepackage{bussproofs}
4 - \renewcommand{\implies}{\rightarrow}
5 - \EnableBpAbbreviations
6---
7# Hoare-Tripel II
8
9d)
10
11\begin{prooftree}
12\AXC{$\forall \phi \ldotp \phi \implies \phi$}
13\UIC{$(0 < n + 1 \land n < m) \implies (0 < n + 1 \land n < m)$}
14\RightLabel{Umformung}
15\UIC{$(0 < n + 1 \land n < m) \implies (0 < n + 1 \land n \leq m - 1)$}
16\RightLabel{Umformung}
17\UIC{$(0 < n + 1 \land n < m) \implies (0 < n + 1 \land n + 1 \leq m)$}
18\RightLabel{Zuweisung}
19\UIC{$ \{ 0 < n + 1 \land n < m \} $ \texttt{n = n + 1} $ \{ 0 < n \land n \leq m \} $}
20\end{prooftree}
21
22e) Nimm als Gegenbeispiel:
23
24~~~
25a = -1
26b = 0
27~~~
28
29f) Seit $\phi$ die Nachfolgerfunktion auf $\mathbb{N}$.
30
31\begin{prooftree}
32\AXC{$\forall n \in \mathbb{N} \ldotp \phi(n) > n$}
33\UIC{$1 > 0$}
34\UIC{$((x + 1) + y > x + y)$}
35\UIC{$(z = x + y) \implies ((x + 1) + y > z)$}
36\UIC{$ \{ z = x + y \} $ \texttt{ x = x + 1} $ \{ x + y > z \} $}
37\UIC{$ \{ z = x + y \land z \equiv 0 \mod 2 \} $ \texttt{x = x + 1} $ \{ x + y > z \} $ \quad $ \{ z = x + y \land z \equiv 1 \mod 2 \} $ \texttt{x = x + 1} $ \{ x + y > z \} $}
38\UIC{$ \{ z = x + y \} $ \texttt{if (z \% 2 == 0) x = x + 1; else y = y + 1;} $ \{ x + y > z \} $}
39\end{prooftree}