truth table: Binary Operations 5


requirements


more examples


security alarm


if the inputs are

  • is there motion?

  • is the code right?

then the possible states for the inputs are

motion (first)

code (second)

motion

right code

motion

wrong code

no motion

right code

no motion

wrong code

and the possible outputs are

  • ON

  • OFF

the truth table shows all the logically possible states of the alarm

  • contradiction: return False

    motion (first)

    code (second)

    output

    motion

    right code

    OFF

    motion

    wrong code

    OFF

    no motion

    right code

    OFF

    no motion

    wrong code

    OFF

    outputs OFF always, it does not care about the inputs.

  • logical_conjunction: return first and second

    motion (first)

    code (second)

    output

    motion

    right code

    ON

    motion

    wrong code

    OFF

    no motion

    right code

    OFF

    no motion

    wrong code

    OFF

    outputs ON only if there is motion AND the right code is entered. Authorized entry.

  • project_second: return second

    motion (first)

    code (second)

    output

    motion

    right code

    ON

    motion

    wrong code

    OFF

    no motion

    right code

    ON

    no motion

    wrong code

    OFF

    outputs ON only if the right code is entered, it does not care if there is motion or no motion. How is the right code entered without motion?

  • converse_non_implication: return (not first) and second

    motion (first)

    code (second)

    output

    motion

    right code

    OFF

    motion

    wrong code

    OFF

    no motion

    right code

    ON

    no motion

    wrong code

    OFF

    outputs ON only if there is no motion AND the right code is entered. How is the right code entered without motion?

  • negate_first: return not first

    motion (first)

    code (second)

    output

    motion

    right code

    OFF

    motion

    wrong code

    OFF

    no motion

    right code

    ON

    no motion

    wrong code

    ON

    outputs ON only if there is no motion, it does not care if the right code or wrong code was entered.

  • logical_nand: return not (first and second)

    motion (first)

    code (second)

    output

    motion

    right code

    OFF

    motion

    wrong code

    ON

    no motion

    right code

    ON

    no motion

    wrong code

    ON

    outputs OFF only if there is motion AND the right code is entered.

  • tautology: return True

    motion (first)

    code (second)

    output

    motion

    right code

    ON

    motion

    wrong code

    ON

    no motion

    right code

    ON

    no motion

    wrong code

    ON

    outputs ON always, it does not care about the inputs.

  • logical_disjunction: return first or second

    motion (first)

    code (second)

    output

    motion

    right code

    ON

    motion

    wrong code

    ON

    no motion

    right code

    ON

    no motion

    wrong code

    OFF

    outputs OFF only if there is no motion AND the wrong code is entered. How is the code entered without motion?

  • exclusive_disjunction: return (not (first and second) and (first or second))

    motion (first)

    code (second)

    output

    motion

    right code

    OFF

    motion

    wrong code

    ON

    no motion

    right code

    ON

    no motion

    wrong code

    OFF

    • outputs OFF if there is motion AND the right code is entered

    • outputs OFF if there is no motion AND the wrong code is entered

    Wait a minute! Why is “motion AND the right code” the same as “NOT motion AND NOT the right code”?

  • material_non_implication: return first and (not second)

    motion (first)

    code (second)

    output

    motion

    right code

    OFF

    motion

    wrong code

    ON

    no motion

    right code

    OFF

    no motion

    wrong code

    OFF

    outputs ON only if there is motion AND NOT the right code is entered. Is there a burglar?

  • project_first: return first

    motion (first)

    code (second)

    output

    motion

    right code

    ON

    motion

    wrong code

    ON

    no motion

    right code

    OFF

    no motion

    wrong code

    OFF

    outputs ON only if there is motion, it does not care if the right code or wrong code was entered.

  • converse_implication: return first or (not second)

    motion (first)

    code (second)

    output

    motion

    right code

    ON

    motion

    wrong code

    ON

    no motion

    right code

    OFF

    no motion

    wrong code

    ON

    outputs OFF only if there is no motion AND the right code is entered. How is the code entered if there is no motion?

  • negate_second: return not second

    motion (first)

    code (second)

    output

    motion

    right code

    OFF

    motion

    wrong code

    ON

    no motion

    right code

    OFF

    no motion

    wrong code

    ON

    outputs ON only if the wrong code is entered, it does not care if there is motion or no motion.

  • logical_nor: return not (first or second)

    motion (first)

    code (second)

    output

    motion

    right code

    OFF

    motion

    wrong code

    OFF

    no motion

    right code

    OFF

    no motion

    wrong code

    ON

    outputs ON only if there is no motion AND the wrong code is entered.

  • logical_equality: return (not first or second) and (first or not second)

    motion (first)

    code (second)

    output

    motion

    right code

    ON

    motion

    wrong code

    OFF

    no motion

    right code

    OFF

    no motion

    wrong code

    ON

    • outputs ON if there is motion AND the right code is entered

    • outputs ON if there is no motion AND the wrong code is entered

  • material_implication: return (not first) or second

    motion (first)

    code (second)

    output

    motion

    right code

    ON

    motion

    wrong code

    OFF

    no motion

    right code

    ON

    no motion

    wrong code

    ON

    outputs OFF only if there is motion AND NOT the right code is entered.

I do not need to know or memorize every operation, the only operations that I want in this case are:

  • logical_conjunction, where it outputs ON only if there is motion AND the right code is entered. I assume this is an authorized entry.

  • material_non_implication, where it outputs ON only if there is motion AND the wrong code is entered. I assume this is NOT an authorized entry.

Because I want to first check if there is motion, then check if the code entered is correct.


hiring


if the inputs are

  • is the person a strong option?

  • is the person a strong fit?

then the possible states for the inputs are

option (first)

fit (second)

strong option

strong fit

strong option

weak fit

weak option

strong fit

weak option

weak fit

and the possible outputs are

  • HIRE

  • REJECT

the truth table shows all the logically possible states of

  • contradiction: return False

    option (first)

    fit (second)

    output

    strong option

    strong fit

    REJECT

    strong option

    weak fit

    REJECT

    weak option

    strong fit

    REJECT

    weak option

    weak fit

    REJECT

    always REJECT. The inputs do not matter.

  • logical_conjunction: return first and second

    option (first)

    fit (second)

    output

    strong option

    strong fit

    HIRE

    strong option

    weak fit

    REJECT

    weak option

    strong fit

    REJECT

    weak option

    weak fit

    REJECT

    HIRE only if it is a strong option AND it is a strong fit. I only hire A players.

  • project_second: return second

    option (first)

    fit (second)

    output

    strong option

    strong fit

    HIRE

    strong option

    weak fit

    REJECT

    weak option

    strong fit

    HIRE

    weak option

    weak fit

    REJECT

    HIRE only if it is a strong fit, I do not care if it is a strong option or weak option. I like this person and do not care about whether it is a strong or weak option. How does the team feel about this?

  • converse_non_implication: return (not first) and second

    option (first)

    fit (second)

    output

    strong option

    strong fit

    REJECT

    strong option

    weak fit

    REJECT

    weak option

    strong fit

    HIRE

    weak option

    weak fit

    REJECT

    HIRE only if it is a weak option AND it is a strong fit. What is the benefit of a weak option that is a strong fit?

  • negate_first: return not first

    option (first)

    fit (second)

    output

    strong option

    strong fit

    REJECT

    strong option

    weak fit

    REJECT

    weak option

    strong fit

    HIRE

    weak option

    weak fit

    HIRE

    HIRE only if it is a weak option, I do not care if it is a strong fit or weak fit. Why would I hire a weak option?

  • logical_nand: return not (first and second)

    option (first)

    fit (second)

    output

    strong option

    strong fit

    REJECT

    strong option

    weak fit

    HIRE

    weak option

    strong fit

    HIRE

    weak option

    weak fit

    HIRE

    REJECT only if it is a strong option AND it is a strong fit. Why do I not want a strong option that is a strong fit?

  • tautology: return True

    option (first)

    fit (second)

    output

    strong option

    strong fit

    HIRE

    strong option

    weak fit

    HIRE

    weak option

    strong fit

    HIRE

    weak option

    weak fit

    HIRE

    HIRE always, I do not care about the inputs. Anybody can get a job here.

  • logical_disjunction: return first or second

    option (first)

    fit (second)

    output

    strong option

    strong fit

    HIRE

    strong option

    weak fit

    HIRE

    weak option

    strong fit

    HIRE

    weak option

    weak fit

    REJECT

    REJECT only if it is a weak option and NOT a strong fit. I hire just about anybody but have to draw the line somewhere.

  • exclusive_disjunction: return (not (first and second) and (first or second))

    option (first)

    fit (second)

    output

    strong option

    strong fit

    REJECT

    strong option

    weak fit

    HIRE

    weak option

    strong fit

    HIRE

    weak option

    weak fit

    REJECT

    • REJECT if it is a strong option AND it is a strong fit

    • REJECT if it is NOT a strong option AND NOT a strong fit

    Wait a minute! Why is “strong option AND strong fit” the same as “weak option AND weak fit”? Do I just not like extremes?

  • material_non_implication: return first and (not second)

    option (first)

    fit (second)

    output

    strong option

    strong fit

    REJECT

    strong option

    weak fit

    HIRE

    weak option

    strong fit

    REJECT

    weak option

    weak fit

    REJECT

    HIRE only if it is a strong option AND NOT a strong fit. How does the team feel about this?

  • project_first: return first

    option (first)

    fit (second)

    output

    strong option

    strong fit

    HIRE

    strong option

    weak fit

    HIRE

    weak option

    strong fit

    REJECT

    weak option

    weak fit

    REJECT

    HIRE only if it is a strong option, I do not care if it is a strong fit or weak fit.

  • converse_implication: return first or (not second)

    option (first)

    fit (second)

    output

    strong option

    strong fit

    HIRE

    strong option

    weak fit

    HIRE

    weak option

    strong fit

    REJECT

    weak option

    weak fit

    HIRE

    REJECT only if it is a weak option AND it is a strong fit. Did I just hire a weak option that is also a weak fit?

  • negate_second: return not second

    option (first)

    fit (second)

    output

    strong option

    strong fit

    REJECT

    strong option

    weak fit

    HIRE

    weak option

    strong fit

    REJECT

    weak option

    weak fit

    HIRE

    HIRE only if it is a weak fit, I do not care if it is a strong option or weak option.

  • logical_nor: return not (first or second)

    option (first)

    fit (second)

    output

    strong option

    strong fit

    REJECT

    strong option

    weak fit

    REJECT

    weak option

    strong fit

    REJECT

    weak option

    weak fit

    HIRE

    HIRE only if it is a weak option AND NOT a strong fit. Trouble.

  • logical_equality: return (not first or second) and (first or not second)

    option (first)

    fit (second)

    output

    strong option

    strong fit

    HIRE

    strong option

    weak fit

    REJECT

    weak option

    strong fit

    REJECT

    weak option

    weak fit

    HIRE

    • HIRE if it is a strong option AND it is a strong fit

    • HIRE if it is NOT a strong option AND NOT a strong fit

    maybe I need someone else making these decisions

  • material_implication: return (not first) or second

    option (first)

    fit (second)

    output

    strong option

    strong fit

    HIRE

    strong option

    weak fit

    REJECT

    weak option

    strong fit

    HIRE

    weak option

    weak fit

    HIRE

    REJECT only if it is a strong option AND NOT a strong fit.

I do not need to know or memorize every operation, the only operations that I want in this case are:

  • logical_conjunction, HIRE only if it is a strong option AND it is a strong fit if I only want A players that can work with the team.

  • material_non_implication, if I am okay with hiring someone who is a strong option AND NOT a strong fit.

  • maybe logical_disjunction, if I will HIRE pretty much anyone and only REJECT a weak option that is also a weak fit.


store discount policy


if the inputs are

  • does the person have a coupon?

  • is the person a member?

then the possible states for the inputs are

coupon (first)

member (second)

coupon

member

coupon

NOT a member

no coupon

member

no coupon

NOT a member

and the possible outputs are

  • DISCOUNT PRICE

  • REGULAR PRICE

the truth table shows all the logically possible states of

  • contradiction: return False

    coupon (first)

    member (second)

    output

    coupon

    member

    REGULAR PRICE

    coupon

    NOT a member

    REGULAR PRICE

    no coupon

    member

    REGULAR PRICE

    no coupon

    NOT a member

    REGULAR PRICE

    REGULAR PRICE always. I never give a discount, everyone pays full price.

  • logical_conjunction: return first and second

    coupon (first)

    member (second)

    output

    coupon

    member

    DISCOUNT PRICE

    coupon

    NOT a member

    REGULAR PRICE

    no coupon

    member

    REGULAR PRICE

    no coupon

    NOT a member

    REGULAR PRICE

    DISCOUNT PRICE only if the person has a coupon AND is a member. A loyalty/rewards program.

  • project_second: return second

    coupon (first)

    member (second)

    output

    coupon

    member

    DISCOUNT PRICE

    coupon

    NOT a member

    REGULAR PRICE

    no coupon

    member

    DISCOUNT PRICE

    no coupon

    NOT a member

    REGULAR PRICE

    DISCOUNT PRICE only if the person is a member, I do not care if they have a coupon or no coupon. I give the discount only to members. A loyalty program. Sorry you brought a coupon.

  • converse_non_implication: return (not first) and second

    coupon (first)

    member (second)

    output

    coupon

    member

    REGULAR PRICE

    coupon

    NOT a member

    REGULAR PRICE

    no coupon

    member

    DISCOUNT PRICE

    no coupon

    NOT a member

    REGULAR PRICE

    DISCOUNT PRICE only if the person does NOT have a coupon AND is a member. What happens to the members who have coupons?

  • negate_first: return not first

    coupon (first)

    member (second)

    output

    coupon

    member

    REGULAR PRICE

    coupon

    NOT a member

    REGULAR PRICE

    no coupon

    member

    DISCOUNT PRICE

    no coupon

    NOT a member

    DISCOUNT PRICE

    DISCOUNT PRICE only if the person does NOT have a coupon, I do not care if it is a member or not. Do I want all the people with coupons to be upset?

  • logical_nand: return not (first and second)

    coupon (first)

    member (second)

    output

    coupon

    member

    REGULAR PRICE

    coupon

    NOT a member

    DISCOUNT PRICE

    no coupon

    member

    DISCOUNT PRICE

    no coupon

    NOT a member

    DISCOUNT PRICE

    REGULAR PRICE only if the person has a coupon AND is a member. I might already have a benefit I give to members and do not want to give discounts with that.

  • tautology: return True

    coupon (first)

    member (second)

    output

    coupon

    member

    DISCOUNT PRICE

    coupon

    NOT a member

    DISCOUNT PRICE

    no coupon

    member

    DISCOUNT PRICE

    no coupon

    NOT a member

    DISCOUNT PRICE

    DISCOUNT PRICE always. I am always giving a discount, everybody loves me.

  • logical_disjunction: return first or second

    coupon (first)

    member (second)

    output

    coupon

    member

    DISCOUNT PRICE

    coupon

    NOT a member

    DISCOUNT PRICE

    no coupon

    member

    DISCOUNT PRICE

    no coupon

    NOT a member

    REGULAR PRICE

    REGULAR PRICE only if the person does NOT have a coupon AND is NOT a member. The person has to be a member, have a coupon, or both to get the discount.

  • exclusive_disjunction: return (not (first and second) and (first or second))

    coupon (first)

    member (second)

    output

    coupon

    member

    REGULAR PRICE

    coupon

    NOT a member

    DISCOUNT PRICE

    no coupon

    member

    DISCOUNT PRICE

    no coupon

    NOT a member

    REGULAR PRICE

    • REGULAR PRICE if the person has a coupon AND is a member

    • REGULAR PRICE if the person does NOT have a coupon AND is NOT a member

    Why is “coupon AND member” the same as “no coupon AND not member”? I do not want a member to have a coupon and I do not want someone who is not a member and does not have a coupon.

  • material_non_implication: return first and (not second)

    coupon (first)

    member (second)

    output

    coupon

    member

    REGULAR PRICE

    coupon

    NOT a member

    DISCOUNT PRICE

    no coupon

    member

    REGULAR PRICE

    no coupon

    NOT a member

    REGULAR PRICE

    DISCOUNT PRICE only if the person has a coupon AND is NOT a member. A coupon for people that are not members.

  • project_first: return first

    coupon (first)

    member (second)

    output

    coupon

    member

    DISCOUNT PRICE

    coupon

    NOT a member

    DISCOUNT PRICE

    no coupon

    member

    REGULAR PRICE

    no coupon

    NOT a member

    REGULAR PRICE

    DISCOUNT PRICE only if the person has a coupon, I do not care about if they are a member or NOT a member.

  • converse_implication: return first or (not second)

    coupon (first)

    member (second)

    output

    coupon

    member

    DISCOUNT PRICE

    coupon

    NOT a member

    DISCOUNT PRICE

    no coupon

    member

    REGULAR PRICE

    no coupon

    NOT a member

    DISCOUNT PRICE

    REGULAR PRICE only if the person does NOT have a coupon AND is a member.

  • negate_second: return not second

    coupon (first)

    member (second)

    output

    coupon

    member

    REGULAR PRICE

    coupon

    NOT a member

    DISCOUNT PRICE

    no coupon

    member

    REGULAR PRICE

    no coupon

    NOT a member

    DISCOUNT PRICE

    DISCOUNT PRICE only if the person is NOT a member, I do not care if they have a coupon or not. Why do I have coupons?

  • logical_nor: return not (first or second)

    coupon (first)

    member (second)

    output

    coupon

    member

    REGULAR PRICE

    coupon

    NOT a member

    REGULAR PRICE

    no coupon

    member

    REGULAR PRICE

    no coupon

    NOT a member

    DISCOUNT PRICE

    DISCOUNT PRICE only if the person does NOT have a coupon AND is NOT a member. Is it opposite day?

  • logical_equality: return (not first or second) and (first or not second)

    coupon (first)

    member (second)

    output

    coupon

    member

    DISCOUNT PRICE

    coupon

    NOT a member

    REGULAR PRICE

    no coupon

    member

    REGULAR PRICE

    no coupon

    NOT a member

    DISCOUNT PRICE

    • DISCOUNT PRICE if the person has a coupon AND is a member

    • DISCOUNT PRICE if the person does NOT have a coupon AND is NOT a member

    this is just confusing, which meets both conditions?

  • material_implication: return (not first) or second

    coupon (first)

    member (second)

    output

    coupon

    member

    DISCOUNT PRICE

    coupon

    NOT a member

    REGULAR PRICE

    no coupon

    member

    DISCOUNT PRICE

    no coupon

    NOT a member

    DISCOUNT PRICE

    REGULAR PRICE if the person has a coupon AND NOT a member.

I do not need to know or memorize every operation, the only operations that I want in this case are:

  • logical_conjunction, if I give a DISCOUNT PRICE only if the person has a coupon AND is a member because I want to reward my most loyal customers.

  • material_non_implication, if I give a DISCOUNT PRICE to someone who has a coupon and is NOT a member. This could be a way to get people to become members though it is not as good as

  • project_second if I give a DISCOUNT PRICE only if the person is a member or

  • logical_disjunction, if I only charge a REGULAR PRICE to the person who does NOT have a coupon AND is not a member.


watering plants


if the inputs are

  • is the soil dry?

  • did it rain?

then the possible states for the inputs are

soil (first)

rain (second)

soil is dry

it rained

soil is dry

NOT rain

soil is wet

it rained

soil is wet

NOT rain

and the possible outputs are

  • WATER

  • DO NOT WATER

the truth table shows all the logically possible states of

  • contradiction: return False

    soil (first)

    rain (second)

    output

    soil is dry

    it rained

    DO NOT WATER

    soil is dry

    NOT rain

    DO NOT WATER

    soil is wet

    it rained

    DO NOT WATER

    soil is wet

    NOT rain

    DO NOT WATER

    DO NOT WATER always. I never water, survival of the fittest.

  • logical_conjunction: return first and second

    soil (first)

    rain (second)

    output

    soil is dry

    it rained

    WATER

    soil is dry

    NOT rain

    DO NOT WATER

    soil is wet

    it rained

    DO NOT WATER

    soil is wet

    NOT rain

    DO NOT WATER

    WATER only if the soil is dry AND it rained. Why is the soil still dry after it rained?

  • project_second: return second

    soil (first)

    rain (second)

    output

    soil is dry

    it rained

    WATER

    soil is dry

    NOT rain

    DO NOT WATER

    soil is wet

    it rained

    WATER

    soil is wet

    NOT rain

    DO NOT WATER

    WATER only if it rained, I do not care if the soil is dry or if the soil is wet. Am I trying to make a swamp?

  • converse_non_implication: return (not first) and second

    soil (first)

    rain (second)

    output

    soil is dry

    it rained

    DO NOT WATER

    soil is dry

    NOT rain

    DO NOT WATER

    soil is wet

    it rained

    WATER

    soil is wet

    NOT rain

    DO NOT WATER

    WATER only if the soil is wet AND it rained. Maybe this is why all my plants die, I keep over watering them.

  • negate_first: return not first

    soil (first)

    rain (second)

    output

    soil is dry

    it rained

    DO NOT WATER

    soil is dry

    NOT rain

    DO NOT WATER

    soil is wet

    it rained

    WATER

    soil is wet

    NOT rain

    WATER

    WATER only if the soil is wet, I do not care if it rained or did NOT rain. I must really want a swamp.

  • logical_nand: return not (first and second)

    soil (first)

    rain (second)

    output

    soil is dry

    it rained

    DO NOT WATER

    soil is dry

    NOT rain

    WATER

    soil is wet

    it rained

    WATER

    soil is wet

    NOT rain

    WATER

    DO NOT WATER only if the soil is dry AND it rained. Why do I water when the soil is wet and it rained?

  • tautology: return True

    soil (first)

    rain (second)

    output

    soil is dry

    it rained

    WATER

    soil is dry

    NOT rain

    WATER

    soil is wet

    it rained

    WATER

    soil is wet

    NOT rain

    WATER

    WATER always.

  • logical_disjunction: return first or second

    soil (first)

    rain (second)

    output

    soil is dry

    it rained

    WATER

    soil is dry

    NOT rain

    WATER

    soil is wet

    it rained

    WATER

    soil is wet

    NOT rain

    DO NOT WATER

    DO NOT WATER only if the soil is wet AND it did NOT rain. I pretty much always water unless the soil is wet and it did not rain.

  • exclusive_disjunction: return (not (first and second) and (first or second))

    soil (first)

    rain (second)

    output

    soil is dry

    it rained

    DO NOT WATER

    soil is dry

    NOT rain

    WATER

    soil is wet

    it rained

    WATER

    soil is wet

    NOT rain

    DO NOT WATER

    • DO NOT WATER if the soil is dry AND it rained

    • DO NOT WATER if the soil is wet AND it did NOT rain

  • material_non_implication: return first and (not second)

    soil (first)

    rain (second)

    output

    soil is dry

    it rained

    DO NOT WATER

    soil is dry

    NOT rain

    WATER

    soil is wet

    it rained

    DO NOT WATER

    soil is wet

    NOT rain

    DO NOT WATER

    WATER only if the soil is dry AND it did NOT rain. I think the plants might like this.

  • project_first: return first

    soil (first)

    rain (second)

    output

    soil is dry

    it rained

    WATER

    soil is dry

    NOT rain

    WATER

    soil is wet

    it rained

    DO NOT WATER

    soil is wet

    NOT rain

    DO NOT WATER

    WATER only if the soil is dry, I do not care if it rained or did NOT rain. Maybe there was not enough rain.

  • converse_implication: return first or (not second)

    soil (first)

    rain (second)

    output

    soil is dry

    it rained

    WATER

    soil is dry

    NOT rain

    WATER

    soil is wet

    it rained

    DO NOT WATER

    soil is wet

    NOT rain

    WATER

    DO NOT WATER only if the soil is wet AND it rained. Too much water.

  • negate_second: return not second

    soil (first)

    rain (second)

    output

    soil is dry

    it rained

    DO NOT WATER

    soil is dry

    NOT rain

    WATER

    soil is wet

    it rained

    DO NOT WATER

    soil is wet

    NOT rain

    WATER

    WATER only if it did NOT rain, I do not care if the soil is dry or if the soil is wet.

  • logical_nor: return not (first or second)

    soil (first)

    rain (second)

    output

    soil is dry

    it rained

    DO NOT WATER

    soil is dry

    NOT rain

    DO NOT WATER

    soil is wet

    it rained

    DO NOT WATER

    soil is wet

    NOT rain

    WATER

    WATER only if the soil is wet AND it did NOT rain. How did the soil get wet? Did I water it already and forget?

  • logical_equality: return (not first or second) and (first or not second)

    soil (first)

    rain (second)

    output

    soil is dry

    it rained

    WATER

    soil is dry

    NOT rain

    DO NOT WATER

    soil is wet

    it rained

    DO NOT WATER

    soil is wet

    NOT rain

    WATER

    • WATER if the soil is dry AND it rained

    • WATER if the soil is wet AND it did NOT rain

    this could be ideal if I treat it as one or the other, but both things cannot be True at the same time

  • material_implication: return (not first) or second

    soil (first)

    rain (second)

    output

    soil is dry

    it rained

    WATER

    soil is dry

    NOT rain

    DO NOT WATER

    soil is wet

    it rained

    WATER

    soil is wet

    NOT rain

    WATER

    DO NOT WATER if the soil is dry AND it did NOT rain. I want to kill the plants.

I do not need to know or memorize every operation, the only operations that I want in this case are:


review

The truth table shows the possible states inputs can take and how they interact to give possible outputs. In most cases, I do not need to know all the operations. I only need to know the conditions for the problem I am solving, and remember that they can be made with some combination of NOT, AND and OR

The examples above show

  • security alarm

    output

    motion, right code

    motion, wrong code

    no motion, right code

    no motion, wrong code

    operation

    OFF

    OFF

    OFF

    OFF

    OFF

    contradiction

    motion AND right code

    ON

    OFF

    OFF

    OFF

    logical_conjunction

    right code

    ON

    OFF

    ON

    OFF

    project_second

    no motion AND right code

    OFF

    OFF

    ON

    OFF

    converse_non_implication

    no motion

    OFF

    OFF

    ON

    ON

    negate_first

    NOT (motion AND right code)

    OFF

    ON

    ON

    ON

    logical_nand

    ON

    ON

    ON

    ON

    ON

    tautology

    motion OR right code

    ON

    ON

    ON

    OFF

    logical_disjunction

    (NOT (motion AND right code)) AND (motion OR right code)

    OFF

    ON

    ON

    OFF

    exclusive_disjunction

    motion AND wrong code

    OFF

    ON

    OFF

    OFF

    material_non_implication

    motion

    ON

    ON

    OFF

    OFF

    project_first

    motion OR wrong code

    ON

    ON

    OFF

    ON

    converse_implication

    wrong code

    OFF

    ON

    OFF

    ON

    negate_second

    NOT (motion OR right code)

    OFF

    OFF

    OFF

    ON

    logical_nor

    (no motion OR right code) AND (motion OR wrong code)

    ON

    OFF

    OFF

    ON

    logical_equality

    no motion OR right code

    ON

    OFF

    ON

    ON

    material_implication

    I can say this in English as

    operation

    rule

    contradiction

    outputs OFF always, it does not care about the inputs

    logical_conjunction

    outputs ON only if there is motion AND the right code is entered

    project_second

    outputs ON only if the right code is entered

    converse_non_implication

    outputs ON only if there is no motion AND the right code is entered

    negate_first

    outputs ON only if there is no motion, it does not care if the right code or wrong code was entered

    logical_nand

    outputs OFF only if there is motion AND the right code is entered.

    tautology

    outputs ON always, it does not care about the inputs

    logical_disjunction

    outputs OFF only if there is no motion AND the wrong code is entered

    exclusive_disjunction

    outputs OFF if there is motion AND the right code is entered, OR if there is no motion AND the wrong code is entered

    material_non_implication

    outputs ON only if there is motion AND NOT the right code is entered

    project_first

    outputs ON only if there is motion, it does not care if the right code or wrong code was entered

    converse_implication

    outputs OFF if there is no motion AND the right code is entered

    negate_second

    outputs ON only if the wrong code is entered

    logical_nor

    outputs ON only if there is no motion AND the wrong code is entered

    logical_equality

    outputs ON only if there is motion AND the right code is entered, AND if there is no motion AND the wrong code is entered

    material_implication

    outputs OFF only if there is motion AND NOT the right code is entered.

  • hiring

    output

    strong option, strong fit

    strong option, weak fit

    weak option, strong fit

    weak option, weak fit

    operation

    REJECT

    REJECT

    REJECT

    REJECT

    REJECT

    contradiction

    strong option AND strong fit

    HIRE

    REJECT

    REJECT

    REJECT

    logical_conjunction

    strong fit

    HIRE

    REJECT

    HIRE

    REJECT

    project_second

    weak option AND strong fit

    REJECT

    REJECT

    HIRE

    REJECT

    converse_non_implication

    weak option

    REJECT

    REJECT

    HIRE

    HIRE

    negate_first

    NOT (strong option AND strong fit)

    REJECT

    HIRE

    HIRE

    HIRE

    logical_nand

    HIRE

    HIRE

    HIRE

    HIRE

    HIRE

    tautology

    strong option OR strong fit

    HIRE

    HIRE

    HIRE

    REJECT

    logical_disjunction

    (NOT (strong option AND strong fit)) AND (strong option OR strong fit)

    REJECT

    HIRE

    HIRE

    REJECT

    exclusive_disjunction

    strong option AND weak fit

    REJECT

    HIRE

    REJECT

    REJECT

    material_non_implication

    strong option

    HIRE

    HIRE

    REJECT

    REJECT

    project_first

    strong option OR weak fit

    HIRE

    HIRE

    REJECT

    HIRE

    converse_implication

    weak fit

    REJECT

    HIRE

    REJECT

    HIRE

    negate_second

    NOT (strong option OR strong fit)

    REJECT

    REJECT

    REJECT

    HIRE

    logical_nor

    (weak option OR strong fit) AND (strong option OR weak fit)

    HIRE

    REJECT

    REJECT

    HIRE

    logical_equality

    weak option OR strong fit

    HIRE

    REJECT

    HIRE

    HIRE

    material_implication

    I can say this in English as

    operation

    rule

    contradiction

    always REJECT

    logical_conjunction

    HIRE only if it is a strong option AND it is a strong fit

    project_second

    HIRE only if it is a strong fit, I do not care if it is a strong option or weak option

    converse_non_implication

    HIRE only if it is a weak option AND it is a strong fit

    negate_first

    HIRE only if it is a weak option, I do not care if it is a strong fit or weak fit

    logical_nand

    REJECT only if it is a strong option AND it is a strong fit

    tautology

    HIRE always, I do not care about the inputs

    logical_disjunction

    REJECT only if it is a weak option and NOT a strong fit

    exclusive_disjunction

    REJECT if it is a strong option AND it is a strong fit, OR if it is NOT a strong option AND NOT a strong fit

    material_non_implication

    HIRE only if it is a strong option AND NOT a strong fit

    project_first

    HIRE only if it is a strong option, I do not care if it is a strong fit or weak fit

    converse_implication

    REJECT only if it is a weak option AND it is a strong fit

    negate_second

    HIRE only if it is a weak fit, I do not care if it is a strong option or weak option

    logical_nor

    HIRE only if it is a weak option AND NOT a strong fit

    logical_equality

    HIRE only if it is a strong option AND it is a strong fit, AND if it is NOT a strong option AND NOT a strong fit

    material_implication

    REJECT only if it is a strong option AND NOT a strong fit

  • store discount policy

    output

    coupon, member

    coupon, NOT a member

    no coupon, member

    no coupon, NOT a member

    operation

    REGULAR PRICE

    REGULAR PRICE

    REGULAR PRICE

    REGULAR PRICE

    REGULAR PRICE

    contradiction

    coupon AND member

    DISCOUNT PRICE

    REGULAR PRICE

    REGULAR PRICE

    REGULAR PRICE

    logical_conjunction

    member

    DISCOUNT PRICE

    REGULAR PRICE

    DISCOUNT PRICE

    REGULAR PRICE

    project_second

    no coupon AND member

    REGULAR PRICE

    REGULAR PRICE

    DISCOUNT PRICE

    REGULAR PRICE

    converse_non_implication

    no coupon

    REGULAR PRICE

    REGULAR PRICE

    DISCOUNT PRICE

    DISCOUNT PRICE

    negate_first

    NOT (coupon AND member)

    REGULAR PRICE

    DISCOUNT PRICE

    DISCOUNT PRICE

    DISCOUNT PRICE

    logical_nand

    DISCOUNT PRICE

    DISCOUNT PRICE

    DISCOUNT PRICE

    DISCOUNT PRICE

    DISCOUNT PRICE

    tautology

    coupon OR member

    DISCOUNT PRICE

    DISCOUNT PRICE

    DISCOUNT PRICE

    REGULAR PRICE

    logical_disjunction

    (NOT (coupon AND member)) AND (coupon OR member)

    REGULAR PRICE

    DISCOUNT PRICE

    DISCOUNT PRICE

    REGULAR PRICE

    exclusive_disjunction

    coupon AND NOT a member

    REGULAR PRICE

    DISCOUNT PRICE

    REGULAR PRICE

    REGULAR PRICE

    material_non_implication

    coupon

    DISCOUNT PRICE

    DISCOUNT PRICE

    REGULAR PRICE

    REGULAR PRICE

    project_first

    coupon OR NOT a member

    DISCOUNT PRICE

    DISCOUNT PRICE

    REGULAR PRICE

    DISCOUNT PRICE

    converse_implication

    NOT a member

    REGULAR PRICE

    DISCOUNT PRICE

    REGULAR PRICE

    DISCOUNT PRICE

    negate_second

    NOT (coupon OR member)

    REGULAR PRICE

    REGULAR PRICE

    REGULAR PRICE

    DISCOUNT PRICE

    logical_nor

    (no coupon OR member) AND (coupon OR NOT a member)

    DISCOUNT PRICE

    REGULAR PRICE

    REGULAR PRICE

    DISCOUNT PRICE

    logical_equality

    no coupon OR member

    DISCOUNT PRICE

    REGULAR PRICE

    DISCOUNT PRICE

    DISCOUNT PRICE

    material_implication

    I can say this in English as

    operation

    rule

    contradiction

    REGULAR PRICE always

    logical_conjunction

    DISCOUNT PRICE only if the person has a coupon AND is a member

    project_second

    DISCOUNT PRICE only if the person is a member, I do not care if they have a coupon or no coupon

    converse_non_implication

    DISCOUNT PRICE only if the person does NOT have a coupon AND is a member

    negate_first

    DISCOUNT PRICE only if the person does NOT have a coupon, I do not care if it is a member or not

    logical_nand

    REGULAR PRICE only if the person has a coupon AND is a member

    tautology

    DISCOUNT PRICE always

    logical_disjunction

    REGULAR PRICE only if the person does NOT have a coupon AND is NOT a member

    exclusive_disjunction

    REGULAR PRICE if the person has a coupon AND is a member, OR if the person does NOT have a coupon AND is NOT a member

    material_non_implication

    DISCOUNT PRICE only if the person has a coupon AND is NOT a member

    project_first

    DISCOUNT PRICE only if the person has a coupon

    converse_implication

    REGULAR PRICE only if the person does NOT have a coupon AND is a member

    negate_second

    DISCOUNT PRICE only if the person is NOT a member, I do not care if they have a coupon or not

    logical_nor

    DISCOUNT PRICE only if the person does NOT have a coupon AND is NOT a member

    logical_equality

    DISCOUNT PRICE if the person has a coupon AND is a member, AND if the person does NOT have a coupon AND is NOT a member

    material_implication

    REGULAR PRICE if the person has a coupon AND NOT a member

  • watering plants

    output

    soil is dry, it rained

    soil is dry, NOT rain

    soil is wet, it rained

    soil is wet, NOT rain

    operation

    DO NOT WATER

    DO NOT WATER

    DO NOT WATER

    DO NOT WATER

    DO NOT WATER

    contradiction

    soil is dry AND it rained

    WATER

    DO NOT WATER

    DO NOT WATER

    DO NOT WATER

    logical_conjunction

    it rained

    WATER

    DO NOT WATER

    WATER

    DO NOT WATER

    project_second

    soil is wet AND it rained

    DO NOT WATER

    DO NOT WATER

    WATER

    DO NOT WATER

    converse_non_implication

    soil is wet

    DO NOT WATER

    DO NOT WATER

    WATER

    WATER

    negate_first

    NOT (soil is dry AND it rained)

    DO NOT WATER

    WATER

    WATER

    WATER

    logical_nand

    WATER

    WATER

    WATER

    WATER

    WATER

    tautology

    soil is dry OR it rained

    WATER

    WATER

    WATER

    DO NOT WATER

    logical_disjunction

    (NOT (soil is dry AND it rained)) AND (soil is dry OR it rained)

    DO NOT WATER

    WATER

    WATER

    DO NOT WATER

    exclusive_disjunction

    soil is dry AND NOT rain

    DO NOT WATER

    WATER

    DO NOT WATER

    DO NOT WATER

    material_non_implication

    soil is dry

    WATER

    WATER

    DO NOT WATER

    DO NOT WATER

    project_first

    soil is dry OR NOT rain

    WATER

    WATER

    DO NOT WATER

    WATER

    converse_implication

    NOT rain

    DO NOT WATER

    WATER

    DO NOT WATER

    WATER

    negate_second

    NOT (soil is dry OR it rained)

    DO NOT WATER

    DO NOT WATER

    DO NOT WATER

    WATER

    logical_nor

    (soil is wet OR it rained) AND (soil is dry OR NOT rain)

    WATER

    DO NOT WATER

    DO NOT WATER

    WATER

    logical_equality

    soil is wet OR it rained

    WATER

    DO NOT WATER

    WATER

    WATER

    material_implication

    I can say this in English as

    operation

    rule

    contradiction

    DO NOT WATER always

    logical_conjunction

    WATER only if the soil is dry AND it rained

    project_second

    WATER only if it rained, I do not care if the soil is dry or if the soil is wet

    converse_non_implication

    WATER only if the soil is wet AND it rained

    negate_first

    WATER only if the soil is wet, I do not care if it rained or did NOT rain

    logical_nand

    DO NOT WATER only if the soil is dry AND it rained

    tautology

    WATER always

    logical_disjunction

    DO NOT WATER only if the soil is wet AND it did NOT rain

    exclusive_disjunction

    DO NOT WATER if the soil is dry AND it rained, OR if the soil is wet AND it did NOT rain

    material_non_implication

    WATER only if the soil is dry AND it did NOT rain

    project_first

    WATER only if the soil is dry, I do not care if it rained or did NOT rain

    converse_implication

    DO NOT WATER only if the soil is wet AND it rained

    negate_second

    WATER only if it did NOT rain, I do not care if the soil is dry or if the soil is wet

    logical_nor

    WATER only if the soil is wet AND it did NOT rain

    logical_equality

    WATER if the soil is dry AND it rained, AND if the soil is wet AND it did NOT rain

    material_implication

    DO NOT WATER if the soil is dry AND it did NOT rain


what is next?

Would you like to test the truth table tests?


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.