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.
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
-}
a :: Bool -> Bool -> Bool
a _ _ = False
b :: Bool -> Bool -> Bool -- conjunction AND
b False _ = False
b _ q = q
c :: Bool -> Bool -> Bool
c False _ = False
c _ q = not q
d :: Bool -> Bool -> Bool
d p _ = p
e :: Bool -> Bool -> Bool
e False q = q
e _ _ = False
f :: Bool -> Bool -> Bool
f _ q = q
g :: Bool -> Bool -> Bool -- exclusive disjunction XOR
g False q = q
g _ q = not q
h :: Bool -> Bool -> Bool -- disjunction OR
h False False = False
h _ _ = True
i :: Bool -> Bool -> Bool -- negation of disjunction NOR
i False False = True
i _ _ = False
j :: Bool -> Bool -> Bool -- biconditional
j False q = not q
j _ q = q
k :: Bool -> Bool -> Bool
k _ q = not q
l :: Bool -> Bool -> Bool
l False q = not q
l _ _ = True
m :: Bool -> Bool -> Bool
m p _ = not p
n :: Bool -> Bool -> Bool -- implication
n False _ = True
n _ q = q
o :: Bool -> Bool -> Bool -- negation of conjunction NAND
o False _ = True
o _ q = not q
p :: Bool -> Bool -> Bool
p _ _ = True
--
Tony Morris
http://tmorris.net/
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
