Prolog programming in depth

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

This book covers the Prolog programming language thoroughly with an emphasis on building practical application software, not just theory. Working through this book, readers build several types of expert systems, as well as natural language processing software and utilities to read foreign file formats. This is the first book to cover ISO Standard Prolog, but the programs are compatible with earlier dialects of the language. Program files are available by FTP from The University of Georgia.

Author(s): Michael A. Covington, Donald Nute, Andre Vellino
Edition: 1
Publisher: Prentice Hall
Year: 1997

Language: English
Pages: 528
City: Upper Saddle River, N.J

Cover
Title Page
Copyright Page
Table of Contents
Preface
Part I The Prolog Language
1 Introducing Prolog
1.1 The Idea of Prolog
1.2 How Prolog Works
1.3 Varieties of Prolog
1.4 A Practical Knowledge Base
1.5 Unification and Variable Instantiation
1.6 Backtracking
1.7 Prolog Syntax
1.8 Defining Relations
1.9 Conjoined Goals ("And")
1.10 Disjoint Goals ("Or")
1.11 Negative Goals ("Not")
1.12 Testing for Equality
1.13 Anonymous Variables
1.14 Avoiding Endless Computations
1.15 Using the Debugger to Trace Execution
1.16 Styles of Encoding Knowledge
1.17 Bibliographical Notes
2 Constructing Prolog Programs
2.1 Declarative and Procedural Semantics
2.2 Output: write, nl, display
2.3 Computing versus Printing
2.4 Forcing Backtracking with fail
2.5 Predicates as Subroutines
2.6 Input of Terms: read
2.7 Manipulating the Knowledge Base
2.8 Static and Dynamic Predicates
2.9 More about consult and reconsult
2.10 File Handling: see, seen, tell, told
2.11 A Program that "Learns"
2.12 Character Input and Output: get, getO, put
2.13 Constructing Menus
2.14 A Simple Expert System
3 Data Structures and Computation
3.1 Arithmetic
3.2 Constructing Expressions
3.3 Practical Calculations
3.4 Testing for Instantiation
3.5 Lists
3.6 Storing Data in Lists
3.7 Recursion
3.8 Counting List Elements
3.9 Concatenating (Appending) Lists
3.10 Reversing a List Recursively
3.11 A Faster Way to Reverse Lists
3.12 Character Strings
3.13 Inputting a Line as a String or Atom
3.14 Structures
3.15 The "Occurs Check"
3.16 Constructing Goals at Runtime
3.17 Data Storage Strategies
3.18 Bibliographical Notes
4 Expressing Procedural Algorithms
4.1 Procedural Prolog
4.2 Conditional Execution
4.3 The "Cut" Operator (!)
4.4 Red Cuts and Green Cuts
4.5 Where Not to Put Cuts
4.6 Making a Goal Deterministic Without Cuts
4.7 The "If-Then-Else" Structure (->)
4.8 Making a Goal Always Succeed or Always Fail
4.9 Repetition Through Backtracking
4.10 Recursion
4.11 More about Recursive Loops
4.12 Organizing Recursive Code
4.13 Why Tail Recursion is Special
4.14 Indexing
4.15 Modularity, Name Conflicts, and Stubs
4.16 How to Document Prolog Predicates
4.17 Supplement: Some Hand Computations
4.18 Bibliographical Notes
5 Reading Data in Foreign Formats
5.1 The Problem of Free-Form Input
5.2 Converting Strings to Atoms and Numbers
5.3 Combining Our Code with Yours
5.4 Validating User Input
5.5 Constructing Menus
5.6 Reading Files with getJbyte
5.7 File Handles (Stream Identifiers)
5.8 Fixed-Length Fields
5.9 Now What Do You Do with the Data?
5.10 Comma-Delimited Fields
5.11 Binary Numbers
5.12 Grand Finale: Reading a Lotus Spreadsheet
6 Prolog as Its Own Metalanguage
6.1 Language and Metalanguage
6.2 Collecting Alternative Solutions into a List
6.3 Using bagof and setof
6.4 Finding the Smallest, Largest, or "Best" Solution
6.5 Intensional and Extensional Queries
6.6 Operator Definitions
6.7 Giving Meaning to Operators
6.8 Prolog in Prolog
6.9 Extending the Inference Engine
6.10 Personalizing the User Interface
6.11 Bibliographical Notes
7 Advanced Techniques
7.1 Structures as Trees
7.2 Lists as Structures
7.3 How to Search or Process Any Structure
7.4 Internal Representation of Data
7.5 Simulating Arrays in Prolog
7.6 Difference Lists
7.7 Quicksort
7.8 Efficiency of Sorting Algorithms
7.9 Mergesort
7.10 Binary Trees
7.11 Treesort
7.12 Customized Arithmetic: A Replacement for is
7.13 Solving Equations Numerically
7.14 Bibliographical Notes
Part II Artificial Intelligence Applications
8 Artificial Intelligence and the Search for Solutions
8.1 Artificial Intelligence, Puzzles, and Prolog
8.2 Through the Maze
8.3 Missionaries and Cannibals
8.4 The Triangle Puzzle
8.5 Coloring a Map
8.6 Examining Molecules
8.7 Exhaustive Search, Intelligent Search, and Heuristics
8.8 Scheduling
8.9 Forward-Chaining and Production-Rule Systems
8.10 A Simple Forward Chainer
8.11 Production Rules in Prolog
8.12 Bibliographical Notes
9 A Simple Expert System Shell
9.1 Expert Systems
9.2 Expert Consultants and Expert Consulting Systems
9.3 Parts of an Expert Consulting System
9.4 Expert System Shells
9.5 Extending the Power of Prolog
9.6 XSHELL: The Main Program
9.7 Asking about Properties in XSHELL
9.8 Asking about Parameters in XSHELL
9.9 XSHELLs Explanatory Facility
9.10 CICHLID: A Sample XSHELL Knowledge Base
9.11 A Consultation with CICHLID
9.12 PAINT: A Sample XSHELL Knowledge Base
9.13 Developing XSHELL Knowledge Bases
9.14 Bibliographical Notes
10 An Expert System Shell with Uncertainty
10.1 Uncertainty, Probability, and Confidence
10.2 Representing and Computing Confidence or Certainty
10.3 Confidence Rules
10.4 The CONMAN Inference Engine
10.5 Getting Information from the User
10.6 The CONMAN Explanatory Facilities
10.7 The Main Program
10.8 CONMAN Knowledge Bases
10.9 No Confidence in "Confidence"
10.10 Bibliographical Notes
11 Defeasible Prolog
11.1 Nonmonotonic Reasoning and Prolog
11.2 New Syntax for Defeasible Reasoning
11.3 Strict Rules
11.4 Incompatible Conclusions
11.5 Superiority of Rules
11.6 Specificity
11.7 Defining Strict Derivability in Prolog
11.8 d-Prolog Preliminaries
11.9 Using Defeasible Rules
11.10 Preemption of Defeaters
11.11 Defeasible Queries and Exhaustive Responses
11.12 Listing Defeasible Predicates
11.13 Consulting and Reconsulting d-Prolog Files
11.14 The d-Prolog Dictionary
11.15 Rescinding Predicates and Knowledge Bases
11.16 Finding Contradictions
11.17 A Special Explanatory Facility
11.18 A Suite of Examples
11.19 Some Feathered and Nonfeathered Friends
11.20 Inheritance Reasoning
11.21 Temporal Persistence
11.22 The Election Example
11.23 d-Prolog and the Closed World Assumption
11.24 Bibliographical Notes
12 Natural Language Processing
12.1 Prolog and Human Languages
12.2 Levels of Linguistic Analysis
12.3 Tokenization
12.4 Template Systems
12.5 Generative Grammars
12.6 A Simple Parser
12.7 Grammar Rule (DCG) Notation
12.8 Grammatical Features
12.9 Morphology
12.10 Constructing the Parse Tree
12.11 Unbounded Movements
12.12 Semantic Interpretation
12.13 Constructing Representations
12.14 Dummy Entities
12.15 Bibliographical Notes
A Summary of ISO Prolog
A.l Syntax of Terms
A.2 Program Structure
A.3 Control Structures
A.4 Error Handling
A.5 Flags
A.6 Arithmetic
A.7 Input and Output
A.8 Other Built-in Predicates
A.9 Modules
B Some Differences Between Prolog Implementations
B.l Introduction
B.2 Which Predicates are Built-in?
B.3 Variation In Behavior of Built-in Predicates
B.4 Control Constructs
B.5 Syntax and Program Layout
B.6 Arithmetic
B.7 Input and Output
B.8 Definite-Clause Grammars
Bibliography
Index