[Haskell-cafe] FOL

Stefan O'Rear stefanor at cox.net
Tue Jun 5 01:11:11 EDT 2007


On Tue, Jun 05, 2007 at 02:41:48PM +1000, Tony Morris wrote:
> I would like to know if all 16 possible functions that accept two
> boolean arguments have names in First-Order Logic. I know they have
> Haskell function names (e.g. \p -> \_ -> id p, \_ -> \_ -> const True),
> but I'm hoping there is a more general name that is recognised by anyone
> with a feel for logic, but not necessarily Haskell.

There are way more than 16, if you count partial and lazy functions.

> I have listed all sixteen of these functions below using Haskell (named
> a to p) along with the name of those that I am aware of having a name as
> a comment.
> 
> Thanks for any tips.
> 
> {-
> 
> p q | a b c d e f g h i j k l m n o p
> 0 0 | 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
> 0 1 | 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1
> 1 0 | 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1
> 1 1 | 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
> 
> -}

I see P/Q notation used a lot

> c :: Bool -> Bool -> Bool
> c False _ = False
> c _ q = not q

P∧¬Q

Also AND-NOT, commonly seen in electronics circles as it is the logic
function performed by a single transistor

Stefan


More information about the Haskell-Cafe mailing list