summaryrefslogtreecommitdiff
path: root/tex/presentation/main.tex
blob: 286e4a7e4fe4283b9bf9cce1eb850f49387d7dab (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
\documentclass{beamer}

\usetheme{Hannover}
\usepackage{amsmath,stmaryrd,listings}

\title{{\bf Static Analysis \\ through \\Abstract Interpretation, \\Convex Optimization, and\\ Strategy Iteration}}

\author{
  {\bf Thomas Martin Gawlitza}
  \\[3pt]
  joint work with
  \\[3pt]
  {\bf Helmut Seidl}
}

\newcommand\N{\mathbb{N}}
\newcommand\Z{\mathbb{Z}}
\newcommand\CZ{\overline{\Z}}

\let\max\undefined
\newcommand\max{\lor}
\let\min\undefined
\newcommand\min{\land}

\begin{document}

\begin{frame}
  \maketitle
\end{frame}

\begin{frame}
  \tableofcontents
\end{frame}

\section{Example}
\begin{frame}{Example}
  \begin{eqnarray*}
    x_1 &=& 0 \max (-1 + x_1 \min x_2) \\
    x_2 &=& 0 \max 5 + x_1 \max x_1 \\
    x_3 &=& 0 \max 1 + x_3 \max 0 + x_1
  \end{eqnarray*}

\end{frame}

\section{Definitions}
\begin{frame}{Preliminary Definitions}
  \begin{center}
    Strange notation: \\
    $x \max y = \text{max}(x, y)$ \\
    $x \min y = \text{min}(x, y)$ \\
    \uncover<2->{
      \bigskip
      {\bf Monotone:} $x \leq y \implies f(x) \leq f(y) ~~ \forall x,y$
    }

    \uncover<3->{
      \bigskip
      {\bf Assignment:} $\rho$ is always a variable assignment (from $X \rightarrow \CZ$)
    }
  \end{center}
\end{frame}

\begin{frame}{Systems of Equations}
  \begin{align*}
    \varepsilon = \{ x_1 = e_1, x_2 = e_2, ... x_n = e_n \}
  \end{align*}
  \uncover<2->{
    \begin{align*}
      \text{\bf Solutions: } & \rho = \llbracket \varepsilon \rrbracket \rho \\
      \text{\bf Presolutions: }  & \rho \leq \llbracket \varepsilon \rrbracket \rho \\
      \text{\bf Fixpoint: } & f(x) = x \\
      \text{\bf Least fixpoint: } & \mu f \\
    \end{align*}
  }
  \uncover<3->{
    {\bf Evaluation:}
    $\text{with } \rho ~ \epsilon ~ Vars(\varepsilon) \rightarrow \CZ$ \\
    \begin{align*}
      (\llbracket \varepsilon \rrbracket \rho)(x) & := \llbracket e \rrbracket \rho \\
                     \llbracket x \rrbracket \rho & := \rho (x) \\
             \llbracket f(e_1, ... e_k) \rrbracket & := f(\llbracket e_1 \rrbracket \rho,
                                                        ... \llbracket e_k \rrbracket \rho)
    \end{align*}
  }
\end{frame}

\begin{frame}{Operators on $\CZ$}
  Working in $\CZ = \Z \cup \{\infty, -\infty\}$

  \bigskip
  \begin{displaymath}
    x +^{-\infty} y = \left\{ \begin{array}{ll}
        -\infty & \text{if } -\infty \in \{x,y\} \\
         \infty & \text{if } -\infty \not\in \{x,y\} \text{ and } \infty \in \{x,y\} \\
         x + y  & \text{if } x,y \in \Z \\
    \end{array} \right.
  \end{displaymath}
  \begin{displaymath}
    x +^{\infty} y = \left\{ \begin{array}{ll}
         \infty & \text{if } \infty \in \{x,y\} \\
         -\infty & \text{if } \infty \not\in \{x,y\} \text{ and } -\infty \in \{x,y\} \\
         x + y  & \text{if } x,y \in \Z \\
    \end{array} \right.
  \end{displaymath}
  \begin{displaymath}
    \begin{array}{lr}
      x \cdot \infty = \infty \cdot x = \infty,
      x \cdot -\infty = -\infty \cdot x = -\infty
        & \forall x > 0 \\
      x \cdot \infty = \infty \cdot x = -\infty,
      x \cdot -\infty = -\infty \cdot x = \infty
        & \forall x < 0 \\
      0 \cdot \infty = \infty \cdot 0 =
      0 \cdot -\infty = -\infty \cdot 0 = 0 &
    \end{array}
  \end{displaymath}
\end{frame}

\begin{frame}{Expansivity}
  $f$ is upward-expansive in $X'$ iff

  \bigskip
  \begin{center}
    $f(\rho \oplus \{x \mapsto \rho(x) + \delta\}) \geq f(\rho) + \delta)$
      ~~ $\forall x \in X', \rho \in X \rightarrow \CZ,  \delta \in \N$
  \end{center}
\end{frame}

\section{Max-strategies}
\begin{frame}{Max-strategies}
  Assume for every $x = e \in \varepsilon$, $e$ is of the
  form $e_1 \max e_2 \max ... \max e_k$.

  Then a $\max$-$strategy$ $\sigma$ maps each $e$ to one of its $e_k$.

  \bigskip
  For all $\max$ strategies $\sigma$ the expression $e\sigma$ is defined as:
  \begin{align*}
    (e_1 \max ... \max e_k)\sigma & = (\sigma(e_1 \max ... \max e_k))\sigma \\
            (f(e_1,...e_k))\sigma & = f(e_1\sigma, ..., e_k\sigma)
  \end{align*}
  where $f \not = \max$
\end{frame}

\begin{frame}{Max-strategies}
  We may need to change strategy throughout our evaluation.

  Consider the system: $\varepsilon = \{x_1 = x_1 + 1 \max 0\}$.

  Let:
  \begin{align*}
    \sigma_1 & = \{x_1 + 1 \max 0 \mapsto x_1 + 1\} \\
    \sigma_2 & = \{x_1 + 1 \max 0 \mapsto 0\}
  \end{align*}

  \uncover<2->{
    This gives us:
  }
  \begin{align*}
    \uncover<2->{
      \mu \llbracket \varepsilon (\sigma_1) \rrbracket & = \{x_1 \mapsto -\infty\} \\
      \mu \llbracket \varepsilon (\sigma_2) \rrbracket & = \{x_1 \mapsto 0\} \\
    }
    \uncover<3->{
      \mu \llbracket \varepsilon \rrbracket & = \{x_1 \mapsto \infty\}
    }
  \end{align*}
\end{frame}

\section{Bellman-Ford}
\begin{frame}{BF-functions}
  $X$ a set. A monotone $f: (X \rightarrow \CZ) \rightarrow CZ$ is called
  a \emph{Bellman-Ford function} iff, $\forall \rho, \rho': X \rightarrow \CZ$
  with $\rho' \geq \rho$ the following holds:

  \bigskip
  If $f(\rho') > f(\rho)$ then $\exists x \in X$ and some $\delta \in \CZ\setminus\{-\infty\}$ such that:
  \begin{align*}
    \rho'(x) & > \rho(x) \\
    f(\rho') & = \rho'(x) + \delta \\
    f(\rho'') & \geq \rho''(x) + \delta ~~ \forall \rho'' \geq \rho'
  \end{align*}
\end{frame}

\begin{frame}{A quick lemma}
  Let $\varepsilon$ be a system of \emph{BF-equations} with $n$ variables. \\
  Let $\rho^{(i)} = \llbracket\varepsilon\rrbracket^i(\_ \mapsto -\infty) ~~ \forall i \in \N$. \\
  The following holds for every $x \in Vars(\varepsilon)$: \\
  If there exists some $k > n$ with $\rho^{(k)}(x) > \rho^{(n)}(x)$, then
  $\mu\llbracket\varepsilon\rrbracket(x) = \infty$.
\end{frame}

\begin{frame}{The algorithm}
  ~ \\
  {\bf Input:} A system of BF-equations with $n$ variables \\
  {\bf Output:} The least solution $\mu\llbracket\varepsilon\rrbracket$ of \varepsilon \\
  \begin{displaymath}
    ~ \\
    \rho \leftarrow (\_ \mapsto -\infty) \\
    {\bf for} i = 1 {\bf to} n {\bf do} \rho \leftarrow \llbracket\varepsilon\rrbracket\rho \\
    \rho \leftarrow \rho' \text{ where } \rho'(x) = \left\{ \begin{array}{ll}
      \rho(x) & \text{if } (\llbracket\varepsilon\rrbracket\rho)(x) \leq \rho(x) \\
       \infty & \text{if } (\llbracket\varepsilon\rrbracket\rho)(x) > \rho(x)
    \end{array} \right. \forall x \in X \\
    {\bf for} i = 1 {\bf to} n-1 {\bf do} \rho \leftarrow \rho \max \llbracket\varepsilon\rrbracket\rho \\
    {\bf return} \rho \\
    ~
  \end{displaymath}
\end{frame}

\begin{frame}{Example}
  \begin{align*}
    x & = 1 \\
    y & = y + x \max -10 \\
    z & = x \cdot^+ y
  \end{align*}
  Where $\cdot^+$ is defined by:
  \begin{displaymath}
    x \cdot^+ y = \left\{ \begin{array}{l l}
        x \cdot y & \text{if } x, y > 0 \\
          -\infty & \text{if } x \le 0 \text{ or } y \le 0
      \end{array} \forall x,y \in \CZ
  \end{displaymath}
\end{frame}

\section{Max-strategy improvement}
\begin{frame}{Max-strategy improvement}
  {\bf General idea:}
  \begin{itemize}
    \item Pick a max-strategy
    \item Perform fixpoint iteration
    \item Improve strategy
    \item Repeat until we have a solution
  \end{itemize}
\end{frame}

\begin{frame}{What is an improvement?}
  If we have $\varepsilon$ a system of equations, $\sigma$ a $\max$-strategy
  for $\varepsilon$ and $\rho$ a presolution of $\varepsilon(\sigma)$, then we
  call a $\max$-strategy $\sigma'$ is called an improvement of $\sigma$ with
  respect to $\rho$ iff:
  \begin{itemize}
    \item if $\rho \not \in {\bf Sol}(\varepsilon)$, then $\llbracket\varepsilon(\sigma')\rrbracket\rho > \rho$
    \item for all $\max$-expression $e \in S_{\max}(\varepsilon)$ the following holds: \\
      If $\sigma'(e) \not = \sigma(e)$, then $\llbracket e\sigma'\rrbracket\rho > \llbracket e\sigma\rrbracket\rho$
  \end{itemize}
\end{frame}

\begin{frame}{Algorithm}
  ~ \\
  {\bf Input:}
  \begin{itemize}
    \item A system $\varepsilon$ of monotone equations over a complete linearly ordered set \\
    \item A $\max$-strategy $\sigma_{init}$ for $\varepsilon$ \\
    \item A pre-solution $\rho_{init}$ of $\varepsilon(\sigma_{init})$ with $\rho_{init} \le \mu\llbracket\varepsilon\rrbracket$
  \end{itemize}
  {\bf Output:} The least solution $\mu\llbracket\varepsilon\rrbracket$ of $\varepsilon$
  \begin{displaymath}
    ~ \\
    \sigma \leftarrow \sigma_{init} \\
    \rho \leftarrow \rho_{init} \\
    \text{while }(\rho \not \in {\bf Sol}(\varepsilon)) \{ \\
      ~~~~ \sigma \leftarrow P_{\max}(\sigma, \rho) \\
      ~~~~ \rho \leftarrow \mu_{\ge\rho} \llbracket\varepsilon(\sigma)\rrbracket \\
    \} \\
    {\bf return} \rho
    ~
  \end{displaymath}
\end{frame}

\begin{frame}{Another related lemma}
  Whenever the $\max$-strategy improvement algorithm terminates, it
  returns the least solution $\mu\llbracket\varepsilon\rrbracket$.
\end{frame}

\begin{frame}{Example}
  \begin{align*}
    x_1 & = 0 \max x_1 + x_2 - 4 \\
    x_2 & = -1 \max ((x_1 + 1 \max 2 \cdot x_2) \min 5)
  \end{align*}
\end{frame}

\section{Feasibility}

\section{Extended Integer Equations}

\section{Abstract Interpretation over Zones}


\end{document}