程序代写代做代考 Haskell 11/9/2020 Grok | COMP30026 Practice Exam

11/9/2020 Grok | COMP30026 Practice Exam
Queson 2 Part B (6 marks)
Queson 2
A proposional logic formula is in prexor normal form (PXNF) if it contains only the
following components and connecves:
The proposional constant true ( ),
proposional variables (for example, , ), and conjuncon ( ) and exclusive-or ( ) connecves.
Part B (6 marks)
Show that all proposional logic formulas have an equivalent formula in prexor normal form.
Hint: Your answers to part A may be useful.
Instrucons
WriteaHaskellfuncontoPXNF :: Exp -> Expwhichtakesanarbitraryproposional expression and returns an equivalent expression in prexor normal form.
 Format
The Haskell type Exp has data constructors FALSE, TRUE, VAR, NOT, AND, OR, XOR, BIIM, and IMPL. Its definion is provided in the file Exp.hs, along with a simple parser parse :: String -> Exp.Thesetoolsarethesameasyouarefamiliarwithfrom worksheets and assignments.
For example, the formula can be expressed as: IMPL (AND (VAR ‘P’) (VAR ‘Q’)) (VAR ‘R’), or
parse “((P & Q) => R)”usingtheparsefuncon.  Visualisaon
WehavealsoprovidedaprintExp :: Exp -> Stringfunconwhichyoucanuse while tesng your expressions to generate more readable output than the default from show.
R ⇒ )Q ∧ P(
⊕∧ QP
t
https://groklearning.com/learn/unimelb-comp30026-2020-s2/prac-exam/4/ 1/1
Cheng