Simple logical operations

A very important applied value for computer science is simple logical operations, used in the development of program algorithms. Simple logical operations are used when talking about statements - narrative sentences about which they can be said to be true (denoted by 0) or false (denoted by 1) (the third is not given). For example, saying A: "twice two is four" is true (A = 1), and statement B: "three is more than five" is a lie (B = 0).

A very important applied value for computer science is simple logical operations, used in the development of program algorithms

Simple logical operations of negation, conjunction, disjunction, implication, equivalence are especially necessary for constructing other complex statements. The operation of negation A is the saying -A (say not A), which is true when A is false, and vice versa. For example, if A is that "tomorrow it will snow", then -A "tomorrow there will be no snow", the truth of one statement automatically means the falsity of the second. This rule can be written in the form of a so-called truth table:

A -A
0 1
1 0

If A is "the height of the cabinet is less than the height of the door", and B is the "cabinet width is less than the width of the door", then, indicating event C, the cabinet can be inserted into the door if the cabinet width is less than the door width And the cabinet height is less than the door height", we come to the operation of the conjunction (logical multiplication). That is, C = 1 only when A and B are true and C = A&B (say C is equal to A and B). The truth table of this operation has the form:

A B C
0 0 0
0 1 0
1 0 0
1 1 1

Simple logical operations include disjunction - the logical addition of A and B, which is true if at least one statement is true. Say C is equal to A or B. For example, if A is that "the student can get home on the bus", and B "the student can get home on the trolleybus, C "the student got home on the bus OR a trolley bus". For this operation, you can write the following table:

A B C
0 0 0
0 1 1
1 0 1
1 1 1

Implication and the equivalent also come in simple logical operations. The implication A and B is C, which is false only if A is true, and B is false and C = A→B (say: from A follows B). For example, "if it's raining, then there are clouds in the sky". The converse is "not always the clouds, it's raining" is not always true. For the implication, the following table can be made:

A B C
0 0 1
0 1 1
1 0 0
1 1 1

Equivalence A and B is C, which is equal to one only when A and B have the same truth values and C = A↔B is written. The truth table in this case looks like this:

A B C
0 0 1
0 1 0
1 0 0
1 1 1

Tools