1. Trang chủ
  2. » Công Nghệ Thông Tin

Lecture Discrete mathematics and its applications - Chapter 1 (Part 2): Predicate Logic

57 96 0

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

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 57
Dung lượng 7,92 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

This chapter define the term computer program, describe the use of flowcharts and pseudocode in programming, identify two ways in which a program can work toward a solution, differentiate the two main approaches to computer programming, list and describe three elements of object-oriented programming.

Trang 1

The Foundations: Logic

and Proofs

Chapter 1, Part II:

Predicate LogicWith Question/Answer Animations

Copyright © McGraw-Hill Education All rights reserved No reproduction or distribution without the prior written consent of McGraw-Hill Education.

Trang 2

Predicate Logic (First­Order Logic (FOL), Predicate Calculus)

Trang 3

Predicates and Quantifiers Section 1.4

Trang 5

Propositional Logic Not

Later we’ll see how to draw inferences. 

Trang 6

Introducing Predicate Logic

Trang 8

Examples of Propositional Functions

Let “x + y = z” be denoted by  R(x, y, z) and U (for all  three variables) be the integers. Find these truth values: 

Trang 9

propositions.

Trang 10

We need quantifiers to express the meaning of English  words including all and some:

Trang 14

Thinking about Quantifiers

When the  domain of discourse is finite, we can think of quantification as looping through the elements of the 

Even if the domains are infinite, we can still think of the quantifiers this fashion, but the loops will not terminate in some cases

Trang 17

Translating from English to Logic

Example 1:  Translate the following sentence into predicate logic: “Every student in this class has taken a course in 

Java.”

Solution:

  First decide on the domain U. 

Solution 1: If U is all students in this class, define a propositional  function J(x) denoting “x has taken a course in Java” and 

Trang 18

Translating from English to Logic

Example 2: Translate the following sentence into predicate logic: “Some student in this class has taken a course in 

Trang 19

Returning to the Socrates

Trang 20

equivalent. 

Example:   x ¬¬S(x)   x S(x)

Trang 21

Thinking about Quantifiers

as Conjunctions and

Disjunctions

If the domain is finite, a universally quantified 

proposition is equivalent to a conjunction of propositions without quantifiers and an existentially quantified 

proposition is equivalent to  a disjunction of propositions without quantifiers. 

If U consists of the integers 1,2, and 3:

Even if the domains are infinite, you can still think of the quantifiers in this fashion, but the equivalent expressions without quantifiers will be infinitely long

Trang 22

     Symbolically  ¬ x J(x)  and  x ¬J(x) are equivalent

Trang 23

     Symbolically  ¬  x J(x)  and   x ¬J(x) are equivalent

Trang 24

De Morgan’s Laws for Quantifiers

The rules for negating quantifiers are:

The reasoning in the table shows that:

These are important. You will use these. 

Trang 25

Translation from English to Logic

Trang 26

Some Fun with Translating from English into Logical

Trang 33

Lewis Carroll Example

        (1832­1898)

Trang 34

Some Predicate Calculus

Trang 37

Logic Programming (cont)

In Prolog, names beginning with an uppercase letter are variables. 

p  c  s(I(p,c)   E(s,c))   T(p,s))

Trang 38

Logic Programming (cont)

Prolog programs are loaded into a Prolog interpreter. The  interpreter receives queries and returns answers using the 

Trang 39

Logic Programming (cont)

Trang 40

Logic Programming (cont)

Trang 41

Nested Quantifiers Section 1.4

Trang 42

Negating Nested Quantifiers

Trang 46

Questions on Order of Quantifiers

Trang 47

Questions on Order of Quantifiers

Trang 48

Quantifications of Two

Variables

P(x,y) is true for every pair  x,y. There is a pair x, y for  which P(x,y) is false.

For every x there is a y for  which P(x,y) is true. There is an x such that P(x,y) is false for every y.

Trang 49

     Solution: Every student in your school has a computer or has a  friend who has a computer. 

Example 2:  Translate the statement

         x y  z ((F(x, y)  F(x,z)   (y ≠z)) ¬F(y,z))∧ ∧ →

   Solution: There is a student none of whose friends are 

also friends with each other

Trang 50

Translating Mathematical

Statements into Predicate

Logic

  Example : Translate “The sum of two positive integers is always positive” into a logical expression

Trang 51

Translating English into

Trang 52

Calculus in Logic (optional)

Example: Use quantifiers to express the definition of the 

limit of a real­valued function f(x) of a real variable x at a  point a in its domain.

Solution: Recall the definition of the statement

    is “For every real number   > 0, there exists a real number ε    > 0 such that |f(x) – L| <   whenever   0 < |x –a| <  ”δ ε δ

     Using quantifiers:

     Where the domain for the variables   and   consists of all ε δ

positive real numbers and the domain for x consists of all 

real numbers. 

Trang 53

Questions on Translation

from English

  Choose the obvious predicates and express in predicate logic

Trang 54

Negating Nested Quantifiers

Example 1: Recall the logical expression developed three slides back:

Trang 55

Return to Calculus and

Logic (Opt)

Example : Recall the logical expression developed in the 

calculus example three slides back

Use quantifiers and predicates to express that       does not exist

Trang 56

Calculus in Predicate Logic

Trang 57

Some Questions about

Can you distribute quantifiers over logical connectives? 

 Is this a valid equivalence?

          Solution: Yes! The left and the right side will always have  the same truth value no matter what propositional functions are 

denoted by P(x) and Q(x).

 Is this a valid equivalence?

          Solution: No! The left and the right side may have different  truth values. Pick “x is a fish” for P(x) and “x has scales” for 

Q(x) with the domain of discourse being all animals. Then the 

left side is false, because there are some fish that do not have 

scales.  But the right side is true since not all animals are fish.

Ngày đăng: 14/10/2020, 14:52

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN