Archive of Formal Proofs https://www.isa-afp.org The Archive of Formal Proofs is a collection of proof libraries, examples, and larger scientific developments, mechanically checked in the theorem prover Isabelle. 14 May 2019 00:00:00 +0000 Formalization of Generic Authenticated Data Structures https://www.isa-afp.org/entries/LambdaAuth.html https://www.isa-afp.org/entries/LambdaAuth.html Matthias Brun, Dmitriy Traytel 14 May 2019 00:00:00 +0000 Authenticated data structures are a technique for outsourcing data storage and maintenance to an untrusted server. The server is required to produce an efficiently checkable and cryptographically secure proof that it carried out precisely the requested computation. <a href="https://doi.org/10.1145/2535838.2535851">Miller et al.</a> introduced &lambda;&bull; (pronounced <i>lambda auth</i>)&mdash;a functional programming language with a built-in primitive authentication construct, which supports a wide range of user-specified authenticated data structures while guaranteeing certain correctness and security properties for all well-typed programs. We formalize &lambda;&bull; and prove its correctness and security properties. With Isabelle's help, we uncover and repair several mistakes in the informal proofs and lemma statements. Our findings are summarized in a <a href="http://people.inf.ethz.ch/trayteld/papers/lambdaauth/lambdaauth.pdf">paper draft</a>. Multi-Party Computation https://www.isa-afp.org/entries/Multi_Party_Computation.html https://www.isa-afp.org/entries/Multi_Party_Computation.html David Aspinall, David Butler 09 May 2019 00:00:00 +0000 We use CryptHOL to consider Multi-Party Computation (MPC) protocols. MPC was first considered by Yao in 1983 and recent advances in efficiency and an increased demand mean it is now deployed in the real world. Security is considered using the real/ideal world paradigm. We first define security in the semi-honest security setting where parties are assumed not to deviate from the protocol transcript. In this setting we prove multiple Oblivious Transfer (OT) protocols secure and then show security for the gates of the GMW protocol. We then define malicious security, this is a stronger notion of security where parties are assumed to be fully corrupted by an adversary. In this setting we again consider OT, as it is a fundamental building block of almost all MPC protocols. HOL-CSP Version 2.0 https://www.isa-afp.org/entries/HOL-CSP.html https://www.isa-afp.org/entries/HOL-CSP.html Safouan Taha, Lina Ye, Burkhart Wolff 26 Apr 2019 00:00:00 +0000 This is a complete formalization of the work of Hoare and Roscoe on the denotational semantics of the Failure/Divergence Model of CSP. It follows essentially the presentation of CSP in Roscoe’s Book ”Theory and Practice of Concurrency” [8] and the semantic details in a joint Paper of Roscoe and Brooks ”An improved failures model for communicating processes". The present work is based on a prior formalization attempt, called HOL-CSP 1.0, done in 1997 by H. Tej and B. Wolff with the Isabelle proof technology available at that time. This work revealed minor, but omnipresent foundational errors in key concepts like the process invariant. The present version HOL-CSP profits from substantially improved libraries (notably HOLCF), improved automated proof techniques, and structured proof techniques in Isar and is substantially shorter but more complete. A Compositional and Unified Translation of LTL into ω-Automata https://www.isa-afp.org/entries/LTL_Master_Theorem.html https://www.isa-afp.org/entries/LTL_Master_Theorem.html Benedikt Seidl, Salomon Sickert 16 Apr 2019 00:00:00 +0000 We present a formalisation of the unified translation approach of linear temporal logic (LTL) into ω-automata from [1]. This approach decomposes LTL formulas into ``simple'' languages and allows a clear separation of concerns: first, we formalise the purely logical result yielding this decomposition; second, we instantiate this generic theory to obtain a construction for deterministic (state-based) Rabin automata (DRA). We extract from this particular instantiation an executable tool translating LTL to DRAs. To the best of our knowledge this is the first verified translation from LTL to DRAs that is proven to be double exponential in the worst case which asymptotically matches the known lower bound. <p> [1] Javier Esparza, Jan Kretínský, Salomon Sickert. One Theorem to Rule Them All: A Unified Translation of LTL into ω-Automata. LICS 2018 A General Theory of Syntax with Bindings https://www.isa-afp.org/entries/Binding_Syntax_Theory.html https://www.isa-afp.org/entries/Binding_Syntax_Theory.html Lorenzo Gheri, Andrei Popescu 06 Apr 2019 00:00:00 +0000 We formalize a theory of syntax with bindings that has been developed and refined over the last decade to support several large formalization efforts. Terms are defined for an arbitrary number of constructors of varying numbers of inputs, quotiented to alpha-equivalence and sorted according to a binding signature. The theory includes many properties of the standard operators on terms: substitution, swapping and freshness. It also includes bindings-aware induction and recursion principles and support for semantic interpretation. This work has been presented in the ITP 2017 paper “A Formalized General Theory of Syntax with Bindings”. The Transcendence of Certain Infinite Series https://www.isa-afp.org/entries/Transcendence_Series_Hancl_Rucki.html https://www.isa-afp.org/entries/Transcendence_Series_Hancl_Rucki.html Angeliki Koutsoukou-Argyraki, Wenda Li 27 Mar 2019 00:00:00 +0000 We formalize the proofs of two transcendence criteria by J. Hančl and P. Rucki that assert the transcendence of the sums of certain infinite series built up by sequences that fulfil certain properties. Both proofs make use of Roth's celebrated theorem on diophantine approximations to algebraic numbers from 1955 which we implement as an assumption without having formalised its proof. Quantum Hoare Logic https://www.isa-afp.org/entries/QHLProver.html https://www.isa-afp.org/entries/QHLProver.html Junyi Liu, Bohua Zhan, Shuling Wang, Shenggang Ying, Tao Liu, Yangjia Li, Mingsheng Ying, Naijun Zhan 24 Mar 2019 00:00:00 +0000 We formalize quantum Hoare logic as given in [1]. In particular, we specify the syntax and denotational semantics of a simple model of quantum programs. Then, we write down the rules of quantum Hoare logic for partial correctness, and show the soundness and completeness of the resulting proof system. As an application, we verify the correctness of Grover’s algorithm. Safe OCL https://www.isa-afp.org/entries/Safe_OCL.html https://www.isa-afp.org/entries/Safe_OCL.html Denis Nikiforov 09 Mar 2019 00:00:00 +0000 <p>The theory is a formalization of the <a href="https://www.omg.org/spec/OCL/">OCL</a> type system, its abstract syntax and expression typing rules. The theory does not define a concrete syntax and a semantics. In contrast to <a href="https://www.isa-afp.org/entries/Featherweight_OCL.html">Featherweight OCL</a>, it is based on a deep embedding approach. The type system is defined from scratch, it is not based on the Isabelle HOL type system.</p> <p>The Safe OCL distincts nullable and non-nullable types. Also the theory gives a formal definition of <a href="http://ceur-ws.org/Vol-1512/paper07.pdf">safe navigation operations</a>. The Safe OCL typing rules are much stricter than rules given in the OCL specification. It allows one to catch more errors on a type checking phase.</p> <p>The type theory presented is four-layered: classes, basic types, generic types, errorable types. We introduce the following new types: non-nullable types (T[1]), nullable types (T[?]), OclSuper. OclSuper is a supertype of all other types (basic types, collections, tuples). This type allows us to define a total supremum function, so types form an upper semilattice. It allows us to define rich expression typing rules in an elegant manner.</p> <p>The Preliminaries Chapter of the theory defines a number of helper lemmas for transitive closures and tuples. It defines also a generic object model independent from OCL. It allows one to use the theory as a reference for formalization of analogous languages.</p> Elementary Facts About the Distribution of Primes https://www.isa-afp.org/entries/Prime_Distribution_Elementary.html https://www.isa-afp.org/entries/Prime_Distribution_Elementary.html Manuel Eberl 21 Feb 2019 00:00:00 +0000 <p>This entry is a formalisation of Chapter 4 (and parts of Chapter 3) of Apostol's <a href="https://www.springer.com/de/book/9780387901633"><em>Introduction to Analytic Number Theory</em></a>. The main topics that are addressed are properties of the distribution of prime numbers that can be shown in an elementary way (i.&thinsp;e. without the Prime Number Theorem), the various equivalent forms of the PNT (which imply each other in elementary ways), and consequences that follow from the PNT in elementary ways. The latter include, most notably, asymptotic bounds for the number of distinct prime factors of <em>n</em>, the divisor function <em>d(n)</em>, Euler's totient function <em>&phi;(n)</em>, and lcm(1,&hellip;,<em>n</em>).</p> Kruskal's Algorithm for Minimum Spanning Forest https://www.isa-afp.org/entries/Kruskal.html https://www.isa-afp.org/entries/Kruskal.html Maximilian P.L. Haslbeck, Peter Lammich, Julian Biendarra 14 Feb 2019 00:00:00 +0000 This Isabelle/HOL formalization defines a greedy algorithm for finding a minimum weight basis on a weighted matroid and proves its correctness. This algorithm is an abstract version of Kruskal's algorithm. We interpret the abstract algorithm for the cycle matroid (i.e. forests in a graph) and refine it to imperative executable code using an efficient union-find data structure. Our formalization can be instantiated for different graph representations. We provide instantiations for undirected graphs and symmetric directed graphs. Probabilistic Primality Testing https://www.isa-afp.org/entries/Probabilistic_Prime_Tests.html https://www.isa-afp.org/entries/Probabilistic_Prime_Tests.html Daniel Stüwe, Manuel Eberl 11 Feb 2019 00:00:00 +0000 <p>The most efficient known primality tests are <em>probabilistic</em> in the sense that they use randomness and may, with some probability, mistakenly classify a composite number as prime &ndash; but never a prime number as composite. Examples of this are the Miller&ndash;Rabin test, the Solovay&ndash;Strassen test, and (in most cases) Fermat's test.</p> <p>This entry defines these three tests and proves their correctness. It also develops some of the number-theoretic foundations, such as Carmichael numbers and the Jacobi symbol with an efficient executable algorithm to compute it.</p> Universal Turing Machine https://www.isa-afp.org/entries/Universal_Turing_Machine.html https://www.isa-afp.org/entries/Universal_Turing_Machine.html Jian Xu, Xingyuan Zhang, Christian Urban, Sebastiaan J. C. Joosten 08 Feb 2019 00:00:00 +0000 We formalise results from computability theory: recursive functions, undecidability of the halting problem, and the existence of a universal Turing machine. This formalisation is the AFP entry corresponding to the paper Mechanising Turing Machines and Computability Theory in Isabelle/HOL, ITP 2013. Isabelle/UTP: Mechanised Theory Engineering for Unifying Theories of Programming https://www.isa-afp.org/entries/UTP.html https://www.isa-afp.org/entries/UTP.html Simon Foster, Frank Zeyda, Yakoub Nemouchi, Pedro Ribeiro, Burkhart Wolff 01 Feb 2019 00:00:00 +0000 Isabelle/UTP is a mechanised theory engineering toolkit based on Hoare and He’s Unifying Theories of Programming (UTP). UTP enables the creation of denotational, algebraic, and operational semantics for different programming languages using an alphabetised relational calculus. We provide a semantic embedding of the alphabetised relational calculus in Isabelle/HOL, including new type definitions, relational constructors, automated proof tactics, and accompanying algebraic laws. Isabelle/UTP can be used to both capture laws of programming for different languages, and put these fundamental theorems to work in the creation of associated verification tools, using calculi like Hoare logics. This document describes the relational core of the UTP in Isabelle/HOL. The Inversions of a List https://www.isa-afp.org/entries/List_Inversions.html https://www.isa-afp.org/entries/List_Inversions.html Manuel Eberl 01 Feb 2019 00:00:00 +0000 <p>This entry defines the set of <em>inversions</em> of a list, i.e. the pairs of indices that violate sortedness. It also proves the correctness of the well-known <em>O</em>(<em>n log n</em>) divide-and-conquer algorithm to compute the number of inversions.</p> Farkas' Lemma and Motzkin's Transposition Theorem https://www.isa-afp.org/entries/Farkas.html https://www.isa-afp.org/entries/Farkas.html Ralph Bottesch, Max W. Haslbeck, René Thiemann 17 Jan 2019 00:00:00 +0000 We formalize a proof of Motzkin's transposition theorem and Farkas' lemma in Isabelle/HOL. Our proof is based on the formalization of the simplex algorithm which, given a set of linear constraints, either returns a satisfying assignment to the problem or detects unsatisfiability. By reusing facts about the simplex algorithm we show that a set of linear constraints is unsatisfiable if and only if there is a linear combination of the constraints which evaluates to a trivially unsatisfiable inequality. IMP2 – Simple Program Verification in Isabelle/HOL https://www.isa-afp.org/entries/IMP2.html https://www.isa-afp.org/entries/IMP2.html Peter Lammich, Simon Wimmer 15 Jan 2019 00:00:00 +0000 IMP2 is a simple imperative language together with Isabelle tooling to create a program verification environment in Isabelle/HOL. The tools include a C-like syntax, a verification condition generator, and Isabelle commands for the specification of programs. The framework is modular, i.e., it allows easy reuse of already proved programs within larger programs. This entry comes with a quickstart guide and a large collection of examples, spanning basic algorithms with simple proofs to more advanced algorithms and proof techniques like data refinement. Some highlights from the examples are: <ul> <li>Bisection Square Root, </li> <li>Extended Euclid, </li> <li>Exponentiation by Squaring, </li> <li>Binary Search, </li> <li>Insertion Sort, </li> <li>Quicksort, </li> <li>Depth First Search. </li> </ul> The abstract syntax and semantics are very simple and well-documented. They are suitable to be used in a course, as extension to the IMP language which comes with the Isabelle distribution. While this entry is limited to a simple imperative language, the ideas could be extended to more sophisticated languages. An Algebra for Higher-Order Terms https://www.isa-afp.org/entries/Higher_Order_Terms.html https://www.isa-afp.org/entries/Higher_Order_Terms.html Lars Hupel 15 Jan 2019 00:00:00 +0000 In this formalization, I introduce a higher-order term algebra, generalizing the notions of free variables, matching, and substitution. The need arose from the work on a <a href="http://dx.doi.org/10.1007/978-3-319-89884-1_35">verified compiler from Isabelle to CakeML</a>. Terms can be thought of as consisting of a generic (free variables, constants, application) and a specific part. As example applications, this entry provides instantiations for de-Bruijn terms, terms with named variables, and <a href="https://www.isa-afp.org/entries/Lambda_Free_RPOs.html">Blanchette’s &lambda;-free higher-order terms</a>. Furthermore, I implement translation functions between de-Bruijn terms and named terms and prove their correctness. A Reduction Theorem for Store Buffers https://www.isa-afp.org/entries/Store_Buffer_Reduction.html https://www.isa-afp.org/entries/Store_Buffer_Reduction.html Ernie Cohen, Norbert Schirmer 07 Jan 2019 00:00:00 +0000 When verifying a concurrent program, it is usual to assume that memory is sequentially consistent. However, most modern multiprocessors depend on store buffering for efficiency, and provide native sequential consistency only at a substantial performance penalty. To regain sequential consistency, a programmer has to follow an appropriate programming discipline. However, na&iuml;ve disciplines, such as protecting all shared accesses with locks, are not flexible enough for building high-performance multiprocessor software. We present a new discipline for concurrent programming under TSO (total store order, with store buffer forwarding). It does not depend on concurrency primitives, such as locks. Instead, threads use ghost operations to acquire and release ownership of memory addresses. A thread can write to an address only if no other thread owns it, and can read from an address only if it owns it or it is shared and the thread has flushed its store buffer since it last wrote to an address it did not own. This discipline covers both coarse-grained concurrency (where data is protected by locks) as well as fine-grained concurrency (where atomic operations race to memory). We formalize this discipline in Isabelle/HOL, and prove that if every execution of a program in a system without store buffers follows the discipline, then every execution of the program with store buffers is sequentially consistent. Thus, we can show sequential consistency under TSO by ordinary assertional reasoning about the program, without having to consider store buffers at all. A Formal Model of the Document Object Model https://www.isa-afp.org/entries/Core_DOM.html https://www.isa-afp.org/entries/Core_DOM.html Achim D. Brucker, Michael Herzberg 26 Dec 2018 00:00:00 +0000 In this AFP entry, we formalize the core of the Document Object Model (DOM). At its core, the DOM defines a tree-like data structure for representing documents in general and HTML documents in particular. It is the heart of any modern web browser. Formalizing the key concepts of the DOM is a prerequisite for the formal reasoning over client-side JavaScript programs and for the analysis of security concepts in modern web browsers. We present a formalization of the core DOM, with focus on the node-tree and the operations defined on node-trees, in Isabelle/HOL. We use the formalization to verify the functional correctness of the most important functions defined in the DOM standard. Moreover, our formalization is 1) extensible, i.e., can be extended without the need of re-proving already proven properties and 2) executable, i.e., we can generate executable code from our specification. Formalization of Concurrent Revisions https://www.isa-afp.org/entries/Concurrent_Revisions.html https://www.isa-afp.org/entries/Concurrent_Revisions.html Roy Overbeek 25 Dec 2018 00:00:00 +0000 Concurrent revisions is a concurrency control model developed by Microsoft Research. It has many interesting properties that distinguish it from other well-known models such as transactional memory. One of these properties is <em>determinacy</em>: programs written within the model always produce the same outcome, independent of scheduling activity. The concurrent revisions model has an operational semantics, with an informal proof of determinacy. This document contains an Isabelle/HOL formalization of this semantics and the proof of determinacy. Verifying Imperative Programs using Auto2 https://www.isa-afp.org/entries/Auto2_Imperative_HOL.html https://www.isa-afp.org/entries/Auto2_Imperative_HOL.html Bohua Zhan 21 Dec 2018 00:00:00 +0000 This entry contains the application of auto2 to verifying functional and imperative programs. Algorithms and data structures that are verified include linked lists, binary search trees, red-black trees, interval trees, priority queue, quicksort, union-find, Dijkstra's algorithm, and a sweep-line algorithm for detecting rectangle intersection. The imperative verification is based on Imperative HOL and its separation logic framework. A major goal of this work is to set up automation in order to reduce the length of proof that the user needs to provide, both for verifying functional programs and for working with separation logic. Constructive Cryptography in HOL https://www.isa-afp.org/entries/Constructive_Cryptography.html https://www.isa-afp.org/entries/Constructive_Cryptography.html Andreas Lochbihler, S. Reza Sefidgar 17 Dec 2018 00:00:00 +0000 Inspired by Abstract Cryptography, we extend CryptHOL, a framework for formalizing game-based proofs, with an abstract model of Random Systems and provide proof rules about their composition and equality. This foundation facilitates the formalization of Constructive Cryptography proofs, where the security of a cryptographic scheme is realized as a special form of construction in which a complex random system is built from simpler ones. This is a first step towards a fully-featured compositional framework, similar to Universal Composability framework, that supports formalization of simulation-based proofs. Transformer Semantics https://www.isa-afp.org/entries/Transformer_Semantics.html https://www.isa-afp.org/entries/Transformer_Semantics.html Georg Struth 11 Dec 2018 00:00:00 +0000 These mathematical components formalise predicate transformer semantics for programs, yet currently only for partial correctness and in the absence of faults. A first part for isotone (or monotone), Sup-preserving and Inf-preserving transformers follows Back and von Wright's approach, with additional emphasis on the quantalic structure of algebras of transformers. The second part develops Sup-preserving and Inf-preserving predicate transformers from the powerset monad, via its Kleisli category and Eilenberg-Moore algebras, with emphasis on adjunctions and dualities, as well as isomorphisms between relations, state transformers and predicate transformers. Quantales https://www.isa-afp.org/entries/Quantales.html https://www.isa-afp.org/entries/Quantales.html Georg Struth 11 Dec 2018 00:00:00 +0000 These mathematical components formalise basic properties of quantales, together with some important models, constructions, and concepts, including quantic nuclei and conuclei. Properties of Orderings and Lattices https://www.isa-afp.org/entries/Order_Lattice_Props.html https://www.isa-afp.org/entries/Order_Lattice_Props.html Georg Struth 11 Dec 2018 00:00:00 +0000 These components add further fundamental order and lattice-theoretic concepts and properties to Isabelle's libraries. They follow by and large the introductory sections of the Compendium of Continuous Lattices, covering directed and filtered sets, down-closed and up-closed sets, ideals and filters, Galois connections, closure and co-closure operators. Some emphasis is on duality and morphisms between structures, as in the Compendium. To this end, three ad-hoc approaches to duality are compared. Graph Saturation https://www.isa-afp.org/entries/Graph_Saturation.html https://www.isa-afp.org/entries/Graph_Saturation.html Sebastiaan J. C. Joosten 23 Nov 2018 00:00:00 +0000 This is an Isabelle/HOL formalisation of graph saturation, closely following a <a href="https://doi.org/10.1016/j.jlamp.2018.06.005">paper by the author</a> on graph saturation. Nine out of ten lemmas of the original paper are proven in this formalisation. The formalisation additionally includes two theorems that show the main premise of the paper: that consistency and entailment are decided through graph saturation. This formalisation does not give executable code, and it did not implement any of the optimisations suggested in the paper. A Verified Functional Implementation of Bachmair and Ganzinger's Ordered Resolution Prover https://www.isa-afp.org/entries/Functional_Ordered_Resolution_Prover.html https://www.isa-afp.org/entries/Functional_Ordered_Resolution_Prover.html Anders Schlichtkrull, Jasmin Christian Blanchette, Dmitriy Traytel 23 Nov 2018 00:00:00 +0000 This Isabelle/HOL formalization refines the abstract ordered resolution prover presented in Section 4.3 of Bachmair and Ganzinger's "Resolution Theorem Proving" chapter in the <i>Handbook of Automated Reasoning</i>. The result is a functional implementation of a first-order prover. Auto2 Prover https://www.isa-afp.org/entries/Auto2_HOL.html https://www.isa-afp.org/entries/Auto2_HOL.html Bohua Zhan 20 Nov 2018 00:00:00 +0000 Auto2 is a saturation-based heuristic prover for higher-order logic, implemented as a tactic in Isabelle. This entry contains the instantiation of auto2 for Isabelle/HOL, along with two basic examples: solutions to some of the Pelletier’s problems, and elementary number theory of primes. Matroids https://www.isa-afp.org/entries/Matroids.html https://www.isa-afp.org/entries/Matroids.html Jonas Keinholz 16 Nov 2018 00:00:00 +0000 <p>This article defines the combinatorial structures known as <em>Independence Systems</em> and <em>Matroids</em> and provides basic concepts and theorems related to them. These structures play an important role in combinatorial optimisation, e. g. greedy algorithms such as Kruskal's algorithm. The development is based on Oxley's <a href="http://www.math.lsu.edu/~oxley/survey4.pdf">`What is a Matroid?'</a>.</p> Deriving generic class instances for datatypes https://www.isa-afp.org/entries/Generic_Deriving.html https://www.isa-afp.org/entries/Generic_Deriving.html Jonas Rädle, Lars Hupel 06 Nov 2018 00:00:00 +0000 <p>We provide a framework for automatically deriving instances for generic type classes. Our approach is inspired by Haskell's <i>generic-deriving</i> package and Scala's <i>shapeless</i> library. In addition to generating the code for type class functions, we also attempt to automatically prove type class laws for these instances. As of now, however, some manual proofs are still required for recursive datatypes.</p> <p>Note: There are already articles in the AFP that provide automatic instantiation for a number of classes. Concretely, <a href="https://www.isa-afp.org/entries/Deriving.html">Deriving</a> allows the automatic instantiation of comparators, linear orders, equality, and hashing. <a href="https://www.isa-afp.org/entries/Show.html">Show</a> instantiates a Haskell-style <i>show</i> class.</p><p>Our approach works for arbitrary classes (with some Isabelle/HOL overhead for each class), but a smaller set of datatypes.</p>