First Technology Transfer

Standard and Advanced Technical Training, Consultancy and Mentoring

Foundations of Prolog Programming

Duration: 5 Days

Intended Audience

This course is for those that need to get up to speed with Prolog programming, or to refresh their Prolog programming skills and master Prolog programming techniques used in the implementation of Expert Systems and Artificial Intelligence applications. Attendees are assumed to already be experienced programmers in a language such as e.g. C/C++ or Java

Course Overview

Prolog is a programming language that is rooted in formal logic. It supports backtracking and unification as built-in features. Prolog makes it possible to elegantly solve many tasks with short and general programs.

Prolog was one of the first logic programming languages. It has, and continues to be sued for theorem proving, expert systems implementation, automated planning and natural language processing.Modern Prolog environments, such as SWI Prolog, support the creation of graphical user interfaces, as well as administrative and networked applications.

Prolog is well-suited for specific tasks that benefit from rule-based logical queries such as searching databases, voice control systems, and filling templates. Modern Prolog implementations can interface with applications written in programming languages such as Java and the combination of Prolog with a traditional programming language can produce powerful business applications. Prolog is extremely well suited for developing web applications. Web pages are naturally represented as Prolog terms and can be easily created, inspected and processed recursively.

This course provides a thorough introduction to Prolog programming for those who will either be maintaining Prolog code or developing business, web or other knowledge utilising and knowledge processing applications in Prolog.

Course Contents

  • Introduction
    • Declarative vs Procedural Programming
    • Kinds of Logic
    • Propositional Calculus
    • First Order Predicate Calculus
    • Prolog Constants
    • Goals and Clauses
    • Multiple Clauses
    • Rules
    • Semantics
    • The Logical Variable
    • Rules and Conjunctions
    • Rules and Disjunctions
    • Using both Disjunctions and Conjunctions
  • Unification, Recursion and Lists
    • Unification
    • Recursion
    • Lists
      • How to construct/deconstruct a list
      • The Empty List
      • A Recursive Program Using Lists
  • File processing and I/O in Prolog
    • Loading Files
    • Interactive Program Development
    • Input/Output Facilities
    • Debugging Issues
  • Prolog Programming Techniques and List Processing
    • List Processing
    • Reconstructing Lists
    • Proof Trees
  • Control and Negation
    • Useful Predicates for Control
      • true/0
      • fail/0
      • repeat/0
      • call/1
    • The Problem of Negation
      • Negation as Failure
      • Using Negation in Case Selection
  • Useful Program Schemata
    • Generate --- Test
    • Finite and Infinite Generators
    • Test --- Process
    • Failure-Driven Loop
    • Practical Problems
      • Commit
      • Satisfy Once Only
      • Fail Goal Now
  • Parsing in Prolog
    • Simple English Syntax
    • Parse Trees and parsing
    • Prolog Grammar Rules and their uses
  • Search Spaces and program modification
  • More Advanced Prolog Syntax
    • Constants, Variables, Compound Terms
    • (Compound) Terms as Trees
    • Compound Terms and Unification
    • The Occurs Check
    • Lists as Terms
    • Rules as Terms
  • More Advanced Input/Output
    • Testing a Predicate
    • Input/ Output Channels
    • Input/ Output and Files
    • The End of File Marker
    • Input of Prolog Terms
    • Defining a custom Consult
  • Operators a deeper look
    • The Three Forms
      • Infix
      • Prefix
      • Postfix
    • Precedence
    • Associativity Notation
      • Infix Operators
      • The Prefix Case
      • Prefix Operators
      • Postfix Operators
    • Finding and Changing Operator Definitions
    • How to Change Operator Definitions
  • Advanced Features
    • Typing and Types
    • Splitting Up Clauses
      • clause/2
      • functor/3
      • arg/3
      • =../2
    • Comparisons of Terms
      • ==/2
      • @>/2, @>=/2, @</2 and @=</2
    • Finding All Solutions
      • setof/3
      • Stage/1
      • Stage/2
      • Stage/3
      • bagof/3
    • Finding Out about Known Terms
      • current_atom/1
      • current_functor/2
      • current_predicate/2
      • current_op/3
    • Open Lists and Difference Lists
    • Prolog Layout and coding style
  • Applied Examples and Case Studies
    • Knowledge representation
    • Business rules in Prolog
    • Language processing in Prolog
    • Semantic web reasoning in Prolog
    • Interfacing Prolog with Relational Databases