Alterna · учебный материал
Expressions and logical transactions
Words, 6 operations (in , priority, truth tables, de Morgan, axioms, interactive formula calculator.
Что в этом материале
- Expressions and its types
- 6 base operations
- Priority of operations
- Logical calculator
- Laws of De Morgan
- Axioms of logic algebra
- Simplified formula trainer
- Guess the operation.
- Mini test
Содержание и основные понятия
Back to the table of contents
Alterna · Chapter 15 · page 15.1
Expressions and logical transactions
6 basic operations, priority, de Morgan, axioms, interactive calculator.
Word
- a telling sentence that you can clearly say is true or false. "Moscow is the capital of Russia" is true. "What hour?" is not a saying. All mathematical logic is based on this simple idea.
GEF
PIF
OGE No. 3
EEG No. 2.15
01
Expressions and its types
Definition
Word
- a narrative proposal that can be clearly said to be true or false.
Logic only works with such suggestions. Questions, exclamations, orders of speech.
not
.
Examples
Proposal
A statement?
Truth
Moscow is the capital of Russia.
♪ Yes
Truth (1)
2+2=5
♪ Yes
Lies (0)
What time is it?
♪ No
—
Snow is white.
♪ Yes
Truth (1)
Close the door!
♪ No
—
Important
In logic, we often refer to words in large Latin letters:
A
,
B
,
C
,
X
,
Y
1 = truth, 0 = lie.
02
6 base operations
You can build complex words out of simple words.
B Inversion (NE / NOT)
It changes the meaning to the opposite.
¬A
read "not A".
♪ Mathematics:
¬A
or
Ā
📊 Excel:
= NE(A1)
💻 LibreOffice:
= NE(A1)
🖥 JS:
!A
A
¬A
0
1
1
0
♪ The situation (I / AND)
A∧B
It's true only when both are true.
♪ Mathematics:
A∧B
📊 Excel:
= I(A1;B1)
💻 LibreOffice:
= I(A1;B1)
🖥 JS:
A && B
A
B
A∧B
0
0
0
0
1
0
1
0
0
1
1
1
The analogy:
∧
- as a multiplication (0·0=0, 0.1=0, 1·0 = 0, 1·1=1).
♪ Disturbation (OR / OR)
A∨B
"A or B" is read.
♪ Mathematics:
A∨B
📊 Excel:
= OR(A1;B1)
💻 LibreOffice:
= OR(A1;B1)
🖥 JS:
A || B
A
B
A∨B
0
0
0
0
1
1
1
0
1
1
1
1
Warning:
∨
- "Including or" (as in mathematics), not "exclusive"!
♪ Implicit (SLUD / IPPLIES)
A→B
A=1, B=0, read "if A, then B".
♪ Mathematics:
A→B
or
A⊃B
📊 Excel:
= SELL(A1=1; SELL (B1=0.0,1);1)
💻 LibreOffice:
= SETTLE(A1;B1; SISTINA)
🖥 JS:
!A || B
A
B
A→B
0
0
1
0
1
1
1
0
0
1
1
1
Meaning: "A is enough for B." Equivalent:
¬A∨B
.
EQ / XNOR Equivalence
A↔B
Indeed, when A and B are the same, it reads "A then and only when B."
♪ Mathematics:
A↔B
or
A≡B
📊 Excel:
= A1=B1/1;0
💻 LibreOffice:
= A1=B1/1;0
🖥 JS:
A === B
A
B
A↔B
0
0
1
0
1
0
1
0
0
1
1
1
EXCLUDING OR (XOR)
A⊕B
true when A and B
different
Read "A or B, but not both".
♪ Mathematics:
A⊕B
📊 Excel:
= I(A1<B1)
or
=(NE(A1=B1))
💻 LibreOffice:
= I(A1<B1)
🖥 JS:
A ^ B
or
A !== B
A
B
A⊕B
0
0
0
0
1
1
1
0
1
1
1
0
Key property:
A⊕A = 0
(self-version) and
A⊕0 = A
XOR is the basis for the addition of two-way arithmetic (chapter 14).
03
Priority of operations
As in arithmetic, every operation has its own priority.
Priority hierarchy (from top to bottom)
¬
(negative) is the highest
∧
(conjunction)
∨
(discussion)
⊕
(excluding or)
→
(implicit)
↔
(equivalent to) is the lowest
As in arithmetic, first multiplication, then addition, the brackets change order!
⚡
Animation of priority calculations
Press Launch to see operations run in order of priority.
Лог вычисления появится здесь...
Another example: A.B.C.
Импликация ассоциативна справа налево:
1) A
→
B → C = A
→
(B → C)
04
Logical calculator
Enter the formula - see the truth table.
🧮
Parser formulas: A, B, C
Formula (A, B, C — variables)
Operations:
¬
NOT ·
∧
And ·
∨
OR
→
followed ·
↔
Equivalence
⊕
XOR. The brackets:
( )
05
Laws of De Morgan
How a denial goes "through" through and ♪
Two De Morgan Acts
Law 1: B(A)B = BA\B
Denying the condition is equal to dissuasing the denial.
Law 2: B(A)B = BA\B
The denial of dysunction is equal to the condition of denial.
🔍
Visual evidence de Morgan
Press cells A and B - see the equality
Left: B(A10/B)
A
B
A∧B
¬(A∧B)
0
0
0
1
0
1
0
1
1
0
0
1
1
1
1
0
=
Right side: BA
A
¬A
¬B
¬A∨¬B
0
1
1
1
0
1
0
1
1
0
1
1
1
0
0
0
The last columns match the law is proven!
Application
De Morgan is used to minimize formulas (chapter 17/27), programming (de Morgan's laws in code), cryptography, relativity OBD (SQL WHERE).
06
Axioms of logic algebra
Basic properties that work for all logical operations
Commutability
Order doesn't matter:
A∧B = B∧A
A∨B = B∨A
A⊕B = B⊕A
Association
The grouping is not important:
(A∧B)∧C = A∧(B∧C)
(A∨B)∨C = A∨(B∨C)
Distributiveness
Distribution:
A∧(B∨C) = (A∧B)∨(A∧C)
A∨(B∧C) = (A∨B)∧(A∨C)
Impotence
Repeat does not change:
A∧A = A
A∨A = A
Absorption
The strong absorbs the weak:
A∧(A∨B) = A
A∨(A∧B) = A
Double denial
Twice "not" = reference:
¬¬A = A
The neutral element
A∧1 = A (конъюнкция)
A∨0 = A (дизъюнкция)
Accumulation element
A∧0 = 0
A∨1 = 1
Laws of contradiction and exclusion of the third
A∧¬A = 0 (противоречие)
A∨¬A = 1 (исключённое третье)
07
Simplified formula trainer
Apply axioms to simplify logical expressions
⚡
Simplify the formula
08
Guess the operation.
The truth table is to determine what this operation is.
🎯
5 questions: Guess the table operation.
0/5
09
Mini test
5 random questions, one at a time
📝
Check yourself out.
0/5