Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. type Expression =
  2. | Expr of bool
  3. | Negation of Expression
  4. | Disjunction of Expression * Expression
  5. | Conjunction of Expression * Expression
  6. | Implication of Expression * Expression
  7. | Bimplication of Expression * Expression
  8.  
  9. let rec nnf expr = match expr with
  10. | (Expr expr) -> (Expr expr)
  11. | (Negation (Negation (expr))) -> (nnf expr)
  12. | (Conjunction (expr1, expr2)) -> (Conjunction ((nnf expr1), (nnf expr2)))
  13. | (Disjunction (expr1, expr2)) -> (Disjunction ((nnf expr1), (nnf expr2)))
  14. | (Negation (Conjunction (expr1, expr2))) -> (Disjunction ((nnf (Negation expr1)), (nnf (Negation expr2))))
  15. | (Negation (Disjunction (expr1, expr2))) -> (Conjunction ((nnf (Negation expr1)), (nnf (Negation expr2))))
  16. | (Negation (Bimplication (expr1, expr2))) -> nnf (Negation (Conjunction ((Implication (expr1, expr2)), (Implication (expr2, expr1)))))
  17. | (Negation (Implication (expr1, expr2))) -> nnf (Conjunction (expr1, (Negation expr2)))
  18. | (Negation expr) -> (Negation expr)
  19. | (Implication (expr1, expr2)) -> nnf (Negation (Conjunction (expr1, (Negation expr2))))
  20. | (Bimplication (expr1, expr2)) -> nnf (Conjunction ((Implication (expr1, expr2)), (Implication (expr2, expr1))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement