You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
genForm :: IO Form
genForm = do
c <- pick 8 -- A number to determine the type of node.
x <- pick 5 -- An x for when the node is a proposition.
f1 <- if c > 3 then genForm else return (Prop 0) -- A child node (only generated if needed)
f2 <- if c > 4 then genForm else return (Prop 0) -- Another child node (only generated if needed)
return $ case c of
c | c <= 3 -> Prop x
4 -> Neg f1
5 -> Cnj [f1, f2]
6 -> Dsj [f1, f2]
7 -> Impl f1 f2
8 -> Equiv f1 f2
To remarks:
1 Too restricted. Cnj xs and Dsj xs where xs are lists must be also possible.
2 How the garantee that the generated form is not too deep.
-- Checks if something is a clause by checking if it consists of literals.
isClause (Dsj xs) = foldr (\x r -> isLiteral x && r) True xs
isClause x = isLiteral x
-- Checks if something is a literal by checking if it is a proposition,
-- optionally embedded in a negation.
isLiteral (Prop _) = True
isLiteral (Neg x) = isLiteral x
isLiteral _ = False
where is the rule
isClause (Cnj xs) = ....
The text was updated successfully, but these errors were encountered:
Exercise 2, 4
To remarks:
1 Too restricted.
Cnj xs
andDsj xs
wherexs
are lists must be also possible.2 How the garantee that the generated form is not too deep.
Exercise 3
Better
where is the rule
The text was updated successfully, but these errors were encountered: