% !TEX encoding = UTF-8
% !TEX spellcheck = en_GB

\documentclass[aspectratio=169,compress]{beamer}

% TODO: Titles Must Be Titlecase.

% Basic packages
\usepackage{pgfpages}
\usepackage{listings}
\usepackage[utf8]{inputenc}
\usepackage[spanish,english]{babel}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{soul}

% Color definitions
\definecolor{criterion}{rgb}{1,0,0}
\definecolor{light-gray}{gray}{0.8}
\definecolor{color1}{rgb}{1,0.5,0}
\definecolor{color2}{rgb}{0.9,0.2,0}
\definecolor{hasExcClr}{rgb}{0,0.5,0}
\definecolor{lightgreen}{RGB}{144,238,144}

% Bibliography settings
\usepackage[backend=bibtex,style=alphabetic,citestyle=alphabetic-verb]{biblatex}
\bibliography{biblio.bib}

% Graphics to create step-by-step graphs
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}

% Beamer theme
% \usetheme{beamertheme-bjeldbak/bjeldbak}
\setbeamertemplate{note page}[plain]
% \setbeameroption{show notes on second screen=right}
\usetheme{-bjeldbak/beamerthemebjeldbak}
% \usetheme{Madrid}
% \usecolortheme{whale}

% Document metadata
% \title[Program slicing with exceptions]{Fragmentación de programas con excepciones}
\title{Program slicing with exception handling}
\date{Dec 18th, 2019}
\author[C. Galindo]{Carlos S. Galindo Jiménez}
\institute[UPV]{
    Universidad Politécnica de Valencia
}

% Escapable listing environment
\lstnewenvironment{java}[1][]{
    \lstset{language=[LaTeX]TeX}\lstset{escapeinside={(*@}{@*)},
    numbers=left,
    numberstyle=\tiny,
    stepnumber=1,
    numbersep=5pt,
    breaklines=true,
    %firstnumber=last,
    %frame=tblr,
    tabsize=2,
    framesep=5pt,
    basicstyle=\small\ttfamily,
    showstringspaces=false,
    %identifierstyle=\ttfamily,
    stringstyle=\color{maroon},
    commentstyle=\color{black},
    rulecolor=\color{black},
    xleftmargin=0pt,
    xrightmargin=0pt,
    aboveskip=\medskipamount,
    belowskip=\medskipamount,
    backgroundcolor=\color{white}, #1
}}{}

\begin{document}
\input{listings-config}

\maketitle

\begin{frame}{Table of Contents}
    \tableofcontents
\end{frame}

\section{Introduction}

\subsection{Program slicing}

\begin{frame}[fragile]{Program slicing}
    \begin{columns}
        \column{0.5\textwidth}
            \begin{java}[gobble=16]
                void f(int x) {
                    int sum = 0;
                    int prod = 0;
                    while (x > 0) {
                        sum += x;
                        prod *= x;
                        x--;
                    }
                    log("sum: " + sum);
                    log("prod: " + (*@\textcolor<2->{criterion}{prod}@*));
                }
            \end{java}
        \column<3->{0.5\textwidth}
            \begin{java}[gobble=16]
                void f(int x) {
                    (*@\textcolor<4->{light-gray}{int sum = 0;}@*)
                    int prod = 0;
                    while (x > 0) {
                        (*@\textcolor<4->{light-gray}{sum += x;}@*)
                        prod *= x;
                        x--;
                    }
                    (*@\textcolor<4->{light-gray}{log("sum: " + sum);}@*)
                    log("prod: " + prod);
                }
            \end{java}
    \end{columns}
    {\hfill Example adapted from \cite{Tip95}.}
\end{frame}

