Exercise 8.
1 \documentclass[a4paper, 10pt, pagesize, smallheadings]{article}
3 %\usepackage[latin1]{inputenc}
4 \usepackage{amsmath, amsthm, amssymb}
7 \usepackage{algorithmic}
11 \title{Theory I, Sheet 8 Solution}
13 \renewcommand{\familydefault}{\sfdefault}
14 \newcommand{\Pos}{\mathcal{P}os}
15 \include{pythonlisting}
21 \section*{Exercise 8.1}
22 Let $s, t \in T(\Sigma, X)$ be terms over $X$ and $p, q$ be strings over the natural numbers. We provide proofs by induction.
23 \subsection*{1. $pq \in \Pos(s) \implies p \in \Pos(s)$ }
24 $(IH): pq \in \Pos(t_i) \implies p \in \Pos(t_i)$ for all $0 < i \leq n$\\\\
26 From $s \in X$ or $s \in \Sigma^{(0)}$ follows $\Pos(s) = \{\epsilon\}$.\\
27 Trivially it follows that $pq \in \Pos(s) \iff pq = \epsilon$ and $pq \in \Pos(s) \implies p \in \Pos(s)$ with $pq \notin \Pos(s)$ or $pq = p = \epsilon$. \\
29 \noindent \emph{Inductive case:}\\
30 Let $s = f(t_1, ...,t_n) \in T(\Sigma, X)$ it follows $\Pos(s) = \{\epsilon\} \cup \bigcup_{i = 1}^{n}\{ip \mid p \in \Pos(t_i)\}$.\\
32 pq \in \Pos(s) &\implies p \in \Pos(s)\\
33 \iff pqr \in \Pos(f(t_1,...,t_n)) &\implies pr \in \Pos(f(t_1,...,t_n))\\
34 \iff pqr \in \{\epsilon\} \cup \bigcup_{i = 1}^{n}\{im \mid m \in \Pos(t_i)\} &\implies pq \in \{\epsilon\} \cup \bigcup_{i = 1}^{n}\{im \mid m \in \Pos(t_i)\}\\
36 By (IH) we know that $qr \in \Pos(t_i) \implies r \in \Pos(t_i)$ for all $i \leq n$ and by the left concatenation of $p$ for $0 < p \leq n$ it holds that $pqr \in \Pos(f(t_1,...,t_n)) \implies pq \in \Pos(f(t_1,...,t_n))$. \\ \qed
38 \subsection*{2. $pq \in \Pos(s) \implies s|_{pq} = (s|_p)|_q$ }
39 $(IH): pq \in \Pos(t_i) \implies t_i|_{pq} = (t_i|_p)|_q$ for all $0 < i \leq n$\\\\
41 From $s \in X$ or $s \in \Sigma^{(0)}$ follows $\Pos(s) = \{\epsilon\}$.\\
42 Trivially it follows that $pq \in \Pos(s) \iff pq = q = \epsilon$ and $pq \in \Pos(s) \implies s|_{pq} = (s|_p)|_q$ with $pq \notin \Pos(s)$ or $pq = p = \epsilon$ with $s_{pq} = s = s|_p = (s|_p)|_q$.\\
44 \noindent \emph{Inductive case:}\\
45 Let $s = f(t_1, ...,t_n) \in T(\Sigma, X)$ it follows $\Pos(s) = \{\epsilon\} \cup \bigcup_{i = 1}^{n}\{ip \mid p \in \Pos(t_i)\}$.\\
46 By definition we know $f(t_1, ...,t_n)|_{pqr} = t_p|_{qr}$ and from $(IH)$ it follows that $t_p|_{qr} = (t_p|_q)|_r$. \\ \qed
48 \subsection*{3. $p \in \Pos(s) \land q \in \Pos(t) \implies (s[t]_p)|_{pq} = t|_q$ }
49 $(IH): p \in \Pos(t_i) \land q \in \Pos(k_j) \implies (t_i[k_j]_p)|_{pq} = k_j|_q$ for all $0 < i \leq n, 0 < j \leq m$\\\\
51 From $s,t \in X$ or $s,t \in \Sigma^{(0)}$ follows $\Pos(s) = \Pos(t) = \{\epsilon\}$.\\
52 Trivially it follows that $p \in \Pos(s) \land q \in \Pos(t) \iff p = q = \epsilon$ and $p \in \Pos(s) \land q \in \Pos(t) \implies (s[t]_p)|_{pq} = t|_q$ with $p \notin \Pos(s) \lor q \notin \Pos(t)$ or $p = q = \epsilon$ with $s[t]_p = (s[t]_p)|_{pq} = t|_q = \epsilon$.\\
54 \noindent \emph{Inductive case:}\\
55 Let $s = f(t_1, ...,t_n), t = g(k_1, ...,k_m) \in T(\Sigma, X)$.\\
56 By definition we know that $f(t_1, ...,t_n)[g(k_1, ...,k_m)]_{p} = f(t_1, ...t_p[g(k_1, ...,k_m)]_\epsilon, ..t_n) = f(t_1, ...g(k_1, ...,k_m), ..t_n)$ and from $(IH)$ follows that $f(t_1, ...g(k_1, ...,k_m), ..t_n)|_{pq} = g(k_1, ...,k_m)|_q = k_q = t|_q$. \\ \qed
58 \section*{Exercise 8.2}
59 We use symbols $\top, \bot$ for $T, F$ respectively.
61 \subsection*{1. $t = \neg (x \land (\top \lor y)), \sigma = \{x \mapsto \bot, y \mapsto \top \land x\}, \tau = \{z \mapsto \top, x \mapsto \top\}$}
63 \sigma(t) &= \neg (\bot \land (\top \lor ( \top \land x)))\\
64 \tau \sigma(t) &= \tau(\neg (\bot \land (\top \lor ( \top \land x)))) = \neg (\bot \land (\top \lor (\top \land \top)))\\
67 \subsection*{2. $t = \neg(\top \land (\bot \lor y)), s = \neg(x \land (\bot \lor (x \land \bot)))$}
68 \[\sigma(t) = \sigma(s) \text{ with } \sigma = \{x \mapsto \top, y \mapsto \top \land \bot \} \]
71 Substitution composition is \emph{not} commutative, we give a counterexample.
72 Let $t = x$, $\sigma = \{x \mapsto \bot\}$ and $\tau = \{x \mapsto \top\}$, it follows:
73 \[\tau\sigma(t) = \bot\]
74 \[\sigma\tau(t) = \top\]
75 We see that $\tau\sigma(t) \neq \sigma\tau(t)$.