1 / 15

Dr. Eick’s Logical Reasoning Transparencies

Learn about First Order Predicate Logic (FOPL) and resolution, including examples and applications in PROLOG. Explore the process of converting assumptions and conclusions into clauses and using resolution to derive the empty clause.

Download Presentation

Dr. Eick’s Logical Reasoning Transparencies

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. Dr. Eick’s Logical Reasoning Transparencies • More Examples using First Order Predicate Logic as a Language • Resolution • For Propositional Calculus • For First Order Predicate Calculus • Unification • Resolution and PROLOG very short!

  2. 1. Example Sentences • Every vegetarian is intelligent. • Every NBA-player owns at least one house in Texas. • There are at least 2 giraffes in the Houston-Zoo.

  3. Example Sentences in FOPL Every vegetarian is intelligent. Vx (vegetarian(x)  intelligent(x)) Every NBA-player owns at least one house in Texas. Vx (nba(x)  ]h(house(h) ^ owns(x,h) ^ location(h,Texas) )) There are at least 2 giraffes in the Houston-Zoo. ]g1]g2 (giraffe(g1) ^ giraffe(g2) ^ not(g1=g2)) ^ lives(g1, HOU_Zoo) ^ lives(g2, HOU_Zoo) ))

  4. Answers Sept. 23, 2004 EnglishFOPL Exam • frog(Fred) ^green(Fred) • x (student(x) ^ (not(take(x,AGR2320) v not(take(x,AGR2388)) • xyz ((person(x) ^ person(y) ^ has-ssn(x,z) ^ has-ssn(y,z))  x=y) • x ((red(x) ^ car(x))  dangerous(x)) • xy(brother(x,Fred) ^ brother(y,Fred) ^ not(x=y)) ^ ~s sister(s,Fred) • abc((ontop(a,b) ^ ontop(b,c))  ontop(a,c)) same s not(sister(s,Fred))

  5. FOPL as a Language SolutionsAnswers to the Un-graded Quiz • frog(Fred) ^green(Fred) • Vx (red(x) ^ car(x)  dangerous(x)) • VxVyVz (person(x) ^ person(y) ^ has-ssn(x,z) ^ has-ssn(y,z)  x=y) • ]x (student(x) ^ registered(x,COSC6367) ^ Vy (registered(y,COSC6367) ^ not (x=y)  send-mail(x,y))) • Vm (man(m) ^ white(m)  not (jump-high(m)) ) • Not possible; no quantifier for “most”!

  6. Answers February 26, 2009EnglishFOPL Exam • m w (man(m)(woman(w) ^ loves(m,w))) • x (student(x) ^ (not(take(x,COSC6340) ^ not(take(x,COSC 6351)) • xyz ((person(x) ^ person(y) ^ has-ssn(x,z) ^ has-ssn(y,z))  x=y) • x (takes(x,COSC 6368) ^ esg1g2(((exam(e,COSC6368,s,g1) ^ (exam(e,COSC6368,x, g2)) ^ not(e=s))g2>g1)) No answer (“most” is a fuzzy quantifier) for (5)!! Remark: Exam(name,course,student,grade) is a predicate that captions the grades of students in courses for a particlar semester; e.g. exam(Mt,COSC6368,Fred,3.0)

  7. 2. Using Resolution for Propositional Calculus • Makes a proof by contradiction • Works with clauses --- knowledge is represented as a conjunct of disjuncts (conjunctive normal form) • Does not use modus ponens; uses the inference rule of resolution (m,n0): A1 v…v An v C; B1v…v Bm v ~C _____________________________ A1v…v An v B1v…v Bm • Steps of a resolution proof: • Convert assumption into clauses • Convert negated conclusion into clauses • Determine if the empty clause can  be derived from the clauses generated in steps 1 and 2. • Yes: theorem is proven • No*: theorem is not proven *:= things are more complicated for FOPL

  8. Proof by Contradiction • Assume you want to prove: A1,…,An |- B then the truth of this statement is verified as follows: • We assume that A1,..,An is true • We assume that ~B is true • We show that it can never be the case that A1,..,An are true and B is false…; that is, we look for a contraction (e.g. P and ~P are both true).

  9. Resolution for Propositional Calculus Example: P v (Q  R), Q  S, P  Q |- RS Clauses: • P v Q • P v R • ~Q v S • ~P v Q • R • ~S • ~Q using 3,6 • ~P v S using 3,4 • ~P using 6,8 • Q using 1,9 •  using 7,10

  10. Key Ideas --- Resolution for FOPL • All-quantifiers are replaced by match variables • Existential quantifiers are replaced by Skolem functions that depend on the variables of the surrounding all-quantifiers. • All match-variables in different clauses are renamed. • A generalized resolution inference rule is used (q denotes a substitution): • P v R, ~R’ v S, R and R’ unify, unify(R,R’)=q • q(P) v q(S) • Similar to resolution for prepositional calculus a proof by contradiction is conducted whose goal is to reach the empty clause (which represents a contradiction).

  11. https://en.wikipedia.org/wiki/Unification_(computer_science)

  12. (A1) Vp (~rich(p) --> ]m married(p,m) ) (A2) Vz (rich(z) --> ~]w married(z,w) ) (A3) VuVv (married(u,v) --> married(v,u) ) (~A) ~~ ]x]y (rich(x) ^ ~rich(y) ^ married(x,y) ) (1) rich($p) v married($p,F($p)) (2) ~rich($z) v ~married($z,$w) (3) ~married($u,$v) v married($v,$u) (4a) rich(X) (4b) ~rich(Y) (4c) married(X,Y) proof: A1,A2,A3 |- A (q1) ~married(X,$w) from (4a) and (2) (q2) married(Y,F(Y)) from (4b) and (1) (q3) ~rich(X) from (4c) and (2) (q4) empty clause from (q3) and (4a) remark: Resolving (q1) and (4c) also generates the empty clause.

  13. 3. PROLOG and Resolution • grandchild(X,Z):-child(X,Y),child(Y,Z) **PROLOG Rule*** • Asserted facts: child(pete,john), child(sally,john), child(john,fred), child(tom,fred) • ?-grandchild(U,fred) “Who are the grandchildren of Fred?” U=pete…U=sally… “Answers returned by the PROLOG runtime system” How does PROLOG do it? It uses resolution as follows: In clause form (using “our” syntax): • ~child($x,$y) v ~child($y,$z) v grandchild($x,$z) • ~grandchild($u,Fred) “negated conclusion” • child(Pete,John) • child(Sally,John) • child(John,Fred) • child(Tom,Fred) Resolution in PROLOG: Find all substitutions to the free variables in the query expression ($u in the example) that lead to a contradiction.

  14. PROLOG Example Continued • ~child($x,$y) v ~child($y,$z) v grandchild($x,$z) rule • ~grandchild($u,Fred) “negated conclusion/query” • child(Pete,John) fact • child(Sally,John) fact • child(John,Fred) fact • child(Tom,Fred) fact • ~child($u,$y) v ~child ($y, Fred) using 1, 2 • ~child($u, John) using 5,7 •  for (($u Pete)) using 3,8 First answer! •  for (($u Sally)) using 4,8 Second answer! • ~child($u, Tom) using 6,7 No more empty clauses are found; therefore the PROLOG system returns two answers: Pete and Sally

More Related