%\documentclass[t,12pt,numbers,fleqn,handout]{beamer}
\documentclass[t,12pt,numbers,fleqn]{beamer}

\usepackage{pgfpages} 
\usepackage{hyperref}
\hypersetup{colorlinks=true,
    linkcolor=blue,
    citecolor=blue,
    filecolor=blue,
    urlcolor=blue,
    unicode=false}
\urlstyle{same}

\usepackage{hhline}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{multicol}
\usepackage{array}
\usepackage{listings}

\usepackage{amssymb}
\usepackage{amsmath}

\useoutertheme{split} %so the footline can be seen, without needing pgfpages

% \pgfpagesuselayout{resize to}[letterpaper,border
% shrink=5mm,landscape] %if this is uncommented, the hyperref links do not work

\mode<presentation>{}

\input{../def-beamer}
\Draftfalse

\newcommand{\topicTitle}{28 Parnas Tables}
\ifDraft
\newcommand{\topic}{\topicTitle~DRAFT}
\else
\newcommand{\topic}{\topicTitle}
\fi

\input{../titlepage}

\begin{document}

\input{../footline}

\lstset{language=java,breaklines=true,showspaces=false,showstringspaces=false,breakatwhitespace=true}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{\topic}

\begin{itemize}
\item Today's slide are partially based on slides by Dr.\ Wassyng
\item Administrative details
\item Design patterns
\item Motivating example: midterm question
\item History of tables
\item Example tables
\item Semantics for tables
\item Classification of tables
\item Tables in practise
\item Advantages of tables
\item pointInRegion(p)
\end{itemize}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Administrative Details}

\ifDraft  
TBD
\else
{
\begin{itemize}

\item Multiple potential Academic Dishonesty cases are currently being
  investigated

\item A3
\begin{itemize}
\item Part 2 - Code: due 11:59 pm Mar 26
\end{itemize}

\item A4
\bi
\item Due April 9 at 11:59 pm
\ei

\end{itemize}
}
\fi

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Command Processor Pattern}

\begin{itemize}

