Starting from:

$27

Project 1: Interpretation of Propositional Formulae

CS3234
Project 1: Interpretation of Propositional Formulae
INSTRUCTIONS

3. The ZIP file contains the file <student number.pl, a prolog program with your answer (modify the name and content of the template program project1.pl).
4. After the deadline and until Friday 16 February at midnight, you can submit to the folder ”Project 1 Late Submissions” in Luminus (penalties apply).
Question 1 [2 marks] Write a Prolog procedure interpretation(+GFormula, ?TruthValue) that succeeds when TruthValue is the truth value of the ground logical formula GFormula. The formula is ground: it does not contain any propositional variable but only the connectives: top, bot, implies, and, or and xor. For example, the goal interpretation(not(top and not bot), T) succeeds with T = false.
Question 2 [2 marks] Write a Prolog procedure propositions(+Formula, ?ListofPropositions) that succeeds when ListOfPropositions is the list of propositions in the logical formula Formula. For example, the goal propositions(not(x1 and not x2), L) succeeds with L = [x1, x2]. You may need to write an ancillary procedure to avoid duplicate answers in the list ListOfPropositions.
Question 3 [3 marks] Write a Prolog procedure assign(+Formula1, +Proposition, +TruthValue, ?Formula2) that succeeds when the logical formula Formula2 is the logical formula Formula1 in which the occurences of the proposition Proposition have been replaced by top if TruthValue is true and bot if TruthValue is false. For example, the goal assign(not(x1 and not x2), x1, true, F) succeeds with F = not(top and not x2).
Question 4 [3 marks] Write a Prolog procedure assignment(+Formula, ?TruthValue, -ListofAssignments) that succeeds when TruthValue is the truth value of the interpretation of the logical formula Formula with the assignment ListofAssignment of the propositions in the formula to true or false. For example, the goal assignment(not(x1 and not x2), false, L) succeeds with L = [[x1, true], [x2, false]]. You may need to use the other procedures that you have written.
– END OF PAPER –

More products