and Applications Lecture 3: Review of First-Order Logic (FOL) Juan - - PowerPoint PPT Presentation

β–Ά
and applications
SMART_READER_LITE
LIVE PREVIEW

and Applications Lecture 3: Review of First-Order Logic (FOL) Juan - - PowerPoint PPT Presentation

Artificial Intelligence: Methods and Applications Lecture 3: Review of First-Order Logic (FOL) Juan Carlos Nieves Snchez November 11, 2014 Outline Knowledge Engineering. Reducing first-order inference to propositional inferece.


slide-1
SLIDE 1
slide-2
SLIDE 2

Artificial Intelligence: Methods and Applications

Lecture 3: Review of First-Order Logic (FOL) Juan Carlos Nieves SΓ‘nchez November 11, 2014

slide-3
SLIDE 3

Review of First-Order Logic 3

Outline

  • Knowledge Engineering.
  • Reducing first-order inference to propositional inferece.
  • Unification.
  • Generalized Modus Pones
  • Forward and backward chaining
  • Resolution
slide-4
SLIDE 4

The knowledge-engineering process

1. Identify the task (identify the questions of interest). 2. Assemble the relevant knowledge (acquisition). 3. Decide on a vocabulaty of predicates, functions, and constants (the ontology). 4. Encode general knowledge about the domain (write down axioms). 5. Encode a description of the specific problem instance. 6. Pose queries to the inference procedure and get answers (use the system). 7. Debug/maintain the knowleg base.

Review of First-Order Logic 4

slide-5
SLIDE 5

Relations

An n-ary relation R is a subset of the Catetian product π‘¬πŸ Γ— βˆ™βˆ™βˆ™ Γ— 𝑬𝒐 where each 𝑬𝒋 𝟐 ≀ 𝒋 ≀ 𝒐 is a set.

Review of First-Order Logic 6

For example: PR(x) – the set of numbers x which are prime: {2,3,5,7,11, . . . }. SQ(x,y) – the set of pairs (x,y) such that y is the square of x: 1,1 , 2,4 , 3,9 , . . . .

Can you define the relation of sum of two integer numbers?

slide-6
SLIDE 6

Predicates

A relation can be formalized as a boolean-valued function on n-tuples:

Review of First-Order Logic 7

Let D be a set. R is an n-ary relation on the domain D if R is a relation on 𝑬𝒐. Let R be an n-ary relation on a domain D. The predicate P associated with R is: For example: SQ(2,1) = F SQ(2,2) = F SQ(2,3) = F SQ(2,4) = T

slide-7
SLIDE 7

The syntax of FOL

Review of First-Order Logic 8

π‘‡π‘“π‘œπ‘’π‘“π‘œπ‘‘π‘“ β†’ π΅π‘’π‘π‘›π‘—π‘‘π‘‡π‘“π‘œπ‘’π‘“π‘œπ‘‘π‘“ | π·π‘π‘›π‘žπ‘šπ‘“π‘¦π‘‡π‘“π‘œπ‘’π‘“π‘œπ‘‘π‘“ π΅π‘’π‘π‘›π‘—π‘‘π‘‡π‘“π‘œπ‘’π‘“π‘œπ‘‘π‘“ β†’ π‘žπ‘ π‘“π‘’π‘—π‘‘π‘π‘’π‘“ π‘žπ‘ π‘“π‘’π‘—π‘‘π‘π‘’π‘“ π‘ˆπ‘“π‘ π‘›1,… π‘ˆπ‘“π‘ π‘› = π‘ˆπ‘“π‘ π‘› π·π‘π‘›π‘žπ‘šπ‘“π‘¦π‘‡π‘“π‘œπ‘’π‘“π‘œπ‘‘π‘“ β†’ π‘‡π‘“π‘œπ‘’π‘“π‘œπ‘‘π‘“ π‘‡π‘“π‘œπ‘’π‘“π‘œπ‘‘π‘“ Β¬ π‘‡π‘“π‘œπ‘’π‘“π‘œπ‘‘π‘“ | Sentence Sentence | Sentence Sentence | π‘‡π‘“π‘œπ‘’π‘“π‘œπ‘‘π‘“ β‡’ π‘‡π‘“π‘œπ‘’π‘“π‘œπ‘‘π‘“ | π‘‡π‘“π‘œπ‘’π‘“π‘œπ‘‘π‘“ π‘‡π‘“π‘œπ‘’π‘“π‘œπ‘‘π‘“ | π‘…π‘£π‘π‘œπ‘’π‘—π‘”π‘—π‘“π‘  π‘Šπ‘π‘ π‘—π‘π‘π‘šπ‘“ , . . . π‘‡π‘“π‘œπ‘’π‘œπ‘‘π‘“ π‘ˆπ‘“π‘ π‘› β†’ πΊπ‘£π‘œπ‘‘π‘’π‘—π‘π‘œ π‘ˆπ‘“π‘ π‘›, … π·π‘π‘œπ‘‘π‘’π‘π‘œπ‘’ π‘Šπ‘π‘ π‘—π‘π‘π‘šπ‘“ π‘…π‘£π‘π‘œπ‘’π‘—π‘”π‘—π‘“π‘  β†’ βˆ€ | βˆƒ π·π‘π‘œπ‘‘π‘’π‘π‘œπ‘’ β†’ A | X1 | Johm | … π‘Šπ‘π‘ π‘—π‘π‘π‘šπ‘“ β†’ A | x | s | … 𝑄𝑠𝑓𝑒𝑗𝑑𝑏𝑒𝑓 β†’ After | Loves | .. πΊπ‘£π‘œπ‘‘π‘’π‘—π‘π‘œ β†’ LeftLeg

slide-8
SLIDE 8

An example of a FOL Theory

We build a knowledge base for natural numbers using the following vocabulary:

  • The relation name Num
  • The constant name 0
  • The function names + and S

Assertions:

  • 𝑂𝑣𝑛(0)
  • βˆ€ 𝑦 𝑂𝑣𝑛 𝑦 β‡’ 𝑂𝑣𝑛 𝑇 𝑦
  • βˆ€ 𝑦 𝑇 𝑦 != 0
  • βˆ€ 𝑦, 𝑧 𝑦 ! = 𝑧 β‡’ 𝑇 𝑦 ! = 𝑇 𝑧
  • βˆ€ 𝑦 𝑂𝑣𝑛 𝑦 β‡’ 𝑦 + 0 = 𝑦
  • βˆ€ 𝑦 𝑂𝑣𝑛 𝑦

∧ 𝑂𝑣𝑛 𝑧 β‡’ 𝑇 𝑦 + 𝑧 = 𝑇(𝑦 + 𝑧)

Review of First-Order Logic 9

slide-9
SLIDE 9

Queries

Asking our knowledge base whether: ? 𝑇 𝑇 𝑇 0 = 𝑇 𝑇 0 + 𝑇(0) Should now in principle yield the answer true. By the first two assertions , all three objects involved are numbers. By the last assertion, the equality must hold. This means that 𝑇 𝑇 𝑇 0 = 𝑇 𝑇 0 + 𝑇(0) is a theorem of our system. It can be derived from our axioms.

Review of First-Order Logic 10

slide-10
SLIDE 10

Another example of a knowledge base

The law says that is a crime for an American to sell weapons to a hostile

  • nations. The country Nono, an enemy of America, has some missiles, and

all of its missiles were sold to by Colonel West, who is American.

Review of First-Order Logic 11

