0% found this document useful (0 votes)
6 views13 pages

01 Propositional Logic 4p

The document provides an overview of propositional logic, including definitions of propositions, logical connectives, and truth tables. It explains the construction of compound propositions and their logical equivalences, as well as applications of propositional logic in various contexts. Key concepts such as conjunction, disjunction, implication, biconditional, and logical equivalences are discussed with examples and truth tables.

Uploaded by

mvrxyz000
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views13 pages

01 Propositional Logic 4p

The document provides an overview of propositional logic, including definitions of propositions, logical connectives, and truth tables. It explains the construction of compound propositions and their logical equivalences, as well as applications of propositional logic in various contexts. Key concepts such as conjunction, disjunction, implication, biconditional, and logical equivalences are discussed with examples and truth tables.

Uploaded by

mvrxyz000
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

The Foundations: Logic and

Proofs
Chapter 1, Part I: Propositional Logic
Propositional Logic
Section 1.1

Chapter Summary Section Summary 1

Propositional Logic Propositions


• The Language of Propositions
• Applications Connectives
• Logical Equivalences
• Negation
Predicate Logic
• The Language of Quantifiers • Conjunction
• Logical Equivalences • Disjunction
• Nested Quantifiers
Proofs • Implication; contrapositive, inverse, converse
• Rules of Inference • Biconditional
• Proof Methods
• Proof Strategy Truth Tables
Propositions Compound Propositions: Negation
A proposition is a declarative sentence that is either true or false. The negation of a proposition p is denoted by
Examples of propositions: ¬p and has this truth table:
a) The Moon is made of green cheese.
b) Trenton is the capital of New Jersey.
p ¬p
c) Toronto is the capital of Canada.
d) 1+0=1 T F
e) 0+0=2 F T
Examples that are not propositions.
a) Sit down! Example: If p denotes “The earth is round.”, then
b) What time is it?
¬p denotes “It is not the case that the earth is
c) x+1=2
d) x+y=z
round,” or more simply “The earth is not round.”

Propositional Logic Conjunction


Constructing Propositions The conjunction of propositions p and q is
• Propositional Variables: p, q, r, s, … denoted by p ∧ q and has this truth table:
• The proposition that is always true is denoted by T and the p q P∧q
proposition that is always false is denoted by F.
T T T
• Compound Propositions; constructed from logical connectives
and other propositions T F F
• Negation ¬ F T F
• Conjunction ∧ F F F
• Disjunction ∨ Example: If p denotes “I am at home.” and q
• Implication → denotes “It is raining.” then p ∧ q denotes “I am
• Biconditional ↔ at home and it is raining.”
Disjunction Implication
The disjunction of propositions p and q is If p and q are propositions, then p → q is a conditional
statement or implication which is read as “if p, then q” and has
denoted by p ∨ q and has this truth table: this truth table:
p q P∨q p q P→q
T T T T T T
T F T T F F
F T T
F T T
F F T
F F F
Example: If p denotes “I am at home.” and q denotes “It is
Example: If p denotes “I am at home.” and q raining.” then p → q denotes “If I am at home then it is raining.”
denotes “It is raining.” then p ∨ q denotes “I am In p → q, p is the hypothesis (antecedent or premise) and q is the
at home or it is raining.” conclusion (or consequence).

The Connective Or in English Understanding Implication 1

In English “or” has two distinct meanings. In p → q there does not need to be any connection
• “Inclusive Or” - In the sentence “Students who have taken CS202 or Math120 between the antecedent or the consequent. The
may take this class,” we assume that students need to have taken one of the
prerequisites, but may have taken both. This is the meaning of disjunction. For “meaning” of p → q depends only on the truth values of
p ∨ q to be true, either one or both of p and q must be true. p and q.
• “Exclusive Or” - When reading the sentence “Soup or salad comes with this
entrée,” we do not expect to be able to get both soup and salad. This is the These implications are perfectly fine, but would not be
meaning of Exclusive Or (Xor). In p ⊕ q , one of p and q must be true, but not
both. The truth table for ⊕ is: used in ordinary English.
p q P⊕q • “If the moon is made of green cheese, then I have more
T T F money than Bill Gates. ”
T F T • “If the moon is made of green cheese then I’m on welfare.”
F T T
• “If 1 + 1 = 3, then your grandma wears combat boots.”
F F F
Understanding Implication 2 Converse, Contrapositive, and Inverse
One way to view the logical conditional is to From p → q we can form new conditional statements .
think of an obligation or contract. • q→p is the converse of p → q
• ¬q → ¬p is the contrapositive of p → q
• “If I am elected, then I will lower taxes.” • ¬p → ¬q is the inverse of p → q
• “If you get 100% on the final, then you will get an A.” Example: Find the converse, inverse, and contrapositive
of “It raining is a sufficient condition for my not going to
If the politician is elected and does not lower town.”
taxes, then the voters can say that he or she has Solution:
broken the campaign pledge. Something similar converse: If I do not go to town, then it is raining.
holds for the professor. This corresponds to the inverse: If it is not raining, then I will go to town.
case where p is true and q is false. contrapositive: If I go to town, then it is not raining.

