Presentation on the topic of logical operations in computer science. Presentation of logical operations on statements. I. Organizational moment

  • 16.11.2019

slide 2

History of logic

Logic is the science of the forms of correct thinking (reasoning). The term comes from the Greek word logos, which means reasoning. Logic is an ancient science that appeared around the 4th century AD. In the East, logic developed in China and India. In Europe, the development of logic comes from Ancient Greece.

slide 3

The Greek philosopher Aristotle is considered to be the founder of logic. Aristotle was the first to systematize the available knowledge about logic, substantiate the forms and rules of logical thinking. He described the results of his research in a series of essays under the general title "Organon"

slide 4

Arguing about something, a person produces statements (judgments). A proposition is a statement that can either be true or false. Example: 1) It's raining outside. 2) The Moon is a satellite of the Earth. The examples given are simple statements. Compound statements are made up of simple statements connected by logical connectives: “and”, “or”, “not”, etc.

slide 5

Inference is the process of obtaining a new statement as a result of the analysis of these statements.

slide 6

In the 19th century, a new branch appeared in mathematical science - the algebra of logic. The algebra of logic operates on logical values, which can take only two values: true or false.

Slide 7

George Boole was the first to apply algebraic methods to solve traditional logical problems, which had previously been solved by reasoning methods, according to Aristotle's logic. In the algebra of logic, logical quantities are denoted by letters: a, b, x, etc.

Slide 8

