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. 06 Apr 2017 00:00:00 +0000 Subresultants https://www.isa-afp.org/entries/Subresultants.shtml https://www.isa-afp.org/entries/Subresultants.shtml Sebastiaan Joosten, René Thiemann, Akihisa Yamada 06 Apr 2017 00:00:00 +0000 We formalize the theory of subresultants and the subresultant polynomial remainder sequence as described by Brown and Traub. As a result, we obtain efficient certified algorithms for computing the resultant and the greatest common divisor of polynomials. Expected Shape of Random Binary Search Trees https://www.isa-afp.org/entries/Random_BSTs.shtml https://www.isa-afp.org/entries/Random_BSTs.shtml Manuel Eberl 04 Apr 2017 00:00:00 +0000 <p>This entry contains proofs for the textbook results about the distributions of the height and internal path length of random binary search trees (BSTs), i.&thinsp;e. BSTs that are formed by taking an empty BST and inserting elements from a fixed set in random order.</p> <p>In particular, we prove a logarithmic upper bound on the expected height and the <em>Θ(n log n)</em> closed-form solution for the expected internal path length in terms of the harmonic numbers. We also show how the internal path length relates to the average-case cost of a lookup in a BST.</p> The number of comparisons in QuickSort https://www.isa-afp.org/entries/Quick_Sort_Cost.shtml https://www.isa-afp.org/entries/Quick_Sort_Cost.shtml Manuel Eberl 15 Mar 2017 00:00:00 +0000 <p>We give a formal proof of the well-known results about the number of comparisons performed by two variants of QuickSort: first, the expected number of comparisons of randomised QuickSort (i.&thinsp;e.&nbsp;QuickSort with random pivot choice) is <em>2&thinsp;(n+1)&thinsp;H<sub>n</sub> - 4&thinsp;n</em>, which is asymptotically equivalent to <em>2&thinsp;n ln n</em>; second, the number of comparisons performed by the classic non-randomised QuickSort has the same distribution in the average case as the randomised one.</p> Lower bound on comparison-based sorting algorithms https://www.isa-afp.org/entries/Comparison_Sort_Lower_Bound.shtml https://www.isa-afp.org/entries/Comparison_Sort_Lower_Bound.shtml Manuel Eberl 15 Mar 2017 00:00:00 +0000 <p>This article contains a formal proof of the well-known fact that number of comparisons that a comparison-based sorting algorithm needs to perform to sort a list of length <em>n</em> is at least <em>log<sub>2</sub>&nbsp;(n!)</em> in the worst case, i.&thinsp;e.&nbsp;<em>Ω(n log n)</em>.</p> <p>For this purpose, a shallow embedding for comparison-based sorting algorithms is defined: a sorting algorithm is a recursive datatype containing either a HOL function or a query of a comparison oracle with a continuation containing the remaining computation. This makes it possible to force the algorithm to use only comparisons and to track the number of comparisons made.</p> The Euler–MacLaurin Formula https://www.isa-afp.org/entries/Euler_MacLaurin.shtml https://www.isa-afp.org/entries/Euler_MacLaurin.shtml Manuel Eberl 10 Mar 2017 00:00:00 +0000 <p>The Euler-MacLaurin formula relates the value of a discrete sum to that of the corresponding integral in terms of the derivatives at the borders of the summation and a remainder term. Since the remainder term is often very small as the summation bounds grow, this can be used to compute asymptotic expansions for sums.</p> <p>This entry contains a proof of this formula for functions from the reals to an arbitrary Banach space. Two variants of the formula are given: the standard textbook version and a variant outlined in <em>Concrete Mathematics</em> that is more useful for deriving asymptotic estimates.</p> <p>As example applications, we use that formula to derive the full asymptotic expansion of the harmonic numbers and the sum of inverse squares.</p> The Group Law for Elliptic Curves https://www.isa-afp.org/entries/Elliptic_Curves_Group_Law.shtml https://www.isa-afp.org/entries/Elliptic_Curves_Group_Law.shtml Stefan Berghofer 28 Feb 2017 00:00:00 +0000 We prove the group law for elliptic curves in Weierstrass form over fields of characteristic greater than 2. In addition to affine coordinates, we also formalize projective coordinates, which allow for more efficient computations. By specializing the abstract formalization to prime fields, we can apply the curve operations to parameters used in standard security protocols. Menger's Theorem https://www.isa-afp.org/entries/Menger.shtml https://www.isa-afp.org/entries/Menger.shtml Christoph Dittmann 26 Feb 2017 00:00:00 +0000 We present a formalization of Menger's Theorem for directed and undirected graphs in Isabelle/HOL. This well-known result shows that if two non-adjacent distinct vertices u, v in a directed graph have no separator smaller than n, then there exist n internally vertex-disjoint paths from u to v. The version for undirected graphs follows immediately because undirected graphs are a special case of directed graphs. Differential Dynamic Logic https://www.isa-afp.org/entries/Differential_Dynamic_Logic.shtml https://www.isa-afp.org/entries/Differential_Dynamic_Logic.shtml Brandon Bohrer 13 Feb 2017 00:00:00 +0000 We formalize differential dynamic logic, a logic for proving properties of hybrid systems. The proof calculus in this formalization is based on the uniform substitution principle. We show it is sound with respect to our denotational semantics, which provides increased confidence in the correctness of the KeYmaera X theorem prover based on this calculus. As an application, we include a proof term checker embedded in Isabelle/HOL with several example proofs. Published in: Brandon Bohrer, Vincent Rahli, Ivana Vukotic, Marcus Völp, André Platzer: Formally verified differential dynamic logic. CPP 2017. Abstract Soundness https://www.isa-afp.org/entries/Abstract_Soundness.shtml https://www.isa-afp.org/entries/Abstract_Soundness.shtml Jasmin Christian Blanchette, Andrei Popescu, Dmitriy Traytel 10 Feb 2017 00:00:00 +0000 A formalized coinductive account of the abstract development of Brotherston, Gorogiannis, and Petersen [APLAS 2012], in a slightly more general form since we work with arbitrary infinite proofs, which may be acyclic. This work is described in detail in an article by the authors, published in 2017 in the <em>Journal of Automated Reasoning</em>. The abstract proof can be instantiated for various formalisms, including first-order logic with inductive predicates. Stone Relation Algebras https://www.isa-afp.org/entries/Stone_Relation_Algebras.shtml https://www.isa-afp.org/entries/Stone_Relation_Algebras.shtml Walter Guttmann 07 Feb 2017 00:00:00 +0000 We develop Stone relation algebras, which generalise relation algebras by replacing the underlying Boolean algebra structure with a Stone algebra. We show that finite matrices over extended real numbers form an instance. As a consequence, relation-algebraic concepts and methods can be used for reasoning about weighted graphs. We also develop a fixpoint calculus and apply it to compare different definitions of reflexive-transitive closures in semirings. Refining Authenticated Key Agreement with Strong Adversaries https://www.isa-afp.org/entries/Key_Agreement_Strong_Adversaries.shtml https://www.isa-afp.org/entries/Key_Agreement_Strong_Adversaries.shtml Joseph Lallemand, Christoph Sprenger 31 Jan 2017 00:00:00 +0000 We develop a family of key agreement protocols that are correct by construction. Our work substantially extends prior work on developing security protocols by refinement. First, we strengthen the adversary by allowing him to compromise different resources of protocol participants, such as their long-term keys or their session keys. This enables the systematic development of protocols that ensure strong properties such as perfect forward secrecy. Second, we broaden the class of protocols supported to include those with non-atomic keys and equationally defined cryptographic operators. We use these extensions to develop key agreement protocols including signed Diffie-Hellman and the core of IKEv1 and SKEME. Bernoulli Numbers https://www.isa-afp.org/entries/Bernoulli.shtml https://www.isa-afp.org/entries/Bernoulli.shtml Lukas Bulwahn, Manuel Eberl 24 Jan 2017 00:00:00 +0000 <p>Bernoulli numbers were first discovered in the closed-form expansion of the sum 1<sup>m</sup> + 2<sup>m</sup> + &hellip; + n<sup>m</sup> for a fixed m and appear in many other places. This entry provides three different definitions for them: a recursive one, an explicit one, and one through their exponential generating function.</p> <p>In addition, we prove some basic facts, e.g. their relation to sums of powers of integers and that all odd Bernoulli numbers except the first are zero. We also prove the correctness of the Akiyama&ndash;Tanigawa algorithm for computing Bernoulli numbers with reasonable efficiency, and we define the periodic Bernoulli polynomials (which appear e.g. in the Euler&ndash;MacLaurin summation formula and the expansion of the log-Gamma function) and prove their basic properties.</p> Minimal Static Single Assignment Form https://www.isa-afp.org/entries/Minimal_SSA.shtml https://www.isa-afp.org/entries/Minimal_SSA.shtml Max Wagner, Denis Lohner 17 Jan 2017 00:00:00 +0000 <p>This formalization is an extension to <a href="https://www.isa-afp.org/entries/Formal_SSA.shtml">"Verified Construction of Static Single Assignment Form"</a>. In their work, the authors have shown that <a href="http://dx.doi.org/10.1007/978-3-642-37051-9_6">Braun et al.'s static single assignment (SSA) construction algorithm</a> produces minimal SSA form for input programs with a reducible control flow graph (CFG). However Braun et al. also proposed an extension to their algorithm that they claim produces minimal SSA form even for irreducible CFGs.<br> In this formalization we support that claim by giving a mechanized proof. </p> <p>As the extension of Braun et al.'s algorithm aims for removing so-called redundant strongly connected components of phi functions, we show that this suffices to guarantee minimality according to <a href="http://dx.doi.org/10.1145/115372.115320">Cytron et al.</a>.</p> Bertrand's postulate https://www.isa-afp.org/entries/Bertrands_Postulate.shtml https://www.isa-afp.org/entries/Bertrands_Postulate.shtml Julian Biendarra, Manuel Eberl 17 Jan 2017 00:00:00 +0000 <p>Bertrand's postulate is an early result on the distribution of prime numbers: For every positive integer n, there exists a prime number that lies strictly between n and 2n. The proof is ported from John Harrison's formalisation in HOL Light. It proceeds by first showing that the property is true for all n greater than or equal to 600 and then showing that it also holds for all n below 600 by case distinction. </p> The Transcendence of e https://www.isa-afp.org/entries/E_Transcendental.shtml https://www.isa-afp.org/entries/E_Transcendental.shtml Manuel Eberl 12 Jan 2017 00:00:00 +0000 <p>This work contains a proof that Euler's number e is transcendental. The proof follows the standard approach of assuming that e is algebraic and then using a specific integer polynomial to derive two inconsistent bounds, leading to a contradiction.</p> <p>This kind of approach can be found in many different sources; this formalisation mostly follows a <a href="http://planetmath.org/proofoflindemannweierstrasstheoremandthateandpiaretranscendental">PlanetMath article</a> by Roger Lipsett.</p> Formal Network Models and Their Application to Firewall Policies https://www.isa-afp.org/entries/UPF_Firewall.shtml https://www.isa-afp.org/entries/UPF_Firewall.shtml Achim D. Brucker, Lukas Brügger, Burkhart Wolff 08 Jan 2017 00:00:00 +0000 We present a formal model of network protocols and their application to modeling firewall policies. The formalization is based on the Unified Policy Framework (UPF). The formalization was originally developed with for generating test cases for testing the security configuration actual firewall and router (middle-boxes) using HOL-TestGen. Our work focuses on modeling application level protocols on top of tcp/ip. Verification of a Diffie-Hellman Password-based Authentication Protocol by Extending the Inductive Method https://www.isa-afp.org/entries/Password_Authentication_Protocol.shtml https://www.isa-afp.org/entries/Password_Authentication_Protocol.shtml Pasquale Noce 03 Jan 2017 00:00:00 +0000 This paper constructs a formal model of a Diffie-Hellman password-based authentication protocol between a user and a smart card, and proves its security. The protocol provides for the dispatch of the user's password to the smart card on a secure messaging channel established by means of Password Authenticated Connection Establishment (PACE), where the mapping method being used is Chip Authentication Mapping. By applying and suitably extending Paulson's Inductive Method, this paper proves that the protocol establishes trustworthy secure messaging channels, preserves the secrecy of users' passwords, and provides an effective mutual authentication service. What is more, these security properties turn out to hold independently of the secrecy of the PACE authentication key. First-Order Logic According to Harrison https://www.isa-afp.org/entries/FOL_Harrison.shtml https://www.isa-afp.org/entries/FOL_Harrison.shtml Alexander Birch Jensen, Anders Schlichtkrull, Jørgen Villadsen 01 Jan 2017 00:00:00 +0000 We present a certified declarative first-order prover with equality based on John Harrison's Handbook of Practical Logic and Automated Reasoning, Cambridge University Press, 2009. ML code reflection is used such that the entire prover can be executed within Isabelle as a very simple interactive proof assistant. As examples we consider Pelletier's problems 1-46. Concurrent Refinement Algebra and Rely Quotients https://www.isa-afp.org/entries/Concurrent_Ref_Alg.shtml https://www.isa-afp.org/entries/Concurrent_Ref_Alg.shtml Julian Fell, Ian Hayes, Andrius Velykis 30 Dec 2016 00:00:00 +0000 The concurrent refinement algebra developed here is designed to provide a foundation for rely/guarantee reasoning about concurrent programs. The algebra builds on a complete lattice of commands by providing sequential composition, parallel composition and a novel weak conjunction operator. The weak conjunction operator coincides with the lattice supremum providing its arguments are non-aborting, but aborts if either of its arguments do. Weak conjunction provides an abstract version of a guarantee condition as a guarantee process. We distinguish between models that distribute sequential composition over non-deterministic choice from the left (referred to as being conjunctive in the refinement calculus literature) and those that don't. Least and greatest fixed points of monotone functions are provided to allow recursion and iteration operators to be added to the language. Additional iteration laws are available for conjunctive models. The rely quotient of processes <i>c</i> and <i>i</i> is the process that, if executed in parallel with <i>i</i> implements <i>c</i>. It represents an abstract version of a rely condition generalised to a process. The Twelvefold Way https://www.isa-afp.org/entries/Twelvefold_Way.shtml https://www.isa-afp.org/entries/Twelvefold_Way.shtml Lukas Bulwahn 29 Dec 2016 00:00:00 +0000 This entry provides all cardinality theorems of the Twelvefold Way. The Twelvefold Way systematically classifies twelve related combinatorial problems concerning two finite sets, which include counting permutations, combinations, multisets, set partitions and number partitions. This development builds upon the existing formal developments with cardinality theorems for those structures. It provides twelve bijections from the various structures to different equivalence classes on finite functions, and hence, proves cardinality formulae for these equivalence classes on finite functions. Proof Strategy Language https://www.isa-afp.org/entries/Proof_Strategy_Language.shtml https://www.isa-afp.org/entries/Proof_Strategy_Language.shtml Yutaka Nagashima 20 Dec 2016 00:00:00 +0000 Isabelle includes various automatic tools for finding proofs under certain conditions. However, for each conjecture, knowing which automation to use, and how to tweak its parameters, is currently labour intensive. We have developed a language, PSL, designed to capture high level proof strategies. PSL offloads the construction of human-readable fast-to-replay proof scripts to automatic search, making use of search-time information about each conjecture. Our preliminary evaluations show that PSL reduces the labour cost of interactive theorem proving. This submission contains the implementation of PSL and an example theory file, Example.thy, showing how to write poof strategies in PSL. Paraconsistency https://www.isa-afp.org/entries/Paraconsistency.shtml https://www.isa-afp.org/entries/Paraconsistency.shtml Anders Schlichtkrull, Jørgen Villadsen 07 Dec 2016 00:00:00 +0000 Paraconsistency is about handling inconsistency in a coherent way. In classical and intuitionistic logic everything follows from an inconsistent theory. A paraconsistent logic avoids the explosion. Quite a few applications in computer science and engineering are discussed in the Intelligent Systems Reference Library Volume 110: Towards Paraconsistent Engineering (Springer 2016). We formalize a paraconsistent many-valued logic that we motivated and described in a special issue on logical approaches to paraconsistency (Journal of Applied Non-Classical Logics 2005). We limit ourselves to the propositional fragment of the higher-order logic. The logic is based on so-called key equalities and has a countably infinite number of truth values. We prove theorems in the logic using the definition of validity. We verify truth tables and also counterexamples for non-theorems. We prove meta-theorems about the logic and finally we investigate a case study. COMPLX: A Verification Framework for Concurrent Imperative Programs https://www.isa-afp.org/entries/Complx.shtml https://www.isa-afp.org/entries/Complx.shtml Sidney Amani, June Andronick, Maksym Bortin, Corey Lewis, Christine Rizkallah, Joseph Tuong 29 Nov 2016 00:00:00 +0000 We propose a concurrency reasoning framework for imperative programs, based on the Owicki-Gries (OG) foundational shared-variable concurrency method. Our framework combines the approaches of Hoare-Parallel, a formalisation of OG in Isabelle/HOL for a simple while-language, and Simpl, a generic imperative language embedded in Isabelle/HOL, allowing formal reasoning on C programs. We define the Complx language, extending the syntax and semantics of Simpl with support for parallel composition and synchronisation. We additionally define an OG logic, which we prove sound w.r.t. the semantics, and a verification condition generator, both supporting involved low-level imperative constructs such as function calls and abrupt termination. We illustrate our framework on an example that features exceptions, guards and function calls. We aim to then target concurrent operating systems, such as the interruptible eChronos embedded operating system for which we already have a model-level OG proof using Hoare-Parallel. Abstract Interpretation of Annotated Commands https://www.isa-afp.org/entries/Abs_Int_ITP2012.shtml https://www.isa-afp.org/entries/Abs_Int_ITP2012.shtml Tobias Nipkow 23 Nov 2016 00:00:00 +0000 This is the Isabelle formalization of the material decribed in the eponymous <a href="http://dx.doi.org/10.1007/978-3-642-32347-8_9">ITP 2012 paper</a>. It develops a generic abstract interpreter for a while-language, including widening and narrowing. The collecting semantics and the abstract interpreter operate on annotated commands: the program is represented as a syntax tree with the semantic information directly embedded, without auxiliary labels. The aim of the formalization is simplicity, not efficiency or precision. This is motivated by the inclusion of the material in a theorem prover based course on semantics. A similar (but more polished) development is covered in the book <a href="http://dx.doi.org/10.1007/978-3-319-10542-0">Concrete Semantics</a>. Separata: Isabelle tactics for Separation Algebra https://www.isa-afp.org/entries/Separata.shtml https://www.isa-afp.org/entries/Separata.shtml Zhe Hou, David Sanan, Alwen Tiu, Rajeev Gore, Ranald Clouston 16 Nov 2016 00:00:00 +0000 We bring the labelled sequent calculus $LS_{PASL}$ for propositional abstract separation logic to Isabelle. The tactics given here are directly applied on an extension of the Separation Algebra in the AFP. In addition to the cancellative separation algebra, we further consider some useful properties in the heap model of separation logic, such as indivisible unit, disjointness, and cross-split. The tactics are essentially a proof search procedure for the calculus $LS_{PASL}$. We wrap the tactics in an Isabelle method called separata, and give a few examples of separation logic formulae which are provable by separata. Formalization of Nested Multisets, Hereditary Multisets, and Syntactic Ordinals https://www.isa-afp.org/entries/Nested_Multisets_Ordinals.shtml https://www.isa-afp.org/entries/Nested_Multisets_Ordinals.shtml Jasmin Christian Blanchette, Mathias Fleury, Dmitriy Traytel 12 Nov 2016 00:00:00 +0000 This Isabelle/HOL formalization introduces a nested multiset datatype and defines Dershowitz and Manna's nested multiset order. The order is proved well founded and linear. By removing one constructor, we transform the nested multisets into hereditary multisets. These are isomorphic to the syntactic ordinals—the ordinals can be recursively expressed in Cantor normal form. Addition, subtraction, multiplication, and linear orders are provided on this type. Formalization of Knuth–Bendix Orders for Lambda-Free Higher-Order Terms https://www.isa-afp.org/entries/Lambda_Free_KBOs.shtml https://www.isa-afp.org/entries/Lambda_Free_KBOs.shtml Heiko Becker, Jasmin Christian Blanchette, Uwe Waldmann, Daniel Wand 12 Nov 2016 00:00:00 +0000 This Isabelle/HOL formalization defines Knuth–Bendix orders for higher-order terms without lambda-abstraction and proves many useful properties about them. The main order fully coincides with the standard transfinite KBO with subterm coefficients on first-order terms. It appears promising as the basis of a higher-order superposition calculus. Expressiveness of Deep Learning https://www.isa-afp.org/entries/Deep_Learning.shtml https://www.isa-afp.org/entries/Deep_Learning.shtml Alexander Bentkamp 10 Nov 2016 00:00:00 +0000 Deep learning has had a profound impact on computer science in recent years, with applications to search engines, image recognition and language processing, bioinformatics, and more. Recently, Cohen et al. provided theoretical evidence for the superiority of deep learning over shallow learning. This formalization of their work simplifies and generalizes the original proof, while working around the limitations of the Isabelle type system. To support the formalization, I developed reusable libraries of formalized mathematics, including results about the matrix rank, the Lebesgue measure, and multivariate polynomials, as well as a library for tensor analysis. Modal Logics for Nominal Transition Systems https://www.isa-afp.org/entries/Modal_Logics_for_NTS.shtml https://www.isa-afp.org/entries/Modal_Logics_for_NTS.shtml Tjark Weber, Lars-Henrik Eriksson, Joachim Parrow, Johannes Borgström, Ramunas Gutkovas 25 Oct 2016 00:00:00 +0000 We formalize a uniform semantic substrate for a wide variety of process calculi where states and action labels can be from arbitrary nominal sets. A Hennessy-Milner logic for these systems is defined, and proved adequate for bisimulation equivalence. A main novelty is the construction of an infinitary nominal data type to model formulas with (finitely supported) infinite conjunctions and actions that may contain binding names. The logic is generalized to treat different bisimulation variants such as early, late and open in a systematic way. Stable Matching https://www.isa-afp.org/entries/Stable_Matching.shtml https://www.isa-afp.org/entries/Stable_Matching.shtml Peter Gammie 24 Oct 2016 00:00:00 +0000 We mechanize proofs of several results from the matching with contracts literature, which generalize those of the classical two-sided matching scenarios that go by the name of stable marriage. Our focus is on game theoretic issues. Along the way we develop executable algorithms for computing optimal stable matches.