truth table: Binary Operations 5
requirements
more examples
security alarm
if the inputs are
is there motion?
is the code right?
alarm |
motion, wrong code |
motion, right code |
no motion, wrong code |
no motion, right code |
operation |
|---|---|---|---|---|---|
alarm always off |
off |
off |
off |
off |
|
motion and wrong code |
on |
off |
off |
off |
|
wrong code |
on |
off |
on |
off |
|
(no motion) and wrong code |
off |
off |
on |
off |
|
no motion |
off |
off |
on |
on |
|
not (motion and wrong code) |
off |
on |
on |
on |
|
alarm always |
on |
on |
on |
on |
|
motion or right code |
on |
on |
on |
off |
|
(not (motion and wrong code)) and (motion or wrong code) |
off |
on |
on |
off |
|
motion and right code |
off |
on |
off |
off |
|
motion |
on |
on |
off |
off |
|
motion or right code |
on |
on |
off |
on |
|
right code |
off |
on |
off |
on |
|
not (motion or wrong code) |
off |
off |
off |
on |
|
(no motion or wrong code) and (motion or right code) |
on |
off |
off |
on |
|
no motion or wrong code |
on |
off |
on |
on |
operation |
rule |
|---|---|
alarm always off |
|
alarm only if there is motion and the code is wrong |
|
alarm only if the code is wrong |
|
alarm only if there is no motion and the code is wrong |
|
alarm only if there is no motion |
|
alarm off only if there is motion and the code is wrong |
|
alarm always on |
|
alarm off if there is no motion and the code is right |
|
alarm off if there is motion and the code is wrong, alarm off if there is no motion and the code is right |
|
alarm only if there is motion and the code is right |
|
alarm only if there is motion |
|
alarm off only if there is no motion and the code is wrong |
|
alarm only if the code is right |
|
alarm only if there is no motion and the code is right |
|
alarm if there is motion and the code is wrong, alarm if there is no motion and the code is right |
|
alarm off only if there is motion and the code is right |
hiring
if the inputs are
is the person a strong option?
is the person a strong fit?
hire/reject |
strong option, strong fit |
strong option, weak fit |
weak option, strong fit |
weak option, weak fit |
operation |
|---|---|---|---|---|---|
reject |
reject |
reject |
reject |
reject |
|
strong option and strong fit |
hire |
reject |
reject |
reject |
|
strong fit |
hire |
reject |
hire |
reject |
|
weak option and strong fit |
reject |
reject |
hire |
reject |
|
weak option |
reject |
reject |
hire |
hire |
|
not (strong option and strong fit) |
reject |
hire |
hire |
hire |
|
hire |
hire |
hire |
hire |
hire |
|
strong option or weak fit |
hire |
hire |
hire |
reject |
|
(not (strong option and strong fit)) and (strong option or strong fit) |
reject |
hire |
hire |
reject |
|
strong option and weak fit |
reject |
hire |
reject |
reject |
|
strong option |
hire |
hire |
reject |
reject |
|
strong option or weak fit |
hire |
hire |
reject |
hire |
|
weak fit |
reject |
hire |
reject |
hire |
|
not (strong option or strong fit) |
reject |
reject |
reject |
hire |
|
(weak option or strong fit) and (strong option or weak fit) |
hire |
reject |
reject |
hire |
|
weak option or strong fit |
hire |
reject |
hire |
hire |
operation |
rule |
|---|---|
not hiring |
|
hire only if it is a strong option that is a strong fit |
|
hire only if it is a strong fit |
|
hire only if it is weak option that is a strong fit |
|
hire only if it is weak option |
|
reject only if it is a strong option that is a strong fit |
|
hiring |
|
reject only if it is weak option that is a weak fit |
|
reject if it is a strong option that is a strong fit, reject if it is a weak option that is a weak fit |
|
hire only if it is a strong option that is a weak fit |
|
hire only if it is a strong option |
|
reject only if it is weak option that is a strong fit |
|
hire only if it is a weak fit |
|
hire only if it is a weak option that is a weak fit |
|
hire if it is a strong option that is a strong fit, hire if it is weak option that is a weak fit |
|
reject only if it is a strong option that is a weak fit |
store discount policy
if the inputs are
does the person have a coupon?
is the person a member?
discount/regular price |
coupon, member |
coupon, not member |
no coupon, member |
no coupon, not member |
operation |
|---|---|---|---|---|---|
regular |
regular |
regular |
regular |
regular |
|
coupon and member |
discount |
regular |
regular |
regular |
|
member |
discount |
regular |
discount |
regular |
|
no coupon and member |
regular |
regular |
discount |
regular |
|
no coupon |
regular |
regular |
discount |
discount |
|
not (coupon and member) |
regular |
discount |
discount |
discount |
|
discount |
discount |
discount |
discount |
discount |
|
coupon or not member |
discount |
discount |
discount |
regular |
|
(not (coupon and member)) and (coupon or member) |
regular |
discount |
discount |
regular |
|
coupon and not member |
regular |
discount |
regular |
regular |
|
coupon |
discount |
discount |
regular |
regular |
|
coupon or not member |
discount |
discount |
regular |
discount |
|
not member |
regular |
discount |
regular |
discount |
|
not (coupon or member) |
regular |
regular |
regular |
discount |
|
(no coupon or member) and (coupon or not member) |
discount |
regular |
regular |
discount |
|
no coupon or member |
discount |
regular |
discount |
discount |
operation |
rule |
|---|---|
everyone pays regular price, no discounts |
|
discount price only if person has a coupon and is a member |
|
discount price only if person is a member |
|
discount price only if person does not have a coupon and is a member |
|
discount price only if person does not have a coupon |
|
regular price only if person has a coupon and is a member |
|
everyone gets a discount |
|
regular price only if person does not have a coupon and is not a member |
|
regular price if person has a coupon and is a member, regular price if person does not have a coupon and is not a member |
|
discount price only if person has a coupon and is not a member |
|
discount price only if person has a coupon |
|
regular price only if person does not have a coupon and is a member |
|
discount price only if person is not a member |
|
discount price only if person does not have a coupon and is not a member |
|
discount price only if person has a coupon and is a member, discount price if person does not have a coupon and is not a member |
|
regular price only if person has a coupon and is not a member |
watering plants
if the inputs are
is the soil dry?
did it rain?
water the plants |
dry soil, no rain |
dry soil, it rained |
wet soil, no rain |
wet soil, it rained |
operation |
|---|---|---|---|---|---|
do not water |
no |
no |
no |
no |
|
dry soil and no rain |
yes |
no |
no |
no |
|
no rain |
yes |
no |
yes |
no |
|
wet soil and no rain |
no |
no |
yes |
no |
|
wet soil |
no |
no |
yes |
yes |
|
not (dry soil and no rain) |
no |
yes |
yes |
yes |
|
water |
yes |
yes |
yes |
yes |
|
dry soil or it rained |
yes |
yes |
yes |
no |
|
(not (dry soil and no rain)) and (dry soil or no rain) |
no |
yes |
yes |
no |
|
dry soil and it rained |
no |
yes |
no |
no |
|
dry soil |
yes |
yes |
no |
no |
|
dry soil or it rained |
yes |
yes |
no |
yes |
|
rain |
no |
yes |
no |
yes |
|
not (dry soil or no rain) |
no |
no |
no |
yes |
|
(wet soil or no rain) and (dry soil or it rained) |
yes |
no |
no |
yes |
|
(wet soil) or no rain |
yes |
no |
yes |
yes |
operation |
rule |
|---|---|
do not water |
|
water only if soil is dry and it did not rain |
|
water only if it did not rain |
|
water only if soil is wet and it did not rain |
|
water only if soil is wet |
|
do not water if soil is dry and it did not rain |
|
everyone gets a yes |
|
do not water if soil is wet and it rained |
|
do not water if soil is dry and it did not rain, do not water if soil is wet and it did not rain |
|
water only if soil is dry and it rained |
|
water only if soil is dry |
|
do not water if soil is wet and it did not rain |
|
water only if it rained |
|
water only if soil is wet and it rained |
|
water only if soil is dry and it did not rain, water if soil is wet and it did not rain |
|
do not water if soil is dry and it rained |
what is next?
rate pumping python
If this has been a 7 star experience for you, please CLICK HERE to leave a 5 star review of pumping python. It helps other people get into the book too