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CSIRNBK6QGBITBRQC QIVGMR6INKBVT5IFCO2UJJQEO4PVW3ZM7IDTCTCOKOX7VKG7UPFAC KUEZAMEH2M3K6EDHWMYXQMHZ2QTTH4KBM5CO7A7EB64ABEWRE6WQC YS5O2UANXCWRI3W7KMRKKK7OT7R6V3QDL4JS4DRLXM2EZUIPFALAC KVSF5AFJEIMIYAC264OUAA56SGP5MFAUG3AECKOTUPIXPGULVFQQC variables. During a run of the program, those costs are added up. The runtimeruntime complexity of a program is a special case of cost-analysis where everytransition has costs equal to 1. Because the costs would be equally copied fromone transition to the unfolded transition, we conjecture that thepartial evaluation preserves worst-case expected costs similarly to theworst-case expected runtime complexity. However, answering this question needsadditional research.
variables. During a run of the program, those costs are added up for everytransition in the run. The runtime runtime complexity of a program is a specialcase of cost-analysis where every transition has costs equal to 1. Because thecosts would be equally copied from one transition to the unfolded transition, weconjecture that the partial evaluation preserves worst-case expected costssimilarly to the worst-case expected runtime complexity. However, answering thisquestion needs additional research.
$\ell_g$, then the version $\langle \ell_g, \texttt{true}$ and all transitionsin $g$ are unfolded by the first evaluation step for this entry transitionmaking $g$ whole again in the partial evaluation graph. If the $\langle \ell_g,\texttt{true}$ is reachable trough the partial evaluation the version isevaluated then at its corresponding step. If it is not reachable the invalidgeneral transition is removed at the end as part of the clean-up.
$\ell_g$, then the version $\langle \ell_g, \texttt{true}\rangle$ and alltransitions in $g$ are unfolded by the first evaluation step for this entrytransition making $g$ whole again in the partial evaluation graph. If the$\langle \ell_g, \texttt{true}\rangle$ is reachable trough the partialevaluation the version is evaluated then at its corresponding step. If it is notreachable the invalid general transition is removed at the end as part of theclean-up.
Both the Algorithm \ref{alg:pe} which applies control-flow-refinement viapartial evaluation on an entire \gls{pip} and the Algorithm \ref{alg:cfr_subscc}which evaluates a set component of a program, where implemented.
The Algorithm \ref{alg:pe} which applies control-flow refinement via partialevaluation on a subset of transitions was implemented. A variant of theimplementation which refines an entire program is provided as well.
The evaluation of a whole program is not used in \gls{koat}s analysis per-se dueto performance reasons, but made available through a new sub command. It mightbe used by other tools in the future, that want to profit from partialevaluation on probabilistic programs.
The evaluation of a whole program is not used in \gls{koat}s analysis due toperformance reasons, but made available through a new sub command. It might beused by other tools in the future, that want to profit from partial evaluationon probabilistic programs.
The implementation for probabilistic programs was done on a
\unfold(\varphi, \eta) = \begin{cases}\tilde{\eta}(\varphi \Land \lfloor\eta\rceil) & \text{if } \varphi\text{ is satisfiable},\\\texttt{false} & \text{otherwise.}\end{cases}
% \unfold(\varphi, \eta) = \begin{cases}% \tilde{\eta}(\varphi \Land \lfloor\eta\rceil) & \text{if } \varphi% \text{ is satisfiable},\\% \texttt{false} & \text{otherwise.}% \end{cases}\unfold(\varphi, \eta) = \tilde{\eta}(\varphi \Land \lfloor\eta\rceil)
\begin{rem}By Lemma \ref{lem:unfold} $\unfold(\varphi)$ is satisfiable if $\varphi\land \tau$ is satisfiable. However in practice, the projectionover-approximates the polynomial guards and updates during projection, hencethe inverse does not hold. The satisfiability check marks unreachableversions as such explicitly.\end{rem}
% \begin{rem}% By Lemma \ref{lem:unfold} $\unfold(\varphi)$ is satisfiable if $\varphi% \land \tau$ is satisfiable. However in practice, the projection% over-approximates the polynomial guards and updates during projection, hence% the inverse does not hold. The satisfiability check marks unreachable% versions as such explicitly.% \end{rem}
\begin{definition}[Unfolding a general transition]\label{def:unfold_g}\begin{equation*}\unfold(\langle \ell,\varphi\rangle, g) = \{\unfold(\langle\ell,\varphi\rangle, t) \mid t \in g\}\end{equation*}\end{definition}For an unfolded general transition $g' = \unfold(\langle\ell_g, \varphi\rangle,g)$ for some general transition $g \in \GTP$ and a set of constraints $\varphi\in 2^{\C_\Prog}$, all the probabilities add up to one, because they were copiedby the unfolding from the original transitions in $g$. Besides, we obtain alocation $\ell_{g'} = \langle \ell_g, \varphi\rangle$, and $\tau_{g'} = \tau_g\land \varphi$ by construction.
\evaluate_\Prog(G) = G + \set{ \unfold(\langle \ell, \varphi \rangle, t)}{\langle \ell, \varphi\rangle \in V(G) \text{, and } t \in\TPout(\ell)}
\evaluate_\Prog(G) = G + \Union_{\substack{g \in \GTPout(\ell)\\\langle \ell, \varphi\rangle \in V(G)}} \unfold(\langle \ell, \varphi \rangle,g)
\in \N$. Moreover, let $G^* = \evaluate_\Prog^*$ be the limit the evaluationapproaches with an increasing number of repetitions.
\in \N$. Moreover, let $G^* = \evaluate_\Prog^*$ be the graph that is obtainedby an infinite number of repetitions of the evaluation.
\textit{true}\rangle$ is evaluated over the transition $t_1$, resulting in asingle new version $\langle \ell_1, \textit{true}\rangle$. The secondevaluation step unfolds $\langle \ell_1, \textit{true}\rangle$ over $t_3$
\texttt{true}\rangle$ is evaluated over the transition $t_1$, resulting in asingle new version $\langle \ell_1, \texttt{true}\rangle$. The secondevaluation step unfolds $\langle \ell_1, \texttt{true}\rangle$ over $t_3$
Let the set $\A \subset \C$, be a \textit{finite} set. It is called an\textit{abstraction space}. A function $\alpha: 2^{\C_\PV} \rightarrow \A$is called an \textit{abstraction function} if for every $\varphi\subset2^{\C_\PV}$, $\llbracket \varphi \rrbracket \subseteq \llbracket\alpha(\varphi)\rrbracket$.
Let the set $\A \subset \C$, be a \textit{finite} non empty set. It iscalled an \textit{abstraction space}. A function $\alpha: 2^{\C_\PV}\rightarrow \A$ is called an \textit{abstraction function} if for every$\varphi\subset 2^{\C_\PV}$, $\llbracket \varphi \rrbracket \subseteq\llbracket \alpha(\varphi)\rrbracket$.
\evaluate_{\Prog,\alpha}(G) = G + \set{ \unfold_\alpha(\langle\ell, \varphi \rangle, t)}{ \langle \ell, \varphi\rangle \in E(G)\text{, and } t \in \TPout(\ell)}
\evaluate_{\Prog,\alpha}(G) = G + \Union_{\substack{g \in \GTPout(\ell)\\\langle \ell, \varphi\rangle \in V(G)}} \unfold_\alpha(\langle \ell, \varphi \rangle, g)
\evaluate_{\Prog,S}(G) = G + \set{ \unfold_{S}(\langle \ell, \varphi\rangle, t)}{ \langle \ell, \varphi\rangle \in E(G) \text{, and } t \in\TPout(\ell)}
\unfold_S(\langle \ell,\varphi\rangle, g) = \{\unfold_S(\langle\ell,\varphi\rangle, t) \mid t \in g\}\end{equation*}\begin{equation*}\evaluate_{\Prog,S}(G) = G + \Union_{\substack{g \in \GTPout(\ell)\\\langle \ell, \varphi\rangle \in V(G)}} \unfold_S(\langle \ell, \varphi \rangle, g)
\begin{figure}[ht]\centering\input{figures/ch3_p3_full_pe_localized}\caption{Partial evaluation of $\Prog_3$ with a localised property basedabstraction $S_{\bot,\Psi_{\ell_1},\bot}$.\label{fig:ex_localized_pba}}\end{figure}
\rightarrow \C$ an evaluation step $\evaluate_{\Prog,S,T} : \G_\Prog\rightarrow \G_\Prog$ is defined as\begin{align*}\evaluate_{\Prog,S}(G) = G&+ \set{ \unfold_{S}(\langle \ell, \varphi \rangle, t)}{ \langle \ell,\varphi\rangle \in E(G) \text{, and } t \in \TPout(\ell) \cap T}\\&+ \set{(\langle\ell,\varphi\rangle,p,\tau,\eta,\langle\ell',\texttt{true}\rangle)}{\langle \ell, \varphi\rangle \in E(G) \text{, and } t \in\TPout(\ell) \backslash T}\end{align*}
\rightarrow \C$ new unfolding functions $\unfold_{S,T} : \vers_\Prog \times\TP \rightarrow \VTP$, and $\unfold: \vers_\Prog \times \GTP \rightarrow 2^\VTP$are defined where\begin{equation*}\begin{gathered}\unfold_{S,T}(\langle \ell,\varphi\rangle, t) = \begin{cases}(\langle\ell, \varphi\rangle, p, \tau\Land\varphi,\eta,S(\langle \ell',\varphi'\rangle)) & \text{if } t \in T \\(\langle\ell, \varphi\rangle, p, \tau\Land\varphi,\eta,\langle\ell',\texttt{true}\rangle) & \text{if } t \not\in T\end{cases}\\ \text{for } t = (\ell, p, \tau, \eta,\ell') \in \T_\Prog \text{ and } \varphi' = \unfold(\varphi \land \tau,\eta), \\\end{gathered}\end{equation*}\begin{equation*}\unfold_{S,T}(\langle \ell,\varphi\rangle, g) = \{\unfold_{S,T}(\langle\ell,\varphi\rangle, t) \mid t \in g\},\end{equation*}\begin{equation*}\evaluate_{\Prog,S,T}(G) = G + \Union_{\substack{g \in \GTPout(\ell)\\\langle \ell, \varphi\rangle \in V(G)}} \unfold_{S,T}(\langle \ell, \varphi \rangle, g)\end{equation*}
Let $S$ be a localised abstraction function. The partial evaluation graph$G_{\Prog,S}^*$ is finite if every loop $L$ in $\Prog$ contains a location$\ell \in L$ such that $\set{S(\langle\ell,\varphi\rangle)}{\varphi \in2^{\C_\PV}}$ is finite.
Let $S$ be a localised abstraction function and $T \subseteq \T_Prog$ Thepartial evaluation graph $G_{\Prog,S,T}^*$ is finite if every loop $L$ in$\Prog$ contains a location $\ell \in L$ such that$\set{S(\langle\ell,\varphi\rangle)}{\varphi \in 2^{\C_\PV}}$ is finite.
We will proceed with proving that the partial evaluation graph restricted to asubset of transitions can be used for constructing an new program $\Prog'$ withequal expected runtime complexity. All the results hold equally for partialevaluation of the entire program and independently of the choice of the (globalor localised) abstraction function, as long as the localised evaluation functionasserts a finite partial evaluation graph by Lemma\ref{lem:localized_pba_finite}.\begin{lemma}[Soundness\label{lem:unfold_g_sound}]Let $G^*_{\Prog,S,T}$ be the evaluation graph of a \gls{pip} $\Prog$ with alocalised abstraction function $S$ on a component $T \subseteq \TP$. Thetransitions of $E(G^*_{\Prog,S,T})$ can be split into finite pairwisedisjunct subsets $g_0,\dots,g_n \subset E(G^*_{\Prog,\alpha}) \subset \VT$.For all $0 \leq i \leq n$\begin{enumerate}\item there exists a unique general transition $\bar{g}_i \in \GTP$ andsome $\varphi \in 2^{\C_\PV}$ for which the following property holds:\begin{align*}g_i &= \set{t}{\bar{t} \in \bar{g}_i, t \in E(G^*_{\Prog,S,T})} \\&= \set{(\langle\ell_{\bar{g}_i},\varphi\rangle,p,\varphi\land \tau_{g_i}, \eta, \langle\ell',\varphi'\rangle}{(\ell_g, p, \tau_g, \eta, \ell') \in g'_i, \varphi' \in2^{\C_\PV}}\end{align*}\item all transitions in $g_i$ have a common guard $\tau_{g_i}$ andsource location $\ell_{g_i}$;\item the probabilities in $g_i$ add up to 1.\end{enumerate}\begin{proof}Let $t =(\langle \ell, \varphi\rangle, p, \tau, \eta, \_) \inE(G^*_{\Prog,S,T})$ be a transition in the partial evaluation graph$G^*_{\Prog,S,T}$ of a \gls{pip} $\Prog$ with a component $T \subset\TP$. There exists a unique generaltransition $g \in \GTP$ with $\bar{t} \in g$. Let $ g = \{ t'_1, \dots,t'_n \}$. We set $\bar{g} = g$. All $t'_i$ share a common guard $\tau_g$and source location $\ell_g = \ell$.Let $1 \leq i \leq n$ an $t'_i = (\ell, p, \tau_g, \_, \_)$. Byconstruction of $\evaluate_\Prog,S,T$ there was added either atransition $t_i = \unfold(\langle\ell,\varphi\rangle, t_i) =(\langle\ell,\varphi\rangle, p, \varphi \land \tau_g, \_, \_)$ if $t'_i\in T$ or $t_i = (\langle\ell,\varphi\rangle, p, \varphi \land \tau_g,\_, \_)$ if $t'_i \not\in T$. In any case, all $t'_i$ share a commonguard $\tau_g' = \varphi \land \tau_g$ and the probabilities add up to1.\end{proof}\end{lemma}
evaluation graph $G^*_{\Prog,\alpha}$ by Lemma \ref{lem:unfold_g_sound}.
evaluation graph $G^*_{\Prog,\alpha}$ where every general transition $g \in\GT_{G^*_{\Prog,\alpha}}$ was added by the unfolding of a unique generaltransition $g' \in \GT_Prog$. We call $\bar{g} = g'$, similar to Lemma\ref{lem:original_transition}, the original transition of $g$.
\set{\unfold_{\Prog,S}(\langle \ell, \varphi\rangle, t) }{ t \in g \text{and } t \in T} \union\set{\langle\ell_{\bar{g}_i},\varphi\rangle,p,\varphi \land \tau_{g_i},\eta, \langle\ell',\varphi'\rangle}{ t = (\ell_g, p, \tau_g, \eta, \ell')\in g, \varphi' \in 2^{\C_\PV} \text{ and } t \not\in T}$. $g'$ is thegeneral transition that contains all the unfolded and copied transitions for$t \in g$. For better readability we define a function$\texttt{eval}_{\Prog,S,T} : \GTP \rightarrow \GTPn$ where\begin{align*}\texttt{eval}_{\Prog,S,T} (g) = &\set{\unfold_{\Prog,S}(\langle \ell,\varphi\rangle, t) }{ t \in g \cap t \in T} \union \\&\set{\langle\ell_{\bar{g}_i},\varphi\rangle,p,\varphi \land\tau_{g_i}, \eta, \langle\ell',\varphi'\rangle}{ t = (\ell_g, p, \tau_g,\eta, \ell') \in g \backslash T, \varphi' \in 2^{\C_\PV}}.\end{align*}
\unfold_{\Prog,S,T}(\langle\ell,\varphi\rangle,g)$% $% \set{\unfold_{\Prog,S}(\langle \ell, \varphi\rangle, t) }{ t \in g \text{% and } t \in T} \union% \set{\langle\ell_{\bar{g}_i},\varphi\rangle,p,\varphi \land \tau_{g_i},% \eta, \langle\ell',\varphi'\rangle}{ t = (\ell_g, p, \tau_g, \eta, \ell')% \in g, \varphi' \in 2^{\C_\PV} \text{ and } t \not\in T}$. $g'$ is the% general transition that contains all the unfolded and copied transitions for% $t \in g$. For better readability we define a function% $\texttt{eval}_{\Prog,S,T} : \GTP \rightarrow \GTPn$ where% \begin{align*}% \texttt{eval}_{\Prog,S,T} (g) = &\set{\unfold_{\Prog,S}(\langle \ell,% \varphi\rangle, t) }{ t \in g \cap t \in T} \union \\% &\set{\langle\ell_{\bar{g}_i},\varphi\rangle,p,\varphi \land% \tau_{g_i}, \eta, \langle\ell',\varphi'\rangle}{ t = (\ell_g, p, \tau_g,% \eta, \ell') \in g \backslash T, \varphi' \in 2^{\C_\PV}}.% \end{align*}
We define a function $\texttt{lin} 2^\PC \rightarrow 2^\C$ that linearlyover-approximates polynomial constraints, that is $\llbracket \varphi\rrbracket\subseteq \llbracket\texttt{lin}(\varphi) \rrbracket$. It is not important, howthe over-approximation works in details. An easy way of over-approximatingpolynomial sets of constraints is to just drop all non-linear constraints.However, one might take minima and maxima of the polynomials into account andget arbitrarily precise.
\cite{kraaikamp2005modern}. Examples of the various probability distributionsare displayed in \fref{fig:distributions}.
\citetitle{kraaikamp2005modern} \cite{kraaikamp2005modern}. Examples of thevarious probability distributions are displayed in \fref{fig:distributions}.
$\MDS_\Prog$, where \enquote{MD} stands for \enquote{Markoviandeterministic}.
$\MDS_\Prog$, where \enquote{MD} stands for \enquote{\underline{M}arkovian\underline{d}eterministic}.
by $\HDS_\Prog$, where \enquote{HD} stands for \enquote{history dependentdeterministic}.
by $\HDS_\Prog$, where \enquote{HD} stands for \enquote{\underline{h}istorydependent \underline{d}eterministic}.
programs \cite{meyer2021tacas}. Unfortunately, by using iRankfinderwhich is limited to non-probabilistic integer programs, the technique of\gls{cfr} via partial evaluation remained out of reach for probabilisticprograms.
programs \cite{meyer2021tacas}. For probabilistic programs, \gls{koat} usesprobabilistic ranking functions, that work similarly to \gls{mprf}, but takeprobability into accound. They fail for the same reasons as \gls{mprf} forcertain kinds of loops. Unfortunately, by using iRankFinder which is limited tonon-probabilistic integer programs, the technique of \gls{cfr} via partialevaluation remained out of reach for probabilistic programs.
\gls{koat} with regard to non-probabilistic integer programs by reimplementingthe control flow refinement technique of iRankFinder \cite{irankfinder2018wst}
\gls{koat} with regard to non-prob\-a\-bilis\-tic integer programs by reimplementingthe control-flow refinement technique of iRankFinder \cite{irankfinder2018wst}