COMP5361 – (Solution)

$ 24.99
Category:

Description

Department of Computer Science & Software Engineering Comp5361 Discrete Structures and Formal Languages

1. Write a Python program that takes as input a truth assignment A for propositional variables P = {P1,P2,…,Pn} and a propositional sentence S involving these variables, and produces output True or False, depending on whether the given assignment A satisfies the sentence S or not. To show that your program works, run your program on the following input
((P1 ∧ P2)∨(P3 ∧True))∨((¬P1 ∧¬P3)∧ P2).
Note that your program should work for any n ≥ 1, and other inputs also will be given as tests.
2. Write a Python program that takes input P and S as in Question 1, generates the truth table for S, and outputs Tautology, Contingency, or Contradiction, depending on which category
S falls into. To show that your program works, run your program on the following inputs
(a) (¬P1 ∧(P1 ∨ P2))→ P2
(b) P2 ∧(P1 →¬P2)∧(¬P1 →¬P2)
(c) (P1 →(P2 → P3))→((P1 → P2)→ P3)
Input/Output format
Use of libraries and some built-in python functions
• The use of any parser / evaluator such as the eval() function is not allowed, unless you implement it.
• Any other function, whether built-in or not, that directly simplifies the assignment is not allowed.
What to submit
Using the Moodle system, submit a .zip file that includes:
1. Source code, please submit one .py file.
2. A .pdf file, explaining your format and how to run your code in few lines.
3. Four screenshots, showing the results of all the four inputs given in this assignment.
The format to be followed for submission file is :
<yourname> passign2 <student-id>.zip
How to prepare for the demo
1. Correctness of the program : 30%
2. Valid input and output cases passed : 40%
3. Comprehension of the written program : 20%
4. Understanding of the problem statement 10%

Reviews

There are no reviews yet.

Be the first to review “COMP5361 – (Solution)”

Your email address will not be published. Required fields are marked *