Next:
Preface
Contents
Index
B-Prolog User's Manual
(Version 7.8)
(
PDF
)
Prolog, Agent, and Constraint Programming
Neng-Fa Zhou
Afany Software & CUNY & Kyutech
Copyright ©Afany Software, 1994
-
2013.
Last updated Jan 24, 2013
Preface
Acknowledgements
Contents
Getting Started with B-Prolog
How to install B-Prolog
Windows
Linux
Mac
How to enter and quit B-Prolog
Command-line arguments
The command-line editor
How to run programs
Compiling and loading
Consulting
Running programs
Example:
Programs
Terms
Atoms
Numbers
Examples:
Variables
Compound terms
Programs
Facts
Rules
Directives
Control constructs
Cut
Example:
Conjunction, disjunction, negation, and if-then-else
repeat/0
call/1 and once/1
call/2
-
n
(not in ISO)
forall/2
(not in ISO)
call_cleanup/2
(not in ISO)
time_out/3
(not in ISO)
All solutions
Aggregates
Data Types and Built-ins
Terms
Type checking
Unification
Term comparison and manipulation
Numbers
Lists and structures
Arrays and the array subscript notation
(not in ISO)
Set manipulation
(not in ISO)
Hashtables
(not in ISO)
Character-string operations
Declarative Loops and List Comprehensions
(not in ISO)
The base
foreach
Examples
foreach
with accumulators
Examples
Examples
List comprehensions
Examples
Cautions on the use
Exception Handling
Exceptions
throw/1
catch/3
Examples:
Directives and Prolog Flags
Mode declaration
include/1
Initialization
Dynamic declaration
multifile/1
Tabled predicate declaration
Table mode declaration
Prolog flags
Debugging
Execution modes
Debugging commands
Input and Output
Stream
Character input/output
Character code input/output
Byte input/output
Term input/output
Input/output of DEC-10 Prolog
(not in ISO)
Formatted output of terms
(not in ISO)
Dynamic Clauses and Global Variables
Predicates of ISO-Prolog
Predicates of DEC-10 Prolog
(not in ISO)
Global variables
(not in ISO)
Properties
Global heap variables
(not in ISO)
Memory Management and Garbage Collection
Memory allocation
Garbage collection
Matching Clauses
Example:
Example:
Action Rules and Events
Syntax
Operational semantics
Another example
Timers and time events
Example:
Suspension and attributed variables
Example:
Constraints
CLP(Tree)
CLP(FD)
Finite-domain variables
Table constraints
Arithmetic constraints
Global constraints
Labeling and variable/value ordering
Optimization
CLP(Boolean)
CLP(Set)
Modeling with
foreach
and list comprehension
Programming Constraint Propagators
A constraint interpreter
Indexicals
Reification
Propagators for binary constraints
Forward-checking
Interval-consistency
Arc-consistency
all_different(L)
A Common Interface to SAT and MP Solvers
Creating decision variables
Constraints
Solver Invocation
Examples
A simple LP example
Graph coloring
Tabling
Table mode declarations
Examples
Linear tabling and the strategies
Primitives on tables
External Language Interface with C
Calling C from Prolog
Term representation
Fetching arguments of Prolog calls
Testing Prolog terms
Converting Prolog terms into C
Manipulating and writing Prolog terms
Building Prolog terms
Registering predicates defined in C
Example:
Calling Prolog from C
Example:
External Language Interface with Java
Installation
Data conversion between Java and B-Prolog
Calling Prolog from Java
Calling Java from Prolog
Interface with Operating Systems
Building standalone applications
Commands
Profiling
Statistics
Profile programs
Profile program executions
More statistics
Predefined Operators
Frequently Asked Questions
How can I get rid of the warnings on singleton variables?
How can I deal with stack overflows?
Is it possible to set break points in the debugger?
Is it possible to debug compiled code?
I have a predicate that is defined in two different files. Why is the definition in the first file still used, even after the second file is loaded?
How can I build standalone applications?
How can I disable the garbage collector?
Why do I get the error message when I compile a Java program that imports bprolog.plc.Plc?
Can I pass a Prolog variable to a Java method, and let the Java method instantiate the variable?
Is it possible for one language to know about exceptions that are raised by a different language?
Is it possible to write CGI scripts in B-Prolog?
Useful Links
CGLIB: http://www.probp.com/cglib/
CHR Compilers: http://www.probp.com/chr/
JIPL: http://www.kprolog.com/jipl/index_e.html
Logtalk: http://www.logtalk.org/
PRISM: http://sato-www.cs.titech.ac.jp/prism/
Constraint Solvers: http://www.probp.com/solvers/
XML: http://www.probp.com/publib/xml.html
Bibliography
Index
About this document ...
Neng-Fa Zhou 2013-01-25