Introduction to Artificial Intelligence

Introduction to Artificial Intelligence First-order Logic (Logic, Deduction, Knowledge Representation) Bernhard Beckert

  U

  NIVERSITÄT

  K

  OBLENZ

  ANDAU Winter Term 2004/2005

  • -L

  Why first-order logic? Syntax and semantics of first-order logic Fun with sentences Wumpus world in first-order logic

  Propositional logic is declarative : pieces of syntax correspond to facts

  Propositional logic is declarative : pieces of syntax correspond to facts Propositional logic allows partial / disjunctive / negated information (unlike most data structures and databases)

  Propositional logic is declarative : pieces of syntax correspond to facts Propositional logic allows partial / disjunctive / negated information (unlike most data structures and databases) Propositional logic is compositional :

  B B P

  meaning of is derived from meaning of and of , ,P , ,

  1

  1

  1

  2

  1

  1

  1

  2

  Propositional logic is declarative : pieces of syntax correspond to facts Propositional logic allows partial / disjunctive / negated information (unlike most data structures and databases) Propositional logic is compositional :

  B B P

  meaning of is derived from meaning of and of , ,P , ,

  1

  1

  1

  2

  1

  1

  1

  2 Meaning in propositional logic is context-independent

  (unlike natural language, where meaning depends on context)

  Propositional logic is declarative : pieces of syntax correspond to facts Propositional logic allows partial / disjunctive / negated information (unlike most data structures and databases) Propositional logic is compositional :

  B B P

  meaning of is derived from meaning of and of , ,P , ,

  1

  1

  1

  2

  1

  1

  1

  2 Meaning in propositional logic is context-independent

  (unlike natural language, where meaning depends on context) Propositional logic has very limited expressive power (unlike natural language)

  Example:

  Cannot say “pits cause breezes in adjacent squares” except by writing one sentence for each square

  Propositional logic

  Assumes that the world contains facts

  Propositional logic

  Assumes that the world contains facts

  First-order logic

  Assumes that the world contains

  Objects people, houses, numbers, theories, Donald Duck, colors, centuries, . . .

  Propositional logic

  Assumes that the world contains facts

  First-order logic

  Assumes that the world contains

  Objects people, houses, numbers, theories, Donald Duck, colors, centuries, . . . Relations . . .

  red, round, prime, multistoried, brother of, bigger than, part of, has color, occurred after, owns, . . .

  Propositional logic

  Assumes that the world contains facts

  First-order logic

  Assumes that the world contains

  Objects people, houses, numbers, theories, Donald Duck, colors, centuries, . . . Relations . . .

  red, round, prime, multistoried, brother of, bigger than, part of, has color, occurred after, owns, . . .

  Functions

  , middle of, father of, one more than, beginning of,

  • . . .

  Symbols Constants KingJohn, 2, Koblenz, C, . . .

  Predicates Brother, >, =, . . . Functions Sqrt, LeftLegOf , . . . Variables x, y, a, b, . . . Connectives

  ∧ ∨ ¬ ⇒ ⇔

  Quantifiers

  ∀ ∃

  Symbols Constants KingJohn, 2, Koblenz, C, . . .

  Predicates Brother, >, =, . . . Functions Sqrt, LeftLegOf , . . . Variables x, y, a, b, . . . Connectives

  ∧ ∨ ¬ ⇒ ⇔

  Quantifiers

  ∀ ∃

  Note

  The equality predicate is always in the vocabulary It is written in infix notation

  Atomic sentence predicate

  (

  term

  1

  , . . . ,

  term n

  ) or

  term

  1

  =

  term

  2

  Atomic sentence predicate

  term

  or

  constant

  , . . . , term n ) or

  1

  term

  (

  function

  =

  (

  1

  term

  ) or

  term n

  , . . . ,

  1

  term

  variable

  Example Brother

  ( KingJohn, RichardTheLionheart )

  Example Brother | {z } predicate

  ( KingJohn

  | {z } constant

  , RichardTheLionheart

  | {z } constant

  )

  Example Brother , RichardTheLionheart

  ( KingJohn )

  | {z } | {z } | {z }

constant constant

predicate

  | {z } | {z }

term term

  Example Brother | {z } predicate

  ( KingJohn

  | {z } constant

  | {z } term

  , RichardTheLionheart

  | {z } constant

  | {z } term

  )

  

| {z }

atomic sentence

  Example

  > ( Length(LeftLegOf (Richard)), Length(LeftLegOf (KingJohn)) )

  Example

  >

  | {z } predicate

  ( Length

  | {z } function

  (LeftLegOf

  | {z } function

  (Richard

  | {z } constant

  )), Length

  | {z } function

  (LeftLegOf

  | {z } function

  (KingJohn

  | {z } constant

  )) )

  Example

  > , Length

  ( Length (LeftLegOf (Richard )) (LeftLegOf (KingJohn )) )

  |{z} | {z } | {z } | {z } | {z } | {z } | {z } predicate function function constant function function constant

  | {z } | {z } term term

  Example

  > , Length

  ( Length (LeftLegOf (Richard )) (LeftLegOf (KingJohn )) )

  |{z} | {z } | {z } | {z } | {z } | {z } | {z } predicate function function constant function function constant

  | {z } | {z } term term

  |

{z

  }

atomic sentence

  Built from atomic sentences using connectives

S S S S

  ¬SSSSS

  1

  2

  1

  2

  1

  2

  1

  2

  (as in propositional logic)

  Built from atomic sentences using connectives

S S S S

  ¬SSSSS

  1

  2

  1

  2

  1

  2

  1

  2

  (as in propositional logic)

  Example Sibling

  Sibling

  ( KingJohn, Richard ) ⇒ ( Richard, KingJohn )

  Built from atomic sentences using connectives

S S S S

  ¬SSSSS

  1

  2

  1

  2

  1

  2

  1

  2

  (as in propositional logic)

  Example Sibling , Richard Sibling , KingJohn

  ( KingJohn ) ⇒ ( Richard )

  | {z } | {z } | {z } | {z } | {z } | {z } term term term term predicate predicate

  Built from atomic sentences using connectives

S S S S

  ¬SSSSS

  1

  2

  1

  2

  1

  2

  1

  2

  (as in propositional logic)

  Example Sibling , Richard Sibling , KingJohn

  ( KingJohn ) ⇒ ( Richard )

  | {z } | {z } | {z } | {z } | {z } | {z } term term term term predicate predicate

  

| {z } | {z }

atomic sentence atomic sentence

  Built from atomic sentences using connectives

  | {z } term

  |

{z

  | {z } atomic sentence

  )

  | {z } term

  , KingJohn

  | {z } term

  ( Richard

  Sibling | {z } predicate

  ⇒

  | {z } atomic sentence

  )

  | {z } term

  , Richard

  ( KingJohn

  ¬S

  Example Sibling | {z } predicate

  (as in propositional logic)

  2

  ⇔ S

  1

  2 S

  ⇒ S

  1

  2 S

  ∨ S

  1

  ∧ S

  1

  S

  }

complex sentence

  Models of first-order logic

  Sentences are true or false with respect to models, which consist of – a domain (also called universe) – an interpretation

  Models of first-order logic

  Sentences are true or false with respect to models, which consist of – a domain (also called universe) – an interpretation

  Domain

  A non-empty (finite or infinite) set of arbitrary elements

  Models of first-order logic

  Sentences are true or false with respect to models, which consist of – a domain (also called universe) – an interpretation

  Domain

  A non-empty (finite or infinite) set of arbitrary elements

  Interpretation

  Assigns to each – constant symbol: a domain element – predicate symbol: a relation on the domain (of appropriate arity) – function symbol: a function on the domain (of appropriate arity)

  Definition

  An atomic sentence , . . . , n

  predicate term term

  ( )

  1

  is true in a certain model (that consists of a domain and an interpretation) iff n the domain elements that are the interpretations of term , . . . , term

  1

  are in the relation that is the interpretation of predicate

  Definition

  An atomic sentence , . . . , n

  predicate term term

  ( )

  1

  is true in a certain model (that consists of a domain and an interpretation) iff n the domain elements that are the interpretations of term , . . . , term

  1

  are in the relation that is the interpretation of predicate The truth value of a complex sentence in a model is computed from the truth-values of its atomic sub-sentences in the same way as in propositional logic

  Constants: KingJohn , Richard Predicates:

  person

  ,

  king

  ,

  crown

  Functions:

  brother

  ,

  on

  _

  head

  ,

  left

  _

  leg

  Syntax

  ∀

  variables sentence

  Syntax variables sentence

  ∀

  Example

  “Everyone studying in Koblenz is smart:

  x

  ∀ (StudiesAt(x, Koblenz) ⇒ Smart(x))

  |{z} | {z } sentence variables

  Semantics

  is true in a modelxP iff

  d

  for all domain elements in the model:

  P is true in the model when x is interpreted by d

  Semantics

  is true in a modelxP iff

  d

  for all domain elements in the model:

  P is true in the model when x is interpreted by d Intuition

  is roughly equivalent to the conjunction of all instances of Px P

  Semantics

  is true in a modelxP iff

  d

  for all domain elements in the model:

  P is true in the model when x is interpreted by d Intuition

  is roughly equivalent to the conjunction of all instances of Px P

  Example

  equivalent to:x StudiesAt(x, Koblenz) ⇒ Smart(x)

  StudiesAt

  (KingJohn, Koblenz) ⇒ Smart(KingJohn) ∧ StudiesAt(Richard, Koblenz) ⇒ Smart(Richard) ∧ StudiesAt(Koblenz, Koblenz) ⇒ Smart(Koblenz) ∧ . . .

  Note

  is the main connective with

  ∀

  Common mistake

  Using as the main connective with

  ∀

  Note

  is the main connective with

  ∀

  Common mistake

  Using as the main connective with

  ∀

  Example Correct: Smart

  ∀x (StudiesAt(x, Koblenz) ⇒ (x)) “Everyone who studies at Koblenz is smart”

  Note

  is the main connective with

  ∀

  Common mistake

  Using as the main connective with

  ∀

  Example Correct: Smart

  ∀x (StudiesAt(x, Koblenz) ⇒ (x)) “Everyone who studies at Koblenz is smart”

  Smart Wrong:

  ∀x (StudiesAt(x, Koblenz) ∧ (x)) “Everyone studies at Koblenz and is smart”, i.e., “Everyone studies at Koblenz and everyone is smart”

  Syntax

  ∃

  variables sentence

  Syntax variables sentence

  ∃

  Example

  “Someone studying in Landau is smart:

  x

  ∃ (StudiesAt(x, Landau) ∧ Smart(x))

  |{z} | {z } sentence variables

  Semantics

  is true in a modelxP iff

  d

  there is a domain element in the model such that:

  P is true in the model when x is interpreted by d

  Semantics

  is true in a modelxP iff

  d

  there is a domain element in the model such that:

  P is true in the model when x is interpreted by d Intuition

  is roughly equivalent to the disjunction of all instances of Px P

  Semantics

  is true in a modelxP iff

  d

  there is a domain element in the model such that:

  P is true in the model when x is interpreted by d Intuition

  is roughly equivalent to the disjunction of all instances of Px P

  Example

  equivalent to:x StudiesAt(x, Landau) ∧ Smart(x)

  StudiesAt

  (KingJohn, Landau) ∧ Smart(KingJohn) ∨ StudiesAt(Richard, Landau) ∧ Smart(Richard) ∨ StudiesAt(Landau, Landau) ∧ Smart(Landau) ∨ . . .

  Note

  is the main connective with

  ∃

  Common mistake

  Using as the main connective with

  ∃

  Note

  is the main connective with

  ∃

  Common mistake

  Using as the main connective with

  ∃

  Example Correct: Smart

  ∃x (StudiesAt(x, Landau) ∧ (x)) “There is someone who studies at Landau and is smart”

  Note

  is the main connective with

  ∃

  Common mistake

  Using as the main connective with

  ∃

  Example Correct: Smart

  ∃x (StudiesAt(x, Landau) ∧ (x)) “There is someone who studies at Landau and is smart”

  Smart Wrong:

  ∃x (StudiesAt(x, Landau) ⇒ (x)) “There is someone who, if he/she studies at Landau, is smart” This is true if there is anyone not studying at Landau

  Quantifiers of same type commute

  is the same asxy

  ∀yx is the same as

  ∃xyyx

  Quantifiers of different type do NOT commute

  is not the same asxy

  ∀yx

  Example

  ∃xyLoves(x, y) “There is a person who loves everyone in the world”yxLoves(x, y) “Everyone in the world is loved by at least one person” (Both hopefully true but different)

  Quantifiers of different type do NOT commute

  is not the same asxy

  ∀yx

  Example

  ∀xyMother(x, y) “Everyone has a mother” (correct)yxMother(x, y) “There is a person who is the mother of everyone” (wrong)

  Quantifier duality

  is the same asxLikes(x, IceCream)

  ¬∃x¬Likes(x, IceCream) is the same as

  ∃xLikes(x, Broccoli) ¬∀x¬Likes(x, Broccoli)

  “Brothers are siblings”x, y (Brother(x, y) ⇒ Sibling(x, y))

  “Brothers are siblings”x, y (Brother(x, y) ⇒ Sibling(x, y)) “Sibling” is symmetricx, y (Sibling(x, y) ⇔ Sibling(y, x))

  “Brothers are siblings”x, y (Brother(x, y) ⇒ Sibling(x, y)) “Sibling” is symmetricx, y (Sibling(x, y) ⇔ Sibling(y, x)) “One’s mother is one’s female parent”x, y (Mother(x, y) ⇔ (Female(x) ∧ Parent(x, y)))

  “Brothers are siblings”x, y (Brother(x, y) ⇒ Sibling(x, y)) “Sibling” is symmetricx, y (Sibling(x, y) ⇔ Sibling(y, x)) “One’s mother is one’s female parent”x, y (Mother(x, y) ⇔ (Female(x) ∧ Parent(x, y))) “A first cousin is a child of a parent’s sibling”x, y (FirstCousin(x, y) ⇔ ∃p, ps (Parent(p, x) ∧ Sibling(ps, p) ∧ Parent(ps, y)))

  Semantics term is true under a given interpretation

  = term

  1

  2

  if and only if

  term and term have the same interpretation

  1

  2

  Example

  Definition of (full) sibling in terms of Parentx, y Sibling(x, y) ⇔ (¬(x = y) ∧

  ∃m, f (¬(m = f ) ∧

  Parent

  (m, x) ∧ Parent( f , x) ∧

  Parent

  (m, y) ∧ Parent( f , y)))

  Important notions

  • – validity – satisfiability – unsatisfiablity – entailment are defined for first-order logic in the same way as for propositional logic

  Important notions

  • – validity – satisfiability – unsatisfiablity – entailment are defined for first-order logic in the same way as for propositional logic

  Calculi

  There are sound and complete calculi for first-order logic (e.g. resolution) Whenever KB , it is also true that KB

  ⊢ α |= α Whenever KB , it is also true that KB

  |= α ⊢ α But these calculi CANNOT decide validity, entailment, etc.

  In propositional logic

  Validity, satisfiability, unsatisfiablity are decidable

  In first-order logic

  The set of valid, and the set of unsatisfiable formulas are enumerable The set of satisfiable formulas is NOT EVEN enumerable

Dokumen yang terkait

Soil characteristics pattern with the depth as affected by forest conversion to rubber plantation

0 0 6

Spatial distribution of land susceptibility to degradation and recommendation for its improvement: a case study in the upper Solo Sub-Watershed

0 0 8

Application of perennial legume green manures to improve growth and yield of organic lowland rice

0 1 8

Comparative Study of Acetylation Reactions to Mentol Compounds Using Lipase from Candida Antarctica Recombined Aspergillus oryzae with Rhizomucor miehei

0 0 8

Pengaruh Debt to Equity Ratio, Firm Size, Inventory Turnover,

0 0 20

Ni Ketut Rendi Astuti ( Dosen STIA Denpasar ) Ni Made Gunastri ( Dosen STIMI “Handayani” Denpasar ) Abstracts : Pervasive poverty remains a major challenge to the efforts of development

0 0 16

KEPUASAN KERJA SEBAGAI MEDIASI HUBUNGAN KOMUNIKASI DAN BUDAYA ORGANISASI TERHADAP KINERJA KARYAWAN (Studi pada Puri Saron Hotel Group di Bali) Anak Agung Ketut Sri Asih I Wayan Arta Artana Abstract: This study aimed to determine the effect of direct and i

0 0 13

FAKTOR-FAKTOR YANG MEMPENGARUHI KINERJA KARYAWAN PADA PT SURYA CAHAYA INTI DENPASAR I Gusti Gde Oka Pradnyana ( Dosen STIMI Handayani Denpasar) Windry Anggraini Kase Abstract : The objectives of this research is to determine whether there is influence

0 0 15

KEMIRIPAN DAN KEUNGGULAN KREDIT MODAL KERJA (KMK) BANK PEMBANGUNAN DAERAH BALI DENGAN BEBERAPA BANK PESAING I Made Purba Astakoni (STIMI Handayani Denpasar) astakonimadegmail.com Abstracts : The aim of this study were 1) to determine the similarity (simil

0 1 14

PENGARUH KOMPOSISI BAHAN BAKU MASSA COR CN (CN2, CN3, CN6, CN7, CN8) TERHADAP TEKNOLOGI PROSES DAN VARIABEL KEUANGAN PADA UPT PSTKP BALI-BPPT Ni Nyoman Nurani STIMI Handayani-Denpasar nyoman.nuranisunlife.co.id Abstracts: The aims of this are to know the

0 0 19