1. Trang chủ
  2. » Giáo án - Bài giảng

Discrrete mathematics for computer science 08QLogic

9 66 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 9
Dung lượng 83,95 KB

Nội dung

Logic with quantifiers aka First-Order Logic Predicate Logic Quantificational Logic 3/22/19 Harry Lewis/CS20/CSCI E-120/with thanks to Albert R Meyer Predicates • • • • 3/22/19 A predicate is a proposition with variables For example: P(x,y) := “x+y=0” (For today, universe is Z = all integers) P(-4,3) is Harry Lewis/CS20/CSCI E-120/with thanks to Albert R Meyer Predicates • • • • 3/22/19 A predicate is a proposition with variables For example: P(x,y) := “x+y=0” P(-4,3) is False P(5,-5) is Harry Lewis/CS20/CSCI E-120/with thanks to Albert R Meyer Predicates • • • • • 3/22/19 A predicate is a proposition with variables For example: P(x,y) := “x+y=0” P(-4,3) is False P(5,-5) is True P(6,-6)⋀¬P(1,2) is Harry Lewis/CS20/CSCI E-120/with thanks to Albert R Meyer Predicates • • • • • 3/22/19 A predicate is a proposition with variables For example: P(x,y) := “x+y=0” P(-4,3) is False P(5,-5) is True P(6,-6)⋀¬P(1,2) is True Harry Lewis/CS20/CSCI E-120/with thanks to Albert R Meyer Quantifiers • ∀x Q(x) := “for all x, Q(x)” • ∃x Q(x) := “for some x, Q(x)” • Let Q(x) := “x-7=0” • Let R(x,y) := “x≥0 ⋀ x+y=0” • ∀y ∃x ((x≥0 ⋀ x+y=0) ⋁ (y≥0 ⋀ y+x=0)): True! – That is, Q(x) holds for each and every value of x – That is, Q(x) holds for at least one value of x – ∀x Q(x) is false but ∃x Q(x) is true – Then ∀y∃x (R(x,y) ⋁ R(y,x)) is …? 3/22/19 Harry Lewis/CS20/CSCI E-120/with thanks to Albert R Meyer Quantifiers • • ∀ is AND-like and ∃ is OR-like If the universe is {Alice, Bob, Carol} then – ∀x Q(x) is the same as Q(Alice) ⋀ Q(Bob) ⋀ Q(Carol) – ∃x Q(x) is the same as Q(Alice) ⋁ Q(Bob) ⋁ Q(Carol) • 3/22/19 In general the universe is infinite … Harry Lewis/CS20/CSCI E-120/with thanks to Albert R Meyer Rhetoric and Quantifiers • • • Let Loves(x,y) := “x loves y” “Everybody loves Oprah”: ∀x Loves(x, Oprah) What does “Everybody loves somebody” mean? ∀x∃y Loves(x,y)? • ∃y∀x Loves(x,y)? “All that glitters is not gold” ∀x (Glitters(x) ⇒ ¬ Gold(x)) ? ¬∀ x (Glitters(x) ⇒ Gold(x)) ? 3/22/19 Harry Lewis/CS20/CSCI E-120/with thanks to Albert R Meyer Negation and Quantifiers • • • ¬∀ x P(x) ≡ ∃x ¬ P(x) • ¬∀ x (Glitters(x) ⇒ Gold(x)) ¬∃ x P(x) ≡ ∀x ¬ P(x) So negation signs can be pushed in to the predicates but the quantifiers flip ⤳ ∃x ¬ (Glitters(x) ⇒ Gold(x)) ⤳ ∃x ¬ ( ¬ Glitters(x) ∨ Gold(x)) rewriting “⇒” ⤳ ∃x (Glitters(x) ⋀ ¬ Gold(x)) by DeMorgan and double negation “There is something that glitters and is not gold” 3/22/19 Harry Lewis/CS20/CSCI E-120/with thanks to Albert R Meyer ...Predicates • • • • 3/22/19 A predicate is a proposition with variables For example: P(x,y) := “x+y=0” (For today, universe is Z = all integers) P(-4,3) is Harry Lewis/CS20/CSCI E-120/with... For example: P(x,y) := “x+y=0” P(-4,3) is False P(5,-5) is Harry Lewis/CS20/CSCI E-120/with thanks to Albert R Meyer Predicates • • • • • 3/22/19 A predicate is a proposition with variables For. .. variables For example: P(x,y) := “x+y=0” P(-4,3) is False P(5,-5) is True P(6,-6)⋀¬P(1,2) is True Harry Lewis/CS20/CSCI E-120/with thanks to Albert R Meyer Quantifiers • ∀x Q(x) := for all x,

Ngày đăng: 22/03/2019, 10:43