Download Logic and Proof - Collaboratory for Advanced Computing and

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Meaning (philosophy of language) wikipedia , lookup

Gödel's incompleteness theorems wikipedia , lookup

History of the function concept wikipedia , lookup

Quantum logic wikipedia , lookup

Tractatus Logico-Philosophicus wikipedia , lookup

Argument wikipedia , lookup

Truth-bearer wikipedia , lookup

History of logic wikipedia , lookup

Axiom of reducibility wikipedia , lookup

Mathematical logic wikipedia , lookup

List of first-order theories wikipedia , lookup

Peano axioms wikipedia , lookup

Analytic–synthetic distinction wikipedia , lookup

Foundations of mathematics wikipedia , lookup

Sequent calculus wikipedia , lookup

Syllogism wikipedia , lookup

Intuitionistic logic wikipedia , lookup

Statistical inference wikipedia , lookup

Interpretation (logic) wikipedia , lookup

Laws of Form wikipedia , lookup

Inquiry wikipedia , lookup

Theorem wikipedia , lookup

Axiom wikipedia , lookup

Propositional calculus wikipedia , lookup

Propositional formula wikipedia , lookup

Catuṣkoṭi wikipedia , lookup

Mathematical proof wikipedia , lookup

Natural deduction wikipedia , lookup

Principia Mathematica wikipedia , lookup

Law of thought wikipedia , lookup

Transcript
Logic and Proof
Aiichiro Nakano
Collaboratory for Advanced Computing & Simulations
Department of Computer Science
Department of Physics & Astronomy
Department of Chemical Engineering & Materials Science
Department of Biological Sciences
University of Southern California
Email: [email protected]
From K. H. Rosen, Discrete Mathematics and Its Applications
(McGraw-Hill) Chapter 1
Logic
Logic = mathematical foundation for: • Objective reasoning
• Formal proofs
• Computation
Proposition: A declarative sentence that is either true or false,
but not both
(Example) ‘today is Friday’
‘read this book’
× — imperative
‘what time is it’
× — interrogative
Predicate (propositional function): A statement involving
variables (Example) P(x, y): Student x has studied subject y
Truth value: True (T) or false (F)
Connectives
Logical operators to form composite propositions from existing
propositions
• Negation
¬p: “not p”; inverts the truth value
• Conjunction p ∧ q: “p and q”; T if both p and q are T • Disjunction p ∨ q: “p or q”; F if both p and q are F, T otherwise • Exclusive or p ⊕ q: T when exactly one of p and q is T Truth table: Combinatorial enumeration of the truth values of
composite propositions; 2n rows for a n-proposition composite
Unary
p
T
F
¬p
F
T
Binary p q p ∧ q p ∨ q p ⊕ q
T
T
F
F
T
F
T
F
T
F
F
F
T
T
T
F
F
T
T
F
Connectives
Implication: p
q; F when p is T and q is F, and T otherwise
hypothesis conclusion p q
p → q
“if p, then q” (“q if p”)
T T
T
“p implies q”
T F
F
“p is a sufficient condition for q”
F T
T
→
F F
T
Related implications
• Contrapositive: ¬q → ¬p
• Converse: q → p
• Inverse: ¬p → ¬q
Biconditional: p ↔ q; T if p and q has the same truth value
p q
p ↔ q
“q if and only if (iff) p”
“p is sufficient and necessary for q” T T
T
T F
F T
F F
F
F
T
Nested Connectives
• Use parenthesis
(p ∧ q) ∨ r
• Precedence: No need to memorize, except for
¬p ∧ q is (¬p) ∧ q not ¬(p ∧ q) Operator Precedence
¬
1
∧
2
∨
3
→
↔
4
5
operate first
operate last
Logical Equivalences
• Tautology: A compound proposition that is always T
• p ≡ q: p and q are logically equivalent; p ↔ q is a tautology
Syntactically different composite propositions can have the
same meaning (truth values) Truth table can be used to determine the equivalence
(Example) “equivalence of contrapositive”
p → q ≡ ¬q → ¬p p
T
T
F
F
q
T
F
T
F
p → q
T
F
T
T
¬q
F
T
F
T
¬p ¬q → ¬p
F
T
F
F
T
T
T
T
Basic Logical Equivalences
Useful to simplify complex composite propositions
p ∧ T ≡ p
p ∨ F ≡ p
p ∨ T ≡ T
p ∧ F ≡ F
p ∨ p ≡ p
p ∧ p ≡ p
¬(¬p) ≡ p Identity laws
Domination laws
Idempotent laws
Double negation
Basic Logical Equivalences
∧ and ∨ are commutative, associative, and distributive
p ∧ q ≡ q ∧ p
Commutative laws
p ∨ q ≡ q ∨ p
(p ∧ q) ∧ r ≡ p ∧ (q ∧ r )
Associative laws
(p ∨ q) ∨ r ≡ p ∨ (q ∨ r)
p ∨ (q ∧ r) ≡ (p ∨ q ) ∧ (p ∨ r ) Distributive laws
p ∧ (q ∨ r) ≡ (p ∧ q ) ∨ (p ∧ r )
Associative laws make the following well defined
• p1 ∧ p2 ∧ ... ∧ pn T if all are T
• p1 ∨ p2 ∨ ... ∨ pn T if one is T Basic Logical Equivalences
¬(p ∧ q) ≡ ¬p ∨ ¬q
¬(p ∨ q) ≡ ¬p ∧ ¬q
p ∨ (p ∧ q) ≡ p p ∧ (p ∨ q) ≡ p
p ∨ ¬p ≡ T
p ∧ ¬p ≡ F
De Morgan’s laws
Absorption laws
Negation laws
Generalized De Morgan’s theorem
• ¬(p1 ∧ p2 ∧ ... ∧ pn) ≡ ¬p1 ∨ ¬p2 ∨ ... ∨ ¬pn
“it is not the case that all are T” ≡ “one is F”
• ¬(p1 ∨ p2 ∨ ... ∨ pn) ≡ ¬p1 ∧ ¬p2 ∧ ... ∧ ¬pn
“it is not the case that one is T” ≡ “all are F”
Basic Logical Equivalences
Equivalences involving implication & biconditional in terms of other connectives p → q ≡ ¬p ∨ q
p → q ≡ ¬q → ¬p (contrapositive)
p ↔ q ≡ (p → q) ∧ (q → p)
Basic Logical Equivalences
Additional logical equivalences can be derived, combining other
logical equivalences that have already been established
(Example) Show that (p ∧ q) → (p ∨ q) ≡ T i.e., “(p ∧ q) → (p ∨ q) is a tautology”
(p ∧ q) → (p ∨ q) ≡ ¬(p ∧ q) ∨ (p ∨ q) p → q ≡ ¬p ∨ q
≡
(¬p ∨ ¬q) ∨ (p ∨ q)
De Morgan
≡
¬p ∨ ¬q ∨ p ∨ q Associative law
≡
(¬p ∨ p) ∨ (¬q ∨ q)
Associative law
≡
T ∨ T
Negation laws
≡
T Domination law
Quantifiers
Universe of discourse: The collection of values that a variable can
take
Universal quantifier, ∀: ∀xP(x), “for all x P(x)” “P(x) is T for all values of x in the universe of discourse”
(Example) Universe of discourse consists of all integers
∀x(x + 1 > x) is T ∀x(x2 > x) is F (P(0) is F, counterexample)
Existential quantification, ∃: ∃xP(x), “there is an x such that P(x)” “There exists an element x in the universe of discourse such that
P(x) is T”
(Example) Universe of discourse consists of all integers
∃x(x > 3) is T (P(4) is T for example)
Negating Quantifiers
¬∀xP(x) ≡ ∃x¬P(x)
“it is not the case that P(x) is T for all x”
≡ “there exists x such that P(x) is F”
(Example) Negation of “all Americans eat cheeseburgers”
“there is an American who do not eat cheeseburgers”
¬∃xP(x) ≡ ∀x¬P(x)
“it is not the case that there exists x such that P(x) is T”
≡ “P(x) is F for all x”
(Example) Negation of “there is an honest politician”
“all politicians are dishonest”
These equivalences are just De Morgan’s theorems: • ¬(P(x1) ∧ P(x2) ∧ ... ∧ P(xn)) ≡ ¬P(x1) ∨ ¬P(x2) ∨ ... ∨ ¬P(xn)
• ¬(P(x1) ∨ P(x2) ∨ ... ∨ P(xn)) ≡ ¬P(x1) ∧ ¬P(x2) ∧ ... ∧ ¬P(xn)
Nesting Quantifiers
1. ∀x∀yP(x,y): “P(x,y) is T for every pair x,y”
2. ∃x∃yP(x,y): “there is a pair for which P(x,y) is T”
3. ∀x∃yP(x,y): “for every x there is a y for which P(x,y) is T”
4. ∃x∀yP(x,y): “there is a x, for which P(x,y) is T for all y”
(Example) P(x, y) = “x relies upon y” ∀x(∃yP(x,y)): “everyone has someone to rely on”
∃x(∀yP(x,y)): “there is a needy person who relies on everybody”
Proof
Examples of Axioms
Axioms of Euclidean geometry (~300BC)
1. Given two distinct points, one can draw one and only one line segment connecting these
points. 2. Given two distinct points, one can draw one and only one circle centered at the first point
and passing through the second one. 3. Any two right angles are equal. 4. Every line segment can be infinitely continued in either direction. 5. For any given line l and a point P not on that line one can draw one and only one line l1
through P that will not intersect the original line l .
Axioms of Riemann’s geometry (1854)
Euclid’s axioms 1-4
5’. Given a straight line and a point not on the line, there are no straight lines through the
point parallel to the original line.
Axioms in Newtonian mechanics
1. An object at rest tends to stay at rest and an object in motion tends to stay in motion with
the same speed and in the same direction unless acted upon by an unbalanced force.
2. The acceleration of an object as produced by a net force is directly proportional to the
magnitude of the net force, in the same direction as the net force, and inversely
proportional to the mass of the object.
3. For every action, there is an equal and opposite reaction.
Rules of Inference
Rule of Inference
p
.
∴p∨q
p ∧ q .
∴p
p
q
.
∴ p ∧ q
p
p → q .
∴q
¬q
p → q .
∴¬p
Tautology
p → (p ∨ q)
Name
Addition
(p ∧ q) → p
Simplification
(p) ∧ (q) → p ∧ q
Conjunction
[p ∧ (p → q)] → q
Modus ponens
[¬q ∧ (p → q)] → ¬p Modus tollens
Rules of Inference
Rule of Inference
Tautology
p → q
[(p → q) ∧ (q → r)] → (p → r)
q → r .
∴p → r
p ∨ q
[(p ∨ q) ∧ ¬p] → q
¬p
.
∴q
p ∨ q
[(p ∨ q) ∧ (¬p ∨ r)] → (q ∨ r)
¬p ∨ r .
∴q ∨ r
Name
Hypothetical
syllogism
Disjunctive
syllogism
Resolution
Rules of Inference for Quantified Statements
Rule of Inference
∀xP(x)
.
∴P(c) for a particular c
P(c) for an arbitrary c ∴∀xP(x)
∃xP(x)
.
∴P(c) for some c
P(c) for some c ∴∃xP(x)
Name
Universal instantiation
Universal generalization
Existential instantiation
Existential generalization
Methods of Proving Theorems
Proving implications p → q:
Direct proof: Assume p is T, and use rules of inference to
prove that q is T
Indirect proof: Prove its contrapositive; assume ¬q, and
prove ¬p
Proof by cases: Prove (p1 ∨ p2) → q by proving (p1 → q)
and (p1 → q)
• Based on [(p1 ∨ p2) → q] ≡ [(p1 → q) ∧ (p2 → q)]
Sample Direct Proof
Proof by Contradiction
Proving p:
• Prove ¬p → (q ∧ ¬q)
• Since (q ∧ ¬q) ≡ F (contradiction, by negation law), ¬p → F
• This is only T, if ¬p = F (i.e., p = T)
(Example) Prove that p: “√2 is irrational”
• Assume ¬p: “√2 is rational (i.e., √2 = a/b, where integers a & b
have no common factors)”.
• It follows that 2 = a2/b2, hence 2b2 = a2. This means a2 is even,
which implies a is even. Furthermore, since a is even, a = 2c
for some integer c. Thus 2b2 = 4c2, so b2 = 2c2. This means b2 is
even, which implies b is even.
• It has been shown that ¬p → “√2 = a/b, where integers a & b
have no common factors” ∧ “2 divides both a & b”.
Existence Proofs
Existence proof: Proving ∃xP(x)
• Constructive proof: Find an element a such that P(a) is T
• Nonconstructive proof: For example, proof by contradiction
— prove that its negation leads to contradiction