1 / 18

Inference in first-order logic

Inference in first-order logic. Chapter 9- Part2 Modified by Vali Derhami. Backward chaining algorithm. SUBST(COMPOSE( θ 1 , θ 2 ), p) = SUBST( θ 2 , SUBST( θ 1 , p)) ترکیب جایگزینی معادل تاثیر به کارگیری هر یک از جایگزینها به نوبت است. Backward chaining example. Backward chaining example.

meryle
Download Presentation

Inference in first-order logic

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Inference in first-order logic Chapter 9- Part2 Modified by Vali Derhami

  2. Backward chaining algorithm SUBST(COMPOSE(θ1, θ2), p) = SUBST(θ2, SUBST(θ1, p)) ترکیب جایگزینی معادل تاثیر به کارگیری هر یک از جایگزینها به نوبت است

  3. Backward chaining example

  4. Backward chaining example

  5. Backward chaining example

  6. Backward chaining example

  7. Backward chaining example

  8. Backward chaining example

  9. Backward chaining example

  10. Backward chaining example

  11. Properties of backward chaining • Depth-first recursive proof search: space is linear in size of proof • Incomplete due to infinite loops (even for Datalog) •  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 for logic programming

  12. Logic programming: Prolog • Algorithm = Logic + Control • Basis: backward chaining with Horn clauses • Uses uppercase letters for variables and lowercase for constants. • Clauses are written with the head preceding the body; ": -" is used for left- implication, commas separate literals in the body, and ‘.’ for end of a sentence. • Widely used in Europe, Japan • Program = set of clauses = head :- literal1, … literaln. criminal(X) :- american(X), weapon(Y), sells(X,Y,Z), hostile(Z). • Depth-first, left-to-right backward chaining • Built-in predicates for arithmetic etc., e.g., X is Y*Z+3

  13. Resolution: brief summary • Full first-order version: l1···lk, m1···mn (l1···li-1li+1 ···lkm1···mj-1mj+1···mn)θ where Unify(li, mj) = θ. • The two clauses are assumed to be standardized apart so that they share no variables. • For example: Rich(x) Unhappy(x) Rich(Ken) Unhappy(Ken) with θ = {x/Ken} • Apply resolution steps to CNF(KB α); complete for FOL

  14. Conversion to CNF • Everyone who loves all animals is loved by someone: x [y Animal(y) Loves(x,y)]  [y Loves(y,x)] 1. Eliminate biconditionals and implications x [y Animal(y) Loves(x,y)]  [yLoves(y,x)] 2. Move  inwards: x p ≡x p,  x p ≡x p x [y (Animal(y) Loves(x,y))]  [y Loves(y,x)] x [y Animal(y) Loves(x,y)]  [y Loves(y,x)] x [y Animal(y) Loves(x,y)]  [y Loves(y,x)]

  15. Conversion to CNF contd. • Standardize variables: each quantifier should use a different one x [y Animal(y) Loves(x,y)]  [z Loves(z,x)] • Skolemize: a more general form of existential instantiation. Each existential variable is replaced by a Skolem function of the enclosing universally quantified variables: x [Animal(F(x)) Loves(x,F(x))] Loves(G(x),x) • Drop universal quantifiers: [Animal(F(x)) Loves(x,F(x))] Loves(G(x),x) • Distribute  over  : [Animal(F(x)) Loves(G(x),x)]  [Loves(x,F(x)) Loves(G(x),x)]

  16. Resolution proof: definite clauses • R1: American(x)  Weapon(y)  Sells(x,y,z)  Hostile(z)  Criminal(x) • R2: Missile(x1)  Owns(Nono,x1)  Sells(West,x1,Nono) • R3: Missile(x2)  Weapon(x2) • R4: Enemy(x3,America)  Hostile(x3) • Owns(Nono,M1) • Missile(M1) • American(West) • Enemy(Nono,America)

  17. Resolution proof: definite clauses • R1: American(x)  Weapon(y)  • Sells(x,y,z)  Hostile(z)  Criminal(x) • R2: Missile(x1)  Owns(Nono,x1)  Sells(West,x1,Nono) • R3: Missile(x2)  Weapon(x2) • R4: Enemy(x3,America)  Hostile(x3) • Owns(Nono,M1) • Missile(M1) • American(West) • Enemy(Nono,America)

  18. تمارین فصل 9: 4، 9، 18 و سوالات تستی

More Related