Publication

A Textbook of Verified OCaml Programs. A deductive study on algorithms and data structures

View document

Bibliographic Details
Summary:We live in a society that has an ever-increasing dependency on critical software. Even minor programming oversights can have disastrous consequences, ranging from endangering human and animal lives to economic loss. Thus, it is crucial to verify the correctness of such programs, which can be achieved with deductive verification techniques. However, the teaching of such techniques is hampered by the small number of bibliographical works in this field. Our goal with this work is ambitious: to write a textbook on verified algorithms and data structures, fully automated or as close to it as possible. We believe that OCaml is the perfect programming language choice for this endeavour, due to its multi-paradigm nature, and its status as a general-purpose language with use cases in both academia and the industry. And, most importantly, it has good support for automated deductive verification with Cameleer and GOSPEL. The current version of the textbook includes more than 1000 lines of verified OCaml code spread across 6 chapters and more than 40 programs. Moreover, we offer a blend of functional and imperative case studies, and, overall, a substantial subset of constructs found in OCaml, including its module system. In this document, we discuss our thought process and design decisions behind the creation of a textbook on verified OCaml algorithms. Namely, identifying which classes of algorithms to tackle, which algorithms were chosen within those classes, and how to orga- nize the contents of the textbook, to name a few topics. Additionally, this is accompanied by an overview of theoretical and practical concepts concerning programming languages, algorithm analysis, deductive verification, and the selected tools.
Main Authors:Gasparinho, Pedro Ramos
Subject:Deductive Verification OCaml GOSPEL Cameleer Why3 Algorithms
Year:2025
Country:Portugal
Document type:master thesis
Access type:open access
Associated institution:Universidade Nova de Lisboa
Language:English
Origin:Repositório Institucional da UNL
Description
Summary:We live in a society that has an ever-increasing dependency on critical software. Even minor programming oversights can have disastrous consequences, ranging from endangering human and animal lives to economic loss. Thus, it is crucial to verify the correctness of such programs, which can be achieved with deductive verification techniques. However, the teaching of such techniques is hampered by the small number of bibliographical works in this field. Our goal with this work is ambitious: to write a textbook on verified algorithms and data structures, fully automated or as close to it as possible. We believe that OCaml is the perfect programming language choice for this endeavour, due to its multi-paradigm nature, and its status as a general-purpose language with use cases in both academia and the industry. And, most importantly, it has good support for automated deductive verification with Cameleer and GOSPEL. The current version of the textbook includes more than 1000 lines of verified OCaml code spread across 6 chapters and more than 40 programs. Moreover, we offer a blend of functional and imperative case studies, and, overall, a substantial subset of constructs found in OCaml, including its module system. In this document, we discuss our thought process and design decisions behind the creation of a textbook on verified OCaml algorithms. Namely, identifying which classes of algorithms to tackle, which algorithms were chosen within those classes, and how to orga- nize the contents of the textbook, to name a few topics. Additionally, this is accompanied by an overview of theoretical and practical concepts concerning programming languages, algorithm analysis, deductive verification, and the selected tools.