0% found this document useful (0 votes)
31 views

Lecture 4

Propositional logic involves statements (propositions) that are either true or false. Logical operations like negation, conjunction, disjunction, implication, and equivalence are used to combine simple propositions into complex ones. Truth tables define the truth values of logical operations and are used to prove logical equivalences between statements. Important concepts include tautologies, contradictions, and logical equivalence.

Uploaded by

hefawoj62
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Lecture 4

Propositional logic involves statements (propositions) that are either true or false. Logical operations like negation, conjunction, disjunction, implication, and equivalence are used to combine simple propositions into complex ones. Truth tables define the truth values of logical operations and are used to prove logical equivalences between statements. Important concepts include tautologies, contradictions, and logical equivalence.

Uploaded by

hefawoj62
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 29

Propositional Logic

TOPICS

• Propositional Logic
• Logical Operations
• Equivalences
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 CS122 (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 is one of:
 A simple proposition (atomic proposition)
 denoted by a capital leJer, 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” (complex proposition)

 e.g. A  B : “A or B”

 If a connective joins complex statements, parenthesis


are added
 e.g. A  (BC)
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
Exclusive Or
 The “or” connective  is inclusive: it is true
if either or both arguments are true
 There is also an exclusive or (either or): 

A B AB
0 0 0
0 1 1
1 0 1
1 1 0
Confusion over
Inclusive OR and Exclusive OR

 Restaurants typically let you pick one (either


soup or salad, not both) when they say “The
entrée comes with a soup or salad”.
 Use exclusive OR to write as a logic proposition
 Give two interpretations of the sentence using
inclusive OR and exclusive OR:
 Students who have taken calculus or intro to
programming can take this class
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 0 1
0 1 1 0 1 0
1 0 0 1 0 0
1 1 1 1 1 1
Conditional implication
 A: A programming homework is due.
 B: It is Tuesday.

 A  B:
 If a programming homework is due, then it
must be Tuesday.
 Is this the same?
 If it is Tuesday, then a programming
homework is due.
Bi-‐conditional

 A: You can take the flight.


 B: You have a valid ticket.

 A  B

 You can take the flight if and only if you


have a valid ticket (and vice versa).
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

See Rosen for more.


Equivalences with Conditionals
and Biconditionals, Precedence
 Conditionals  Biconditionals
 p  q  p  q  p  q  (p  q)  (q  p)

 p  q  q  p  p  q  p  q

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

 Precedence: (Rosen chapter 1, table 8)


  highest
  higher than 
  and  higher than  and 
 equal precedence: left to right
   used to define priority, and create clarity
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

=
Contrapositive

 The contrapositive of an implication p  q is:


q  p

The contrapositive is equivalent to the


original implication.
Prove it!

so now we have:
p  q  p  q  q  p

You might also like