.. it is a crime for an American to sell weapons to hostile nations: βˆ€ 𝑦, 𝑧, 𝑨 π΅π‘›π‘“π‘ π‘—π‘‘π‘π‘œ 𝑦 ∧ π‘‹π‘“π‘π‘žπ‘π‘œ 𝑧 ∧ π‘‡π‘“π‘šπ‘šπ‘‘ 𝑦, 𝑧, 𝑨 ∧ πΌπ‘π‘‘π‘’π‘—π‘šπ‘“ 𝑨 β‡’ π·π‘ π‘—π‘›π‘—π‘œπ‘π‘š(𝑦) Nono … has some missiles: βˆƒ 𝑦 𝑃π‘₯π‘œπ‘‘ π‘‚π‘π‘œπ‘, 𝑦 ∧ π‘π‘—π‘‘π‘‘π‘—π‘šπ‘“ 𝑦 . .. all of its missiles were sold to it by Colonel West: βˆ€π‘¦ π‘π‘—π‘‘π‘‘π‘—π‘šπ‘“ 𝑦 ∧ 𝑃π‘₯𝑛𝑑 π‘‚π‘π‘œπ‘, 𝑦 β‡’ π‘‡π‘“π‘šπ‘šπ‘‘(𝑋𝑓𝑑𝑒, 𝑦, π‘‚π‘π‘œπ‘) Missiles are weapons: βˆ€ 𝑦 π‘π‘—π‘‘π‘‘π‘—π‘šπ‘“ 𝑦 β‡’ π‘‹π‘“π‘π‘žπ‘π‘œ( 𝑦) West, who is American: π΅π‘›π‘“π‘ π‘—π‘‘π‘π‘œ(𝑋𝑓𝑑𝑒) The country Nono, an enemy of America: πΉπ‘œπ‘“π‘›π‘§(π‘‚π‘π‘œπ‘, 𝐡𝑛𝑓𝑠𝑗𝑑𝑏) An enemy of America counts as β€œhostile”: βˆ€ 𝑦 πΉπ‘œπ‘“π‘›π‘—π‘•π‘§ 𝑦, 𝐡𝑛𝑓𝑠𝑗𝑑𝑏 β‡’ πΌπ‘π‘‘π‘’π‘—π‘šπ‘“(𝑦)

How to solve queries automatically?

slide-11
SLIDE 11

Universal Instantiation (UI)

Every instantiation of a universal quantified sentence is entailed by it: βˆ€ 𝑀 𝛽 π‘‡π‘‰πΆπ‘‡π‘ˆ({𝑀/𝑕, 𝛽}) for any variable 𝑀 and ground term 𝑕. E.g., βˆ€ 𝑦 πΏπ‘—π‘œπ‘• 𝑦 ∧ 𝐻𝑠𝑓𝑓𝑒𝑧 𝑦 β‡’ πΉπ‘€π‘—π‘š(𝑦) yields πΏπ‘—π‘œπ‘• πΎπ‘β„Žπ‘œ ∧ 𝐻𝑠𝑓𝑓𝑒𝑧 πΎπ‘β„Žπ‘œ β‡’ πΉπ‘€π‘—π‘š(πΎπ‘β„Žπ‘œ) πΏπ‘—π‘œπ‘• π‘†π‘—π‘‘β„Žπ‘π‘ π‘’ ∧ 𝐻𝑠𝑓𝑓𝑒𝑧 π‘†π‘—π‘‘β„Žπ‘π‘ π‘’ β‡’ πΉπ‘€π‘—π‘š(π‘†π‘—π‘‘β„Žπ‘π‘ π‘’) πΏπ‘—π‘œπ‘• π‘”π‘π‘’β„Žπ‘“π‘  πΎπ‘β„Žπ‘œ ∧ 𝐻𝑠𝑓𝑓𝑒𝑧 π‘”π‘π‘’β„Žπ‘“π‘  π‘˜π‘β„Žπ‘œ β‡’ πΉπ‘€π‘—π‘š(π‘”π‘π‘’β„Žπ‘“π‘ (π‘˜π‘β„Žπ‘œ)) ….

Review of First-Order Logic 12

slide-12
SLIDE 12

Existential instantiation (EI)

