Università degli Studi di Urbino Carlo Bo / Portale Web di Ateneo


Procedural and Logic Programming
Programmazione Procedurale e Logica

A.Y. Credits
2014/2015 12
Lecturer Email Office hours for students
Marco Bernardo wednesday 16:00-18:00

Assigned to the Degree Course

Date Time Classroom / Location

Learning Objectives

The objective of this course is to illustrate the basic principles, the techniques, and the tools for programming computer applications, through the presentation of the concepts typical of procedural imperative programming and logical declarative programming.


01. Introduction to computer programming:
  01.01 Basic definitions in informatics.
  01.02 A bit of history of informatics.
  01.03 Elements of computer architecture.
  01.04 Elements of operating systems.
  01.05 Elements of programming languages and compilers.
  01.06 A methodology for developing software "in the small".

02. Procedural programming: the language ANSI C:
  02.01 A bit of history of C.
  02.02 Format of a program with a single function.
  02.03 Library inclusion.
  02.04 Function main.
  02.05 Identifiers.
  02.06 Predefined data types: int, double, char.
  02.07 Library functions for interactive input/output.
  02.08 Library functions for file-based input/output.

03. Expressions:
  03.01 Symbolic constant definition.
  03.02 Variable declaration.
  03.03 Arithmetical operators.
  03.04 Relational operators.
  03.05 Logical operators.
  03.06 Conditional operator.
  03.07 Assignment operators.
  03.08 Increment/decrement operators.
  03.09 Comma operator.
  03.10 Type of the expressions.
  03.11 Precedence and associativity of the operators.

04. Statements:
  04.01 Assignment statement.
  04.02 Compound statement.
  04.03 Selection statements: if, switch.
  04.04 Repetition statements: while, for, do-while.
  04.05 Goto statement.
  04.06 Fundamental theorem of structured programming.

05. Procedures:
  05.01 Format of a program with several functions on a single file.
  05.02 Function declaration.
  05.03 Function definition and formal parameters.
  05.04 Function invocation and actual parameters.
  05.05 Return statement.
  05.06 Parameters and result of function main.
  05.07 Passing parameters by value and by reference.
  05.08 Recursive functions.
  05.09 Stack-based sequential execution model.
  05.10 Format of a program with several functions on several files.
  05.11 Scope of local and nonlocal identifiers.

06. Data types:
  06.01 Data type classification and sizeof operator.
  06.02 Type int: representation and variants.
  06.03 Type double: representation and variants.
  06.04 Mathematical library functions.
  06.05 Type char: representation and library functions.
  06.06 Enumerated types.
  06.07 Type conversions and cast operator.
  06.08 Arrays: representation and indexing operator.
  06.09 Strings: representation and library functions.
  06.10 Structures and unions: representation and dot operator.
  06.11 Pointers: operators and library functions.

07. Correctness of procedural programs:
  07.01 Hoare triples.
  07.02 Determining the weakest precondition.
  07.03 Verifying the correctness of iterative procedural programs.
  07.04 Verifying the correctness of recursive procedural programs.

08. Introduction to mathematical logic:
  08.01 A bit of history of logic.
  08.02 Elements of set theory.
  08.03 Relations, functions, and operations.
  08.04 Induction principle.

09. Propositional logic:
  09.01 Syntax of propositional logic.
  09.02 Semantics and decidability of propositional logic.
  09.03 Consequence and equivalence in propositional logic.
  09.04 Algebraic properties of the logical connectives.
  09.05 Deduction systems for propositional logic.

10. Predicate logic:
  10.01 Syntax of predicate logic.
  10.02 Semantics and undecidability of predicate logic.
  10.03 Consequence and equivalence in predicate logic.
  10.04 Algebraic properties of the quantifiers.
  10.05 Deduction systems for predicate logic.

