Next:
List of Figures
Up:
Prolog Programming A
Previous:
Prolog Programming A
Contents
List of Figures
Preface
A Warning
The Intended Audience
The Objective
The Aims
Course Structure
Acknowledgements
Introduction
Declarative vs Procedural Programming
What Kind of Logic?
A Warning
A Request
Knowledge Representation
Propositional Calculus
A Problem
First Order Predicate Calculus
We Turn to Prolog
Prolog Constants
Goals and Clauses
Multiple Clauses
Rules
Semantics
The Logical Variable
Rules and Conjunctions
Rules and Disjunctions
Both Disjunctions and Conjunctions
What You Should Be Able To Do
Prolog's Search Strategy
Queries and Disjunctions
A Simple Conjunction
Conjunctions and Disjunctions
What You Should Be Able To Do
Unification, Recursion and Lists
Unification
Recursion
Lists
How to construct/deconstruct a list
List Destruction:
List Construction:
Bigger Chunks:
The Empty List
Some Possible Matches
A Recursive Program Using Lists
What You Should Be Able To Do
The Box Model of Execution
The Box Model
The Flow of Control
An Example using the Byrd Box Model
An Example using an AND/OR Proof Tree
What You Should Be Able To Do
Interlude: Practical Matters
Exiting and Leaving Prolog
Loading Files
Interactive Program Development
A Problem with consult/1
Two Variations on Program Development
Avoiding Various Kinds of Trouble
Input/Output Facilities
The Debugging Issue
The Tracer Outlined
Activating the Tracer
Interacting with the Tracer
Debugging
Programming Techniques and List Processing
The `Reversibility' of Prolog Programs
Evaluation in Prolog
Calling Patterns
List Processing
Program Patterns
Test for Existence
Test All Elements
Return a Result ---Having Processed One Element
Return a Result ---Having Processed All Elements
Reconstructing Lists
Building Structure in the Clause Head
Building Structure in the Clause Body
Proof Trees
What You Should Be Able To Do
Control and Negation
Some Useful Predicates for Control
true/0
fail/0
repeat/0
call/1
The Problem of Negation
/1
Negation as Failure
Using Negation in Case Selection
Some General Program Schemata
Generate --- Test
Finite and Infinite Generators
Test --- Process
Failure-Driven Loop
Some Practical Problems
Commit
Satisfy Once Only
Fail Goal Now
What You Should Be Able To Do
Parsing in Prolog
Simple English Syntax
The Parse Tree
First Attempt at Parsing
A Second Approach
Prolog Grammar Rules
To Use the Grammar Rules
How to Extract a Parse Tree
Adding Arbitrary Prolog Goals
What You Should Be Able To Do
Modifying the Search Space
A Special Control Predicate
Commit
Make Determinate
Fail Goal Now
Changing the Program
Do Not Do It!
Sometimes You have To!
What You Should Be Able To Do
Prolog Syntax
Constants
Variables
Compound Terms
(Compound) Terms as Trees
Compound Terms and Unification
The Occurs Check
Lists Are Terms Too
How To Glue Two Lists Together
Rules as Terms
1
2
3
What You Should Be Able To Do
Another Interlude: Input/Output
Testing a Predicate
Input/ Output Channels
Input/ Output and Files
The End of File Marker
Input of Prolog Terms
Defining Your Own Consult
What You Should Be Able To Do
Operators
The Three Forms
Infix
Prefix
Postfix
Precedence
Associativity Notation
Infix Operators
The Prefix Case
Prefix Operators
Postfix Operators
How to Find Operator Definitions
How to Change Operator Definitions
A More Complex Example
What You Should Be Able To Do
Advanced Features
Powerful Features
Powerful Features ---Typing
Powerful Features ---Splitting Up Clauses
clause/2
functor/3
arg/3
=../2
Powerful Features ---Comparisons of Terms
==/2
==/2
@>/2, @>=/2, @</2 and @=</2
Powerful Features ---Finding All Solutions
setof/3
Stage 1
Stage 2
Stage 3
bagof/3
Powerful Features ---Find Out about Known Terms
current_atom/1
current_functor/2
current_predicate/2
current_op/3
Open Lists and Difference Lists
Prolog Layout
Comments
Program Headers
Section Comments
End of Line Comments
Code Layout
Prolog Style
Side Effect Programming
Modifying the Program at Runtime
The cut (!/0)
;/2
if ... then & if ... then ... else
Prolog and Logic Programming
Prolog and Resolution
Prolog and Parallelism
Prolog and Execution Strategies
Prolog and Functional Programming
Other Logic Programming Languages
What You Should Be Able To Do
A Short Prolog Bibliography
References
Details of the SICStus Prolog Tracer
Solutions and Comments on Exercises for Knowledge Representation (Chapter 2)
Exercise #chap2logicprolog1#5676>
Execise #chap2logicprolog2#5716>
Exercise #chap2logicprolog3#5728>
Exercise #chap2logicprolog4#5742>
Exercise #chap2logicprolog5#5760>
Exercise #chap2logicprolog6#5774>
Exercise #chap2logicprolog7#5789>
Solutions and Comments on Exercises for Chapter #firstsearch#5822>
Exercise #chap3searchprolog1#5823>
Exercise #chap3searchprolog2#5897>
Solutions and Comments on Exercises for Chapter #chapterrecursion#5997>
Exercise #chap4unific1#5998>
Exercise #chap4unific2#6020>
Exercise #chap4recurse1#6061>
Solutions and Comments on Exercises for Chapter #techniques#6113>
Exercise #chap6schemata1#6114>
Solutions and Comments on Exercises for Chapter #parsingchap#6388>
Exercise #chap8dcg1#6389>
Solutions and Comments on Exercises for Chapter #extralogical#6444>
Exercise #chap9cuts1#6445>
Solutions and Comments on Exercises for Chapter #operators#6582>
Exercise #chap11op1#6583>
Solutions and Comments on Exercises for Chapter #advanced#6594>
Exercise #difflist1#6595>
Paul Brna
Mon May 24 20:14:48 BST 1999