For any sentence 𝛽, variable 𝑀, and constnat symbol 𝑙 that does not appear alsewhere in the knowledge base: βˆƒ 𝑀 𝛽 π‘‡π‘‰πΆπ‘‡π‘ˆ({𝑀/𝑕, 𝐿) E.g. βˆƒ 𝑦 𝐷𝑠𝑝π‘₯π‘œ 𝑦 ∧ OnHead x, John yields 𝐷𝑠𝑝π‘₯π‘œ 𝐷1 ∧ π‘ƒπ‘œπΌπ‘“π‘π‘’ (𝐷1, πΎπ‘β„Žπ‘œ) such that 𝐷1 is a new constant symbol, called Skolen constant.

Review of First-Order Logic 13

OBSERVATIONS: UI can be applied several times to add new sentences; the new logical theory is logical equivalent to the old. EI can be applied once to replace the existence sentence; the new logical theory is not logical equivalent to the old, but is satisfiable iff the old logical theory was satisfiable.

slide-13
SLIDE 13

Reduction to propositional inference

Suppose the KB contains just the following: βˆ€π‘¦ πΏπ‘—π‘œπ‘• 𝑦 ∧ 𝐻𝑠𝑓𝑓𝑒𝑧 𝑦 β‡’ πΉπ‘€π‘—π‘š 𝑦 πΏπ‘—π‘œπ‘’ πΎπ‘β„Žπ‘œ 𝐻𝑠𝑓𝑓𝑒𝑧 πΎπ‘β„Žπ‘œ πΆπ‘ π‘π‘’β„Žπ‘“π‘  π‘†π‘—π‘‘β„Žπ‘π‘ π‘’, πΎπ‘β„Žπ‘œ Instantiating the universal sentence in all possible ways, we have πΏπ‘—π‘œπ‘• πΎπ‘β„Žπ‘œ ∧ 𝐻𝑠𝑓𝑓𝑒𝑧 πΎπ‘β„Žπ‘œ β‡’ πΉπ‘€π‘—π‘š(πΎπ‘β„Žπ‘œ) πΏπ‘—π‘œπ‘• π‘†π‘—π‘‘β„Žπ‘π‘ π‘’ ∧ 𝐻𝑠𝑓𝑓𝑒𝑧 π‘†π‘—π‘‘β„Žπ‘π‘ π‘’ β‡’ πΉπ‘€π‘—π‘š(π‘†π‘—π‘‘β„Žπ‘π‘ π‘’) πΏπ‘—π‘œπ‘’ πΎπ‘β„Žπ‘œ 𝐻𝑠𝑓𝑓𝑒𝑧 πΎπ‘β„Žπ‘œ πΆπ‘ π‘π‘’β„Žπ‘“π‘  π‘†π‘—π‘‘β„Žπ‘π‘ π‘’, πΎπ‘β„Žπ‘œ The new KB is propositionalized. Some of the proposition symbols are πΏπ‘—π‘œπ‘’ πΎπ‘β„Žπ‘œ , 𝐻𝑠𝑓𝑓𝑒𝑧 πΎπ‘β„Žπ‘œ , πΉπ‘€π‘—π‘š πΎπ‘β„Žπ‘œ , … .

Review of First-Order Logic 14

slide-14
SLIDE 14

Observations of the reduction

  • Claim: A grounded sentence is entailed by the new knowledge base iff

entailed by the original knoledge base.

  • Claim: Every FOL knowledge base can be propositionalized so as to

preserve entailment.

  • Idea: propositonalize knowledge base and query, apply resolution,

return result.

  • Problem: with functions symbols, there are infinitely many grounded

terms.

  • Theorem: Helbrad (1930), If a sentence 𝛽 is enteilated by an FOL

knowledge base, it is entailed by a finite subset of the propositonal knowled base.

  • Idea: For π‘œ = 0 to ∞ do

create a propositional knowleg base by instatiating with depth-π‘œ terms

see if 𝛽 is entailed by this propositional knowledge base

  • Problem: works if 𝛽 is entailed, loops if 𝛽 is not entailed
  • Thoerem: Turing (1936), Church(1936), entailment if FOL is

semidecidable

Review of First-Order Logic 15

slide-15
SLIDE 15

Problems with propositonalization

Propositionalization seems to generate lots of irrelevant sentences. E.g., from βˆ€π‘¦ πΏπ‘—π‘œπ‘• 𝑦 ∧ 𝐻𝑠𝑓𝑓𝑒𝑧 β‡’ πΉπ‘€π‘—π‘š 𝑦 πΏπ‘—π‘œπ‘• πΎπ‘β„Žπ‘œ βˆ€ 𝑧 𝐻𝑠𝑓𝑓𝑒𝑧(𝑧) πΆπ‘ π‘π‘’β„Žπ‘“π‘ (π‘†π‘—π‘‘β„Žπ‘π‘ π‘’, πΎπ‘β„Žπ‘œ) it seems obvious that πΉπ‘€π‘—π‘š πΎπ‘β„Žπ‘œ , but propositionalization produces lots of facts such as 𝐻𝑠𝑓𝑓𝑒𝑧 π‘†π‘—π‘‘β„Žπ‘π‘ π‘’ that are inrrelevant. With π‘ž 𝑙-any predicates and π‘œ constants, there are π‘ž π‘œπ‘™ instantiations. With function symbols, it gets much much worse!

Review of First-Order Logic 16

slide-16
SLIDE 16

Unification

We can get the inference immediately if we can find a substitution πœ„ such that πΏπ‘—π‘œπ‘•(𝑦) and 𝐻𝑠𝑓𝑒𝑧(𝑦) match πΏπ‘—π‘œπ‘•(πΎπ‘β„Žπ‘œ) and 𝐻𝑠𝑓𝑓𝑒𝑧(𝑧) πœ„ = {𝑦/πΎπ‘β„Žπ‘œ, 𝑧/πΎπ‘β„Žπ‘œ} works Uπ‘œπ‘—π‘”π‘§ 𝛽, 𝛾 𝑗𝑔 π›½πœ„ = π›Ύπœ„

Review of First-Order Logic 17

𝜷 𝜸 𝜾 πΏπ‘œπ‘π‘₯𝑑(πΎπ‘β„Žπ‘œ, 𝑦) πΏπ‘œπ‘π‘₯𝑑(πΎπ‘β„Žπ‘œ, πΎπ‘π‘œπ‘“) {𝑦/πΎπ‘π‘œπ‘“ } πΏπ‘œπ‘π‘₯𝑑(πΎπ‘β„Žπ‘œ, 𝑦) πΏπ‘œπ‘π‘₯𝑑(𝑧, 𝑃𝐾) {𝑦/𝑃𝐾, 𝑧/πΎπ‘β„Žπ‘œ} πΏπ‘œπ‘π‘₯𝑑(πΎπ‘β„Žπ‘œ, 𝑦) πΏπ‘œπ‘π‘₯𝑑(𝑧, π‘π‘π‘’β„Žπ‘“π‘ (𝑧)) {𝑦/π‘π‘π‘’β„Žπ‘“π‘ (πΎπ‘β„Žπ‘œ), 𝑧/πΎπ‘β„Žπ‘œ} πΏπ‘œπ‘π‘₯𝑑(πΎπ‘β„Žπ‘œ, 𝑦) πΏπ‘œπ‘π‘₯𝑑(𝑦, 𝑃𝐾) π‘”π‘π‘—π‘š

slide-17
SLIDE 17

Generalized Modus Ponens (GMP)

π‘žβ€²1, π‘žβ€²2,..., π‘žβ€²π‘œ,

(π‘ž1βˆ§π‘ž2 ∧ ...∧ π‘žπ‘œ β‡’π‘Ÿ)

π‘Ÿπœ„

where π‘žβ€²π‘— πœ„ = π‘žπ‘— πœ„ for all 𝑗 π‘žβ€²1 is πΏπ‘—π‘œπ‘•(πΎπ‘β„Žπ‘œ) π‘ž1 is πΏπ‘—π‘œπ‘•(𝑦) π‘žβ€²2 is 𝐻𝑠𝑓𝑓𝑒𝑧(𝑧) π‘ž2 is 𝐻𝑠𝑓𝑓𝑒𝑧(𝑦) πœ„ is πœ„ = {𝑦/πΎπ‘β„Žπ‘œ, 𝑧/πΎπ‘β„Žπ‘œ} π‘Ÿ is πΉπ‘€π‘—π‘š(𝑦) π‘Ÿπœ„ is πΉπ‘€π‘—π‘š πΎπ‘β„Žπ‘œ GMP used with knowledge bases of definte clauses (exactly one positive literal). All the variables assumed universally quantified

Review of First-Order Logic 18

slide-18
SLIDE 18

Example knowledge base

The law says that is a crime for an American to sell weapons to a hostile

  • nations. The country Nono, an enemy of America, has some missiles, and

all of its missiles were sold to iy by Colonel West, who is American.

Review of First-Order Logic 19

Prove that Colonel Est is a crimintal .. it is a crime for an American to sell weapons to hostile nations: π΅π‘›π‘“π‘ π‘—π‘‘π‘π‘œ 𝑦 ∧ π‘‹π‘“π‘π‘žπ‘π‘œ 𝑧 ∧ π‘‡π‘“π‘šπ‘šπ‘‘ 𝑦, 𝑧, 𝑨 ∧ πΌπ‘π‘‘π‘’π‘—π‘šπ‘“ 𝑨 β‡’ π·π‘ π‘—π‘›π‘—π‘œπ‘π‘š(𝑦) Nono … has some missiles: βˆƒ 𝑦 𝑃π‘₯π‘œπ‘‘ π‘‚π‘π‘œπ‘, 𝑦 ∧ π‘π‘—π‘‘π‘‘π‘—π‘šπ‘“ 𝑦 . If we apply Skolemization, we get 𝑃π‘₯π‘œπ‘‘ π‘‚π‘π‘œπ‘, 𝑁1 ∧ π‘π‘—π‘‘π‘‘π‘—π‘šπ‘“ 𝑁1 . .. all of its missiles were sold to it by Colonel West: βˆ€π‘¦ π‘π‘—π‘‘π‘‘π‘—π‘šπ‘“ 𝑦 ∧ 𝑃π‘₯𝑛𝑑 π‘‚π‘π‘œπ‘, 𝑦 β‡’ π‘‡π‘“π‘šπ‘šπ‘‘(𝑋𝑓𝑑𝑒, 𝑦, π‘‚π‘π‘œπ‘) Missiles are weapons: π‘π‘—π‘‘π‘‘π‘—π‘šπ‘“ 𝑦 β‡’ π‘‹π‘“π‘π‘žπ‘π‘œ( 𝑦) West, who is American: π΅π‘›π‘“π‘ π‘—π‘‘π‘π‘œ(𝑋𝑓𝑑𝑒) The country Nono, an enemy of America: πΉπ‘œπ‘“π‘›π‘§(π‘‚π‘π‘œπ‘, 𝐡𝑛𝑓𝑠𝑗𝑑𝑏) An enemy of America counts as β€œhostile”: πΉπ‘œπ‘“π‘›π‘—π‘•π‘§ 𝑦, 𝐡𝑛𝑓𝑠𝑗𝑑𝑏 β‡’ πΌπ‘π‘‘π‘’π‘—π‘šπ‘“(𝑦)

slide-19
SLIDE 19

Extensional knowledge base (facts):

Forward chaining inference

Review of First-Order Logic 20

Intentional knowledge base (rules):

  • π΅π‘›π‘“π‘ π‘—π‘‘π‘π‘œ 𝑦 ∧ π‘‹π‘“π‘π‘žπ‘π‘œ 𝑧 ∧ π‘‡π‘“π‘šπ‘šπ‘‘ 𝑦, 𝑧, 𝑨 ∧ πΌπ‘π‘‘π‘’π‘—π‘šπ‘“ 𝑨 β‡’ π·π‘ π‘—π‘›π‘—π‘œπ‘π‘š(𝑦)
  • π‘π‘—π‘‘π‘‘π‘—π‘šπ‘“ 𝑦 ∧ 𝑃π‘₯𝑛𝑑 π‘‚π‘π‘œπ‘, 𝑦 β‡’ π‘‡π‘“π‘šπ‘šπ‘‘(𝑋𝑓𝑑𝑒, 𝑦, π‘‚π‘π‘œπ‘)
  • πΉπ‘œπ‘“π‘›π‘—π‘•π‘§ 𝑦, 𝐡𝑛𝑓𝑠𝑗𝑑𝑏 β‡’ πΌπ‘π‘‘π‘’π‘—π‘šπ‘“(𝑦)
  • π‘π‘—π‘‘π‘‘π‘—π‘šπ‘“ 𝑦 β‡’ π‘‹π‘“π‘π‘žπ‘π‘œ( 𝑦)

π΅π‘›π‘“π‘ π‘—π‘‘π‘π‘œ(𝑋𝑓𝑑𝑒)

π‘π‘—π‘‘π‘‘π‘—π‘šπ‘“ 𝑁1 𝑃π‘₯π‘œπ‘‘ π‘‚π‘π‘œπ‘, 𝑁1 πΉπ‘œπ‘“π‘›π‘§(π‘‚π‘π‘œπ‘, 𝐡𝑛𝑓𝑠𝑗𝑑𝑏) π‘‹π‘“π‘π‘žπ‘π‘œ(𝑁1) π‘‡π‘“π‘šπ‘šπ‘‘(𝑋𝑓𝑑𝑒, 𝑁1, π‘‚π‘π‘œπ‘) πΌπ‘π‘‘π‘’π‘—π‘šπ‘“(π‘‚π‘π‘œπ‘) π·π‘ π‘—π‘›π‘—π‘œπ‘π‘š(𝑋𝑓𝑑𝑒)

slide-20
SLIDE 20

Properties of forward chaining

  • Sound and complete for first-order definite clauses (proof similar to

propositional proof).

  • Datalog = first-order definite clauses + no function. Forward chaining

terminates for Datalog in Poly interactions.

  • May not terminate in general if 𝛽 is not entailed.
  • Forward chaining is widely used in deductive databases.
  • Matching conjunctive premises against know facts is NP-hard.

Review of First-Order Logic 21

How can we avoid matching between conjunctive premises and know facts?

Backward chaining inference

slide-21
SLIDE 21

Backward chaining inference

Review of First-Order Logic 22

π·π‘ π‘—π‘›π‘—π‘œπ‘π‘š(𝑋𝑓𝑑𝑒)

π΅π‘›π‘“π‘ π‘—π‘‘π‘π‘œ 𝑋𝑓𝑑𝑒

π‘‹π‘“π‘π‘žπ‘π‘œ(𝑧) π‘‡π‘“π‘šπ‘šπ‘‘(𝑋𝑓𝑑𝑒, 𝑁1, 𝑨) πΌπ‘π‘‘π‘’π‘—π‘šπ‘“(π‘‚π‘π‘œπ‘) π‘π‘—π‘‘π‘‘π‘—π‘šπ‘“ 𝑧 π‘π‘—π‘‘π‘‘π‘—π‘šπ‘“ 𝑁1 𝑃π‘₯π‘œπ‘‘ π‘‚π‘π‘œπ‘, 𝑁1 πΉπ‘œπ‘“π‘›π‘§(π‘‚π‘π‘œπ‘, 𝐡𝑛𝑓𝑠𝑗𝑑𝑏)

slide-22
SLIDE 22

Properties of backward chaining

  • Depth-first recursive proof search: space is linear in size of proof.
  • Incomplete due to innite loops

– fix by checking current goal against every goal on stack

  • Inefficient due to repeated subgoals (both success and failure)
  • fix using caching of previous results (extra space!)
  • Widely used by classical logic programming interpreters!

Review of First-Order Logic 23

slide-23
SLIDE 23

Resolution: a short review

Review of First-Order Logic 24

where For example: With Apply resolution steps to complete for FOL

slide-24
SLIDE 24

Conversion to CNF

Review of First-Order Logic 25

Intentional knowledge base (rules):

  • π΅π‘›π‘“π‘ π‘—π‘‘π‘π‘œ 𝑦 ∧ π‘‹π‘“π‘π‘žπ‘π‘œ 𝑧 ∧ π‘‡π‘“π‘šπ‘šπ‘‘ 𝑦, 𝑧, 𝑨 ∧ πΌπ‘π‘‘π‘’π‘—π‘šπ‘“ 𝑨 β‡’ π·π‘ π‘—π‘›π‘—π‘œπ‘π‘š 𝑦

Β¬ π΅π‘›π‘“π‘ π‘—π‘‘π‘π‘œ 𝑦 ∨ Β¬π‘‹π‘“π‘π‘žπ‘π‘œ 𝑧 ∨ Β¬π‘‡π‘“π‘šπ‘šπ‘‘ 𝑦, 𝑧, 𝑨 ∨ Β¬πΌπ‘π‘‘π‘’π‘—π‘šπ‘“ 𝑨 ∨ π·π‘ π‘—π‘›π‘—π‘œπ‘π‘š 𝑦

  • π‘π‘—π‘‘π‘‘π‘—π‘šπ‘“ 𝑦 ∧ 𝑃π‘₯𝑛𝑑 π‘‚π‘π‘œπ‘, 𝑦 β‡’ π‘‡π‘“π‘šπ‘šπ‘‘(𝑋𝑓𝑑𝑒, 𝑦, π‘‚π‘π‘œπ‘)

Β¬ π‘π‘—π‘‘π‘‘π‘—π‘šπ‘“ 𝑦 ∨ Β¬ 𝑃π‘₯𝑛𝑑 π‘‚π‘π‘œπ‘, 𝑦 ∨ π‘‡π‘“π‘šπ‘šπ‘‘(𝑋𝑓𝑑𝑒, 𝑦, π‘‚π‘π‘œπ‘)

  • πΉπ‘œπ‘“π‘›π‘—π‘•π‘§ 𝑦, 𝐡𝑛𝑓𝑠𝑗𝑑𝑏 β‡’ πΌπ‘π‘‘π‘’π‘—π‘šπ‘“(𝑦)

Β¬πΉπ‘œπ‘“π‘›π‘—π‘•π‘§ 𝑦, 𝐡𝑛𝑓𝑠𝑗𝑑𝑏 ∨ πΌπ‘π‘‘π‘’π‘—π‘šπ‘“(𝑦)

  • π‘π‘—π‘‘π‘‘π‘—π‘šπ‘“ 𝑦 β‡’ π‘‹π‘“π‘π‘žπ‘π‘œ( 𝑦)

Β¬ π‘π‘—π‘‘π‘‘π‘—π‘šπ‘“ 𝑦 ∨ π‘‹π‘“π‘π‘žπ‘π‘œ( 𝑦)

slide-25
SLIDE 25

Resolution example

Review of First-Order Logic 26

slide-26
SLIDE 26

Observations

If a set of sentences is unsatisfiable, then resolution will always be able to derive a contradiction.

Review of First-Order Logic 27

Given a logical theory π‘ˆ and a formula 𝛽, if π‘ˆ entails 𝛽, then π‘ˆ ∧ Β¬ 𝛽 is unsatisfiable

  • Resolution is one of the most powerful tools for implementing

automated reasoning.

  • There are several extensions of the resolution rule in order to

implement inference in other non-classical logics, e.g. Possibilistic Logic.

slide-27
SLIDE 27

Datum Sidfot 28

Sources of this Lecture

  • S. Russell, P. Norvig, Artificial Intelligence: A Modern Approach. Third

Edition.

  • M. Ben-Ari, Mathematical Logic for Computer Science, Prentice Hall,

1993.

  • Some of these slides are based on the slides of the book: Artificial

Intelligence: A Modern Approach, by Stuart Russell and Peter Norvig