Transcript p ~q
Statements
• In logic, letters are used to represent
statements that are either true or false
• These statements can be joined to form
what are called compound statements
• A conjunction is a compound statement
composed of two statements joined by the word
“and” and uses the symbol
• A disjunction is a compound statement
composed of two statements joined by the word
“or” and uses the symbol
Statements
(continued)
Examples of compound statements.
Statements:
Conjunction: p
Disjunction: p
p
q
q
q
Rob plays baseball.
John plays basketball.
Rob plays baseball and
John plays basketball.
Rob plays baseball or
John plays basketball.
Truth Tables
• Truth tables tell you the conditions under
which a compound statement is true or
false.
T= TRUE
Truth Table for a conjunction
p
q
p
q
T
T
T
T
F
F
F
T
F
F
F
F
F= FALSE
If p and q are true, then the
conjunction p
q is also true.
However, because this is an
"and" statement, if either p or q
is false, then the conjunction
p
q is false as well.
Truth Tables
(continued)
Truth table for disjunction
p
q
p
q
T
T
T
T
F
T
F
T
T
F
F
F
A disjunction is true
when both statements are
true (row 2).
If one statement is false
and another is true then
the disjunction is true
based the inclusive use
of "or" (row 3 & 4).
If both statements are
false then the disjunction
is considered false (row
5).
Truth Tables
(continued)
• Along with the words "and" and "or", the
word "not" is also used
• According to the negation of p, if p is not
true, then it can be called "not p" or ~p
p
~p
T
F
F
T
A contradiction
occurs, when the
negation of p is the
same thing as the
statement p itself.
~p
p
Truth Tables
(continued)
Make a truth table for ~p ~q
1. Make a column for p and a column for
q. Write all possible combinations of T
and F in the standard pattern shown.
2. Add a column for ~p and ~q, and use
the first column to decide whether it is
true or false.
3. Using columns ~p and ~q decide
whether the disjunction is true or
false
Truth Tables
(continued)
~p
~q
p
q
~p
~q
T
T
F
F
F
T
F
F
T
T
F
T
T
F
T
F
F
T
T
T
To find out the
number of rows
you need in a
truth table:
2
•The number of
letters you have is
the exponent of
the base 2
•Ex: 2^3 = 8
Truth Tables for
Conditionals
• For conditional or if-then
statements whose basic
form is If p, then q
statement p is the
hypothesis and q is the
conclusion
If p, then q
p: hypothesis q: conclusion
• These statements can also
be written as
p
q, "p implies q", and "q
follows from p"
p
q
pq
T
T
T
T
F
F
F
T
T
F
F
T
Truth Tables for Conditions
(continued)
Example:
Mom promises, "If I catch the early train home I'll take you
swimming"
1. Mom catches the early train home and takes you
swimming. She kept her promise; her statement was
true.
2. Mom catches the early train home but does not take you
swimming. She broke her promise; her statement was
false.
3. Mom does not catch the early train home, but still takes
you swimming. She does not break her promise; the
statement is true.
4. Mom does not catch the early train home and does not
take you swimming. She has not broken her promise;
her statement was true.
Truth Tables for Conditionals
(continued)
Conditional Statement “If p then q”
If B is between A and C, then AB+BC=AC
Converse “If q then p”
If AB+BC=AC then B is between A and C
Inverse “If not p then not q”
If B is not between A and C, then AB+BC AC
Contrapositive “If not q then not p”
If AB+BC AC then B is not between A and C
Truth Tables for Conditionals
(continued)
• There are two types of Truth Tables:
Converse of pq
p
T
T
F
F
q
T
F
T
F
q p
T
T
F
T
Contrapositive of p q
p
T
T
F
F
q
T
F
T
F
~q
F
T
F
T
~p ~q ~p
F
T
F
F
T
T
T
T
The last column of the above table is identical
to the last column of the conditional table
therefore:
The contrapositive of a statement is true (or
false) if and only if the statement itself is true
(or false).
Some Rules of Inference
• There are four rules for making logical inferences. The
horizontal line separates the given information from the
conclusion. You must accept true the conclusions shown.
1. Modus Ponens
p
q
2. Modus Tollens
q
p
~q
p
Therefore, q
Therefore, ~p
3. Simplification
4. Disjunction Syllogism
p
q
Therefore, p
p
q
~p
Therefore, q
Examples of Rules of Inference
1. If today is Tuesday, then tomorrow is Wednesday.
Today is Tuesday
Therefore, tomorrow is Wednesday. (Rule 1)
2. If a figure is a triangle, then it is a polygon
This figure is not a polygon.
Therefore, this figure is not a triangle (Rule 2)
3. It is Tuesday and it is April.
Therefore, it is April. (Rule 3)
4. It is a square or it is a triangle.
It is not a square
Therefore, it is a triangle. (Rule 4)
One More Example
5. Given: p
q ; p r; ~q
Prove: r
Proof:
Statements
1.
2.
3.
4.
5.
p q
~q
~p
p r
r
Reasons
1. Given
2. Given
3. Step 1 and 2 and
Modus Tollen
4. Given
5. Steps 3 and 4 and Disj.
Syllogism
Valid Arguments and Mistaken
Premises
Tautology is a statement whose truth table
contains only Ts in the last column
~p ( “p or not p”)
Valid Argument
– An example is the disjunction of p
Tautology
p
~p
T
F
F
T
p
~p
p
p
p p
T
T
F
T
T
F
F
T
Valid Argument represents a tautology in which the
last columns have all Ts.
An Example of a Logically Valid
Argument
The following is a logically valid argument . Is the conclusion true?
1.
The weather is sunny.
2.
If the weather is sunny, then the plane will arrive on time.
3.
If the plane arrives on time, we will be able to ski today.
4.
Therefore, we will be able to ski today.
Solution: We cannot evaluate the truth of the conclusion unless we
investigate all of the premises. The first statement, a given, may
not be accurate. Perhaps it is cloudy. Also, one or more of the
remaining conditional statements may be wrong. Perhaps the
plane will malfunction and be late even though the weather is
sunny. Perhaps we wont be able to get to the ski area even if the
plane lands on time. Or maybe we don’t even know how to ski! It
is important to investigate the truth of every premise before
you can draw meaningful conclusions.
Some Rules of Replacement
The symbol
5. Contrapositive Rule
means “is logically equivalent to.”
8. Associative Rules
6. Double Negation
r p (q r)
(p q) r p (q r)
~(~p)
9. Distributive Rule
p
q
~q ~p
p
7. Commutative Rules
q q p
pq q p
p
(p q)
(q r) (p q) (p r)
p (q r) (p q) (p r)
p
10. DeMorgan’s Rules
q) ~p ~q
~(p q) ~p ~q
~(p
Application of Logic to Circuits
Opened Switch
When switch p is open, the electricity
that is flowing from A will not reach B.
Series Circuit
Closed Switch
When switch p is closed, the electricity
flows through the switch to B.
Parallel Circuit
p
p
q
This diagram represents two
switches, p and q, that are
connected in series. The
current will flow if, and only if,
both switches are closed.
q
The diagram represents the switches, p
and q, that are connected in parallel.
Notice that the current will flow if
either switch is closed, or if both
switches are closed.
Application of Logic to Circuits
(continued)
Series Circuit
p
q
T
T
T
Circuit
Parallel Circuit
p
q
T
T
T
T
F
F
T
F
T
F
T
F
F
T
T
F
F
F
F
F
F
Notice that the series circuit truth
table is the same as the
conjunction truth table.
Circuit
Notice that the series circuit
truth table is the same as the
disjunction truth table.
Application of Logic to Circuits
(continued)
(p q)
p
p
(p ~q)
q
~q
Notice that one of the switches is labeled ~q. This means that this switch is open if
switch q is closed, and vice versa.
The first and the
p q
T
T
F
F
T
F
T
F
~q
F
T
F
T
p q
T
F
F
F
p
F
T
F
F
~q (p q) (p ~q)
T
T
F
F
last columns of
the table are
identical. This
means that you
would be able to
replace this
circuit with a
simpler circuit
that contains just
p.