c h a p t e r n i n e

17
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. C H A P T E R N I N E Logic Programming

Upload: francis-frazier

Post on 01-Jan-2016

28 views

Category:

Documents


3 download

DESCRIPTION

C H A P T E R N I N E. Logic Programming. Attempting to Satisfy the Query talkswith (bob, allen) Figure 9.1. First Attempt to Satisfy the Query talkswith(Who, allen) Figure 9.2. A Partial Family Tree Figure 9.3. A Small Family “Tree” Figure 9.4. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: C H A P T E R  N I N E

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

C H A P T E R N I N E

Logic Programming

Page 2: C H A P T E R  N I N E

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

9-2

Attempting to Satisfy the Query talkswith (bob, allen)Figure 9.1

Page 3: C H A P T E R  N I N E

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

9-3

First Attempt to Satisfy the Query talkswith(Who, allen)Figure 9.2

Page 4: C H A P T E R  N I N E

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

9-4

A Partial Family TreeFigure 9.3

Page 5: C H A P T E R  N I N E

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

9-5

A Small Family “Tree”Figure 9.4

Page 6: C H A P T E R  N I N E

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

9-6

Partial Search Tree for append([english, russian], [spanish], L)Figure 9.5

Page 7: C H A P T E R  N I N E

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

9-7

Trace of bsort for the List [5,2,3,1].Figure 9.6

Page 8: C H A P T E R  N I N E

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

9-8

The Factorial Function in PrologFigure 9.7

Page 9: C H A P T E R  N I N E

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

9-9

Trace of Factorial (4)Figure 9.8

Page 10: C H A P T E R  N I N E

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

9-10

Symbolic Differentiation RulesFigure 9.9

Page 11: C H A P T E R  N I N E

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

9-11

Prolog Symbolic DifferentiatorFigure 9.10

Page 12: C H A P T E R  N I N E

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

9-12

Search Tree for the Query d(x, 2*x+1, Ans)Figure 9.11

Page 13: C H A P T E R  N I N E

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

9-13

Prolog Solution for the Building ProblemFigure 9.12

Page 14: C H A P T E R  N I N E

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

9-14

A Simple BNF Grammar and Parse Tree for “The Giraffe Dreams”† Figure 9.13

Page 15: C H A P T E R  N I N E

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

9-15

Tracing Execution of a Prolog QueryFigure 9.14

Page 16: C H A P T E R  N I N E

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

9-16

Prolog DCG for the Syntax of Jay ExpressionsFigure 9.15

Page 17: C H A P T E R  N I N E

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

9-17

Jay Expression Syntax Extended to Generate Parse TreesFigure 9.16