答案1
另一种解决方案基于listliketab
:
\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage{listliketab}
\begin{document}
\storestyleof{enumerate}
\begin{listliketab}%
\newcounter{tabenum}\setcounter{tabenum}{0}
\newcommand{\step}{\refstepcounter{tabenum}\thetabenum.}
\noindent \begin{tabular}{L >{$}l <{$}@{\hskip4em}l}
\multicolumn{2}{c}{$ \vdash P\lor\lnot P $} \\
\step & \lnot(P\land\lnot P) & Hyp \\
\step & P & {Hyp}\\
\step & P\lor\lnot P & 2, $\lor$-introduction \\
\step & \bot & 1, 3, contradiction \\
\step & \lnot P & 2, 4, negation-introduction \\
\step & P\lor\lnot P & 5, $\lor$-introduction \\
\step & \bot & 1, 6, contradiction \\
\step & \lnot\lnot(P\lor\lnot P) & 1, 7, negation-introduction \\
\step & P\lor\lnot P & 8, double negation elimination
\end{tabular}
\end{listliketab}
\end{document}
答案2
您可以基于以下内容构建环境flalign*
:
\documentclass{article}
\usepackage{amsmath}
\usepackage{showframe}
\newcounter{formalproofline}
\newenvironment{formalproof}[1]
{%
\setcounter{formalproofline}{0}%
\csname flalign*\endcsname
&\makebox[0pt][l]{$\displaystyle#1$}
}
{\endflalign}
\newcommand{\step}[2]{%
\\
\stepcounter{formalproofline}%
\theformalproofline.\quad & #1 &\qquad& \text{#2}%
}
\begin{document}
\begin{formalproof}{\vdash P\lor\lnot P}
\step{\lnot(P\land\lnot P)}{Hyp}
\step{P}{Hyp}
\step{P\lor\lnot P}{2, $\lor$-introduction}
\step{\bot}{1, 3, contradiction}
\step{\lnot P}{2, 4, negation-introduction}
\step{P\lor\lnot P}{5, $\lor$-introduction}
\step{\bot}{1, 6, contradiction}
\step{\lnot\lnot(P\lor\lnot P)}{1, 7, negation-introduction}
\step{P\lor\lnot P}{8, double negation elimination}
\end{formalproof}
\end{document}
该showframe
包仅绘制页面边框,以检查对齐情况。