11. Logic programming: the language Prolog:
  11.01 Normal forms for logical formulas.
  11.02 Herbrand theory and refutation algorithm.
  11.03 Robinson resolution for propositional logic.
  11.04 Unification and resolution for predicate logic.
  11.05 Prolog: Horn clauses and SLD resolution strategy.
  11.06 Prolog: terms and predicates.
  11.07 Prolog: input/output, cut, and negation.

12. Laboratory activities:
  12.01 Work session in Linux.
  12.02 File management in Linux.
  12.03 The editor gvim.
  12.04 The compiler gcc.
  12.05 The maintenance utility make.
  12.06 The debugger gdb.
  12.07 Implementation of the C programs introduced in the lectures.
  12.08 The compiler/interpreter gprolog.
  12.09 Implementation of the Prolog programs introduced in the lectures.

Bridging Courses

There are no mandatory prerequisites.

It is recommended to take the exam of Procedural and Logic Programming after taking the exam of Discrete Structure and Linear Algebra and before taking all the other exams except those of mathematics and physics.

Teaching, Attendance, Course Books and Assessment


Theory lectures and laboratory exercises.


Although strongly recommended, course attendance is not mandatory.

Course books

Hanly, Koffman, "Problem Solving and Program Design in C", Addison-Wesley, 2012
(Hanly, Koffman, "Problem Solving e Programmazione in C", Apogeo, 2013).

Kernighan, Ritchie, "The C Programming Language", Prentice Hall, 1988
(Kernighan, Ritchie, "Il Linguaggio C", Pearson/Prentice Hall, 2004).

Asperti, Ciabattoni, "Logica a Informatica", McGraw-Hill, 1997
(Schöning, "Logic for Computer Scientists", Birkhäuser, 2008).

Console, Lamma, Mello, Milano, "Programmazione Logica e Prolog", UTET, 1997
(Sterling, Shapiro, "The Art of Prolog", MIT Press, 1997).


Project (to be developed individually or by groups of two students), written exam, and oral exam.

The project, which changes at each exam session, has to be submitted at least 10 days before the written exam. It is passed if the mark is at least 18/30; the mark is valid until the second exam session after the one in which the project is submitted. In case of late submission, a 3/30 penalty is applied for each day after the deadline. Should the project be resubmitted in a subsequent exam call, the mark of the previously submitted project is canceled; if the resubmission takes place in the same exam session, a 5/30 penalty is applied to the mark of the newly submitted project because the developers can benefit from the correction of the previously submitted project (the correction of the new project may reveal errors that went undetected during the correction of the previous one).

The written exam, which changes at each exam call and can be taken only if the project has been passed, consists of 9 questions plus 2 exercises to carry out in 90 minutes. It is passed if the mark is at least 18/30; the mark is valid only for the exam call in which the written exam is taken.

The oral exam, which can be taken only if the project and the written exam have been passed, consists of a discussion of the project and of the written exam, plus further questions. If passed, it determines an adjustment between -5/30 and 5/30 of the average of the two previous marks, thus yielding the final mark.


The course is offered both face-to-face and on-line within the Laurea Degree Program in Applied Computer Science.

For the teaching material and further information, click here.

« back Last update: 22/04/2015


Questo contenuto ha risposto alla tua domanda?

Il tuo feedback è importante

Raccontaci la tua esperienza e aiutaci a migliorare questa pagina.

Se sei vittima di violenza o stalking chiama il 1522

Il 1522 è un servizio pubblico promosso dalla Presidenza del Consiglio dei Ministri – Dipartimento per le Pari Opportunità. Il numero, gratuito è attivo 24 h su 24, accoglie con operatrici specializzate le richieste di aiuto e sostegno delle vittime di violenza e stalking.

Posta elettronica certificata



Università degli Studi di Urbino Carlo Bo
Via Aurelio Saffi, 2 – 61029 Urbino PU – IT
Partita IVA 00448830414 – Codice Fiscale 82002850418
2022 © Tutti i diritti sono riservati