This preview shows page 1. Sign up to view the full content.
Unformatted text preview: 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....
View Full Document
This note was uploaded on 03/26/2011 for the course CS 1fc3 taught by Professor Kahl during the Spring '11 term at McMaster University.
- Spring '11