如何以列表形式排版公理逻辑证明?

如何以列表形式排版公理逻辑证明?

我正在尝试以列表形式排版一些公理逻辑证明。我尝试定义一个新环境,以便我可以将包proof的环境amsthm与表格结合起来,结果得到了下面丑陋的图片。

我想要实现的是,证明的行自动编号(我试图用计数器来实现),它们具有与枚举相同的缩进,描述很好地对齐(这就是我尝试使用表格的原因)并且 QED 符号放置正确。

我怎样才能做到这一点?

丑陋,丑陋的证据。

\documentclass{article}
\usepackage{array,amsthm,amssymb,amsmath}
\newcounter{rowcount}
\newenvironment{listproof}
{\setcounter{rowcount}{0}
  \begin{proof}\mbox{}\\\\
    \begin{tabular}{@{\stepcounter{rowcount}(\alph{rowcount})\hspace*{\tabcolsep}}ll}}
    {\end{tabular}\end{proof}}
\newtheorem{thm}{Theorem}
\newcommand{\necc}{\ensuremath{\mathbin{\Box}}}
\newcommand{\limpl}{\ensuremath{\mathbin{\rightarrow}}}
\newcommand{\theo}{\ensuremath{\mathrel{\vdash}}}

\begin{document}
\begin{thm}
  $\theo\phi\limpl\psi \implies \theo\necc\phi\limpl\necc\psi$.
 \end{thm}

 \begin{listproof}
   $\phi\limpl\psi$ & given\\
   $\necc(\phi\limpl\psi)$ & N, a\\
   $\necc(\phi\limpl \psi)\limpl(\necc \phi\limpl\necc\psi)$ & $[\phi/p, \psi/q]\,$K\\
   $\necc{\phi}\limpl\necc{\psi}$ & MP, b, c\\
 \end{listproof} 
\end{document}

答案1

你几乎就到了。

\documentclass{article}
\usepackage{array,amsthm,amssymb,amsmath,enumitem}

\newcounter{rowcount}
\newenvironment{listproof}
 {\setcounter{rowcount}{0}%
  \begin{proof}\mbox{}\\*
  \begin{tabular}[b]{
    @{%
     \stepcounter{rowcount}%
%     \makebox[\dimexpr\leftmargini-\labelsep][r]{(\alph{rowcount})}\hspace{\labelsep}}
     \makebox[\leftmargini][r]{(\alph{rowcount})\hspace{\labelsep}}}
    ll@{}
  }%
 }
 {\end{tabular}\end{proof}}

\newtheorem{thm}{Theorem}
\newcommand{\necc}{\mathbin{\Box}}
\newcommand{\limpl}{\mathbin{\rightarrow}}
\newcommand{\theo}{\mathrel{\vdash}}

\begin{document}
\begin{thm}
$\theo\phi\limpl\psi \implies \theo\necc\phi\limpl\necc\psi$.
\end{thm}

\begin{listproof}
  $\phi\limpl\psi$ & given\\
  $\necc(\phi\limpl\psi)$ & N, a\\
  $\necc(\phi\limpl \psi)\limpl(\necc \phi\limpl\necc\psi)$ & $[\phi/p, \psi/q]\,$K\\
  $\necc{\phi}\limpl\necc{\psi}$ & MP, b, c\\
\end{listproof} 

\begin{enumerate}[label=(\alph*),noitemsep]
\item test
\item test
\item test
\item test
\end{enumerate}

\end{document}

QED\begin{tabular}[b]符号将与表格底部对齐。标签设置在框\leftmargini宽内,与第一级列表使用的相同。

在此处输入图片描述

我删除了无用的部分和空白行;如果您需要更多垂直空间,\ensuremath您可以使用它。这确保不会出现分页符。\\*[1ex]*

相关内容