[FMFP] Mostly finish exercises section

This commit is contained in:
2026-07-14 14:44:07 +02:00
parent 9f80889d40
commit bc1cc816f1
12 changed files with 117 additions and 3 deletions
@@ -0,0 +1,31 @@
\subsection{Induction on Proof Trees}
\label{sec:induction-on-proof-trees}
This type of induction is used to prove that a statement exhibits given behaviour.
Since often, we are not restricted to just simple statements, such where we know that we are applying the $\textsc{Ass}_{\text{NS}}$ rule,
we need to perform case distinction on all possible last rules applied in the derivation tree $T$.
If all are to be proven, this will yield $7$, one for each rule of the big-step semantics.
\inlinedefinition[Subderivation] We define $T' \sqsubset T$, where $T$ is a derivation tree. $T'$ is called a \textit{subderivation} of $T$,
or more simply, a \textit{subtree} of $T$. Definition is analogous to the subterm relation.
\shade{ForestGreen}{Rundown} Below a rundown of how such proofs are expected to be laid out.
We define $P(T) \equiv \forall \sigma, \sigma', s . (\texttt{root}(T) \equiv \text{statement})$.
The quantifier-bound variables / states / statements can of course differ, so adjust accordingly.
This step is the crucial step to setting up this type of induction.
We then prove $\forall T . P(T)$ by strong induction on the shape of the derivation tree $T$.
Thus, for some arbitrary $T$, the induction hypothesis is $\forall T' \sqsubset T . P(T')$ and we prove $P(T)$.
Let $\sigma, \sigma', s$ (and more, if applicable) be arbitrary.
Then, for rules, such as $\textsc{WhT}_{\text{NS}}$, we draw up a derivation tree, like so (from solutions of Exercise Session 11, FS2026):
\begin{center}
\includegraphics[width=0.6\linewidth]{assets/proof-on-shape-of-tree.png}
\end{center}
After it, we need to put final constraints and bind free variables in some way, e.g. here:
For some $b, s', \sigma'', T_4, T_5$, such that $s \equiv \texttt{while}\; b \; \texttt{do} \; s' \; \texttt{end}$ and $\cB \llbracket b \rrbracket \sigma = \texttt{tt}$.
Then use the induction hypothesis on the subderivations $T_i$ and finish the proof by showing the original statement holds under the induction hypothesis.
@@ -0,0 +1,18 @@
\newpage
\subsection{Induction on Derivation Sequence}
A finite derivation sequence has a length $n \in \N$.
We typically reason about finite derivation sequences using \bi{strong induction on the length of a derivation sequence},
i.e. we reason about a multi-step execution $\gamma \rightarrow_1^k \gamma'$ using strong induction on the number of steps $k$.
We define $P(k) \equiv$ ``for all executions of length $k$, our property holds''
We then prove $P(k)$ for arbitrary $k$, with induction hypothesis $\forall k' < k. P(k')$, as is usually the case with induction on natural numbers.
After the setup, the proof \textit{typically} proceeds by case distinction on:
\begin{itemize}
\item $k = 0$ step execution
\item $k > 0$ step execution, by splitting off the first execution (i.e. an execution $\langle s, \sigma \rangle \rightarrow_1^k \sigma''$
can be split up as $\langle s, \sigma \rangle \rightarrow_1^1 \gamma \rightarrow_1^{k - 1} \sigma''$.)
\end{itemize}
In the $k > 0$ case, we can then apply the induction hypothesis. Sometimes a further case distinction can become necessary, depending on the rules that are possible.
For instance, if $s = s_1; s_2$, two rules are possible, \textsc{Seq1} and \textsc{Seq2} from the SOS.