Departamento de Ciência de Computadores

Disciplina: Programação Lógica / Logic Programming


Important Dates

Exam - 1st phase

Important Note

Academic Misconduct
All examinations, programming assignments, and written homeworks must be done by each team. Cheating and plagiarism will be dealt with in accordance with University procedures (see below the two documents related to the topic). Hence, code and reports for programming assignments should not be shared across teams. You are encouraged to discuss ideas, approaches and techniques with your peers, but code and reports should be unique for each team. Additionally, text written in reports should not be copied from internet sources. The same holds true for code. Please, have a look at the documents below.

Theoretical classes

  • Sep 19th: Introduction (PT, EN)

  • Sep 22nd: Deductive Systems and Prolog syntax

  • Sep 26th: The Prolog Language (discussion of examples of practical class: ackerman and batsmen)

  • Sep 29th: The Prolog Language (more syntax and lists: last, append, member, etc)

  • Oct 3rd: The Prolog Language (more syntax, example: append, introduction to the use of the cut operator)

  • Oct 6th: The Prolog Language (more syntax, intro to Definite Clause Grammars - DCGs)
  • Oct 10th: The Prolog Language (backtracking, more about cuts, lists and builtin predicates)

  • Oct 13th: The Prolog Language (binary tree - predicate lookup)

  • Oct 17th: Depth-first search in Prolog (predicate path - called dfs in class)

  • Oct 20th: Breadth-first search in Prolog (predicate bfs) and an example of implementing transitions (Hanoi)

  • Oct 24th: Breadth-first search in Prolog (predicate bfs) (cont.) and Interpreter of Prolog in Prolog!

  • Oct 26th: Interpreter of Prolog in Prolog (cont.) and Meta-predicates (clause, arg, =.., functor etc)

  • Oct 31st: Sorting and N-queens

  • Nov 3rd: N-queens (cont.)

  • Nov 7th: Prolog and Databases

  • Nov 10th: Implementation of Prolog

  • Nov 14th: Implementation of Prolog (cont.)

  • Nov 17th: Implementation of Prolog (cont.)

  • Nov 21st: Implementation of Prolog: example of execution with state of the WAM machine

  • Nov 24th: Constraint Logic Programming

  • Nov 28th (+1h): Constraint Logic Programming (cont.: n-queens) and back to Prolog: examples (matmult - problem 10 of list #3 and propositional theorem prover - problem 5 of list #2)

  • Dec 1st: NO CLASS (holiday)

  • Dec 5th (+1h): Pout-pourri of built-in predicates and examples

  • Dec 8th: NO CLASS (holiday)

  • Dec 12th: Assignment: Part #3 presentations


  • Practical Classes

  • Week 1 (Sep 19th):
  • Week 2 (Sep 26th):
  • Week 3 (Oct 3rd): Part #1 of Assignment

  • Week 4 (Oct 10th): List #2

  • Week 5 (Oct 17th): List #2 (cont.) and Part #2 of Assignment

  • Week 6 (Oct 24th): TEST #1

  • Week 7 (Oct 31st): List #3 (training basic Prolog reasoning) (pdf) (html)

  • Week 8 (Nov 7th): List #3 (cont.) (pdf) (html)

  • Week 9 (Nov 14th): List #3 (cont.) (pdf) (html) OR Part #3 of Assignment OR List #4

  • Week 10 (Nov 21st): List #3 (cont.) (pdf) (html) OR Part #3 of Assignment OR List #4
  • Week 11 (Nov 28th): Constraint Logic Programming

  • Week 12 (Dec 5th): List #5 (pdf) (html)

  • Week 13 (Dec 12th): TEST #2


  • Recommended Reading

  • Coding guidelines for Prolog
  • Notes on Prolog (by Matthew Huntbach, Dept of Computer Science, Queen Mary and Westfield College, London)
  • Translating Questions to SQL Queries with Generative Parsers Discriminatively Reranked
  • Natural Language Processing for Prolog Programmers
  • Prolog and Natural Language Semantics
  • Prolog and Databases
  • Datalog
  • A Gentle Guide to Constraint Logic Programming with Eclipse
  • Programming with Constraints: an Introduction, Kim Marriott and Peter J. Stuckey, MIT Press

  • Links of interest

  • Yap Prolog
  • SWI Prolog
  • SWISH
  • Learn Prolog Now!
  • Aleph

  •