Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP...

53
Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Transcript of Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP...

Page 1: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic

Jason Filippou

CMSC250 @ UMCP

06-06-2016

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Page 2: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Outline

1 Propositional logic falls short

2 Predicate LogicSyntaxSemanticsProof theory

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 2 / 42

Page 3: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Propositional logic falls short

Propositional logic falls short

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 3 / 42

Page 4: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Propositional logic falls short

Modelling worlds

The goal of logic has, is, and will be to model domain knowledgeabout the world, and make certain inferences, based on a certaintheory of proof.

So, for every scenario, we have an agreement on what our world is.

E.g CSIC, CS department, State of Maryland

Consider how the world affects the truth value of certainpropositional logic statements!

freshman ∨ sophomore ∨ junior ∨ seniormotorcycle ∧ red light⇒ wait for green

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 4 / 42

Page 5: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Propositional logic falls short

Semantic simplicity of propositional symbols

Suppose we already have the propositional symbol charlie.

How do we express the fact that Charlie is a unicorn?

1 Insert a new symbol, charlie the unicorn, retract (?) symbolcharlie.

2 Insert rule charlie ∧ horned charlie⇒ charlie the unicorn and thesymbol horned charlie, use modus ponens.

What about the pink and gray unicorns?

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 5 / 42

Page 6: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Propositional logic falls short

Semantic simplicity of propositional symbols

Suppose we already have the propositional symbol charlie.

How do we express the fact that Charlie is a unicorn?1 Insert a new symbol, charlie the unicorn, retract (?) symbol

charlie.2 Insert rule charlie ∧ horned charlie⇒ charlie the unicorn and the

symbol horned charlie, use modus ponens.

What about the pink and gray unicorns?

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 5 / 42

Page 7: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Propositional logic falls short

Semantic simplicity of propositional symbols

Manually curated knowledge is time-consuming, error-prone, andsometimes contradicting.

Stable modeling example (whiteboard).

Beats the point of inference rules: Why did we even come up withthe automated construction of new knowledge if we end up puttingstuff in ourselves?

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 6 / 42

Page 8: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Propositional logic falls short

Semantic simplicity of propositional symbols

Modeling properties of an element of our world is virtuallyimpossible in propositional logic.

For every object in our world, we need to replicate every property!(whiteboard)

How do we relate objects to one another? E.g siblings,coworkers,...

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 7 / 42

Page 9: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Propositional logic falls short

The need for more symbols

How can I write a statement that says “Every CS250 student willsit for a midterm”?

Need a symbol to express the notion of “every item x that satisfiessome property P”...

How about “There’s at least two people in this classroom whoshare a birth month?”

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 8 / 42

Page 10: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Propositional logic falls short

Propositional Logic is not enough...

Expressiveness - tractability trade-off.

Tracta-what?

Propositional logic is the most basic kind of logic.

Excellent for:

Modeling hardware (boolean gates).The study of computational complexity (SAT problem).

Not-so-excellent for:

Translating language into computer-readable format.Building deductive databases.Efficient inference on large domains.

The next-step: First-Order logic!

Only we won’t do full FOL §

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 9 / 42

Page 11: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Propositional logic falls short

Propositional Logic is not enough...

Expressiveness - tractability trade-off.

Tracta-what?

Propositional logic is the most basic kind of logic.

Excellent for:

Modeling hardware (boolean gates).The study of computational complexity (SAT problem).

Not-so-excellent for:

Translating language into computer-readable format.Building deductive databases.Efficient inference on large domains.

The next-step: First-Order logic!

Only we won’t do full FOL §

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 9 / 42

Page 12: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Propositional logic falls short

Propositional Logic is not enough...

Expressiveness - tractability trade-off.

Tracta-what?

Propositional logic is the most basic kind of logic.

Excellent for:

Modeling hardware (boolean gates).The study of computational complexity (SAT problem).

Not-so-excellent for:

