Predicate Logic Motivations Propositional logic can only express

  • Slides: 18
Download presentation
Predicate Logic

Predicate Logic

Motivations • Propositional logic can only express whole sentences. • It doesn’t allow you

Motivations • Propositional logic can only express whole sentences. • It doesn’t allow you to access the components within a sentence, e. g. , subject, object, adjectives, etc. • Predicate logic has that capability.

Objectives • • • Syllogism Predicates Universal quantifiers Existential quantifiers Define legal predicate sentences

Objectives • • • Syllogism Predicates Universal quantifiers Existential quantifiers Define legal predicate sentences recursively

Many names • • • Predicate logic Predicate calculus First-order logic First-order predicate calculus

Many names • • • Predicate logic Predicate calculus First-order logic First-order predicate calculus Logic of quantifiers

All humans are mortal • Syllogism in Aristotle's Prior Analytics, – Major premise: All

All humans are mortal • Syllogism in Aristotle's Prior Analytics, – Major premise: All humans are mortal. – Minor premise: Socrates is human. – Conclusion: Socrates is mortal. • Propositional Logic – – P: All humans are mortal. Q: Socrates is human. R: Socrates is mortal. But R cannot be deduced from P and Q. • First Order Logic – – – The for-all symbol is need to qualify the variable x to indicate that the IF-conditional is true not just for some x. • SWI-Prolog – – mortal(X) : - man(X). man(socrates). ? - mortal(socrates). Yes Prolog uses the variable X and the ONLY-IF-conditional to show that the clause is true for all X.

Subject and predicate • Access the subject of a sentence: Tony likes BBQ ribs.

Subject and predicate • Access the subject of a sentence: Tony likes BBQ ribs. Lynda likes BBQ ribs. • We need a special function called a predicate, e. g, like_ribs() like_ribs(tony) like_ribs(lynda) • The predicate like_ribs/1 predicates (depends) on one argument which is the subject of a sentence.

Examples • Given a world of discourse, or a domain D = {tony, lynda,

Examples • Given a world of discourse, or a domain D = {tony, lynda, samuel, daniel, ezekiel, jonathan, joy} • D contains 7 constant symbols or atoms. We can say that the whole family in the House of Chan like BBQ ribs: – X like_ribs (X), X in D. X is a variable, not a constant. – Compare with the proposition “Everyone in the House of Chan likes BBQ ribs. ” • Some computers have mouse connected on the USB port. Y computer (Y) USB_conn (Y, mouse_of(Y))

Predicate logic • Subject / Predicate John / went to the store. The sky

Predicate logic • Subject / Predicate John / went to the store. The sky / is blue. • Propositional logic uses propositions • Predicate logic uses predicates – predicates must be applied to a subject in order to be true or false – In general, a logical predicate can be applied to the objects, adjectives, or any other component of a sentence. • P(X) – means this predicate represented by P – applied to the entity (item) represented by X

Family relationships 1. 2. 3. 4. 5. mother(eve, abel). mother(eve, cain). father(adam, abel). father(adam,

Family relationships 1. 2. 3. 4. 5. mother(eve, abel). mother(eve, cain). father(adam, abel). father(adam, cain). X Y father(X, Y) mother(X, Y) parent(X, Y). 6. X Y Z parent(X, Y) parent(X, Z) sibling(Y, Z). 7. sibling(cain, abel)?

Connection between the quantifiers Change of variable X to Y. X q(X) Y q(Y)

Connection between the quantifiers Change of variable X to Y. X q(X) Y q(Y) X p(X) Y p(Y) It is false that for all X, such that p(X) is true. E. g. : Not every student has a textbook. Or: There is at least one student who does not have the textbook. X p(X) Not even one student has the textbook. X p(X)

Types of symbols 1. Truth symbols true and false These are reserved symbols. 2.

Types of symbols 1. Truth symbols true and false These are reserved symbols. 2. Constant symbols are symbols having the first character lowercase. – E. g. , today, fisher 3. Variable symbols are symbols beginning with an uppercase character or underscore. – E. g. , X, Y, Z, Building, _building 4. Function symbols are symbols having the first character lowercase. Arity: /number of arguments – E. g. , mother_of/1; maximum/2

Mutually recursive definitions • A function expression consists of a function symbol of arity

Mutually recursive definitions • A function expression consists of a function symbol of arity n, followed by n terms, t 1 , t 2 , …, tn, enclosed in parentheses and separated by commas. – mother_of(sam) – maximum(5, 38) – maximum(7, 18), add_one(18)) – Non-example: maximum(7, 18) add_one(18) • A FOL term is either a constant, variable, or function expression. – sam – Sam – house_of(X) – color_of(house_of(neighbor(joe)))

Atomic sentences • Predicate symbols are symbols beginning with a lowercase letter. Predicates are

Atomic sentences • Predicate symbols are symbols beginning with a lowercase letter. Predicates are special functions with true/false as the range. Arity: number of arguments • An atomic sentence is a predicate constant of arity n, followed by n terms, t 1 , t 2 , …, tn, enclosed in parentheses and separated by commas. • The truth values, true and false, are also atomic sentences. • Atomic sentences do not contain logical connectives symbols.

3 examples of atomic sentences 1. greater_than(2, 3) Predicate symbol term, constant 2. mother_of(joe,

3 examples of atomic sentences 1. greater_than(2, 3) Predicate symbol term, constant 2. mother_of(joe, susan) 3. mother_of(sister_of(joe), susan)

Predicate logic sentences • Every atomic sentence is a sentence. • If s is

Predicate logic sentences • Every atomic sentence is a sentence. • If s is a sentence, then so is its negation, s. • If s 1 and s 2 are sentences, then so is their – Conjunction, s 1 s 2. – Disjunction, s 1 s 2. – Implication, s 1 s 2. – Equivalence, s 1 s 2.

Predicate logic sentences (cont’d) • If X is a variable and s is a

Predicate logic sentences (cont’d) • If X is a variable and s is a sentence, then so are – X s. • Remember that logical sentences evaluate to true or false, therefore only such objects are atomic sentences. • Functions are not atomic sentences.

Checking a sentence in predicate logic 1. 2. 3. 4. 5.

Checking a sentence in predicate logic 1. 2. 3. 4. 5.

Summary • Unlike natural languages such as English, the semantics of predicate logic sentences

Summary • Unlike natural languages such as English, the semantics of predicate logic sentences are precise and unambiguous. • Predicate logic is more expressive than propositional logic. • It extends propositional logic by allowing functions, universal, and existential quantifiers in its sentences.