1 Propositional Logic
1 Propositional Logic
• A proposition can be
• A single variable ,p
• Compound, combination of one or more propositions.
pvq
Truth Table
• Truth table displays the relationships between the
truth values of propositions.
• Valueable in determination of the truth values of
propositions constructed by simple propositions.
Logical Operators
• Negation (Not)
• Or
• And
• XOR
• If
• Iff if and only if – ancak ve ancak
• ...
• Example propositions
• p1: Today is Friday.
• p2: It is raining today.
Negation Operator: NOT
• Negates the truth value
• Denoted by ¬ (not sign) or ~ (tilda)
• p if and only if q
• p is necessary and suffiecient for q p q pq
• pq pq qp T T T
T F F
F T F
F F T
Example 1
• You can access the internet from campus only if you
are a computer science major or you are not a
freshman. Write the statement in proposition
letters?
• a: You can access the internet from campus.
• c: You are a computer science major
• f: You are a freshman.
• a (c ¬f)
Example 2
• You cannot ride the roller coaster if you are under 4 feet tall unless
you are older than 16 years old. Write the sentence in a logical
expression?
• If you are under 4 feet tall and you are not older than 16 years old,
you cannot ride the roller coaster.
• q: You can ride the roller coaster
• r: You are under 4 feet tall
• s: You are older than 16 years old
• (r ¬s) ¬q
Logic and Bit Operators
• A bit string is sentence of zero or more bits. The length of
this string is the number of bits in the string.
• 0 represents F (false)
• 1 represents T (true)
01 1011 0110
11 0001 1101 x y xy
11 1011 1111 bitwise OR 0 0 0
01 0001 0100 bitwise AND 0 1 1
10 1010 1011 bitwise XOR 1 0 1
1 1 1
Operator Precedence
• NOT
• AND
• OR
• IF
• IFF
Propositional Equvalences
• Tautology: A compound proposition that is always
true, no matter what the truth values of the
propositions that occur in it, is called tautology.
p ¬p tautology contradiction
p¬p p¬p
T F T F
F T T F
Logical Equivalences
• p and q are logically equivalent if pq is tautology.
• pq denotes tha p and q are logically equivalent.
• yerine kullanılabiliyor.
Example 1
• Show that ¬(pq) and ¬p¬q are logically
equivalent?
• ¬(pq) ¬p¬q is tautology ? Yes
• Solution
(pq) (p q) (pq) (¬p q) get rid of if
¬(pq) (¬p q) get rid of if
(¬p ¬q) (¬p q) De Morgan’s rule
(¬p ¬p) (¬q q) Cumm. and Assoc.
(¬p ¬p) T
T Domination law
Additional Examples
• Show that if (p q)(¬q r) is tautology?