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

Logic

The document provides an overview of logic, specifically propositional logic, and its components such as syntax, semantics, and rules of inference. It explains concepts like propositions, logical connectives, truth tables, and various logical operations including negation, conjunction, disjunction, implication, and biconditional. Additionally, it discusses logical equivalences, tautologies, and contradictions, illustrating these concepts with examples and truth tables.

Uploaded by

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

Logic

The document provides an overview of logic, specifically propositional logic, and its components such as syntax, semantics, and rules of inference. It explains concepts like propositions, logical connectives, truth tables, and various logical operations including negation, conjunction, disjunction, implication, and biconditional. Additionally, it discusses logical equivalences, tautologies, and contradictions, illustrating these concepts with examples and truth tables.

Uploaded by

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

Logic

Logic:
• defines a formal language for representing knowledge and for
making logical inferences
• It helps us to understand how to construct a valid argument

Logic defines:
• Syntax of statements
• The meaning of statements
• The rules of logical inference (manipulation)

Propositional logic
• The simplest logic

• Definition:
– A proposition is a statement that is either true or false.

• Examples:
– Pitt is located in the Oakland section of Pittsburgh.
• (T)
– 5 + 2 = 8.
• (F)
– It is raining today.
• (either T or F)

1
Propositional logic
• Examples (cont.):
– How are you?
• a question is not a proposition
– x+5=3
• since x is not specified, neither true nor false
– 2 is a prime number.
• (T)
– She is very talented.
• since she is not specified, neither true nor false
– There are other life forms on other planets in the universe.
• either T or F

Composite statements
• More complex propositional statements can be build from
elementary statements using logical connectives.

Example:
• Proposition A: It rains outside
• Proposition B: We will see a movie
• A new (combined) proposition:
If it rains outside then we will see a movie

2
Composite statements
• More complex propositional statements can be build from
elementary statements using logical connectives.

• Logical connectives:
– Negation
– Conjunction
– Disjunction
– Exclusive or
– Implication
– Biconditional

Negation
Definition: Let p be a proposition. The statement "It is not the
case that p." is another proposition, called the negation of p. The
negation of p is denoted by ¬ p and read as "not p."
Example:
• Pitt is located in the Oakland section of Pittsburgh.

• It is not the case that Pitt is located in the Oakland section of
Pittsburgh.
Other examples:
– 5 + 2  8.
– 10 is not a prime number.
– It is not the case that buses stop running at 9:00pm.

3
Negation
• Negate the following propositions:
– It is raining today.
• It is not raining today.
– 2 is a prime number.
• 2 is not a prime number
– There are other life forms on other planets in the universe.
• It is not the case that there are other life forms on other
planets in the universe.

Negation
• A truth table displays the relationships between truth
values (T or F) of different propositions.

p ¬p
T F
F T

Rows: all possible


values of elementary
propositions:

4
Conjunction
• Definition: Let p and q be propositions. The proposition "p
and q" denoted by p  q, is true when both p and q are true
and is false otherwise. The proposition p  q is called the
conjunction of p and q.

• Examples:
– Pitt is located in the Oakland section of Pittsburgh and 5 +
2=8
– It is raining today and 2 is a prime number.
– 2 is a prime number and 5 + 2  8.
– 13 is a perfect square and 9 is a prime.

Disjunction
• Definition: Let p and q be propositions. The proposition "p
or q" denoted by p  q, is false when both p and q are false
and is true otherwise. The proposition p  q is called the
disjunction of p and q.

• Examples:
– Pitt is located in the Oakland section of Pittsburgh or 5 + 2
= 8.
– It is raining today or 2 is a prime number.
– 2 is a prime number or 5 + 2  8.
– 13 is a perfect square or 9 is a prime.

5
Truth tables
• Conjunction and disjunction
• Four different combinations of values for p and q

p q pq pq
T T
T F
F T
F F

Rows: all possible combinations of values for


elementary propositions: 2n values

Truth tables
• Conjunction and disjunction
• Four different combinations of values for p and q

p q pq pq
T T T
T F F
F T F
F F F

• NB: p  q (the or is used inclusively, i.e., p  q is true when


either p or q or both are true).

6
Truth tables
• Conjunction and disjunction
• Four different combinations of values for p and q

p q pq pq
T T T T
T F F T
F T F T
F F F F

• NB: p  q (the or is used inclusively, i.e., p  q is true when


either p or q or both are true).

Exclusive or
• Definition: Let p and q be propositions. The proposition "p
exclusive or q" denoted by p  q, is true when exactly one of p
and q is true and it is false otherwise.

p q pq
T T F
T F T
F T T
F F F

7
Implication
• Definition: Let p and q be propositions. The proposition "p
implies q" denoted by p  q is called implication. It is false
when p is true and q is false and is true otherwise.

• In p  q, p is called the hypothesis and q is called the


conclusion.

p q pq
T T T
T F F
F T T
F F T

Implication
• p  q is read in a variety of equivalent ways:
• if p then q
• p only if q
• p is sufficient for q
• q whenever p

• Examples:
– if Steelers win the Super Bowl in 2013 then 2 is a prime.
• If F then T ?

8
Implication
• p  q is read in a variety of equivalent ways:
• if p then q
• p only if q
• p is sufficient for q
• q whenever p

• Examples:
– if Steelers win the Super Bowl in 2013 then 2 is a prime.
•T
– if today is Tuesday then 2 * 3 = 8.
• What is the truth value ?

