0% found this document useful (0 votes)
5 views40 pages

Knowledge

The document provides an overview of propositional and predicate logic, including definitions of propositions, truth tables, logical operations (negation, conjunction, disjunction, implication, biconditional), and their corresponding truth tables. It also introduces predicate logic, quantifiers, and how to express statements in logical form. Additionally, it discusses logical equivalences and the evaluation of logical expressions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views40 pages

Knowledge

The document provides an overview of propositional and predicate logic, including definitions of propositions, truth tables, logical operations (negation, conjunction, disjunction, implication, biconditional), and their corresponding truth tables. It also introduces predicate logic, quantifiers, and how to express statements in logical form. Additionally, it discusses logical equivalences and the evaluation of logical expressions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 40

Propositional Logic, Truth Tables,

Predicate Logic
Logic?
What is logic?

Logic is a truth-preserving system of inference

Truth-preserving:
System: a set of
If the initial
mechanistic
statements are
transformations, based
true, the inferred
on syntax alone
statements will
be true Inference: the process of
deriving (inferring) new
statements from old
statements
Propositional Logic
 A proposition is a statement that is either true or
false
 Examples:
 This class is M.Sc (3rd semester) in Computer Science
(true)
 Today is Sunday (false)
 It is currently raining in Singapore (???)
 Every proposition is true or false, but its truth
value (true or false) may be unknown
Propositional Logic (II)
 A propositional statement or well-formed formula
wff) is one of:
 A simple proposition

denoted by a capital letter, e.g. ‘A’.
 A negation of a propositional statement

e.g. A : “not A”
 Two propositional statements joined by a connective

e.g. A  B : “A and B”

e.g. A  B : “A or B”
 If a connective joins complex statements, parenthesis
are added

e.g. A  (BC)
Truth Tables
 The truth value of a compound
propositional statement is determined by
its truth table
 Truth tables define the truth value of a
connective for every possible truth value of
its terms
Logical negation
 Negation of proposition A is A

 A: It is snowing.
 A: It is not snowing

 A: Newton knew Einstein.


 A: Newton did not know Einstein.

 A: I am not registered for CS195.


 A: I am registered for CS195.
Negation Truth Table

A A
0 1
1 0
Logical and (conjunction)
 Conjunction of A and B is A  B
 A: CS160 teaches logic.
 B: CS160 teaches Java.
 A  B: CS160 teaches logic and Java.

 Combining conjunction and negation


 A: I like fish.
 B: I like sushi.
 I like fish but not sushi: A  B
Truth Table for Conjunction

A B AB
0 0 0
0 1 0
1 0 0
1 1 1
Logical or (disjunction)
 Disjunction of A and B is A  B
 A: Today is Friday.
 B: It is snowing.
 A  B: Today is Friday or it is snowing.

 This statement is true if any of the following hold:


 Today is Friday
 It is snowing
 Both
 Otherwise it is false
Truth Table for Disjunction

A B AB
0 0 0
0 1 1
1 0 1
1 1 1
Conditional & Biconditional
Implication
 The conditional implication connective is 
 The biconditional implication connective is 
 These, too, are defined by truth tables

A B AB A B AB
0 0 1
0 1 1 0 0 1
0 1 0
1 0 0
1 0 0
1 1 1
1 1 1
Conditional implication
 Shown by A  B
 A: A programming homework is due.
 B: It is Tuesday.
 A  B:
 If a programming homework is due, then it must be
Tuesday.
 A programming homework is due only if it is Tuesday.

 Is this the same as:


 If it is Tuesday, then a programming homework is due.
Bi-conditional
 A: You can drive a car.
 B: You have a driver’s license.

 You can drive a car if and only if you have a


driver’s license.
 AB

 What if we said “if”?


 What if we said “only if”?
Compound Truth Tables
 Truth tables can also be used to determine
the truth values of compound statements,
such as (AB)(A) (fill this as an exercise)
A B A AB (AB)(A)
0 0 1 0 0
0 1 1 1 1
1 0 0 1 0
1 1 0 1 0
Tautology and Contradiction
 A tautology is a compound proposition that is
always true.
 A contradiction is a compound proposition that
is always false.
 A contingency is neither a tautology nor a
contradiction.
 A compound proposition is satisfiable if there is
at least one assignment of truth values to the
variables that makes the statement true.
Examples

A A AA AA

0 1 1 0

1 0 1 0
Result is always
false, no matter
what A is
Result is always
true, no matter
what A is Therefore, it is a Therefore, it is a
tautology contradiction
Logical Equivalence
 Two compound propositions, p and q, are
logically equivalent if p  q is a tautology.
 Notation: p  q
 De Morgan’s Laws:
•  (p  q)   p   q
•  (p  q)   p   q
 How so? Let’s build a truth table!
Prove (p  q)  p  q

p q p q (p  q) (p  q) p  q
0 0 1 1 0 1 1

0 1 1 0 0 1 1

1 0 0 1 0 1 1

