CPSC 125 Ch 1 sec 4
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

CPSC 125 Ch 1 sec 4

on

  • 1,464 views

 

Statistics

Views

Total Views
1,464
Views on SlideShare
1,461
Embed Views
3

Actions

Likes
0
Downloads
24
Comments
0

1 Embed 3

http://www.slideshare.net 3

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

CPSC 125 Ch 1 sec 4 Presentation Transcript

  • 1. Formal Logic Mathematical Structures for Computer Science Chapter 1 Copyright © 2006 W.H. Freeman & Co. MSCS Slides Formal Logic
  • 2. Predicate Logic ●  Similar to propositional logic for solving arguments, build from quantifiers, predicates and logical connectives. ●  A valid argument for predicate logic need not be a tautology. ●  The meaning and the structure of the quantifiers and predicates determines the interpretation and the validity of the arguments ●  Basic approach to prove arguments: ■  Strip of quantifiers ■  Manipulate the unquantified wffs ■  Reinsert the quantifiers Four new inference rules Two rules to strip the qualifiers Two rules to reinsert the qualifiers ●  Note to remember: P(x) could be (∀y) (∀z) Q(x,y,z) Section 1.4 Predicate Logic 1
  • 3. Inference Rules From Can Derive Name / Restrictions on Use Abbreviation (∀x)P(x) P(t) where t is a Universal If t is a variable, it must variable or constant Instantiation- ui not fall within the scope symbol of a quantifier for t (∃x)P(x) P(t) where t is a Existential Must be the first rule variable or constant Instantiation- ei used that introduces t symbol not previously used in a proof sequence P(x) (∀x)P(x) Universal P(x) has not been Generalization- ug deduced from any hypotheses in which x is a free variable nor has P (x) been deduced by ei from any wff in which x is a free variable P(x) or P(a) (∃x)P(x) Existential To go from P(a) to (∃x)P Generalization- eg (x), x must not appear in P(a) Section 1.4 Predicate Logic 2
  • 4. Examples: Proofs using Predicate Logic ●  Prove the following argument: ■  All flowers are plants. Sunflower is a flower. Therefore, sunflower is a plant. ■  P(x) is “ x is a plant” ■  a is a constant symbol (Sunflower) ■  Q(x) is “x is a flower” ●  The argument is (∀x)[Q(x) → P(x)] Λ Q(a) → P(a) ●  The proof sequence is as follows: 1.  (∀x)[Q(x) → P(x)] hyp 2.  Q(a) hyp 3.  Q(a) → P(a) 1, ui 4.  P(a) 2, 3, mp Section 1.4 Predicate Logic 3
  • 5. Examples: Proofs using Predicate Logic ●  Prove the argument (∀x)[P(x) → Q(x)] Λ [Q(y)]ʹ′ → [P(y)]ʹ′ ●  Proof sequence: 1.  (∀x)[P(x) → Q(x)] hyp 2.  [Q(y)]ʹ′ hyp 3.  P(y) → Q(y) 1, ui 4.  [P(y)]ʹ′ 2, 3, mt ●  Prove the argument (∀x)P(x) → (∃x)P(x) ●  Proof sequence: 1.  (∀x)P(x) hyp 2.  P(x) 1, ui 3.  (∃x)P(x) 2, eg Section 1.4 Predicate Logic 4
  • 6. Examples: Proofs using Predicate Logic ●  Prove the argument (∀x)[P(x) → Q(x)] Λ (∀x)P(x) → (∀x)Q(x) ●  Proof sequence: 1.  (∀x)[P(x) → Q(x)] hyp 2.  (∀x)P(x) hyp 3.  P(x) → Q(x) 1, ui 4.  P(x) 2, ui : no restriction on ui about reusing a name 5.  Q(x) 3, 4, mp 6.  (∀x)Q(x) 5, ug ●  Note: step 6 is legitimate since x is not a free variable in any hypothesis nor was ei used before Section 1.4 Predicate Logic 5
  • 7. Examples: Proofs using Predicate Logic ●  Prove the argument (∀x)[P(x) Λ Q(x)] → (∀x)P(x) Λ (∀x)Q(x) ●  Proof sequence: 1.  (∀x)[P(x) Λ Q(x)] hyp 2.  P(x) Λ Q(x) 1, ui 3.  P(x) 2, sim 4.  Q(x) 2, sim 5.  (∀x)P(x) 3, ug 6.  (∀x)Q(x) 4, ug 7.  (∀x)P(x) Λ (∀x)Q(x) 5, 6, con Section 1.4 Predicate Logic 6
  • 8. Examples: Proofs using Predicate Logic ●  Prove the argument (∀y)[P(x) → Q(x,y)] → [P(x) → (∀y)Q(x,y)] ●  Using the deduction method, we can derive (∀y)[P(x) → Q(x,y)] Λ P(x) → (∀y)Q(x,y) ●  Proof sequence: 1.  (∀y)[P(x) → Q(x,y)] hyp 2.  P(x) hyp 3.  P(x) → Q(x,y) 1, ui 4.  Q(x,y) 2, 3, mp 5.  (∀y)Q(x,y) 4, ug Section 1.4 Predicate Logic 7
  • 9. Temporary hypotheses ●  A temporary hypothesis can be inserted into a proof sequence. If T is inserted as a temporary hypothesis and eventually W is deduced from T and other hypotheses, then the wff T → W has been deduced from other hypotheses and can be reinserted into the proof sequence ●  Prove the argument [P(x) → (∀y)Q(x,y)] → (∀y)[P(x) → Q(x,y)] ●  Proof sequence: 1.  P(x) → (∀y)Q(x,y) hyp 2.  P(x) temporary hypothesis 3.  (∀y)Q(x,y) 1, 2, mp 4.  Q(x,y) 3, ui 5.  P(x) → Q(x,y) temp. hyp discharged 6.  (∀y)[P(x) → Q(x,y)] 5, ug Section 1.4 Predicate Logic 8
  • 10. More Examples ●  Prove the sequence [(∃x)A(x)]ʹ′ ⇔ (∀x)[A(x)]ʹ′ ■  To prove equivalence, implication in each direction should be proved ●  Proof sequence for [(∃x)A(x)]ʹ′ → (∀x)[A(x)]ʹ′ 1.  [(∃x)A(x)]ʹ′ hyp 2.  A(x) temp. hyp 3.  (∃x)A(x) 2, eg 4.  A(x) → (∃x)A(x) temp. hyp discharged 5.  [A(x)]ʹ′ 1, 4, mt 6.  (∀x)[A(x)]ʹ′ 5, ug ●  Proof sequence for (∀x)[A(x)]ʹ′ → [(∃x)A(x)]ʹ′ 1.  (∀x)[A(x)]ʹ′ hyp 2.  (∃x)A(x) temp. hyp 3.  A(a) 2, ei 4.  [A(a)]ʹ′ 1, ui 5.  [(∀x)[A(x)]ʹ′]ʹ′ 3, 4, inc 6.  (∃x)A(x) → [(∀x)[A(x)]ʹ′]ʹ′ temp. discharged 7.  [((∀x)[A(x)]ʹ′)ʹ′]ʹ′ 1, dn 8.  [(∃x)A(x)]ʹ′ 6, 7, mt Section 1.4 Predicate Logic 9
  • 11. Proving Verbal arguments ●  Every crocodile is bigger than every alligator. Sam is a crocodile. But there is a snake, and Sam isn’t bigger than that snake. Therefore, something is not an alligator. ■  Use C(x): x is a crocodile; A(x): x is an alligator, B(x,y): x is bigger than y, s is a constant (Sam), S(x): x is a Snake ●  Hence prove argument (∀x) (∀y)[C(x) Λ A(y) → B(x,y)] Λ C(s) Λ (∃x)(S(x) Λ [B(s,x)]ʹ′) → (∃x)[A(x)] 1.  (∀x) (∀y)[C(x) Λ A(x) → B(x,y)] hyp 2.  C(s) hyp 3.  (∃x)(S(x) Λ [B(s,x)]ʹ′) hyp 4.  (∀y)[C(s) Λ A(y) → B(s,y)] 1, ui 5.  S(a) Λ [B(s,a)]ʹ′) 3, ei 6.  C(s) Λ A(a) → B(s,a) 4, ui 7.  [B(s,a)]ʹ′ 5, sim 8.  [C(s) Λ A(a)]ʹ′ 6, 7, mt 9.  [C(s)]ʹ′ V [A(a)]ʹ′ 9, De Morgan 10.  [[C(s)]ʹ′]ʹ′ 2, dn 11.  [A(a)]ʹ′ 9, 10, ds 12.  (∃x)[A(x)]ʹ′ 11, eg Section 1.4 Predicate Logic 10
  • 12. Class Exercise ●  Prove the argument (∀x)[(B(x) V C(x)) → A(x)] → (∀x)[B(x) → A(x)] Proof sequence: 1.  (∀x)[(B(x) V C(x)) → A(x)] hyp 2.  (B(x) V C(x)) → A(x) 1, ui 3.  B(x) temp. hyp 4.  B(x) V C(x) 3, add 5.  A(x) 2, 4, mp 6.  B(x) → A(x) temp. hyp discharged 7.  (∀x)[B(x) → A(x)] 6, ug Section 1.4 Predicate Logic 11
  • 13. Class exercise ●  Every ambassador speaks only to diplomats, and some ambassadors speak to someone. Therefore, there is a diplomat. ●  Use A(x): x is an ambassador; S(x,y): x speaks to y; D(x): x is a diplomat Prove the argument (∀x) (∀y)[(A(x) Λ S(x,y)) → D(y)] Λ (∃x)(∃y)(A(x) Λ S(x,y)) → (∃x)D(x) Proof Sequence: 1.  (∀x) (∀y)[(A(x) Λ S(x,y)) → D(y)] hyp 2.  (∃x)(∃y)(A(x) Λ S(x,y)) hyp 3.  (∀y)((A(a) Λ S(a,y)) → D(y)) 1, ui 4.  (∃y)(A(a) Λ S(a,y)) 2, ei 5.  A(a) Λ S(a,b) 4, ei 6.  (A(a) Λ S(a,b)) → D(b) 3, ui 7.  D(b) 5, 6, mp 8.  (∃x)D(x) 7, eg Section 1.4 Predicate Logic 12