Translating language into computer-readable format.Building deductive databases.Efficient inference on large domains.

The next-step: First-Order logic!

Only we won’t do full FOL §

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 9 / 42

Page 13: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic

Predicate Logic

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 10 / 42

Page 14: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic

What is predicate logic?

An extension of propositional logic we have come up with.

A subset of FOL suitable for introducing formal proofs.

“The logic of quantified statements” is another suitablecharacterization (Epp).

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 11 / 42

Page 15: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic

A hierarchy of logics

Propositional Logic

First- Order Logic

Second-Order Logic

Type Theory

Infinitary Logic

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 12 / 42

Page 16: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic

A hierarchy of logics

Propositional Logic

First- Order LogicPredicates, quantifiers,

functors, backward / forward chaning,undecidability of inference

Second-Order Logic

Type Theory

Infinitary Logic

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 13 / 42

Page 17: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic

A hierarchy of logics

Only aspectsof FOLincluded in“Predicate Logic”.

Propositional Logic

First- Order LogicPredicates, quantifiers,

functors, backward / forward chaning,undecidability of inference

Second-Order Logic

Type Theory

Infinitary Logic

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 14 / 42

Page 18: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic Syntax

Syntax

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 15 / 42

Page 19: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic Syntax

Variables and Constants

Our syntax has some crucial additions over Propositional Logic.

Variables (denoted lowercase) and their (sometimes implicit)domains. E.g:

E.g x ∈ R (Dom(c) = R)E.g c, with Dom(c) = {green, red, blue}

Constants (denoted uppercase): Unique identifiers of objects inour database (similar to Propositional Logic’s “propositionalsymbols”).

Sun,Earth,Benedict Cumberbatch, Jason Filippou

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 16 / 42

Page 20: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic Syntax

Predicates

Predicate Symbols: typically used to denote properties ofobjects, like adverbs or adjectives in language.

Written with uppercase first letter: P,Q, Father,Rainy

Predicates (denoted uppercase): consist of a predicate symbolfollowed by at least one constant and variable as an “argument”within parentheses. E.g:

Odd(x), Even(y), Father(q, r), with Dom(x) = Dom(y) = N,Dom(q) = {s | s is a MD resident under 18} andDom(r) = {s | s is a male PA resident over 22},King(Charlie, Bananas), Enrolled(x,CMSC 250), withDom(x) = CS UMD Undergraduates.

Arity of a predicate: The number of its arguments.

We constrain predicates to have arity at least 1, otherwise (a) Theymake no sense and (b) They are undistinguishable from constants.

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 17 / 42

Page 21: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic Syntax

Quantifiers

The symbols “exists”: ∃ and “forall”: ∀, followed by at least onevariable and one predicate.

(∃ x)(Prime(x))(∀x)(Politician(x)⇒ Liar(x))

Parentheses can be used to define the scope of a quantifier. Whenthe scope is obvious, they can be ommitted (e.g above).

Can I have more than 1 predicate on the right of a quantifier?

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 18 / 42

Page 22: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic Syntax

Quantifiers

The symbols “exists”: ∃ and “forall”: ∀, followed by at least onevariable and one predicate.

(∃ x)(Prime(x))(∀x)(Politician(x)⇒ Liar(x))

Parentheses can be used to define the scope of a quantifier. Whenthe scope is obvious, they can be ommitted (e.g above).

Can I have more than 1 predicate on the right of a quantifier?

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 18 / 42

Page 23: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic Syntax

Quantified Statements

Absolutely! We will call those quantified statements, and they aresomewhat equivalent to propositional logic’s “compoundstatements”

1 Existential statements follow ∃.2 Universal statements follow ∀.3 Mixed statements follow both:

(∀x)(Person(x) ⇒ (∃z)(Loves(z, x))).(∀p1, p2 ∈ R2)(∃p3 ∈ R2)dist(p3, p1) = dist(p3, p2)(∀q)(Prime(q) ⇒ (∃p)(Prime(p) ∧ p > q))

