Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Week 3: Exercise 4 #5

Open
BertLisser opened this issue Sep 27, 2017 · 0 comments
Open

Week 3: Exercise 4 #5

BertLisser opened this issue Sep 27, 2017 · 0 comments

Comments

@BertLisser
Copy link

BertLisser commented Sep 27, 2017

arbForm n = oneof [
                    liftM Prop (choose (1, 3)),
                    liftM Neg (arbForm (n `div` 4)),
                    liftM Cnj (vectorOf 2 (arbForm (n `div` 4))),
                    liftM Dsj (vectorOf 2 (arbForm (n `div` 4))),
                    liftM2 Impl (arbForm (n `div` 4)) (arbForm (n `div` 4)),
                    liftM2 Equiv (arbForm (n `div` 4)) (arbForm (n `div` 4))
]

is too restricted. Better is

arbForm n = oneof [
                    liftM Prop (choose (1, 3)),
                    liftM Neg (arbForm (n `div` 4)),
                    liftM Cnj (vectorOf (n-1) (arbForm (n `div` 4))),
                    liftM Dsj (vectorOf (n-1) (arbForm (n `div` 4))),
                    liftM2 Impl (arbForm (n `div` 4)) (arbForm (n `div` 4)),
                    liftM2 Equiv (arbForm (n `div` 4)) (arbForm (n `div` 4))
]
quickCheck propEquiv

better

verboseCheckWith stdArg {maxSize=6}  propEquiv

Then n div 4 can be replaced by n div 2

Well done (=9)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant