Академический Документы
Профессиональный Документы
Культура Документы
Introduction to logic
What is logic?
Why is it useful?
Types of logic
Propositional logic
Predicate logic
Introduction to logic
What is logic?
Why is it useful?
Types of logic
Propositional logic
Predicate logic
What is logic?
“Logic is the
beginning of
wisdom, not the
end”
What is logic?
Logic : The branch of philosophy
concerned with analysing the
patterns of reasoning by which a
conclusion is drawn from a set of
premises, without reference to
meaning or context
Why study logic?
Logic is concerned with two key
skills, which any computer
engineer or scientist should have:
Abstraction
Formalisation
Why is logic important?
Logic is a formalisation of reasoning.
T F
F T
Compound Propositions
Composite
3. Negation ¬ p(not)
Topic #1.0 – Propositional Logic: Operators
T T T
T F F
F T F
F F F
Topic #1.0 – Propositional Logic: Operators
T T T
T F T
F T T
F F F
Propositional calculus.
• truth tables for logical connectives
P ~P P Q P∧Q P∨Q
T F T T T T
F T T F F T
F T F T
F F F F
Example
If p represents “ This book is good” and q represents
This book is cheap”, write the following sentences in
symbolic form:
(a) This book is good and cheap.
(b) This book is costly but good
(c) This book is neither good nor cheap
(d) This book is not good but cheap
(e) This book is good or cheap
(a) p∧q (b)(¬q) ∧p (c)(¬p) ∧(¬q)
(d)(¬ p)∧q (e)p∨q
Topic #1.0 – Propositional Logic: Operators
The Implication (conditional)
Operator
The implication p → q states that p implies
q.
I.e., If p is true, then q is true; but if p is not
true, then q could be either true or false.
E.g., let p = “You study hard.”
q = “You will get a good grade.”
p → q = “If you study hard, then you will get
a good grade.”
Logic
• More with Truth Tables: implication p q
• If you have propositions p and q, the implication
p q of p and q is false when p is true and q is
false and is true otherwise:
p q p q
T T T
T F F
F T T
F F T
Logic
• More with Truth Tables: implication p q
• Other ways to refer to this implication:
– q if p if p, q q whenever p
– p only if q q is necessary for p
– If p, then q p is sufficient for q p implies q
p q p q
T T T
T F F
F T T
F F T
•
Logic
More with Truth Tables: implication p q
• In other words, p is the hypothesis (or
antecedent or premise); and q is the conclusion
(or consequence)
p q p q
T T T
T F F
F T T
F F T
Topic #1.0 – Propositional Logic: Operators
2006
2005 I’m still
here!
• More with Tables: biconditional p q
• True when p and q have the same truth
values and is false otherwise
• Other ways to express it: p IFF q; p is
necessary and sufficient for q; if p then q,
and vice versa
p q p q
T T T
T F F
F T F
F F T
Proposition
Let P(p,q,........) denote an expression constructed from
logical variables p,q,......., which take on the value True(T)
or False(F), and the logical connectives ∧, ∨, and ¬
E.g. P(p,q) = ¬ (p ∧ ¬ q)
p q ¬q p∧¬q ¬ (p ∧ ¬ q)
T T F F T
T F T F
T
F T F F T
F F T F T
Well-Formed Formulas(wff)
p q ¬ (p ¬ q)
∧
T T T T F F T
T F F T T T F
F T T F F F T
F F T F F T F
step 4 1 3 2 1
Propositional calculus cont.
P Q ~Q ~P P⇒Q ~Q⇒~P
T T F F T T
T F T F F F
F T F T T T
F F T T T T
Propositional calculus cont.
P Q ~P ~P⇒
Q P∨
Q P⇒
Q ~P∨
Q
T T F T T T T
T F F T T F F
F T T T T T T
F F T F F T T
Construct truth table for p∨¬q and (p∨q)
Logic - Equivalences
Propositional Equivalences
In mathematical arguments, you can replace a statement or
proposition with another statement or proposition with the
same truth value
Tautology: A compound proposition (combination of
propositions using logical operators) that is always True,
no matter what the truth values of the propositions that are
in it
Contradiction: a compound proposition that is always false
Contingency: proposition that is neither a tautology or a
contradiction
Logic - Equivalences
• Propositional Equivalences
p p pv p p^ p
T F T F
F T T F
1. Do implication first
2. Do DeMorgan’s second
¬ (p V (¬p Λ q))
PROPOSITIONAL EQUIVALENCES
DeMorgan’s Law ¬ ( p V q) ⇔ ¬p Λ ¬q
¬ (p V (¬p Λ q))
⇔ ¬ p Λ ¬ (¬p Λ q)
PROPOSITIONAL EQUIVALENCES
Now we have
¬ (p V (¬p Λ q)) ⇔ ¬ p Λ ¬ (¬p Λ q)) DeMorgan’s Law
¬ (¬p Λ q) ⇔ ¬ (¬ p) V ¬q
PROPOSITIONAL EQUIVALENCES
Now we have
¬ (p V (¬p Λ q)) ⇔ ¬ p Λ ¬ (¬p Λ q)) DeMorgan’s Law
⇔ ¬ p Λ [¬ (¬p) V ¬q)] ) DeMorgan’s Law
¬ p Λ (p V ¬q)
PROPOSITIONAL EQUIVALENCES
Distributive Law p Λ (q V r) ⇔ (p Λ q) V (p Λ r)
(¬ p Λ p) V (¬ p Λ ¬q) ⇔
F V (¬ p Λ ¬q)
PROPOSITIONAL EQUIVALENCES
Now we have
¬ (p V (¬p Λ q)) ⇔ ¬ p Λ ¬ (¬p Λ q)) DeMorgan’s Law
⇔ ¬ p Λ [¬ (¬p) V ¬q)] ) DeMorgan’s Law
⇔ ¬ p Λ (p V ¬q) Double negation
⇔ (¬ p Λ p) V (¬ p Λ ¬q) Distributative Law
⇔ (F) V (¬ p Λ ¬q)
Commutative Laws p V q ⇔ q V p
F V (¬ p Λ ¬q) ⇔ (¬ p Λ ¬q) V F
Identity Law p V F ⇔ p
(¬ p Λ ¬q) V F ⇔ (¬ p Λ ¬q)
PROPOSITIONAL EQUIVALENCES
⇔ (F) V (¬ p Λ ¬q)
⇔ (¬ p Λ ¬q) V (F) Commutative Law
⇔ ¬ p Λ ¬q Identity Law
PROPOSITIONAL EQUIVALENCES
Prove (p Λ q) → ( p V q) is a Tautology.
Prove (p Λ q) → ( p V q) ⇔ T
PROPOSITIONAL EQUIVALENCES
Prove (p Λ q) → ( p V q) ⇔ T
(p Λ q) → ( p V q) ⇔ T
(p Λ q) → ( p V q) ⇔ T
PROPOSITIONAL EQUIVALENCES
Useful Law #3 ( p → q )⇔ ¬ p V q
(p Λ q) → ( p V q) ⇔ ¬ ( p Λ q) V ( p V q)
PROPOSITIONAL EQUIVALENCES
Prove (p Λ q) → ( p V q) is a Tautology.
Now we have
(pΛq)→(pVq)⇔
⇔ ¬( p Λ q) V ( p V q)
DeMorgan’s Law
¬ ( p Λ q) ⇔ ¬ p V ¬q
¬( p Λ q) V ( p V q) ⇔ ( ¬ p V ¬ q) V ( p V q)
PROPOSITIONAL EQUIVALENCES
Now we have
(p Λ q) → ( p V q) ⇔ T
⇔ ¬( p Λ q) V ( p V q)
⇔ ( ¬ p V ¬ q) V ( p V q) DeMorgan’s Law
What do we have? ( ¬ p V ¬ q) V ( p V q)
What are we trying to get? T
Associative Laws (p V q) V r ⇔ p V (q V r)
( ¬ p V ¬ q) V ( p V q) ⇔ ¬ p V (¬ q V p) V q
PROPOSITIONAL EQUIVALENCES
¬ p V (¬ q V p) V q ⇔ ¬ p V (p V ¬ q) V q
PROPOSITIONAL EQUIVALENCES
Associative Laws (p V q) V r ⇔ p V (q V r)
¬ p V (p V ¬ q) V q ⇔ (¬ p V p) V (¬ q V q)
PROPOSITIONAL EQUIVALENCES
(¬ p V p) V (¬ q V q) ⇔ T V T
PROPOSITIONAL EQUIVALENCES
T V T ⇔ T
PROPOSITIONAL EQUIVALENCES
Prove (p Λ q) → ( p V q) is a Tautology.
(p Λ q) → ( p V q) ⇔ T
⇔ ¬( p Λ q) V ( p V q)
⇔ ( ¬ p V ¬ q) V ( p V q) DeMorgan’s Law
⇔ ( ¬ p V p) V (¬ q V q) Associative Law
⇔ ( ¬ p V p) V (¬ q V q) Commulative Law
⇔ ( T ) V ( T ) Useful Law # 1
⇔ T V T Domination Law
Prove
¬(p → q) ⇔ (p Λ ¬q)
Show that
((p∨q) Λ¬(¬p Λ(¬q ∨ ¬r))) ∨(¬p Λ ¬q) ∨(¬p Λ¬r)
is a tautology.
Arguments
In logical reasoning , a certain number of propositions
are assumed to be true and based on the assumption some
other proposition is derived(deduced or inferred)
premises
conclusion
Definition - An argument p1,p2,p3,.......,pn q
is said to be valid if q is true whenever all premises
p1,p2,......,pn are true.
valid argument
fallacy
Theorem - The argument p1,p2,p3,.......,pn q
is valid iff the proposition (p1∧p2 ∧........... ∧pn) q
is a tautology
Inference Rules - General Form
• An Inference Rule is
– A pattern establishing that if we know that a
set of antecedent statements of certain forms
are all true, then we can validly deduce that a
certain related consequent statement is true.
• antecedent 1
antecedent 2 …
∴ consequent “∴” means
“therefore”
Some Inference Rules
• p Rule of Addition
∴ p∨q
• p∧q Rule of Simplification
∴p
• p Rule of Conjunction
q
∴ p∧q
Some Inference Rules
• p
• p→q (law of detachment)
∴q “the mode of
affirming”
• ¬q
“the mode of denying”
p→q
∴¬p
Syllogism Inference Rules
• p→q Rule of hypothetical
q→r syllogism
∴p→r
3) If P is true of an object, so is Q
4) This is the negation of the above: for some object, P is true but
Q is false.
Relations between negation,
universal and existential quantifiers
“It is not the case that all math majors are male” or
“There exists at least one math major who is a female”