Question: PYTHON Tautologies and Contradictions Block 1 prints the truth table for ((p q) q). The code prints a message if an assignment is found that

PYTHON

Tautologies and Contradictions

Block 1 prints the truth table for ((p q) q). The code prints a message if an assignment is found that causes ((p q) q) to be true, showing that ((p q) q) is not a contradiction.

Block 2 prints the truth table for (p q) q. The proposition is false for every row, so no extra message is printed. Therefore (p q) q is a contradiction.

Follow the instructions in the comments to create code to determine whether the propositions ((q p) p) and ((p q) p) are tautologies.

main.py:

# Block 1 # Prints out the rows of a truth table for "not((p and q) or not p)" which has two variables, p and q # An extra message is printed for every truth assignment that makes "not((p and q) or not p)" True. print("p q not((p and q) or not p)") # This is a header line that labels the columns for p in (True, False): for q in (True, False): print( p, q, not((p and q) or not p), end = '' ) # end = '' supresses the newline if ((not((p and q) or not p)) == True): print(" <-- True. Therefore, not a contradiction.", end = '') # Extra message print(" ") # put a newline to start a new row of the truth table

print(" ") # Put a blank line between outputs.

# Block 2 # Prints out the rows of a truth table for "not((p and q) or not p)" which has two variables, p and q # An extra message is printed for every truth assignment that makes "not((p and q) or not p)" True. print("p q not(p or q) and q") # This is a header line that labels the columns for p in (True, False): for q in (True, False): print(p, q, not(p or q) and q, end = '' ) if ((not(p or q) and q) == True): print(" <-- True. Therefore, not a contradiction.", end = '' ) # Extra message print(" ") print(" ") # Put a blank line between outputs.

# Block 3 # Put your code here that prints out the truth table for "not(q and not p) or p" # Print an extra message for every truth assignment found showing that "not(q and not p) or p" is not a tautology. print(" ") # Put a blank line between outputs.

# Block 4 # Put your code here that prints out the truth table for "not(q and p) or p" # Print an extra message for every truth assignment found showing that "not(q and p) or p" is not a tautology.

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!