\documentstyle[12pt]{article}
\textheight     9.4truein
\textwidth      6.5truein
\topmargin      0.0truein
\oddsidemargin  0.0truein
\evensidemargin 0.0truein
\textheight     9.4truein
\textwidth      6.5truein
\footheight     0.0truein
\footskip       0.0truein
\headheight     0.0truein
\headsep        0.0truein
\newlength{\lineheight}
\setlength{\lineheight}{11pt}
\newcommand{\ls}[1]{\baselineskip=#1\lineheight}
\newcommand{\doublearrow}{\leftarrow}
\newcommand{\lt}{<}
\begin{document}
\Huge

\begin{center}
BATTLE POWERSET
\end{center}

\noindent Let $S$ be a set of integers. For example:

\[
S = \{1,-2,17\}
\]

\noindent The {\it powerset} of $S$ is the set of 
all subsets of $S$:

\[
{\cal P}(S) = \{ \{\}, \{ 1\} , \{ -2\} , \{ 17\} ,
\]
\[
 \{1, -2\} , \{1, 17\} , \{-2, 17\} , \{ 1, 2, 17\} \}
\]

\noindent Note in particular that:

\begin{itemize}
\item $S \in {\cal P}(S)$ for all $S$.
\item $\{\} \in {\cal P}(S)$ for all $S$.
\item ${\cal P}(\{\}) = \{\{\}\}$.
\end{itemize}

\newpage

\begin{center}
BATTLE POWERSET (contd.)
\end{center}

\noindent A set of sets of integers can be represented as
a text file. Each line represents a set of
integers.  The empty set can be represented as 
an empty line. For example, the set

\[
A = \{\{1,2\}, \{\}, \{4\}, \{1, -2, -17\}, \{5, 6\}\}
\]

\noindent can be represented as follows:

\begin{verbatim}
1 2

4
1 -2 -17
5 6
\end{verbatim}

\newpage

\begin{center}
BATTLE POWERSET (contd.)
\end{center}

\noindent The same set can also be represented as a file
which looks like this:

\begin{verbatim}
(define A '(
(1 2)
()
(4)
(1 -2 -17)
(5 6)
))
\end{verbatim}

\noindent Use whichever format you prefer.

\newpage

\begin{center}
BATTLE POWERSET (contd.)
\end{center}

\noindent Write a program which decides whether or not
a set of sets of integers is a powerset. The program 
prints ``good'' if the file represents a powerset 
and ``bad'' otherwise. 

\newpage

\begin{center}
BATTLE POWERSET (contd.)
\end{center}

Here is an example of ``good'' input:

\begin{verbatim}
1
1 -2
-2
17 -2
17
17 -2 1

1 17
\end{verbatim}

\begin{verbatim}
(define B '(
(1)
(1 -2)
(-2)
(17 -2)
(17)
(17 -2 1)
()
(1 17)
))
\end{verbatim}

\newpage

\begin{center}
BATTLE POWERSET (contd.)
\end{center}

\noindent Here is an example of ``bad'' input:

\begin{verbatim}
1
1 -2
-2
17 -2 1
17 5
17

1 17
\end{verbatim}

\begin{verbatim}
(define C '(
(1)
(1 -2)
(-2)
(17 -2 1)
(17 5)
(17)
()
(1 17)
))
\end{verbatim}

\newpage

\begin{center}
BATTLE POWERSET (contd.)
\end{center}

Hint: Implement a set ADT. A set is like a list
but the order of elements does not matter and 
there can be no duplicates. Make sure that your ADT is 
general enough to handle sets of sets.

\newpage

\begin{center}
BATTLE POWERSET (contd.)
\end{center}

Who's cuisine reigns supreme? Will it be the 
{\it Pundits of Perl}...or the {\it Champions of Scheme}?

\end{document}









