It contains code in Haskell
which implements the retrieval of a given
a propositional formula a conjunctive normal form of it.
The following list represents a list of the functions involved in the the code:
-
The fnc:
clausularform :: Formula -> Formula
-
The subsumption algorithm (limited number of variables):
sieveClauseList :: [Ic] -> [Ic]
-
Transform a formula and with a set of formulas into a set of of clauses:
form2claus :: Formula -> [[Literal]] setform2clausImp :: [Formula] -> [[Literal]]
-
The Davis&Putnam algorithm:
unsatisfiable:: [[Literal]] -> Bool satisfiable :: [[Literal]] -> (Bool, [[Literal]])
-
The deduction theorem:
deductionTheorem :: [Formula] -> Formula -> [Formula].
-
Semantic implication:
sImplies :: [Formula] -> Formula -> Bool extsImplies :: [Formula] -> Formula -> (Bool,[Literal])
-
Recognise whether a formula is a tautology or not:
tautological :: Formula -> Bool
-
Recognise whether two formulae are equivalent or not:
isLogEquiv :: Formula -> Formula -> Bool
Let us nuance something else:
-
distribute
: applydak
as many times as necessary to arrive at the clause form. clausular form. Uses thealternation
function which measures the minimum number of times it needs to be applied. -
associate
: apply theaka
function to a formula in clause form the minimum number of times necessary for all conjunctions and disjunctions to be left-associative. disjunctions are left-associated. -
clausularform
: apply the above functions in the appropriate order to transform a formula into an equivalent formula that is in clausal form. clausular form. -
form2claus
: Given a formula, theform2claus
function extracts its clauses. It removes tautological clauses and repeated literals from each repeated literals from each of the clauses. -
setform2claus
: Given a set (list) of formulas, extract their clauses. It removes tautological clauses and repeated literals in each of the clauses. clause. -
unsatisfiable
: Given a list of clauses, returnsTrue
orFalse
depending on whether the clause set is unsatisfiable or satisfiable. It makes use of the Davis&Putnam algorithm. -
satisfiable
: Given a list of clauses, returnsTrue
orFalse
, depending on whether the clause set is satisfiable or not. It also returns a list of literals, which when interpreted as true, satisfies interpreted as true, satisfies the set; in case of being unsatisfiable, it gives the empty list. -
form2claus
: Does the same assetform2claus
. -
sImplies
: Given a set of formulae, and a formula, it says if it is a logical consequence of the set of formulas. -
extsImplies
: Same as above, except that in the case that the implication is false, it also gives a list of literals whose implication is false, it also gives us a list of literals to show why the implication is false. shows us why the implication is false.