Basic of Logic
Basic of Logic
Proof
¬ 𝑜𝑟 − ¬𝐴 ¬(¬𝐴) ≡ 𝐴
𝑥 ≠ 𝑦 ⟺ ¬(𝑥 = 𝑦)
∨ 𝑜𝑟 + 𝐴∨𝐵 𝑛≥7 ∨𝑛≤5 ⇔𝑛≠6
𝑤ℎ𝑒𝑛 𝑛 𝑖𝑠 𝑎 𝑛𝑎𝑡𝑢𝑟𝑎𝑙 𝑛𝑢𝑚𝑏𝑒𝑟
∧ 𝑜𝑟 ⋅ 𝐴∧𝐵 𝑛<7 ∨𝑛>5 ⇔𝑛=6
𝑤ℎ𝑒𝑛 𝑛 𝑖𝑠 𝑎 𝑛𝑎𝑡𝑢𝑟𝑎𝑙 𝑛𝑢𝑚𝑏𝑒𝑟
⇒ 𝑜𝑟 → 𝐴⇒𝐵 𝑥 = 1 ⇒ 𝑥2 = 1
𝑥2 = 1 ⇒ 𝑥 = 1
( 𝑥 𝑐𝑎𝑛 𝑏𝑒 ± 1 )
⟺ 𝑜𝑟 ⟷ 𝑜𝑟 ≡ 𝐴⇔𝐵 𝑥 2 + 2𝑥 − 3 = 0 ⇔ 𝑥 = 1 𝑎𝑛𝑑 𝑥 = −3
2𝑛
23 = 8 (1 , 1 , 1 , 1 , 0 , 0 , 0 , 0)
22 = 4 (1 , 1 , 0 , 0)
21 = 2 (1 , 0)
𝑷 𝒒 𝒑 𝒒 𝒓
𝒑 ഥ
𝒑
𝒑 𝒒 𝒑∨𝒒 𝒑∧𝒒 𝒑⇒𝒒 𝒑⇔𝒒
Truth Tables
Useful for determining equivalences and also for shoeing
simple true and false values for variables gone through
various operation.
Two values occupy the spaces in a truth table :
• “ True “ value : Either “ 1 “ or “ T “
• “False “ value : Either “ 0 “ or “ F “
Notice : In our country we will be using the “ 0 “ and “ 1 “ values
True we use “ 1 “
False we use “ 0 “
Truth Tables
Sample truth table
𝑝 is our statement and ¬𝑝 = 𝑝ҧ is an operation
Truth Tables
When creating a truth table, we start off by listing all the statements in
one separate column
Following the statements, we fill in the operations we need to perform
to the columns on the left of the statements
In this case for multiple statements, we list all possible combinations of
true and false values for the statements and that will determine the
amount of rows we have
- The number will be 2𝑛 , where n is the number of
statement
- If we have one statement so we get the value are 21 = 2
( “ 1 “ and “ 0 “ )
Sample truth table :
Statement : p and q so n=2 and we expect to have 22 = 4 rows
Operation : 𝑝 ∧ 𝑞 ( these operations will be explained in the next
few slides )
( Note that the first two columns are our statements and the last
column is the operation we performed )
Basic Operations
The NOT operation : ¬
The AND operation : ∧
The OR operation :∨
The Implication operation : ⟶
The equivalence operation : ⟷ , ⟺ 𝒐𝒓 ≡
NOT Operation
The NOT operation is quite self-explanatory and is what one
would think it to be, negation.
This operation can be only perform to one statement.
Often denoted by using the symbol " ¬ 𝑜𝑟 ഥ “
Example: ¬𝑝 , 𝑝′ 𝑜𝑟 𝑝ҧ
NOT Operation
In plain text, we can describe the operation to be the opposite of
what the original value is
Example : Let p = “ cat “
then ¬𝑝 will be “ not a cat “
Example : Let p = “ tired “
then ¬𝑝 = “ not tired “
AND operation
For the AND Operation, two or more statements are required
and will only return “ true “ if both statements are also “ true “
Often denoted by symbol “ ∧ or " ∙ "
AND plain text,
Example: let p is “tired” and q is “ hungry ”
then 𝑝 ∧ 𝑞 is “ tired and hungry “
also ¬𝑝 ∧ 𝑞 is “ not tired and hungry “
or 𝑝 ∧ ¬𝑞 is “ tired and not hungry “
OR Operation
For the OR Operation, two or more statement are required and
will return “ true “ if one or more of statements are true
Often denoted1 by the symbol " ∨ “ or " + “
1
1
OR Operation
In plain text,
Example : let p is “ tired “ and q is “ hungry “
if “ tired and not hungry “ , 𝑝 ∨ 𝑞 is “ true
“
if “ not tired and hungry “ ,𝑝 ∨ 𝑞 is “ true
“
it “ not tired and not hungry “ 𝑝 ∨ 𝑞 is “
false “
Implication Operation
For Implication Operation, it is slightly more complicated and
requires two statement. It will return “true “if the initial
condition is false, regardless of the value of the second
statement, and when both statements ae true.
Denoted by the symbol “ → 𝑜𝑟 ⇒ “
Implication Operation
In plain text, we can use it in the form “ if p, then q “
Example : let p is hungry and q is eat
𝑝 → 𝑞 will be “ if I am hungry, I eat “
Example : “ you must be 21 to drink “
If p is “ John is 21 “ and q is “ John drink
“
then 𝑞 → 𝑝 satisfies the statement
Implication Operation
𝑝 → 𝑞 is also equivalent ( the same as ) ¬𝑝 ∨ 𝑞
Example : Using the operations we have just learned, we will
apply them using truth tables :
Equivalence
Equivalence requires two statements and will return “true” if
both statements have the same value
Denoted by the symbol " ⟺ 𝑜𝑟 ≡ “
Tautology
Tautology is very similar to logical equivalence
When all values are “ true “ that is a tautology
Example : 𝑝 ≡ 𝑞 if and only if 𝑝 ↔ 𝑞 is tautology
Example : 𝑝 ≡ ¬¬𝑝 is tautology
Example
𝑝→𝑞
𝑝 𝑞
∀𝑥 𝑝 𝑥 → 𝑞 𝑥 .
𝑝(𝑥) 𝑞(𝑥) 𝑥
𝑥 𝑥
𝑛, 𝑛 𝑛2
𝑛 𝑛
𝑛2
𝑛2
𝑛 𝑛 𝑛 = 2𝑘 𝑘
𝑛2 = 2𝑘 2 = 4𝑘 2 = 2(2𝑘 2 2𝑘 2 𝑛2
𝑎, 𝑏, 𝑐, 𝑎|𝑏 𝑎𝑛𝑑 𝑏|𝑐 𝑡ℎ𝑒𝑛 𝑎|𝑐. 𝑥|𝑦
𝑥 𝑑𝑖𝑣𝑖𝑑𝑒𝑠 𝑦 𝑦 𝑥, 𝑥 𝑦
𝑎, 𝑏, 𝑎𝑛𝑑 𝑐
𝑎|𝑏 𝑎𝑛𝑑 𝑏|𝑐 𝑎|𝑐.
(𝑎|𝑏 𝑎𝑛𝑑 𝑏|𝑐)
(𝑎|𝑐)
𝑎|𝑏 𝑏 = 𝑘𝑎 𝑘 𝑏 𝑎
𝑐 = 𝑙𝑎,
𝑎
𝑝→𝑞
¬𝑞 ¬𝑝
𝑛 𝑛2 𝑛
𝑛2
n2 = 2𝑘
𝑛2
𝐼𝑛
𝑛2
𝑛 = 2𝑘 + 1 𝑘. n2 = 2𝑘 + 1 2
= 4𝑘 2 + 4𝑘 + 1 = 2 2𝑘 2 + 2𝑘 + 1.
2𝑘 2 + 2𝑘 𝑛2
𝑝, 𝑝=2
2
𝑝 ¬𝑝 → 𝑞 𝑞
𝑞 ¬𝑝?
𝑝
¬𝑝
¬𝑝 𝑝
𝑝 𝑝
Example : Prove that 2 is irrational.
Solution
𝑎 𝑎
Suppose not. Then √2 is equal to a fraction 𝑏. Without loss of generality, assume 𝑏 is in lowest terms (otherwise reduce
the fraction). So,
𝑎2
2= 2
𝑏
2𝑏 = 𝑎2
2
Thus 𝑎2 is even, and as such 𝑎 is even. So 𝑎 = 2𝑘 for some integer k, and 𝑎2 = 4𝑘 2 . We then have,
2𝑏2 = 4𝑘 2
𝑏2 = 2𝑘 2
𝑎
Thus 𝑏2 is even, and as such 𝑏 is even. Since 𝑎 is also even, we see that 𝑏 is not in lowest terms, a contradiction.
Thus √2 is irrational.
𝑥 𝑦 𝑥 2 = 4𝑦 + 2.
𝑛 𝑛
𝑛 𝑛 = 2𝑘 𝑘
𝑛3 − 𝑛 = 8𝑘 3 − 2𝑘 = 2(4𝑘 3 − 𝑘), 4𝑘 3 − 𝑘 𝑛3 − 𝑛
𝑛 = 2𝑘 + 1 𝑘
𝑛3 − 𝑛 = 2𝑘 + 1 3
− (2𝑘 + 1) = 8𝑘 3 + 6𝑘 2 + 6𝑘 + 1 − 2𝑘 − 1 = 2(4𝑘 3 + 3𝑘 2 + 2𝑘), 4𝑘 3 + 3𝑘 2 +
2𝑘 𝑛3 − 𝑛
𝑛3 − 𝑛 𝑛3 − 𝑛
𝑎 𝑏, 𝑎+𝑏
𝑎 𝑏
𝑎 𝑏 𝑎 𝑏 𝑎+𝑏
1+3=4