EducationSecondary education and schools

Informatics: truth table. Building truth tables

Today we will talk about a subject called computer science. The table of truth, varieties of functions, the order of their implementation are our main questions, which we will try to find answers in the article.

Usually this course is taught in high school, but a large number of students is a cause of misunderstanding of some features. And if you are going to devote your life to it, then you can not do without putting the unified state exam in computer science. A table of truth, the transformation of complex expressions, the solution of logical problems - this can all happen in the ticket. Now we will look more closely at this topic and help you to score more points on the USE.

Subject of Logic

What kind of thing is computer science? Table of truth - how to build it? Why do we need the science of logic? We will answer all of these questions with you.

Informatics is a fascinating subject. He can not cause difficulties for modern society, because everything that surrounds us, one way or another, refers to the computer.

The fundamentals of the science of logic are given by secondary school teachers in computer science lessons. Tables of truth, functions, simplification of expressions - all this should be explained by the teacher of computer science. This science is simply necessary in our life. Look, everything obeys any laws. You threw the ball up, it flew up, but after that fell back to the ground, it happened because of the laws of physics and the force of gravity. Mom cooks soup and adds salt. Why do not we get grains when we eat it? It's simple, the salt dissolved in the water, obeying the laws of chemistry.

Now pay attention to how you talk.

  • "If I take my cat to a veterinary clinic, he will be vaccinated."
  • "Today was a very difficult day, because verification came."
  • "I do not want to go to university, because today there will be a colloquium" and so on.

Everything that you say, necessarily obeys the laws of logic. This applies both to business and to a friendly conversation. It is for this reason that it is necessary to understand the laws of logic so as not to act randomly, but to be confident in the outcome of events.

Functions

In order to compile a truth table to the problem proposed to you, you need to know the logical functions. What it is? A logical function has some variables that are statements (true or false), and the very value of the function must give us the answer to the question: "Is the expression true or false?".

All expressions take the following values:

  • Truth or lie.
  • And or L.
  • 1 or 0.
  • Plus or minus.

Here, give preference to the method that is more convenient for you. In order to compile a truth table, we need to enumerate all combinations of variables. Their number is calculated by the formula: 2 to the power of n. The result of the calculation is the number of possible combinations, the variable n in this formula denotes the number of variables in the condition. If the expression has many variables, then you can use a calculator or make for yourself a small table with the construction of a deuce to the power.

In total, in logic, there are seven functions or links that connect expressions:

  • Multiplication (conjunction).
  • Addition (disjunction).
  • Consequence (implication).
  • Equivalence.
  • Inversion.
  • Bar of Schaeffer.
  • Arrow Pierce.

The first operation, presented in the list, has the name "logical multiplication". It can be marked graphically in the form of an inverted check mark, with the & or *. The second operation in our list is a logical addition, it is indicated graphically in the form of a tick, +. Implication is called a logical consequence, is denoted by an arrow indicating the condition for the effect. The equivalence is denoted by a double-sided arrow, the function has a true value only in cases where both values take either "1" or "0". Inversion is called logical negation. The Schaeffer bar is called a function that negates a conjunction, and the Pearce arrow is a function that rejects a disjunction.

Basic binary functions

The truth table helps to find the answer in the task, but for this it is necessary to remember the tables of binary functions. In this section they will be provided.

Conjunction (multiplication). If two expressions are true, then the result is true, in all other cases we get a lie.

+

+

+

+

-

-

-

+

-

-

-

-

As the table looks, you learned, then there is no need to bring it to all formulas. In the picture above you can see in which cases the result is equal to one.

The result - a lie with logical addition, we have only in the case of two false input data.

A logical consequence has a false result only when the condition is true, and the consequence is false. Here you can give an example from life: "I wanted to buy sugar, but the store was closed," therefore, sugar was never purchased.

Equivalence is true only in cases of identical values of the input data. That is, for pairs: "0; 0" or "1; 1".

In the case of inversion, everything is elementary, if there is a true expression at the input, then it is converted to false, and vice versa. The picture shows how it is indicated graphically.

The Schiffer bar will have a false result at the output only if there are two true expressions.

In the case of Pearce's arrow, the function will be true only if we have only false expressions at the input.

In what order to perform logical operations

Note that the construction of truth tables and simplification of expressions is possible only if the order of operations is correct. Remember, in what order they should be carried out, it is very important to get the right result.

  • Logical negation;
  • multiplication;
  • addition;
  • Consequence;
  • An equivalent;
  • The negation of multiplication (Sheffer's prime);
  • The negation of addition (arrow Peirce).

Example №1

Now we propose to consider an example of constructing a truth table for 4 variables. It is necessary to know in which cases F = 0 for the equation: notA + B + C * D

A

AT

FROM

D

NotA

C * D

F

-

-

-

-

+

-

+

-

-

-

+

+

-

+

-

-

+

-

+

-

+

-

-

+

+

+

+

+

-

+

-

-

+

-

+

-

+

-

+

+

-

+

-

+

+

-

+

-

+

-

+

+

+

+

+

+

+

-

-

-

-

-

-

+

-

-

+

-

-

-

+

-

+

-

-

-

-

+

-

+

+

-

+

+

+

+

-

-

-

-

+

+

+

-

+

-

-

+

+

+

+

-

-

-

+

+

+

+

+

-

+

+

The answer to this task will be the enumeration of the following combinations: "1; 0; 0; 0"; "1; 0; 0; 1" and "1; 0; 1; 0". As you can see, it's quite easy to make a truth table. Once again I want to draw your attention to the order of the actions. In the concrete case, he was the following:

  1. Inversion of the first simple expression.
  2. Conjunction of the third and fourth expressions.
  3. Disjunction of the second expression with the results of previous calculations.

Example №2

Now we will consider one more task that requires the construction of a truth table. Informatics (examples were taken from the school course) can have logical tasks as tasks. Briefly consider one of them. Was Vanya guilty of stealing the ball if the following is known:

  • If Vanya did not steal or Petya stole, then Seryozha took part in the theft.
  • If Vanya is not guilty, then Sergei did not steal the ball.

Let us introduce the notation: - Vanya stole the ball; P stole Petya; C - Seryozha stole.

According to this condition, we can form the equation: F = ((non + Π) implication C) * (not the implication not). We need those options where the function takes on a true value. Next, we need to create a table, since this function has as many as 7 actions, then we omit them. We will only input the input and the result.

AND

P

FROM

F

-

-

-

-

-

-

+

-

-

+

-

-

-

+

+

-

+

-

-

+

+

-

+

+

+

+

-

-

+

+

+

+

Note that in this task we used plus and minus instead of the signs "0" and "1". This is also acceptable. We are interested in combinations where F = +. Analyzing them, we can draw the following conclusion: Vanya participated in the theft of the ball, since in all cases where F takes the value +, AND has a positive value.

Example №3

Now we suggest you find the number of combinations when F = 1. The equation has the following form: F = neA + B * A + neB. We compile the truth table:

A

AT

NotA

Not

B * A

F

L

L

AND

AND

L

AND

L

AND

AND

L

L

AND

AND

L

L

AND

L

AND

AND

AND

L

L

AND

AND

Answer: 4 combinations.

Similar articles

 

 

 

 

Trending Now

 

 

 

 

Newest

Copyright © 2018 en.delachieve.com. Theme powered by WordPress.