Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Equivalence in Propositional LogiC As discussed in class, one way to prove whether two propositions are equivalent, is to generate truth tables for both propositions
Equivalence in Propositional LogiC As discussed in class, one way to prove whether two propositions are equivalent, is to generate truth tables for both propositions and check to see if all the rows match, in which case the propositions are equivalent otherwise they are not. In this exercise you are required to write a Python program that asks the user to enter two propositions, where both propositions the variables p and q. Your program should then determine whether or not the two propositions are equivalent, and report the result. Here is an example of how a user might interact with your program: Enter proposition 1: p and q Enter proposition 2: q and 1P The propositions are equivalent In order to complete this exercise, you should study the structure of the table property of TruthTable. You can access it by saying: print myTable.table For example, here is the table of the proposition p Aq. CCo, o], [011, [[o, 1], [0]1, [[1, o], [0]], [[1, 1], 01111 As you can see, it is one big list, made up of exactly 4 smaller lists. Each one of the smaller lists represents a row of the truth table. Each row in turn is made up of exactly 2 lists. The first one is a list of truth values of the propositional variables, and the second one is the overall truth value of the proposition(s), given the truth values in the last list If we take the above table and consider the first row, that is the list [o, o], [0]]. Bearing in mind that this is for the formula pA q, the way to interpret this list is that when the variables p and q are [0, 0], respectively, then the proposition p q has a truth value of 0 , or simply o Remember, this is represented as a list with a single element in it because the truth table may have more than one proposition being evaluated This brings us to the following example. Let us generate a single truth table for both pAq and qAp. Now we have the following table: It is still made up of 4 lists, each of which represents a row of the truth table. Each row is still made up of two lists, as before. The first of these lists is still a specific combination of truth values, and the second list is the overall truth value of each proposition. Since we generated a truth table for 2 propositions, the list has 2 results in it. This time, taking the second row, which is [[0, 1J. [o, oJJ, we can see that when p 0 and 1 then q evaluates to false, and q / p also evaluates to false, hence both O values in the list. Examining the whole table, we can see that the two propositions are indeed equivalent because, for every row, the result part always contains the same two values, meaning that for any possible combination of truth values, both propositions evaluate to the same result
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started