\documentclass[a4paper]{scrartcl}

\usepackage[backend=biber,natbib]{biblatex}
\bibliography{library}

\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}
\newtheorem{definition}{Definition}
\usepackage{mathtools}
\usepackage{mdframed}
\usepackage{tikz}
\usetikzlibrary{automata,positioning}

\newcommand{\defeq}{\overset{\text{def}}{=}}
\newcommand{\Uop}{\mathbf{U}}
\newcommand{\Xop}{\mathbf{X}}
\newcommand{\Sop}{\mathbf{S}}
\newcommand{\Fop}{\mathbf{F}}
\newcommand{\Gop}{\mathbf{G}}

\title{Model Checking}
\subtitle{Assignment 1}
\author{Camil Staps \and Erin van der Veen}

\begin{document}

\maketitle

\section{Past Modalities in LTL}
% Explain that past Modalities are not necessary for a complete logic
% Explain that LTLP does make the logic more succinct (Paper 1)
%TODO: Give example on what kind of things we want to express with LTLP
This section of the book concerns an extension of LTL called ``Past Modalities''.
The combination of LTL and Past Modalities is often called ``LTL-Past'' or LTLP,
for the sake of brevity (and without compromising readability) we will use the first (LTL-Past) to denote this combination.
When temporal logic was first introduced by Arthur N. Prior in his 1957 book~\cite{Prior1957},
the logic consisted of both past and future modalities.
It wasn't until later, after it was shown that past modalities do not increase the expressive power of LTL~\cite{Gabbay1980},
that computing scientists stopped considering past modalities in favour of minimality.

In 2003 Nicolas Markey showed that, while past modalities do not increase expressive power,
they do make the LTL exponentially more succinct~\cite{Markey2003}.
In particular, Markey shows that there is a class of LTL-Past formulas that are $O(n)$,
but $\Omega(2^n)$ in LTL.
Markey achieves this proof by providing an formula that is in exactly this class.

\subsection{Syntax and Semantics}
% Provide formal syntax
% Provide intuitive semantics
%TODO: Provide formal semantics
This subsection describes the syntax and semantics of LTLP.
Given that LTLP is an extension of LTL, we are left with two options.
The first options is to define the entire syntax of LTLP without considering that we have already defined LTL.
This options is slightly more verbose, but does ensure that this subsection does not depend on the subsection 5.1.1.
The second option builds on the syntax and semantics that were already defined for LTL formulae.
It is this option that we will use for this book, since it allows us to focus exclusively on the past modalities that are the focus of this section.

\subsubsection{Syntax}
\begin{definition}
	LTLP formulae over the set $LTL$ of LTL formulae are formed according to the following grammar:
	$$\phi ::= l \mid \phi_1 \Sop \phi_2 \mid \Xop^{-1} \phi$$
	where $l \in LTL$.
\end{definition}

In this grammar, $\Sop$ is the ``since'' operator and $\Xop^{-1}$ is the ``previous'' operator.
Intuitively, the since operator defines that the second proposition must have occurred continuously since the first occurred.
The previous operator defines that a proposition must have occurred in the previous state.

Like we did in LTL, we can also derive additional operators in LTLP:
\begin{definition}
	Given $\phi \in LTLP$, then\footnote{Note that we assume that the LTL formulas are also extended as given in subsection 5.1.1}:
	\begin{align*}
		%\Fop \phi &\defeq \top \Uop \phi\\
		%\Gop \phi &\defeq \neg \Fop \neg \phi\\
		\Fop^{-1} \phi &\defeq \top \Sop \phi\\
		\Gop^{-1} \phi &\defeq \neg \Fop^{-1} \neg \phi
	\end{align*}
\end{definition}

As a result, we can derive the following intuitive meaning for $\Fop^{-1}$ and $\Gop^{-1}$.
$\Fop^{-1} \phi$ ensures that at some point in the past $\phi$ was true.
$\Gop^{-1} \phi$ is satisfied only if it is not true that $\phi$ didn't hold in the past.
This is equivalent to the fact that $\phi$ held globally until this point.

Figure \ref{fig:LTLP_intuitive} shows the intuitive meanings of the past modalities for the simple case where $a$ and $b$ are the only atomic propositions.
The left hand side of the figure shows some LTLP formulae,
the right hand side shows sequences for which this formula trivially holds.
Since we need to also consider the past,
we include an arrow that points to the state for which the formula holds.

