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. 22 Oct 2018 00:00:00 +0000 Smooth Manifolds https://www.isa-afp.org/entries/Smooth_Manifolds.html https://www.isa-afp.org/entries/Smooth_Manifolds.html Fabian Immler, Bohua Zhan 22 Oct 2018 00:00:00 +0000 We formalize the definition and basic properties of smooth manifolds in Isabelle/HOL. Concepts covered include partition of unity, tangent and cotangent spaces, and the fundamental theorem of path integrals. We also examine some concrete manifolds such as spheres and projective spaces. The formalization makes extensive use of the analysis and linear algebra libraries in Isabelle/HOL, in particular its “types-to-sets” mechanism. Randomised Binary Search Trees https://www.isa-afp.org/entries/Randomised_BSTs.html https://www.isa-afp.org/entries/Randomised_BSTs.html Manuel Eberl 19 Oct 2018 00:00:00 +0000 <p>This work is a formalisation of the Randomised Binary Search Trees introduced by Martínez and Roura, including definitions and correctness proofs.</p> <p>Like randomised treaps, they are a probabilistic data structure that behaves exactly as if elements were inserted into a non-balancing BST in random order. However, unlike treaps, they only use discrete probability distributions, but their use of randomness is more complicated.</p> Formalization of the Embedding Path Order for Lambda-Free Higher-Order Terms https://www.isa-afp.org/entries/Lambda_Free_EPO.html https://www.isa-afp.org/entries/Lambda_Free_EPO.html Alexander Bentkamp 19 Oct 2018 00:00:00 +0000 This Isabelle/HOL formalization defines the Embedding Path Order (EPO) for higher-order terms without lambda-abstraction and proves many useful properties about it. In contrast to the lambda-free recursive path orders, it does not fully coincide with RPO on first-order terms, but it is compatible with arbitrary higher-order contexts. Upper Bounding Diameters of State Spaces of Factored Transition Systems https://www.isa-afp.org/entries/Factored_Transition_System_Bounding.html https://www.isa-afp.org/entries/Factored_Transition_System_Bounding.html Friedrich Kurz, Mohammad Abdulaziz 12 Oct 2018 00:00:00 +0000 A completeness threshold is required to guarantee the completeness of planning as satisfiability, and bounded model checking of safety properties. One valid completeness threshold is the diameter of the underlying transition system. The diameter is the maximum element in the set of lengths of all shortest paths between pairs of states. The diameter is not calculated exactly in our setting, where the transition system is succinctly described using a (propositionally) factored representation. Rather, an upper bound on the diameter is calculated compositionally, by bounding the diameters of small abstract subsystems, and then composing those. We port a HOL4 formalisation of a compositional algorithm for computing a relatively tight upper bound on the system diameter. This compositional algorithm exploits acyclicity in the state space to achieve compositionality, and it was introduced by Abdulaziz et. al. The formalisation that we port is described as a part of another paper by Abdulaziz et. al. As a part of this porting we developed a libray about transition systems, which shall be of use in future related mechanisation efforts. The Transcendence of π https://www.isa-afp.org/entries/Pi_Transcendental.html https://www.isa-afp.org/entries/Pi_Transcendental.html Manuel Eberl 28 Sep 2018 00:00:00 +0000 <p>This entry shows the transcendence of &pi; based on the classic proof using the fundamental theorem of symmetric polynomials first given by von Lindemann in 1882, but the formalisation mostly follows the version by Niven. The proof reuses much of the machinery developed in the AFP entry on the transcendence of <em>e</em>.</p> Symmetric Polynomials https://www.isa-afp.org/entries/Symmetric_Polynomials.html https://www.isa-afp.org/entries/Symmetric_Polynomials.html Manuel Eberl 25 Sep 2018 00:00:00 +0000 <p>A symmetric polynomial is a polynomial in variables <em>X</em><sub>1</sub>,&hellip;,<em>X</em><sub>n</sub> that does not discriminate between its variables, i.&thinsp;e. it is invariant under any permutation of them. These polynomials are important in the study of the relationship between the coefficients of a univariate polynomial and its roots in its algebraic closure.</p> <p>This article provides a definition of symmetric polynomials and the elementary symmetric polynomials e<sub>1</sub>,&hellip;,e<sub>n</sub> and proofs of their basic properties, including three notable ones:</p> <ul> <li> Vieta's formula, which gives an explicit expression for the <em>k</em>-th coefficient of a univariate monic polynomial in terms of its roots <em>x</em><sub>1</sub>,&hellip;,<em>x</em><sub>n</sub>, namely <em>c</em><sub><em>k</em></sub> = (-1)<sup><em>n</em>-<em>k</em></sup>&thinsp;e<sub><em>n</em>-<em>k</em></sub>(<em>x</em><sub>1</sub>,&hellip;,<em>x</em><sub>n</sub>).</li> <li>Second, the Fundamental Theorem of Symmetric Polynomials, which states that any symmetric polynomial is itself a uniquely determined polynomial combination of the elementary symmetric polynomials.</li> <li>Third, as a corollary of the previous two, that given a polynomial over some ring <em>R</em>, any symmetric polynomial combination of its roots is also in <em>R</em> even when the roots are not. </ul> <p> Both the symmetry property itself and the witness for the Fundamental Theorem are executable. </p> Signature-Based Gröbner Basis Algorithms https://www.isa-afp.org/entries/Signature_Groebner.html https://www.isa-afp.org/entries/Signature_Groebner.html Alexander Maletzky 20 Sep 2018 00:00:00 +0000 <p>This article formalizes signature-based algorithms for computing Gr&ouml;bner bases. Such algorithms are, in general, superior to other algorithms in terms of efficiency, and have not been formalized in any proof assistant so far. The present development is both generic, in the sense that most known variants of signature-based algorithms are covered by it, and effectively executable on concrete input thanks to Isabelle's code generator. Sample computations of benchmark problems show that the verified implementation of signature-based algorithms indeed outperforms the existing implementation of Buchberger's algorithm in Isabelle/HOL.</p> <p>Besides total correctness of the algorithms, the article also proves that under certain conditions they a-priori detect and avoid all useless zero-reductions, and always return 'minimal' (in some sense) Gr&ouml;bner bases if an input parameter is chosen in the right way.</p><p>The formalization follows the recent survey article by Eder and Faug&egrave;re.</p> The Prime Number Theorem https://www.isa-afp.org/entries/Prime_Number_Theorem.html https://www.isa-afp.org/entries/Prime_Number_Theorem.html Manuel Eberl, Lawrence C. Paulson 19 Sep 2018 00:00:00 +0000 <p>This article provides a short proof of the Prime Number Theorem in several equivalent forms, most notably &pi;(<em>x</em>) ~ <em>x</em>/ln <em>x</em> where &pi;(<em>x</em>) is the number of primes no larger than <em>x</em>. It also defines other basic number-theoretic functions related to primes like Chebyshev's functions &thetasym; and &psi; and the &ldquo;<em>n</em>-th prime number&rdquo; function p<sub><em>n</em></sub>. We also show various bounds and relationship between these functions are shown. Lastly, we derive Mertens' First and Second Theorem, i.&thinsp;e. &sum;<sub><em>p</em>&le;<em>x</em></sub> ln <em>p</em>/<em>p</em> = ln <em>x</em> + <em>O</em>(1) and &sum;<sub><em>p</em>&le;<em>x</em></sub> 1/<em>p</em> = ln ln <em>x</em> + M + <em>O</em>(1/ln <em>x</em>). We also give explicit bounds for the remainder terms.</p> <p>The proof of the Prime Number Theorem builds on a library of Dirichlet series and analytic combinatorics. We essentially follow the presentation by Newman. The core part of the proof is a Tauberian theorem for Dirichlet series, which is proven using complex analysis and then used to strengthen Mertens' First Theorem to &sum;<sub><em>p</em>&le;<em>x</em></sub> ln <em>p</em>/<em>p</em> = ln <em>x</em> + c + <em>o</em>(1).</p> <p>A variant of this proof has been formalised before by Harrison in HOL Light, and formalisations of Selberg's elementary proof exist both by Avigad <em>et al.</em> in Isabelle and by Carneiro in Metamath. The advantage of the analytic proof is that, while it requires more powerful mathematical tools, it is considerably shorter and clearer. This article attempts to provide a short and clear formalisation of all components of that proof using the full range of mathematical machinery available in Isabelle, staying as close as possible to Newman's simple paper proof.</p> Aggregation Algebras https://www.isa-afp.org/entries/Aggregation_Algebras.html https://www.isa-afp.org/entries/Aggregation_Algebras.html Walter Guttmann 15 Sep 2018 00:00:00 +0000 We develop algebras for aggregation and minimisation for weight matrices and for edge weights in graphs. We verify the correctness of Prim's and Kruskal's minimum spanning tree algorithms based on these algebras. We also show numerous instances of these algebras based on linearly ordered commutative semigroups. Octonions https://www.isa-afp.org/entries/Octonions.html https://www.isa-afp.org/entries/Octonions.html Angeliki Koutsoukou-Argyraki 14 Sep 2018 00:00:00 +0000 We develop the basic theory of Octonions, including various identities and properties of the octonions and of the octonionic product, a description of 7D isometries and representations of orthogonal transformations. To this end we first develop the theory of the vector cross product in 7 dimensions. The development of the theory of Octonions is inspired by that of the theory of Quaternions by Lawrence Paulson. However, we do not work within the type class real_algebra_1 because the octonionic product is not associative. Quaternions https://www.isa-afp.org/entries/Quaternions.html https://www.isa-afp.org/entries/Quaternions.html Lawrence C. Paulson 05 Sep 2018 00:00:00 +0000 This theory is inspired by the HOL Light development of quaternions, but follows its own route. Quaternions are developed coinductively, as in the existing formalisation of the complex numbers. Quaternions are quickly shown to belong to the type classes of real normed division algebras and real inner product spaces. And therefore they inherit a great body of facts involving algebraic laws, limits, continuity, etc., which must be proved explicitly in the HOL Light version. The development concludes with the geometric interpretation of the product of imaginary quaternions. The Budan-Fourier Theorem and Counting Real Roots with Multiplicity https://www.isa-afp.org/entries/Budan_Fourier.html https://www.isa-afp.org/entries/Budan_Fourier.html Wenda Li 02 Sep 2018 00:00:00 +0000 This entry is mainly about counting and approximating real roots (of a polynomial) with multiplicity. We have first formalised the Budan-Fourier theorem: given a polynomial with real coefficients, we can calculate sign variations on Fourier sequences to over-approximate the number of real roots (counting multiplicity) within an interval. When all roots are known to be real, the over-approximation becomes tight: we can utilise this theorem to count real roots exactly. It is also worth noting that Descartes' rule of sign is a direct consequence of the Budan-Fourier theorem, and has been included in this entry. In addition, we have extended previous formalised Sturm's theorem to count real roots with multiplicity, while the original Sturm's theorem only counts distinct real roots. Compared to the Budan-Fourier theorem, our extended Sturm's theorem always counts roots exactly but may suffer from greater computational cost. An Incremental Simplex Algorithm with Unsatisfiable Core Generation https://www.isa-afp.org/entries/Simplex.html https://www.isa-afp.org/entries/Simplex.html Filip Marić, Mirko Spasić, René Thiemann 24 Aug 2018 00:00:00 +0000 We present an Isabelle/HOL formalization and total correctness proof for the incremental version of the Simplex algorithm which is used in most state-of-the-art SMT solvers. It supports extraction of satisfying assignments, extraction of unsatisfiable cores, incremental assertion of constraints and backtracking. Formalization relies on stepwise program refinement, starting from a simple specification, going through a number of refinement steps, and ending up in a fully executable functional implementation. Symmetries present in the algorithm are handled with special care. Minsky Machines https://www.isa-afp.org/entries/Minsky_Machines.html https://www.isa-afp.org/entries/Minsky_Machines.html Bertram Felgenhauer 14 Aug 2018 00:00:00 +0000 <p> We formalize undecidablity results for Minsky machines. To this end, we also formalize recursive inseparability. </p><p> We start by proving that Minsky machines can compute arbitrary primitive recursive and recursive functions. We then show that there is a deterministic Minsky machine with one argument and two final states such that the set of inputs that are accepted in one state is recursively inseparable from the set of inputs that are accepted in the other state. </p><p> As a corollary, the set of Minsky configurations that reach the first state but not the second recursively inseparable from the set of Minsky configurations that reach the second state but not the first. In particular both these sets are undecidable. </p><p> We do <em>not</em> prove that recursive functions can simulate Minsky machines. </p> Pricing in discrete financial models https://www.isa-afp.org/entries/DiscretePricing.html https://www.isa-afp.org/entries/DiscretePricing.html Mnacho Echenim 16 Jul 2018 00:00:00 +0000 We have formalized the computation of fair prices for derivative products in discrete financial models. As an application, we derive a way to compute fair prices of derivative products in the Cox-Ross-Rubinstein model of a financial market, thus completing the work that was presented in this <a href="https://hal.archives-ouvertes.fr/hal-01562944">paper</a>. Von-Neumann-Morgenstern Utility Theorem https://www.isa-afp.org/entries/Neumann_Morgenstern_Utility.html https://www.isa-afp.org/entries/Neumann_Morgenstern_Utility.html Julian Parsert, Cezary Kaliszyk 04 Jul 2018 00:00:00 +0000 Utility functions form an essential part of game theory and economics. In order to guarantee the existence of utility functions most of the time sufficient properties are assumed in an axiomatic manner. One famous and very common set of such assumptions is that of expected utility theory. Here, the rationality, continuity, and independence of preferences is assumed. The von-Neumann-Morgenstern Utility theorem shows that these assumptions are necessary and sufficient for an expected utility function to exists. This theorem was proven by Neumann and Morgenstern in ``Theory of Games and Economic Behavior'' which is regarded as one of the most influential works in game theory. The formalization includes formal definitions of the underlying concepts including continuity and independence of preferences. Pell's Equation https://www.isa-afp.org/entries/Pell.html https://www.isa-afp.org/entries/Pell.html Manuel Eberl 23 Jun 2018 00:00:00 +0000 <p> This article gives the basic theory of Pell's equation <em>x</em><sup>2</sup> = 1 + <em>D</em>&thinsp;<em>y</em><sup>2</sup>, where <em>D</em>&thinsp;&isin;&thinsp;&#8469; is a parameter and <em>x</em>, <em>y</em> are integer variables. </p> <p> The main result that is proven is the following: If <em>D</em> is not a perfect square, then there exists a <em>fundamental solution</em> (<em>x</em><sub>0</sub>, <em>y</em><sub>0</sub>) that is not the trivial solution (1, 0) and which generates all other solutions (<em>x</em>, <em>y</em>) in the sense that there exists some <em>n</em>&thinsp;&isin;&thinsp;&#8469; such that |<em>x</em>| + |<em>y</em>|&thinsp;&radic;<span style="text-decoration: overline"><em>D</em></span> = (<em>x</em><sub>0</sub> + <em>y</em><sub>0</sub>&thinsp;&radic;<span style="text-decoration: overline"><em>D</em></span>)<sup><em>n</em></sup>. This also implies that the set of solutions is infinite, and it gives us an explicit and executable characterisation of all the solutions. </p> <p> Based on this, simple executable algorithms for computing the fundamental solution and the infinite sequence of all non-negative solutions are also provided. </p> Projective Geometry https://www.isa-afp.org/entries/Projective_Geometry.html https://www.isa-afp.org/entries/Projective_Geometry.html Anthony Bordg 14 Jun 2018 00:00:00 +0000 We formalize the basics of projective geometry. In particular, we give a proof of the so-called Hessenberg's theorem in projective plane geometry. We also provide a proof of the so-called Desargues's theorem based on an axiomatization of (higher) projective space geometry using the notion of rank of a matroid. This last approach allows to handle incidence relations in an homogeneous way dealing only with points and without the need of talking explicitly about lines, planes or any higher entity. The Localization of a Commutative Ring https://www.isa-afp.org/entries/Localization_Ring.html https://www.isa-afp.org/entries/Localization_Ring.html Anthony Bordg 14 Jun 2018 00:00:00 +0000 We formalize the localization of a commutative ring R with respect to a multiplicative subset (i.e. a submonoid of R seen as a multiplicative monoid). This localization is itself a commutative ring and we build the natural homomorphism of rings from R to its localization. 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.