Created
November 5, 2010 22:04
-
-
Save ldunn/664948 to your computer and use it in GitHub Desktop.
This file contains 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
data Expr = Expr Bool | |
| Conjunction Expr Expr | |
| Negation Expr | |
| Disjunction Expr Expr | |
| Implication Expr Expr | |
deriving (Eq, Show) | |
nnf :: Expr -> Expr | |
nnf (Expr expr) = Expr expr | |
nnf (Conjunction expr1 expr2) = Conjunction (nnf expr1) (nnf expr2) | |
nnf (Disjunction expr1 expr2) = Disjunction (nnf expr1) (nnf expr2) | |
nnf (Negation (Negation expr)) = nnf expr | |
nnf (Negation (Conjunction expr1 expr2)) = (Disjunction (Negation (nnf expr1)) (Negation (nnf expr2))) | |
nnf (Negation (Disjunction expr1 expr2)) = (Conjunction (Negation (nnf expr1)) (Negation (nnf expr2))) | |
nnf (Implication expr1 expr2) = (Disjunction (Negation (nnf expr1)) (nnf expr2)) | |
nnf (Negation (Implication expr1 expr2)) = nnf (Negation (Disjunction (Negation (nnf expr1)) (nnf expr2))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment