UVN5HOW3H2OVESJ62UFNQNS6VXHI5TRV22HQ44EOYU42453SDD2QC Koat2 can work on integer programs with polynomial integerarithmetic.\cite{Brockschmidt16} To represent states and invariants in such aprogram, one needs polynomial constraints. As an extended concept Koat2 usesboxes and we will use polyhedra for the partial evaluation. Since those conceptsare closely related we will introduce them together.
% Koat2 can work on integer programs with polynomial integer% arithmetic.\cite{Brockschmidt16} To represent states and invariants in such a% program, one needs polynomial constraints. As an extended concept Koat2 uses% boxes and we will use polyhedra for the partial evaluation. Since those concepts% are closely related we will introduce them together.
A constraint $c \in \C$ is \textit{satisfiable} when the formula $\varphi=c$ is satisfiable in $\Zs$ or $\Zs \models c$. We say a variable assignment
A constraint $c \in \C$ is \textit{satisfiable} when the formula $c$ issatisfiable in $\Zs$ or $\Zs \models c$. We say a variable assignment
\models \LAnd_{c_i \in C} c_i$ and $(\Zs, \beta)\models \LAnd {c_i \in C} c_i$,respectively. Furthermore, we use conjunctions and sets of constraintsinterchangeably.
\models \LAnd_{c_i \in C} c_i$ and $(\Zs, \beta)\models \LAnd_{c_i \in C} c_i$,respectively.\begin{definition}[Solutions]Let $\varphi$ be an FO-formula. $\llbracket \varphi \rrbracket$ is definedas the set of all satisfying assignments or the \textit{solutions} of theformula $\varphi$.Correspondingly, $\llbracket c \rrbracket$ and $\llbracket C \rrbracket$ arethe solutions of the constraint $c \in \C$ and the set of constraints $C\subset \C$, respectively.\end{definition}The following properties hold. Hence, we use conjunctions and sets ofconstraints interchangeably.\begin{align*}\llbracket c_1 \Land c_2 \rrbracket &= \llbracket c_1 \rrbracket \intersect\llbracket c_2 \rrbracket \\\llbracket C \rrbracket &= \llbracket \LAnd_{c_i \in C} c_i \rrbracket \\&= \Intersect_{c_i \in C} \llbracket c_i \rrbracket\end{align*}\begin{definition}[Equivalence]Two formulas, constraints, or set of constraints are considered equivalent,when there solutions are equal. We write $\varphi_1 \equiv \varphi_2$.\end{definition}
% SolutionsThe we define $\llbracket c \rrbracket$ as the set of all satisfying assignmentsof the constraint $c$ and $\llbracket C \rrbracket$ as the set of all satisfyingassignments for $C$. The following holds:\begin{equation*}\llbracket C \rrbracket = \Intersect_{c_i \in C} \llbracket c_i \rrbracket\end{equation*}
Since we are talking about probabilistic programs, we will need tools torepresent probabilities throughout the program. For example a variable in aprobabilistic program can take a random value. That means that the valueassigned to a variable is not deterministic but chosen at random from a givendistribution.The field of probability and random variables is well studied. We will onlyintroduce the core concepts needed to understand this thesis and follow the
% Since we are talking about probabilistic programs, we will need tools to% represent probabilities throughout the program. For example a variable in a% probabilistic program can take a random value. That means that the value% assigned to a variable is not deterministic but chosen at random from a given% distribution.The field of probability and random variables is well studied. Only the coreconcepts needed to understand this thesis will be introduced, following the
For random program variables in this thesis, $\Omega$ will be the set ofintegers and $\mathcal{F}$ the maximal $\sigma$-field in $\Omega$, the powerset$2^\Omega$. However since the program variables are chosen at random, aspecific path over a given program can also be considered a random event in theprobability space and hence be considered as a ransom variable. In this case$\Omega$ is the set of all runs $\mathcal{Runs}$. The exact definition will beintroduced later on in \Sref{}.
% For random program variables in this thesis, $\Omega$ will be the set of% integers and $\mathcal{F}$ the maximal $\sigma$-field in $\Omega$, the power-set% $2^\Omega$. However since the program variables are chosen at random, a specific% path over a given program can also be considered a random event in the% probability space and hence be considered as a ransom variable. In this case% $\Omega$ is the set of all runs $\mathcal{Runs}$. The exact definition will be% introduced later on in \Sref{}.
The general concept of random variables is not to be confused with programvariables (that can take random values). Random variables assign a probabilityto an event of a probability space.
The concept of random variables is not to be confused with programvariables or variables in formulas. Random variables assign a probabilityto an event of a probability space, whereas variables in formulas can be boundto a value by an assignment or existentially quantified.
\todo{remark: the following relations do not consider the satisfiability butonly the mere existence of transitions.}For the following let $P=(\V, L, GT, l_0)$ be \gls{pip}.\begin{definition}[Transition relation]A relation $\rightarrow_P \,\subseteq L \times L$ is defined for the\gls{pip} $P$, with $l \rightarrow_P l'$ if and only if there exists ageneral transition $g \in GT$ and a transition $t \in g$ with $t = (l, p,\tau, \nu, l)$.\end{definition}\begin{definition}[Path relations]For $n \in \N$ and the \gls{pip} $P$, a relation $\npathto{n}_P\,\subseteq L\times L$ is defined with $l \npathto{n}_P l'$ if and only if there exist a(finite) sequence of locations $(l_{k_0}, \dots l_{k_n})\in L^n$, with$l_{k_i}\rightarrow_P l_{k_{i+1}}$ for $i \in [0, n-1]$, $l_{k_0} = l$, and$l_{k_n} = l'$. We say there exists a \textit{path} of length $n$ from $l$to $l'$.In addition, the relation $l \pathto_P l'$ denotes that there exists a pathof arbitrary length, $l \npathto{>n}_P l'$ that there exists a path oflengthat least $n$.\end{definition}\begin{rem}\\begin{itemize}\item A path of length 0 and the relation $\npathto{0}$ are perfectlylegal. With a zero-length path being a sequence of length onecontaining only a single location;\item the relation $\rightarrow_P$ is neither \textit{reflexive},\textit{transitive} nor \textit{symmetric} in the general case, butmight be depending on the program.\item the relation $\npathto{0}_P$ is always \textit{reflexive},\textit{transitive}, and \textit{symmetric};\item the relation $\npathto{<n}_P$ is always \textit{reflexive};\item the relation $\npathto{>n}_P$ is always \textit{transitive};whereas\item the relation $\npathto{>0}_P \, = \,\pathto_P$ is always\textit{reflexive} and \textit{transitive}.\end{itemize}\todo{proof needed?}\end{rem}Notation-wise, whenever the program is obvious from the context, the subscript$P$ can be dropped from the relation.
A set of locations $A \subseteq L$ is \textit{strongly connected} in P whenfor every two locations $l, l' \in A$ there exists a path between the twolocations $l \pathto_P l'$. And it is a \textit{strongly connectedcomponent} when the set is maximal. That is, there exists no location $l'' \inL\backslash A$ such that $A \union \{l''\}$ is also strongly connected.\end{definition}\begin{lemma}\label{lem:scc_expand}Let $A \subseteq L$ be strongly connected set of locations in $P$. Given alocation $l \in L$, and a location $l_A \in A$, if $l \pathto l_A$ and $l_A\pathto l$ then $A \union \{l\}$ is also strongly connected in $P$.\begin{proof}\todo{proof needed?}\end{proof}\end{lemma}\begin{lemma}\label{lem:scc_disjunct}Two strongly connected components $A, B \subseteq L$ of $P$ are either equalor disjunct.\begin{proof}Let two strongly connected components $A, B \subseteq L$ be notdisjunct, and $l_{AB} \in A\intersect B$.Assume there is a location $l_A \in A \backslash B$. Then $l_A \pathtol_{AB}$ and for all $l_B \in B$, $l_{AB}\pathto l_B$ due to $A$ and $B$being strongly connected. By transitivity, $l_A \pathto l_B$.Symmetrically, for any $l_B \in B$, $l_B \pathto l_A$. But then $B\union \{l_A\}$ would be strongly connected, contradicting $B$maximality. Hence such a location $l_AB$ cannot exist and $A \intersectB = \emptyset$.\end{proof}\end{lemma}
\begin{lemma}\label{lem:scc_exist}For every location $l\in L$, there exists a strongly connected component $A$such that $l\in A$.\begin{proof}Let $l_{k_0}\in L$ be an arbitrary location of a program $P$. The proofwill be given in an inductive fashin. Starting with a set $A_0 =\{l_{k_0}\}$, by reflexivity $l \pathto l$. Hence, $A_0$ is stronglyconnected.For $i \in \N$, if $A_i$ is maximal and $A_i$ is the SCC containing $l$.If not there exists another $l_{k_{i+1}} \notin A_i$, such that $A_{i+1}:= A_i \union \{l_{k_{i+1}}\}$ is strongly connected.Repeat the argument above until a maximal set is found. The inductionends, because the set of locations is finite.\end{proof}\end{lemma}\begin{definition}[Loop]A loop in a \gls{pip} $P$ is a sequence of pairwise different locations$(l_{k_0} \dots l_{k_n})$ with $l_{k_i} \rightarrow l_{k_{i+1}}$ for $i \in[0, n-1]$ and $l_{k_n} \rightarrow l_{k_0}$.
\todo{examples: 1. loops, 2. two loopheads}\begin{lemma}\label{lem:loop_path}Let $(l_{k_0} \dots l_{k_n})$ be a loop in the program $P$. For any twolocations in the loop $l_{k_i}, l_{k_j}$, $l_{k_i} \pathto l_{k_j}$ and$l_{k_j} \pathto l_{k_i}$.\todo{proof needed?}\end{lemma}\begin{lemma}Let $(l_{k_0} \dots l_{k_n})$ be a loop in the program $P$. Then alllocations $l_{k_0} \dots l_{k_n}$ are contained in the same SCC.\begin{proof}Follows immediately from Lemma \ref{lem:scc_expand} and Lemma\ref{lem:loop_path} \todo{fix ref}\end{proof}\end{lemma}