










Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!











Chris BrooksDepartment of Computer ScienceUniversity of San Francisco
Department of Computer Science — University of San Francisco – p. 1/
12-2: Representation^ •^ Propositional Logic has several nice features^ ◦^ Lets us easily express disjunction and negation^ •^ “There is a pit in (1,1) or in (2,2)”^ •^ “There is not a pit in (1,1)”^ •^ This is hard to do in C/Java/Python - variables can onlytake on a single value.^ •^ There’s no obvious way to
assign^ x^ the value “3 or 4” or “some value less than 10”. ◦ Separates declarative knowledge from inference procedures ◦ Compositional • The meaning of a sentence is a function of the meaningof its parts.
Department of Computer Science — University of San Francisco – p. 2/
12-4: Inference in Propositional Logic^ •^ Inference can be done using DeMorgan’s, Modus Ponens,And-elimination, etc^ •^ Or, we can convert sentences to Conjunctive Normal Form^ ◦^ (a^ ∨^ b
∨ ¬c)^ ∧^ (d^ ∨^
e)^ ∧^ (f^ ∨ ¬g)
-^ We can then use resolution to derive new sentences. •^ Resolution is sound and complete.
Department of Computer Science — University of San Francisco – p. 4/
12-5: Weaknesses of Propositional Logic^ •^ There are several problems with propositional logic:^ ◦^ Lack of conciseness. (How to say “There is a pit in everysquare”?)^ ◦^ Lack of ability to quantify (How to say “There is a squarethat has a pit”?)^ ◦^ Lack of ability to deal with large domains.^ •^ What if there were an infinite number of rooms?^ •^ What is we wanted to write sentences about the integers?^ •^ The problem stems from the fact that propositional logic dealswith facts that are either true or false.^ •^ No way to indicate that terms in different sentences refer to thesame object.^ •^ No way to talk about relations between objects.
Department of Computer Science — University of San Francisco – p. 5/
12-7: Models in first-order logic^ •^ Recall that a model is the set of “possible worlds” for acollection of sentences.^ •^ In propositional logic, this meant truth assignments to facts.^ •^ In FOL, models have objects in them.^ •^ The^ domain
of a model is the set of objects in that world.
-^ For example, the Simpsons model might have the domain^ ◦^ {Marge, Homer, Lisa, Bart, Maggie} •^ We can then specify relations and functions between theseobjects^ ◦^ married-to(marge, homer), baby(maggie), father(bart) =homer
Department of Computer Science — University of San Francisco – p. 7/
12-8: Terms and sentences^ •^ A^ term^ is an expression that refers to a single object.^ ◦^ Bart, Lisa, Homer^ ◦^ We can also use functions as terms - Saxophone(Lisa)refers to the object that is Lisa’s saxophone^ •^ An^ atomic sentence
consists of a predicate applied to terms ◦^ Brother-of(Lisa, Bart), Married(Homer, Marge),Married(Mother(Lisa), Father(Bart)) ◦^ Plays(Lisa, Saxophone(Lisa))
Department of Computer Science — University of San Francisco – p. 8/
12-10: Quantifiers and variables^ •^ Often, it’s not enough to make a statement about particularobjects. Instead, we want to make a statement about some orall objects.^ ◦^ “All of the Simpsons are yellow.”^ ◦^ “At least one of the Simpsons is a baby.”^ ◦^ Quantifiers allow us to do this.^ ◦^ ∀^ is the symbol for universal quantification^ •^ It means that a sentence holds for every object in thedomain.^ •^ ∀xSimpson
(x)^ ⇒^ yellow
(x)^ Department of Computer Science — University of San Francisco – p. 10/
12-11: Quantifiers and variables^ •^ ∃^ is the symbol for existential quantification^ ◦^ It means that the sentence is true for at least one element inthe domain.^ ◦^ ∃xf emale
(x)^ ∧^ playsSaxophone
(x) ◦^ What would happen if I said^ ∃xf emale(
x)^ ⇒^ playsSaxophone
(x)?^ Department of Computer Science — University of San Francisco – p. 11/
12-13: Nesting quantifiers^ •^ Often, we’ll want to express more complex quantifications. Forexample, “every person has a mother”^ ◦^ ∀x∃ymother
(x, y) ◦^ Notice the scope - for each
x, a different
y^ is (potentially)
chosen. • What if we said^ ∃
y∀xmother(x, y
-^ this is not a problem when nesting quantifiers of the same type. •^ ∀x∀ybrotherOf
(x, y)^ ⇒^ siblingOf
(x, y)^ and ∀y∀xbrotherOf
(x, y)^ ⇒^ siblingOf
(x, y)^ are equivalent.
-^ We often write that as
∀x, ybrotherOf
(x, y)^ ⇒^ siblingOf
(x, y) Department of Computer Science — University of San Francisco – p. 13/
12-14: Negation^ •^ We can negate quantifiers^ ◦^ ¬∀xyellow
(x)^ says that it is not true that everyone is yellow. ◦ ∃x¬yellow(x)^ has the same meaning - there is someonewho is not yellow. ◦ ¬∃xdaughterOf^ (Bart, x
)^ says that there does not exist anyone who is Bart’s daughter. ◦ ∀x¬daughterOf
(Bart, x)^ says that for all individuals they are not Bart’s daughter. • In fact, we can use DeMorgan’s rules with quantifiers just likewith^ ∧^ and^ ∨.
Department of Computer Science — University of San Francisco – p. 14/
12-16: More examples^ •^ Everyone knows someone who is angry at Homer.^ ◦^ ∀x∃yknows
(x, y)^ ∧^ angryAt
(y, homer)
-^ Everyone who works at the power plant is scared of Mr. Burns^ ◦^ ∀xworksAt
(P owerP lant, x
)^ ⇒^ scaredOf
(x, burns) Department of Computer Science — University of San Francisco – p. 16/
12-17: Audience Participation^ •^ Everyone likes Lisa.^ •^ Someone who works at the power plant doesn’t like Homer.(both ways)^ •^ Bart, Lisa, and Maggie are Marge’s only children.^ •^ People who go to Moe’s are depressed.^ •^ There is someone in Springfield who is taller than everyoneelse.^ •^ When a person is fired from the power plant, they go to Moe’s^ •^ Everyone loves Krusty except Sideshow Bob^ •^ Only Bart skateboards to school^ •^ Someone with large feet robbed the Quickie-mart.
Department of Computer Science — University of San Francisco – p. 17/