\item Context: User interfaces which must be flexible or provide functionality that goes beyond the direct handling of
user functions.  Examples are undo facilities or logging functions
\item Problem: We want a well-structured solution for mapping an interface to the internal functionality of a system. 
All `extras' which have to do with the way user commands are input, additional commands such as undo and redo, and any
non-application-specific processing of user commands, such as logging, should be kept separate from the interface to
the internal functionality.

\end{itemize}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Command Processor Pattern Continued}

\begin{itemize}

\item Solution: A separate component, the \structure{command processor}, takes care of all commands.  The command
processor component schedules the execution of commands, stores them for later undo, logs them for later analysis, and
so on.  The actual execution of the command is delegated to a supplier component within the application.

\end{itemize}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Command in UML}

\includegraphics[scale=0.8]{../Figures/command.png}
~\\
\href{http://www.dofactory.com/net/command-design-pattern}
{http://www.dofactory.com/net/command-design-pattern}

%invoker can track list of previous commands
%command can include undo execute
%receiver actually knows how to do the calculation
%client associates receiver and concrete command

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Adapter Design Pattern}

\structure{When have we used the adapter (or wrapper) design pattern?}

% wrapper for sequence for A1
% npolyVal(n, x) implemented by numpy polyfit
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Adapter Design Pattern}

\includegraphics[scale=0.7]{../Figures/500px-AdapterPatternForWiki.jpg}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Adapter UML Diagram}

\includegraphics[scale=0.42]{../Figures/Adapter.png}

\href{https://commons.wikimedia.org/wiki/File:Adapter_using_delegation_UML_class_diagram.png}
{Link}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Factory Pattern}

\includegraphics[scale=0.55]{../Figures/factory_pattern_uml_diagram.jpg}

\href{https://www.tutorialspoint.com/design_pattern/factory_pattern.htm}{Code}

% create object without exposing the creation logic, refer to newly created
% object using a common interface.
% Client is decoupled from the implementation details of derived classes
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Singleton Pattern}

\includegraphics[scale=1.7]{../Figures/Singleton.jpg}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Tables Motivating Example: ptOn(c, s)}

\begin{align*}
(x(c) = x(s) &\Rightarrow \begin{aligned} (y(s) \leq y(f) &\Rightarrow y(s) \leq
  y(c) \leq y(f) | \\ y(s) > y(f) &\Rightarrow y(f) \leq y(c) \leq y(s)
  )\end{aligned}\\
| y(c) = y(s) &\Rightarrow \begin{aligned} (x(s) \leq x(f) &\Rightarrow x(s) \leq
  x(c) \leq x(f) | \\ x(s) > x(f) &\Rightarrow x(f) \leq x(c) \leq x(s)
  )\end{aligned}\\
| N(c,s) &\Rightarrow \mbox{False} )
\end{align*} 

$N(c,s) \equiv x(c) \neq x(s) \wedge y(c) \neq y(s)$

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{In Tabular Form}

\begin{tabular}{|p{2.5cm}|p{2.5cm}|p{5.1cm}|}
\hhline{~|~|-|}
\multicolumn{1}{r}{} & \multicolumn{1}{r|}{} & \multicolumn{1}{l|}{\textbf{out}}\\
\hhline{|-|-|-|}
{$x(c) = x(s)$} & {$y(s) \leq y(f)$} & {$y(s) \leq y(c) \leq y(f)$}\\
\hhline{|~|-|-|}
~ & {$y(s) > y(f)$} & {$y(f) \leq y(c) \leq y(s)$}\\
\hhline{|-|-|-|}
{$y(c) = y(s)$} & {$x(s) \leq x(f)$} & {$x(s) \leq x(c) \leq x(f)$}\\
\hhline{|~|-|-|}
~ & {$x(s) > x(f)$} & {$x(f) \leq x(c) \leq x(s)$}\\
\hhline{-|-|-|}
\multicolumn{2}{|l|}{{$x(c) \neq x(s) \wedge y(c) \neq y(s)$}} & {$\mbox{False}$}\\
\hhline{|-|-|-|}

\end{tabular}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{A Brief History of Tables}

\begin{itemize}

\item Similar work, such as decision tables, have been around for a while (1950s?)
\item The intuitive use of tables proliferated on the A-7E Aircraft US Naval Research Lab (NRL) project (Parnas)
\item The US NRL continues to work on the SCR (Software Cost Reduction) method
\item Ontario Hydro - Darlington Shutdown Systems
\item Work began on the semantics of tables - Parnas, Janicki, Zucker, Abraham
\item Ontario Power Generation (OPG) methods for Safety Critical Software
\item More semantics - Janicki, Khedri, Kahl, Wassyng
\item Dave Parnas has championed the use of tabular expressions (tables) in documenting software requirements and
designs

\end{itemize}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Example Table from A-7E Project}

\includegraphics[scale=0.47]{../Figures/SCR_A7E_Example.png}\\
%this table does not cover all of the cases

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Example Table from OPG Project}

\includegraphics[scale=0.48]{../Figures/OPG_Example.png}
%f_ means function
%y_ means type
%m_ means monitored
%k_ means constant
%HT is heat transfer
%hys is hysteresis
%sp is set point
%e mean enumerated type
%subscript -1 means previous value
~\\
~\\
\structure{What is this table specifying?}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Example for Input Checking}

\begin{flushleft}
\scalebox{0.75}{
\begin{tabular}{||r|p{6cm}||}
\hhline{=|=}
Composition rule & $\cup_{i=1}^{4} H_2[i] \cap  (\cap_{j=1}^{2} H_1[j] ~;~ G[i,j])$ \\
\hhline{=|=}
\end{tabular}
}
\end{flushleft}

\begin{tabular}{|l|p{0.3cm}|l|l|}
\multicolumn{4}{c}{} \\
\multicolumn{2}{c}{} & \multicolumn{2}{>{\large}c}{$H_1$} \\
\hhline{|~|~|-|-|}
\multicolumn{2}{c|}{} & $S_{GET}'\cup =$ & $ErrorMsg'+=$ \\
\hhline{|~|~|-|-|}
\multicolumn{4}{c}{} \\
\hhline{|-|~|-|-|}
$x_1 < 0$ & & $\emptyset$ & $InvalidInput\_x_1$  \\
\hhline{|-|~|-|-|}
$0 \le x_1 < min_d$ & & $\emptyset$ & $x_1\_TooSmall$ \\
\hhline{|-|~|-|-|}
$x_1 > max_d$ & & $\emptyset$ & $x_1\_TooLarge$ \\
\hhline{|-|~|-|-|}
$min_d \le x_1 \le max_d$ & & $\{@{x_1}\}$ & $NULL$ \\
\hhline{|-|~|-|-|}
\multicolumn{2}{c}{} & \multicolumn{2}{r}{$\land ChangeOnly(S_{GET}, ErrorMsg)$}\\
\multicolumn{2}{>{\large}c}{$H_2$} & \multicolumn{2}{>{\large}c}{$G$} \\
\end{tabular}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Solving Real Roots of $ax^2 + bx + c = 0$}

\includegraphics[scale=0.5]{../Figures/QuadraticEquationExample.png}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Table for Solving the Quadratic Equation}

\includegraphics[scale=0.5]{../Figures/QuadraticEquationTable.png}

\structure<1>{What are the advantages of the tabular specification?}
\uncover<2->{
\bi
\item Understandable
\item Unambiguous
\item Check for completeness and disjointness
\item Test cases
\ei
}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Why We Need Precise Semantics}

\begin{itemize}

\item To promote an unambiguous understanding for both writers and readers
\item To understand the meaning of tables that look similar, but have different semantics
\item To be able to link tables of different types
\item To know what notation we can use in the tables
\item To be able to build software tools that create, edit, transform and print tables

\end{itemize}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Early Semantics}

\begin{tabular}{|p{4cm}|p{4cm}|}
\hhline{~|-}
\multicolumn{1}{r|}{} & \multicolumn{1}{l|}{\textbf{f\_name}}\\
\hhline{|-|-|}
Condition 1 & Result 1\\
\hhline{|-|-|}
Condition 2 & Result 2\\
\hhline{|-|-|}
... & ...\\
\hhline{|-|-|}
Condition n & Result n\\
\hhline{|-|-|}
\end{tabular}
~\newline

If Condition 1 then f\_name = Result 1\\
Elseif Condition 2 then f\_name = Result 2\\
Elseif ...\\
Elseif Condition n then f\_name = Result n\\
or f\_name = (Condition 1 $\Rightarrow$ Result 1 $|$ ...)

~\newline
\uncover<2->{\structure<2>{Disjointedness $\equiv$
$\forall (i, j: \mathbb{N} | 1 \leq i \leq n \wedge 1 \leq j \leq n \wedge i \neq j : \mbox{Condition } i \wedge
\mbox{Condition } j \Leftrightarrow \mbox{false})$\\
~\\
Completeness $\equiv \vee (i: \mathbb{N} | 1 \leq i \leq n : \mbox{Condition } i
)$}}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Semantics}

\includegraphics[scale=0.45]{../Figures/Semantics.png}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Semantics Continued}

\begin{itemize}

\item Disjointedness and Completness are not part of the semantics of tables
\item We impose these conditions to make tables more useful in practise

\end{itemize}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Classification of Tables}

Tabular expressions can be classified according to the orientation of the tables\\
~\newline
Vertical condition tables \\
~\newline
\includegraphics[scale=0.3]{../Figures/VerticalConditionTable.png}\\
~\newline
Horizontal condition tables \\
~\newline
\includegraphics[scale=0.3]{../Figures/HorizontalConditionTable.png}\\

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Types of Tables}

\includegraphics[scale=0.45]{../Figures/TypesOfTables.png}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{World View of Tables}

\bi
\item \structure{Do tables take a dynamic or a static world view?} %static
\item \structure{Can you directly write an algorithm from a table?} %maybe
\ei

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Tables in Practise}

\begin{itemize}

\item According to Dr.\ Wassyng projects typically define a small set of types of tables to be used in that project
\item Tables at Ontario Power Generation, Darlington Nuclear Generating Station - Shutdown System One (SDS1)
\begin{itemize}
\item Horizontal condition tables for requirements - read from left to right, fit on the page well
\item Vertical condition tables for the software design - better suited to multiple outputs
\item Sometimes also state transition tables
\end{itemize}
\item Use table structure to visually aid readers so that they can discern nested conditions (see the quadratic
equation example)
\item Tables enable production of formal requirements that are readable by domain experts
\item Use \structure{natural language expressions} to enhance readability

\end{itemize}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Advantages of Tables}

\begin{itemize}

\item Tabular expressions describe relations through pre and post conditions - ideal for describing behaviour without
sequences of operations
\item They make it easy to ensure input domain coverage
\item They are easy to read and understand (you need just a little practise to write them)
\item Coding from tables results in extremely well structured code
\item They facilitate identification of test cases
\item Extremely good for real-time/embedded systems
\end{itemize}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{A Table for pointInRegion(p)}

\begin{itemize}

\item Consider all of the cases for a rectangle
\item Draw a picture
\item Short form notation
\begin{itemize}
\item $px = p.\mbox{xcoord()}$
\item $py = p.\mbox{ycoord()}$
\item $llx = \mathit{lower\_left}.\mbox{xcoord()}$
\item $lly = \mathit{lower\_left}.\mbox{ycoord()}$
\item $llxw = \mathit{lower\_left}.\mbox{xcoord()} + \mathit{width}$
\item $llyh = \mathit{lower\_left}.\mbox{ycoord()} + \mathit{height}$
\item T = Constants.TOLERANCE
\item $p1$.dist$(p2$) is the distance between p1 and p2
\end{itemize}

\end{itemize}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}[plain]
%\frametitle{A Table for Assignment 4, Part 2, pointInRegion(p)}

\begin{tabular}{|p{2.cm}|p{2.8cm}|p{5.3cm}|}
\hhline{~|~|-|}
\multicolumn{1}{r}{} & \multicolumn{1}{r|}{} & \multicolumn{1}{l|}{\textbf{out}}\\
\hhline{|-|-|-|}
\uncover<2->{$px < llx$} & \uncover<3->{$py < lly$} & \uncover<4->{$p.\mbox{dist}(\mbox{PointT}(llx, lly)) \leq
\mbox{T}$}\\
\hhline{|~|-|-|}
~ & \uncover<3->{$lly \leq py \leq llyh$} & \uncover<5->{$(llx - px) \leq \mbox{T}$}\\
\hhline{|~|-|-|}
~ & \uncover<3->{$py > llyh$} & \uncover<6->{$p.\mbox{dist}(\mbox{PointT}(llx, llyh)) \leq \mbox{T}$}\\
\hhline{-|-|-|}
\uncover<2->{$llx \leq px \leq llxw$} & \uncover<3->{$py < lly$} & \uncover<7->{$(lly-py) \leq\mbox{T}$}\\
\hhline{|~|-|-|}
~ & \uncover<3->{$lly \leq py \leq llyh$} & \uncover<8->{$\mbox{True}$}\\
\hhline{|~|-|-|}
~ & \uncover<3->{$py > llyh$} & \uncover<9->{$(py - llyh) \leq \mbox{T}$}\\
\hhline{-|-|-|}
\uncover<2->{$px > llxw$} & \uncover<3->{$py < lly$} & \uncover<10->{$p.\mbox{dist}(\mbox{PointT}(llxw, lly)) \leq
\mbox{T}$}\\
\hhline{|~|-|-|}
~ & \uncover<3->{$lly \leq py \leq llyh$} & \uncover<10->{$(px-llxw) \leq \mbox{T}$}\\
\hhline{|~|-|-|}
~ & \uncover<3->{$py > llyh$} & \uncover<10->{$p.\mbox{dist}(\mbox{PointT}(llxw,llyh)) \leq \mbox{T}$}\\
\hhline{-|-|-|}

\end{tabular}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Seven Cases}

\begin{tabular}{|p{2.cm}|p{2.8cm}|p{5.3cm}|}
\hhline{~|~|-|}
\multicolumn{1}{r}{} & \multicolumn{1}{r|}{} & \multicolumn{1}{l|}{\textbf{out}}\\
\hhline{|-|-|-|}
\uncover<1->{$px < llx$} & \uncover<1->{$py < lly$} & \uncover<1->{$p.\mbox{dist}(\mbox{PointT}(llx, lly)) \leq
\mbox{T}$}\\
\hhline{|~|-|-|}
~ & \uncover<1->{$lly \leq py \leq llyh$} & \uncover<1->{$(llx - px) \leq \mbox{T}$}\\
\hhline{|~|-|-|}
~ & \uncover<1->{$py > llyh$} & \uncover<1->{$p.\mbox{dist}(\mbox{PointT}(llx, llyh)) \leq \mbox{T}$}\\
\hhline{|-|-|-|}
\multicolumn{2}{|l|}{\uncover<1->{$llx \leq px \leq llxw$}} & \uncover<2->{$(lly-\mbox{T}) \leq py \leq (llyh +
\mbox{T})$}\\
\hhline{|-|-|-|}
\uncover<1->{$px > llxw$} & \uncover<1->{$py < lly$} & \uncover<1->{$p.\mbox{dist}(\mbox{PointT}(llxw, lly)) \leq
\mbox{T}$}\\
\hhline{|~|-|-|}
~ & \uncover<1->{$lly \leq py \leq llyh$} & \uncover<1->{$(px-llxw) \leq \mbox{T}$}\\
\hhline{|~|-|-|}
~ & \uncover<1->{$py > llyh$} & \uncover<1->{$p.\mbox{dist}(\mbox{PointT}(llxw, llyh)) \leq \mbox{T}$}\\
\hhline{-|-|-|}

\end{tabular}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Six Cases}

\begin{tabular}{|p{2.5cm}|p{2.5cm}|p{5.1cm}|}
\hhline{~|~|-|}
\multicolumn{1}{r}{} & \multicolumn{1}{r|}{} & \multicolumn{1}{l|}{\textbf{out}}\\
\hhline{|-|-|-|}
\uncover<1->{$px < llx$} & \uncover<1->{$py < lly$} & \uncover<1->{$p.\mbox{dist}(\mbox{PointT}(llx, lly)) \leq
\mbox{T}$}\\
\hhline{|~|-|-|}
~ & \uncover<1->{$py > llyh$} & \uncover<1->{$p.\mbox{dist}(\mbox{PointT}(llx, llyh)) \leq \mbox{T}$}\\
\hhline{|-|-|-|}
\multicolumn{2}{|l|}{\uncover<1->{$llx \leq px \leq llxw$}} & \uncover<1->{$(lly-\mbox{T}) \leq py \leq (llyh +
\mbox{T})$}\\
\hhline{|-|-|-|}
\uncover<1->{$px > llxw$} & \uncover<1->{$py < lly$} & \uncover<1->{$p.\mbox{dist}(\mbox{PointT}(llxw, lly)) \leq
\mbox{T}$}\\
\hhline{|~|-|-|}
~ & \uncover<1->{$py > llyh$} & \uncover<1->{$p.\mbox{dist}(\mbox{PointT}(llxw, llyh)) \leq \mbox{T}$}\\
\hhline{-|-|-|}
\multicolumn{2}{|l|}{\uncover<1->{$lly \leq py \leq llyh$}} & \uncover<2->{$(llx-\mbox{T}) \leq px \leq (llxw +
\mbox{T})$}\\
\hhline{|-|-|-|}

\end{tabular}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Three Cases}

\begin{tabular}{|p{2.5cm}|p{2.5cm}|p{5.1cm}|}
\hhline{~|~|-|}
\multicolumn{1}{r}{} & \multicolumn{1}{r|}{} & \multicolumn{1}{l|}{\textbf{out}}\\
\hhline{|-|-|-|}
\multicolumn{2}{|p{5cm}|}{\uncover<1->{$llx \leq px \leq llxw$}} & \uncover<1->{$(lly-\mbox{T}) \leq py \leq (llyh +
\mbox{T})$}\\
\hhline{|-|-|-|}
\multicolumn{2}{|p{5cm}|}{\uncover<1->{$lly \leq py \leq llyh$}} & \uncover<1->{$(llx-\mbox{T}) \leq px \leq (llxw +
\mbox{T})$}\\
\hhline{|-|-|-|}
\multicolumn{2}{|p{5cm}|}{\uncover<1->{$\neg(llx \leq px \leq llxw) \wedge \neg(lly \leq py \leq llyh)$}} &
\uncover<2->{$\mbox{min}[p.\mbox{dist}(\mbox{PointT}(llx, lly)),$ $p.\mbox{dist}(\mbox{PointT}(llxw, lly)),$
$p.\mbox{dist}(\mbox{PointT}(llx, llyh)),$ 
$p.\mbox{dist}(\mbox{PointT}(llxw, llyh)) ] \leq \mbox{T}$}\\
\hhline{|-|-|-|}

\end{tabular}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Nine Cases, but 2D}

\bi
\item \structure{How would you write all 9 cases, but with a tabular form that
    closely matches the original 2D problem description?}
\ei

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\end{document}