We can also have regular, non-quantified statements that involveconstants instead of variables (ground statements), orstatements that involve both:

Hates(Jason,Artichokes) ∧Hates(Jason,Brussel Sprouts),Form Triangle(P1, P2, P3) ∨ Colinear(P1, P2, P3)(∀x)(Lives(x,North America)⇔Lives(x,Canada) ∨ Lives(x, USA) ∨ Lives(x,Mexico))

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 19 / 42

Page 24: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic Syntax

Bound / Free variables in statements

Bound variable: A variable that is quantified. E.g:

(∃z) Unicorn(z) ∧Nuts(z)(∀x, y ∈ N)Divides(x, y)⇔ (∃z ∈ N)y = x ∗ z

Free variable: A variable that isn’t bound. E.g:

(∀x)P (x, y)(∃z)(R(z, s) ∨Q(z))⇒ F (z)Q(x)⇒ (∀x)Q(x)

Use parentheses when necessary!

Sentence: A quantified statement with only bound variables.

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 20 / 42

Page 25: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic Semantics

Semantics

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 21 / 42

Page 26: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic Semantics

Knowledge Bases / Grounding

Knowledge base (KB): A set of ground (variable-free) predicates1

that represent what we know about the world.

Grounding: The substitution of variables in quantified statementswith constants corresponding to predicate arguments.

Groundings can be true or false with respect to the KB.

Closed world assumption: Anything not mentioned in ourknowledge base is assumed to be false!

1We technically call those ground atoms.Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 22 / 42

Page 27: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic Semantics

Predicate truth

Semantics in Predicate Logic will be tied to the notion of the truthof a - possibly quantified - statement.

Ground statement: Similar to propositional logic. Consists of anon-quantified statement that can be either true or false givenour knowledge base.Sentence: Have to introduce the notions of universal andexistential instantiation / generalization.

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 23 / 42

Page 28: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic Semantics

Universal instantiation

Rule of Universal Instantiation

(∀x ∈ D)P (x)∴ P (A) for any particular A ∈ D

Examples:

(∀x ∈ R) x2 ≥ 0

(∀p ∈ UMD Undergrads) Smart(p)

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 24 / 42

Page 29: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic Semantics

Universal instantiation

Rule of Universal Instantiation

(∀x ∈ D)P (x)∴ P (A) for any particular A ∈ D

Examples:

(∀x ∈ R) x2 ≥ 0

(∀p ∈ UMD Undergrads) Smart(p)

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 24 / 42

Page 30: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic Semantics

Existential instantiation

Rule of Existential instantiation

(∃x ∈ D)P (x)∴ P (A) for a specific A ∈ D

Examples:

(∃z ∈ Classroom) Name(z, Jason)

(∃c ∈ USA) NameContains(y, “Truth”) ∧NameContains(y, “Consequences”)

Can I have more > 1 “A”’s?

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 25 / 42

Page 31: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic Semantics

Existential instantiation

Rule of Existential instantiation

(∃x ∈ D)P (x)∴ P (A) for a specific A ∈ D

Examples:

(∃z ∈ Classroom) Name(z, Jason)

(∃c ∈ USA) NameContains(y, “Truth”) ∧NameContains(y, “Consequences”)

Can I have more > 1 “A”’s?

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 25 / 42

Page 32: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic Semantics

Universal generalization

Rule of Universal Generalization

P (A) for some A ∈ D selected arbitrarily.∴ (∀x)P (x)

A is then often called the generic particular.Compare and contrast:

Let A ∈ N Let A ∈ Neven

. . . . . .P (A) P (A)

∴ (∀n ∈ N)P (n) ∴ (∀n ∈ N)P (n)

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 26 / 42

Page 33: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic Semantics

Universal generalization

Rule of Universal Generalization

P (A) for some A ∈ D selected arbitrarily.∴ (∀x)P (x)

A is then often called the generic particular.

Compare and contrast:

Let A ∈ N Let A ∈ Neven

. . . . . .P (A) P (A)

∴ (∀n ∈ N)P (n) ∴ (∀n ∈ N)P (n)

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 26 / 42

Page 34: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic Semantics

Universal generalization

Rule of Universal Generalization

P (A) for some A ∈ D selected arbitrarily.∴ (∀x)P (x)

A is then often called the generic particular.Compare and contrast:

Let A ∈ N Let A ∈ Neven

. . . . . .P (A) P (A)

∴ (∀n ∈ N)P (n) ∴ (∀n ∈ N)P (n)

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 26 / 42

Page 35: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic Semantics

Existential generalization

Rule of existential generalization

P (A) for any A ∈ D.∴ (∃x)P (x)

Good practice: Pay attention to the usages of “any” and “some”.

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 27 / 42

Page 36: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic Semantics

Modeling Example: Family tree

Jill Phil

Steven Keegan

Hailey Bailey

Cathy

SargeMarge WesleyLesley

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 28 / 42

Page 37: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic Semantics

Example: Family tree

Female(Marge) Male(Sarge)

Female(Lesley) Male(Phil)

Female(Jill) Male(Wesley)

Female(Hailey) Male(Bailey)

Female(Cathy) Male(Steven)

Male(Keegan)

Jill Phil

Steven Keegan

Hailey Bailey

Cathy

SargeMarge WesleyLesley

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 29 / 42

Page 38: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic Semantics

Example: Family tree

Female(Marge) Male(Sarge) Couple(Marge, Sarge)

Female(Lesley) Male(Phil) Couple(Lesley,Wesley)

Female(Jill) Male(Wesley) Couple(Jill, Phil)

Female(Hailey) Male(Bailey) Couple(Hailey,Bailey)

Female(Cathy) Male(Steven)

Male(Keegan)

Jill Phil

Steven Keegan

Hailey Bailey

Cathy

SargeMarge WesleyLesley

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 30 / 42

Page 39: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic Semantics

Example: Family tree

Female(Marge) Male(Sarge) Couple(Marge, Sarge)

Female(Lesley) Male(Phil) Couple(Lesley,Wesley)

Female(Jill) Male(Wesley) Couple(Jill, Phil)

Female(Hailey) Male(Bailey) Couple(Hailey,Bailey)

Female(Cathy) Male(Steven)

Mother(Marge, Jill) Male(Keegan)

Mother(Lesley, Phil)

Mother(Lesley,Hailey)

Mother(Jill, Steven)

Mother(Jill,Keegan)

Mother(Hailey, Cathy)

Jill Phil

Steven Keegan

Hailey Bailey

Cathy

SargeMarge WesleyLesley

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 31 / 42

Page 40: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic Semantics

Negated quantifiers

For variable set x and quantified statement P (x), the following hold:

(@x)P (x) ≡ (∀x) ∼P (x)

(∃x)P (x) ≡ ∼(∀x)∼P (x)

This applies recursively to nested quantifiers! (whiteboard examples)

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 32 / 42

Page 41: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic Semantics

Vacuous truth of quantified statements

Critique the following quantified statement:

(∀x)(Marker(x) ∧ Location(x,WhiteBoard)⇒ Blue(x))

What truth value would you attach to it?

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 33 / 42

Page 42: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic Proof theory

Proof theory

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 34 / 42

Page 43: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic Proof theory

Major and Minor premises

Major premise: A universally quantified implication, i.e of form(∀x) P (x)⇒ Q(x)

Minor premise: The association of an object with the domain ofthe quantified variable, i.e P (A) for some A.

Conclusion: Q(A).

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 35 / 42

Page 44: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic Proof theory

Universal modus ponens

The quantified version of modus ponens.

Universal Modus Ponens

(∀x)P (x)⇒ Q(x)

