Install PropLogic
January 2010
Bucephalus.org


Different ways to use the package

PropLogic is a Haskell package for propositional logic. There are several ways to use it:

  1. Run the standalone program from the command line.

    For example (if $ denotes your default prompt)

      $ PropLogic spcnf "[[a * b] -> b]"
      true

    which means that you asked for the "Simplified Prime Conjunctive Normal Form" of the formula [[a * b] -> b] and the result was true.

    All this is further explained in ExecPropLogic.html.
  2. Load PropLogic in an interpreter session.

    For example, if ghci (or hugs) is started (and > denotes the prompt in the session)

      > spcnf "[[a * b] -> b]"
      true
    For more details see the tutorial IntroToPropLogic.html.
  3. As a Haskell programmer, you can import PropLogic as a toolbox for your own programs.

The standalone program (1) can be used without any knowledge of Haskell. If you work on a Windows machine, you can even run this executable without any Haskell system on it (see PropLogic.exe for Windows users below).


The package installation

For the full installation you will need a Haskell system on your machine. The Glasgow Haskell Compiler (GHC) is the default choice, but PropLogic also works with Hugs (when started with C). Note, that the Haskell Platform has become the new standard Haskell distribution, which now includes the GHC and many more things.

1. method: full installation from Hackage with Cabal

(The HackageDB is the online database for Haskell packages and the installation via Cabal is the most comfortable and recommended one. But PropLogic is not uploaded, yet.)

2. method: full installation, manually

Download the tarball

PropLogic-0.9.tar.gz

into some directory. Now unpack this tarball. On a Unix-like machine, you can use

  tar -xvf PropLogic-0.9.tar.gz

Windows users can use an alternative unzip program. This creates a new subsubdirectory with the Haskell modulues, i.e. the *.hs files. Make this your working directory with

  cd PropLogic-0.9

Now subsequently run (try in super-user mode if it refuses)

  runghc Setup.lhs configure --ghc
  runghc Setup.lhs build
  runghc Setup.lhs install

PropLogic is now available for interpreter sessions and import into other programs.

(What is not clear to me, however, is the standard way to generate the executable program, which is also supposed to be named PropLogic. You could run
ghc --make -o PropLogic Main.hs
to generate the executable program file in the current directory. But I am not sure, if there isn't a better way that makes the program available globally.)

3. method: local installation

The previously described full installations integrate the package into your Haskell system. But you can also do everything in a (new) local directory and delete that afterwards without leaving any traces. Start with a download of

PropLogic-0.9.tar.gz

into a local directory. Extract the tarball, e.g. with

  tar -xvf PropLogic-0.9.tar.gz

Make the newly created directory PropLogic-0.9 your working directory with

  cd PropLogic-0.9

For a session with the GHC interpreter, call

  ghci

The prompt (probably Prelude>) will invite you for the next input. You can now load all the PropLogic modules with

  Prelude> :load PropLogic.hs
  ... Ok, modules loaded: ...
  PropLogic>

If everything went as intended, an ...Ok, modules loaded:... message appeared and the subsequent new prompt PropLogic> is telling us that we have now everything ready for use and that the interpreter awaits the next input.

To generate the executable program, run

  ghc --make -o PropLogic Main.hs

The new executable file PropLogic appears in the working directory and can be called, e.g. with the help option

  ./PropLogic help


PropLogic.exe for Windows users

On a Windows machine you can just download the single file

PropLogic.exe

into an appropriate directory, say

  C:\newdir

You can then just run it from there. Just type PropLogic help, i.e.

  C:\newdir> PropLogic help
That should answer you with a display of the program options. The tutorial A little program for propositional logic further explains how to continue from there.