5

I've written a proof in LaTeX, and I looked up how to use the proof environment. From what I read, it should start with "Proof:" and end with \qed, but the PDF shows no changes. It simply displays the text verbatim. What could be the cause of this? My code is as follows:

\documentclass[12pt]{report}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{float}
\usepackage{framed}
\usepackage[hang,flushmargin]{footmisc}

\newtheorem{theorem}{Theorem}[section]
\newtheorem{corollary}{Corollary}[theorem]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{definition}{Definition}[section]

\begin{document} 
\begin{proof}
    \noindent Assume that $R$ decides $HALT_{TM}$, and obtain a contradiction. Construct $S$ to decide $A_{TM}$, where $S$ operates as follows: \newline \newline 
    $S=$ ``On input $\langle M, w \rangle$, an encoding of a TM $M$ and a string $w$:
    \begin{enumerate}
    \item Run TM $r$ on input $\langle M, w \rangle$.
    \item If $R$ rejects, reject
    \item If $R$ accepts, accept
    \item If $M$ has accepted, accept; if $M$ has rejected, reject."
    \end{enumerate}

    \noindent \newline If $R$ decides $HALT_{TM}$, then $S$ decides $A_{TM}$. Because $A_{TM}$ is undecidable, $HALT_{TM}$ must also be undecidable. 
    \end{proof}
\end{document}
user83024
  • 121
  • please fix your example to be a complete document that shows the problem. proof isn't defined by default but several packages define environments of this form so it is impossible to guess what definitions you are using. – David Carlisle Jul 05 '18 at 23:26
  • Do you require a picture of the PDF? If so, how do I do that? – user83024 Jul 05 '18 at 23:30
  • as posted the document produces the error ! LaTeX Error: Environment proof undefined. after an error you shouldn't really even look at the pdf, you need to fix the error first, – David Carlisle Jul 05 '18 at 23:33
  • I'm not getting any errors. That's why I'm confused. – user83024 Jul 05 '18 at 23:34
  • did you intend to load the amsthm package? – David Carlisle Jul 05 '18 at 23:34
  • try the above document (not your original document) proof is not defined – David Carlisle Jul 05 '18 at 23:35
  • Are you saying I should have, or that I did and shouldn't have? – user83024 Jul 05 '18 at 23:36
  • meanwhile other comments, you should never need \noindent and certainly not \noindent \newline also \newline \newline produces the warning that this produces output with maximum measure of badness: Underfull \hbox (badness 10000) in paragraph at lines 17--19 finally $HALT_{TM}$ would be better as $\mathrm{HALT}_{\mathrm{TM}}$ otherwise it will be typeset in math italic with spaced letters to look like a product of variables, not a word. – David Carlisle Jul 05 '18 at 23:39
  • I am saying that the document posted above does not define a proof environment so you just get an error at that point which explains why it is not typeset as a proof. one way to define a proof environment is to load amsthm – David Carlisle Jul 05 '18 at 23:40
  • Ah, I see. Is there a way to produce the same layout but remove the \newline \newline and so on? – user83024 Jul 05 '18 at 23:43
  • just leave a blank line for a new paragraph, whether paragraphs are indented or set off by vertical space should be a global document setting not something controlled by \noindent etc in each case. – David Carlisle Jul 05 '18 at 23:50

1 Answers1

6

enter image description here

The proof environment is not defined so you get the error

! LaTeX Error: Environment proof undefined.

a common way to define it is to load amsthm when you get a proof heading and qed box at the end.

\documentclass[12pt]{report}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{float}
\usepackage{framed}
\usepackage[hang,flushmargin]{footmisc}

\usepackage{amsthm}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{corollary}{Corollary}[theorem]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{definition}{Definition}[section]

\begin{document} 
\begin{proof}
    Assume that $R$ decides $\mathrm{HALT}_{\mathrm{TM}}$, and obtain a contradiction. Construct $S$ to decide $A_{\mathrm{TM}}$, where $S$ operates as follows: 

    $S={}$ ``On input $\langle M, w \rangle$, an encoding of a TM $M$ and a string $w$:
    \begin{enumerate}
    \item Run TM $r$ on input $\langle M, w \rangle$.
    \item If $R$ rejects, reject
    \item If $R$ accepts, accept
    \item If $M$ has accepted, accept; if $M$ has rejected, reject."
    \end{enumerate}

     If $R$ decides $\mathrm{HALT}_{\mathrm{TM}}$, then $S$ decides $A_{\mathrm{TM}}$. Because $A_{\mathrm{TM}}$ is undecidable, $\mathrm{HALT}_{\mathrm{TM}}$ must also be undecidable. 
    \end{proof}
\end{document}
David Carlisle
  • 757,742
  • Thank you! I guess ShareLaTeX is missing some info. At least, from what I could see. – user83024 Jul 05 '18 at 23:52
  • @user83024 i am sure that sharelatex is flagging errors if you look in the right place, also it can show you the log file which will also have the error message. I can't give details as I don't use it myself – David Carlisle Jul 05 '18 at 23:56