Different Ways of Expressing p → q Biconditional


if p, then q p implies q If p and q are propositions, then we can form the biconditional
proposition p ↔ q, read as “p if and only if q .” The biconditional p
if p, q p only if q ↔ q denotes the proposition with this truth table:

q unless ¬p q when p p q P↔q


T T T
q if p
T F F
q whenever p p is sufficient for q F T F
q follows from p q is necessary for p F F T

If p denotes “I am at home.” and q denotes “It is raining.” then


a necessary condition for p is q
p ↔ q denotes “I am at home if and only if it is raining.”
a sufficient condition for q is p
Expressing the Biconditional Example Truth Table
Some alternative ways “p if and only if q” is Construct a truth table for p ∨ q → ¬r
expressed in English:
p q r ¬r p∨q p ∨ q → ¬r
• p is necessary and sufficient for q T T T F T F
T T F T T T
• if p then q, and conversely
T F T F T F
• p if q T F F T T T
F T T F T F
F T F T T T
F F T F F T
F F F T F T

Truth Tables For Compound


Equivalent Propositions
Propositions
Construction of a truth table: Two propositions are equivalent if they always
Rows have the same truth value.
• Need a row for every possible combination of values for Example: Show using a truth table that the
the atomic propositions. conditional is equivalent to the contrapositive.
Columns
Solution:
• Need a column for the compound proposition (usually at
p q ¬p ¬q p→q ¬q → ¬p
far right)
T T F F T T
• Need a column for the truth value of each expression T F F T F F
that occurs in the compound proposition as it is built up.
F T T F T T
• This includes the atomic propositions
F F T T T T
Using a Truth Table to Show Non-
Precedence of Logical Operators
Equivalence
Example: Show using truth tables that neither Operator Precedence
the converse nor inverse of an implication are ¬ 1
not equivalent to the implication. ∧ 2
∨ 3
Solution: → 4
p q ¬p ¬q p→q ¬p → ¬q q → p ↔ 5
T T F F T T T
T F F T F T T p ∨ q → ¬r is equivalent to (p ∨ q) → ¬r
F T T F T F F If the intended meaning is p ∨(q → ¬r)
F F T T T T T
then parentheses must be used.

Problem
How many rows are there in a truth table with n
propositional variables?
Applications of
Solution: 2n We will see how to do this in
Chapter 6. Propositional Logic
Note that this means that with n propositional Section 1.2
variables, we can construct 2n distinct (that is,
not equivalent) propositions.
Applications of Propositional Logic:
Example
Summary
Translating English to Propositional Logic Problem: Translate the following sentence into
propositional logic:
System Specifications
“You can access the Internet from campus only if you
Boolean Searching are a computer science major or you are not a
freshman.”
Logic Puzzles
One Solution: Let a, c, and f represent respectively
Logic Circuits “You can access the internet from campus,” “You are a
computer science major,” and “You are a freshman.”
AI Diagnosis Method (Optional)
a → ( c  f )

Translating English Sentences System Specifications


