Office Automation (ICT225)

Computer Science - COS

Semester: Second Semester

Level: 300

Year: 2018

1
Logic programming (Resit)
School:
HTTTC Department: Computer
Science
Option: FCS/ICT
Course Code: ICT222/CSC222 Course Title: Logic programming
Lecturer: Kamtchoum V. Evrad Credit Value: 2 Start Time:
Date: September 2018 Time: 2 hours End Time:
Exercise 1: propositional logic (7 marks)
1. Define the following terms: formula, consistency, validity, literal. (3 marks)
2. Use a truth table to say if the following is valid, consistent, or false:
((p (q ¬p)) ((¬q p) q)) (1.5 mark)
3. Transform the following formula in normal conjunctive form:
((r p) (¬ (q r) p)) (1.5 mark)
4. Use the refutation method to show that:
{p ∨ q ∨ r, ¬p q ∨ r, ¬q r} r (1 mark)
Exercise 2: first order logic (7 marks)
1. Answer by true or false to the following statements: (2 marks)
a. Propositional logic is less expressive than first order logic.
b. Logic connectors are used to build well written formulas.
c. Forward and backward chaining are techniques used in first order logic.
d. A term is a logic expression that refers to an object.
2. Express the following sentences in first order logic. (3 marks)
Somebody likes somebody.
Everybody likes everybody.
Everybody likes somebody.
Somebody likes everybody.
3. Which of the following formulas is valid? (2 marks)
(∃𝑥. 𝐹 ∃x. G) ∃𝑥. (F G)
(∃𝑥. 𝐹 ∃x. G) ∃𝑥. (F G)
(∀𝑥. 𝐹 ∀x. G) ∀𝑥. (F G)
(∀𝑥. 𝐹 ∀x. G) ∀𝑥. (F G)
Exercise 3: PROLOG (6 marks)
1. Name three software used for logic programming (1.5 marks)
2. Write the followings facts in PROLOG: (1 mark)
Socrates is a man.
Mary likes John and John likes Mary.
3. Write a PROLOG program to calculate the sum of a list of integers. (1.5 marks)
4. Write a predicate to verify that a list is a binary tree. (2 marks)
THE UNIVERSITY OF BAMENDA
P.O. Box 39 Bambili
REPUBLIC OF CAMEROON
Peace-Work- Fatherland
www.schoolfaqs.net