Created
June 13, 2016 19:46
-
-
Save lgcantarelli/090362fd9dc90afd47787748182047c4 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
data B = T | F | NOT B | AND B B | OR B B | |
deriving(Eq, Show) | |
prog :: B | |
prog = OR (AND F (NOT T)) (NOT F) | |
smallStepB :: B -> B | |
smallStepB (NOT T) = F | |
smallStepB (NOT F) = T | |
smallStepB (NOT b) = (NOT (smallStepB b)) | |
smallStepB (OR F b) = b | |
smallStepB (OR T b) = T | |
smallStepB (OR b1 b2) = (OR (smallStepB b1) b2) | |
smallStepB (AND F b) = F | |
smallStepB (AND T b) = b | |
smallStepB (AND b1 b2) = (AND (smallStepB b1) b2) | |
ssInterpreterB :: B -> B | |
ssInterpreterB b = if (isFinalB b) then b else (ssInterpreterB (smallStepB b)) | |
isFinalB :: B -> Bool | |
isFinalB T = True | |
isFinalB F = True | |
isFinalB _ = False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment