The Foundat ions: Logic and The Foundat ions: Logic and The Foundat - - PDF document

the foundat ions logic and the foundat ions logic and the
SMART_READER_LITE
LIVE PREVIEW

The Foundat ions: Logic and The Foundat ions: Logic and The Foundat - - PDF document

The Foundat ions: Logic and The Foundat ions: Logic and The Foundat ions: Logic and Proof , Set s, and Funct ions Proof , Set s, and Funct ions Proof , Set s, and Funct ions 1 Out line Logic Proposit ional Equivalences Predicat es


slide-1
SLIDE 1

1

The Foundat ions: Logic and Proof , Set s, and Funct ions The Foundat ions: Logic and The Foundat ions: Logic and Proof , Set s, and Funct ions Proof , Set s, and Funct ions

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 2

Out line

‧Logic ‧Proposit ional Equivalences ‧Predicat es and Quant if iers ‧Met hods of Proof ‧Set s and Set Operat ions ‧Funct ions

slide-2
SLIDE 2

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 3

Part 1. Foundat ion of Logic

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 4

Mat hemat ical Logic

Mat hemat ical Logic is a t ool f or working wit h complicat ed compound st at ement s. I t includes: ‧A language f or expressing t hem. ‧A concise not at ion f or writ ing t hem. ‧A met hodology f or obj ect ively reasoning about t heir t rut h or f alsit y. ‧I t is t he f oundat ion f or expressing f ormal proof s in all branches of mat hemat ics.

slide-3
SLIDE 3

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 5

Foundat ions of Logic: Overview

  • Proposit ional logic (§

1.1-1.2):

– Basic def init ions. (§ 1.1) – Equivalence rules & derivat ions. (§ 1.2)

  • Predicat e logic (§

1.3-1.4)

– Predicat es. – Quant if ied predicat e expressions. – Equivalences & derivat ions.

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 6

Proposit ional Logic

Proposit ional Logic is t he logic of compound st at ement s built f rom simpler st at ement s using so-called Boolean connect ives. Some applicat ions in comput er science:

  • Design of digit al elect ronic circuit s.
  • Expressing condit ions in programs.
  • Queries t o dat abases & search engines.

Topic #1 – Propositional Logic

slide-4
SLIDE 4

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 7

Proposit ions

  • Proposit ions: t he basic building blocks of

logic

  • Proposit ion (St at ement 、命題、敘述):a

declarat ive sent ence t hat is eit her t rue or f alse, but not bot h.

  • Ex:

– Washingt on, D.C., is t he capit al of t he USA. (t r ue) – Toront o is t he capit al of Canada. (f alse) – 1 + 1 = 2. (t r ue) – 2 + 2 = 3. (f alse)

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 8

Proposit ions (Cont .)

  • Example: A st at ement cannot be t rue or

f alse unless it is declarat ive. This excludes commands and quest ions.

– Read t his caref ully. – What t ime is it ?

  • Declarat ions about semant ic t okens of non-

const ant value are NOT proposit ions.

– x + 1 = 2. – x + y = z.

slide-5
SLIDE 5

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 9

Proposit ions (Cont .)

‧The ar ea of logic t hat deals wit h pr oposit ions is called t he proposit ional calculus (or pr oposit ional logic).

–f ir st developed syst emat ically by t he Gr eek philosopher Ar ist ot le mor e t han 2300 year s ago.

‧Let t er s ar e used t o denot e proposit ions.

–p:t he weat her is f ine t oday.

‧The t r ut h value of a pr oposit ion is t r ue, denot ed by T, if it is a t r ue proposit ion and f alse, denot ed by F, if it is a f alse pr oposit ion. ‧Compound pr oposit ions:f or med f rom exist ing pr oposit ions using logical oper at or s or connect ives.

–p and q, p or q

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 10

Negat ion, Conj unct ion, Disj unct ion, and Exclusive or

‧Tr ut h t able (真值表):displays t he r elat ionships bet ween t he t r ut h values of proposit ions. ‧negat ion(¬)/ conj unct ion(∧)/ disj unct ion(∨) / exclusive or(⊕)

T F F T ¬p p T F F T T F T F F F F F T q T p T T p∨q p∧q

T F T T T F F F F T q T p F p⊕q

slide-6
SLIDE 6

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 11

Nat ural Language is Ambiguous

  • Not e t hat English “or”

can be ambiguous r egar ding t he “bot h” case!

– “Pat is a singer or P at is a wr it er .” - ∨ – “Pat is a man or P at is a woman.” - ⊕

  • Need cont ext t o

disambiguat e t he meaning!

  • For t his class, assume

“or ” means inclusive.

p q p "or" q F F F F T T T F T T T ?

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 12

I mplicat ions

‧I mplicat ion (→) is somet imes called a condit ional st at ement :

–if p, t hen q –p implies q –q when p –q f ollows f r om p –p only if q –p is suf f icient f or q –p is a suf f icient condit ion f or q –q is necessar y f or p –q is a necessar y condit ion f or p

‧p:hypot hesis, ant ecedent or pr emise ‧q: conclusion or consequence F F T T T F T F F T q T p T p→q

slide-7
SLIDE 7

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 13

I mplicat ions (Cont .)

‧Ex: The pledge many polit icians make when r unning f or of f ice is: “I f I am elect ed, t hen I will lower t axes.”

–I f t he polit ician is elect ed, vot er s would expect t his polit ician t o lower t axes. –I f t he polit ician is not elect ed, t hen vot er s will not have any expect at ion t hat t his per son will lower t axes. –I t is only when t he polit ician is elect ed but does not lower t axes t hat vot er s can say t hat t he polit ician has br oken t he campaign pledge.

‧“p only if q” is equivalent t o “if p t hen q.”

–p can not be t r ue when q is not t r ue –The st at ement is f alse if p is t r ue, but q is f alse.

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 14

I mplicat ions (Cont .)

‧Ex: The implicat ion “I f t oday is Fr iday, t hen 2 + 3 = 5.” is t r ue f r om t he def init ion of implicat ion, since it s conclusion is t r ue. (The t r ut h value of t he hypot hesis does not mat t er t hen.) ‧Ex: The implicat ion “I f t oday is Fr iday, t hen 2 + 3 = 6.” is t r ue ever y day except Fr iday, even t hough 2 + 3 = 6 is f alse.

slide-8
SLIDE 8

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 15

Converse, Cont raposit ive, and I nverse

‧The pr oposit ion q→p is t he converse of p→q. ‧The cont r aposit ive of p→q is t he pr oposit ion ¬q→¬p.

–The cont r aposit ive has t he same t r ut h value as p→q.

‧The pr oposit ion ¬p→¬q is t he inver se of p→q. ‧When t wo compound pr oposit ions always have t he same t r ut h value, we call t hem equivalent.

–An implicat ion and it s cont r aposit ive ar e equivalent . –The conver se and t he inver se of an implicat ion ar e also equivalent .

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 16

Biocondit ional

‧Bicondit ional p↔q:

–p if and only if (if f ) q –p is necessar y and suf f icient f or q –I f p t hen q, and conver sely

‧p↔q has exact ly t he same t r ut h value as (p→q)∧(q→p). ‧The bicondit ional p↔q is t r ue pr ecisely when bot h t he implicat ions p→q and q→p ar e t r ue.

–“You can t ake t he f light if f you buy a t icket .”

F F T F T F T F F T q T p T p↔q

slide-9
SLIDE 9

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 17

Boolean Operat ions Summary

  • We have seen 1 unary operat or (out of t he 4

possible) and 5 binary operat ors (out of t he 16 possible). Their t rut h t ables are below. p q ¬p p∧q p∨q p⊕ q p→ q p↔ q F F T F F F T T F T T F T T T F T F F F T T F F T T F T T F T T

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 18

Some Alt er nat ive Not at ions

Name:

not and or xor implies iff

Propositional logic:

¬ ∧ ∨ ⊕ → ↔

Boolean algebra:

p

pq + ⊕

C/C++/Java (wordwise): ! && || !=

==

C/C++/Java (bitwise):

~ & | ^

Logic gates:

slide-10
SLIDE 10

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 19

Precedence of Logical Operat ors

Operat or Precedence ¬ 1 ∧ 2 ∨ 3 → 4 ↔ 5

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 20

Translat ing English Sent ences

  • Translat ing English sent ences int o logical

expressions removes t he ambiguit y.

  • Ex: “You can access t he I nt ernet f rom

campus only if you are a comput er science maj or or you are not a f reshman.”

– Let a be “You can access t he I nt er net f r om campus” – Let c be “You ar e a comput er science maj or” – Let f be “You ar e a f reshman” – Then, t his sent ence can be r epr esent ed as a → (c ∨ ¬f ).

slide-11
SLIDE 11

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 21

A Logic Puzzle

  • A f at her t ells his t wo childr en, a boy and a gir l, t o

play in t heir backyar d wit hout get t ing dir t y. However , while playing, bot h children get mud on t heir f oreheads.

  • When t he childr en st op playing, t he f at her says

“At least one of you has a muddy f orehead,” and t hen asks t he childr en t o answer “Yes” or “No” t o t he quest ion: “Do you know whet her you have a muddy f orehead?” The f at her asks t his quest ion t wice. What will t he childr en answer each t ime t his quest ion is asked?

  • Assume t hat a child can see whet her his or her

sibling has a muddy f orehead, but can not see his

  • r her f or ehead.
  • Assume t hat bot h childr en ar e honest and t hat

t he childr en answer each quest ion simult aneously.

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 22

Logic and Bit Operat ions

  • A bit is a binary (base 2) digit : 0 or 1.
  • Bit s may be used t o represent t rut h values.
  • By convent ion:

0 represent s “f alse”; 1 represent s “t rue”.

  • Boolean algebra is like ordinary algebra

except t hat variables st and f or bit s, + means “or”, and mult iplicat ion means “and”. – See chapt er 10 f or more det ails.

Topic #2 – Bits

slide-12
SLIDE 12

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 23

Proposit ional Equivalences

Two synt act ically (i.e., t ext ually) dif f erent compound proposit ions may be semant ically ident ical (i.e., have t he same meaning). We call t hem equivalent . Lear n:

  • Various equivalence rules or laws.
  • How t o prove equivalences using

symbolic der ivat ions.

Topic #1.1 – Propositional Logic: Equivalences

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 24

Taut ologies and Cont radict ions

  • A t aut ology is a compound proposit ion

t hat is true no mat t er what t he t rut h values of it s at omic pr oposit ions are!

– Ex. p ∨ ¬p [What is it s t rut h t able?]

  • A cont radict ion is a compound

proposit ion t hat is always f alse

– Ex. p ∧ ¬p [Trut h t able?]

  • Ot her compound props. are

cont ingencies.

Topic #1.1 – Propositional Logic: Equivalences

slide-13
SLIDE 13

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 25

Logical Equivalence

  • Compound proposit ion p is logically

equivalent t o compound proposit ion q, writ t en p⇔q or p≡q, I FF t he compound proposit ion p↔q is a t aut ology.

  • Compound proposit ions p and q are

logically equivalent t o each ot her I FF p and q cont ain t he same t rut h values as each ot her in all rows of t heir t rut h t ables.

Topic #1.1 – Propositional Logic: Equivalences

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 26

  • Ex. Prove t hat p∨q ⇔ ¬(¬p ∧ ¬q).

p q p p∨ ∨q q ¬ ¬p p ¬ ¬q q ¬ ¬p p ∧ ∧ ¬ ¬q q ¬ ¬( (¬ ¬p p ∧ ∧ ¬ ¬q q) ) F F F T T F T T

Proving Equivalence via Trut h Tables

F T T T T T T T T T F F F F F F F F T T

Topic #1.1 – Propositional Logic: Equivalences

slide-14
SLIDE 14

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 27

Equivalence Laws

  • These are similar t o t he ar it hmet ic

ident it ies you may have learned in algebra, but f or proposit ional equivalences inst ead.

  • They pr ovide a pat t ern or t emplat e

t hat can be used t o mat ch all or part

  • f a much more complicat ed

proposit ion and t o f ind an equivalence f or it .

Topic #1.1 – Propositional Logic: Equivalences

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 28

Equivalence Laws - Examples

  • I dent it y: p∧T ⇔ p p∨F ⇔ p
  • Dominat ion: p∨T ⇔ T p∧F ⇔ F
  • I dempot ent : p∨p ⇔ p p∧p ⇔ p
  • Double negat ion: ¬¬p ⇔ p
  • Commut at ive: p∨q ⇔ q∨p p∧q ⇔ q∧p
  • Associat ive: (p∨q)∨r ⇔ p∨(q∨r)

(p∧q)∧r ⇔ p∧(q∧r)

Topic #1.1 – Propositional Logic: Equivalences

slide-15
SLIDE 15

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 29

More Equivalence Laws

  • Dist ribut ive: p∨(q∧r) ⇔ (p∨q)∧(p∨r)

p∧(q∨r) ⇔ (p∧q)∨(p∧r)

  • De Morgan’s:

¬(p∧q) ⇔ ¬p ∨ ¬q ¬(p∨q) ⇔ ¬p ∧ ¬q

  • Trivial t aut ology/ cont radict ion:

p ∨ ¬p ⇔ T p ∧ ¬p ⇔ F

Topic #1.1 – Propositional Logic: Equivalences

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 30

Def ining Operat ors via Equivalences

Using equivalences, we can def ine

  • perat ors in t er ms of ot her
  • perat ors.
  • Exclusive or: p⊕q ⇔ (p∨q)∧¬(p∧q)

p⊕q ⇔ (p∧¬q)∨(q∧¬p)

  • I mplies: p→q ⇔ ¬p ∨ q
  • Bicondit ional: p↔q ⇔ (p→q) ∧ (q→p)

p↔q ⇔ ¬(p⊕q)

Topic #1.1 – Propositional Logic: Equivalences

slide-16
SLIDE 16

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 31

‧Ex: Show t hat ¬(p∨(¬p∧q)) and ¬p∧¬q are logically equivalent .

( ( )) ( ) by the 2nd law of De Morgan's Law ( ) from the first law of De Morgan ( ) ( ) ( ) p p q p p q p p q p p q p p p q ¬ ∨ ¬ ∧ ≡ ¬ ∧ ¬ ¬ ∧ ≡ ¬ ∧ ¬¬ ∨ ¬ ≡ ¬ ∧ ∨ ¬ ≡ ¬ ∧ ∨ ¬ ∧ ¬ from the second distribute law F ( ) p q p q ≡ ∨ ¬ ∧ ¬ ≡ ¬ ∧ ¬

Symbolic Derivat ions

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 32

‧Ex: Show t hat p∧q→p∨q is a t aut ology.

( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) p q p q p q p q p q p q p q p q p p q q T q q ∧ → ∨ ≡ ¬ ∧ ∨ ∨ ≡ ¬ ∨ ¬ ∨ ∨ ≡ ¬ ∨ ¬ ∨ ∨ ≡ ¬ ∨ ∨ ¬ ∨ ≡ ∨ ¬ ∨ T q T ≡ ∨ ≡

Symbolic Derivat ions (Cont .)

slide-17
SLIDE 17

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 33

Predicat e Logic

  • Predicat e logic is an ext ension of

proposit ional logic t hat per mit s concisely reasoning about whole classes of ent it ies.

  • Proposit ional logic t reat s simple

proposit ions (sent ences) as at omic ent it ies.

  • I n cont rast , predicat e logic

dist inguishes t he subj ect of a sent ence f rom it s predicat e.

– Remember t hese English grammar t erms?

Topic #3 – Predicate Logic

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 34

Subj ect s and Predicat es

  • I n t he sent ence “The dog is sleeping”:

– The phr ase “t he dog” denot es t he subj ect - t he obj ect or ent it y t hat t he sent ence is about . – The phr ase “is sleeping” denot es t he pr edicat e- a pr oper t y t hat is t r ue of t he subj ect .

  • I n predicat e logic, a predicat e is modeled

as a f unct ion P(·) f rom obj ect s t o proposit ions.

– P(x) = “x is sleeping” (where x is any obj ect ).

Topic #3 – Predicate Logic

slide-18
SLIDE 18

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 35

More About Predicat es

  • Convent ion: Lowercase variables x, y, z...

denot e obj ect s/ ent it ies; uppercase variables P, Q, R… denot e proposit ional f unct ions (predicat es).

  • Keep in mind t hat t he result of applying a

predicat e P t o a specif ied obj ect x is t he proposit ion P(x). But t he predicat e P itself (e.g. P=“is sleeping”) is not a proposit ion (not a complet e sent ence).

– E.g. if P(x) = “x is a prime number ”, P(3) is t he pr oposit ion “3 is a pr ime number .”

Topic #3 – Predicate Logic

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 36

Proposit ional Funct ions

  • Predicat e logic generalizes t he

grammat ical not ion of a predicat e t o also include proposit ional f unct ions of any number of argument s, each of which may t ake any grammat ical role t hat a noun can t ake.

– E.g. let P(x,y,z) = “x gave y t he grade z”, t hen if x=“Mike”, y=“Mary”, z=“A”, t hen P(x,y,z) = “Mike gave Mary t he grade A.”

Topic #3 – Predicate Logic

slide-19
SLIDE 19

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 37

Universes of Discourse (U.D.s)

  • The power of dist inguishing obj ect s f rom

predicat es is t hat it let s you st at e t hings about many obj ect s at once.

  • E.g., let P(x)=“x+1>

x”. We can t hen say, “For any number x, P(x) is t rue” inst ead of (0+1> 0) ∧ (1+1> 1) ∧ (2+1> 2) ∧ ...

  • The collect ion of values t hat a variable x

can t ake is called x’s universe of discourse.

Topic #3 – Predicate Logic

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 38

Quant if ier Expressions

  • Quant if iers provide a not at ion t hat allows

us t o quant if y (count ) how many obj ect s in t he univ. of disc. sat isf y a given predicat e.

  • “∀” is t he FOR∀LL or universal quant if ier.

∀x P(x) means f or all x in t he u.d., P holds.

  • “∃” is t he ∃XI STS or exist ent ial quant if ier.

∃x P(x) means t here exist s an x in t he u.d. (t hat is, 1 or more) such t hat P(x) is t rue.

Topic #3 – Predicate Logic

slide-20
SLIDE 20

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 39

The Univer sal Quant if ier ∀

  • Example:

Let t he u.d. of x be parking spaces at NTHU. Let P(x) be t he predicat e “x is f ull.” Then t he univer sal quant if icat ion of P(x), ∀x P(x), is t he proposit ion:

– “All parking spaces at NTHU are f ull.” – i.e., “Every parking space at NTHU is f ull.” – i.e., “For each parking space at NTHU, t hat space is f ull.”

Topic #3 – Predicate Logic

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 40

The Exist ent ial Quant if ier ∃

  • Example:

Let t he u.d. of x be parking spaces at NTHU. Let P(x) be t he predicat e “x is f ull.” Then t he exist ent ial quant if icat ion of P(x), ∃x P(x), is t he proposit ion:

– “Some parking space at NTHU is f ull.” – “Ther e is a parking space at NTHU t hat is f ull.” – “At least one parking space at NTHU is f ull.”

Topic #3 – Predicate Logic

slide-21
SLIDE 21

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 41

Quant if ier Equivalence Laws

  • Def init ions of quant if iers: I f

u.d.=a,b,c,… ∀x P(x) ⇔ P(a) ∧ P(b) ∧ P(c) ∧ … ∃x P(x) ⇔ P(a) ∨ P(b) ∨ P(c) ∨ …

  • From t hose, we can pr ove t he laws:

