Giter VIP home page Giter VIP logo

lk's Introduction

An implementation of the system LK

LK is a sequent calculus, used in order to automate proofs. Given a logic formula (so far only propositional formulas are implemented), the system should be able to deduce whether or not the formula is valid. It relies on the idea that if there is no way to falsify the formula, then it must always hold true, meaning it’s valid.

The project is a means to learn more about proof systems, Haskell and in particular it’s type system.

The program has a useful feature, namely that it outputs a derivation tree in LaTeX markup for a given sequent.

Compile the program:

[larstvei LK/] λ ghc LK.hs

The program reads two lines of input, where each line may contain space separated WFFs.

Definition WFF (well formed formula):

  • p, q, r, s, t ∈ WFF
  • if w ∈ WFF then Nw ∈ WFF
  • if w, x ∈ WFF then Owx, Awx, Iwx ∈ WFF

Example run:

[larstvei LK/] λ ./LK
Enter Γ:
Opq Np
Enter Δ:
q

Output:

\begin{prooftree}
\AxiomC{$Q \stackrel{\times}{\vdash} P, Q$}
\AxiomC{$P \stackrel{\times}{\vdash} P, Q$}
\RightLabel{\scriptsize{L$\lor$}}
\BinaryInfC{$(P \lor Q) \vdash P, Q$}
\RightLabel{\scriptsize{L$\neg$}}
\UnaryInfC{$(P \lor Q), \neg P \vdash Q$}
\end{prooftree}

The rendered output looks like this:

./example.png

A side note

The code may look clunky, but when used with the wonderful prettify-symbols-mode in Emacs it looks a lot better. The prettify-symbols-alist have been configured in the following way:

(setq-default prettify-symbols-alist '(("lambda" . )
                                       ("delta" . )
                                       ("gamma" . )
                                       ("phi" . )
                                       ("psi" . )))

lk's People

Contributors

larstvei avatar torenord avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

torenord

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.