Last active
December 23, 2015 04:09
-
-
Save qoelet/6578793 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.List | |
import Control.Applicative | |
main :: IO () | |
main = do | |
let tt = [True, True] | |
ff = [False, False] | |
tf = head perms_tf | |
ft = reverse (head perms_tf) | |
perms_tf = permutations [True, False] | |
perms_tbl = tt:tf:ft:[ff] | |
putStrLn "Negation" | |
putStrLn $ show([True, not True]) | |
putStrLn "Conjunction" | |
fmap putStrLn show(map and perms_tbl) | |
putStrLn "Disjunction" | |
fmap putStrLn show(map or perms_tbl) | |
putStrLn "Implication" | |
fmap putStrLn show ([(<=) x (head y) | (x:y) <- perms_tbl]) | |
putStrLn "Equivalence" | |
-- thanks to ion on IRC, who answered my query with | |
-- (P -> Q, Q -> P)? | |
fmap putStrLn show ([((<=) x (head y)) && ((<=) (head y) x) | (x:y) <- perms_tbl]) | |
return () |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment