Presentation is loading. Please wait.

Presentation is loading. Please wait.

CT214 – Logical Foundations of Computing Lecture 9 Revision.

Similar presentations


Presentation on theme: "CT214 – Logical Foundations of Computing Lecture 9 Revision."— Presentation transcript:

1 CT214 – Logical Foundations of Computing Lecture 9 Revision

2 B1. (i) Consider a generic operator on some set S. Explain what is meant by saying a.has a right identity element A R b.is commutative c.is idempotent Prove that if all three properties hold, then ( ( a A R ) a ) b = b a a, b S

3 B1. (i) Consider a generic operator on some set S. Explain what is meant by saying a.has a right identity element A R Answer: A right identity element A R means that if any premise is connected with the element A R using the generic operator then that premise can be concluded. i.e. a A R = a

4 B1. (i) Consider a generic operator on some set S. Explain what is meant by saying b.is commutative Answer: The generic operator is commutative means that all premises connected using the generic operator are interchangeable. i.e. a b = b a

5 B1. (i) Consider a generic operator on some set S. Explain what is meant by saying c.is idempotent Answer: Idempotent means that if a premise is connected with itself using the generic operator then that premise can be concluded on its own. i.e. a a = a

6 B1. (i) Consider a generic operator on some set S. Prove that if the operator is commutative, idempotent and has a right identity element A R, then ( ( a A R ) a ) b = b a a, b S Answer: Take LHS( ( a A R ) a ) b = ( a a ) b Identity = a bIdempotent = b aCommutative

7 B1. (ii) Using the laws of Propositional Calculus, prove the following: a.( p ^ q ) -> r = p -> ( q -> r ) b.( p ^ ( q v r ) ) ^ ¬q = p ^ ¬q ^ r c.p ^ ( ( p ^ q ) v ¬p ) = p ^ q d.p ^ ( ( p ^ q ) v r ) = p ^ ( q v r )

8 B1. (ii) Using the laws of Propositional Calculus prove: a.( p ^ q ) -> r = p -> ( q -> r ) Answer: Take LHS( p ^ q ) -> r = ¬( p ^ q ) v rDefinition of -> = ¬p v ¬q v rDe Morgan = p -> ( ¬q v r )Definition of -> = p -> ( q -> r )Definition of ->

9 B1. (ii) Using the laws of Propositional Calculus prove: b.( p ^ ( q v r ) ) ^ ¬q = p ^ ¬q ^ r Answer:( p ^ ( q v r ) ) ^ ¬q = ( ( p ^ q ) v ( p ^ r ) ) ^ ¬q Distribution = ( p ^ q ^ ¬q ) v ( p ^ r ^ ¬q ) Distribution = ( p ^ F ) v ( p ^ r ^ ¬q ) Compliment = F v ( p ^ r ^ ¬q ) Absorption = p ^ ¬q ^ r Identity and Commutative

10 B1. (ii) Using the laws of Propositional Calculus prove: c.p ^ ( ( p ^ q ) v ¬p ) = p ^ q Answer: p ^ ( ( p ^ q ) v ¬p ) = ( p ^ ( p ^ q ) ) v ( p ^ ¬p ) Distribution = ( p ^ ( p ^ q ) ) v F Complement = p ^ ( p ^ q )Identity = ( p ^ p ) ^ q Associative = p ^ q Idempotent

11 B1. (ii) Using the laws of Propositional Calculus prove: d.p ^ ( ( p ^ q ) v r ) = p ^ ( q v r ) Answer: p ^ ( ( p ^ q ) v r ) = ( p ^ p ^ q ) v (p ^ r )Distribution = ( p ^ q ) v (p ^ r )Idempotent = p ^ ( q v r )Distribution

12 B2. (i) Consider the following argument: “If the lecturer is hard to understand and the material is complicated then the students will find it difficult to pass the exam. However, if the lecturer is in a good mood when setting the exam then the exam will be easy. If the exam is easy then the students should not find it difficult to pass the exam. The lecturer is hard to understand but is in a good mood when setting the exam, therefore, the students should not find it difficult to pass the exam.” Using two alternative proofs, one using the Deduction Theorem and one using Reductio Ad Absurdum, show that this is a valid argument, stating the laws used at each step.

13 “If the lecturer is hard to understand and the material is complicated then the students will find it difficult to pass the exam. However, if the lecturer is in a good mood when setting the exam then the exam will be easy. If the exam is easy then the students should not find it difficult to pass the exam. The lecturer is hard to understand but is in a good mood when setting the exam, therefore, the students should not find it difficult to pass the exam.” The lecturer is hard to understandU The material is complicatedM Students find it difficult to pass examD Lecturer in a good mood when setting examG The exam will be easyE

14 “If the lecturer is hard to understand and the material is complicated then the students will find it difficult to pass the exam. However, if the lecturer is in a good mood when setting the exam then the exam will be easy. If the exam is easy then the students should not find it difficult to pass the exam. The lecturer is hard to understand but is in a good mood when setting the exam, therefore, the students should not find it difficult to pass the exam.” (1)U ^ M -> D (2)G -> E¬D (3)E -> ¬D (4)U ^ G

15 (1)U ^ M -> D (2)G -> E¬D (3)E -> ¬D (4)U ^ G Proof using Deduction Theorem U ^ G(4) GSimplification (5) G -> E, G(2 + 5) EModus Ponens (6) E -> ¬D, E(3 + 6) ¬DModus Ponens

16 (1)U ^ M -> D (2)G -> E¬D (3)E -> ¬D (4)U ^ G Reductio Ad Absurdum, assume ¬¬D and prove contradiction (1)U ^ M -> D (2)G -> E (3)E -> ¬DFalse (4)U ^ G (5)¬¬D

17 (1)U ^ M -> D (2)G -> E (3)E -> ¬DFalse (4)U ^ G (5)¬¬D Proof using Reductio Ad Absurdum U ^ G(4) GSimplification (6) G -> E, G(2 + 6) EModus Ponens (7)

18 E -> ¬D, E(3 + 7) ¬DModus Ponens(8) ¬¬D(5) DDouble Negative(9) D, ¬D(8 + 9) D ^ ¬DConjunction FalseCompliment

19 B2. (ii) (a)Modus Ponens Prove: ((P -> Q) ^ P) -> Q is a tautology Answer: ((P -> Q) ^ P) -> Q = ((¬P v Q) ^ P) -> QDefinition = ¬((¬P v Q) ^ P) v Q Definition = ¬(P ^ (¬P v Q)) v Q Commutative = ¬((P ^ ¬P) v (P ^ Q)) v Q Distribution = ¬(F v (P ^ Q)) v Q Complement.....

20 = ¬(F v (P ^ Q)) v Q Complement = ¬(P ^ Q) v Q Identity = (¬P v ¬Q) v QDe Morgan Law 1 = ¬P v (¬Q v Q)Associative = ¬P v TComplement = TAbsorption

21 B2. (ii) (b)Disjunctive Syllogism Prove: ((P v Q) ^ ¬ P) -> Q is a tautology Answer: ((P v Q) ^ ¬ P) -> Q = ¬((P v Q) ^ ¬ P) v Q Definition = ¬(P v Q) v ¬(¬ P) v Q De Morgan Law1 = ¬(P v Q) v P v Q Double Negative = (¬P ^ ¬Q) v P v Q De Morgan Law 2 = P v (¬P ^ ¬Q) v QCommutative.....

22 = P v (¬P ^ ¬Q) v QCommutative = (P v (¬P ^ ¬Q)) v QAssociative = ((P v ¬P) ^ (P v ¬Q)) v QDistribution = (T ^ (P v ¬Q)) v Q Compliment = (P v ¬Q) v Q Identity = P v (¬Q v Q)Associative = P v TCompliment = TAbsorption

23 B3. (i) On the set of integers consider the predicates: P 1 (X) : X > 3, P 2 (X, Y) : X = Y,P 3 (X, Y, Z) : X - Y = Z where X, Y, Z State if the following are true: (a)X : Y : P 2 (X, Y) Answer:False as all integers are not equal. (b) X : Y : P 3 (X, Y, 8) Answer:True as there exists two integers that can be subtracted that result in 8.

24 (c)X : Y : P 1 (X) ^ P 2 (X, Y) Answer:False as every integer > 3 is not equal to every other integer. (d) X : Y : P 1 (X) ^ P 2 (X, Y) Answer:True as every integer > 3 is equal itself. (e) X : Y : P 3 (5, X, Y) Answer:True as every integer can be subtracted from 5 to give some other integer value.

25 B3. (ii) P( X, Y ) means X is a parent of Y, S( X, Y ) means X is a sibling of Y, O( X, Y ) means X is older than Y, write the following using predicate calculus: 1.“Everyone has a parent” X : U Y : U P( Y, X ) 2.“Every parent is older than their child” X : U Y : U P( X, Y ) -> O( X, Y )

26 3.“John has no older siblings” X : U S( john, X ) -> ¬O( X, john ) 4.“Nobody who is a parent has an older sibling” X : U Y Y : U Z : U P(X, Y) -> ¬( S(X, Z) ^ O(Z, X) )


Download ppt "CT214 – Logical Foundations of Computing Lecture 9 Revision."

Similar presentations


Ads by Google