# SLFPrefaceIntroduction to the course

# Welcome

*Software Foundations*series, which presents the mathematical underpinnings of reliable software.

# About Separation Logic

{ H } t { Q }

-------------------------

{ H \* H' } t { Q \* H' }

- Automated proofs: the user provides only the code, and the tool locates sources of potential bugs. A good automated tool provides feedback that, most of time, is relevant.
- Semi-automated proofs: the user provides not just the code, but also specifications and invariants; the tool then leverages automated solvers (e.g., SMT solvers) to discharge proof obligations.
- Interactive proofs: the user provides not just the code and its specifications, but also a detailed proof script justifying the correctness of the code; such proofs are developed interactively using a proof assistant such as Coq.

- higher-order logic provides virtually-unlimited expressiveness that enables formulating arbitrarily-complex specifications and invariants;
- a proof assistant provides a unified framework to prove both the implementation details of the code and the underlying mathematical results form, e.g., results from theory or graph theory;
- proof scripts may be easily maintained to reflect on a change to the source code;
- the fact that Separation Logic is formalized in the proof assistant provides high confidence in the correctness of the tool.

- A formalization of the syntax and semantics of the source language This is called a "deep embedding" of the programming language.
- A definition of Separation Logic predicates as predicates from higher-order logic. This is called a "shallow embedding" of the program logic.
- A definition of Separation Logic triples as a predicate, the statements of the reasoning rules as lemmas, and the proof of these reasoning rules with respect to the semantics.
- An infrastructure that consists of lemmas, tactics and notation, allowing for verification proof to be carried out through relatively concise proof scripts.

- A minimalistic imperative programming language: a lambda-calculus with references. This language admits a simple semantics and avoids in particular the need to distinguish between stack variables and heap-allocated variables.
- The simplest possible variant of Separation Logic.

## Course Summary

- SeqSepLogic.pdf is a LaTeX-formatted paper that gives a summary
of most of the definitions involved in the course,
yet not covering the chapters SLFBasic and SLFWPgen,
which involve a weakest precondition generator.
- SLFSummary.pdf contains LaTeX-formatted slides presenting the
most important definitions.
- SLFSummary.v contains Coq material, aimed to give a 1-hour tour
of the key ingredients involved in the course.
- SLFMinimal.v contains a minimal proof of soundness of Separation Logic for sequential programs. It is aimed to argue for the simplicity of the soundness proof of Separation Logic when set up with the definitions considered in this course.

## Chapters

- SLFPreface: the present introduction.
- SLFBasic: introduction to Separation Logic through practical examples
of specifications and verification proofs, on basic programs;
this chapter is helpful for motivating Separation Logic.
- SLFHprop: definition of the core operators of Separation Logic,
of Hoare triples, and of Separation Logic triples.
- SLFHimpl: definition of the entailment relation, statement and proof
of its fundamental properties, and description of the
simplification tactic for entailment.
- SLFRules: statement and proofs of the reasoning rules of Separation Logic,
and examples of complete verification proofs.
- SLFWPsem: definition of the semantic notion of weakest precondition,
and statement of reasoning rules in weakest-precondition style.
- SLFWPgen: presentation of a function that effectively computes weakest
preconditions, and description of the construction of a set up
that leads to concise verification proofs.
- SLFWand: introduction of the magic wand, of the ramified frame rule,
and recursive computation of weakest precondition inside functions.
- SLFAffine: description of a generalized Separation Logic that supports the
ability to freely discard certain types of heap predicates.
- SLFStruct: specification of array and record operations, and realization
of these operations using pointer arithmetic.
- SLFRich: treatment of additional language constructs, including loops, assertions, and n-ary functions.

## Special chapters

- SLFSummary:This file contains the material for a one-hour talk that
introduces, at a high level, the most important ideas from the
course. This material is accompanied by LaTeX-generated slides
to be found in the file SLFSummary.pdf.
- SLFDirect: This file provides the minimal set of definitions and lemmas
required to build a practical program verification tool,
without detour. This file is mostly self-contained; it depends
only on the representation of variables, of finite maps, and
on the implementation of the entailment simplification tactic
(i.e., auxiliary files Var.v, Fmap.v, and SepSimpl.v).
Note that the file SLFDirect contains a minimal amount of
comments; explanations are given in the main course chapters.
- SLFExtra: This file recaps the definition and lemmas that are presented in the main course chapters but that are not included in the file SLFDirect. Again, this file serves as a reference, and does not contain further explanations.

## Teaching units

- SLFBasic
- SLFProp and SLFHimpl
- SLFRules
- SLFWPsem and SLFWPgen
- A presentation of the main ideas from the chapters SLFAffine and SLFStruct and SLFRich, with students reading the advanced contents if they are interested.

## Three levels of reading

- the "chapter in a rush" part, which presents the main take-away messages,
- the "detailed contents" part, which presents important technical results,
- the "optional contents" part, intended for those who seek a deeper understanding, including in particular discussion of alternative definitions.

- reading only the "in a rush" parts of every chapter should make sense,
- all the "optional contents" parts are essentially independent: up to a few exceptions, these parts may be read, partially read, or skipped, without consequences on the understanding of the other chapters.

## Exercises

## System Requirements

## Note for CoqIDE users

coqide -async-proofs off -async-proofs-command-error-resilience off -Q . SLF SLF*.v &

## TLC: tactics and libraries

## Imports between files

# Dissemination

## Recommended citation format

@book {Chargueraud:SF6,

author = {Arthur Charguéraud},

title = "Separation Logic Foundations",

series = "Software Foundations",

volume = "6",

year = "2020",

publisher = "Electronic textbook",

note = {Version 1.0, \URL{http://softwarefoundations.cis.upenn.edu} },

}

## For instructors and contributors

*Logical Foundations*for instructions.

# Thanks

*Software Foundations*series has been supported, in part, by the National Science Foundation under the NSF Expeditions grant 1521523,

*The Science of Deep Specification*.

(* 2020-09-03 15:43:08 (UTC+02) *)