☰ Contents · Computing

Logical operations

Lessons 4 · 1 lessons · B. Boltayev, A. Azamatov, A. Asqarov, M. Sodiqov, G. Azamatova. Fundamentals of Informatics and Computer Technology, Grade 8. Second edition. “O‘zbekiston milliy ensiklopediyasi” State Scientific Publishing House, Tashkent, 2015
4

Logical operations

Textbook: pp. 22–27
GoalKnows statements and the operations AND, OR and NOT, builds truth tables and evaluates logical expressions.
New words
statement: a declarative sentence that is either true or false · mulohazaconjunction (AND), written ∧: true only when both statements are true · mantiqiy ko‘paytirish (VA)disjunction (OR), written ∨: true when at least one statement is true · mantiqiy qo‘shish (YOKI)truth table: a table of all value combinations of the variables and the resulting value · rostlik jadvali
Explanation

A statement is a declarative sentence of which we can say that it is true or false; questions and commands are not statements. We denote statements by letters such as A and B, and true by 1 and false by 0. Compound statements are made from simple ones with the words AND, OR and NOT. The conjunction A ∧ B is true only when both statements are true (11→1, 10→0, 01→0, 00→0); the disjunction A ∨ B is true when at least one is true (11→1, 10→1, 01→1, 00→0); the negation ¬A reverses the value (¬1 = 0, ¬0 = 1). In an expression, brackets come first, then negation, then ∧, and finally ∨; operations of the same rank go from left to right. A truth table with n variables has 2ⁿ rows.

Worked examples
With A = 1, B = 0: A ∧ ¬B ∨ B. First ¬B = 1, then A ∧ ¬B = 1 ∧ 1 = 1, finally 1 ∨ B = 1 ∨ 0 = 1. Answer: 1.
Truth table of ¬A ∨ B. (A, B) = (1,1): ¬A = 0, 0 ∨ 1 = 1; (1,0): 0 ∨ 0 = 0; (0,1): 1 ∨ 1 = 1; (0,0): 1 ∨ 0 = 1. The result column: 1, 0, 1, 1.
Class activity

“True-false” game: the teacher says a sentence; pupils stand if it is true and sit if it is false. Then two sentences are joined with “AND” or “OR” and the class discusses how to react.

Practice
1
Which are statements: a) “Samarkand is a city in Uzbekistan.” b) “Close the door.” c) “12 is divisible by 5.” d) “How old are you?”
2
With A = 1, B = 0, C = 1 evaluate A ∨ B ∧ C.
3
With the same values evaluate ¬(A ∧ C) ∨ B.
4
Why does a truth table with three variables have 8 rows?