\begin{figure}
	\centering
	$a \Sop b$
	\begin{tikzpicture}[shorten >=1pt,node distance=2cm,on grid,initial text={},baseline=-0.5ex]
		\node                                          (0)                {\dots};
		\node[state,label=arbitrary,minimum size=15pt] (1) [right of = 0] {};
		\node[state,label=$b$      ,minimum size=15pt] (2) [right of = 1] {};
		\node[state,label=$a$      ,minimum size=15pt] (3) [right of = 2] {};
		\node[state,label=$a$      ,minimum size=15pt,initial below] (4) [right of = 3] {};
		\node[state,label=arbitrary,minimum size=15pt] (5) [right of = 4] {};
		\node                                          (6) [right of = 5] {\dots};
		\path[->] (0) edge (1) (1) edge (2)(2) edge (3)(3) edge (4)(4) edge (5)(5) edge (6);
	\end{tikzpicture}\\
	$\Xop^{-1} a$
	\begin{tikzpicture}[shorten >=1pt,node distance=2cm,on grid,initial text={},baseline=-0.5ex]
		\node                                          (0)                {\dots};
		\node[state,label=arbitrary,minimum size=15pt] (1) [right of = 0] {};
		\node[state,label=arbitrary,minimum size=15pt] (2) [right of = 1] {};
		\node[state,label=$a$      ,minimum size=15pt] (3) [right of = 2] {};
		\node[state,label=arbitrary,minimum size=15pt,initial below] (4) [right of = 3] {};
		\node[state,label=arbitrary,minimum size=15pt] (5) [right of = 4] {};
		\node                                          (6) [right of = 5] {\dots};
		\path[->] (0) edge (1) (1) edge (2)(2) edge (3)(3) edge (4)(4) edge (5)(5) edge (6);
	\end{tikzpicture}\\
	$\Fop^{-1} a$
	\begin{tikzpicture}[shorten >=1pt,node distance=2cm,on grid,initial text={},baseline=-0.5ex]
		\node                                          (0)                {\dots};
		\node[state,label=arbitrary,minimum size=15pt] (1) [right of = 0] {};
		\node[state,label=$a$      ,minimum size=15pt] (2) [right of = 1] {};
		\node[state,label=arbitrary,minimum size=15pt] (3) [right of = 2] {};
		\node[state,label=arbitrary,minimum size=15pt,initial below] (4) [right of = 3] {};
		\node[state,label=arbitrary,minimum size=15pt] (5) [right of = 4] {};
		\node                                          (6) [right of = 5] {\dots};
		\path[->] (0) edge (1) (1) edge (2)(2) edge (3)(3) edge (4)(4) edge (5)(5) edge (6);
	\end{tikzpicture}\\
	$\Gop^{-1} a$
	\begin{tikzpicture}[shorten >=1pt,node distance=2cm,on grid,initial text={},baseline=-0.5ex]
		\node                                          (0)                {\dots};
		\node[state,label=$a$      ,minimum size=15pt] (1) [right of = 0] {};
		\node[state,label=$a$      ,minimum size=15pt] (2) [right of = 1] {};
		\node[state,label=$a$      ,minimum size=15pt] (3) [right of = 2] {};
		\node[state,label=$a$      ,minimum size=15pt,initial below] (4) [right of = 3] {};
		\node[state,label=arbitrary,minimum size=15pt] (5) [right of = 4] {};
		\node                                          (6) [right of = 5] {\dots};
		\path[->] (0) edge (1) (1) edge (2)(2) edge (3)(3) edge (4)(4) edge (5)(5) edge (6);
	\end{tikzpicture}\\
	\caption{Intuitive semantics of past modalities.}
	\label{fig:LTLP_intuitive}
\end{figure}

%TODO: Give examples of semantics along the lines of subsection 5.1.1.

\subsubsection{Semantics}
The semantics of LTL and LTLP are defined in a very similar way.
In fact, we can use most definitions as defined in section 5.1.2 (in particular: Definition 5.6 and 5.7).
In order to make these definitions suitable for use with our LTLP operators,
we must provide their semantics.
Figure~\ref{fig:LTLP-semantics} shows the formal semantics of the operators defined in the grammar.
Note that we need to add a index $i$, since we must also be able to look in the past.

\begin{figure}
	\centering
	\begin{mdframed}
	$$
		\begin{matrix*}[l]
			\sigma,i &\vDash &\phi\Sop\psi &\text{iff} &\exists_{k \leq i}[\sigma,k \vDash \phi \wedge \forall_{k < j \leq i}[\sigma,j \vDash \phi]]\\
			\sigma,i &\vDash &\Xop^{-1}\phi &\text{iff} &i \geq 1 \wedge \sigma,i-1 \vDash \phi
		\end{matrix*}
	$$
	\end{mdframed}
	\caption{LTLP semantics for infinite words of $2^{AP}$}
	\label{fig:LTLP-semantics}
\end{figure}

Given these definitions, it is possible to derive the formal semantics of the $\Fop^{-1}$ and $\Gop^{-1}$ operators as well:
$$
	\begin{matrix*}[l]
		\sigma,i &\vDash &\Fop^{-1}\phi &\text{iff} &\exists_{k \leq i}[\sigma,k \vDash \phi]\\
		\sigma,i &\vDash &\Gop^{-1}\phi &\text{iff} &\forall_{k \leq i}[\sigma,k \vDash \phi]
	\end{matrix*}
$$

\subsection{LTL and LTL-Past}
%TODO: Consider/Analyse differences between LTL and LTL-Past

\subsection{LTL-Past to LTL}
%TODO: Provide the syntactic algorithm to convert LTLP to LTL
%TODO: Provide algorithm via automata to convert LTLP to LTL
%TODO: In both cases make use of examples from SSH Paper

%TODO: (Section?) Assess if LTLP is actually more succinct using the examples from the SSH Paper

\subsection{Minimal Bad Prefix in NuSMV}
%TODO: Given a formula of the form vw^\omega, can we find a n \in \mathbb{N} such that vw^n is a bad prefix?

\section{Contribution}
%TODO: Like we are some immature group of children, we have to provide proof of contribution

\printbibliography

\end{document}