\begin{frame}[containsverbatim]{Program slicing}{Applications}
    \begin{columns}
        \column{0.5\linewidth}
        \begin{itemize}
            \item Debugging
            \item Program specialization
            \item Software maintenance
            \item Code obfuscation
            \item Dead code removal
            \item Program parallelization
        \end{itemize}
        \column{0.5\linewidth}
        \begin{java}[gobble=12]
            void f(int x) {
                (*@\textcolor{light-gray}{int sum = 0;}@*)
                int prod = 0;
                while (x > 0) {
                    (*@\textcolor{light-gray}{sum += x;}@*)
                    prod *= x;
                    x--;
                }
                (*@\textcolor{light-gray}{log("sum: " + sum);}@*)
                log("prod: " + prod);
            }
        \end{java}
    \end{columns}
    % Clone detection (examenes, copyright)
\end{frame}

\begin{frame}{Program slicing}{Metrics}
    \begin{description}
        \item[\textbf{Completeness.}] The slice includes all instructions that are necessary.
        \item[\textbf{Correctness.}] The statements included affect the slicing criterion.
    \end{description}

    \vfill
    \definecolor{minimalcolor}{rgb}{0.8588235294117647,0.3803921568627451,0.0784313725490196}
    \definecolor{programcolor}{rgb}{0.08235294117647059,0.396078431372549,0.7529411764705882}
    \definecolor{slicecolor}{rgb}{0,0,0}

    \pause
    \begin{columns}
        \column{0.25\textwidth}
            Correct and complete: \\
            \begin{tikzpicture}[line cap=round,line join=round,>=triangle 45]
                \draw [line width=2pt,color=programcolor,fill=programcolor,fill opacity=0.25] (0,0) circle (4em);
                \draw [line width=2pt,color=minimalcolor,fill=minimalcolor,fill opacity=0.4] (0,0) circle (2em);
                \visible<3->{\draw [line width=1pt,dotted,color=slicecolor,fill=slicecolor,fill opacity=0.2] (0, 0) circle (2em);}
            \end{tikzpicture}
        \column{0.25\textwidth}
            Correct and incomplete: \\
            \begin{tikzpicture}[line cap=round,line join=round,>=triangle 45]
                \draw [line width=2pt,color=programcolor,fill=programcolor,fill opacity=0.25] (0,0) circle (4em);
                \draw [line width=2pt,color=minimalcolor,fill=minimalcolor,fill opacity=0.4] (0,0) circle (2em);
                \visible<4->{\draw [line width=1pt,dotted,color=slicecolor,fill=slicecolor,fill opacity=0.2] (0, 0) circle (1.5em);}
            \end{tikzpicture}
        % \includegraphics[width=\textwidth]{}
        \column{0.25\textwidth}
            Incorrect and complete: \\
            \begin{tikzpicture}[line cap=round,line join=round,>=triangle 45]
                \draw [line width=2pt,color=programcolor,fill=programcolor,fill opacity=0.25] (0,0) circle (4em);
                \draw [line width=2pt,color=minimalcolor,fill=minimalcolor,fill opacity=0.4] (0,0) circle (2em);
                \visible<5->{\draw [line width=1pt,dotted,color=slicecolor,fill=slicecolor,fill opacity=0.2] (0, 0) circle (2.5em);}
            \end{tikzpicture}
        % \includegraphics[width=\textwidth]{}
        \column{0.25\textwidth}
            Incorrect and incomplete: \\
            \begin{tikzpicture}[line cap=round,line join=round,>=triangle 45]
                \draw [line width=2pt,color=programcolor,fill=programcolor,fill opacity=0.25] (0,0) circle (4em);
                \draw [line width=2pt,color=minimalcolor,fill=minimalcolor,fill opacity=0.4] (0,0) circle (2em);
                \visible<6->{\draw [line width=1pt,dotted,color=slicecolor,fill=slicecolor,fill opacity=0.2] (1em, 1em) circle (2em);}
            \end{tikzpicture}
        % \includegraphics[width=\textwidth]{}
    \end{columns}
\end{frame}

\subsection{The System Dependence Graph}

