F#/Clojure implementation of Cathoristic Logic
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Cathoristic.fs
README.md
cl.clj
project.edn

README.md

F#/Clojure implementation of Cathoristic Logic

Ported from the original Haskell implementation to F# with a ClojureCLR wrapper. Much thanks to @vivid-synth for the Haskell guidance.

Status

Still rough, don't use for anything important. 25/26 of the original tests are passing.

Building

The F# compiler will issue warnings that you should ignore. It should produce Cathoristic.dll and FSharp.Core.dll in the same directory.

$ fsharpc -a Cathoristic.fs
Microsoft (R) F# Compiler version 4.1
Copyright (c) Microsoft Corporation. All Rights Reserved.

/Users/nasser/Projects/cathoristic/Cathoristic.fs(83,21): warning FS0025: Incomplete pattern matches on this expression. For example, the value '(_,None)' may indicate a case not covered by the pattern(s).

/Users/nasser/Projects/cathoristic/Cathoristic.fs(106,34): warning FS0025: Incomplete pattern matches on this expression. For example, the value '(_,None)' may indicate a case not covered by the pattern(s).

Usage

The cl namespace has the following definitions and functions, taken from the original API.

  • top
  • bot
  • (entails? p q)
  • (trans sym prop)
  • (trans sym)
  • (conj prop prop)
  • (bang [sym])

A 'symbol' here is anything that can be turned into a string. As a convenience if trans is called with one argument the second default to top. Additionally, some sugar is provided:

  • (∧ p q)(conj p q)
  • (! & ss)(bang ss)
  • (?= p q)(entails? p q)

The Clojure implementation is tested using nostrand, but should work anywhere ClojureCLR does.

$ nos repl
user> (use 'cl)
WARNING: conj already refers to: #'clojure.core/conj in namespace: user, being replaced by: #'cl/conj
nil
user> (?= top top)
true
user> (?= top bot)
false
user> (?= (trans :a (! :b)) (trans :a))
true
user> (?= (trans :a (! :b)) (trans :a (! :c)))
false