我用 LaTeX 写了一个证明,并查找了如何使用证明环境。从我读到的内容来看,它应该以“证明:”开头并以 \qed 结尾,但 PDF 没有任何变化。它只是逐字显示文本。这可能是什么原因造成的?我的代码如下:
\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}
答案1
环境proof
未定义,因此您会收到错误
! LaTeX Error: Environment proof undefined.
定义它的一种常见方法是amsthm
当您获得proof
标题和末尾的 qed 框时加载。
\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}