Logic
Logic
Logic
Language
• a systematic means of communicating by the use of
sounds or conventional symbols (Chen, 2010)
Mathematics as a Language
It is a universal language, the only one shared by all human beings
regardless of culture, religion, or gender.
Exclusive Disjunction
Conjunction Disjunction
(exclusive or/
p q (and) (or)
either but not both)
p˄q p˅q
p⨁q
T T T T F
T F F T T
F T F T T
F F F F F
Conditional/Implication Biconditional
p q (If – then/ implies) (if and only if)
p→q p↔q
T T T T
T F F F
F T T F
F F T T
p ~p
T F
F T
(b) Converse (𝑞 → 𝑝)
If it is raining today, then today is Friday.
Logical
Name Logical Equivalence Name
Equivalence
𝑝∧𝑻 ⟺𝑝 𝑝∨𝑞 ⟺𝑞∨𝑝 Commutative
Identity laws
𝑝∨𝑭⟺𝑝 𝑝∧𝑞 ⟺𝑞∧𝑝 laws
𝑝∨𝑻⟺𝑻 Domination (𝑝 ∨ 𝑞) ∨ 𝑟 ⟺ 𝑝 ∨ (𝑞 ∨ 𝑟) Associative
𝑝∧𝑭⟺𝑭 Laws (𝑝 ∧ 𝑞) ∧ 𝑟 ⟺ 𝑝 ∧ (𝑞 ∧ 𝑟) laws
𝑝∨𝑝⟺𝑝 Idempotent 𝑝 ∧ (𝑞 ∨ 𝑟) ⟺ (𝑝 ∧ 𝑞) ∨ (𝑝 ∧ 𝑟) Distributive
𝑝∧𝑝⟺𝑝 laws 𝑝 ∨ (𝑞 ∧ 𝑟) ⟺ (𝑝 ∨ 𝑞) ∧ (𝑝 ∨ 𝑟) laws
Double ~ 𝑝 ∧ 𝑞 ⟺ ~𝑝 ∨ ~𝑞 De Morgan’s
~(~𝑝) ⟺ 𝑝
negation law ~ 𝑝 ∨ 𝑞 ⟺ ~𝑝 ∧ ~𝑞 laws
Bit Operations
Bit is short for binary digit. Computers represent information using bits.
A bit has two possible values, 0 and 1, which represent a truth value.
As customary done, 1 will be used to represent T and 0 will be used to
represent F.
A bit string is a sequence of zero or more bits. The length of this string
is the number of bits in the string. Hence, 101001100 is a bit string of
length 9.
A byte is 8 bits.
A word is 16 bits or 2 bytes.
Bit Operations
What is the decimal value of the binary 10110001?
1 → 1 x 27 = 1 x 128 = 128
0 → 0 x 26 = 0 x 64 = 0
1 → 1 x 25 = 1 x 32 = 32
1 → 1 x 24 = 1 x 16 = 16
0 → 0 x 23 =0x 8= 0
0 → 0 x 22 =0x 4= 0
0 → 0 x 21 =0x 2= 0
1 → 1 x 20 =1x 1= 1
Some Logic Gates
The bitwise OR, bitwise AND, and bitwise XOR of two strings of the
same length are defined as the strings that have as their bits the
connectives OR, AND, and XOR of the corresponding bits in the two
strings respectively.
OR 0 1 AND 0 1 XOR 0 1
0 0 1 0 0 0 0 0 1
1 1 1 1 0 1 1 1 0