Upload
dominh
View
234
Download
0
Embed Size (px)
Citation preview
Basics of logical algebra
Аюпов Равшан Хамдамович
Plan:
1. About logic
2. Logical expressions and validity tables
3. Logical elements, predicates and Logical
functions
4. Logical laws and rules of transformation of log.
expressions
5. Logical bases of the device of the computer
6. Boolean operations on polygons
1. Thinking forms
The logic is a science about forms and ways
of thinking. Main forms of thinking: 1 – Concept
2 – Statement
3 – Conclusion
1.1. Concept The concept is the form of thinking
fixing the main, essential signs of object.
Concept
Contents Volume
Set of essential signs
of object
Set of subjects on
which the concept
extends
1.2. Statement The statement is a form of thinking in which something is
approved or denied about properties of real subjects and
the relations between them.
The statement is the narrative offer.
Statement
True False
Communication of
concepts correctly
reflects properties and
the relations of real
things
The statement doesn't
correspond to reality
Statement
Simple Compound
1.3. Conclusion
The conclusion is a form of thinking by
means of which of one or several
judgments (parcels) the new judgment
(decision) can be received.
Parcels – only true judgments.
2. Propositional algebra
The algebra of statements serves for
determination of the validity or falsehood of
compound statements.
Statements are designated by names of
logical variables which can accept only two
values: "truth" (1) and "lie" (0).
Logical operation
Logical operation — in programming operation over expressions of the logical (Boolean) type, corresponding to some operation over statements in algebra of logic. As well as statements, can accept logical expressions one or the other truth conditional values — "truly" or "in a false manner". Logical operations serve for receiving difficult logical expressions from simpler. In turn, logical expressions are usually used as a condition for management of sequence of implementation of the program.
Logical operation
Any digital computer consists of logical schemes - such schemes which can be only in one of two possible conditions - or "logical zero", or "logical unit". For logical 0 and logical 1 it is possible to accept any expression, including verbal which can be characterized as "truth" and "lie". In computer facilities logical 0 and 1 is a condition of electric circuits with certain parameters. So, for logical elements and the schemes executed on technologies of transistor-transistor logic (TTL-scheme), logical 0 is tension in the range of 0 … + 0,4 B, and logical 1 is tension in the range + 2,4 … + 5 V [1]. Work of logical schemes is described by means of special mathematical apparatus which is called as logical (Boolean) algebra or algebra of logic. The Boolean algebra was developed by George Boulle (1815 - 1864), it is a basis of all methods of simplification of Boolean expressions.
Logical operation
In some programming languages (for
example in C) instead of logical type or at
the same time with it numerical types are
used. In this case it is considered that other
than zero value corresponds to logical
truth, and zero — logical lie.
Among logical operations are most known conjunction (& &), a disjunction (||), denial (!) . Them quite often confuse to bit operations though it is different things. For example, the following code in language C:
if (action_required && some_condition())
{ /* any activities */ }
won't execute a call of the subprogramme of some_condition
() if value of the logical action_required variable is false. At
such operation the second argument of operation & also
won't be calculated at all.
Logical operation
2.1 . Logical multiplication (conjunction)
2.2 . Logical addition (disjunction)
2.3 . Logical denial (inversion)
2.1. Logical multiplication (conjunction)
Association of two (or several) statements in one by means of the and union.
The compound statement is true only when truth both simple statements.
Corresponds to the union and
Designation &, ^
In the and programming languages and;
Validity table
A B F=A&B
0 0 0
0 1 0
1 0 0
1 1 1
2.2. Logical addition (disjunction) Association of two (or several) statements in one by means of the or union.
The compound statement is true only when truly at least one or the other simple
statements.
Corresponds to the OR union
Designation of V
In the or programming languages or
Validity table
A B F=AvB
0 0 0
0 1 1
1 0 1
1 1 1
2.3. Logical denial (inversion) Particle accession "not" to the statement.
Inversion does the true statement false and, on the contrary.
Corresponds to NOT union
Designation Ā
In not programming languages not
Validity table
A F= Ā
0 1
1 0
3. Logical expressions and validity tables
Logical expression – a formula into which logical variables and signs of logical
operations enter.
Example:
)(&)( BABAF
For logical expression it is possible to construct the table of the validity which
defines its validity or falsehood at all possible combinations of reference values
of simple statements.
Logical elements Logical elements — the devices intended for information processing in a
digital form (sequence of signals high — "1" and low — "0" levels in binary logic, sequence "0", "1" and "2" in ternary logic, sequence "0", "1", "2", "3", "4", "5", "6", "7", "8" and "9" in decimal logic). Physically logical elements can be executed mechanical, electromechanical (on electromagnetic relays), electronic (on diodes and transistors), pneumatic, hydraulic, optical, etc.
With electrical equipment development from mechanical logical elements passed to electromechanical logical elements (on electromagnetic relays), and then to electronic logical elements on electron tubes, later — on transistors. After the proof in 1946 of the theorem of John von Neumann about profitability of indicative position notations it became known of advantages of binary and ternary notations in comparison with decimal notation. From decimal logical elements passed to binary logical elements. The binary and ternary allows to reduce considerably number of operations and the elements which are carrying out this processing, in comparison with decimal logical elements.
With electrical equipment development from mechanical logical elements passed to electromechanical logical elements (on electromagnetic relays), and then to electronic logical elements on electron tubes, later — on transistors. After the proof in 1946 of the theorem of John von Neumann about profitability of indicative position notations it became known of advantages of binary and ternary notations in comparison with decimal notation. From decimal logical elements passed to binary logical elements. The binary and ternary allows to reduce considerably number of operations and the elements which are carrying out this processing, in comparison with decimal logical elements.
Logical elements carry out logical function (operation) over entrance signals (operands, data).
Predicate Predicate (n-seater) — is function with a set of values (or { lie, truth }), defined on a
set. Thus, each set of elements of a set of M is characterized either as "true", or as "false".
The predicate can be connected with the mathematical relation: if (m1, m2... mn) belongs to the relation, the predicate will return on it 1. In particular, the single predicate defines the accessory relation to some set.
Predicate — one of elements of logic of the first and the highest orders. Since logic of the second order, in formulas it is possible to put quantifiers on predicates.
if on any set of arguments it accepts value 1.
Predicate call identical and false
if on any set of arguments it accepts value 0.
Predicate call feasible if at least on one set of arguments it accepts value 1.
As predicates accept only two values, all operations of Boolean algebra are applicable to them, for example: denial, implication, conjunction, disjunction
4. Logical function
Any compound statement can be
considered as the logical function F(X1, X2
function, …, Xn),
where X1, X2, …, Xn – simple statements.
Function and arguments can accept only
two various values: "truth" (1) and "lie" (0).
Tables of the validity of logical functions of two arguments
argumen
ts Logical function
A B F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15 F16
0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
0 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1
1 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1
1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
Logical following (implication)
Corresponds to a turn If …, then …
designation А→В In the if programming languages if … then …
Implication is formed by connection of two statements in one by means of a
turn of speech "if …, then …".
Implication is false only when from the true first statement (precondition)
the fallacy (the second statement) follows.
Validity table
A B F14=A→B
0 0 1
0 1 1
1 0 0
1 1 1
Logical equality (equivalence) Equivalence is formed by connection of two statements in one by means of a turn
of speech "… in only case when, when …".
The compound statement formed by means of logical operation of equivalence
truly in only case when when both statements at the same time either are false, or
are true.
Validity table
A B F10
0 0 1
0 1 0
1 0 0
1 1 1
Corresponds to a turn in only case when, when …
Designation of А≡В, А~B
5. Logical laws and rules of transformation of logical expressions
0A&A
1AA
Identity law.
Any statement is identical to itself. А=А
Not contradiction law.
The statement can't be at the same time true and false.
The law excluded the third.
The statement can be either true, or false, the third isn't given.
Law of double denial.
If twice to deny some statement, we will receive the initial statement.
AA
Logical laws and rules of transformation of logical expressions
De Morgan's laws.
BAB&A
B&ABA
Commutativity law
A & B = B & A
A v B = B v A
Associativity law
(A & B) & C = A & (B & C)
(A v B) v C = A v (B v C)
Distributivity law.
(A & B) v (A & C) = A & (B v C)
(A v B) & (A v C) = A v (B & C)
6 . Logical bases of the device of the computer
Basic logical Elements
Logical element
"and"
Logical element
"OR"
Logical element
"NOT"
and
А(0,0,1,1)
В(0,1,0,1)
F(0,0,0,1)
or А(0,0,1,1)
В(0,1,0,1)
F(0,1,1,1)
not А(0,1) F(1,0)
Слагаемые Перенос Сумма
A B P S
0 0 0 0
0 1 0 1
1 0 0 1
1 1 1 0
Adder of binary numbers
Half-adder.
A, B – the composed
P – transfer
S – amount
)B&A(&B)(AS
P = A & B
Logical bases of the device of the computer
Logical bases of the device of the computer
Adder of binary numbers
Half-adder.
Table of the validity of logical function )B&A(&B)(AF
A B AvB A&B
0 0 0 0 1 0
0 1 1 0 1 1
1 0 1 0 1 1
1 1 1 1 0 0
)B&A(&B)(AF )B&A(&B)(AF
and
or
not and
A
B A&B
AvB
)B&A(&B)(AF
A&B
)B&A(&B)(AF
Logical bases of the device of the computer
Adder of binary numbers
Full one-digit adder
Has three entrances: A, B – composed, P0 – transfer from the younger category;
two exits: S – the sum, P – transfer.
Addition table
The
composed
Transfer from the
younger category transfer amout
A B P0 P S
0 0 0 0 0
0 1 0 0 1
1 0 0 0 1
1 1 0 1 0
0 0 1 0 1
0 1 1 1 0
1 0 1 1 0
1 1 1 1 1
P=(A&B)v(A&P0)v(B&P0)
S=(AvBvP0)&P0v(A&B&P0)
Logical bases of the device of the computer
Trigger
The trigger allows to remember, store, read out information.
The trigger stores 1 bit of information.
or not
or not
S(1) 1
1
0
R
0 1
Q
Boolean operations on polygons
Boolean operations on polygons are a
set of Boolean operations (AND, OR, NOT,
XOR, ...) operating on one or more sets
of polygons in computer graphics. These
sets of operations are widely used
in computer graphics, CAD, and
in EDA (in integrated circuit physical design
and verification software).