\begin{frame}[fragile]{The System Dependence Graph}{Creation}
%     \item Código a un lado
%     \item Aparecen nodos que corresponden a statements
%     \item Aparecen arcos (control y data o por pasos).
%     \item Añadir in-out
%     \item No añadir la llamada
\begin{columns}
    \column{0.20\textwidth}
    \begin{java}[basicstyle=\scriptsize\ttfamily,numberstyle=\tiny]
void f(int x) {
  int sum = 0;
  int prod = 0;
  while (x>0) {
    sum += sum;
    prod*=prod;
    x--;
  }
  log(sum);
  log(prod);
}
    \end{java}
    \column{0.8\textwidth}<+->
    \centering
    % TODO: leyenda de data dependence
    \includegraphics<+>[width=1.1\linewidth]{figs/example-sdg-1}
    \includegraphics<+>[width=1.1\linewidth]{figs/example-sdg-2}
    \includegraphics<+>[width=1.1\linewidth]{figs/example-sdg-3}
    \includegraphics<+>[width=1.1\linewidth]{figs/example-sdg-4}
    \includegraphics<+>[width=1.1\linewidth]{figs/example-sdg-5}
    \includegraphics<+>[width=1.1\linewidth]{figs/example-sdg-6}
\end{columns}
\end{frame}

\begin{frame}[fragile]{The System Dependence Graph}{Traversal}
    \begin{columns}
        \column{0.20\textwidth}
        \begin{java}[basicstyle=\scriptsize\ttfamily\color<2->{light-gray},numberstyle=\tiny\color{black},gobble=12]
            (*@\textcolor<4->{black}{void f(}@*)(*@\textcolor<8->{black}{int x}@*)(*@\textcolor<4->{black}{) \{}@*)
              int sum = 0;
              (*@\textcolor<4->{black}{int prod = 0;}@*)
              (*@\textcolor<6->{black}{while (x>0) \{}@*)
                sum += sum;
                (*@\textcolor<4->{black}{prod*=prod;}@*)
                (*@\textcolor<8->{black}{x--;}@*)
              (*@\textcolor<6->{black}{\}}@*)
              log(sum);
              (*@\textcolor<2->{black}{log(\textcolor<1>{criterion}{prod});}@*)
            (*@\textcolor<4->{black}{\}}@*)
        \end{java}
        \column{0.8\textwidth}
        \centering
        \includegraphics<1>[width=1.1\linewidth]{figs/example-sdg} % original graph
        \includegraphics<2>[width=1.1\linewidth]{figs/example-slice-1} % SC marked
        \includegraphics<3>[width=1.1\linewidth]{figs/example-slice-2} % edges
        \includegraphics<4>[width=1.1\linewidth]{figs/example-slice-3} % add 1, 3, 6
        \includegraphics<5>[width=1.1\linewidth]{figs/example-slice-4} % edges
        \includegraphics<6>[width=1.1\linewidth]{figs/example-slice-5} % add 4
        \includegraphics<7>[width=1.1\linewidth]{figs/example-slice-6} % edges
        \includegraphics<8>[width=1.1\linewidth]{figs/example-slice-7} % add 7, x
        \includegraphics<9>[width=1.1\linewidth]{figs/example-slice-8} % edges
        \includegraphics<10->[width=1.1\linewidth]{figs/example-slice} % final slice
    \end{columns}
\end{frame}

\subsection{Exception handling}