Steps to convert an English sentence to a System and Software engineers take requirements in
statement in propositional logic English and express them in a precise specification
language based on logic.
• Identify atomic propositions and represent using
propositional variables. Example: Express in propositional logic:
• Determine appropriate logical connectives “The automated reply cannot be sent when the file
“If I go to Harry’s or to the country, I will not go system is full”
shopping.” Solution: One possible solution: Let p denote “The
• p: I go to Harry’s automated reply can be sent” and q denote “The file
If p or q then not r.
system is full.”
• q: I go to the country.
• r: I will go shopping.
( p  q ) → r q → p
Consistent System Specifications
Definition: A list of propositions is consistent if it is possible to
assign truth values to the proposition variables so that each
proposition is true.
Exercise: Are these specifications consistent?
• “The diagnostic message is stored in the buffer or it is retransmitted.”
Propositional Equivalences
• “The diagnostic message is stored in the buffer.”
• “If the diagnostic message is stored in the buffer, then it is retransmitted.”
Solution: Let p denote “The diagnostic message is stored in the buffer.” Let q
Section 1.3
denote “The diagnostic message is retransmitted” The specification can be
written as: p ∨ q, ¬p, p → q. When p is false and q is true all three statements
are true. So the specification is consistent.
• What if “The diagnostic message is not retransmitted” is added.
Solution: Now we are adding ¬q and there is no satisfying assignment. So the
specification is not consistent.

Raymond
Logic Puzzles Smullyan Section Summary 2
(Born 1919)
An island has two kinds of inhabitants, knights, who always tell the truth, and Tautologies, Contradictions, and Contingencies.
knaves, who always lie.
You go to the island and meet A and B. Logical Equivalence
• A says “B is a knight.” • Important Logical Equivalences
• B says “The two of us are of opposite types.”
• Showing Logical Equivalence
Example: What are the types of A and B?
Solution: Let p and q be the statements that A is a knight and B is a knight, Normal Forms (optional, covered in exercises in text)
respectively. So, then ¬p represents the proposition that A is a knave and ¬q
that B is a knave.
• Disjunctive Normal Form
• If A is a knight, then p is true. Since knights tell the truth, q must also be true. • Conjunctive Normal Form
Then (p ∧ ¬ q) ∨ (¬ p ∧ q) would have to be true, but it is not. So, A is not a
knight and therefore ¬p must be true. Propositional Satisfiability
• If A is a knave, then B must not be a knight since knaves always lie. So, then both
¬p and ¬q hold since both are knaves.
• Sudoku Example
Tautologies, Contradictions, and
De Morgan’s Laws
Contingencies
A tautology is a proposition which is always true.  ( p  q )  p  q Augustus De Morgan
1806-1871
• Example: p ∨ ¬p  ( p  q )  p  q
A contradiction is a proposition which is always false.
• Example: p ∧ ¬p This truth table shows that De Morgan’s Second Law holds.

p q ¬p ¬q (p ∨ q) ¬(p ∨ q) ¬p ∧ ¬q
A contingency is a proposition which is neither a
T T F F T F F
tautology nor a contradiction, such as p
T F F T T F F
P ¬p p ∨ ¬p p ∧ ¬p F T T F T F F
T F T F F F T T F T T
F T T F

Logically Equivalent Key Logical Equivalences 1

Two compound propositions p and q are logically equivalent if p↔q Identity Laws: p  T  p, pF  p
is a tautology.
We write this as p⇔q or as p≡q where p and q are compound
propositions. Domination Laws: p T  T, pF  F
Two compound propositions p and q are equivalent if and only if
the columns in a truth table giving their truth values agree.
This truth table shows that ¬p ∨ q is equivalent to p → q.
Idempotent laws: p  p  p, p p  p
p q ¬p ¬p ∨ q p→q
T T F T T Double Negation Law:  ( p )  p
T F F F F
F T T T T Negation Laws: p  p  T , p  p  F
F F T T T
Key Logical Equivalences 2 Constructing New Logical Equivalences
Commutative Laws: p  q  q  p, p  q  q  p We can show that two expressions are logically
equivalent by developing a series of logically equivalent
Associative Laws: ( p  q)  r  p  ( q  r ) statements.
( p  q)  r  p  ( q  r ) To prove that A ≡ B we produce a series of
equivalences beginning with A and ending with B.
Distributive Laws: ( p  ( q  r ))  ( p  q)  ( p  r ) A  A1

( p  ( q  r ))  ( p  q)  ( p  r ) An  B
Keep in mind that whenever a proposition (represented
Absorption Laws: p  ( p  q)  p p  ( p  q)  p by a propositional variable) occurs in the equivalences
listed earlier, it may be replaced by an arbitrarily
complex compound proposition.

More Logical Equivalences Equivalence Proofs 1

