Intro to AI - First Order Logic

0.0(0)
studied byStudied by 2 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/65

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

66 Terms

1
New cards

What are Propositional Logic Limitations?

  • Stating similar facts is cumbersome

    • Can’t make generalizations

  • In propositional logic, world contains facts, not objects

    • Ontological commitment of PL is limited

2
New cards

Propositional Logic vs Natural Language

Natural language deals with objects (nouns) and relations (verbs), hence is more expressive

3
New cards

Facts vs Objects

Fact: Felix is a cat, Garfield is a cat, Nemo is a fish, Garfield is a cat implies Garfield has whiskers

Object: Felix, Garfield, Nemo, Dory, Reef, Indiana

4
New cards

Properties, Relations (Predicates)

Cat, Fish, Swims, HasWhiskers, Lives

Cat(Felix), Cat(Garfield)

Fish(Nemo), Fish(Dory)

Lives(Nemo, Reef), Lives(Garfield, Indiana)

5
New cards

Generalizations

For all X, if Cat(X) then HasWhiskers(X)
“All cats have whiskers”

For all X, if Fish(X) then Swims(X)
“All fishes can swim”

6
New cards

First Order Logic (FOL) World consists of ___?

Objects, Reactions, Functions

7
New cards

First Order Logic (FOL) Sentences are made up of

Symbols, Connectives, Quantifiers and Variables

8
New cards

Symbols

for constant objects, predicates, and functions

9
New cards

Connectives

as in propositional logic

10
New cards

Quanitifiers and variables

Ɐx, Ǝy

11
New cards

Constants

  • Refer to objects, unlike propositional var referring to propositions

  • EX. John, Richard, C, L1, L2

<ul><li><p><span style="background-color: transparent;"><span>Refer to objects, unlike propositional var referring to propositions</span></span></p></li><li><p>EX. John, Richard, C, L1, L2</p></li></ul><p></p>
12
New cards
<p>Name the predicates in this example</p>

Name the predicates in this example

  • Person = {John, Richard}

  • King = {John}

  • Crown = {C}

  • Brother = {(John, Richard), (Richard, John)}

  • OnHead = {C, John}

13
New cards
<p>Name the <span style="background-color: transparent;"><span>Functions in this example</span></span></p>

Name the Functions in this example

  • LeftLeg={(Richard->L1),(John->L2)}

  • Strictly speaking, the function should be total—all objects should have a value when the function is applied to it

14
New cards

Models in FOL

  • Consists of the objects (domain elements) and relations (including functions)

    • Conceptual view of the world

15
New cards

Interpretations in FOL

  • Associates the symbols to the objects, relations and functions in the model

    • Number of interpretations for a given set of symbols is combinatorially explosive

16
New cards

Given this example, what are the sentences you can make?

  • Person(John) ∧ Person(Richard)

  • OnHead(C, John)

  • LeftLeg(John) = L1 ∨ LeftLeg(Richard) = L2

  • ∀x King(x) ⇒ Person(x)

17
New cards

Term

  • Expression that refers to an object

  • EX. Richard

  • EX. LeftLeg(John)

18
New cards

Atomic Sentences

Constructed by equating terms (=) or by a predicate (with terms as arguments)

19
New cards

Complex Sentences

Sentences with connectives or quantifiers

20
New cards

What are the possible forms of a sentence in FOL?

  • Atomic Sentence

  • (Sentence Connective Sentence)

  • ¬Sentence

  • Quantifier Variable Sentence

21
New cards

What are the types of Terms in FOL?

  • Function-Symbol(Term, …)

  • Constant-Symbol

  • Variable

22
New cards

What do Connectives represent in FOL?

Logical operations combining sentences

23
New cards

List the main Connectives in FOL

∧ (and), ∨ (or), ⇒ (implies), ⇔ (if and only if)

24
New cards

What are the Quantifiers in FOL?

∀ (for all), ∃ (there exists)

25
New cards

Semantics

  • Truth of a sentence in FOL:

    • Determined with respect to a model and an interpretation

    • Analogous notions for entailments, validity and satisfiability

  • Model enumeration is impractical in FOL

26
New cards

Types of Quantifiers

  1. Universal Quantification

  2. Existential Quantification

27
New cards

Universal Quantification

  • ∀x P is true in a model m iff P is true with x being each possible object in the model

  • A conjunction of instantiations

28
New cards

Existential Quantification

  • ∃x P is true in a model m iff P is true with x being some object in the model

  • A disjunction of instantiations

29
New cards

Universal Quantification for this example

  • ∀x King(x) ⇒ Person(x)

    • Means that King(x) ⇒ Person(x) holds for all objects
      (e.g., John, Richard, C, L1,L2)

    • (King(John) ⇒ Person(John)) ∧ (King(Richard) ⇒ Person(Richard)) ∧ (King(C) ⇒ Person(C)) ∧ (King(L1) ⇒ Person(L1)) ∧ (King(L2) ⇒ Person(L2))

30
New cards

Existential Quantification for this example

  • ∃x Crown(x)
    “there is at least one crown”

    • Means that for one of the objects (e.g., John, Richard, C, L1,L2), Crown(x) holds

    • Crown(John) ∨ Crown(Richrd) ∨ Crown(C) ∨ Crown(L1) ∨ Crown(L2)

31
New cards

Translate to english: ∀x King(x) ⇒ Person(x)

“All kings are persons”

32
New cards

Translate to english: ∃x Crown(x)  ∧ OnHead(x,John)

“John has a crown on his head”

