Starting from:

$30

COMP5361- Programming Assignment 2 Solved

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.

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

(¬P1 ∧(P1 ∨ P2))→ P2
P2 ∧(P1 →¬P2)∧(¬P1 →¬P2)
(P1 →(P2 → P3))→((P1 → P2)→ P3)
Input/Output format
The input/output format is up to the student. You may take and show the information in any format you want. For example, you may use “OR,” “V”, etc. to represent logical disjunction.

The input/output streams is up to the student as well. For example, you may read from sys.stdin or from a file.

Use of libraries and some built-in python functions
The use of any regular expression engine is not allowed (unless you implement it.) You may, however, use very simple such functions, like the split()
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.
How to prepare for the demo
You will have to demonstrate your program in a one to one zoom meeting (the date of which will be announced) and your program will be tested using other test cases.

More products