TABLE 7 Logical Equivalences (


Example: Show that  p  ( p  q ) )
is logically equivalent to p  q
Involving Conditional Statements.
TABLE 8 Logical Equivalences
p → q  p  q Involving Biconditional Statements.
p → q  q → p Solution:
p  q  ( p → q)  ( q → p)
p  q  p → q  ( p  ( p  q ) )   p   (  p  q ) by the second De Morgan law
p  q  p  q
p  q   ( p → q )
p  q  ( p  q )  ( p   q )  ( p )  q 
 p   by the first De Morgan law
 ( p → q )  p  q  p  ( p  q )
 ( p  q )  p  q by the double negation law
( p → q)  ( p → r )  p → ( q  r )  ( p  p )  ( p  q ) by the second distributive law
( p → r )  ( q → r )  ( p  q) → r  F  ( p  q ) because p  p  F
( p → q)  ( p → r )  p → ( q  r )
 ( p  q )  F
( p → r )  ( q → r )  ( p  q) → r by the commutative law
for disjunction
 ( p  q ) By the identity law for F
Questions on Propositional
Equivalence Proofs 2
Satisfiability
Example: Show that ( p  q) → ( p  q) Example: Determine the satisfiability of the following
is a tautology. compound propositions:

Solution: ( p  q )  ( q  r )  ( r   p )
( p  q) → ( p  q)   ( p  q)  ( p  q) by truth table for → Solution: Satisfiable. Assign T to p, q, and r.
 ( p  q )  ( p  q ) by the first De Morgan law ( p  q  r )  ( p  q   r )
 ( p  p )  ( q  q ) by associative and Solution: Satisfiable. Assign T to p and F to q.
commutative laws
laws for disjunction ( p  q )  ( q  r )  ( r   p )  ( p  q  r )  (  p   q   r )
 T T by truth tables Solution: Not satisfiable. Check each possible
assignment of truth values to the propositional
T by the domination law
variables and none will make the proposition true.

Propositional Satisfiability Notation


A compound proposition is satisfiable if there is

n
an assignment of truth values to its variables j =1
p j is used for p1  p2   pn
that make it true. When no such assignments


exist, the compound proposition is unsatisfiable. n
j =1
p j is used for p1  p2   pn
A compound proposition is unsatisfiable if and
only if its negation is a tautology.
Needed for the next example.
Sudoku Encoding as a Satisfiability Problem 2

A Sudoku puzzle is represented by a 9×9 grid made For each cell with a given value, assert p(i,j,n), when
up of nine 3×3 subgrids, known as blocks. Some of the cell in row i and column j has the given value.
the 81 cells of the puzzle are assigned one of the
Assert that every row contains every number.
numbers 1,2, …, 9.
9 9 9
The puzzle is solved by assigning numbers to each
blank cell so that every row, column and block
 p ( i, j, n)
i =1 n =1 j =1
contains each of the nine possible numbers.
Assert that every column contains every number.
Example
9 9 9

 p ( i, j, n)
j =1n =1 i =1

Encoding as a Satisfiability Problem 1 Encoding as a Satisfiability Problem 3

Let p(i,j,n) denote the proposition that is true Assert that each of the 3 × 3 blocks contain every
when the number n is in the cell in the ith row number. 2 2 9 3 3
and the jth column.  p ( 3r + i,3s + j, n)
r = 0 s = 0 n =1 i =1 j =1
There are 9 × 9 × 9 = 729 such propositions.
(this is tricky - ideas from chapter 4 help)
In the sample puzzle p(5,1,6) is true, but p(5,j,6) Assert that no cell contains more than one number.
is false for j = 2,3,…9 Take the conjunction over all values of n, n’, i, and j,
where each variable ranges from 1 to 9 and n ≠ n’ , of

p ( i , j , n ) → p ( i , j , n  )
Solving Satisfiability Problems
To solve a Sudoku puzzle, we need to find an assignment of
truth values to the 729 variables of the form p(i,j,n) that
makes the conjunction of the assertions true. Those
variables that are assigned T yield a solution to the puzzle.

A truth table can always be used to determine the


satisfiability of a compound proposition. But this is too
complex even for modern computers for large problems.

There has been much work on developing efficient methods


for solving satisfiability problems as many practical
problems can be translated into satisfiability problems.

You might also like