\begin{frame}[fragile]{Exception Handling Systems}{Java}
    \begin{columns}
        \column{0.5\textwidth}
        \begin{java}[tabsize=2,gobble=12]
            void main() {
              (*@\textcolor<5->{color1}{try}@*) {
                f();
              } (*@\textcolor<5->{color1}{catch}@*) ((*@\textcolor<6>{color1}{Exception e}@*)) {
                log("caught exception");
              } (*@\textcolor<5->{color1}{catch}@*) ((*@\textcolor<6>{color1}{Throwable e}@*)) {
                log("caught throwable");
              }
            }
        \end{java}
        \column{0.5\textwidth}
        \begin{java}[firstnumber=10,tabsize=2,gobble=12]
            void f() (*@\textcolor<4>{color1}{throws Throwable}@*) {
              switch(x) {
              case A:
                log("no error");
                break;
              case B:
                (*@\textcolor<2-4>{color1}{throw}@*) (*@\textcolor<3-4>{color1}{new Exception()}@*);
              default:
                (*@\textcolor<2-4>{color1}{throw}@*) (*@\textcolor<3-4>{color1}{new Throwable()}@*);
              }
            }
        \end{java}
    \end{columns}
\end{frame}

% TODO: possible animation; selecting each named exception and explaining its contents, then splitting into checked/unchecked.
% TODO: título: jerarquía de herencia
\begin{frame}{Exception Handling Systems}{Java}
    \begin{columns}
        \column{0.5\textwidth}
        \begin{center}
            \includegraphics[height=0.85\textheight]{figs/exception-hierarchy}
        \end{center}
        \column{0.5\textwidth}
        \begin{itemize}
            \item \textit{Checked} (solid): must be caught (\texttt{try-catch}) or declared (\texttt{f() throws T}).
            \item \textit{Unchecked} (dashed).
        \end{itemize}
    \end{columns}
\end{frame}