1 1 0 0 1 0 0

=
Show (p  q)  p  q

p q p q (p  q) (p q) p  q
0 0 1 1 0 1 1

0 1 1 0 1 0 0

1 0 0 1 1 0 0

1 1 0 0 1 0 0

=
Other Equivalences
 Show p  q  p  q

 Show Distributive Law:


 p  (q  r)  (p  q)  (p  r)
Show p  q  p  q

p q p p  q p  q
0 0 1 1 1

0 1 1 1 1

1 0 0 0 0

1 1 0 1 1

=
Show p  (q  r)  (p  q)  (p  r)
p q r q  r p  q p  r p  (q  r) (p  q)  (p  r)

0 0 0 0 0 0 0 0
0 0 1 0 0 1 0 0
0 1 0 0 1 0 0 0
0 1 1 1 1 1 1 1
1 0 0 0 1 1 1 1
1 0 1 0 1 1 1 1
1 1 0 0 1 1 1 1
1 1 1 1 1 1 1 1
=
More Equivalences

Equivalence Name
pTp Identity
pFp
pqq p Commutative
pqq p
p  (p  q)  p Absorption
p  (p  q)  p
Equivalences with Conditionals and
Biconditionals
 Conditionals  Biconditionals
 p  q  p  q  p  q  (p  q)  (q 

 p  q  q  p p)
 (p  q)  p  q  p  q  p  q

 (p  q)  p  q
Prove Biconditional Equivalence

p q q p  q (p  q) p  q
0 0 1 1 0 0

0 1 0 0 1 1

1 0 1 0 1 1

1 1 0 1 0 0

=
Predicate Logic
 Some statements cannot be expressed in
propositional logic, such as:
 All men are mortal.
 Some trees have needles.
 X > 3.
 Predicate logic can express these
statements and make inferences on them.
Statements in Predicate Logic
P(x,y)
 Two parts:
 Predicate P describes a relation or property,
 Variables (x,y) can take arbitrary values from
some domain.
 Still have two truth values for statements
(T and F)
 When we assign values to x and y, then
P has a truth value.
Example
 Let Q(x,y) denote “x=y+3”.

What are truth values of:

Q(1,2) false

Q(3,0) true

 Let R(x,y) denote x beats y in


Rock/Paper/Scissors with 2 players with
following rules:

Rock smashes scissors, Scissors cuts paper,
Paper covers rock.

What are the truth values of:

R(rock, paper) false

R(scissors, paper) true
Quantifiers
 Quantification expresses the extent to
which a predicate is true over a set of
elements.
 Two forms:
 Universal 
 Existential 
Universal Quantifier
 P(x) is true for all values in the domain
xD, P(x)
 For every x in D, P(x) is true.
 An element x for which P(x) is false is
called a counterexample.
 Given P(x) as “x+1>x” and the domain of
R, what is the truth value of:
x P(x) true
Example
 Let P(x) be that x>0 and x is in domain
of R.
 Give a counterexample for:
x P(x)
x = -5
Existential Quantifier
 P(x) is true for at least one value in the
domain.
xD, P(x)
 For some x in D, P(x) is true.
 Let the domain of x be “animals”,
M(x) be “x is a mammal” and
E(x) be “x lays eggs”,
what is the truth value of: true
Platypuses
x (M(x)  E(x)) echidnas
English to Logic
 Some person in this class has visited the
Grand Canyon.
 Domain of x is the set of all persons
 C(x): x is a person in this class
 V(x): x has visited the Grand Canyon
 x(C(x)V(x))
English to Logic
 For every one there is someone to love.
 Domain of x and y is the set of all persons
 L(x, y): x loves y
 xy L(x,y)
 Is it necessary to explicitly include that x
and y must be different people (i.e. xy)?
 Just because x and y are different variable
names doesn’t mean that they can’t take the
same values
English to Logic
 No one in this class is wearing shorts and a ski
parka.
 Domain of x is persons in this class
 S(x): x is wearing shorts

 P(x): x is wearing a ski parka

 x(S(x)P(x))

 Domain of x is all persons


 C(x): x belongs to the class

 x(C(x)S(x)P(x))
Evaluating Expressions:
Precedence and Variable Bindings
 Precedence:
 Quantifiers and negation are evaluated
before operators
 Otherwise left to right
 Bound:
 Variables can be given specific values or
 Can be constrained by quantifiers
Predicate Logic Equivalences
• Statements are logically equivalent iff they have the
same truth value under all possible bindings.
• For example:

– In English, given domain of students in CS160, all students


have passed M124 course (P) and are registered at CSU (Q);
hence, all students have passed M124 and all students are
registered at CSU.
Other Equivalences
• Someone likes skiing (P) or likes swimming (Q); hence, there exists someone
who likes skiing or there exists someone who likes skiing.

• Not everyone likes to go to the dentist; hence there is someone who does not
like to go to the dentist.

• There does not exist someone who likes to go to the dentist; hence everyone
does not like to go to the dentist.

You might also like