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. 26 Oct 2017 00:00:00 +0000 The Kuratowski Closure-Complement Theorem https://www.isa-afp.org/entries/Kuratowski_Closure_Complement.html https://www.isa-afp.org/entries/Kuratowski_Closure_Complement.html Peter Gammie, Gianpaolo Gioiosa 26 Oct 2017 00:00:00 +0000 We discuss a topological curiosity discovered by Kuratowski (1922): the fact that the number of distinct operators on a topological space generated by compositions of closure and complement never exceeds 14, and is exactly 14 in the case of R. In addition, we prove a theorem due to Chagrov (1982) that classifies topological spaces according to the number of such operators they support. Transition Systems and Automata https://www.isa-afp.org/entries/Transition_Systems_and_Automata.html https://www.isa-afp.org/entries/Transition_Systems_and_Automata.html Julian Brunner 19 Oct 2017 00:00:00 +0000 This entry provides a very abstract theory of transition systems that can be instantiated to express various types of automata. A transition system is typically instantiated by providing a set of initial states, a predicate for enabled transitions, and a transition execution function. From this, it defines the concepts of finite and infinite paths as well as the set of reachable states, among other things. Many useful theorems, from basic path manipulation rules to coinduction and run construction rules, are proven in this abstract transition system context. The library comes with instantiations for DFAs, NFAs, and Büchi automata. Büchi Complementation https://www.isa-afp.org/entries/Buchi_Complementation.html https://www.isa-afp.org/entries/Buchi_Complementation.html Julian Brunner 19 Oct 2017 00:00:00 +0000 This entry provides a verified implementation of rank-based Büchi Complementation. The verification is done in three steps: <ol> <li>Definition of odd rankings and proof that an automaton rejects a word iff there exists an odd ranking for it.</li> <li>Definition of the complement automaton and proof that it accepts exactly those words for which there is an odd ranking.</li> <li>Verified implementation of the complement automaton using the Isabelle Collections Framework.</li> </ol> Evaluate winding numbers through Cauchy indices https://www.isa-afp.org/entries/Winding_Number_Eval.html https://www.isa-afp.org/entries/Winding_Number_Eval.html Wenda Li 17 Oct 2017 00:00:00 +0000 In complex analysis, the winding number measures the number of times a path (counterclockwise) winds around a point, while the Cauchy index can approximate how the path winds. This entry provides a formalisation of the Cauchy index, which is then shown to be related to the winding number. In addition, this entry also offers a tactic that enables users to evaluate the winding number by calculating Cauchy indices. Count the Number of Complex Roots https://www.isa-afp.org/entries/Count_Complex_Roots.html https://www.isa-afp.org/entries/Count_Complex_Roots.html Wenda Li 17 Oct 2017 00:00:00 +0000 Based on evaluating Cauchy indices through remainder sequences, this entry provides an effective procedure to count the number of complex roots (with multiplicity) of a polynomial within a rectangle box or a half-plane. Potential applications of this entry include certified complex root isolation (of a polynomial) and testing the Routh-Hurwitz stability criterion (i.e., to check whether all the roots of some characteristic polynomial have negative real parts). Homogeneous Linear Diophantine Equations https://www.isa-afp.org/entries/Diophantine_Eqns_Lin_Hom.html https://www.isa-afp.org/entries/Diophantine_Eqns_Lin_Hom.html Florian Messner, Julian Parsert, Jonas Schöpf, Christian Sternagel 14 Oct 2017 00:00:00 +0000 We formalize the theory of homogeneous linear diophantine equations, focusing on two main results: (1) an abstract characterization of minimal complete sets of solutions, and (2) an algorithm computing them. Both, the characterization and the algorithm are based on previous work by Huet. Our starting point is a simple but inefficient variant of Huet's lexicographic algorithm incorporating improved bounds due to Clausen and Fortenbacher. We proceed by proving its soundness and completeness. Finally, we employ code equations to obtain a reasonably efficient implementation. Thus, we provide a formally verified solver for homogeneous linear diophantine equations. The Hurwitz and Riemann ζ Functions https://www.isa-afp.org/entries/Zeta_Function.html https://www.isa-afp.org/entries/Zeta_Function.html Manuel Eberl 12 Oct 2017 00:00:00 +0000 <p> This entry builds upon the results about formal and analytic Dirichlet series to define the Hurwitz &zeta; function and, based on that, the Riemann &zeta; function. This is done by first defining them for &real;(<i>z</i>) > 1 and then successively extending the domain to the left using the Euler&ndash;MacLaurin formula. </p> <p> Some basic results about these functions are also shown, such as their analyticity on &#8450;&#8726;&#123;1&#125;, that they have a simple pole with residue 1 at 1, their relation to the &Gamma; function, and the special values at negative integers and positive even integers &ndash; including the famous &zeta;(-1) = -1/12 and &zeta;(2) = &pi;&sup2;/6. </p> <p> Lastly, the entry also contains Euler's analytic proof of the infinitude of primes, based on the fact that &zeta;(<i>s</i>) has a pole at <i>s</i> = 1. </p> Linear Recurrences https://www.isa-afp.org/entries/Linear_Recurrences.html https://www.isa-afp.org/entries/Linear_Recurrences.html Manuel Eberl 12 Oct 2017 00:00:00 +0000 <p> Linear recurrences with constant coefficients are an interesting class of recurrence equations that can be solved explicitly. The most famous example are certainly the Fibonacci numbers with the equation <i>f</i>(<i>n</i>) = <i>f</i>(<i>n</i>-1) + <i>f</i>(<i>n</i> - 2) and the quite non-obvious closed form (<i>&phi;</i><sup><i>n</i></sup> - (-<i>&phi;</i>)<sup>-<i>n</i></sup>) / &radic;<span style="text-decoration: overline">5</span> where &phi; is the golden ratio. </p> <p> In this work, I build on existing tools in Isabelle &ndash; such as formal power series and polynomial factorisation algorithms &ndash; to develop a theory of these recurrences and derive a fully executable solver for them that can be exported to programming languages like Haskell. </p> Dirichlet Series https://www.isa-afp.org/entries/Dirichlet_Series.html https://www.isa-afp.org/entries/Dirichlet_Series.html Manuel Eberl 12 Oct 2017 00:00:00 +0000 This entry is a formalisation of much of Chapters 2, 3, and 11 of Apostol's &ldquo;Introduction to Analytic Number Theory&rdquo;. This includes: <ul> <li>Definitions and basic properties for several number-theoretic functions (Euler's &phi;, M&ouml;bius &mu;, Liouville's &lambda;, the divisor function &sigma;, von Mangoldt's &Lambda;)</li> <li>Executable code for most of these functions, the most efficient implementations using the factoring algorithm by Thiemann <i>et al.</i></li> <li>Dirichlet products and formal Dirichlet series</li> <li>Analytic results connecting convergent formal Dirichlet series to complex functions</li> <li>Euler product expansions</li> <li>Asymptotic estimates of number-theoretic functions including the density of squarefree integers and the average number of divisors of a natural number</li> </ul> These results are useful as a basis for developing more number-theoretic results, such as the Prime Number Theorem. Computer-assisted Reconstruction and Assessment of E. J. Lowe's Modal Ontological Argument https://www.isa-afp.org/entries/Lowe_Ontological_Argument.html https://www.isa-afp.org/entries/Lowe_Ontological_Argument.html David Fuenmayor, Christoph Benzmüller 21 Sep 2017 00:00:00 +0000 Computers may help us to understand --not just verify-- philosophical arguments. By utilizing modern proof assistants in an iterative interpretive process, we can reconstruct and assess an argument by fully formal means. Through the mechanization of a variant of St. Anselm's ontological argument by E. J. Lowe, which is a paradigmatic example of a natural-language argument with strong ties to metaphysics and religion, we offer an ideal showcase for our computer-assisted interpretive method. Representation and Partial Automation of the Principia Logico-Metaphysica in Isabelle/HOL https://www.isa-afp.org/entries/PLM.html https://www.isa-afp.org/entries/PLM.html Daniel Kirchner 17 Sep 2017 00:00:00 +0000 <p> We present an embedding of the second-order fragment of the Theory of Abstract Objects as described in Edward Zalta's upcoming work <a href="https://mally.stanford.edu/principia.pdf">Principia Logico-Metaphysica (PLM)</a> in the automated reasoning framework Isabelle/HOL. The Theory of Abstract Objects is a metaphysical theory that reifies property patterns, as they for example occur in the abstract reasoning of mathematics, as <b>abstract objects</b> and provides an axiomatic framework that allows to reason about these objects. It thereby serves as a fundamental metaphysical theory that can be used to axiomatize and describe a wide range of philosophical objects, such as Platonic forms or Leibniz' concepts, and has the ambition to function as a foundational theory of mathematics. The target theory of our embedding as described in chapters 7-9 of PLM employs a modal relational type theory as logical foundation for which a representation in functional type theory is <a href="https://mally.stanford.edu/Papers/rtt.pdf">known to be challenging</a>. </p> <p> Nevertheless we arrive at a functioning representation of the theory in the functional logic of Isabelle/HOL based on a semantical representation of an Aczel-model of the theory. Based on this representation we construct an implementation of the deductive system of PLM which allows to automatically and interactively find and verify theorems of PLM. </p> <p> Our work thereby supports the concept of shallow semantical embeddings of logical systems in HOL as a universal tool for logical reasoning <a href="http://www.mi.fu-berlin.de/inf/groups/ag-ki/publications/Universal-Reasoning/1703_09620_pd.pdf">as promoted by Christoph Benzm&uuml;ller</a>. </p> <p> The most notable result of the presented work is the discovery of a previously unknown paradox in the formulation of the Theory of Abstract Objects. The embedding of the theory in Isabelle/HOL played a vital part in this discovery. Furthermore it was possible to immediately offer several options to modify the theory to guarantee its consistency. Thereby our work could provide a significant contribution to the development of a proper grounding for object theory. </p> Anselm's God in Isabelle/HOL https://www.isa-afp.org/entries/AnselmGod.html https://www.isa-afp.org/entries/AnselmGod.html Ben Blumson 06 Sep 2017 00:00:00 +0000 Paul Oppenheimer and Edward Zalta's formalisation of Anselm's ontological argument for the existence of God is automated by embedding a free logic for definite descriptions within Isabelle/HOL. Microeconomics and the First Welfare Theorem https://www.isa-afp.org/entries/First_Welfare_Theorem.html https://www.isa-afp.org/entries/First_Welfare_Theorem.html Julian Parsert, Cezary Kaliszyk 01 Sep 2017 00:00:00 +0000 Economic activity has always been a fundamental part of society. Due to modern day politics, economic theory has gained even more influence on our lives. Thus we want models and theories to be as precise as possible. This can be achieved using certification with the help of formal proof technology. Hence we will use Isabelle/HOL to construct two economic models, that of the the pure exchange economy and a version of the Arrow-Debreu Model. We will prove that the <i>First Theorem of Welfare Economics</i> holds within both. The theorem is the mathematical formulation of Adam Smith's famous <i>invisible hand</i> and states that a group of self-interested and rational actors will eventually achieve an efficient allocation of goods and services. Root-Balanced Tree https://www.isa-afp.org/entries/Root_Balanced_Tree.html https://www.isa-afp.org/entries/Root_Balanced_Tree.html Tobias Nipkow 20 Aug 2017 00:00:00 +0000 <p> Andersson introduced <em>general balanced trees</em>, search trees based on the design principle of partial rebuilding: perform update operations naively until the tree becomes too unbalanced, at which point a whole subtree is rebalanced. This article defines and analyzes a functional version of general balanced trees, which we call <em>root-balanced trees</em>. Using a lightweight model of execution time, amortized logarithmic complexity is verified in the theorem prover Isabelle. </p> <p> This is the Isabelle formalization of the material decribed in the APLAS 2017 article <a href="http://www.in.tum.de/~nipkow/pubs/aplas17.html">Verified Root-Balanced Trees</a> by the same author, which also presents experimental results that show competitiveness of root-balanced with AVL and red-black trees. </p> Orbit-Stabiliser Theorem with Application to Rotational Symmetries https://www.isa-afp.org/entries/Orbit_Stabiliser.html https://www.isa-afp.org/entries/Orbit_Stabiliser.html Jonas Rädle 20 Aug 2017 00:00:00 +0000 The Orbit-Stabiliser theorem is a basic result in the algebra of groups that factors the order of a group into the sizes of its orbits and stabilisers. We formalize the notion of a group action and the related concepts of orbits and stabilisers. This allows us to prove the orbit-stabiliser theorem. In the second part of this work, we formalize the tetrahedral group and use the orbit-stabiliser theorem to prove that there are twelve (orientation-preserving) rotations of the tetrahedron. The LambdaMu-calculus https://www.isa-afp.org/entries/LambdaMu.html https://www.isa-afp.org/entries/LambdaMu.html Cristina Matache, Victor B. F. Gomes, Dominic P. Mulligan 16 Aug 2017 00:00:00 +0000 The propositions-as-types correspondence is ordinarily presented as linking the metatheory of typed λ-calculi and the proof theory of intuitionistic logic. Griffin observed that this correspondence could be extended to classical logic through the use of control operators. This observation set off a flurry of further research, leading to the development of Parigots λμ-calculus. In this work, we formalise λμ- calculus in Isabelle/HOL and prove several metatheoretical properties such as type preservation and progress. Stewart's Theorem and Apollonius' Theorem https://www.isa-afp.org/entries/Stewart_Apollonius.html https://www.isa-afp.org/entries/Stewart_Apollonius.html Lukas Bulwahn 31 Jul 2017 00:00:00 +0000 This entry formalizes the two geometric theorems, Stewart's and Apollonius' theorem. Stewart's Theorem relates the length of a triangle's cevian to the lengths of the triangle's two sides. Apollonius' Theorem is a specialisation of Stewart's theorem, restricting the cevian to be the median. The proof applies the law of cosines, some basic geometric facts about triangles and then simply transforms the terms algebraically to yield the conjectured relation. The formalization in Isabelle can closely follow the informal proofs described in the Wikipedia articles of those two theorems. Dynamic Architectures https://www.isa-afp.org/entries/DynamicArchitectures.html https://www.isa-afp.org/entries/DynamicArchitectures.html Diego Marmsoler 28 Jul 2017 00:00:00 +0000 The architecture of a system describes the system's overall organization into components and connections between those components. With the emergence of mobile computing, dynamic architectures have become increasingly important. In such architectures, components may appear or disappear, and connections may change over time. In the following we mechanize a theory of dynamic architectures and verify the soundness of a corresponding calculus. Therefore, we first formalize the notion of configuration traces as a model for dynamic architectures. Then, the behavior of single components is formalized in terms of behavior traces and an operator is introduced and studied to extract the behavior of a single component out of a given configuration trace. Then, behavior trace assertions are introduced as a temporal specification technique to specify behavior of components. Reasoning about component behavior in a dynamic context is formalized in terms of a calculus for dynamic architectures. Finally, the soundness of the calculus is verified by introducing an alternative interpretation for behavior trace assertions over configuration traces and proving the rules of the calculus. Since projection may lead to finite as well as infinite behavior traces, they are formalized in terms of coinductive lists. Thus, our theory is based on Lochbihler's formalization of coinductive lists. The theory may be applied to verify properties for dynamic architectures. Declarative Semantics for Functional Languages https://www.isa-afp.org/entries/Decl_Sem_Fun_PL.html https://www.isa-afp.org/entries/Decl_Sem_Fun_PL.html Jeremy Siek 21 Jul 2017 00:00:00 +0000 We present a semantics for an applied call-by-value lambda-calculus that is compositional, extensional, and elementary. We present four different views of the semantics: 1) as a relational (big-step) semantics that is not operational but instead declarative, 2) as a denotational semantics that does not use domain theory, 3) as a non-deterministic interpreter, and 4) as a variant of the intersection type systems of the Torino group. We prove that the semantics is correct by showing that it is sound and complete with respect to operational semantics on programs and that is sound with respect to contextual equivalence. We have not yet investigated whether it is fully abstract. We demonstrate that this approach to semantics is useful with three case studies. First, we use the semantics to prove correctness of a compiler optimization that inlines function application. Second, we adapt the semantics to the polymorphic lambda-calculus extended with general recursion and prove semantic type soundness. Third, we adapt the semantics to the call-by-value lambda-calculus with mutable references. <br> The paper that accompanies these Isabelle theories is <a href="https://arxiv.org/abs/1707.03762">available on arXiv</a>. HOLCF-Prelude https://www.isa-afp.org/entries/HOLCF-Prelude.html https://www.isa-afp.org/entries/HOLCF-Prelude.html Joachim Breitner, Brian Huffman, Neil Mitchell, Christian Sternagel 15 Jul 2017 00:00:00 +0000 The Isabelle/HOLCF-Prelude is a formalization of a large part of Haskell's standard prelude in Isabelle/HOLCF. We use it to prove the correctness of the Eratosthenes' Sieve, in its self-referential implementation commonly used to showcase Haskell's laziness; prove correctness of GHC's "fold/build" rule and related rewrite rules; and certify a number of hints suggested by HLint. Minkowski's Theorem https://www.isa-afp.org/entries/Minkowskis_Theorem.html https://www.isa-afp.org/entries/Minkowskis_Theorem.html Manuel Eberl 13 Jul 2017 00:00:00 +0000 <p>Minkowski's theorem relates a subset of &#8477;<sup>n</sup>, the Lebesgue measure, and the integer lattice &#8484;<sup>n</sup>: It states that any convex subset of &#8477;<sup>n</sup> with volume greater than 2<sup>n</sup> contains at least one lattice point from &#8484;<sup>n</sup>\{0}, i.&thinsp;e. a non-zero point with integer coefficients.</p> <p>A related theorem which directly implies this is Blichfeldt's theorem, which states that any subset of &#8477;<sup>n</sup> with a volume greater than 1 contains two different points whose difference vector has integer components.</p> <p>The entry contains a proof of both theorems.</p> Verified Metatheory and Type Inference for a Name-Carrying Simply-Typed Lambda Calculus https://www.isa-afp.org/entries/Name_Carrying_Type_Inference.html https://www.isa-afp.org/entries/Name_Carrying_Type_Inference.html Michael Rawson 09 Jul 2017 00:00:00 +0000 I formalise a Church-style simply-typed \(\lambda\)-calculus, extended with pairs, a unit value, and projection functions, and show some metatheory of the calculus, such as the subject reduction property. Particular attention is paid to the treatment of names in the calculus. A nominal style of binding is used, but I use a manual approach over Nominal Isabelle in order to extract an executable type inference algorithm. More information can be found in my <a href="http://www.openthesis.org/documents/Verified-Metatheory-Type-Inference-Simply-603182.html">undergraduate dissertation</a>. A framework for establishing Strong Eventual Consistency for Conflict-free Replicated Datatypes https://www.isa-afp.org/entries/CRDT.html https://www.isa-afp.org/entries/CRDT.html Victor B. F. Gomes, Martin Kleppmann, Dominic P. Mulligan, Alastair R. Beresford 07 Jul 2017 00:00:00 +0000 In this work, we focus on the correctness of Conflict-free Replicated Data Types (CRDTs), a class of algorithm that provides strong eventual consistency guarantees for replicated data. We develop a modular and reusable framework for verifying the correctness of CRDT algorithms. We avoid correctness issues that have dogged previous mechanised proofs in this area by including a network model in our formalisation, and proving that our theorems hold in all possible network behaviours. Our axiomatic network model is a standard abstraction that accurately reflects the behaviour of real-world computer networks. Moreover, we identify an abstract convergence theorem, a property of order relations, which provides a formal definition of strong eventual consistency. We then obtain the first machine-checked correctness theorems for three concrete CRDTs: the Replicated Growable Array, the Observed-Remove Set, and an Increment-Decrement Counter. Stone-Kleene Relation Algebras https://www.isa-afp.org/entries/Stone_Kleene_Relation_Algebras.html https://www.isa-afp.org/entries/Stone_Kleene_Relation_Algebras.html Walter Guttmann 06 Jul 2017 00:00:00 +0000 We develop Stone-Kleene relation algebras, which expand Stone relation algebras with a Kleene star operation to describe reachability in weighted graphs. Many properties of the Kleene star arise as a special case of a more general theory of iteration based on Conway semirings extended by simulation axioms. This includes several theorems representing complex program transformations. We formally prove the correctness of Conway's automata-based construction of the Kleene star of a matrix. We prove numerous results useful for reasoning about weighted graphs. Propositional Proof Systems https://www.isa-afp.org/entries/Propositional_Proof_Systems.html https://www.isa-afp.org/entries/Propositional_Proof_Systems.html Julius Michaelis, Tobias Nipkow 21 Jun 2017 00:00:00 +0000 We formalize a range of proof systems for classical propositional logic (sequent calculus, natural deduction, Hilbert systems, resolution) and prove the most important meta-theoretic results about semantics and proofs: compactness, soundness, completeness, translations between proof systems, cut-elimination, interpolation and model existence. Partial Semigroups and Convolution Algebras https://www.isa-afp.org/entries/PSemigroupsConvolution.html https://www.isa-afp.org/entries/PSemigroupsConvolution.html Brijesh Dongol, Victor B. F. Gomes, Ian J. Hayes, Georg Struth 13 Jun 2017 00:00:00 +0000 Partial Semigroups are relevant to the foundations of quantum mechanics and combinatorics as well as to interval and separation logics. Convolution algebras can be understood either as algebras of generalised binary modalities over ternary Kripke frames, in particular over partial semigroups, or as algebras of quantale-valued functions which are equipped with a convolution-style operation of multiplication that is parametrised by a ternary relation. Convolution algebras provide algebraic semantics for various substructural logics, including categorial, relevance and linear logics, for separation logic and for interval logics; they cover quantitative and qualitative applications. These mathematical components for partial semigroups and convolution algebras provide uniform foundations from which models of computation based on relations, program traces or pomsets, and verification components for separation or interval temporal logics can be built with little effort. Buffon's Needle Problem https://www.isa-afp.org/entries/Buffons_Needle.html https://www.isa-afp.org/entries/Buffons_Needle.html Manuel Eberl 06 Jun 2017 00:00:00 +0000 In the 18th century, Georges-Louis Leclerc, Comte de Buffon posed and later solved the following problem, which is often called the first problem ever solved in geometric probability: Given a floor divided into vertical strips of the same width, what is the probability that a needle thrown onto the floor randomly will cross two strips? This entry formally defines the problem in the case where the needle's position is chosen uniformly at random in a single strip around the origin (which is equivalent to larger arrangements due to symmetry). It then provides proofs of the simple solution in the case where the needle's length is no greater than the width of the strips and the more complicated solution in the opposite case. Formalizing Push-Relabel Algorithms https://www.isa-afp.org/entries/Prpu_Maxflow.html https://www.isa-afp.org/entries/Prpu_Maxflow.html Peter Lammich, S. Reza Sefidgar 01 Jun 2017 00:00:00 +0000 We present a formalization of push-relabel algorithms for computing the maximum flow in a network. We start with Goldberg's et al.~generic push-relabel algorithm, for which we show correctness and the time complexity bound of O(V^2E). We then derive the relabel-to-front and FIFO implementation. Using stepwise refinement techniques, we derive an efficient verified implementation. Our formal proof of the abstract algorithms closely follows a standard textbook proof. It is accessible even without being an expert in Isabelle/HOL, the interactive theorem prover used for the formalization. Flow Networks and the Min-Cut-Max-Flow Theorem https://www.isa-afp.org/entries/Flow_Networks.html https://www.isa-afp.org/entries/Flow_Networks.html Peter Lammich, S. Reza Sefidgar 01 Jun 2017 00:00:00 +0000 We present a formalization of flow networks and the Min-Cut-Max-Flow theorem. Our formal proof closely follows a standard textbook proof, and is accessible even without being an expert in Isabelle/HOL, the interactive theorem prover used for the formalization. Optics https://www.isa-afp.org/entries/Optics.html https://www.isa-afp.org/entries/Optics.html Simon Foster, Frank Zeyda 25 May 2017 00:00:00 +0000 Lenses provide an abstract interface for manipulating data types through spatially-separated views. They are defined abstractly in terms of two functions, <em>get</em>, the return a value from the source type, and <em>put</em> that updates the value. We mechanise the underlying theory of lenses, in terms of an algebraic hierarchy of lenses, including well-behaved and very well-behaved lenses, each lens class being characterised by a set of lens laws. We also mechanise a lens algebra in Isabelle that enables their composition and comparison, so as to allow construction of complex lenses. This is accompanied by a large library of algebraic laws. Moreover we also show how the lens classes can be applied by instantiating them with a number of Isabelle data types.