Anno Accademico 2026/2027
Docente Marco Lenci
Crediti formativi 4
SSD MATH-04/A
Lingua di insegnamento Inglese
Moduli Claudio Sacerdoti Coen (Modulo 1) , Marco Lenci (Modulo 2) , Giovanni Paolini (Modulo 3)
Can machines prove theorems? Can they write reliable code? The course explores these questions by introducing tools for the rigorous verification of proofs and programs, with particular emphasis on Lean, and by examining how such tools can be integrated with and complement machine learning.
By the end of the course, students will be able to:
The course consists of three eight-hour modules. The first introduces the logical and computational foundations of formal verification; the second provides a practical introduction to Lean and its ecosystem; the third places these topics in the context of machine learning and large language models. The modules are intended for students accustomed to logical and mathematical reasoning, but do not require specific previous knowledge of formal logic, Lean, or machine learning.
Module 1 — Logic, Computability, and Formal Verification SystemsCan an algorithm prove everything that is provable and compute any mathematical function? The module will show that the answer to both questions is negative. Can an algorithm verify a program or a proof and guarantee its correctness? In this case, the answer is positive. The module will introduce logic and interactive theorem provers (ITPs), of which Lean is an example, and will explain how combining ITPs with machine learning makes it possible to search for proofs or write code while retaining a rigorous final verification of correctness.
Module 2 — Lean and Its Ecosystem
The module will introduce Lean and its ecosystem: the digital library of theorems mathlib, the international community of Lean users and forms of remote collaboration, and platforms that use machine learning to assist with proofs. The approach will be practical and interactive: students will carry out these activities on their own computers and will learn to write simple proofs in Lean independently.
Module 3 — Generative AI for Formal Code Production
The module will focus on machine learning and introduce large language models (LLMs), with emphasis on their ability to support formal reasoning and the writing of proofs in Lean. After presenting the problem of language modelling, it will cover the main pre-training and post-training techniques, with particular attention to reinforcement learning for code generation, especially Lean code. The module does not require previous knowledge of machine learning.
Teaching material (slides, Lean files, exercises, selected readings and web resources) will be made available through Virtuale. The practical activities will draw in particular on the open textbook Mathematics in Lean and on the official Lean and mathlib documentation. Additional references on computability, formal verification, and large language models will be indicated during the course.
The course combines introductory lectures, demonstrations, and guided computer-based activities. Theoretical notions, particularly in the first and third modules, will be introduced without unnecessary technical detail, while preserving the rigour of the statements and providing intuitive explanations whenever possible. The second module will be practical and interactive: students will work on their own computers and learn to write simple proofs in Lean.
The three modules are coordinated through shared examples and terminology. A tutor will support the practical activities.
The examination consists of an oral presentation and discussion in English of a theoretical or practical project on one or more of the topics covered in the course. A practical project may, for example, involve writing and commenting on Lean code. The project must be agreed upon in advance with the instructors and presented in the form of either a written paper (at least 3,000 words) or a slide presentation (at least 12 slides). Projects may be completed individually or in groups, provided that each student’s contribution is clearly identifiable.
Assessment will take into account the student’s understanding of the relevant course content, the quality of the project, the clarity of the written paper or slides and of the oral presentation, and, where applicable, the correctness of the Lean code. The examination is graded on a 30-point scale.
Slides, lecture notes, computer, video projector, and blackboard. Teaching materials will be made available on Virtuale.
Consulta il sito web di Marco Lenci
Consulta il sito web di Claudio Sacerdoti Coen
Consulta il sito web di Giovanni Paolini
L'insegnamento contribuisce al perseguimento degli Obiettivi di Sviluppo Sostenibile dell'Agenda 2030 dell'ONU.