<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">I need to write two functions for a coursework that will behave as follows...<br>unction 1)<span class="yiv2015921497pln">removeTautologies </span><span class="yiv2015921497pun">::</span><span class="yiv2015921497pln"> Formula</span><span class="yiv2015921497pun">-&gt;</span>Formula <br>If in a clause, a literal and its negation are found, it means that the clause will be true, regardless of the value
finally assigned to that propositional variable. Consider the following example:
(A v B v -A) ^ (B v C v A)
The first clause contains the literals A and -A. This means that the clause will always be true, in which case
it can be simplify the whole set to simply (B v C v A) .<br>I was tinking of using something like<br>&nbsp;<span class="yiv2015921497pln">removeTautologies (f:fs)=filter rTf:</span><span class="yiv2015921497pln">removeTautologies fs<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 where rT-is supposed to take the firs Literal from the clasue and 
search for a similar one,if one si found we compare the values if not 
the we go to the second literal.<br></span>-&gt;Function 2)<code><span class="yiv2015921497pln">pureLiteralDeletion </span><span class="yiv2015921497pun">::</span><span class="yiv2015921497pln"> Formula</span><span class="yiv2015921497pun">-&gt;</span><span class="yiv2015921497pln">Formula<br>This is a little bit complicate but from What I get this</span></code> function is suppose to implement a simplification step that assumes 
as true any atom in a formula that appears exclusively in a positive or
negative form (not both). Consider the formula:
(P v Q v R) ^ (P v Q v -R) ^ (-Q v R)
Note that in this formula P is present but -P is not. Using Pure Literal
 Deletion  it can be assumed that the value of P will be True thus 
simplifying the formula to (-Q v R). If the literal were false then the 
literal would simply be deleted from the clauses it appears in. In that 
case any satisfying model for the resulting formula would also be a 
satisfying model for the formula when we assume that the literal is true.<br><br>removeTautologies :: Formula -&gt; Formula<br>removeTautologies = map rt.map head.group.sort<br>&nbsp;&nbsp;&nbsp;&nbsp; where rt ((x, x') : (y, y') : rest) | x' == y' = rt rest<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | otherwise = (x, x') : rt ((y, y') : rest)<br><br><br><br><br>pureLiteralDeletion :: Formula -&gt; Formula<br>pureLiteralDeletion = map lD.map head.group.sort.concat<br>&nbsp;&nbsp;&nbsp;&nbsp; where lD ((x, x') : (y, y') : rest) | x' == y' &amp;&amp; x/=y = lD rest<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | otherwise = (x,
 x') : lD ((y, y') : rest)<br><br>this is what I've witten so far but they don't wok poperly....any sugestions?<br><br></td></tr></table><br>