Closed Emanon42 closed 7 years ago
It seems your property is false:
> quickCheck prop_NNF1
*** Failed! Falsifiable (after 3 tests):
Var "S" :<->: T
> isNNF $ toNNF $ Var "S" :<->: T
False
I am using deriving Show
because you didn't include the code for showProp
; maybe showProp
is printing the counterexample in a misleading way?
Ah, I see! In the counterexample (S<->T), the T is not Var "T"
but the constructor T
:)
This is my showProp
showProp :: Prop -> String
showProp (Var x) = x
showProp (F) = "F"
showProp (T) = "T"
showProp (Not p) = "(~" ++ showProp p ++ ")"
showProp (p :|: q) = "(" ++ showProp p ++ "|" ++ showProp q ++ ")"
showProp (p :&: q) = "(" ++ showProp p ++ "&" ++ showProp q ++ ")"
showProp (p :->: q) = "(" ++ showProp p ++ "->" ++ showProp q ++ ")"
showProp (p :<->: q) = "(" ++ showProp p ++ "<->" ++ showProp q ++ ")"
Yes you are correct.
Thank you! I know how to solve it.
I am using GHC i 7.10.3 on Ubuntu 16.04 LTS, here is my code: