# Propositions & Logical Operator Part 2

In the first part of the blog, we saw what propositions are and what we used them for.

In this blog, I would like to cover the rest of the propositions and how to use them in computer logic:

The Unary propositions take one atomic proposition and make a new one from it. You can translate this like the minus sign which take a positive number and transform it into a negative number. -3

The Binary operator takes two atomic propositions and creates a new one from it. You can translate this like the multiplication or division, for example between two numbers that transform these two number in a whole new value. 2*4 = 8

# The Not (unary) operator

· Logical ‘not.’

· Symbol ~

· Written ~A

· Alternative forms **¬A, ˜A,!A**

The Statement “A” must be false to result in true value. The not operator is expecting that the value of the proposition is false (not true); if you satisfy the criteria of not true, the result will be true. If the proportion instead is TRUE, and the expectation is a “not true” the value is not satisfied, and in this case, will be FALSE.

**TABLE:**

**The And operator**

· Logical ‘and.’

· Symbol ^

· Written A^B

· Alternative form A&B, A.B, AB

The **and-operator** is expecting that both propositions are TRUE to result in a TRUE value if one of the two or both has a truth value of FALSE the new proposition will be FALSE.

For example, you are going to a night club with a friend and bouncer require that you and your friend are over 18 to enter into the club. If one of you or both are not over 18, you cannot enter the club. In the same way, the machine is expecting that both propositions have a truth value of TRUE to result in a TRUE value otherwise will be FALSE.

**TABLE:**

# The Or operator

· Logical ‘or.’

· Symbol V

· Written A V B

· Alternative form A+B, A||B

The or operator is expecting that one of the two propositions have a TRUE value to be TRUE. If none of the propositions is TRUE will result in a FALSE value.

The same example as the club, imagine you and your friend after the club needs to drive back home and requires that one of the two are sober and not drunk to drive the car. If both are not drunk it is ok, and you can drive the car, if one of you is not drunk it is still possible to drive the car because it requires just one person to drive, but if both of you are drunk, you cannot drive the car.

**TABLE:**

# The If-Then operator

· Logical ‘if-then.’

· Symbol →

· Written A → B

· Alternative form A=>B, A ⊃ B

The if-then operator can result in a false value only if the first proposition, is TRUE and the second proposition is false, under any other condition, will result in a TRUE value, let see some examples:

A = **I drive drunk**

B= **I’ll get into a car accident.**

“If **I drive drunk** then **I’ll get into a car accident.”**

The first part A is called the ANTECEDENT, and the second part B is called the CONSEQUENT.

The conditional in this case is making an assertion but doesn’t assert that A is true or that B is true. It asserts a logical relationship between A and B, and the relationship say that if A is true, then B is true, and the only way to prove that is false if A is TRUE, but B is FALSE.

In this case, you are saying that **if you drive drunk, you then have an accident**. However, you can still have an accident without to be drunk because it does not state that if ONLY you are drunk you will get an accident, but you assert that in the combination of both conditions are TRUE you will have an accident. Same if both conditions are FALSE, the whole assertion will result in TRUE, because you did not drive drunk and you did not get an accident, so you don't have a proof that the assertion was wrong.

Example2:

“If** I miss the bus **then **I’ll be late for work.**”

In this case, you can be on time and do not miss the bus (FALSE), but doesn't imply the fact that you won't be late for work. In fact, the bus can be late can broke can get stuck in the traffic and you can arrive late anyway.

FALSE →TRUE = TRUE

In the second case, you can be on time and don't miss the bus(FALSE) and don't be late for work (FALSE). This time you could not prove that your assertion is FALSE and then will result in a TRUE value.

FALSE → FALSE = TRUE

The third case is the easy one, in which you missed the bus, and you were late for work. In this scenario, your assertion was right, and by missing the bus, you were late, and this result in a TRUE value.

TRUE → TRUE = TRUE

The last case is the most tricky one, let’s consider that you missed the bus (TRUE), but you were not in late for work (FALSE). In this case, your assertion that both conditions are TRUE combined is FASLE. In the first part you assuming that if you missed the bus is not a guarantee, you not saying only if I miss the bus. But in the second part you saying that if the first is true,** then** the second condition is TRUE. This case is proof that your assertion is false.

TRUE → FASLE = FALSE

**TABLE:**

# The If-and-only-If operator

· Logical ‘if and only if...’

· Symbol ← →

· Written A← →B

· Alternative form A<=>B, A ≡ B

The if-and only-if operator must have both propositions with the same symbol to result in a TRUE value. If one of the two propositions are different, this will result in a FALSE value.

Let say you and a friend need to go to the bathroom, to be able to access the same facility you both need to be either man or women. If you both are a man, you can go together in the same bathroom same if both are women. But if one of you have different gender, you cannot go in the same bathroom.

In this case, the condition to meet to be TRUE is either TRUE← → TRUE or FALSE← → FALSE.

**TABLE:**

# The XOR operator

· Logical ‘xor.’

· Symbol ⊕****

· Written A**⊕**B

The XOR operator has a TRUE value if one of the two propositions is true but not both.

It requires that A or B has different value either TRUE and FALSE or FALSE and TRUE, but if both are TRUE or both are FALSE will result is FALSE.

As an example, we can say that a day can be sunny or dark, but cannot be both or none of them. You require to have one of the two conditions but you cannot have both at the same time, for example, dark and sun or you cannot have any of them.

**TABLE**: