adelhult / fitch

Fitch-style natural deduction proof-editor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fitch

Fitch is a small command-line editor for writing natural deduction (propositional logic) proofs. However, the program hasn't been extensively tested and was just written to get a chance to play around with propositional logic and the wonderful chumsky parser combinator library. But it can be rather helpful for generating LaTeX and avoid having to manually typeset proofs.

See the video for a short demo:

demo.webm

Usage

Assuming you have Rust installed. Clone the repo and run:

cd fitch_cli
cargo run

You can then start using fitch by typing a command followed by a series of arguments:

  • premise <formula> - Add a new premise
  • copy <step index> - Copy a previously proven formula
  • assume <formula> - Create a new proof box (sub-proof) with some assumption
  • discharge - Close a proof box
  • rule <rule name> <rule arguments...> - Apply a rule given some step indices. See a list of rules below.
  • undo - Undo the latest step
  • quit - Quit the program
  • help - Print a help message
  • latex - Generate LaTeX code to typeset your proof

Rules

The rules are the same as those presented in Huth and Ryan Logic in Computer Science. (With the expection that $\neg \varphi$ is encoded as $\varphi \to \bot$).

Name Arguments Explanation
and_i StepIndex StepIndex
        phi     psi
        -----------
        phi  ^  psi
      
and_e_lhs StepIndex
        phi  ^  psi
        -----------
            phi
      
and_e_rhs StepIndex
        phi  ^  psi
        -----------
            psi
      
or_i_lhs StepIndex Prop
            phi
        ------------
        phi \/ psi
      
or_i_rhs Prop StepIndex
            psi
        ------------
        phi \/ psi
      
or_e StepIndex StepIndex StepIndex
        phi \/ psi   [phi]...chi   [psi]...chi
        -------------------------------------
                        chi
      
neg_i StepIndex
        [phi]...bottom
        ----------------
            neg phi
      
neg_e StepIndex StepIndex
        phi    neg phi
        ----------------
            bottom
      
imply_i StepIndex
        [phi]...psi
        -------------
            psi
      
imply_e StepIndex StepIndex
        phi      phi -> psi
        ---------------------
                psi
      
bottom-e StepIndex Prop
          bottom
        ------------
            phi
      
neg_neg_e StepIndex
        neg (neg phi)
        ---------------
            phi
      
mt StepIndex StepIndex
        phi -> psi    neg psi
        ------------------------
                neg phi
      
neg_neg_i StepIndex
            phi
        ---------------
        neg (neg phi)
      
PBC StepIndex
        [not phi]...bottom
        --------------------
                phi
      
LEM Prop
        ----------------
        phi \/ neg phi
      

About

Fitch-style natural deduction proof-editor

License:MIT License


Languages

Language:Rust 100.0%