% TODO: iluminar las que si en otro color
\begin{frame}{Exception Handling Systems}{Other programming languages}
    \begin{table}
        \begin{columns}
            \column{0.6\linewidth}
        \centering
        \begin{tabular}{r | r }
            \textbf{Language}     & $\%$ usage \\ \hline
            \textcolor<2->{hasExcClr}{JavaScript}         & 69.7 \\ \hline
            \textcolor<3->{color2}{HTML/CSS}              & 63.1 \\ \hline
            \textcolor<3->{color2}{SQL}                   & 56.5 \\ \hline
            \textcolor<2->{hasExcClr}{Python}             & 39.4 \\ \hline
            \textcolor<2->{hasExcClr}{Java}               & 39.2 \\ \hline
            \textcolor<3->{color2}{Bash/Shell}/\textcolor<2->{hasExcClr}{PowerShell} & 37.9 \\ \hline
            \textcolor<2->{hasExcClr}{C\#}                & 31.9 \\ \hline
            \textcolor<2->{hasExcClr}{PHP}                & 25.8 \\ \hline
            \textcolor<2->{hasExcClr}{TypeScript}         & 23.5 \\ \hline
            \textcolor<2->{hasExcClr}{C++}                & 20.4 \\ \hline
        \end{tabular}

        \column{0.4\linewidth}
        \begin{tabular}{r | r }
            \textbf{Language}     & $\%$ usage \\ \hline
            \textcolor<3->{color2}{C}                   & 17.3 \\ \hline
            \textcolor<2->{hasExcClr}{Ruby}             &  8.9 \\ \hline
            \textcolor<3->{color2}{Go}                  &  8.8 \\ \hline
            \textcolor<2->{hasExcClr}{Swift}            &  6.8 \\ \hline
            \textcolor<2->{hasExcClr}{Kotlin}           &  6.6 \\ \hline
            \textcolor<2->{hasExcClr}{R}                &  5.6 \\ \hline
            \textcolor<3->{color2}{VBA}                 &  5.5 \\ \hline
            \textcolor<2->{hasExcClr}{Objective-C}      &  5.2 \\ \hline
            \textcolor<3->{color2}{Assembly}            &  5.0 \\ \hline
        \end{tabular}
        \end{columns}
        \caption[Commonly used programming languages]{Programming language by usage in the software industry (StackOverflow's 2019 Developer Survey)}
        \label{tab:popular-languages}
    \end{table}
\end{frame}

\section{Problems and proposals}
\subsection{Problem 1: incorrect slices with nested unconditional jumps}

\begin{frame}[fragile]{Problem 1}{The subsumption correctness error}
    \begin{minipage}{0.39\linewidth}
    \begin{java}[gobble=8]
        public void f() {
          while (X) {
            if (Y) {
              (*@\textcolor<4->{light-gray}{if (Z) \{}@*)
                (*@\textcolor<3->{light-gray}{A;}@*)
                (*@\textcolor<4->{light-gray}{break;}@*)
              (*@\textcolor<4->{light-gray}{\}}@*)
              (*@\textcolor<3->{light-gray}{B;}@*)
              break;
            }
            (*@\textcolor<2->{criterion}{C}@*);
          }
          (*@\textcolor<3->{light-gray}{D;}@*)
        }
    \end{java}
    \end{minipage}
    \begin{minipage}{0.59\linewidth}
        \includegraphics<2>[width=0.9\linewidth]{figs/problem1}
        \includegraphics<3->[width=0.9\linewidth]{figs/problem1-sliced}
    \end{minipage}
\end{frame}

\begin{frame}{Problem 1: proposed solution}{The subsumption correctness error}
    \begin{columns}
        \column{0.5\textwidth}
        \begin{enumerate}
            \item Identify edges caused by unconditional jumps. \pause
            \item Remove from $E_c$ all $(a, b)$ such that $(a', b) \in E_c \wedge a', b \in J \wedge (a', b), (a, b) \in E_{a'}$
            \\ $J$: unconditional jumps
            \\ $E_c$: control edges
            \\ $E_{a'}$: edges caused by $a'$
        \end{enumerate}
        \column{0.5\textwidth}
        \includegraphics<3>[width=0.9\linewidth]{figs/problem1-solution}
        \includegraphics<4->[width=0.9\linewidth]{figs/problem1-solution-sliced}
    \end{columns}
\end{frame}

\subsection{Problem 2: incorrect weak slices}

\begin{frame}[fragile]{Problem 2}{Unnecessary instructions in weak slicing}
    \begin{minipage}{0.33\linewidth}
		\begin{java}[gobble=12]
            void g() {
                int a = 1;
                while (a > 0) {
                    (*@\textcolor<3->{light-gray}{if (a > 10)}@*)
                        (*@\textcolor<3->{light-gray}{break;}@*)
                    (*@\textcolor{red}{a}@*)++;
                }
                (*@\textcolor<2->{light-gray}{log(a);}@*)
            }
		\end{java}
    \end{minipage}
    \begin{minipage}{0.66\textwidth}
        \centering
        \includegraphics<2->[width=0.5\textwidth]{figs/problem2}
    \end{minipage}
\end{frame}

\begin{frame}{Problem 2: proposed solution}{Unnecessary instructions in weak slicing}
    \begin{columns}
        \column{0.5\textwidth}
        \begin{enumerate}
            \item Remove all forward-jumping unconditional jump's nodes.
            \pause[3] \item Traverse the graph.
            \pause \item Re-add all nodes removed if there is any statement in the slice after their destination.
            \pause \item If (3) changed the graph, goto (2).
        \end{enumerate}

        \column{0.5\textwidth}
        \includegraphics<1>[width=0.7\linewidth]{figs/problem2-sol1}
        \includegraphics<2>[width=0.7\linewidth]{figs/problem2-sol2}
        \includegraphics<3-5>[width=0.7\linewidth]{figs/problem2-sol3}
        \includegraphics<6>[width=0.7\linewidth]{figs/problem2-sol4}
    \end{columns}
\end{frame}

\subsection{Problem 3: incomplete \texttt{catch} treatment}

\begin{frame}[fragile]{Problem 3}{The Lack of Dependencies of \texttt{catch} Statements}
    \begin{columns}
        \column{0.4\textwidth}
        \begin{java}[gobble=12,basicstyle=\scriptsize\ttfamily]
            int x;

            void main() (*@\alt<6>{\fcolorbox{black}{pink}{throws Exception}}{throws Exception}@*) {
              try {
                (*@\alt<3-4>{\fcolorbox{black}{lightgreen}{f()}}{f()}@*);
              } (*@\textcolor<11->{light-gray}{\alt<4>{\fcolorbox{black}{pink}{catch (Exception e)}}{catch (Exception e)} \{}@*)
                (*@\textcolor<8,11->{light-gray}{log("error");}@*)
              (*@\textcolor<11->{light-gray}{\}}@*)
              (*@\visible<9->{\alt<9>{\fcolorbox{black}{lightgreen}{x = 0;}}{x = 0;}}@*)
              (*@\alt<5-6>{\fcolorbox{black}{lightgreen}{f()}}{f()}@*);
            }

            void f() throws Exception {
              x++;
              if (x > 0)
                throw new Exception();
              log((*@\textcolor{criterion}{x}@*));
            }
        \end{java}
        \column<+->{0.6\textwidth}
        \includegraphics<+>[width=1.1\textwidth]{figs/problem3-data-edge}
        \includegraphics<+>[width=1.1\textwidth]{figs/problem3-data-edge-color-f1}
        \includegraphics<+>[width=1.1\textwidth]{figs/problem3-data-edge-color-f1-error}
        \includegraphics<+>[width=1.1\textwidth]{figs/problem3-data-edge-color-f2}
        \includegraphics<+>[width=1.1\textwidth]{figs/problem3-data-edge-color-f2-error}
        \includegraphics<+>[width=1.1\textwidth]{figs/problem3-data-edge}
        \includegraphics<+>[width=1.1\textwidth]{figs/problem3-data-edge-sliced}        
        \includegraphics<+>[width=1.1\textwidth]{figs/problem3-color-x0}
        \includegraphics<+>[width=1.1\textwidth]{figs/problem3}
        \includegraphics<+>[width=1.1\textwidth]{figs/problem3-sliced}
    \end{columns}
\end{frame}

% \begin{frame}[fragile,label=p3]{Problem 3}{The lack of dependencies of \texttt{catch} statements}
%     \begin{columns}
%         \column{0.4\textwidth}
%         \begin{java}[gobble=12,basicstyle=\scriptsize\ttfamily]
%             void main() throws Exception {
%               try {
%                 f();
%               } (*@\textcolor<2->{light-gray}{catch (Exception e) \{}@*)
%                 (*@\textcolor<2->{light-gray}{log("error");}@*)
%               (*@\textcolor<2->{light-gray}{\}}@*)
%               x = 0;
%               f();
%             }

%             void f() throws Exception {
%               x++;
%               if (x < 0)
%                 throw new Exception();
%               log((*@\textcolor{criterion}{x}@*));
%             }
%         \end{java}

%         % TODO: highlight each section of the graph.
%         \column{0.6\textwidth}
%         \includegraphics<1>[height=0.9\textheight]{figs/problem3}
%         \includegraphics<2>[height=0.9\textheight]{figs/problem3-sliced}
%     \end{columns}
% \end{frame}

% % TODO: reorder, good approach, error, solution
% \begin{frame}{Problem 3}{The lack of dependencies of \texttt{catch} statements}
%     \centering
%     \includegraphics<+>[height=0.9\textheight]{figs/problem3}
%     \includegraphics<+>[height=0.9\textheight]{figs/problem3-data-edge}
%     \includegraphics<+>[height=0.9\textheight]{figs/problem3-data-edge-sliced}
% \end{frame}

% \againframe<1>{p3}

\begin{frame}{Problem 3: proposed solution}{The lack of dependencies of \texttt{catch} statements}
    \centering
    \includegraphics<+>[height=0.9\textheight]{figs/problem3}
    \includegraphics<+>[height=0.9\textheight]{figs/problem3-color}
    \includegraphics<+>[height=0.9\textheight]{figs/problem3-sol-color}
    \includegraphics<+>[height=0.9\textheight]{figs/problem3-sol}
    \includegraphics<+>[height=0.9\textheight]{figs/problem3-sol-sliced}
\end{frame}

\section{Conclusions}

\begin{frame}{Conclusions}
    \begin{itemize}
        \item<+-> Program slicing: a powerful technique, not yet complete for commonly used programming languages.
        \item Efficiency vs. completeness and correctness.
        \item<+-> Results: 3 problems and proposed solutions.
        % \begin{itemize}
        %     \item
        %     \item Problem 1: submitted to LCTES 2020 (ACM SIGPLAN Languages, Compilers and Tools for Embedded Systems).
        % \end{itemize}
    \end{itemize}
\end{frame}

\begin{frame}{Future work}
    \begin{itemize}
        % \item Publish Problem 2 and Problem 3.
        \item Improve correctness of \texttt{try-catch}.
        \item Implement into existing software tools, benchmark against state of the art.
        \item Adapt to other variants of program slicing.
        \item Redefine control dependence (extend Danicic's work \cite{DanBHHKL11}), \textit{execution dependence} vs. \textit{presence dependence}.
    \end{itemize}
\end{frame}

\appendix
% \section*{Extra slides}

\begin{frame}[noframenumbering]{Related work}
    Change to state of the art and move to introduction
    \begin{itemize}
        \item 1988: Horwitz, Reps and Ball \cite{HorwitzRB88} present the SDG.
        \item 1993: Ball and Horwitz \cite{BalH93} present SDG with unconditional jumps
        \item 1998: Sinha and Harrold \cite{SinH98,SinHR99} present SDG with exceptions.
        \item 2003: Allen and Horwitz \cite{AllH03} improves \cite{SinH98}.
        \pause
        \item 2004: Jo and Chang \cite{JoC04} present an alternative construction of the graph (not demonstrated, not an improvement).
        \item 2006: Jiang et al. \cite{JiaZSJ06} propose a solution for C++, not applicable.
        \item 2011: Prabhy, Maeda and Blakrishnan \cite{PraMB11} propose another solution for C++, no notable improvement.
        \item 2011: Jie and Shu-juan \cite{JieS11} introduce Object-Oriented + Exception SDG, same errors as \cite{AllH03}.
    \end{itemize}
\end{frame}

\begin{frame}[noframenumbering]{Program slicing}{Strong and Weak Slices}
    \begin{definition}[Strong slice \cite{Wei81}]
        Given a program $P$, its slice $S$ w.r.t. a slicing criterion $SC$ is a subset of the statements ($S \subseteq P$) such that the execution of $S$ yields the same sequence of values on $SC$ as the execution of $P$.
    \end{definition}
    \begin{definition}[Weak slice \cite{BinG96}]
        Given a program $P$, its slice $S$ w.r.t. a slicing criterion $SC$ is a subset of the statements ($S \subseteq P$) such that the execution of $S$ yields a sequence of values on $SC$ ($\textit{seq}_S$), the execution of $P$ yields a sequence of values on $SC$ ($\textit{seq}_P$), and $\textit{seq}_P$ is a prefix of $\textit{seq}_S$.
    \end{definition}
\end{frame}

\begin{frame}[noframenumbering]{Program Slicing}{Strong and Weak Slices: Example}
    \begin{table}
		\centering
		\label{tab:slice-weak}
		\begin{tabular}{r | r | r | r | r | r }
			Original program & 1 & 2 & 6 & - & - \\ \hline
			Slice A & 1 & 2 & 6 & - & - \\ \hline
			Slice B & 1 & 2 & 6 & 24 & 120 \\ \hline
			Slice C & 1 & 1 & 1 & 1 & 1 \\
		\end{tabular}
		\caption{Sequences of values produced on the slicing criterion.}
	\end{table}
\end{frame}

\begin{frame}[noframenumbering,allowframebreaks]{Bibliography}
    \printbibliography
\end{frame}

\end{document}