I need some help if possible with the following problem....
atomsClause :: Clause ! [Atom]This function must take a Clause and return the set of Atoms of that Clause. Note that the set should not contain any duplicates.atoms :: Formula![Atom]This function must take a Formula return the set of Atoms of a Formula. Note that the set should not contain any duplicates.isLiteral :: Literal ! Clause ! BoolThis function returns True if the given Literal can be found within the Clause.flipSymbol :: Model ! Atom ! ModelThis function must take a Model and an Atom and flip the truth value of the atom in the model.
Here is the code:
module Algorithm where
import System.Random
import Data.Maybe
import Data.List
type Atom = String
type Literal = (Bool,Atom)
type Clause = [Literal]
type Formula = [Clause]
type Model = [(Atom, Bool)]
type Node = (Formula, ([Atom], Model))
atomsClause :: Clause -> [Atom]
atomsClause = undefined
atoms :: Formula -> [Atom]
atoms = undefined
isLiteral :: Literal -> Clause -> Bool
isLiteral = undefined
flipSymbol :: Model -> Atom -> Model
flipSymbol = undefined
Thank you.
I was thinking for the first one to write it like this......
atomsClause :: Clause -> [Atom]
atomsClause [(Bool,Atom)] =[a|(b,a)<-(Bool,Atom)]
...is this ok?