tags:

views:

246

answers:

4

Hi, I'm trying to typeset some basic logic proofs in LaTeX. I need a multiple column layout, and I need the lines numbered on the right. I want to reset the numbering for each proof. The output should look like this:

1) (x)¬F      A

2) (Ex)F

3) ...

What is the easiest way to do this? enumerate doesn't seem a good idea, since it's not going to like the multiple column things. I need everything to be in mathmode as well.

Is there an easy way to do this?

[edit] Here is what I've managed to do so far, but it is far from elegant.

\begin{minipage}{\linewidth}
\boldmath \center{$ \forall x \neg F \to \neg \exists x F $} \unboldmath

\begin{math}
  \begin{array}{llr}
    1. &\forall x \neg F &   \\
    2. &\exists x F & A  \\
    3. &F[\alpha / x ] & ES 2  \\
    4. &\neg F[\alpha / x] & US  \\
    5. &\exists x F \to F[\alpha / x ] & CP 2,4  \\
    6. &\neg \exists x F & TI 4,5 
  \end{array}
\end{math}
\end{minipage}

Ideally I want something that automatically numbers steps and makes the "title" line easier...

A: 

Check out section 3.6 of the amsmath package documentation.

Anders Lindahl
I want each column left aligned, and I want an easy (i.e. automatic) way to have the numbering reset for each proof.
Seamus
A: 

Sorry, don't have a \LaTeX compiler now, so my code may be not compileable or contain silly mistakes.

You need a new counter for your lines:

\newcount\logicproofline

Then, you need a command to start it:

\def\proofline#1{
    \global\advance\logicproofline by 1
    \shoveright{\text{\the\logicproofline}\qquad#1}
}

Now, you would need to redefine proof to reset your counter:

\AtBeginDocument{
    \let\myoldproof=\proof
    \def\proof{\myoldproof\logicproofline=0\relax}
}

The redefinition is needed because proof is not associated with any counter, so we cannot make that one a master counter.

Vlad
+2  A: 
\newcount\mycount
\def\nextnum{\global\advance\mycount 1 \the\mycount.}
\def\logicx#1{\halign{$\nextnum##$\quad \hfil&$##$\hfil
      &\qquad\hfil##\crcr#1\crcr}\endgroup}
\def\logic{\begingroup \global\mycount 0 \let\\\cr \logicx}

\logic{
    &\forall x \neg F &   \\
    &\exists x F & A  \\ 
    &F[\alpha / x ] & ES 2  \\ 
    &\neg F[\alpha / x] & US  \\ 
    &\exists x F \to F[\alpha / x ] & CP 2,4  \\ 
    &\neg \exists x F & TI 4,5  \\
}
Alexey Malistov
I suppose you ought to reset `\mycount` at the beginning of proof, not on every `\logic`.
Vlad
@Vlad: Alexey's `\logic#1` typesets a whole proof at once.
Charles Stewart
@Charles: usually a proof consists of some more words, not just calculations. Something like: "Assume x > 0. Putting y = |x| + 1, we've got: (list of equations). For the case x < 0, (another list). The case x = 0 is obvious." For such a proof, the equation numbers will be reset in the middle of the it.
Vlad
@Vlad: Not in formal logic. It's pretty clear that these are proofs is some Hilbert-style proof system (`US` I recognise - it's uniform substitution), where informal statements like "Assume *x>0* are trandslated into internal formal representations. I'd expect any discussion in English to be remarks made at the end of the proof, that refer to the inferences by the step numbers 1 to 6.
Charles Stewart
Well, there may be some introductory text at the beginning, like that: "We use slightly modified approach from [1]" and in the middle like "This was the hard part, now we only need to prove the foobarability of X". The proof shouldn't be too dry.
Vlad
+2  A: 

See the packages for Fitch-style proofs here. You simply don't need any subproofs. LaTeX for Logicians also covers other proof styles, logical symbols, etc.

Alexey Romanov
+1: Latex for Logicians is an excellent resource, very well put together. I think, though, that Alexey M's suggestion is so brief, that I would prefer that for this task, than the avoidable import of another package.
Charles Stewart