Implication
• p  q is read in a variety of equivalent ways:
• if p then q
• p only if q
• p is sufficient for q
• q whenever p

• Examples:
– if Steelers win the Super Bowl in 2013 then 2 is a prime.
•T
– if today is Tuesday then 2 * 3 = 8.
• If T then F

9
Implication
• p  q is read in a variety of equivalent ways:
• if p then q
• p only if q
• p is sufficient for q
• q whenever p

• Examples:
– if Steelers win the Super Bowl in 2013 then 2 is a prime.
•T
– if today is Tuesday then 2 * 3 = 8.
•F

Implication
• The converse of p  q is q  p.
• The contrapositive of p  q is ¬q  ¬p
• The inverse of p  q is ¬p  ¬q

• Examples:
• If it snows, the traffic moves slowly.
• p: it snows q: traffic moves slowly.
• pq
– The converse:
If the traffic moves slowly then it snows.
• qp

10
Implication
• The contrapositive of p  q is ¬q  ¬p
• The inverse of p  q is ¬p  ¬q

• Examples:
• If it snows, the traffic moves slowly.
– The contrapositive:
• If the traffic does not move slowly then it does not
snow.
• ¬q  ¬p
– The inverse:
• If it does not snow the traffic moves quickly.
• ¬p  ¬q

Biconditional
• Definition: Let p and q be propositions. The biconditional p
 q (read p if and only if q), is true when p and q have the
same truth values and is false otherwise.

p q pq
T T T
T F F
F T F
F F T

• Note: two truth values always agree.

11
Constructing the truth table
• Example: Construct the truth table for
(p  q)  (¬p  q) Typically the target
(unknown) compound
proposition and its
values
p q ¬p pq ¬p  q (pq)
(¬pq)
T T
T F
F T Auxiliary compound
F F propositions and their
values

Constructing the truth table


• Examples: Construct a truth table for
(p  q)  (¬p  q)

p q ¬p pq ¬p  q (pq)
(¬pq)
T T F
T F F
F T T
F F T

12
Constructing the truth table
• Examples: Construct a truth table for
(p  q)  (¬p  q)

p q ¬p pq ¬p  q (pq)
(¬pq)
T T F T
T F F F
F T T T
F F T T

Constructing the truth table


• Examples: Construct a truth table for
(p  q)  (¬p  q)

p q ¬p pq ¬p  q (pq)
(¬pq)
T T F T F
T F F F T
F T T T T
F F T T F

13
Constructing the truth table
• Examples: Construct a truth table for
(p  q)  (¬p  q)
Simpler if we decompose the sentence to elementary and
intermediate propositions

p q ¬p pq ¬p  q (pq)
(¬pq)
T T F T F F
T F F F T F
F T T T T T
F F T T F F

Tautology and Contradiction

What is a tautology?
• A compound proposition that is always true for all possible
truth values of the propositions is called a tautology.

Example: p  ¬p is a tautology.

p ¬p p  ¬p
T F T
F T T

14
Tautology and Contradiction

What is a contradiction?
• A compound proposition that is always false is called a
contradiction.

Example: p  ¬p is a contradiction.

p ¬p p  ¬p
T F F
F T F

Equivalence
• How do we determine that two propositions are equivalent?
Their truth values in the truth table are the same.
• Example: p  q is equivalent to ¬q  ¬p (contrapositive)

p q pq ¬q  ¬p
T T T T
T F F F
F T T T
F F T T

• Equivalent statements are important for logical reasoning


since they can be substituted and can help us to make a logical
argument.

15
Logical equivalence

• Definition: The propositions p and q are called logically


equivalent if p  q is a tautology (alternately, if they have the
same truth table). The notation p <=> q denotes p and q are
logically equivalent.

a b (a  b) <->
ab ¬a  ¬b
(¬a  ¬b)
T T T T T
T F F F T
F T T T T
F F T T T

Important logical equivalences


• Identity
– p  T <=> p
– p  F <=> p

• Domination
– p  T <=> T
– p  F <=> F

• Idempotent
– p  p <=> p
– p  p <=> p

16
Important logical equivalences
• Double negation
– ¬(¬p) <=> p

• Commutative
– p  q <=> q  p
– p  q <=> q  p

• Associative
– (p  q)  r <=> p  (q  r)
– (p  q)  r <=> p  (q  r)

Important logical equivalences


• Distributive
– p  (q  r) <=> (p  q)  (p  r)
– p  (q  r) <=> (p  q)  (p  r)

• De Morgan
– ¬( p  q ) <=> ¬p  ¬q
– ( p  q ) <=> ¬p  ¬q

• Other useful equivalences


– p  ¬p <=> T
– p  ¬p <=> F
– p  q <=> (¬p  q)

17
Showing logical equivalence
Example: Show (p  q)  p is a tautology
In other words ((p  q)  p <=> T)

Proof via truth table:

p q pq (p  q)p
T T T T
T F F T
F T F T
F F F T

Showing logical equivalences


• Equivalences can be used in proofs. A proposition or its part
can be transformed using equivalences and some conclusion
can be reached.

Example: Show that (p  q)  p is a tautology.


• Proof: (we must show (p  q)  p <=> T)
(p  q)  p <=> ¬(p  q)  p Useful
<=> [¬p  ¬q]  p DeMorgan
<=> [¬q  ¬p]  p Commutative
<=> ¬q  [ ¬p  p ] Associative
<=> ¬q  [ T ] Useful
<=> T Domination

18

You might also like