\documentclass[12pt]{article}

\usepackage{amssymb,amsmath,amsthm}
\usepackage[top=1in, bottom=1in, left=1.25in, right=1.25in]{geometry}
\usepackage{fancyhdr}
\usepackage{enumerate}
\usepackage{color}

%% Import a package useful for displaying graphics.
\usepackage{graphicx}

% Comment the following line to use TeX's default font of Computer Modern.
\usepackage{times,txfonts}

% Adjust line spacing an indentation
\parindent 0pt
\parskip 6pt plus 1pt

\newtheoremstyle{ex215}% name of the style to be used
  {18pt}% measure of space to leave above the theorem. E.g.: 3pt
  {12pt}% measure of space to leave below the theorem. E.g.: 3pt
  {}% name of font to use in the body of the theorem
  {}% measure of space to indent
  {\bfseries}% name of head font
  {:}% punctuation between head and body
  {2ex}% space after theorem head; " " = normal interword space
  {}% Manually specify head
\theoremstyle{ex215} 

\makeatletter
\newtheorem*{lemmacore}{Lemma \@currentlabel}
\newenvironment{lemma}[1]
{\def\@currentlabel{#1}\lemmacore}
{\endlemmacore}

\newtheorem*{corollarycore}{Corollary \@currentlabel}
\newenvironment{corollary}[1]
{\def\@currentlabel{#1}\corollarycore}
{\endcorollarycore}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Stuff for getting the name/document date/title across the header
\RequirePackage{fancyhdr}
\pagestyle{fancy}
\fancyfoot[C]{\ifnum \value{page} > 1\relax\thepage\fi}
\fancyhead[L]{\ifx\@doclabel\@empty\else\@doclabel\fi}
\fancyhead[C]{\ifx\@docauthor\@empty\else\@docdate\fi}
\fancyhead[R]{\ifx\@docauthor\@empty\@docdate\else\@docauthor\fi}
\headheight 15pt


\def\doclabel#1{\gdef\@doclabel{#1}}
\doclabel{Use {\tt\textbackslash doclabel\{MY LABEL\}}.}
\def\docdate#1{\gdef\@docdate{#1}}
\docdate{Use {\tt\textbackslash docdate\{MY DATE\}}.}
\def\docauthor#1{\gdef\@docauthor{#1}}
%\docauthor{Use {\tt\textbackslash docauthor\{MY NAME\}}.}
\let\@docauthor\@empty

\newcounter{probcount}
\newcounter{subprobcount}
\newlength\probsep
\newlength\pshrinking
\newif\iffirstprob

% The following commands allow for a handy override of labels in an enumeration,
% without having the user keep track of what level the enumeration is happening at.
% To use them, just put \listlabel{....} as the first command after a \begin{enumerate}.
% The '....' is used to define the label.  You can access the name of the current label
% counter with \thelistlabel.  Hence \listlabel{\textbf{\Alph{\thelistlabel}:}} would
% generate lists with bold labels A:, B:, C:, etc.
\newcommand{\listlabel}[1]{\def\thelistlabel{\@enumctr}%
            \expandafter\def\csname label\@enumctr\endcsname{#1}}


\newenvironment{subproblems}%
  {\begin{enumerate}\listlabel{\alph{\thelistlabel})}%
  %% Make the enumerate environment think we are making a list in a list:
  \global \@newlistfalse}%
  {\end{enumerate}}%

\newenvironment{problems}%
  {\ifhmode\unskip\par\fi\setcounter{probcount}{0}\probsep\parskip
  \sbox\@tempboxa{\textbf{9.}}\pshrinking\wd\@tempboxa\advance\pshrinking\labelsep
  \advance\linewidth -\pshrinking
  \advance\@totalleftmargin\pshrinking
  \advance\leftskip\pshrinking}%
  {\ifhmode\unskip \par\fi\advance\leftskip-\pshrinking}%

\newcommand{\problem}{%
  \setcounter{subprobcount}{0}%
  \stepcounter{probcount}%
  \def\@currentlabel{\arabic{probcount}}%
  \ifhmode
    \unskip \par
  \fi
%  \addpenalty{-4000}%
  \iffirstprob\else\addvspace\probsep\fi
  \firstprobfalse
  \hskip -\labelwidth\hskip -\labelsep 
  \hbox to\labelwidth{\hss\textbf{\arabic{probcount}.}}\hskip\labelsep
}%

%% The localhead command puts a label on top of a paragraph -- handy for labels
%% like "Solution:"
\newskip\restoreparskip
\newcommand{\localhead}[1]{\par\smallskip\textbf{#1}\nobreak\\}%
%% The following arcane code was added to make the localhead enviroment get along
%% with the ams theorem enviroment (which is based on the latex list enviroment).
%% previously, the command was {\par\smallskip\textbf{#1}\\}, but the list
%% enviroment would also add a par at the end of this paragraph, which would result
%% in an extra blank line.  Our solution now is to put in our own par, but with
%% none of the parskip glue that adds extra space between paragraphs.
%%  \restoreparskip\parskip\parskip 0pt\par\nobreak\noindent\parskip\restoreparskip}%
\newcommand\solution{\localhead{Solution:}}
\newcommand\subsol{\stepcounter{subprobcount}\localhead{Solution, part \alph{subprobcount}:}}
\newcommand\subsoleg[1]{\stepcounter{subprobcount}\par\textbf{Solution, part \alph{subprobcount}:} #1\\}
\def\solver#1{(Solution by #1)\\\vskip-12pt}


%% The default 'article' class has captions that label figures Figure 1, etc.  This is too 
%% formal for homework sets, so we change \caption so that it just puts the caption text.
%% Here I have just modified the \@makecaption command from the article class.
%% Maybe I should change this in the future to let authors decide whether or not to label a figure.

\long\def\@makecaption#1#2{%
  \vskip\abovecaptionskip
  \sbox\@tempboxa{#2}%
  \ifdim \wd\@tempboxa >\hsize
    #2\par
  \else
    \global \@minipagefalse
    \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
  \fi
  \vskip\belowcaptionskip}

%% The default implementation of the proof environment starts a new paragraph at the start of the proof,
%% with the full parskip spacing. This only looks good following a theorem statement 
%% if \parskip is set to zero.  We've got a medium sized parskip, so we overide this 
%% questionable decision.
\renewenvironment{proof}[1][\proofname]{\par
  \pushQED{\qed}%
  \normalfont \topsep6\p@\@plus6\p@\relax
  \trivlist
  \@topsep \topsep
  \item[\hskip\labelsep
        \itshape
    #1\@addpunct{.}]\ignorespaces
}{%
  \popQED\endtrivlist\@endpefalse
}
\makeatother

% Shortcuts for blackboard bold number sets (reals, integers, etc.)
\newcommand{\Reals}{\ensuremath{\mathbb R}}
\newcommand{\Nats}{\ensuremath{\mathbb N}}
\newcommand{\Ints}{\ensuremath{\mathbb Z}}
\newcommand{\Rats}{\ensuremath{\mathbb Q}}
\newcommand{\Cplx}{\ensuremath{\mathbb C}}
%% Some equivalents that some people may prefer.
\let\RR\Reals
\let\NN\Nats
\let\II\Ints
\let\CC\Cplx


% The following commands set up the material that appears
% in the header.
\doclabel{Math 651: Demo Homework}
\docauthor{Your name here.}
\docdate{August 28, 2017}

\begin{document}
\begin{problems}

\problem Exercise 0.1 \solver{John Gimbel}
If $a$ and $b$ are even integers, then so is $a+b$.
\solution
Let $a$ and $b$ be even integers.  Then there exist integers
$j$ and $k$ such that $a=2j$ and $b=2k$.  But then
\begin{equation}
a+b = 2j+ 2k = 2(j+k).
\end{equation}
Since $j+k\in\Ints$, $a+b$ is even.

\problem Exercise 0.2 \solver{Jill Faudree}
Let $X$ be a set.
\begin{subproblems}
\item An intersection of topologies on $X$ is a topology on $X$.
\item A union of topologies on $X$ need not be a topology.
\end{subproblems}
\subsol
Let $\{\tau_\alpha\}$ be a family of topologies and let $\tau=\cap_\alpha \tau_\alpha$.  
Observe that $\emptyset$ and $X$ belong to $\tau$ as they belong to each $\tau_\alpha$.

Suppose $\{U_\beta\}$ is a family of sets in $\tau$ and let $U=\cup_\beta U_\beta$. 
Fix $\alpha$ and observe that each $U_\beta\in \tau_\alpha$. Since $\tau_\alpha$
is a topology, $U\in\tau_\alpha$.  Since $\alpha$ is arbitrary, $U\in\cap\tau_\alpha=\tau$.

The proof that a finite intersection of sets in $\tau$ belongs to $\tau$ is essentially similar.

\subsol
Let $X=\{1,2,3\}$.  Let $\tau_1 = \{\emptyset, \{1\}, X\}$ and let $\tau_2 = \{\emptyset, \{2\}, X\}$.
It is easy to see that these are topologies.
Let $T=\tau_1\cup \tau_2 = \{\emptyset, \{1\}, \{2\}, X\}$.   Observe that $T$ is not closed under
taking unions as $\{1\}$ and $\{2\}$ are elements of $T$ but $\{1,2\}$ is not.

\problem Exercise 0.3 \solver{Elizabeth Allman}
Let $X$ be a metric space.  Showt that 
the collection of open balls in $X$ forms the basis of a topology.

\solution
We start with a technical lemma.
\begin{lemma}{A}\label{lem:DAMrefine}  
Suppose $B_1=B_{r_1}(x_1)$ and $B_2=B_{r_2}(x_2)$ are 
open balls in $X$ an $x_3\in B_1\cap B_2$.  Then there is an $r>0$ such
that $B_r(x_3)\subseteq B_1\cap B_2$.
\end{lemma}
\begin{proof}
Let $r = \min(r_1-d(x_3,x_1),r_2-d(x-2,x_2)$ and observe that $r>0$.  Now suppose
$z\in B_{r}(x_3)$.  The triangle inequality implies
\begin{align*} 
d(x_1,z)&\le d(x_1,x_3) + d(x_3,z) \\
&< d(x_1,x_3) + r \\
&\le d(x_1,x_3) + ( r_1-d(x_3,x_1) ) \\
&= r_1
\end{align*}
Hence $z\in B_{r_1}(x_1)=x_1$.  Similarly $z\in B_2$, and hence $B_r(z)\subseteq B_1\cap B_2$.
\end{proof}

Let $\mathcal{B}$ be the collection of open balls in $X$.  Fix $x\in X$ and note
that $\cup_{r>0} B_r(x)=X$.  Hence $\mathcal{B}$ covers $X$.  Moreover, by Lemma
\ref{lem:DAMrefine}, $\mathcal{B}$ satisfies the refinement property.  Hence
by the topology construction lemma, $\mathcal{B}$ generates a topology on $X$,
and the open sets are simply the unions of open balls.

\end{problems}
\end{document}