33
New cards

Translate to english: ∀x∀y Brother(x,y) ⇔ Brother(y,x)

“The ’Brother’ relationship goes both ways”

34
New cards

Translate to english: ∃x∃y Brother(x,Richard) ∧ Brother(y,Richard) ∧ ¬(x=y)

“Richard has at least 2 brothers”

35
New cards

Translate to english: ∀x King(x) ⇒ ∃y Crown(y) ∧ OnHead(y,x)

“All kings have crowns”

36
New cards

Properties of Quantifiers: Nested Quantifiers

  • ∀x ∀y P  equivalent to  ∀y ∀x P

  • ∃x ∃y P  equivalent to ∃y ∃x P

  • Does not apply if quantifiers are different

37
New cards

Properties of Quantifiers: De Morgan's law of quantifiers

  • ∀x ¬P ≡ ¬∃x P

  • ∀x P ≡ ¬∃x ¬P

  • ∃x ¬P ≡ ¬∀x P

  • ∃x P≡ ¬∀x ¬P

38
New cards

Turn this into logic: Everybody loves somebody

∀x∃y Love (x, y)

39
New cards

Turn this into logic: There is somebody that everybody loves

∃x∀y Love (y, x)

40
New cards

What to look out for in quantifiers?

  • Using quantifiers (∀, ∃) in combination with ∧, ⇒

  • The domain consists of multiple kinds of objects

41
New cards

Translate this to english: ∀x King(x) ⇒ Person(x)

“All kings are persons”

42
New cards

Translate this to english and is it true or false: ∀x King(x) ⇒ Person(x)

“All kings are persons”

True

43
New cards

Translate this to english and is it true or false: ∀x King(x) ∧ Person(x)

“Everything in the world is a king and a person”
False

44
New cards

Translate this to english and is it true or false: ∃x Crown(x) ∧ OnHead(x,John)

“There is a crown on John’s head”

True

45
New cards

Translate this to english and is it true or false: ∃x Crown(x) ⇒ OnHead(x, John)

“There is an object where this rule holds”

Almost always true

46
New cards

Functions vs Predicates

  • Functions map objects to one another

  • Predicates describe properties of objects

47
New cards

Functions

  • Returns an object; this object is a term

  • Serves as a noun phrase

  • FatherOf(x) returns whoever is x’s father

  • Sum(4,3) returns 7

48
New cards

Predicates

  • Returns a truth value; result of a formula

  • Serves as a verb phrase, which can be an atomic sentence

  • Father(x,y) means x is the father of y

  • EqualTo(Sum(4,3), 7) evaluates to True

49
New cards

Is this ok: ∃x LeftLeg(x)

not ok because LeftLeg is a function

50
New cards

Is this ok: ∃x LeftLeg(John) = x

ok since it compares a function value (LeftLeg(John)) to an object (x)

51
New cards

Is this ok: ∃x LeftLeg(x) = L1

ok because it’s a valid equality — the function LeftLeg(x) returns an object, and you’re checking if that object equals L1

52
New cards

Is this ok: ∃x Crown(x)

ok because Crown is a predicate

53
New cards

Common error between Functions and Predicates

  • Treating a function (returns an object) like a predicate (returns a true/false value)

    • Often, because = was omitted

  • LeftLeg(John) = L1 ∨ LeftLeg(Richard) = L1
    “L1 is either John’s or Richard’s left leg”

54
New cards

FOL in Wumpus World

  • Represent Wumpus World more compactly

    • Less sentences to represent rules

    • Capture rules on pits and breezes, Wumpus and stenches

  • Can include time and percept objects in the world

    • Percept is represented as a list of constant symbols

    • Predicates with time arguments capture the dynamic nature of the agent moving in this world

55
New cards

Inference Algorithms in FOL

  • Reduction to propositional inference (propositionalization)

  • More efficient methods:

    • Lifting and unification

    • Resolution

    • Can be demonstrated in Logic programming languages like prolog

56
New cards

Propositional Logic VS First Order Logic

While PL deals with logical symbols, FOL deals with objects, relations, and functions

57
New cards

Translate this to FOL: Cottonball loves fish

Loves(Cottonball, Fish)

58
New cards

Translate this to FOL: Emilio is a student

Student(Emilio)

59
New cards

Translate this to FOL: Drea studies Computer Science

Students(Drea, CS)

60
New cards

Which natural language statement is the best interpretation of: ∃y ∀x Loves(x, y)?

There is a specific person whom everybody loves.

61
New cards

Choose the FOL notation which uses a function correctly to represent: "Alice's father is older than Bob."

OlderThan(FatherOf(Alice), Bob)

62
New cards

Translate to english: Loves(Buddy, Tasha) ∧ ~Loves(Tasha, Buddy)

Buddy loves Tasha but Tasha doesn’t love Buddy.

63
New cards

Which natural language statement is the best interpretation of: ∀x (Cat(x) ∨ Dog(x))?

Everything is either a cat or a dog.

64
New cards

Which natural language statement is the best interpretation of: ∃x (Apple(x) ∧ Red(x) ∧ ∃y (Box(y) ∧ In(x, y)))?

There is an apple that is red and in a box.

65
New cards

Which natural language statement is the best interpretation of: ∀x (Car(x) → ¬∃y (HasWheel(x, y) ∧ Three(y)))?
(Assume Three(y) means y is the number 3)


No cars have three wheels.

66
New cards

Which FOL notation best represents the statement: "All students like music."

∀x (Student(x) → Likes(x, Music))