In the proposed work, the question of converting logical expressions will be considered in detail. In addition, we suggest you take a short course in logic, where the basic laws and concepts will be considered. Transformation of logical expressions is a rather difficult process if you do not familiarize yourself with all the nuances of the subject itself.
The computer science course will seem simple and give pleasure if you carefully read this article and familiarize yourself with the rules and laws of transformation, problem solving, and charting. We offer to start right now.
Science logic
The basics of logic is a rather complicated subject; a lot of volumes have been written on it. In this article, the basics and laws of the conversion of logical expressions will be considered, that is, the information will be as compressed and concentrated as possible. This is necessary to consider more meaningful computer technology and build circuits.
To begin with, what is logic and why is it needed? It is important to note that this is a whole science that considers the forms and methods of reasoning. Everything that we see, hear or do is subject to the laws. They threw the ball from above - it always flies down, as it obeys the laws of physics. We brew aromatic coffee in the morning, add sugar, and bulk solids instantly dissolve in water, obeying the laws of physics. We are talking with friends, sharing our plans: “If I protect my work well, I will get a red diploma”, “I will not be able to arrive by car, as it is being repaired.” Without noticing, we build all our conversations, relying on logic and its laws. So why do we need science logic? Of course, knowing its laws, you will be able to accurately determine the outcome of an event, since you do not have to act at random and take risks.
Although thinking is a rather complex process, it can nevertheless be divided into certain components, more precisely, forms (with the help of which the expression of thought occurs):
- concepts;
- utterances;
- inferences;
- proof of.
Further we suggest you to pass to logical functions and transformation of logical expressions. Computer science will turn out to be a fun and fairly simple subject for you if you carefully read this article.
Logical functions
Now we offer to get acquainted with logical functions. Often, in tickets for the unified state exam in Part B, there are tasks for converting logical expressions into numerical segments. They cannot be solved without knowledge of the functions of logic.
What is the main task of this science? Of course, the study of logical expressions (both complex and simple). How does a complex statement come about? By the merging of the simple, this is due to the connectives, which are usually called functions.
In total, five ligaments can be distinguished:
- inversion (that is, negation, using this function you can get a statement opposite to this: I go to the cinema today - I do not go to the cinema today);
- disjunction (this function is often called logical addition, in order to make it clear, we give a simple example from life: “if I have a headache or stomachache, I won’t go to school” - this expression will be true if at least one of the requirements is taken into account );
- conjunction (often called logical multiplication: “if I wash the dishes and do my homework, I’ll go for a walk with friends” - this expression will be true if two conditions are taken into account);
- implication (in logic, this function is called follow-up, unfortunately, it cannot be illustrated by a life situation; a false function will be if you wanted to do something but failed, in other cases the function will be true);
- equivalence (or equality, if two statements are true or false, then we get the truth as a result).
It is important to note that in computer science any simple expression is indicated by the capital letter of the Latin alphabet. Next, you must remember the truth table for each function. Please note that it is not necessary to memorize it, only understanding the functions will be enough.
Truth tables
Conjunction
The first expression (A) | The second expression (B) | Result (C) |
L | L | L |
AND | L | L |
L | AND | L |
AND | AND | AND |
Disjunction
A | IN | WITH |
L | L | L |
AND | L | AND |
L | AND | AND |
AND | AND | AND |
Inversion
Implication
A | IN | WITH |
L | L | AND |
AND | L | L |
L | AND | AND |
AND | AND | AND |
Equivalent
A | IN | WITH |
L | L | AND |
AND | L | L |
L | AND | L |
AND | AND | AND |
In addition, it is important to note the fact that a lie in logic is denoted by the number 0, and a true expression by the number 1. For your convenience, you can use the plus and minus signs. Please note that the false and true expressions in the proposed tables are indicated by the letters "L" and "And", respectively.
Building
Before proceeding with the transformation of logical expressions, you need to get acquainted with their construction. Any compound or, as was said before, complex expression consists of two parts:
- variables that are indicated by capital letters of the Latin alphabet;
- signs that denote a function and connect simple expressions with each other.
How to make an expression in the language of algebra of logic? To do this, you need to do a few things:
- divide the entire statement into simple expressions;
- mark these elements with letters;
- highlight the links between simple expressions;
- write the resulting expression using special symbols of the algebra of logic.
We suggest considering a simple example: (Z * F = 5 or Z * F = 4) And (Z * F is not equal to 5 or Z * F is not equal to 4). It is necessary to substitute 2. for variables. After this we get the expression (4 = 5 or 4 = 4) and (4 is not equal to 5 or 4 is not equal to 4). After the operations, we must highlight the expressions and the relationships between them, it should turn out as follows: (Z or F) and (not Z or not F). After that, we need to transform this record by substituting the meaning of the statements. In that case, if the expression is true, then you must substitute 1, otherwise - 0. We get: G = 1 and 1. After the necessary calculations, we get the result: G = 1, that is, the complex expression is true.
The laws
Now we suggest you consider the laws of logic and the rules for converting logical expressions. It is important to mention that any logical expression can be transformed into another using the laws of logic. Now we will consider in detail all ten rules.
The first on our list is the "law of double negation." That is, the expression “not (not A)” will be equal to the expression “A”.
There is a communicative law in mathematics, it is quite easy to remember. A + B = B + A, A * B = B * A.
The combination law is (D + E) + F = (D + F) + E, the same law applies to logical multiplication.
Distributive law is an elementary opening of brackets. Example: (A + B) * C = (A * C) + (B * C).
De Morgan's law: not (A + B) = not A * not B, not (A * B) = not A + not B, Aimplication B = not A + B, not (Aimplication B) = A * notB.
Idempotency: X + X = X or C * C = C.
Exclusion of constants: X + 1 = 1, X + 0 = X; X * 1 = X, X * 0 = 0.
Next we highlight the law of contradiction, following it, we can state the following equality: B * not B = 0.
In logic, there is a law of absorption, which in practice looks like this: C + (C * D) = C or C * (C + D) = C.
It is also important for the transformation of logical expressions to remember the law of exclusion: (C * E) + (not C * E) = E or (C + E) * (not C + E) = E.
If you carefully consider and remember all the laws presented in this section, then there will never be problems with the conversion. No less important is the order in which functions are performed. Pay more attention to this item, the correct distribution of the order of functions is the key to the correct solution to the problem.
Rules and laws of transformation and simplification, procedure for performing actions with examples
Logical laws and rules for transforming logical expressions are very simple to remember. If you doubt the veracity of at least one of them, then check it yourself. To do this, you need to spend 10 minutes of your time and compile truth tables to get an answer.
Now we propose to consider the logical laws and rules for converting logical expressions using specific examples. This is necessary in order to properly consolidate the knowledge gained. Pay particular attention to the sequence of actions.
We are given: C + (not C * E). Need to simplify the expression. First of all, we suggest opening the brackets. Then we get the expression: (C + nonC) * (C + E). We note right away that the logical addition of two opposing statements gives us the truth. What we get in the end: 1 * (C + E). Again, open the brackets: (1 * C) + (1 + E). Now once again we recall the laws and get the answer: C + E.
As you have already seen, everything is quite simple. To solve such problems, it is necessary to remember the laws that were listed in the last section. We suggest moving on to solving logical problems, since this task is already a little more complicated than the previous one.
Problem solving
We got acquainted with the basics of science called “logic”, we briefly examined the transformation of logical expressions, and listed the laws. The most difficult tasks with the preparation of logical expressions are tasks. It is important to note that they can be solved using reasoning, expression conversion, or a tabular method. We propose to consider one of them in detail.
Three boys (Cyril, Anton and Kostya) were in the same room. Suddenly, a mother from the kitchen hears the sound of a broken cup. I ran to my sons and asked: "Who did this?" The answer was as follows: Cyril said that it was not Kostya who broke the cup, but Anton; Anton said that Kostya did this, not Cyril; Kostya claims that Anton is not the culprit. We know that one of the boys told a lie to mom. We need to find out who broke the cup.
Logically, the answers of Cyril and Anton contradict each other, just like Cyril and Kostya. Therefore, they cannot be both true. We make the following conclusion - Anton and Kostya told the truth, and Cyril is the culprit of the broken cup. This was the method of reflection applied. Now we’ll look at the solution to the same problem, only using the expression conversion method. First, we introduce the abbreviations:
- - the cup is broken by Cyril;
- A - the cup is broken by Anton;
- K is the culprit Kostya.
Boys Answers:
- Cyril - notK, A;
- Anton - not KK, K;
- Kostya is not A.
We propose to make an expression if Kostya lied, and Cyril and Anton told the truth: not K * A = 1 and K * not KP = 1 and A = 1. Transforming the expression, we get a contradiction: 0 = 1. Our assumption is incorrect, it is worth checking other assumptions.
If we assume that Cyril lied, and Anton and Kostya told the mother the truth, then we get the following expression: K * notA = 1 and K * notKR = 1 and notA = 1. Simplifying the expression, we get KP * notA * notK = 1. This suggests that our assumption was true, indeed, Cyril broke the cup and lied to mom.
Tabular Method of Solution
The considered laws of logic and the transformation of logical expressions certainly helped us cope with the task that was presented in the previous section. Now we propose to consider the tabular method for solving the following problem.
Dmitry, Anatoly and Lyudmila are fans of mail correspondence, we know that everyone lives in different parts of the world and have different hobbies. Determine who lives in which city and what is fond of. The following facts are known:
- Dmitry has never been to Paris, and Lyudmila - to Rome;
- one who lives in Paris does not like cinema;
- a person who lives in Rome is engaged in vocals;
- Lyudmila is disgusted with ballet.
In order to solve the problem, you need to make a small table.
France | Italy | USA | | Vocals | Ballet | Movie |
| | | Dmitry | | | |
| | | Anatoly | | | |
| | | Lyudmila | | | |
Further, maximum attention is required from you. Everything that you read in the condition should be reflected in this table. As the filling progresses, the following will become clear:
- Dmitry lives in Rome and is engaged in vocals;
- Anatoly lives in Paris and often attends ballet;
- Lyudmila is a big fan of cinema, who lives in the United States.
Pay once again your attention to the fact that the true expression is marked with the number 1, and the false - 0. Filling the table with these symbols, you will quickly find the answer to the question that interests you.
Microchip
The examples of transforming logical expressions that we examined are rather complicated at first glance. In tickets for the unified state exam, the condition can be completely given in the form of a microcircuit.
It is important to know that all digital devices are based on logical elements, that is, certain devices that perform one logical function.
We have already talked about such a function as conjunction (logical multiplication). It is customary to designate the symbol &. This function is necessary for conjunction of several values. In the picture you see the logical multiplication scheme.
The disjunction function is necessary to implement the disjunction of some input values. When writing an expression, this function is usually denoted by the symbol Ú. The picture is a diagram.
The inversion function is a converter of one expression to the opposite. In the figure you see how the “not” circuit looks.
An example of simplification of the formula No. 1
The considered rules for converting logical expressions must be consolidated in practice. In pursuit of this goal, we propose to solve independently two examples of medium complexity and compare them with the results in this section of the article.
If you have not had time to remember the formulas for transforming logical expressions, you can make yourself a little “reminder”. You will see that soon you will not peek at it.
Example: (X + T) * (neX + T) * (M + notT). Do not blindly write off, try to solve the example yourself.
In the course of simplification, we obtain the following entries: T * (M + notT) = (T * M) + (T * notT) = (T * notM) + 0 = (T + 0) * (M + 0) = T * M.
As you can see, from a rather long and cumbersome complex expression, we got a short T * M. If you did not manage to solve this example yourself, then refer again to the point where we examined the conversion of logical expressions, tasks.
An example of simplification of the formula No. 2
In this section, we suggest that you simplify the expression (E + H) * (E + K). We will analyze the solution in stages. First of all, we need to open the brackets, remember the course in basic mathematics. As a result, we obtain the following expression: E * E + E * K + H * E + H * K. Further, we notice that in the resulting expression there is a part E * E, recall the law of idempotency and transform the notation: E + E * K + H * E + H * K. The next step is to transform the part E + E * K, using the bracket of the variable E and the property: A + 1 = 1. We get the expression: E + H * E + H * K. We follow the same procedure as the last paragraph and bracket E. As a result, we get the answer: E + H * K.
Pay attention to the fact that the tasks only seem complicated at first glance. To “click them like seeds”, you just need to learn the basic laws of logic.