Boolean operations

  • Slide 9

    Slide 10

    Example: Chess

    There are 4 friends: Anton, Victor, Semyon and Dmitry. Regarding their ability to play chess, the following statements are true: Semyon plays chess If Viktor does not play chess, then Semyon and Dmitry play If Anton or Viktor plays, then Semyon does not play. Let us transform these statements to the algebraic form. We introduce logical variables to represent four simple statements: A = "Anton plays chess" B = "Victor plays chess" C= "Semyon plays chess" D = "Dmitry plays chess"

    1 slide

    Examples of strict and non-strict disjunctions: MOU Secondary School No. 19 "Vybor", Nakhodka Statement Type of disjunction Vitya is sitting on the northern or eastern tribune of the stadium Strict Student rides a train or reads a book Non-strict Olya likes to write compositions or solve logical problems graduated from it Strict Tomorrow it will rain or not (the third is not given) Strict Let's fight for cleanliness. Cleanliness is achieved in this way: either do not litter, or clean up often Non-strict Earth moves in a circular or elliptical orbit Strict Numbers can be added or multiplied Non-strict MOU Secondary School No. 19 "Vybor", Nakhodka

    2 slide

    is formed by combining two statements into one using the union "or". The union "or" can be used: in a non-exclusive (unifying) sense - the operation is called a non-strict disjunction; in the exclusive (separating) sense - the operation is called strict disjunction. MOU secondary school No. 19 "Vybor", Nakhodka MOU secondary school No. 19 "Vybor", Nakhodka

    3 slide

    Graphical illustration of the conjunction using Euler-Venn diagrams: A - many excellent students in the class; B - set of sportsmen in a class; A B - many excellent students involved in sports. MOU secondary school No. 19 "Vybor", Nakhodka B A MOU secondary school No. 19 "Vybor", Nakhodka

    4 slide

    The truth table of the conjunction: MOU secondary school No. 19 "Choice", Nakhodka The conjunction of two statements is true if and only if both statements are true, and false when at least one statement is false. A B A ۸ B 0 0 0 0 1 0 1 0 0 1 1 1 School № 19 "Vybor", Nakhodka

    5 slide

    It is formed by combining two statements into one using the union "and". Conjunction notation: A AND B; A ۸ B; A&B; A B; A AND B. MOU secondary school No. 19 "Vybor", Nakhodka A \u003d "10 is divisible by 2" B \u003d "10 is divisible by 5", A ۸ B \u003d "10 is divisible by 2 and 5". MOU secondary school No. 19 "Choice", Nakhodka

    6 slide

    Graphical illustration of inversion using Euler-Venn diagrams: A - many excellent students; Ā - set of non-excellent people. MOU secondary school No. 19 "Vybor", Nakhodka A Ā MOU secondary school No. 19 "Vybor", Nakhodka

    7 slide

    The truth of a statement that has the form Ā (regardless of its content) is determined by a special truth table. Inversion truth table (not A): MOU secondary school No. 19 "Choice", Nakhodka Logical negation (inversion) makes a true statement false and, conversely, a false one - true. A Ā 0 1 1 0 MOU secondary school No. 19 "Vybor", Nakhodka

    8 slide

    It is formed from a statement by adding the particle "not" to the predicate or using the figure of speech "it is not true that ...". Inversion designation: NOT A; ¬A; a; NOT A. MOU SOSH № 19 "Vybor", Nakhodka A = It won't rain Ā = It's not true that it won't rain. (It will rain.) MOU secondary school No. 19 "Choice", Nakhodka

    9 slide

    A method of constructing a complex statement from given statements, in which the truth value of the complex statement is completely determined by the truth values ​​of the original statements. A true statement in logic is denoted by - 1, a false one - 0. Statements are denoted by letters of the Latin alphabet: A, B, C, etc. MOU secondary school No. 19 "Vybor", Nakhodka MOU secondary school No. 19 "Vybor", Nakhodka

    10 slide

    Logical negation (inversion) Logical multiplication (conjunction) Logical addition (disjunction) Logical consequence (implication) Logical equality (equivalence)

    11 slide

    is formed by combining two statements into one using the figure of speech "... if and only if ...". Equivalence notation: A B; A B; A ~ B. School № 19 "Vybor", Nakhodka An angle is called right if and only if it is equal to 90°. The head thinks when and only when the tongue is at rest. MOU secondary school No. 19 "Choice", Nakhodka

    12 slide

    Graphic illustration of the implication using Euler-Venn diagrams: (A=0) (B=0) (A=0) (B=1) (A=1) (B=1) School № 19 "Choice", Nakhodka B A MOU secondary school No. 19 "Choice", Nakhodka

    13 slide

    Implication truth table: MOU secondary school No. 19 "Choice", Nakhodka The implication of two statements is false if and only if a false statement follows from a true statement (From truth a lie cannot follow). A B A B 0 0 1 0 1 1 1 0 0 1 1 1

    14 slide

    is formed by combining two statements into one using the figure of speech "if ..., then ...". Implication notation: A B; A B. MOU secondary school № 19 "Vybor", Nakhodka E = If an oath is given, then it must be fulfilled. P = If the number is divisible by 9, then it is divisible by 3. MOU secondary school No. 19 "Choice", Nakhodka

    15 slide

    Graphical illustration of the disjunction using Euler-Venn diagrams: A - many excellent students in the class; B - set of sportsmen in a class; A B is the set of class students who are excellent students or athletes. MOU secondary school No. 19 "Vybor", Nakhodka B A MOU secondary school No. 19 "Vybor", Nakhodka

    CONJUNCTION F = A & B. F = A & B. Boolean multiplication The logical multiplication CONJUNCTION is a new complex expression that will be true only if both original simple expressions are true. CONJUNCTION - This new compound expression will only be true if both of the original simple expressions are true. A conjunction defines the joining of two logical expressions using the conjunction AND. A conjunction defines the joining of two logical expressions using the conjunction AND. ABF


    Examples: 10 is divisible by 2 and 5 is greater than 3 10 is divisible by 2 and 5 is greater than 3 10 is not divisible by 2 and 5 is greater than 3 10 is not divisible by 2 and 5 is greater than 3 10 is divisible by 2 and 5 is not greater than 3 10 is divisible by 2 and 5 is not more than 3 10 is not divisible by 2 and 5 is not more than 3 10 is not divisible by 2 and 5 is not more than 3 F=A&B F=A&B Task: Determine what the value of F will be for each expression. Task: Determine what the value of F will be for each expression.


    DISJUNCTION F = A + B F = A + B Logical addition - DISJUNCTION - this new complex expression will be true if and only if at least one of the original (simple) expressions is true. Logical addition - DISJUNCTION - this new complex expression will be true if and only if at least one of the original (simple) expressions is true. A disjunction defines the joining of two logical expressions using the union OR A disjunction defines the joining of two logical expressions using the union OR ABF


    Examples: 10 is divisible by 2 or 5 is greater than 3 10 is divisible by 2 or 5 is greater than 3 10 is not divisible by 2 or 5 is greater than 3 10 is not divisible by 2 or 5 is greater than 3 10 is divisible by 2 or 5 is not greater than 3 10 is divisible by 2 or 5 not more than 3 10 not divisible by 2 or 5 not more than 3 10 not divisible by 2 or 5 not more than 3 F=A V B Task: Determine what the value of F will be for each expression. Task: Determine what the value of F will be for each expression.


    INVERSION Logical negation: INVERSION - if the original expression is true, then the result of the negation will be false, and vice versa, if the original expression is false, then the result of the negation will be true / Logical negation: INVERSION - if the original expression is true, then the result of the negation will be false, and vice versa, if the original expression is false, then the result of the negation will be true / This operation means that the particle NOT or the word INCORRECT is added to the original logical expression, WHAT This operation means that the particle NOT or the word WRONG is added to the original logical expression, THAT A _ _ F = A 10 01




    Logical implication (implication) Logical implication (implication) is formed by combining two statements into one using the union "if ... then ...". Logical consequence (Implication) is formed by combining two statements into one using the union "if ... then ...". The implication is written as a premise of the consequence; (the tip always points to the consequence). The implication is written as a premise of the consequence; (the tip always points to the consequence). F = A B, compound statement formed by the operation: logical consequence (implication) F = A B, compound statement formed by the operation: logical consequence (implication) The judgment expressed by the implication is also expressed in the following ways: The judgment expressed by the implication is expressed also in the following ways: Judgment 1. The premise is a sufficient condition for the conclusion to be fulfilled; 1. The premise is a condition sufficient for the conclusion to be true; condition 2. The consequence is a condition necessary for the truth of the premise. 2. The consequence is a condition necessary for the truth of the premise.


    The "everyday" meaning of the implication. For an easier understanding of the meaning of the implication and memorizing its truth table, an everyday model may be useful: For an easier understanding of the meaning of the implication and memorizing its truth table, an everyday model may be useful: A boss. He can order "work" (1) or say "do whatever you want" (0). And the boss. He can order "work" (1) or say "do whatever you want" (0). In a subordinate. It can work (1) or idle (0). In a subordinate. It can work (1) or idle (0). In this case, the implication is nothing but the obedience of a subordinate to a superior. In this case, the implication is nothing but the obedience of a subordinate to a superior. According to the truth table, it is easy to check that there is no obedience only when the boss orders to work, and the subordinate is idle. According to the truth table, it is easy to check that there is no obedience only when the boss orders to work, and the subordinate is idle.


    IMPLICATION Logical implication: IMPLICATION - connects two simple logical expressions, of which the first is a condition (A), and the second (B) is a consequence of this condition. Logical consequence: IMPLICATION - connects two simple logical expressions, of which the first is a condition (A), and the second (B) is a consequence of this condition. The result of IMPLICATION is FALSE only when condition A is true and consequence B is false. The result of IMPLICATION is FALSE only when condition A is true and consequence B is false. Denoted by A B with the symbol "therefore" and Denoted by A B with the symbol "therefore" and expressed by the words IF ... THEN ... expressed by the words IF ... THEN ... ABF


    Examples: If the given quadrilateral is a square, then a circle can be circumscribed around it If the given quadrilateral is a square, then a circle can be circumscribed about it If the given quadrilateral is not a square, then a circle can be circumscribed about it a quadrilateral is a square, then a circle cannot be circumscribed around it If the given quadrangle is a square, then a circle cannot be circumscribed around it If the given quadrilateral is not a square, then a circle cannot be circumscribed around it If the given quadrangle is not a square, then a circle cannot be circumscribed around it A B A B Task: Determine what will be equal to the value of F for each expression. Task: Determine what the value of F will be for each expression.


    The order of execution of logical operations 1. inversion 1. inversion 2. conjunction 2. conjunction 3. disjunction 3. disjunction 4. implication 4. implication Parentheses are used to change the specified order of operations. Parentheses are used to change the specified order of operations.


    Task 1 example: The symbol F denotes one of the following logical expressions from three arguments: X, Y, Z. The symbol F denotes one of the following logical expressions from three arguments: X, Y, Z. A fragment of the truth table of the expression F is given: Given fragment of the truth table of the expression F: XYZF) ¬X ¬Y ¬Z 2) X Y Z3) X Y Z 4) ¬X ¬Y ¬Z Which expression corresponds to F? What expression corresponds to F?


    Solution: for each line, you need to substitute the given X, Y and Z values ​​into all the functions given in the answers, and compare the results with the corresponding F values ​​for this data, you need to substitute the given X, Y and Z values ​​for each line into all the functions given in answers, and compare the results with the corresponding F values ​​for these data, if for any combination of X, Y and Z the result does not match the corresponding F value, the remaining rows can be ignored, since for a correct answer all three results must match the values ​​of the F function if for some combination of X, Y and Z the result does not match the corresponding value of F, the remaining rows can be ignored, since for the correct answer all three results must match the values ​​of the function F


    First expression, only equals 1 when X=Y=Z=0, so it's a wrong answer (the first row of the table doesn't work) matches) the second expression, equals 1 only when X=Y=Z=1, so this is an incorrect answer (the first and second rows of the table do not match) the second expression, equals 1 only when X=Y=Z=1, so this is an incorrect answer ( the first and second rows of the table do not match) the third expression, equals zero at X=Y=Z=0, so this is an incorrect answer (the second row of the table does not match) the third expression, equals zero at X=Y=Z=0, so this is incorrect answer (the second row of the table is not suitable) finally, the fourth expression, is equal to zero only when X=Y=Z=1, and in other cases it is equal to 1, which coincides with the given part of the truth table; finally, the fourth expression, is equal to zero only if , when X=Y=Z=1, and in other cases it is equal to 1, which coincides with the given part of the truth table, thus, the correct the answer is 4 so the correct answer is 4 XYZF) ¬X ¬Y ¬Z 2) X Y Z 3) X Y Z 4) ¬X ¬Y ¬Z


    Example task 2: The symbol F denotes one of the following logical expressions from three arguments: X, Y, Z. The symbol F denotes one of the following logical expressions from three arguments: X, Y, Z. A fragment of the truth table of the expression F is given: Given fragment of the truth table of the expression F: XYZF Which expression corresponds to F? 1) ¬X ¬Y ¬Z 2) X Y Z3) X ¬Y ¬Z4) X ¬Y ¬Z


    Solution: There is only one 1 in column F for the combination X=1, Y=Z=0, simplest function, true (only) for this case, has the form, it is among the given answers (answer 3) In column F there is a single unit for the combination X=1, Y=Z=0, the simplest function, true (only) for this case, has the form, it is among the given answers (answer 3) thus, the correct answer is 3. thus, the correct answer is 3.


    Example task 3: A fragment of the truth table of the expression F is given (see the table on the right). A fragment of the truth table of the expression F is given (see the table on the right). What expression corresponds to F? What expression corresponds to F? XYZF) (X ¬Y) Z 2) (X Y) ¬Z 3) X (¬Y Z)4) X Y ¬Z



    Boolean operations AND AND OR


    propositional logic allows you to build composite statements. They are created from several simple statements by connecting them with each other using logical operations. NOT , And , OR and etc.


    Boolean operation And

    The determination of the truth or falsity of a compound statement depends on whether the simple statements included in its composition are true or false, as well as on the logical operation that connects them.


    Boolean operation And

    Compound statement BUT And AT , formed by combining two simple statements BUT and B logical operation And, is true if and only if BUT and AT true at the same time.


    Boolean operation And

    Example 1:

    Let's analyze the statement "The number 456 is three-digit and even."

    This sentence is compound because it contains two simple sentences:

    "The number 456 is three-digit"(statement BUT) and "The number 456 is even"(statement AT).

    sayings BUT and AT connected together by a logical operation And, resulting in a compound statement

    BUT And b. statement BUT true, statement AT true. Therefore the statement BUT And B true: (BUT And B) = 1.


    Boolean operation And

    Example 2:

    statement BUT: "Hercules - the hero of ancient Greek mythology." Truly , BUT = 1.

    statement AT: "Hercules is the son of the god Zeus." Truly , B = 1.

    statement BUT And AT: "Hercules - the hero of ancient Greek mythology And son of the god Zeus. Truly , (BUT And AT) = 1.


    Boolean operation And

    Operation And called logical multiplication

    And :


    Boolean operation And

    Imagine a truth table for a logical operation And :


    Boolean operation And

    If at least one of the simple statements associated with the operation And, will be false, then the compound statement will also be false.

    And use the following notation: A And B , A AND B , A · B , A * B , AB , A & B .


    Boolean operation Or

    Compound statement BUT OR AT , formed by combining two simple statements BUT and B logical operation OR, is false if and only if BUT and AT false at the same time


    Boolean operation Or

    Example 3:

    Let's analyze the statement "Seventh grade students study philosophy or astronomy" .

    This compound statement is formed from two simple statements: "Seventh-graders study philosophy" (the statement BUT), “Seventh-graders study astronomy” (saying AT), which are connected by a logical operation OR. The result is a compound statement BUT OR b. statement BUT false, statement AT false. Therefore the statement BUT OR B false :( BUT OR B) = 0.


    Boolean operation Or

    Example 4:

    statement BUT: "Francisk Skaryna - Belarusian first printer". Truly BUT = 1.

    statement AT: "Stefan Batory - Turkish Sultan". false, B = 0.


    Boolean operation Or

    Example 4:

    statement"Francis Skorina - Belarusian first printer, OR Stefan Batory - Turkish Sultan" will be true , (BUT OR AT) = 1.


    Boolean operation Or

    Operation And called logical multiplication . Equalities 1 1 = 1, 1 0 = 0, 0 1 = 0, 0 0 = 0, which are true for ordinary multiplication, are also true for logical multiplication.


    Boolean operation Or

    Truth table for logical operation OR has the following form:

    BUT

    AT

    BUT OR AT


    Boolean operation Or

    The OR operation is called logical addition . Equalities 1 + 0 = 1, 0 + 1 = 1, 0 + 0 = 0, which are true for ordinary addition, are also true for logical addition.

    To write a logical operation OR the following expressions can be used: A OR B , A OR B , A + B , AB , A | B .


    Boolean operation Or

    If there are several logical operations in a logical expression, it is important to determine the order in which they are performed.

    The operation has the highest priority. NOT. Boolean operation And, i.e. logical multiplication, is performed before the operation OR- logical addition


    Boolean operation Or

    Parentheses are used to change the order of execution of logical operations: in this case, operations in brackets are performed first, and then all the rest.

    Boolean operations And and OR obey the displacement law:

    A And B=B And A ;

    A OR B=B OR A .


    Boolean operation Or

    • To determine the value of a compound logical expression, sometimes it is enough to know the value of only one simple statement.
    • Thus, if in a compound statement with the operation And the value of at least one simple statement is false, then the value of the compound statement will be false.
    • If in a compound statement with the operation OR the value of at least one simple statement will be true, then the value of the compound statement will be true

    Boolean operation Or

    Example 5:

    statement BUT :

    "It's raining outside now."

    statement AT :

    statement BUT And B will be false if we saw that it was not raining outside (regardless of what the weather forecast promised).


    Boolean operation Or

    Example 5:

    statement BUT :

    "The weather forecast is for rain."

    "It's raining outside now."

    statement AT :

    statement BUT OR B will be true if the weather forecast promised rain (regardless of what kind of weather we are seeing now).

    Exercises

    Determine whether the following compound statements are true or false.

    • ball round, OR The earth is flat. Rabbits are pets And baobab grows in Belovezhskaya Pushcha. Keyboard - an information input device, OR hard drive - an information output device. M. Yu. Lermontov wrote the poem "Sail", And I. A. Krylov wrote the fable "Quartet". Pine - coniferous tree, And cedar is not a coniferous tree. A processor is a device that processes information in a computer. OR Headphones are not an input device. Continents and islands are large areas of land.
    • ball round, OR The earth is flat.
    • Rabbits are pets And baobab grows in Belovezhskaya Pushcha.
    • Keyboard - an information input device, OR hard drive - an information output device.
    • M. Yu. Lermontov wrote the poem "Sail", And I. A. Krylov wrote the fable "Quartet".
    • Pine - coniferous tree, And cedar is not a coniferous tree.
    • A processor is a device that processes information in a computer. OR Headphones are not an input device.
    • Continents and islands are large areas of land.

    Homework

    To enjoy preview presentations, create a Google account (account) and sign in: https://accounts.google.com


    Slides captions:

    Logical operations Ivanova Julia

    A logical operation is a method of constructing a complex statement from given statements, in which the truth value of the complex statement is completely determined by the truth values ​​of the original statements.

    Inversion (logical negation) The inversion of a boolean variable is true if the variable is false, and vice versa, the inversion is false if the variable is true. Designation:

    A 1 0 0 1 Truth table

    Conjunction (logical multiplication) A conjunction of two logical variables is true if and only if both statements are true. Designation:

    Truth table A B 1 1 1 1 0 0 0 1 0 0 0 0

    Disjunction (logical addition) A disjunction of two logical variables is false if and only if both statements are false. Designation:

    Truth table A B 1 1 1 1 0 1 0 1 1 0 0 0

    Implication (logical consequence) An implication of two logical variables is false if and only if a false consequence follows from a true reason. Designation: A - condition B - consequence

    Equivalence (logical equality) The equivalence of two logical variables is true if and only if both statements are either false or true at the same time. Designation:

    Truth table A B 1 1 1 1 0 0 0 1 0 0 0 1

    Priority of execution of logical operations When calculating the value of a logical expression (formula), logical operations are calculated in a certain order, according to their priority: 1. inversion, 2. conjunction, 3. disjunction, 4. implication and equivalence. Operations of the same priority are executed from left to right. Parentheses are used to change the order of actions. Example

    Example Given a formula Determine the order in which it is calculated. Order of evaluation: Inversion - Conjunction - Disjunction - Implication - Equivalence -


    On the topic: methodological developments, presentations and notes

    Logical expressions and basic logical operations. truth tables.

    This development contains a lesson plan on the topic: "Logical expressions and basic logical operations. Truth tables." A presentation with additional files saves time...

    Elements of mathematical logic. logical operations. Constructing Boolean Expressions Using Relationships and Boolean Operations

    When studying at school, the subject "Informatics and ICT" is important. One of the sections of the theoretical course - logic - considers the laws and rules of logical thinking, which are ...

    Presentation for the lesson of informatics "Logical operations and truth tables. Problem solving."

    Presentation for the informatics lesson "Logical operations and truth tables" This presentation consists of sections: Logical operations, examples; The order of performing logical operations; Examples are solved ...