Question
- Python directly supports conjunction and disjunction in terms of the built-in primitives and and or , as well as negation via the primitive not
- Python directly supports conjunction and disjunction in terms of the built-in primitives and and or, as well as negation via the primitive not. Other connectives can easily be encoded as functions by use of the if statement. The implication arrow, for example, may be defined as follows:
def implies( a, b ):
if a:
return b
else:
return True
To express the logical statement x 0 y 0 x*y 0 in Python one simply writes implies( x >= 0 and y >= 0, x*y >= 0 ) Notice, though, that the Python interpreter will merely check whether the implication statement holds for the particular values assigned to x and y at run-time. To check the validity of the statement in general, one has to run it for every possible combination of values for x and y a daunting task even considering the limited range of Pythons integers!
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