# Sheet10 - McMaster University Department of Computing and...

This preview shows page 1. Sign up to view the full content.

McMaster University Department of Computing and Software Dr. W. Kahl COMP SCI 1FC3 Exercise Sheet 10 COMP SCI 1FC3 — Mathematics for Computing 27 March 2009 Exercise 10.1 — Syntax Trees for Propositional Logic The assignment generator for Assignment 1 used (a variant of) the following Haskell datatype to represent formulae of propositional logic (see also textbook section 4.3 p. 301and p. 305): data PropForm = Var String | FF | TT | Negation PropForm | Conjunction PropForm PropForm | Disjunction PropForm PropForm | Implication PropForm PropForm | Biimplication PropForm PropForm | ExclusiveOr PropForm PropForm deriving ( Eq , Ord ) (a) Define Haskell values f1 , f2 , f3 , f4 :: PropForm representing the formulae F T ”, “ p p ”, “ p q p q ”, and “ p ∧ ¬ q ↔ ¬( p q ) ”. (b) Implement the function subformulae :: PropForm -> [ PropForm ] which computes all subformulae of its argument. For example, the subformulae of “ p q p ” are “ p ”, “ q ”, “ p q ”, and “ p q p ”.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern