A minor fix.
1 \documentclass[a4paper, 10pt, pagesize, smallheadings]{article}
3 %\usepackage[latin1]{inputenc}
4 \usepackage{amsmath, amsthm, amssymb}
7 \usepackage{algorithmic}
11 \title{Theory I, Sheet 9 Solution}
13 \renewcommand{\familydefault}{\sfdefault}
14 \newcommand{\Pos}{\mathcal{P}os}
15 \newcommand{\E}{\mathcal{E}}
16 \newcommand{\D}{\mathcal{D}}
17 \newcommand{\J}{\mathcal{J}}
18 \include{pythonlisting}
24 \section*{Exercise 9.1.3}
26 ADT\, bool = &(\Sigma_{bool}, \E)\\
27 \Sigma_{bool} = &\{true^{(0)}, false^{(0)}, not^{(1)}, and^{(2)}, or^{(2)}\}\\
28 \E = &\{true \approx not(false),\\
29 & not(not(x)) \approx x,\\
30 & or(x, false) \approx x,\\
31 & or(x, true) \approx true,\\
32 & and(x, y) \approx not(or(not(x), not(y)))\}\\
34 Remarks: $false \approx not(true)$ follows from $true \approx not(false)$ and $not(not(x)) \approx x$.\\
35 $or(x, y) \approx not(and(not(x), not(y)))$ follows from $not(not(x)) \approx x$ and $and(x, y) \approx not(or(not(x), not(y)))$.
37 \section*{Exercise 9.1.4}
39 \D_{bool} &= (M, \J)\\
44 \J(and)(x, y) &= min(x, y)\\
45 \J(or)(x, y) &= max(x, y)\\
48 \section*{Exercise 9.2}
50 ADT\, Stack(A) = &(\Sigma_{Stack}, \E)\\
51 \Sigma_{Stack} = &\{new^{(0)}, true^{(0)}, false^{(0)}, pop^{(1)}, top^{(1)}, isEmpty^{(1)}, push^{(2)}\}\\
55 & pop: Stack \to Stack\\
57 & isEmpty: Stack \to bool\\
58 & push: Stack \times A \to Stack\\
59 \E = &\{isEmpty(new) \approx true,\\
60 & isEmpty(push(S, x)) \approx false,\\
61 & top(push(S, x)) \approx x,\\
62 & pop(push(S, x)) \approx S\}\\
64 The ADT $Stack$ has only one constructor $new$.