1 / 5

Chapter1 - continued

Chapter1 - continued. 1.3 Recursive rules. How to express predecessor relation in terms of parent relation? It is expressed with two rules: Direct (immediate) predecessors. predecessor (X, Z):- parent (X, Z),

ocean-young
Download Presentation

Chapter1 - continued

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. Chapter1 - continued

  2. 1.3 Recursive rules • How to express predecessor relation in terms of parent relation? • It is expressed with two rules: • Direct (immediate) predecessors. predecessor (X, Z):- parent (X, Z), • Indirect predecessors ( X is an indirect predecessor of some Z if there is a parentship chain of people between X and Z) For all X and Z, X is a predecessor of Z if there is Y such that (1) X is a parent of Y (2) Y is a parent of Z predecessor (X, Z):- parent (X, Y), predecessor(Y, Z). X X Parent (a) Predecessor Parent (b) Predecessor Parent Z Parent • (Recursion) Z

  3. 1.4 How Prolog answers questions • A question is a sequence of one or more goals. To answer questions, Prolog tries to satisfy all the goals • To demonstrate that the goals are true, assuming that the relations in the program are true • To demonstrate that the goal is logically follows from the facts and rules in the program. • If the question contains variables • Prolog also has to find what are the particular objects for which the goals are satisfied. • If Prolog cannot find some instantiation of variables that the goals logically follow from the program, Prolog answer will be ‘no’

  4. Homework Read section 1.4 and 1.5 in your textbook and ask me please if there is any ambiguity.

More Related