Question: please help me with the following python programming task 1. Write a Python program that takes as input a truth assignment A for propositional variables

please help me with the following python programming task

please help me with the following python programming task 1. Write a

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) v(P31 True)) ((-P11 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 v P2)) P2 (b) P2 (P1 -P2)^(-P1 -P2) (c) (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() function. 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. 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) v(P31 True)) ((-P11 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 v P2)) P2 (b) P2 (P1 -P2)^(-P1 -P2) (c) (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() function. 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

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!