P (A) for some A ∈ Dom(x)

∴ Q(A)

Theorem

Universal Modus Ponens is a valid rule of inference.

Proof.

Diagramatic (whiteboard)

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 36 / 42

Page 45: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic Proof theory

Universal modus ponens

The quantified version of modus ponens.

Universal Modus Ponens

(∀x)P (x)⇒ Q(x)

P (A) for some A ∈ Dom(x)

∴ Q(A)

Theorem

Universal Modus Ponens is a valid rule of inference.

Proof.

Diagramatic (whiteboard)

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 36 / 42

Page 46: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic Proof theory

Universal modus ponens

The quantified version of modus ponens.

Universal Modus Ponens

(∀x)P (x)⇒ Q(x)

P (A) for some A ∈ Dom(x)

∴ Q(A)

Theorem

Universal Modus Ponens is a valid rule of inference.

Proof.

Diagramatic (whiteboard)

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 36 / 42

Page 47: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic Proof theory

Universal modus tollens

Universal Modus Tollens

(∀x)P (x)⇒ Q(x)

∼Q(A) for some A ∈ Dom(x)

∴ ∼P (A)

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 37 / 42

Page 48: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic Proof theory

Quantified converse error

Quantified Converse Error

(∀x)P (x)⇒ Q(x)

Q(A) for some A ∈ Dom(x)

∴ P (A)

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 38 / 42

Page 49: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic Proof theory

Quantified inverse error

Quantified inverse error

(∀x)P (x)⇒ Q(x)

∼P (A) for some A ∈ Dom(x)

∴ ∼Q(A)

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 39 / 42

Page 50: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic Proof theory

Complex inferences

Assume a simplified version of 250, called Mini250.

2 midterms, 1 final.

We want to author rules that dictate when a student passes acourse, and formally prove that a student called Trisha will, infact, pass 250.

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 40 / 42

Page 51: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic Proof theory

Complex inferences

We will use the following predicates:

Predicate Meaning

Midterm(n, s, g) The grade of student s in midterm number n(1 or 2) was g (A, B or C).

Final(s, g) The grade of student s in midterm in the finalwas g (A, B, or C).

Present(s) Student s was consistently present in lecture.

Studies(s, l) Student s studies in mode l (Lazily, Well orHard)

Passes(s, g) Student s passed the course with grade g.

Fails(s) Student s failed the course.

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 41 / 42

Page 52: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic Proof theory

Complex inferences

Let’s translate the following statements into Predicate Logic:

1 Every student who studies hard will get As in both midterms andat least a B in the final.

2 Any student who is consistently present in lecture will score atleast a B in both midterms and at least a C in the final.

3 One will pass the course if, and only if, one scores at least a Cin the final, and a C or B in either one of the two midterms.

4 Any student who studies well or hard will score at least a B inboth midterms and the final.

5 One cannot pass and fail the course at the same time.

Now, assume that Trisha is a student who studies well and isconsistently present in lecture. Prove that Trisha will pass the course(with any grade)

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 42 / 42

Page 53: Predicate Logic 06-06-2016 · 2016. 7. 13. · Predicate Logic Jason Filippou CMSC250 @ UMCP 06-06-2016 Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 1 / 42

Predicate Logic Proof theory

Complex inferences

Let’s translate the following statements into Predicate Logic:

1 Every student who studies hard will get As in both midterms andat least a B in the final.

2 Any student who is consistently present in lecture will score atleast a B in both midterms and at least a C in the final.

3 One will pass the course if, and only if, one scores at least a Cin the final, and a C or B in either one of the two midterms.

4 Any student who studies well or hard will score at least a B inboth midterms and the final.

5 One cannot pass and fail the course at the same time.

Now, assume that Trisha is a student who studies well and isconsistently present in lecture. Prove that Trisha will pass the course(with any grade)

Jason Filippou (CMSC250 @ UMCP) Predicates 06-06-2016 42 / 42