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
-- Testing is done by ensuring that the generated form is not in CNF. Non-CNF forms are transformed
-- into CNF. Then CNF-form is checked to make sure it actually in CNF and is logicaly equivelant to
-- the original. This test relies on the random form generator from assignment 4.
testCNFConversion :: Form -> Bool
testCNFConversion f = (not (isCNFConjunction f)) --> isCNFConjunction f' && equiv f f'
where
f' = cnf f
can be replace by the stronger
-- Testing is done by ensuring that the generated form is not in CNF. Non-CNF forms are transformed
-- into CNF. Then CNF-form is checked to make sure it actually in CNF and is logicaly equivelant to
-- the original. This test relies on the random form generator from assignment 4.
testCNFConversion :: Form -> Bool
testCNFConversion f = isCNFConjunction f' && equiv f f'
where
f' = cnf f
Why can the function
convertToCNF :: Form -> Form
convertToCNF f | isLiteral f = f
convertToCNF f | isCNFClause f = f
convertToCNF f = Cnj [ Dsj [ negateProp v | v <- vs ] | vs <- allVals f, not (evl vs f)]
no be simplified to
convertToCNF :: Form -> Form
convertToCNF f = Cnj [ Dsj [ negateProp v | v <- vs ] | vs <- allVals f, not (evl vs f)]
The text was updated successfully, but these errors were encountered:
The implication is used to enforce a pre-condition. There is no need to check the conversion if the form is already in CNF.
The guards 'isLiteral' and 'isCNFClause' are there to prevent things like 'Cnj[ Dsj [1]]' which is rather unnecessary. What is the point of a conjunction or disjunction with a single literal.
Regarding the comment on convertToCNF in ex.3: why rewrite something to cnf if it is already in cnf?
The "| isLiteral f" could indeed be skipped, since the isCNFClause case is there.
Exerc. 2
is too much.
is enough.
Exerc. 4
must be
Exerc. 3
can be replace by the stronger
Why can the function
no be simplified to
The text was updated successfully, but these errors were encountered: