module Week6 

where 
import List 

data Cat = S | NP | DET | CN | RCN | VP | TV deriving (Eq,Ord,Show) 

data Structure = Word Cat String 
               | Tree Cat Structure Structure deriving (Eq,Ord,Show)

dict :: [(String,Cat)]
dict = [("Barack", NP), ("Hillary", NP), 
        ("respects", TV), ("hates", TV),
        ("wins", VP), ("loses", VP), 
        ("some", DET), ("every", DET), 
        ("senator", CN),("democrat", CN)]

tree1 :: Structure 
tree1 = Tree S (Word NP "Barack")
               (Tree VP (Word TV "respects")
                        (Word NP "Hillary"))

data Form = Prop String
          | Not Form
          | Conj [Form]
          | Disj [Form]
          deriving (Eq,Ord) 

instance Show Form where
  show (Prop name) = name
  show (Not f) = '~' : '(' : show f ++ ")"
  show (Conj fs) = '&' : show fs
  show (Disj fs) = 'v' : show fs


p1 = Prop "p1" ; p2 = Prop "p2" ; p3 = Prop "p3"
q1 = Prop "q1" ; q2 = Prop "q2" ; q3 = Prop "q3"
r1 = Prop "r1" ; r2 = Prop "r2" ; r3 = Prop "r3"

form1 = Disj [p1, Not p1]
form2 = Conj [p1, Not p1]





