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. 05 Jun 2018 00:00:00 +0000 Partial Order Reduction https://www.isa-afp.org/entries/Partial_Order_Reduction.html https://www.isa-afp.org/entries/Partial_Order_Reduction.html Julian Brunner 05 Jun 2018 00:00:00 +0000 This entry provides a formalization of the abstract theory of ample set partial order reduction. The formalization includes transition systems with actions, trace theory, as well as basics on finite, infinite, and lazy sequences. We also provide a basic framework for static analysis on concurrent systems with respect to the ample set condition. Optimal Binary Search Trees https://www.isa-afp.org/entries/Optimal_BST.html https://www.isa-afp.org/entries/Optimal_BST.html Tobias Nipkow, Dániel Somogyi 27 May 2018 00:00:00 +0000 This article formalizes recursive algorithms for the construction of optimal binary search trees given fixed access frequencies. We follow Knuth (1971), Yao (1980) and Mehlhorn (1984). The algorithms are memoized with the help of the AFP article <a href="Monad_Memo_DP.html">Monadification, Memoization and Dynamic Programming</a>, thus yielding dynamic programming algorithms. Hidden Markov Models https://www.isa-afp.org/entries/Hidden_Markov_Models.html https://www.isa-afp.org/entries/Hidden_Markov_Models.html Simon Wimmer 25 May 2018 00:00:00 +0000 This entry contains a formalization of hidden Markov models [3] based on Johannes Hölzl's formalization of discrete time Markov chains [1]. The basic definitions are provided and the correctness of two main (dynamic programming) algorithms for hidden Markov models is proved: the forward algorithm for computing the likelihood of an observed sequence, and the Viterbi algorithm for decoding the most probable hidden state sequence. The Viterbi algorithm is made executable including memoization. Hidden markov models have various applications in natural language processing. For an introduction see Jurafsky and Martin [2]. Probabilistic Timed Automata https://www.isa-afp.org/entries/Probabilistic_Timed_Automata.html https://www.isa-afp.org/entries/Probabilistic_Timed_Automata.html Simon Wimmer, Johannes Hölzl 24 May 2018 00:00:00 +0000 We present a formalization of probabilistic timed automata (PTA) for which we try to follow the formula MDP + TA = PTA as far as possible: our work starts from our existing formalizations of Markov decision processes (MDP) and timed automata (TA) and combines them modularly. We prove the fundamental result for probabilistic timed automata: the region construction that is known from timed automata carries over to the probabilistic setting. In particular, this allows us to prove that minimum and maximum reachability probabilities can be computed via a reduction to MDP model checking, including the case where one wants to disregard unrealizable behavior. Further information can be found in our ITP paper [2]. Irrational Rapidly Convergent Series https://www.isa-afp.org/entries/Irrationality_J_Hancl.html https://www.isa-afp.org/entries/Irrationality_J_Hancl.html Angeliki Koutsoukou Argyraki, Wenda Li 23 May 2018 00:00:00 +0000 We formalize with Isabelle/HOL a proof of a theorem by J. Hancl asserting the irrationality of the sum of a series consisting of rational numbers, built up by sequences that fulfill certain properties. Even though the criterion is a number theoretic result, the proof makes use only of analytical arguments. We also formalize a corollary of the theorem for a specific series fulfilling the assumptions of the theorem. Axiom Systems for Category Theory in Free Logic https://www.isa-afp.org/entries/AxiomaticCategoryTheory.html https://www.isa-afp.org/entries/AxiomaticCategoryTheory.html Christoph Benzmüller, Dana Scott 23 May 2018 00:00:00 +0000 This document provides a concise overview on the core results of our previous work on the exploration of axioms systems for category theory. Extending the previous studies (http://arxiv.org/abs/1609.01493) we include one further axiomatic theory in our experiments. This additional theory has been suggested by Mac Lane in 1948. We show that the axioms proposed by Mac Lane are equivalent to the ones we studied before, which includes an axioms set suggested by Scott in the 1970s and another axioms set proposed by Freyd and Scedrov in 1990, which we slightly modified to remedy a minor technical issue. Monadification, Memoization and Dynamic Programming https://www.isa-afp.org/entries/Monad_Memo_DP.html https://www.isa-afp.org/entries/Monad_Memo_DP.html Simon Wimmer, Shuwei Hu, Tobias Nipkow 22 May 2018 00:00:00 +0000 We present a lightweight framework for the automatic verified (functional or imperative) memoization of recursive functions. Our tool can turn a pure Isabelle/HOL function definition into a monadified version in a state monad or the Imperative HOL heap monad, and prove a correspondence theorem. We provide a variety of memory implementations for the two types of monads. A number of simple techniques allow us to achieve bottom-up computation and space-efficient memoization. The framework’s utility is demonstrated on a number of representative dynamic programming problems. A detailed description of our work can be found in the accompanying paper [2]. OpSets: Sequential Specifications for Replicated Datatypes https://www.isa-afp.org/entries/OpSets.html https://www.isa-afp.org/entries/OpSets.html Martin Kleppmann, Victor B. F. Gomes, Dominic P. Mulligan, Alastair R. Beresford 10 May 2018 00:00:00 +0000 We introduce OpSets, an executable framework for specifying and reasoning about the semantics of replicated datatypes that provide eventual consistency in a distributed system, and for mechanically verifying algorithms that implement these datatypes. Our approach is simple but expressive, allowing us to succinctly specify a variety of abstract datatypes, including maps, sets, lists, text, graphs, trees, and registers. Our datatypes are also composable, enabling the construction of complex data structures. To demonstrate the utility of OpSets for analysing replication algorithms, we highlight an important correctness property for collaborative text editing that has traditionally been overlooked; algorithms that do not satisfy this property can exhibit awkward interleaving of text. We use OpSets to specify this correctness property and prove that although one existing replication algorithm satisfies this property, several other published algorithms do not. An Isabelle/HOL Formalization of the Modular Assembly Kit for Security Properties https://www.isa-afp.org/entries/Modular_Assembly_Kit_Security.html https://www.isa-afp.org/entries/Modular_Assembly_Kit_Security.html Oliver Bračevac, Richard Gay, Sylvia Grewe, Heiko Mantel, Henning Sudbrock, Markus Tasch 07 May 2018 00:00:00 +0000 The "Modular Assembly Kit for Security Properties" (MAKS) is a framework for both the definition and verification of possibilistic information-flow security properties at the specification-level. MAKS supports the uniform representation of a wide range of possibilistic information-flow properties and provides support for the verification of such properties via unwinding results and compositionality results. We provide a formalization of this framework in Isabelle/HOL. WebAssembly https://www.isa-afp.org/entries/WebAssembly.html https://www.isa-afp.org/entries/WebAssembly.html Conrad Watt 29 Apr 2018 00:00:00 +0000 This is a mechanised specification of the WebAssembly language, drawn mainly from the previously published paper formalisation of Haas et al. Also included is a full proof of soundness of the type system, together with a verified type checker and interpreter. We include only a partial procedure for the extraction of the type checker and interpreter here. For more details, please see our paper in CPP 2018. VerifyThis 2018 - Polished Isabelle Solutions https://www.isa-afp.org/entries/VerifyThis2018.html https://www.isa-afp.org/entries/VerifyThis2018.html Peter Lammich, Simon Wimmer 27 Apr 2018 00:00:00 +0000 <a href="http://www.pm.inf.ethz.ch/research/verifythis.html">VerifyThis 2018</a> was a program verification competition associated with ETAPS 2018. It was the 7th event in the VerifyThis competition series. In this entry, we present polished and completed versions of our solutions that we created during the competition. Bounded Natural Functors with Covariance and Contravariance https://www.isa-afp.org/entries/BNF_CC.html https://www.isa-afp.org/entries/BNF_CC.html Andreas Lochbihler, Joshua Schneider 24 Apr 2018 00:00:00 +0000 Bounded natural functors (BNFs) provide a modular framework for the construction of (co)datatypes in higher-order logic. Their functorial operations, the mapper and relator, are restricted to a subset of the parameters, namely those where recursion can take place. For certain applications, such as free theorems, data refinement, quotients, and generalised rewriting, it is desirable that these operations do not ignore the other parameters. In this article, we formalise the generalisation BNF<sub>CC</sub> that extends the mapper and relator to covariant and contravariant parameters. We show that <ol> <li> BNF<sub>CC</sub>s are closed under functor composition and least and greatest fixpoints,</li> <li> subtypes inherit the BNF<sub>CC</sub> structure under conditions that generalise those for the BNF case, and</li> <li> BNF<sub>CC</sub>s preserve quotients under mild conditions.</li> </ol> These proofs are carried out for abstract BNF<sub>CC</sub>s similar to the AFP entry BNF Operations. In addition, we apply the BNF<sub>CC</sub> theory to several concrete functors. The Incompatibility of Fishburn-Strategyproofness and Pareto-Efficiency https://www.isa-afp.org/entries/Fishburn_Impossibility.html https://www.isa-afp.org/entries/Fishburn_Impossibility.html Felix Brandt, Manuel Eberl, Christian Saile, Christian Stricker 22 Mar 2018 00:00:00 +0000 <p>This formalisation contains the proof that there is no anonymous Social Choice Function for at least three agents and alternatives that fulfils both Pareto-Efficiency and Fishburn-Strategyproofness. It was derived from a proof of <a href="http://dss.in.tum.de/files/brandt-research/stratset.pdf">Brandt <em>et al.</em></a>, which relies on an unverified translation of a fixed finite instance of the original problem to SAT. This Isabelle proof contains a machine-checked version of both the statement for exactly three agents and alternatives and the lifting to the general case.</p> Weight-Balanced Trees https://www.isa-afp.org/entries/Weight_Balanced_Trees.html https://www.isa-afp.org/entries/Weight_Balanced_Trees.html Tobias Nipkow, Stefan Dirix 13 Mar 2018 00:00:00 +0000 This theory provides a verified implementation of weight-balanced trees following the work of <a href="https://doi.org/10.1017/S0956796811000104">Hirai and Yamamoto</a> who proved that all parameters in a certain range are valid, i.e. guarantee that insertion and deletion preserve weight-balance. Instead of a general theorem we provide parameterized proofs of preservation of the invariant that work for many (all?) valid parameters. CakeML https://www.isa-afp.org/entries/CakeML.html https://www.isa-afp.org/entries/CakeML.html Lars Hupel 12 Mar 2018 00:00:00 +0000 CakeML is a functional programming language with a proven-correct compiler and runtime system. This entry contains an unofficial version of the CakeML semantics that has been exported from the Lem specifications to Isabelle. Additionally, there are some hand-written theory files that adapt the exported code to Isabelle and port proofs from the HOL4 formalization, e.g. termination and equivalence proofs. A Theory of Architectural Design Patterns https://www.isa-afp.org/entries/Architectural_Design_Patterns.html https://www.isa-afp.org/entries/Architectural_Design_Patterns.html Diego Marmsoler 01 Mar 2018 00:00:00 +0000 The following document formalizes and verifies several architectural design patterns. Each pattern specification is formalized in terms of a locale where the locale assumptions correspond to the assumptions which a pattern poses on an architecture. Thus, pattern specifications may build on top of each other by interpreting the corresponding locale. A pattern is verified using the framework provided by the AFP entry Dynamic Architectures. Currently, the document consists of formalizations of 4 different patterns: the singleton, the publisher subscriber, the blackboard pattern, and the blockchain pattern. Thereby, the publisher component of the publisher subscriber pattern is modeled as an instance of the singleton pattern and the blackboard pattern is modeled as an instance of the publisher subscriber pattern. In general, this entry provides the first steps towards an overall theory of architectural design patterns. Hoare Logics for Time Bounds https://www.isa-afp.org/entries/Hoare_Time.html https://www.isa-afp.org/entries/Hoare_Time.html Maximilian P. L. Haslbeck, Tobias Nipkow 26 Feb 2018 00:00:00 +0000 We study three different Hoare logics for reasoning about time bounds of imperative programs and formalize them in Isabelle/HOL: a classical Hoare like logic due to Nielson, a logic with potentials due to Carbonneaux <i>et al.</i> and a <i>separation logic</i> following work by Atkey, Chaguérand and Pottier. These logics are formally shown to be sound and complete. Verification condition generators are developed and are shown sound and complete too. We also consider variants of the systems where we abstract from multiplicative constants in the running time bounds, thus supporting a big-O style of reasoning. Finally we compare the expressive power of the three systems. Treaps https://www.isa-afp.org/entries/Treaps.html https://www.isa-afp.org/entries/Treaps.html Maximilian Haslbeck, Manuel Eberl, Tobias Nipkow 06 Feb 2018 00:00:00 +0000 <p> A Treap is a binary tree whose nodes contain pairs consisting of some payload and an associated priority. It must have the search-tree property w.r.t. the payloads and the heap property w.r.t. the priorities. Treaps are an interesting data structure that is related to binary search trees (BSTs) in the following way: if one forgets all the priorities of a treap, the resulting BST is exactly the same as if one had inserted the elements into an empty BST in order of ascending priority. This means that a treap behaves like a BST where we can pretend the elements were inserted in a different order from the one in which they were actually inserted. </p> <p> In particular, by choosing these priorities at random upon insertion of an element, we can pretend that we inserted the elements in <em>random order</em>, so that the shape of the resulting tree is that of a random BST no matter in what order we insert the elements. This is the main result of this formalisation.</p> A verified factorization algorithm for integer polynomials with polynomial complexity https://www.isa-afp.org/entries/LLL_Factorization.html https://www.isa-afp.org/entries/LLL_Factorization.html Jose Divasón, Sebastiaan Joosten, René Thiemann, Akihisa Yamada 06 Feb 2018 00:00:00 +0000 Short vectors in lattices and factors of integer polynomials are related. Each factor of an integer polynomial belongs to a certain lattice. When factoring polynomials, the condition that we are looking for an irreducible polynomial means that we must look for a small element in a lattice, which can be done by a basis reduction algorithm. In this development we formalize this connection and thereby one main application of the LLL basis reduction algorithm: an algorithm to factor square-free integer polynomials which runs in polynomial time. The work is based on our previous Berlekamp–Zassenhaus development, where the exponential reconstruction phase has been replaced by the polynomial-time basis reduction algorithm. Thanks to this formalization we found a serious flaw in a textbook. First-Order Terms https://www.isa-afp.org/entries/First_Order_Terms.html https://www.isa-afp.org/entries/First_Order_Terms.html Christian Sternagel, René Thiemann 06 Feb 2018 00:00:00 +0000 We formalize basic results on first-order terms, including a first-order unification algorithm, as well as well-foundedness of the subsumption order. This entry is part of the <i>Isabelle Formalization of Rewriting</i> <a href="http://cl-informatik.uibk.ac.at/isafor">IsaFoR</a>, where first-order terms are omni-present: the unification algorithm is used to certify several confluence and termination techniques, like critical-pair computation and dependency graph approximations; and the subsumption order is a crucial ingredient for completion. The Error Function https://www.isa-afp.org/entries/Error_Function.html https://www.isa-afp.org/entries/Error_Function.html Manuel Eberl 06 Feb 2018 00:00:00 +0000 <p> This entry provides the definitions and basic properties of the complex and real error function erf and the complementary error function erfc. Additionally, it gives their full asymptotic expansions. </p> A verified LLL algorithm https://www.isa-afp.org/entries/LLL_Basis_Reduction.html https://www.isa-afp.org/entries/LLL_Basis_Reduction.html Ralph Bottesch, Jose Divasón, Maximilian Haslbeck, Sebastiaan Joosten, René Thiemann, Akihisa Yamada 02 Feb 2018 00:00:00 +0000 The Lenstra-Lenstra-Lovász basis reduction algorithm, also known as LLL algorithm, is an algorithm to find a basis with short, nearly orthogonal vectors of an integer lattice. Thereby, it can also be seen as an approximation to solve the shortest vector problem (SVP), which is an NP-hard problem, where the approximation quality solely depends on the dimension of the lattice, but not the lattice itself. The algorithm also possesses many applications in diverse fields of computer science, from cryptanalysis to number theory, but it is specially well-known since it was used to implement the first polynomial-time algorithm to factor polynomials. In this work we present the first mechanized soundness proof of the LLL algorithm to compute short vectors in lattices. The formalization follows a textbook by von zur Gathen and Gerhard. Formalization of Bachmair and Ganzinger's Ordered Resolution Prover https://www.isa-afp.org/entries/Ordered_Resolution_Prover.html https://www.isa-afp.org/entries/Ordered_Resolution_Prover.html Anders Schlichtkrull, Jasmin Christian Blanchette, Dmitriy Traytel, Uwe Waldmann 18 Jan 2018 00:00:00 +0000 This Isabelle/HOL formalization covers Sections 2 to 4 of Bachmair and Ganzinger's "Resolution Theorem Proving" chapter in the <em>Handbook of Automated Reasoning</em>. This includes soundness and completeness of unordered and ordered variants of ground resolution with and without literal selection, the standard redundancy criterion, a general framework for refutational theorem proving, and soundness and completeness of an abstract first-order prover. Gromov Hyperbolicity https://www.isa-afp.org/entries/Gromov_Hyperbolicity.html https://www.isa-afp.org/entries/Gromov_Hyperbolicity.html Sebastien Gouezel 16 Jan 2018 00:00:00 +0000 A geodesic metric space is Gromov hyperbolic if all its geodesic triangles are thin, i.e., every side is contained in a fixed thickening of the two other sides. While this definition looks innocuous, it has proved extremely important and versatile in modern geometry since its introduction by Gromov. We formalize the basic classical properties of Gromov hyperbolic spaces, notably the Morse lemma asserting that quasigeodesics are close to geodesics, the invariance of hyperbolicity under quasi-isometries, we define and study the Gromov boundary and its associated distance, and prove that a quasi-isometry between Gromov hyperbolic spaces extends to a homeomorphism of the boundaries. We also prove a less classical theorem, by Bonk and Schramm, asserting that a Gromov hyperbolic space embeds isometrically in a geodesic Gromov-hyperbolic space. As the original proof uses a transfinite sequence of Cauchy completions, this is an interesting formalization exercise. Along the way, we introduce basic material on isometries, quasi-isometries, Lipschitz maps, geodesic spaces, the Hausdorff distance, the Cauchy completion of a metric space, and the exponential on extended real numbers. An Isabelle/HOL formalisation of Green's Theorem https://www.isa-afp.org/entries/Green.html https://www.isa-afp.org/entries/Green.html Mohammad Abdulaziz, Lawrence C. Paulson 11 Jan 2018 00:00:00 +0000 We formalise a statement of Green’s theorem—the first formalisation to our knowledge—in Isabelle/HOL. The theorem statement that we formalise is enough for most applications, especially in physics and engineering. Our formalisation is made possible by a novel proof that avoids the ubiquitous line integral cancellation argument. This eliminates the need to formalise orientations and region boundaries explicitly with respect to the outwards-pointing normal vector. Instead we appeal to a homological argument about equivalences between paths. Taylor Models https://www.isa-afp.org/entries/Taylor_Models.html https://www.isa-afp.org/entries/Taylor_Models.html Christoph Traut, Fabian Immler 08 Jan 2018 00:00:00 +0000 We present a formally verified implementation of multivariate Taylor models. Taylor models are a form of rigorous polynomial approximation, consisting of an approximation polynomial based on Taylor expansions, combined with a rigorous bound on the approximation error. Taylor models were introduced as a tool to mitigate the dependency problem of interval arithmetic. Our implementation automatically computes Taylor models for the class of elementary functions, expressed by composition of arithmetic operations and basic functions like exp, sin, or square root. The Falling Factorial of a Sum https://www.isa-afp.org/entries/Falling_Factorial_Sum.html https://www.isa-afp.org/entries/Falling_Factorial_Sum.html Lukas Bulwahn 22 Dec 2017 00:00:00 +0000 This entry shows that the falling factorial of a sum can be computed with an expression using binomial coefficients and the falling factorial of its summands. The entry provides three different proofs: a combinatorial proof, an induction proof and an algebraic proof using the Vandermonde identity. The three formalizations try to follow their informal presentations from a Mathematics Stack Exchange page as close as possible. The induction and algebraic formalization end up to be very close to their informal presentation, whereas the combinatorial proof first requires the introduction of list interleavings, and significant more detail than its informal presentation. The Median-of-Medians Selection Algorithm https://www.isa-afp.org/entries/Median_Of_Medians_Selection.html https://www.isa-afp.org/entries/Median_Of_Medians_Selection.html Manuel Eberl 21 Dec 2017 00:00:00 +0000 <p>This entry provides an executable functional implementation of the Median-of-Medians algorithm for selecting the <em>k</em>-th smallest element of an unsorted list deterministically in linear time. The size bounds for the recursive call that lead to the linear upper bound on the run-time of the algorithm are also proven. </p> The Mason–Stothers Theorem https://www.isa-afp.org/entries/Mason_Stothers.html https://www.isa-afp.org/entries/Mason_Stothers.html Manuel Eberl 21 Dec 2017 00:00:00 +0000 <p>This article provides a formalisation of Snyder’s simple and elegant proof of the Mason&ndash;Stothers theorem, which is the polynomial analogue of the famous abc Conjecture for integers. Remarkably, Snyder found this very elegant proof when he was still a high-school student.</p> <p>In short, the statement of the theorem is that three non-zero coprime polynomials <em>A</em>, <em>B</em>, <em>C</em> over a field which sum to 0 and do not all have vanishing derivatives fulfil max{deg(<em>A</em>), deg(<em>B</em>), deg(<em>C</em>)} < deg(rad(<em>ABC</em>)) where the rad(<em>P</em>) denotes the <em>radical</em> of <em>P</em>, i.&thinsp;e. the product of all unique irreducible factors of <em>P</em>.</p> <p>This theorem also implies a kind of polynomial analogue of Fermat’s Last Theorem for polynomials: except for trivial cases, <em>A<sup>n</sup></em> + <em>B<sup>n</sup></em> + <em>C<sup>n</sup></em> = 0 implies n&nbsp;&le;&nbsp;2 for coprime polynomials <em>A</em>, <em>B</em>, <em>C</em> over a field.</em></p> Dirichlet L-Functions and Dirichlet's Theorem https://www.isa-afp.org/entries/Dirichlet_L.html https://www.isa-afp.org/entries/Dirichlet_L.html Manuel Eberl 21 Dec 2017 00:00:00 +0000 <p>This article provides a formalisation of Dirichlet characters and Dirichlet <em>L</em>-functions including proofs of their basic properties &ndash; most notably their analyticity, their areas of convergence, and their non-vanishing for &Re;(s) &ge; 1. All of this is built in a very high-level style using Dirichlet series. The proof of the non-vanishing follows a very short and elegant proof by Newman, which we attempt to reproduce faithfully in a similar level of abstraction in Isabelle.</p> <p>This also leads to a relatively short proof of Dirichlet’s Theorem, which states that, if <em>h</em> and <em>n</em> are coprime, there are infinitely many primes <em>p</em> with <em>p</em> &equiv; <em>h</em> (mod <em>n</em>).</p>