Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data And Databases

Authors: Jeff Mapua

1st Edition

1978502257, 978-1978502253

More Books

Students also viewed these Databases questions

Question

How wide are Salary Structure Ranges?

Answered: 1 week ago