mirror of
https://github.com/janishutz/eth-summaries.git
synced 2026-07-27 21:29:09 +02:00
[FMFP] Restructure summary
This commit is contained in:
Binary file not shown.
@@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
\setup{Formal Methods \& Functional Programming}
|
\setup{Formal Methods \& Functional Programming}
|
||||||
|
|
||||||
|
% ────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
\begin{document}
|
\begin{document}
|
||||||
\startDocument
|
\startDocument
|
||||||
|
|
||||||
@@ -59,6 +61,8 @@
|
|||||||
\newpage
|
\newpage
|
||||||
\printtoc{Aquamarine}
|
\printtoc{Aquamarine}
|
||||||
|
|
||||||
|
% TODO: Strong and weak structural induction and more
|
||||||
|
|
||||||
|
|
||||||
\newsection
|
\newsection
|
||||||
\section{Haskell}
|
\section{Haskell}
|
||||||
@@ -66,85 +70,90 @@
|
|||||||
\input{parts/00_haskell/01_syntax.tex}
|
\input{parts/00_haskell/01_syntax.tex}
|
||||||
|
|
||||||
|
|
||||||
|
\newsection
|
||||||
|
\section{Induction Proofs}
|
||||||
|
\input{parts/01_induction-proofs/00_intro.tex}
|
||||||
|
\input{parts/01_induction-proofs/01_mathematical-induction.tex}
|
||||||
|
\input{parts/01_induction-proofs/02_structural-induction.tex}
|
||||||
|
% \input{parts/01_induction-proofs/}
|
||||||
|
|
||||||
\newsection
|
\newsection
|
||||||
\section{Formal Reasoning}
|
\section{Formal Reasoning}
|
||||||
\input{parts/01_formal-reasoning/00_formal-proofs.tex}
|
\input{parts/02_formal-reasoning/00_formal-proofs.tex}
|
||||||
\input{parts/01_formal-reasoning/01_natural-deduction.tex}
|
\input{parts/02_formal-reasoning/01_natural-deduction.tex}
|
||||||
\input{parts/01_formal-reasoning/02_propositional-logic/00_syntax.tex}
|
\input{parts/02_formal-reasoning/02_propositional-logic/00_syntax.tex}
|
||||||
\input{parts/01_formal-reasoning/02_propositional-logic/01_semantics.tex}
|
\input{parts/02_formal-reasoning/02_propositional-logic/01_semantics.tex}
|
||||||
\input{parts/01_formal-reasoning/02_propositional-logic/02_deductive-system.tex}
|
\input{parts/02_formal-reasoning/02_propositional-logic/02_deductive-system.tex}
|
||||||
\input{parts/01_formal-reasoning/02_propositional-logic/03_natural-deduction-prop-logic.tex}
|
\input{parts/02_formal-reasoning/02_propositional-logic/03_natural-deduction-prop-logic.tex}
|
||||||
\input{parts/01_formal-reasoning/02_propositional-logic/04_derivation-rules-overview.tex}
|
\input{parts/02_formal-reasoning/02_propositional-logic/04_derivation-rules-overview.tex}
|
||||||
\input{parts/01_formal-reasoning/03_first-order-logic/00_syntax.tex}
|
\input{parts/02_formal-reasoning/03_first-order-logic/00_syntax.tex}
|
||||||
\input{parts/01_formal-reasoning/03_first-order-logic/01_semantics.tex}
|
\input{parts/02_formal-reasoning/03_first-order-logic/01_semantics.tex}
|
||||||
\input{parts/01_formal-reasoning/03_first-order-logic/02_quantifiers.tex}
|
\input{parts/02_formal-reasoning/03_first-order-logic/02_quantifiers.tex}
|
||||||
\input{parts/01_formal-reasoning/04_equality.tex}
|
\input{parts/02_formal-reasoning/04_equality.tex}
|
||||||
\input{parts/01_formal-reasoning/05_correctness/00_intro.tex}
|
\input{parts/02_formal-reasoning/05_correctness/00_intro.tex}
|
||||||
\input{parts/01_formal-reasoning/05_correctness/01_termination.tex}
|
\input{parts/02_formal-reasoning/05_correctness/01_termination.tex}
|
||||||
\input{parts/01_formal-reasoning/05_correctness/02_behaviour.tex}
|
\input{parts/02_formal-reasoning/05_correctness/02_behaviour.tex}
|
||||||
\input{parts/01_formal-reasoning/05_correctness/03_induction.tex}
|
% \input{parts/02_formal-reasoning/05_correctness/}
|
||||||
% \input{parts/01_formal-reasoning/05_correctness/}
|
% \input{parts/02_formal-reasoning/}
|
||||||
% \input{parts/01_formal-reasoning/}
|
|
||||||
|
|
||||||
|
|
||||||
\newsection
|
\newsection
|
||||||
\section{Typing}
|
\section{Typing}
|
||||||
\input{parts/02_typing/00_intro.tex}
|
\input{parts/03_typing/00_intro.tex}
|
||||||
\input{parts/02_typing/01_mini-haskell/00_syntax.tex}
|
\input{parts/03_typing/01_mini-haskell/00_syntax.tex}
|
||||||
\input{parts/02_typing/01_mini-haskell/01_lambda-calculus.tex}
|
\input{parts/03_typing/01_mini-haskell/01_lambda-calculus.tex}
|
||||||
\input{parts/02_typing/01_mini-haskell/02_further-rules.tex}
|
\input{parts/03_typing/01_mini-haskell/02_further-rules.tex}
|
||||||
\input{parts/02_typing/01_mini-haskell/03_type-inference.tex}
|
\input{parts/03_typing/01_mini-haskell/03_type-inference.tex}
|
||||||
\input{parts/02_typing/02_algebraic-data-types/00_correctness.tex}
|
\input{parts/03_typing/02_algebraic-data-types/00_correctness.tex}
|
||||||
\input{parts/02_typing/02_algebraic-data-types/01_induction-nat-num.tex}
|
\input{parts/03_typing/02_algebraic-data-types/01_induction-nat-num.tex}
|
||||||
\input{parts/02_typing/02_algebraic-data-types/02_lists.tex}
|
\input{parts/03_typing/02_algebraic-data-types/02_lists.tex}
|
||||||
\input{parts/02_typing/02_algebraic-data-types/03_trees.tex}
|
\input{parts/03_typing/02_algebraic-data-types/03_trees.tex}
|
||||||
\input{parts/02_typing/02_algebraic-data-types/04_structural-induction.tex}
|
\input{parts/03_typing/03_interpreter/00_intro.tex}
|
||||||
\input{parts/02_typing/03_interpreter/00_intro.tex}
|
\input{parts/03_typing/03_interpreter/01_read.tex}
|
||||||
\input{parts/02_typing/03_interpreter/01_read.tex}
|
\input{parts/03_typing/03_interpreter/02_eval.tex}
|
||||||
\input{parts/02_typing/03_interpreter/02_eval.tex}
|
% \input{parts/03_typing/03_interpreter/}
|
||||||
% \input{parts/02_typing/03_interpreter/}
|
|
||||||
|
|
||||||
|
|
||||||
\newsection
|
\newsection
|
||||||
\section{Language Semantics}
|
\section{Language Semantics}
|
||||||
\input{parts/03_language-semantics/00_imp/00_syntax.tex}
|
\input{parts/04_language-semantics/00_imp/00_syntax.tex}
|
||||||
\input{parts/03_language-semantics/00_imp/01_semantics.tex}
|
\input{parts/04_language-semantics/00_imp/01_semantics.tex}
|
||||||
\input{parts/03_language-semantics/00_imp/02_properties.tex}
|
\input{parts/04_language-semantics/00_imp/02_properties.tex}
|
||||||
\input{parts/03_language-semantics/01_operational-semantics/00_big-step-semantics/00_transition-systems.tex}
|
\input{parts/04_language-semantics/01_operational-semantics/00_big-step-semantics/00_transition-systems.tex}
|
||||||
\input{parts/03_language-semantics/01_operational-semantics/00_big-step-semantics/01_semantics.tex}
|
\input{parts/04_language-semantics/01_operational-semantics/00_big-step-semantics/01_semantics.tex}
|
||||||
\input{parts/03_language-semantics/01_operational-semantics/00_big-step-semantics/02_instantiations.tex}
|
\input{parts/04_language-semantics/01_operational-semantics/00_big-step-semantics/02_instantiations.tex}
|
||||||
\input{parts/03_language-semantics/01_operational-semantics/00_big-step-semantics/03_termination.tex}
|
\input{parts/04_language-semantics/01_operational-semantics/00_big-step-semantics/03_termination.tex}
|
||||||
\input{parts/03_language-semantics/01_operational-semantics/00_big-step-semantics/04_semantic-equivalence.tex}
|
\input{parts/04_language-semantics/01_operational-semantics/00_big-step-semantics/04_semantic-equivalence.tex}
|
||||||
\input{parts/03_language-semantics/01_operational-semantics/00_big-step-semantics/05_unfolding-loops.tex}
|
\input{parts/04_language-semantics/01_operational-semantics/00_big-step-semantics/05_unfolding-loops.tex}
|
||||||
\input{parts/03_language-semantics/01_operational-semantics/00_big-step-semantics/06_deterministic-semantics.tex}
|
\input{parts/04_language-semantics/01_operational-semantics/00_big-step-semantics/06_deterministic-semantics.tex}
|
||||||
\input{parts/03_language-semantics/01_operational-semantics/00_big-step-semantics/07_extensions-of-imp.tex}
|
\input{parts/04_language-semantics/01_operational-semantics/00_big-step-semantics/07_extensions-of-imp.tex}
|
||||||
\input{parts/03_language-semantics/01_operational-semantics/01_small-step-semantics/00_structural-operational-semantics.tex}
|
\input{parts/04_language-semantics/01_operational-semantics/01_small-step-semantics/00_structural-operational-semantics.tex}
|
||||||
\input{parts/03_language-semantics/01_operational-semantics/01_small-step-semantics/01_rules.tex}
|
\input{parts/04_language-semantics/01_operational-semantics/01_small-step-semantics/01_rules.tex}
|
||||||
\input{parts/03_language-semantics/01_operational-semantics/01_small-step-semantics/02_multi-step-derivation-seq.tex}
|
\input{parts/04_language-semantics/01_operational-semantics/01_small-step-semantics/02_multi-step-derivation-seq.tex}
|
||||||
\input{parts/03_language-semantics/01_operational-semantics/01_small-step-semantics/03_termintation.tex}
|
\input{parts/04_language-semantics/01_operational-semantics/01_small-step-semantics/03_termintation.tex}
|
||||||
\input{parts/03_language-semantics/01_operational-semantics/01_small-step-semantics/04_proofs.tex}
|
\input{parts/04_language-semantics/01_operational-semantics/01_small-step-semantics/04_proofs.tex}
|
||||||
\input{parts/03_language-semantics/01_operational-semantics/01_small-step-semantics/05_semantic-equivalence.tex}
|
\input{parts/04_language-semantics/01_operational-semantics/01_small-step-semantics/05_semantic-equivalence.tex}
|
||||||
\input{parts/03_language-semantics/01_operational-semantics/01_small-step-semantics/06_extensions.tex}
|
\input{parts/04_language-semantics/01_operational-semantics/01_small-step-semantics/06_extensions.tex}
|
||||||
\input{parts/03_language-semantics/01_operational-semantics/02_equiv.tex}
|
\input{parts/04_language-semantics/01_operational-semantics/02_equiv.tex}
|
||||||
\input{parts/03_language-semantics/01_operational-semantics/03_rules-summary.tex}
|
\input{parts/04_language-semantics/01_operational-semantics/03_rules-summary.tex}
|
||||||
\input{parts/03_language-semantics/02_axiomatic-semantics/00_intro.tex}
|
\input{parts/04_language-semantics/02_axiomatic-semantics/00_intro.tex}
|
||||||
\input{parts/03_language-semantics/02_axiomatic-semantics/01_hoare-logic/00_triples-assertions.tex}
|
\input{parts/04_language-semantics/02_axiomatic-semantics/01_hoare-logic/00_triples-assertions.tex}
|
||||||
\input{parts/03_language-semantics/02_axiomatic-semantics/01_hoare-logic/01_derivation-systems.tex}
|
\input{parts/04_language-semantics/02_axiomatic-semantics/01_hoare-logic/01_derivation-systems.tex}
|
||||||
\input{parts/03_language-semantics/02_axiomatic-semantics/01_hoare-logic/02_total-correctness.tex}
|
\input{parts/04_language-semantics/02_axiomatic-semantics/01_hoare-logic/02_total-correctness.tex}
|
||||||
\input{parts/03_language-semantics/02_axiomatic-semantics/02_soundness-completeness.tex}
|
\input{parts/04_language-semantics/02_axiomatic-semantics/02_soundness-completeness.tex}
|
||||||
% \input{parts/03_language-semantics/}
|
% \input{parts/04_language-semantics/}
|
||||||
|
|
||||||
\newsection
|
\newsection
|
||||||
\section{Modelling}
|
\section{Modelling}
|
||||||
\input{parts/04_modelling/00_intro.tex}
|
\input{parts/05_modelling/00_intro.tex}
|
||||||
\input{parts/04_modelling/01_promela/00_syntax.tex}
|
\input{parts/05_modelling/01_promela/00_syntax.tex}
|
||||||
\input{parts/04_modelling/01_promela/01_expressions.tex}
|
\input{parts/05_modelling/01_promela/01_expressions.tex}
|
||||||
\input{parts/04_modelling/01_promela/02_statements.tex}
|
\input{parts/05_modelling/01_promela/02_statements.tex}
|
||||||
\input{parts/04_modelling/01_promela/03_macros.tex}
|
\input{parts/05_modelling/01_promela/03_macros.tex}
|
||||||
\input{parts/04_modelling/02_linear-temporal-logic/00_linear-time-properties.tex}
|
\input{parts/05_modelling/02_linear-temporal-logic/00_linear-time-properties.tex}
|
||||||
\input{parts/04_modelling/02_linear-temporal-logic/01_linear-temporal-logic.tex}
|
\input{parts/05_modelling/02_linear-temporal-logic/01_linear-temporal-logic.tex}
|
||||||
% \input{parts/04_modelling/02_linear-temporal-logic/}
|
% \input{parts/05_modelling/02_linear-temporal-logic/}
|
||||||
% \input{parts/04_modelling/}
|
% \input{parts/05_modelling/}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
\subsubsection{Induction}
|
|
||||||
To prove recursive formulas, or more precisely formulated, a formula $P$ (with free variable $n$) for all $n \in \N$,
|
|
||||||
we can't really do a proof by cases, as there are infinitely many cases (one for each input).
|
|
||||||
Thus: We can use induction to prove recursive formulas or functions.
|
|
||||||
|
|
||||||
|
|
||||||
\paragraph{The schema}
|
|
||||||
To prove $\forall n \in \N. P$ (with $n$ free in $P$), we do the following:
|
|
||||||
|
|
||||||
\shade{blue}{Base case} We show that $P[n \mapsto 0]$ is correct
|
|
||||||
|
|
||||||
\shade{green}{Step case} For an arbitrary $m$ not free in $P$, we show that $P[n \mapsto m + 1]$ is correct under the assumption that $P[n \mapsto m]$ is correct.
|
|
||||||
|
|
||||||
For \bi{well-founded} domains, we have to adjust the induction hypothesis slightly: We assume $\forall l \in \N. l < m \rightarrow P[n \mapsto l]$
|
|
||||||
and then prove $P[n \mapsto m]$ under our assumption.
|
|
||||||
|
|
||||||
|
|
||||||
\paragraph{Induction over Lists}
|
|
||||||
To prove $P$ for all $xs$ in \texttt{[T]}, we do the following:
|
|
||||||
|
|
||||||
\shade{blue}{Base case} We prove that $P[xs \mapsto []]$ is correct
|
|
||||||
|
|
||||||
\shade{green}{Step case} We prove that $\forall y :: T, ys :: [T]. P[xs \mapsto ys] \rightarrow P[xs \mapsto y : ys]$, or in other words:
|
|
||||||
We fix arbitrary $y :: T$ and $ys :: [T]$, which both are not free in $P$.
|
|
||||||
We then apply our induction hypothesis $P[xs \mapsto ys]$ to prove $P[xs \mapsto y : ys]$
|
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
To prove recursive formulas, or more precisely formulated, a formula $P$ (with free variable $n$) for all $n \in \N$,
|
||||||
|
we have can use weak or strong induction.
|
||||||
|
Weak induction may be a \textit{slightly} misleading term, because it isn't necessarily weaker than strong induction.
|
||||||
|
|
||||||
|
This section has been moved to the very start of the theory part, even though many of the topics mentioned have not been covered in the summary yet,
|
||||||
|
such that all the induction proofs can be covered in the same place.
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
\subsection{Mathematical Induction}
|
||||||
|
{\small NOTE: These types of induction were (primarily) mentioned in the Formal Methods part of the course, but made most sense to be put here}
|
||||||
|
|
||||||
|
\subsubsection{Weak Mathematical Induction}
|
||||||
|
To prove $\forall n \in \N. P$ (with $n$ free in $P$), we do the following:
|
||||||
|
|
||||||
|
\shade{blue}{Base case} We show that $P[n \mapsto 0]$ is correct
|
||||||
|
|
||||||
|
\shade{green}{Step case} For an arbitrary $m$ not free in $P$, we show that $P[n \mapsto m + 1]$ is correct under the assumption that $P[n \mapsto m]$ is correct.
|
||||||
|
|
||||||
|
For \bi{well-founded} domains, we have to adjust the induction hypothesis slightly: We assume $\forall l \in \N. l < m \rightarrow P[n \mapsto l]$
|
||||||
|
and then prove $P[n \mapsto m]$ under our assumption.
|
||||||
|
|
||||||
|
The same, but expressed as a Natural Deduction rule:
|
||||||
|
\[
|
||||||
|
\begin{prooftree}
|
||||||
|
\hypo{\Gamma \vdash P(0)}
|
||||||
|
\hypo{\Gamma, P(n) \vdash P(n + 1)}
|
||||||
|
\infer2{\Gamma \vdash \forall n. P(n)}
|
||||||
|
\end{prooftree}
|
||||||
|
\]
|
||||||
|
|
||||||
|
|
||||||
|
\subsubsection{Strong Mathematical Induction}
|
||||||
+2
-1
@@ -1,4 +1,5 @@
|
|||||||
\subsubsection{Structural Induction}
|
\subsection{Structural Induction}
|
||||||
|
\subsubsection{Weak Structural Induction}
|
||||||
Induction is based on the structure of terms
|
Induction is based on the structure of terms
|
||||||
\mint{haskell}+data T t = Leaf t | Node1 (T t) | Node2 t (T t) (T t)+
|
\mint{haskell}+data T t = Leaf t | Node1 (T t) | Node2 t (T t) (T t)+
|
||||||
|
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
\subsection{Other types of induction}
|
||||||
|
\subsubsection{Induction over Lists}
|
||||||
|
To prove $P$ for all $xs$ in \texttt{[T]}, we do the following:
|
||||||
|
|
||||||
|
\shade{blue}{Base case} We prove that $P[xs \mapsto []]$ is correct
|
||||||
|
|
||||||
|
\shade{green}{Step case} We prove that $\forall y :: T, ys :: [T]. P[xs \mapsto ys] \rightarrow P[xs \mapsto y : ys]$, or in other words:
|
||||||
|
We fix arbitrary $y :: T$ and $ys :: [T]$, which both are not free in $P$.
|
||||||
|
We then apply our induction hypothesis $P[xs \mapsto ys]$ to prove $P[xs \mapsto y : ys]$
|
||||||
|
|
||||||
|
|
||||||
+1
-1
@@ -41,4 +41,4 @@ We then show that the function is correct for both cases (i.e. LHS and RHS of OR
|
|||||||
\end{enumerate}
|
\end{enumerate}
|
||||||
In this proof we used the \textbf{TND} and \textbf{$\lor$-E} (here also called \bi{Case Split}) rules.
|
In this proof we used the \textbf{TND} and \textbf{$\lor$-E} (here also called \bi{Case Split}) rules.
|
||||||
|
|
||||||
So what we have to show, given $Q \lor R$ for any proposition $P$ with case split is that \bi{(1)} $P$ follows from $Q$ and \bi{(2)} $P$ follows from $R$
|
What we have to show, given $Q \lor R$ for any proposition $P$ with case split, is that \bi{(1)} $P$ follows from $Q$ and \bi{(2)} $P$ follows from $R$
|
||||||
+2
-1
@@ -1,3 +1,4 @@
|
|||||||
|
\newpage
|
||||||
\subsubsection{The semantics}
|
\subsubsection{The semantics}
|
||||||
\paragraph{Numerals}
|
\paragraph{Numerals}
|
||||||
The semantic function $\cN : \texttt{Numeral} \rightarrow \texttt{Val}$ maps a numeral $n$ to an integer value $\cN\llbracket n \rrbracket$,
|
The semantic function $\cN : \texttt{Numeral} \rightarrow \texttt{Val}$ maps a numeral $n$ to an integer value $\cN\llbracket n \rrbracket$,
|
||||||
@@ -27,7 +28,7 @@ $\cA : \texttt{Aexp} \rightarrow \texttt{State} \rightarrow \texttt{Val}$ maps a
|
|||||||
given by:
|
given by:
|
||||||
\begin{align*}
|
\begin{align*}
|
||||||
\cA\llbracket x \rrbracket \sigma & = \sigma(x) \\
|
\cA\llbracket x \rrbracket \sigma & = \sigma(x) \\
|
||||||
\cA\llbracket n \rrbracket \sigma & = \cN\llbracket x \rrbracket \\
|
\cA\llbracket n \rrbracket \sigma & = \cN\llbracket n \rrbracket \\
|
||||||
\cA\llbracket e_1 \; \texttt{op} \; e_2 \rrbracket \sigma & = \cA\llbracket e_1 \rrbracket \sigma \; \overline{\texttt{op}} \; \cA\llbracket e_2 \rrbracket \sigma
|
\cA\llbracket e_1 \; \texttt{op} \; e_2 \rrbracket \sigma & = \cA\llbracket e_1 \rrbracket \sigma \; \overline{\texttt{op}} \; \cA\llbracket e_2 \rrbracket \sigma
|
||||||
\end{align*}
|
\end{align*}
|
||||||
For $\texttt{op} \in \texttt{Op}$, $\overline{\texttt{op}}$ is the corresponding operation $\texttt{Val} \times \texttt{Val} \rightarrow \texttt{Val}$
|
For $\texttt{op} \in \texttt{Op}$, $\overline{\texttt{op}}$ is the corresponding operation $\texttt{Val} \times \texttt{Val} \rightarrow \texttt{Val}$
|
||||||
+2
-3
@@ -24,7 +24,6 @@ If on the other hand we define $\cA\llbracket -e \rrbracket \sigma = \cA\llbrack
|
|||||||
it is \textit{not} an inductive definition because $0 - e$ is \textit{not} a subterm of $-e$
|
it is \textit{not} an inductive definition because $0 - e$ is \textit{not} a subterm of $-e$
|
||||||
|
|
||||||
|
|
||||||
\newpage
|
|
||||||
\paragraph{Free Variables}
|
\paragraph{Free Variables}
|
||||||
For Arithmetic Expressions
|
For Arithmetic Expressions
|
||||||
\begin{align*}
|
\begin{align*}
|
||||||
@@ -36,7 +35,7 @@ For Arithmetic Expressions
|
|||||||
For Boolean Expressions
|
For Boolean Expressions
|
||||||
\begin{align*}
|
\begin{align*}
|
||||||
FV(b_1 \; \texttt{op} \; b_2) & = FV(b_1) \cup FV(b_2) \\
|
FV(b_1 \; \texttt{op} \; b_2) & = FV(b_1) \cup FV(b_2) \\
|
||||||
FV(\texttt{not} b) & = FV(b) \\
|
FV(\texttt{not}\; b) & = FV(b) \\
|
||||||
FV(b_1 \; \texttt{or} \; b_2) & = FV(b_1) \cup FV(b_2) \\
|
FV(b_1 \; \texttt{or} \; b_2) & = FV(b_1) \cup FV(b_2) \\
|
||||||
FV(b_1 \; \texttt{and} \; b_2) & = FV(b_1) \cup FV(b_2)
|
FV(b_1 \; \texttt{and} \; b_2) & = FV(b_1) \cup FV(b_2)
|
||||||
\end{align*}
|
\end{align*}
|
||||||
@@ -56,7 +55,7 @@ And finally for Statements:
|
|||||||
|
|
||||||
A substitution $f[x \mapsto e]$ replaces each free occurrence of variable $x$ in $f$ by $e$, where $f$ is any expression.
|
A substitution $f[x \mapsto e]$ replaces each free occurrence of variable $x$ in $f$ by $e$, where $f$ is any expression.
|
||||||
|
|
||||||
Detailed rules for arithmetic expressions:
|
Detailed rules for arithmetic expressions (for the last, if variable $y$ is $x$, it is replaced, otherwise not):
|
||||||
\begin{align*}
|
\begin{align*}
|
||||||
(e_1 \; \texttt{op} \; e_2)[x \mapsto e] & \equiv (e_1[x \mapsto e] \; \texttt{op} \; e_2[x \mapsto e]) \\
|
(e_1 \; \texttt{op} \; e_2)[x \mapsto e] & \equiv (e_1[x \mapsto e] \; \texttt{op} \; e_2[x \mapsto e]) \\
|
||||||
n[x \mapsto e] & \equiv n \\
|
n[x \mapsto e] & \equiv n \\
|
||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
\newpage
|
\newpage
|
||||||
\subsection{Operational Semantics}
|
\subsection{Operational Semantics}
|
||||||
Big-step semantics describe how the \bi{overall} results of the execution are obtained and use Natural semantics rules.
|
\textbf{Big-step semantics} describe how the \bi{overall} results of the execution are obtained and use Natural semantics rules.
|
||||||
Small-step semantics describe how the individual steps of the computations take place and use Structural Operational Semantics (SOS)
|
\textbf{Small-step semantics} describe how the individual steps of the computations take place and use Structural Operational Semantics (SOS)
|
||||||
|
|
||||||
\subsubsection{Big-Step Semantics}
|
\subsubsection{Big-Step Semantics}
|
||||||
\paragraph{Transition Systems}
|
\paragraph{Transition Systems}
|
||||||
+2
-2
@@ -2,8 +2,8 @@
|
|||||||
Each inference rule is actually a rule scheme, where the meta-variables are placeholders for statements, states, etc.
|
Each inference rule is actually a rule scheme, where the meta-variables are placeholders for statements, states, etc.
|
||||||
Each rule scheme describes infinitely many \bi{rule instances}.
|
Each rule scheme describes infinitely many \bi{rule instances}.
|
||||||
|
|
||||||
A rule is \bi{instantiated} when all meta-variables are replaced with syntactic elements
|
A rule is \bi{instantiated} when all meta-variables are replaced with syntactic elements.
|
||||||
Assignment rule scheme vs. instance
|
Assignment rule scheme vs. instance:
|
||||||
\[
|
\[
|
||||||
\begin{prooftree}
|
\begin{prooftree}
|
||||||
\infer0[\textsc{Ass}$_{NS}$]{\langle x := e, \sigma \rangle \rightarrow \sigma[x \mapsto \cA\llbracket e \rrbracket \sigma]}
|
\infer0[\textsc{Ass}$_{NS}$]{\langle x := e, \sigma \rangle \rightarrow \sigma[x \mapsto \cA\llbracket e \rrbracket \sigma]}
|
||||||
Reference in New Issue
Block a user