∀x P(x) ⇔ ¬∃x ¬P(x) ∃x P(x) ⇔ ¬∀x ¬P(x)

  • Which pr oposit ional equivalence laws

can be used t o prove t his?

Topic #3 – Predicate Logic

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 42

More Equivalence Laws

  • ∀x ∀y P(x,y) ⇔ ∀y ∀x P(x,y)

∃x ∃y P(x,y) ⇔ ∃y ∃x P(x,y)

  • ∀x (P(x) ∧ Q(x)) ⇔ (∀x P(x)) ∧ (∀x Q(x))

∃x (P(x) ∨ Q(x)) ⇔ (∃x P(x)) ∨ (∃x Q(x))

  • Exercise:

See if you can prove t hese your self .

– What proposit ional equivalences did you use?

Topic #3 – Predicate Logic

slide-22
SLIDE 22

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 43

Free and Bound Variables

  • An expression like P(x) is said t o have

a f ree variable x (meaning, x is undef ined).

  • A quant if ier (eit her ∀ or ∃) oper at es
  • n an expression having one or more

f ree variables, and binds one or more

  • f t hose var iables, t o produce an

expression having one or more bound variables.

Topic #3 – Predicate Logic

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 44

Example of Binding

  • P(x,y) has 2 f ree variables, x and y.
  • ∀x P(x,y) has 1 f ree variable, and one

bound variable. [Which is which?]

  • “P(x), where x=3” is anot her way t o bind x.
  • An expression wit h zero f ree variables is a

bona-f ide (act ual) proposit ion.

  • An expression wit h one or more f ree

variables is st ill only a predicat e: ∀x P(x,y)

Topic #3 – Predicate Logic

slide-23
SLIDE 23

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 45

Nest ing of Quant if iers

Example: Let t he u.d. of x & y be people. Let L(x,y)=“x likes y” (a predicat e w. 2 f .v.’s) Then ∃y L(x,y) = “There is someone whom x likes.” (A predicat e w. 1 f ree variable, x) Then ∀x (∃y L(x,y)) = “Everyone has someone whom t hey like.” (A __________ wit h ___ f ree variables.)

Topic #3 – Predicate Logic

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 46

Quant if ier Exer cise

I f R(x,y)=“x relies upon y,” expr ess t he f ollowing in unambiguous English: ∀x(∃y R(x,y))= ∃y(∀x R(x,y))= ∃x(∀y R(x,y))= ∀y(∃x R(x,y))= ∀x(∀y R(x,y))=

Everyone has someone to rely on. There’s a poor overburdened soul whom everyone relies upon (including himself)! There’s some needy person who relies upon everybody (including himself). Everyone has someone who relies upon them. Everyone relies upon everybody, (including themselves)!

Topic #3 – Predicate Logic

slide-24
SLIDE 24

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 47

Nat ural language is ambiguous!

  • “Everybody likes somebody.”

– For everybody, t here is somebody t hey like,

  • ∀x ∃y Likes(x,y)

– or, t here is somebody (a popular person) whom everyone likes?

  • ∃y ∀x Likes(x,y)
  • “Somebody likes everybody.”

– Same problem: Depends on cont ext , emphasis.

Topic #3 – Predicate Logic

Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 48

Quant if icat ions of Two Variables

P(x,y) is f alse f or ever y pair x,y. Ther e is a pair x,y f or which P(x,y) is t r ue. ∃x∃y P(x,y) ∃y∃x P(x,y) For ever y x t hr ee is a y f or which P(x,y) is f alse. Ther e is an x f or which P(x,y) is t r ue f or ever y y ∃x∀y P(x,y) Ther e is an x such t hat P(x,y) is f alse f or ever y y. For ever y x, t her e is a y f or which P(x,y) is t r ue ∀x∃y P(x,y) Ther e is a pair x,y f or which P(x,y) is f alse. P(x,y) is t r ue f or ever y pair (x,y) ∀x∀y P(x,y) ∀y∀x P(x,y)

When False? When t r ue? St at ement