diff --git a/metadata/metadata b/metadata/metadata --- a/metadata/metadata +++ b/metadata/metadata @@ -1,8931 +1,9029 @@ [Arith_Prog_Rel_Primes] title = Arithmetic progressions and relative primes author = José Manuel Rodríguez Caballero topic = Mathematics/Number Theory date = 2020-02-01 notify = jose.manuel.rodriguez.caballero@ut.ee -abstract = +abstract = This article provides a formalization of the solution obtained by the - author of the Problem “ARITHMETIC PROGRESSIONS” from the + author of the Problem “ARITHMETIC PROGRESSIONS” from the Putnam exam problems of 2002. The statement of the problem is as follows: For which integers n > 1 does the set of positive integers less than and relatively prime to n constitute an arithmetic progression? [Complex_Geometry] title = Complex Geometry author = Filip Marić , Danijela Simić topic = Mathematics/Geometry date = 2019-12-16 notify = danijela@matf.bg.ac.rs, filip@matf.bg.ac.rs, boutry@unistra.fr abstract = A formalization of geometry of complex numbers is presented. Fundamental objects that are investigated are the complex plane extended by a single infinite point, its objects (points, lines and circles), and groups of transformations that act on them (e.g., inversions and Möbius transformations). Most objects are defined algebraically, but correspondence with classical geometric definitions is shown. [Poincare_Disc] title = Poincaré Disc Model author = Danijela Simić , Filip Marić , Pierre Boutry topic = Mathematics/Geometry date = 2019-12-16 notify = danijela@matf.bg.ac.rs, filip@matf.bg.ac.rs, boutry@unistra.fr abstract = We describe formalization of the Poincaré disc model of hyperbolic geometry within the Isabelle/HOL proof assistant. The model is defined within the extended complex plane (one dimensional complex projectives space ℂP1), formalized in the AFP entry “Complex Geometry”. Points, lines, congruence of pairs of points, betweenness of triples of points, circles, and isometries are defined within the model. It is shown that the model satisfies all Tarski's axioms except the Euclid's axiom. It is shown that it satisfies its negation and the limiting parallels axiom (which proves it to be a model of hyperbolic geometry). [Fourier] title = Fourier Series author = Lawrence C Paulson topic = Mathematics/Analysis date = 2019-09-06 notify = lp15@cam.ac.uk abstract = This development formalises the square integrable functions over the reals and the basics of Fourier series. It culminates with a proof that every well-behaved periodic function can be approximated by a Fourier series. The material is ported from HOL Light: https://github.com/jrh13/hol-light/blob/master/100/fourier.ml [Generic_Deriving] title = Deriving generic class instances for datatypes author = Jonas Rädle , Lars Hupel topic = Computer Science/Data Structures date = 2018-11-06 notify = jonas.raedle@gmail.com abstract =

We provide a framework for automatically deriving instances for generic type classes. Our approach is inspired by Haskell's generic-deriving package and Scala's shapeless library. In addition to generating the code for type class functions, we also attempt to automatically prove type class laws for these instances. As of now, however, some manual proofs are still required for recursive datatypes.

Note: There are already articles in the AFP that provide automatic instantiation for a number of classes. Concretely, Deriving allows the automatic instantiation of comparators, linear orders, equality, and hashing. Show instantiates a Haskell-style show class.

Our approach works for arbitrary classes (with some Isabelle/HOL overhead for each class), but a smaller set of datatypes.

[Partial_Order_Reduction] title = Partial Order Reduction author = Julian Brunner topic = Computer Science/Automata and Formal Languages date = 2018-06-05 notify = brunnerj@in.tum.de abstract = 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. [CakeML] title = CakeML author = Lars Hupel , Yu Zhang <> contributors = Johannes Åman Pohjola <> topic = Computer Science/Programming Languages/Language Definitions date = 2018-03-12 notify = hupel@in.tum.de abstract = 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. [CakeML_Codegen] title = A Verified Code Generator from Isabelle/HOL to CakeML author = Lars Hupel topic = Computer Science/Programming Languages/Compiling, Logic/Rewriting date = 2019-07-08 notify = lars@hupel.info abstract = This entry contains the formalization that accompanies my PhD thesis (see https://lars.hupel.info/research/codegen/). I develop a verified compilation toolchain from executable specifications in Isabelle/HOL to CakeML abstract syntax trees. This improves over the state-of-the-art in Isabelle by providing a trustworthy procedure for code generation. [DiscretePricing] title = Pricing in discrete financial models author = Mnacho Echenim topic = Mathematics/Probability Theory, Mathematics/Games and Economics date = 2018-07-16 notify = mnacho.echenim@univ-grenoble-alpes.fr abstract = 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 paper. extra-history = Change history: [2019-05-12]: Renamed discr_mkt predicate to stk_strict_subs and got rid of predicate A for a more natural definition of the type discrete_market; renamed basic quantity processes for coherent notation; renamed value_process into val_process and closing_value_process to cls_val_process; relaxed hypothesis of lemma CRR_market_fair_price. Added functions to price some basic options. (revision 0b813a1a833f)
[Pell] title = Pell's Equation author = Manuel Eberl topic = Mathematics/Number Theory date = 2018-06-23 notify = eberlm@in.tum.de abstract =

This article gives the basic theory of Pell's equation x2 = 1 + Dy2, where D ∈ ℕ is a parameter and x, y are integer variables.

The main result that is proven is the following: If D is not a perfect square, then there exists a fundamental solution (x0, y0) that is not the trivial solution (1, 0) and which generates all other solutions (x, y) in the sense that there exists some n ∈ ℕ such that |x| + |y| √D = (x0 + y0 √D)n. This also implies that the set of solutions is infinite, and it gives us an explicit and executable characterisation of all the solutions.

Based on this, simple executable algorithms for computing the fundamental solution and the infinite sequence of all non-negative solutions are also provided.

[WebAssembly] title = WebAssembly author = Conrad Watt topic = Computer Science/Programming Languages/Language Definitions date = 2018-04-29 notify = caw77@cam.ac.uk abstract = 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. [Knuth_Morris_Pratt] title = The string search algorithm by Knuth, Morris and Pratt author = Fabian Hellauer , Peter Lammich topic = Computer Science/Algorithms date = 2017-12-18 notify = hellauer@in.tum.de, lammich@in.tum.de abstract = The Knuth-Morris-Pratt algorithm is often used to show that the problem of finding a string s in a text t can be solved deterministically in O(|s| + |t|) time. We use the Isabelle Refinement Framework to formulate and verify the algorithm. Via refinement, we apply some optimisations and finally use the Sepref tool to obtain executable code in Imperative/HOL. [Minkowskis_Theorem] title = Minkowski's Theorem author = Manuel Eberl topic = Mathematics/Geometry, Mathematics/Number Theory date = 2017-07-13 notify = eberlm@in.tum.de abstract =

Minkowski's theorem relates a subset of ℝn, the Lebesgue measure, and the integer lattice ℤn: It states that any convex subset of ℝn with volume greater than 2n contains at least one lattice point from ℤn\{0}, i. e. a non-zero point with integer coefficients.

A related theorem which directly implies this is Blichfeldt's theorem, which states that any subset of ℝn with a volume greater than 1 contains two different points whose difference vector has integer components.

The entry contains a proof of both theorems.

[Name_Carrying_Type_Inference] title = Verified Metatheory and Type Inference for a Name-Carrying Simply-Typed Lambda Calculus author = Michael Rawson topic = Computer Science/Programming Languages/Type Systems date = 2017-07-09 notify = mr644@cam.ac.uk, michaelrawson76@gmail.com abstract = 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 undergraduate dissertation. [Propositional_Proof_Systems] title = Propositional Proof Systems author = Julius Michaelis , Tobias Nipkow topic = Logic date = 2017-06-21 notify = maintainafpppt@liftm.de abstract = 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. [Optics] title = Optics author = Simon Foster , Frank Zeyda topic = Computer Science/Functional Programming, Mathematics/Algebra date = 2017-05-25 notify = simon.foster@york.ac.uk abstract = Lenses provide an abstract interface for manipulating data types through spatially-separated views. They are defined abstractly in terms of two functions, get, the return a value from the source type, and put 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. extra-history = Change history: [2020-03-02]: Added partial bijective and symmetric lenses. Improved alphabet command generating additional lenses and results. Several additional lens relations, including observational equivalence. Additional theorems throughout. Adaptations for Isabelle 2020. (revision 44e2e5c) [Game_Based_Crypto] title = Game-based cryptography in HOL author = Andreas Lochbihler , S. Reza Sefidgar <>, Bhargav Bhatt topic = Computer Science/Security/Cryptography date = 2017-05-05 notify = mail@andreas-lochbihler.de abstract =

In this AFP entry, we show how to specify game-based cryptographic security notions and formally prove secure several cryptographic constructions from the literature using the CryptHOL framework. Among others, we formalise the notions of a random oracle, a pseudo-random function, an unpredictable function, and of encryption schemes that are indistinguishable under chosen plaintext and/or ciphertext attacks. We prove the random-permutation/random-function switching lemma, security of the Elgamal and hashed Elgamal public-key encryption scheme and correctness and security of several constructions with pseudo-random functions.

Our proofs follow the game-hopping style advocated by Shoup and Bellare and Rogaway, from which most of the examples have been taken. We generalise some of their results such that they can be reused in other proofs. Thanks to CryptHOL's integration with Isabelle's parametricity infrastructure, many simple hops are easily justified using the theory of representation independence.

extra-history = Change history: [2018-09-28]: added the CryptHOL tutorial for game-based cryptography (revision 489a395764ae) [Multi_Party_Computation] title = Multi-Party Computation author = David Aspinall , David Butler topic = Computer Science/Security date = 2019-05-09 notify = dbutler@turing.ac.uk abstract = We use CryptHOL to consider Multi-Party Computation (MPC) protocols. MPC was first considered by Yao in 1983 and recent advances in efficiency and an increased demand mean it is now deployed in the real world. Security is considered using the real/ideal world paradigm. We first define security in the semi-honest security setting where parties are assumed not to deviate from the protocol transcript. In this setting we prove multiple Oblivious Transfer (OT) protocols secure and then show security for the gates of the GMW protocol. We then define malicious security, this is a stronger notion of security where parties are assumed to be fully corrupted by an adversary. In this setting we again consider OT, as it is a fundamental building block of almost all MPC protocols. [Sigma_Commit_Crypto] title = Sigma Protocols and Commitment Schemes author = David Butler , Andreas Lochbihler topic = Computer Science/Security/Cryptography date = 2019-10-07 notify = dbutler@turing.ac.uk abstract = We use CryptHOL to formalise commitment schemes and Sigma-protocols. Both are widely used fundamental two party cryptographic primitives. Security for commitment schemes is considered using game-based definitions whereas the security of Sigma-protocols is considered using both the game-based and simulation-based security paradigms. In this work, we first define security for both primitives and then prove secure multiple case studies: the Schnorr, Chaum-Pedersen and Okamoto Sigma-protocols as well as a construction that allows for compound (AND and OR statements) Sigma-protocols and the Pedersen and Rivest commitment schemes. We also prove that commitment schemes can be constructed from Sigma-protocols. We formalise this proof at an abstract level, only assuming the existence of a Sigma-protocol; consequently, the instantiations of this result for the concrete Sigma-protocols we consider come for free. [CryptHOL] title = CryptHOL author = Andreas Lochbihler topic = Computer Science/Security/Cryptography, Computer Science/Functional Programming, Mathematics/Probability Theory date = 2017-05-05 notify = mail@andreas-lochbihler.de abstract =

CryptHOL provides a framework for formalising cryptographic arguments in Isabelle/HOL. It shallowly embeds a probabilistic functional programming language in higher order logic. The language features monadic sequencing, recursion, random sampling, failures and failure handling, and black-box access to oracles. Oracles are probabilistic functions which maintain hidden state between different invocations. All operators are defined in the new semantic domain of generative probabilistic values, a codatatype. We derive proof rules for the operators and establish a connection with the theory of relational parametricity. Thus, the resuting proofs are trustworthy and comprehensible, and the framework is extensible and widely applicable.

The framework is used in the accompanying AFP entry "Game-based Cryptography in HOL". There, we show-case our framework by formalizing different game-based proofs from the literature. This formalisation continues the work described in the author's ESOP 2016 paper.

[Constructive_Cryptography] title = Constructive Cryptography in HOL author = Andreas Lochbihler , S. Reza Sefidgar<> topic = Computer Science/Security/Cryptography, Mathematics/Probability Theory date = 2018-12-17 notify = mail@andreas-lochbihler.de, reza.sefidgar@inf.ethz.ch abstract = Inspired by Abstract Cryptography, we extend CryptHOL, a framework for formalizing game-based proofs, with an abstract model of Random Systems and provide proof rules about their composition and equality. This foundation facilitates the formalization of Constructive Cryptography proofs, where the security of a cryptographic scheme is realized as a special form of construction in which a complex random system is built from simpler ones. This is a first step towards a fully-featured compositional framework, similar to Universal Composability framework, that supports formalization of simulation-based proofs. [Probabilistic_While] title = Probabilistic while loop author = Andreas Lochbihler topic = Computer Science/Functional Programming, Mathematics/Probability Theory, Computer Science/Algorithms date = 2017-05-05 notify = mail@andreas-lochbihler.de abstract = This AFP entry defines a probabilistic while operator based on sub-probability mass functions and formalises zero-one laws and variant rules for probabilistic loop termination. As applications, we implement probabilistic algorithms for the Bernoulli, geometric and arbitrary uniform distributions that only use fair coin flips, and prove them correct and terminating with probability 1. extra-history = Change history: [2018-02-02]: Added a proof that probabilistic conditioning can be implemented by repeated sampling. (revision 305867c4e911)
[Monad_Normalisation] title = Monad normalisation author = Joshua Schneider <>, Manuel Eberl , Andreas Lochbihler topic = Tools, Computer Science/Functional Programming, Logic/Rewriting date = 2017-05-05 notify = mail@andreas-lochbihler.de abstract = The usual monad laws can directly be used as rewrite rules for Isabelle’s simplifier to normalise monadic HOL terms and decide equivalences. In a commutative monad, however, the commutativity law is a higher-order permutative rewrite rule that makes the simplifier loop. This AFP entry implements a simproc that normalises monadic expressions in commutative monads using ordered rewriting. The simproc can also permute computations across control operators like if and case. [Monomorphic_Monad] title = Effect polymorphism in higher-order logic author = Andreas Lochbihler topic = Computer Science/Functional Programming date = 2017-05-05 notify = mail@andreas-lochbihler.de abstract = The notion of a monad cannot be expressed within higher-order logic (HOL) due to type system restrictions. We show that if a monad is used with values of only one type, this notion can be formalised in HOL. Based on this idea, we develop a library of effect specifications and implementations of monads and monad transformers. Hence, we can abstract over the concrete monad in HOL definitions and thus use the same definition for different (combinations of) effects. We illustrate the usefulness of effect polymorphism with a monadic interpreter for a simple language. extra-history = Change history: [2018-02-15]: added further specifications and implementations of non-determinism; more examples (revision bc5399eea78e)
[Constructor_Funs] title = Constructor Functions author = Lars Hupel topic = Tools date = 2017-04-19 notify = hupel@in.tum.de abstract = Isabelle's code generator performs various adaptations for target languages. Among others, constructor applications have to be fully saturated. That means that for constructor calls occuring as arguments to higher-order functions, synthetic lambdas have to be inserted. This entry provides tooling to avoid this construction altogether by introducing constructor functions. [Lazy_Case] title = Lazifying case constants author = Lars Hupel topic = Tools date = 2017-04-18 notify = hupel@in.tum.de abstract = Isabelle's code generator performs various adaptations for target languages. Among others, case statements are printed as match expressions. Internally, this is a sophisticated procedure, because in HOL, case statements are represented as nested calls to the case combinators as generated by the datatype package. Furthermore, the procedure relies on laziness of match expressions in the target language, i.e., that branches guarded by patterns that fail to match are not evaluated. Similarly, if-then-else is printed to the corresponding construct in the target language. This entry provides tooling to replace these special cases in the code generator by ignoring these target language features, instead printing case expressions and if-then-else as functions. [Dict_Construction] title = Dictionary Construction author = Lars Hupel topic = Tools date = 2017-05-24 notify = hupel@in.tum.de abstract = Isabelle's code generator natively supports type classes. For targets that do not have language support for classes and instances, it performs the well-known dictionary translation, as described by Haftmann and Nipkow. This translation happens outside the logic, i.e., there is no guarantee that it is correct, besides the pen-and-paper proof. This work implements a certified dictionary translation that produces new class-free constants and derives equality theorems. [Higher_Order_Terms] title = An Algebra for Higher-Order Terms author = Lars Hupel contributors = Yu Zhang <> topic = Computer Science/Programming Languages/Lambda Calculi date = 2019-01-15 notify = lars@hupel.info abstract = In this formalization, I introduce a higher-order term algebra, generalizing the notions of free variables, matching, and substitution. The need arose from the work on a verified compiler from Isabelle to CakeML. Terms can be thought of as consisting of a generic (free variables, constants, application) and a specific part. As example applications, this entry provides instantiations for de-Bruijn terms, terms with named variables, and Blanchette’s λ-free higher-order terms. Furthermore, I implement translation functions between de-Bruijn terms and named terms and prove their correctness. [Subresultants] title = Subresultants author = Sebastiaan Joosten , René Thiemann , Akihisa Yamada topic = Mathematics/Algebra date = 2017-04-06 notify = rene.thiemann@uibk.ac.at abstract = 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. [Comparison_Sort_Lower_Bound] title = Lower bound on comparison-based sorting algorithms author = Manuel Eberl topic = Computer Science/Algorithms date = 2017-03-15 notify = eberlm@in.tum.de abstract =

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 n is at least log2 (n!) in the worst case, i. e. Ω(n log n).

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.

[Quick_Sort_Cost] title = The number of comparisons in QuickSort author = Manuel Eberl topic = Computer Science/Algorithms date = 2017-03-15 notify = eberlm@in.tum.de abstract =

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. e. QuickSort with random pivot choice) is 2 (n+1) Hn - 4 n, which is asymptotically equivalent to 2 n ln n; second, the number of comparisons performed by the classic non-randomised QuickSort has the same distribution in the average case as the randomised one.

[Random_BSTs] title = Expected Shape of Random Binary Search Trees author = Manuel Eberl topic = Computer Science/Data Structures date = 2017-04-04 notify = eberlm@in.tum.de abstract =

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. e. BSTs that are formed by taking an empty BST and inserting elements from a fixed set in random order.

In particular, we prove a logarithmic upper bound on the expected height and the Θ(n log n) 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.

[Randomised_BSTs] title = Randomised Binary Search Trees author = Manuel Eberl topic = Computer Science/Data Structures date = 2018-10-19 notify = eberlm@in.tum.de abstract =

This work is a formalisation of the Randomised Binary Search Trees introduced by Martínez and Roura, including definitions and correctness proofs.

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.

[E_Transcendental] title = The Transcendence of e author = Manuel Eberl topic = Mathematics/Analysis, Mathematics/Number Theory date = 2017-01-12 notify = eberlm@in.tum.de abstract =

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.

This kind of approach can be found in many different sources; this formalisation mostly follows a PlanetMath article by Roger Lipsett.

[Pi_Transcendental] title = The Transcendence of π author = Manuel Eberl topic = Mathematics/Number Theory date = 2018-09-28 notify = eberlm@in.tum.de abstract =

This entry shows the transcendence of π 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 e.

[DFS_Framework] title = A Framework for Verifying Depth-First Search Algorithms author = Peter Lammich , René Neumann notify = lammich@in.tum.de date = 2016-07-05 topic = Computer Science/Algorithms/Graph abstract =

This entry presents a framework for the modular verification of DFS-based algorithms, which is described in our [CPP-2015] paper. It provides a generic DFS algorithm framework, that can be parameterized with user-defined actions on certain events (e.g. discovery of new node). It comes with an extensible library of invariants, which can be used to derive invariants of a specific parameterization. Using refinement techniques, efficient implementations of the algorithms can easily be derived. Here, the framework comes with templates for a recursive and a tail-recursive implementation, and also with several templates for implementing the data structures required by the DFS algorithm. Finally, this entry contains a set of re-usable DFS-based algorithms, which illustrate the application of the framework.

[CPP-2015] Peter Lammich, René Neumann: A Framework for Verifying Depth-First Search Algorithms. CPP 2015: 137-146

[Flow_Networks] title = Flow Networks and the Min-Cut-Max-Flow Theorem author = Peter Lammich , S. Reza Sefidgar <> topic = Mathematics/Graph Theory date = 2017-06-01 notify = lammich@in.tum.de abstract = 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. [Prpu_Maxflow] title = Formalizing Push-Relabel Algorithms author = Peter Lammich , S. Reza Sefidgar <> topic = Computer Science/Algorithms/Graph, Mathematics/Graph Theory date = 2017-06-01 notify = lammich@in.tum.de abstract = 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. [Buildings] title = Chamber Complexes, Coxeter Systems, and Buildings author = Jeremy Sylvestre notify = jeremy.sylvestre@ualberta.ca date = 2016-07-01 topic = Mathematics/Algebra, Mathematics/Geometry abstract = We provide a basic formal framework for the theory of chamber complexes and Coxeter systems, and for buildings as thick chamber complexes endowed with a system of apartments. Along the way, we develop some of the general theory of abstract simplicial complexes and of groups (relying on the group_add class for the basics), including free groups and group presentations, and their universal properties. The main results verified are that the deletion condition is both necessary and sufficient for a group with a set of generators of order two to be a Coxeter system, and that the apartments in a (thick) building are all uniformly Coxeter. [Algebraic_VCs] title = Program Construction and Verification Components Based on Kleene Algebra author = Victor B. F. Gomes , Georg Struth notify = victor.gomes@cl.cam.ac.uk, g.struth@sheffield.ac.uk date = 2016-06-18 topic = Mathematics/Algebra abstract = Variants of Kleene algebra support program construction and verification by algebraic reasoning. This entry provides a verification component for Hoare logic based on Kleene algebra with tests, verification components for weakest preconditions and strongest postconditions based on Kleene algebra with domain and a component for step-wise refinement based on refinement Kleene algebra with tests. In addition to these components for the partial correctness of while programs, a verification component for total correctness based on divergence Kleene algebras and one for (partial correctness) of recursive programs based on domain quantales are provided. Finally we have integrated memory models for programs with pointers and a program trace semantics into the weakest precondition component. [C2KA_DistributedSystems] title = Communicating Concurrent Kleene Algebra for Distributed Systems Specification author = Maxime Buyse , Jason Jaskolka topic = Computer Science/Automata and Formal Languages, Mathematics/Algebra date = 2019-08-06 notify = maxime.buyse@polytechnique.edu, jason.jaskolka@carleton.ca abstract = Communicating Concurrent Kleene Algebra (C²KA) is a mathematical framework for capturing the communicating and concurrent behaviour of agents in distributed systems. It extends Hoare et al.'s Concurrent Kleene Algebra (CKA) with communication actions through the notions of stimuli and shared environments. C²KA has applications in studying system-level properties of distributed systems such as safety, security, and reliability. In this work, we formalize results about C²KA and its application for distributed systems specification. We first formalize the stimulus structure and behaviour structure (CKA). Next, we combine them to formalize C²KA and its properties. Then, we formalize notions and properties related to the topology of distributed systems and the potential for communication via stimuli and via shared environments of agents, all within the algebraic setting of C²KA. [Card_Equiv_Relations] title = Cardinality of Equivalence Relations author = Lukas Bulwahn notify = lukas.bulwahn@gmail.com date = 2016-05-24 topic = Mathematics/Combinatorics abstract = This entry provides formulae for counting the number of equivalence relations and partial equivalence relations over a finite carrier set with given cardinality. To count the number of equivalence relations, we provide bijections between equivalence relations and set partitions, and then transfer the main results of the two AFP entries, Cardinality of Set Partitions and Spivey's Generalized Recurrence for Bell Numbers, to theorems on equivalence relations. To count the number of partial equivalence relations, we observe that counting partial equivalence relations over a set A is equivalent to counting all equivalence relations over all subsets of the set A. From this observation and the results on equivalence relations, we show that the cardinality of partial equivalence relations over a finite set of cardinality n is equal to the n+1-th Bell number. [Twelvefold_Way] title = The Twelvefold Way author = Lukas Bulwahn topic = Mathematics/Combinatorics date = 2016-12-29 notify = lukas.bulwahn@gmail.com abstract = 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. [Chord_Segments] title = Intersecting Chords Theorem author = Lukas Bulwahn notify = lukas.bulwahn@gmail.com date = 2016-10-11 topic = Mathematics/Geometry abstract = This entry provides a geometric proof of the intersecting chords theorem. The theorem states that when two chords intersect each other inside a circle, the products of their segments are equal. After a short review of existing proofs in the literature, I decided to use a proof approach that employs reasoning about lengths of line segments, the orthogonality of two lines and the Pythagoras Law. Hence, one can understand the formalized proof easily with the knowledge of a few general geometric facts that are commonly taught in high-school. This theorem is the 55th theorem of the Top 100 Theorems list. [Category3] title = Category Theory with Adjunctions and Limits author = Eugene W. Stark notify = stark@cs.stonybrook.edu date = 2016-06-26 topic = Mathematics/Category Theory abstract = This article attempts to develop a usable framework for doing category theory in Isabelle/HOL. Our point of view, which to some extent differs from that of the previous AFP articles on the subject, is to try to explore how category theory can be done efficaciously within HOL, rather than trying to match exactly the way things are done using a traditional approach. To this end, we define the notion of category in an "object-free" style, in which a category is represented by a single partial composition operation on arrows. This way of defining categories provides some advantages in the context of HOL, including the ability to avoid the use of records and the possibility of defining functors and natural transformations simply as certain functions on arrows, rather than as composite objects. We define various constructions associated with the basic notions, including: dual category, product category, functor category, discrete category, free category, functor composition, and horizontal and vertical composite of natural transformations. A "set category" locale is defined that axiomatizes the notion "category of all sets at a type and all functions between them," and a fairly extensive set of properties of set categories is derived from the locale assumptions. The notion of a set category is used to prove the Yoneda Lemma in a general setting of a category equipped with a "hom embedding," which maps arrows of the category to the "universe" of the set category. We also give a treatment of adjunctions, defining adjunctions via left and right adjoint functors, natural bijections between hom-sets, and unit and counit natural transformations, and showing the equivalence of these definitions. We also develop the theory of limits, including representations of functors, diagrams and cones, and diagonal functors. We show that right adjoint functors preserve limits, and that limits can be constructed via products and equalizers. We characterize the conditions under which limits exist in a set category. We also examine the case of limits in a functor category, ultimately culminating in a proof that the Yoneda embedding preserves limits. extra-history = Change history: [2018-05-29]: Revised axioms for the category locale. Introduced notation for composition and "in hom". (revision 8318366d4575)
[2020-02-15]: Move ConcreteCategory.thy from Bicategory to Category3 and use it systematically. Make other minor improvements throughout. (revision a51840d36867)
[MonoidalCategory] title = Monoidal Categories author = Eugene W. Stark topic = Mathematics/Category Theory date = 2017-05-04 notify = stark@cs.stonybrook.edu abstract = Building on the formalization of basic category theory set out in the author's previous AFP article, the present article formalizes some basic aspects of the theory of monoidal categories. Among the notions defined here are monoidal category, monoidal functor, and equivalence of monoidal categories. The main theorems formalized are MacLane's coherence theorem and the constructions of the free monoidal category and free strict monoidal category generated by a given category. The coherence theorem is proved syntactically, using a structurally recursive approach to reduction of terms that might have some novel aspects. We also give proofs of some results given by Etingof et al, which may prove useful in a formal setting. In particular, we show that the left and right unitors need not be taken as given data in the definition of monoidal category, nor does the definition of monoidal functor need to take as given a specific isomorphism expressing the preservation of the unit object. Our definitions of monoidal category and monoidal functor are stated so as to take advantage of the economy afforded by these facts. extra-history = Change history: [2017-05-18]: Integrated material from MonoidalCategory/Category3Adapter into Category3/ and deleted adapter. (revision 015543cdd069)
[2018-05-29]: Modifications required due to 'Category3' changes. Introduced notation for "in hom". (revision 8318366d4575)
[2020-02-15]: Cosmetic improvements. (revision a51840d36867)
[Card_Multisets] title = Cardinality of Multisets author = Lukas Bulwahn notify = lukas.bulwahn@gmail.com date = 2016-06-26 topic = Mathematics/Combinatorics abstract =

This entry provides three lemmas to count the number of multisets of a given size and finite carrier set. The first lemma provides a cardinality formula assuming that the multiset's elements are chosen from the given carrier set. The latter two lemmas provide formulas assuming that the multiset's elements also cover the given carrier set, i.e., each element of the carrier set occurs in the multiset at least once.

The proof of the first lemma uses the argument of the recurrence relation for counting multisets. The proof of the second lemma is straightforward, and the proof of the third lemma is easily obtained using the first cardinality lemma. A challenge for the formalization is the derivation of the required induction rule, which is a special combination of the induction rules for finite sets and natural numbers. The induction rule is derived by defining a suitable inductive predicate and transforming the predicate's induction rule.

[Posix-Lexing] title = POSIX Lexing with Derivatives of Regular Expressions author = Fahad Ausaf , Roy Dyckhoff , Christian Urban notify = christian.urban@kcl.ac.uk date = 2016-05-24 topic = Computer Science/Automata and Formal Languages abstract = Brzozowski introduced the notion of derivatives for regular expressions. They can be used for a very simple regular expression matching algorithm. Sulzmann and Lu cleverly extended this algorithm in order to deal with POSIX matching, which is the underlying disambiguation strategy for regular expressions needed in lexers. In this entry we give our inductive definition of what a POSIX value is and show (i) that such a value is unique (for given regular expression and string being matched) and (ii) that Sulzmann and Lu's algorithm always generates such a value (provided that the regular expression matches the string). We also prove the correctness of an optimised version of the POSIX matching algorithm. [LocalLexing] title = Local Lexing author = Steven Obua topic = Computer Science/Automata and Formal Languages date = 2017-04-28 notify = steven@recursivemind.com abstract = This formalisation accompanies the paper Local Lexing which introduces a novel parsing concept of the same name. The paper also gives a high-level algorithm for local lexing as an extension of Earley's algorithm. This formalisation proves the algorithm to be correct with respect to its local lexing semantics. As a special case, this formalisation thus also contains a proof of the correctness of Earley's algorithm. The paper contains a short outline of how this formalisation is organised. [MFMC_Countable] title = A Formal Proof of the Max-Flow Min-Cut Theorem for Countable Networks author = Andreas Lochbihler date = 2016-05-09 topic = Mathematics/Graph Theory abstract = This article formalises a proof of the maximum-flow minimal-cut theorem for networks with countably many edges. A network is a directed graph with non-negative real-valued edge labels and two dedicated vertices, the source and the sink. A flow in a network assigns non-negative real numbers to the edges such that for all vertices except for the source and the sink, the sum of values on incoming edges equals the sum of values on outgoing edges. A cut is a subset of the vertices which contains the source, but not the sink. Our theorem states that in every network, there is a flow and a cut such that the flow saturates all the edges going out of the cut and is zero on all the incoming edges. The proof is based on the paper The Max-Flow Min-Cut theorem for countable networks by Aharoni et al. Additionally, we prove a characterisation of the lifting operation for relations on discrete probability distributions, which leads to a concise proof of its distributivity over relation composition. notify = mail@andreas-lochbihler.de extra-history = Change history: [2017-09-06]: derive characterisation for the lifting operations on discrete distributions from finite version of the max-flow min-cut theorem (revision a7a198f5bab0)
[Liouville_Numbers] title = Liouville numbers author = Manuel Eberl date = 2015-12-28 topic = Mathematics/Analysis, Mathematics/Number Theory abstract =

Liouville numbers are a class of transcendental numbers that can be approximated particularly well with rational numbers. Historically, they were the first numbers whose transcendence was proven.

In this entry, we define the concept of Liouville numbers as well as the standard construction to obtain Liouville numbers (including Liouville's constant) and we prove their most important properties: irrationality and transcendence.

The proof is very elementary and requires only standard arithmetic, the Mean Value Theorem for polynomials, and the boundedness of polynomials on compact intervals.

notify = eberlm@in.tum.de [Triangle] title = Basic Geometric Properties of Triangles author = Manuel Eberl date = 2015-12-28 topic = Mathematics/Geometry abstract =

This entry contains a definition of angles between vectors and between three points. Building on this, we prove basic geometric properties of triangles, such as the Isosceles Triangle Theorem, the Law of Sines and the Law of Cosines, that the sum of the angles of a triangle is π, and the congruence theorems for triangles.

The definitions and proofs were developed following those by John Harrison in HOL Light. However, due to Isabelle's type class system, all definitions and theorems in the Isabelle formalisation hold for all real inner product spaces.

notify = eberlm@in.tum.de [Prime_Harmonic_Series] title = The Divergence of the Prime Harmonic Series author = Manuel Eberl date = 2015-12-28 topic = Mathematics/Number Theory abstract =

In this work, we prove the lower bound ln(H_n) - ln(5/3) for the partial sum of the Prime Harmonic series and, based on this, the divergence of the Prime Harmonic Series ∑[p prime] · 1/p.

The proof relies on the unique squarefree decomposition of natural numbers. This is similar to Euler's original proof (which was highly informal and morally questionable). Its advantage over proofs by contradiction, like the famous one by Paul Erdős, is that it provides a relatively good lower bound for the partial sums.

notify = eberlm@in.tum.de [Descartes_Sign_Rule] title = Descartes' Rule of Signs author = Manuel Eberl date = 2015-12-28 topic = Mathematics/Analysis abstract =

Descartes' Rule of Signs relates the number of positive real roots of a polynomial with the number of sign changes in its coefficient sequence.

Our proof follows the simple inductive proof given by Rob Arthan, which was also used by John Harrison in his HOL Light formalisation. We proved most of the lemmas for arbitrary linearly-ordered integrity domains (e.g. integers, rationals, reals); the main result, however, requires the intermediate value theorem and was therefore only proven for real polynomials.

notify = eberlm@in.tum.de [Euler_MacLaurin] title = The Euler–MacLaurin Formula author = Manuel Eberl topic = Mathematics/Analysis date = 2017-03-10 notify = eberlm@in.tum.de abstract =

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.

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 Concrete Mathematics that is more useful for deriving asymptotic estimates.

As example applications, we use that formula to derive the full asymptotic expansion of the harmonic numbers and the sum of inverse squares.

[Card_Partitions] title = Cardinality of Set Partitions author = Lukas Bulwahn date = 2015-12-12 topic = Mathematics/Combinatorics abstract = The theory's main theorem states that the cardinality of set partitions of size k on a carrier set of size n is expressed by Stirling numbers of the second kind. In Isabelle, Stirling numbers of the second kind are defined in the AFP entry `Discrete Summation` through their well-known recurrence relation. The main theorem relates them to the alternative definition as cardinality of set partitions. The proof follows the simple and short explanation in Richard P. Stanley's `Enumerative Combinatorics: Volume 1` and Wikipedia, and unravels the full details and implicit reasoning steps of these explanations. notify = lukas.bulwahn@gmail.com [Card_Number_Partitions] title = Cardinality of Number Partitions author = Lukas Bulwahn date = 2016-01-14 topic = Mathematics/Combinatorics abstract = This entry provides a basic library for number partitions, defines the two-argument partition function through its recurrence relation and relates this partition function to the cardinality of number partitions. The main proof shows that the recursively-defined partition function with arguments n and k equals the cardinality of number partitions of n with exactly k parts. The combinatorial proof follows the proof sketch of Theorem 2.4.1 in Mazur's textbook `Combinatorics: A Guided Tour`. This entry can serve as starting point for various more intrinsic properties about number partitions, the partition function and related recurrence relations. notify = lukas.bulwahn@gmail.com [Multirelations] title = Binary Multirelations author = Hitoshi Furusawa , Georg Struth date = 2015-06-11 topic = Mathematics/Algebra abstract = Binary multirelations associate elements of a set with its subsets; hence they are binary relations from a set to its power set. Applications include alternating automata, models and logics for games, program semantics with dual demonic and angelic nondeterministic choices and concurrent dynamic logics. This proof document supports an arXiv article that formalises the basic algebra of multirelations and proposes axiom systems for them, ranging from weak bi-monoids to weak bi-quantales. notify = [Noninterference_Generic_Unwinding] title = The Generic Unwinding Theorem for CSP Noninterference Security author = Pasquale Noce date = 2015-06-11 topic = Computer Science/Security, Computer Science/Concurrency/Process Calculi abstract =

The classical definition of noninterference security for a deterministic state machine with outputs requires to consider the outputs produced by machine actions after any trace, i.e. any indefinitely long sequence of actions, of the machine. In order to render the verification of the security of such a machine more straightforward, there is a need of some sufficient condition for security such that just individual actions, rather than unbounded sequences of actions, have to be considered.

By extending previous results applying to transitive noninterference policies, Rushby has proven an unwinding theorem that provides a sufficient condition of this kind in the general case of a possibly intransitive policy. This condition has to be satisfied by a generic function mapping security domains into equivalence relations over machine states.

An analogous problem arises for CSP noninterference security, whose definition requires to consider any possible future, i.e. any indefinitely long sequence of subsequent events and any indefinitely large set of refused events associated to that sequence, for each process trace.

This paper provides a sufficient condition for CSP noninterference security, which indeed requires to just consider individual accepted and refused events and applies to the general case of a possibly intransitive policy. This condition follows Rushby's one for classical noninterference security, and has to be satisfied by a generic function mapping security domains into equivalence relations over process traces; hence its name, Generic Unwinding Theorem. Variants of this theorem applying to deterministic processes and trace set processes are also proven. Finally, the sufficient condition for security expressed by the theorem is shown not to be a necessary condition as well, viz. there exists a secure process such that no domain-relation map satisfying the condition exists.

notify = [Noninterference_Ipurge_Unwinding] title = The Ipurge Unwinding Theorem for CSP Noninterference Security author = Pasquale Noce date = 2015-06-11 topic = Computer Science/Security abstract =

The definition of noninterference security for Communicating Sequential Processes requires to consider any possible future, i.e. any indefinitely long sequence of subsequent events and any indefinitely large set of refused events associated to that sequence, for each process trace. In order to render the verification of the security of a process more straightforward, there is a need of some sufficient condition for security such that just individual accepted and refused events, rather than unbounded sequences and sets of events, have to be considered.

Of course, if such a sufficient condition were necessary as well, it would be even more valuable, since it would permit to prove not only that a process is secure by verifying that the condition holds, but also that a process is not secure by verifying that the condition fails to hold.

This paper provides a necessary and sufficient condition for CSP noninterference security, which indeed requires to just consider individual accepted and refused events and applies to the general case of a possibly intransitive policy. This condition follows Rushby's output consistency for deterministic state machines with outputs, and has to be satisfied by a specific function mapping security domains into equivalence relations over process traces. The definition of this function makes use of an intransitive purge function following Rushby's one; hence the name given to the condition, Ipurge Unwinding Theorem.

Furthermore, in accordance with Hoare's formal definition of deterministic processes, it is shown that a process is deterministic just in case it is a trace set process, i.e. it may be identified by means of a trace set alone, matching the set of its traces, in place of a failures-divergences pair. Then, variants of the Ipurge Unwinding Theorem are proven for deterministic processes and trace set processes.

notify = [List_Interleaving] title = Reasoning about Lists via List Interleaving author = Pasquale Noce date = 2015-06-11 topic = Computer Science/Data Structures abstract =

Among the various mathematical tools introduced in his outstanding work on Communicating Sequential Processes, Hoare has defined "interleaves" as the predicate satisfied by any three lists such that the first list may be split into sublists alternately extracted from the other two ones, whatever is the criterion for extracting an item from either one list or the other in each step.

This paper enriches Hoare's definition by identifying such criterion with the truth value of a predicate taking as inputs the head and the tail of the first list. This enhanced "interleaves" predicate turns out to permit the proof of equalities between lists without the need of an induction. Some rules that allow to infer "interleaves" statements without induction, particularly applying to the addition or removal of a prefix to the input lists, are also proven. Finally, a stronger version of the predicate, named "Interleaves", is shown to fulfil further rules applying to the addition or removal of a suffix to the input lists.

notify = [Residuated_Lattices] title = Residuated Lattices author = Victor B. F. Gomes , Georg Struth date = 2015-04-15 topic = Mathematics/Algebra abstract = The theory of residuated lattices, first proposed by Ward and Dilworth, is formalised in Isabelle/HOL. This includes concepts of residuated functions; their adjoints and conjugates. It also contains necessary and sufficient conditions for the existence of these operations in an arbitrary lattice. The mathematical components for residuated lattices are linked to the AFP entry for relation algebra. In particular, we prove Jonsson and Tsinakis conditions for a residuated boolean algebra to form a relation algebra. notify = g.struth@sheffield.ac.uk [ConcurrentGC] title = Relaxing Safely: Verified On-the-Fly Garbage Collection for x86-TSO author = Peter Gammie , Tony Hosking , Kai Engelhardt <> date = 2015-04-13 topic = Computer Science/Algorithms/Concurrent abstract =

We use ConcurrentIMP to model Schism, a state-of-the-art real-time garbage collection scheme for weak memory, and show that it is safe on x86-TSO.

This development accompanies the PLDI 2015 paper of the same name.

notify = peteg42@gmail.com [List_Update] title = Analysis of List Update Algorithms author = Maximilian P.L. Haslbeck , Tobias Nipkow date = 2016-02-17 topic = Computer Science/Algorithms/Online abstract =

These theories formalize the quantitative analysis of a number of classical algorithms for the list update problem: 2-competitiveness of move-to-front, the lower bound of 2 for the competitiveness of deterministic list update algorithms and 1.6-competitiveness of the randomized COMB algorithm, the best randomized list update algorithm known to date. The material is based on the first two chapters of Online Computation and Competitive Analysis by Borodin and El-Yaniv.

For an informal description see the FSTTCS 2016 publication Verified Analysis of List Update Algorithms by Haslbeck and Nipkow.

notify = nipkow@in.tum.de [ConcurrentIMP] title = Concurrent IMP author = Peter Gammie date = 2015-04-13 topic = Computer Science/Programming Languages/Logics abstract = ConcurrentIMP extends the small imperative language IMP with control non-determinism and constructs for synchronous message passing. notify = peteg42@gmail.com [TortoiseHare] title = The Tortoise and Hare Algorithm author = Peter Gammie date = 2015-11-18 topic = Computer Science/Algorithms abstract = We formalize the Tortoise and Hare cycle-finding algorithm ascribed to Floyd by Knuth, and an improved version due to Brent. notify = peteg42@gmail.com [UPF] title = The Unified Policy Framework (UPF) author = Achim D. Brucker , Lukas Brügger , Burkhart Wolff date = 2014-11-28 topic = Computer Science/Security abstract = We present the Unified Policy Framework (UPF), a generic framework for modelling security (access-control) policies. UPF emphasizes the view that a policy is a policy decision function that grants or denies access to resources, permissions, etc. In other words, instead of modelling the relations of permitted or prohibited requests directly, we model the concrete function that implements the policy decision point in a system. In more detail, UPF is based on the following four principles: 1) Functional representation of policies, 2) No conflicts are possible, 3) Three-valued decision type (allow, deny, undefined), 4) Output type not containing the decision only. notify = adbrucker@0x5f.org, wolff@lri.fr, lukas.a.bruegger@gmail.com [UPF_Firewall] title = Formal Network Models and Their Application to Firewall Policies author = Achim D. Brucker , Lukas Brügger<>, Burkhart Wolff topic = Computer Science/Security, Computer Science/Networks date = 2017-01-08 notify = adbrucker@0x5f.org abstract = 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. [AODV] title = Loop freedom of the (untimed) AODV routing protocol author = Timothy Bourke , Peter Höfner date = 2014-10-23 topic = Computer Science/Concurrency/Process Calculi abstract =

The Ad hoc On-demand Distance Vector (AODV) routing protocol allows the nodes in a Mobile Ad hoc Network (MANET) or a Wireless Mesh Network (WMN) to know where to forward data packets. Such a protocol is ‘loop free’ if it never leads to routing decisions that forward packets in circles.

This development mechanises an existing pen-and-paper proof of loop freedom of AODV. The protocol is modelled in the Algebra of Wireless Networks (AWN), which is the subject of an earlier paper and AFP mechanization. The proof relies on a novel compositional approach for lifting invariants to networks of nodes.

We exploit the mechanization to analyse several variants of AODV and show that Isabelle/HOL can re-establish most proof obligations automatically and identify exactly the steps that are no longer valid.

notify = tim@tbrk.org [Show] title = Haskell's Show Class in Isabelle/HOL author = Christian Sternagel , René Thiemann date = 2014-07-29 topic = Computer Science/Functional Programming license = LGPL abstract = We implemented a type class for "to-string" functions, similar to Haskell's Show class. Moreover, we provide instantiations for Isabelle/HOL's standard types like bool, prod, sum, nats, ints, and rats. It is further possible, to automatically derive show functions for arbitrary user defined datatypes similar to Haskell's "deriving Show". extra-history = Change history: [2015-03-11]: Adapted development to new-style (BNF-based) datatypes.
[2015-04-10]: Moved development for old-style datatypes into subdirectory "Old_Datatype".
notify = christian.sternagel@uibk.ac.at, rene.thiemann@uibk.ac.at [Certification_Monads] title = Certification Monads author = Christian Sternagel , René Thiemann date = 2014-10-03 topic = Computer Science/Functional Programming abstract = This entry provides several monads intended for the development of stand-alone certifiers via code generation from Isabelle/HOL. More specifically, there are three flavors of error monads (the sum type, for the case where all monadic functions are total; an instance of the former, the so called check monad, yielding either success without any further information or an error message; as well as a variant of the sum type that accommodates partial functions by providing an explicit bottom element) and a parser monad built on top. All of this monads are heavily used in the IsaFoR/CeTA project which thus provides many examples of their usage. notify = c.sternagel@gmail.com, rene.thiemann@uibk.ac.at [CISC-Kernel] title = Formal Specification of a Generic Separation Kernel author = Freek Verbeek , Sergey Tverdyshev , Oto Havle , Holger Blasum , Bruno Langenstein , Werner Stephan , Yakoub Nemouchi , Abderrahmane Feliachi , Burkhart Wolff , Julien Schmaltz date = 2014-07-18 topic = Computer Science/Security abstract =

Intransitive noninterference has been a widely studied topic in the last few decades. Several well-established methodologies apply interactive theorem proving to formulate a noninterference theorem over abstract academic models. In joint work with several industrial and academic partners throughout Europe, we are helping in the certification process of PikeOS, an industrial separation kernel developed at SYSGO. In this process, established theories could not be applied. We present a new generic model of separation kernels and a new theory of intransitive noninterference. The model is rich in detail, making it suitable for formal verification of realistic and industrial systems such as PikeOS. Using a refinement-based theorem proving approach, we ensure that proofs remain manageable.

This document corresponds to the deliverable D31.1 of the EURO-MILS Project http://www.euromils.eu.

notify = [pGCL] title = pGCL for Isabelle author = David Cock date = 2014-07-13 topic = Computer Science/Programming Languages/Language Definitions abstract =

pGCL is both a programming language and a specification language that incorporates both probabilistic and nondeterministic choice, in a unified manner. Program verification is by refinement or annotation (or both), using either Hoare triples, or weakest-precondition entailment, in the style of GCL.

This package provides both a shallow embedding of the language primitives, and an annotation and refinement framework. The generated document includes a brief tutorial.

notify = [Noninterference_CSP] title = Noninterference Security in Communicating Sequential Processes author = Pasquale Noce date = 2014-05-23 topic = Computer Science/Security abstract =

An extension of classical noninterference security for deterministic state machines, as introduced by Goguen and Meseguer and elegantly formalized by Rushby, to nondeterministic systems should satisfy two fundamental requirements: it should be based on a mathematically precise theory of nondeterminism, and should be equivalent to (or at least not weaker than) the classical notion in the degenerate deterministic case.

This paper proposes a definition of noninterference security applying to Hoare's Communicating Sequential Processes (CSP) in the general case of a possibly intransitive noninterference policy, and proves the equivalence of this security property to classical noninterference security for processes representing deterministic state machines.

Furthermore, McCullough's generalized noninterference security is shown to be weaker than both the proposed notion of CSP noninterference security for a generic process, and classical noninterference security for processes representing deterministic state machines. This renders CSP noninterference security preferable as an extension of classical noninterference security to nondeterministic systems.

notify = pasquale.noce.lavoro@gmail.com [Floyd_Warshall] title = The Floyd-Warshall Algorithm for Shortest Paths author = Simon Wimmer , Peter Lammich topic = Computer Science/Algorithms/Graph date = 2017-05-08 notify = wimmers@in.tum.de abstract = The Floyd-Warshall algorithm [Flo62, Roy59, War62] is a classic dynamic programming algorithm to compute the length of all shortest paths between any two vertices in a graph (i.e. to solve the all-pairs shortest path problem, or APSP for short). Given a representation of the graph as a matrix of weights M, it computes another matrix M' which represents a graph with the same path lengths and contains the length of the shortest path between any two vertices i and j. This is only possible if the graph does not contain any negative cycles. However, in this case the Floyd-Warshall algorithm will detect the situation by calculating a negative diagonal entry. This entry includes a formalization of the algorithm and of these key properties. The algorithm is refined to an efficient imperative version using the Imperative Refinement Framework. [Roy_Floyd_Warshall] title = Transitive closure according to Roy-Floyd-Warshall author = Makarius Wenzel <> date = 2014-05-23 topic = Computer Science/Algorithms/Graph abstract = This formulation of the Roy-Floyd-Warshall algorithm for the transitive closure bypasses matrices and arrays, but uses a more direct mathematical model with adjacency functions for immediate predecessors and successors. This can be implemented efficiently in functional programming languages and is particularly adequate for sparse relations. notify = [GPU_Kernel_PL] title = Syntax and semantics of a GPU kernel programming language author = John Wickerson date = 2014-04-03 topic = Computer Science/Programming Languages/Language Definitions abstract = This document accompanies the article "The Design and Implementation of a Verification Technique for GPU Kernels" by Adam Betts, Nathan Chong, Alastair F. Donaldson, Jeroen Ketema, Shaz Qadeer, Paul Thomson and John Wickerson. It formalises all of the definitions provided in Sections 3 and 4 of the article. notify = [AWN] title = Mechanization of the Algebra for Wireless Networks (AWN) author = Timothy Bourke date = 2014-03-08 topic = Computer Science/Concurrency/Process Calculi abstract =

AWN is a process algebra developed for modelling and analysing protocols for Mobile Ad hoc Networks (MANETs) and Wireless Mesh Networks (WMNs). AWN models comprise five distinct layers: sequential processes, local parallel compositions, nodes, partial networks, and complete networks.

This development mechanises the original operational semantics of AWN and introduces a variant 'open' operational semantics that enables the compositional statement and proof of invariants across distinct network nodes. It supports labels (for weakening invariants) and (abstract) data state manipulations. A framework for compositional invariant proofs is developed, including a tactic (inv_cterms) for inductive invariant proofs of sequential processes, lifting rules for the open versions of the higher layers, and a rule for transferring lifted properties back to the standard semantics. A notion of 'control terms' reduces proof obligations to the subset of subterms that act directly (in contrast to operators for combining terms and joining processes).

notify = tim@tbrk.org [Selection_Heap_Sort] title = Verification of Selection and Heap Sort Using Locales author = Danijela Petrovic date = 2014-02-11 topic = Computer Science/Algorithms abstract = Stepwise program refinement techniques can be used to simplify program verification. Programs are better understood since their main properties are clearly stated, and verification of rather complex algorithms is reduced to proving simple statements connecting successive program specifications. Additionally, it is easy to analyze similar algorithms and to compare their properties within a single formalization. Usually, formal analysis is not done in educational setting due to complexity of verification and a lack of tools and procedures to make comparison easy. Verification of an algorithm should not only give correctness proof, but also better understanding of an algorithm. If the verification is based on small step program refinement, it can become simple enough to be demonstrated within the university-level computer science curriculum. In this paper we demonstrate this and give a formal analysis of two well known algorithms (Selection Sort and Heap Sort) using proof assistant Isabelle/HOL and program refinement techniques. notify = [Real_Impl] title = Implementing field extensions of the form Q[sqrt(b)] author = René Thiemann date = 2014-02-06 license = LGPL topic = Mathematics/Analysis abstract = We apply data refinement to implement the real numbers, where we support all numbers in the field extension Q[sqrt(b)], i.e., all numbers of the form p + q * sqrt(b) for rational numbers p and q and some fixed natural number b. To this end, we also developed algorithms to precisely compute roots of a rational number, and to perform a factorization of natural numbers which eliminates duplicate prime factors.

Our results have been used to certify termination proofs which involve polynomial interpretations over the reals. extra-history = Change history: [2014-07-11]: Moved NthRoot_Impl to Sqrt-Babylonian. notify = rene.thiemann@uibk.ac.at [ShortestPath] title = An Axiomatic Characterization of the Single-Source Shortest Path Problem author = Christine Rizkallah date = 2013-05-22 topic = Mathematics/Graph Theory abstract = This theory is split into two sections. In the first section, we give a formal proof that a well-known axiomatic characterization of the single-source shortest path problem is correct. Namely, we prove that in a directed graph with a non-negative cost function on the edges the single-source shortest path function is the only function that satisfies a set of four axioms. In the second section, we give a formal proof of the correctness of an axiomatic characterization of the single-source shortest path problem for directed graphs with general cost functions. The axioms here are more involved because we have to account for potential negative cycles in the graph. The axioms are summarized in three Isabelle locales. notify = [Launchbury] title = The Correctness of Launchbury's Natural Semantics for Lazy Evaluation author = Joachim Breitner date = 2013-01-31 topic = Computer Science/Programming Languages/Lambda Calculi, Computer Science/Semantics abstract = In his seminal paper "Natural Semantics for Lazy Evaluation", John Launchbury proves his semantics correct with respect to a denotational semantics, and outlines an adequacy proof. We have formalized both semantics and machine-checked the correctness proof, clarifying some details. Furthermore, we provide a new and more direct adequacy proof that does not require intermediate operational semantics. extra-history = Change history: [2014-05-24]: Added the proof of adequacy, as well as simplified and improved the existing proofs. Adjusted abstract accordingly. [2015-03-16]: Booleans and if-then-else added to syntax and semantics, making this entry suitable to be used by the entry "Call_Arity". notify = [Call_Arity] title = The Safety of Call Arity author = Joachim Breitner date = 2015-02-20 topic = Computer Science/Programming Languages/Transformations abstract = We formalize the Call Arity analysis, as implemented in GHC, and prove both functional correctness and, more interestingly, safety (i.e. the transformation does not increase allocation).

We use syntax and the denotational semantics from the entry "Launchbury", where we formalized Launchbury's natural semantics for lazy evaluation.

The functional correctness of Call Arity is proved with regard to that denotational semantics. The operational properties are shown with regard to a small-step semantics akin to Sestoft's mark 1 machine, which we prove to be equivalent to Launchbury's semantics.

We use Christian Urban's Nominal2 package to define our terms and make use of Brian Huffman's HOLCF package for the domain-theoretical aspects of the development. extra-history = Change history: [2015-03-16]: This entry now builds on top of the Launchbury entry, and the equivalency proof of the natural and the small-step semantics was added. notify = [CCS] title = CCS in nominal logic author = Jesper Bengtson date = 2012-05-29 topic = Computer Science/Concurrency/Process Calculi abstract = We formalise a large portion of CCS as described in Milner's book 'Communication and Concurrency' using the nominal datatype package in Isabelle. Our results include many of the standard theorems of bisimulation equivalence and congruence, for both weak and strong versions. One main goal of this formalisation is to keep the machine-checked proofs as close to their pen-and-paper counterpart as possible.

This entry is described in detail in Bengtson's thesis. notify = [Pi_Calculus] title = The pi-calculus in nominal logic author = Jesper Bengtson date = 2012-05-29 topic = Computer Science/Concurrency/Process Calculi abstract = We formalise the pi-calculus using the nominal datatype package, based on ideas from the nominal logic by Pitts et al., and demonstrate an implementation in Isabelle/HOL. The purpose is to derive powerful induction rules for the semantics in order to conduct machine checkable proofs, closely following the intuitive arguments found in manual proofs. In this way we have covered many of the standard theorems of bisimulation equivalence and congruence, both late and early, and both strong and weak in a uniform manner. We thus provide one of the most extensive formalisations of a the pi-calculus ever done inside a theorem prover.

A significant gain in our formulation is that agents are identified up to alpha-equivalence, thereby greatly reducing the arguments about bound names. This is a normal strategy for manual proofs about the pi-calculus, but that kind of hand waving has previously been difficult to incorporate smoothly in an interactive theorem prover. We show how the nominal logic formalism and its support in Isabelle accomplishes this and thus significantly reduces the tedium of conducting completely formal proofs. This improves on previous work using weak higher order abstract syntax since we do not need extra assumptions to filter out exotic terms and can keep all arguments within a familiar first-order logic.

This entry is described in detail in Bengtson's thesis. notify = [Psi_Calculi] title = Psi-calculi in Isabelle author = Jesper Bengtson date = 2012-05-29 topic = Computer Science/Concurrency/Process Calculi abstract = Psi-calculi are extensions of the pi-calculus, accommodating arbitrary nominal datatypes to represent not only data but also communication channels, assertions and conditions, giving it an expressive power beyond the applied pi-calculus and the concurrent constraint pi-calculus.

We have formalised psi-calculi in the interactive theorem prover Isabelle using its nominal datatype package. One distinctive feature is that the framework needs to treat binding sequences, as opposed to single binders, in an efficient way. While different methods for formalising single binder calculi have been proposed over the last decades, representations for such binding sequences are not very well explored.

The main effort in the formalisation is to keep the machine checked proofs as close to their pen-and-paper counterparts as possible. This includes treating all binding sequences as atomic elements, and creating custom induction and inversion rules that to remove the bulk of manual alpha-conversions.

This entry is described in detail in Bengtson's thesis. notify = [Encodability_Process_Calculi] title = Analysing and Comparing Encodability Criteria for Process Calculi author = Kirstin Peters , Rob van Glabbeek date = 2015-08-10 topic = Computer Science/Concurrency/Process Calculi abstract = Encodings or the proof of their absence are the main way to compare process calculi. To analyse the quality of encodings and to rule out trivial or meaningless encodings, they are augmented with quality criteria. There exists a bunch of different criteria and different variants of criteria in order to reason in different settings. This leads to incomparable results. Moreover it is not always clear whether the criteria used to obtain a result in a particular setting do indeed fit to this setting. We show how to formally reason about and compare encodability criteria by mapping them on requirements on a relation between source and target terms that is induced by the encoding function. In particular we analyse the common criteria full abstraction, operational correspondence, divergence reflection, success sensitiveness, and respect of barbs; e.g. we analyse the exact nature of the simulation relation (coupled simulation versus bisimulation) that is induced by different variants of operational correspondence. This way we reduce the problem of analysing or comparing encodability criteria to the better understood problem of comparing relations on processes. notify = kirstin.peters@tu-berlin.de [Circus] title = Isabelle/Circus author = Abderrahmane Feliachi , Burkhart Wolff , Marie-Claude Gaudel contributors = Makarius Wenzel date = 2012-05-27 topic = Computer Science/Concurrency/Process Calculi, Computer Science/System Description Languages abstract = The Circus specification language combines elements for complex data and behavior specifications, using an integration of Z and CSP with a refinement calculus. Its semantics is based on Hoare and He's Unifying Theories of Programming (UTP). Isabelle/Circus is a formalization of the UTP and the Circus language in Isabelle/HOL. It contains proof rules and tactic support that allows for proofs of refinement for Circus processes (involving both data and behavioral aspects).

The Isabelle/Circus environment supports a syntax for the semantic definitions which is close to textbook presentations of Circus. This article contains an extended version of corresponding VSTTE Paper together with the complete formal development of its underlying commented theories. extra-history = Change history: [2014-06-05]: More polishing, shorter proofs, added Circus syntax, added Makarius Wenzel as contributor. notify = [Dijkstra_Shortest_Path] title = Dijkstra's Shortest Path Algorithm author = Benedikt Nordhoff , Peter Lammich topic = Computer Science/Algorithms/Graph date = 2012-01-30 abstract = We implement and prove correct Dijkstra's algorithm for the single source shortest path problem, conceived in 1956 by E. Dijkstra. The algorithm is implemented using the data refinement framework for monadic, nondeterministic programs. An efficient implementation is derived using data structures from the Isabelle Collection Framework. notify = lammich@in.tum.de [Refine_Monadic] title = Refinement for Monadic Programs author = Peter Lammich topic = Computer Science/Programming Languages/Logics date = 2012-01-30 abstract = We provide a framework for program and data refinement in Isabelle/HOL. The framework is based on a nondeterminism-monad with assertions, i.e., the monad carries a set of results or an assertion failure. Recursion is expressed by fixed points. For convenience, we also provide while and foreach combinators.

The framework provides tools to automatize canonical tasks, such as verification condition generation, finding appropriate data refinement relations, and refine an executable program to a form that is accepted by the Isabelle/HOL code generator.

This submission comes with a collection of examples and a user-guide, illustrating the usage of the framework. extra-history = Change history: [2012-04-23] Introduced ordered FOREACH loops
[2012-06] New features: REC_rule_arb and RECT_rule_arb allow for generalizing over variables. prepare_code_thms - command extracts code equations for recursion combinators.
[2012-07] New example: Nested DFS for emptiness check of Buchi-automata with witness.
New feature: fo_rule method to apply resolution using first-order matching. Useful for arg_conf, fun_cong.
[2012-08] Adaptation to ICF v2.
[2012-10-05] Adaptations to include support for Automatic Refinement Framework.
[2013-09] This entry now depends on Automatic Refinement
[2014-06] New feature: vc_solve method to solve verification conditions. Maintenace changes: VCG-rules for nfoldli, improved setup for FOREACH-loops.
[2014-07] Now defining recursion via flat domain. Dropped many single-valued prerequisites. Changed notion of data refinement. In single-valued case, this matches the old notion. In non-single valued case, the new notion allows for more convenient rules. In particular, the new definitions allow for projecting away ghost variables as a refinement step.
[2014-11] New features: le-or-fail relation (leof), modular reasoning about loop invariants. notify = lammich@in.tum.de [Refine_Imperative_HOL] title = The Imperative Refinement Framework author = Peter Lammich notify = lammich@in.tum.de date = 2016-08-08 topic = Computer Science/Programming Languages/Transformations,Computer Science/Data Structures abstract = We present the Imperative Refinement Framework (IRF), a tool that supports a stepwise refinement based approach to imperative programs. This entry is based on the material we presented in [ITP-2015, CPP-2016]. It uses the Monadic Refinement Framework as a frontend for the specification of the abstract programs, and Imperative/HOL as a backend to generate executable imperative programs. The IRF comes with tool support to synthesize imperative programs from more abstract, functional ones, using efficient imperative implementations for the abstract data structures. This entry also includes the Imperative Isabelle Collection Framework (IICF), which provides a library of re-usable imperative collection data structures. Moreover, this entry contains a quickstart guide and a reference manual, which provide an introduction to using the IRF for Isabelle/HOL experts. It also provids a collection of (partly commented) practical examples, some highlights being Dijkstra's Algorithm, Nested-DFS, and a generic worklist algorithm with subsumption. Finally, this entry contains benchmark scripts that compare the runtime of some examples against reference implementations of the algorithms in Java and C++. [ITP-2015] Peter Lammich: Refinement to Imperative/HOL. ITP 2015: 253--269 [CPP-2016] Peter Lammich: Refinement based verification of imperative data structures. CPP 2016: 27--36 [Automatic_Refinement] title = Automatic Data Refinement author = Peter Lammich topic = Computer Science/Programming Languages/Logics date = 2013-10-02 abstract = We present the Autoref tool for Isabelle/HOL, which automatically refines algorithms specified over abstract concepts like maps and sets to algorithms over concrete implementations like red-black-trees, and produces a refinement theorem. It is based on ideas borrowed from relational parametricity due to Reynolds and Wadler. The tool allows for rapid prototyping of verified, executable algorithms. Moreover, it can be configured to fine-tune the result to the user~s needs. Our tool is able to automatically instantiate generic algorithms, which greatly simplifies the implementation of executable data structures.

This AFP-entry provides the basic tool, which is then used by the Refinement and Collection Framework to provide automatic data refinement for the nondeterminism monad and various collection datastructures. notify = lammich@in.tum.de [EdmondsKarp_Maxflow] title = Formalizing the Edmonds-Karp Algorithm author = Peter Lammich , S. Reza Sefidgar<> notify = lammich@in.tum.de date = 2016-08-12 topic = Computer Science/Algorithms/Graph abstract = We present a formalization of the Ford-Fulkerson method for computing the maximum flow in a network. 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. We then use stepwise refinement to obtain the Edmonds-Karp algorithm, and formally prove a bound on its complexity. Further refinement yields a verified implementation, whose execution time compares well to an unverified reference implementation in Java. This entry is based on our ITP-2016 paper with the same title. [VerifyThis2018] title = VerifyThis 2018 - Polished Isabelle Solutions author = Peter Lammich , Simon Wimmer topic = Computer Science/Algorithms date = 2018-04-27 notify = lammich@in.tum.de abstract = VerifyThis 2018 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. [PseudoHoops] title = Pseudo Hoops author = George Georgescu <>, Laurentiu Leustean <>, Viorel Preoteasa topic = Mathematics/Algebra date = 2011-09-22 abstract = Pseudo-hoops are algebraic structures introduced by B. Bosbach under the name of complementary semigroups. In this formalization we prove some properties of pseudo-hoops and we define the basic concepts of filter and normal filter. The lattice of normal filters is isomorphic with the lattice of congruences of a pseudo-hoop. We also study some important classes of pseudo-hoops. Bounded Wajsberg pseudo-hoops are equivalent to pseudo-Wajsberg algebras and bounded basic pseudo-hoops are equivalent to pseudo-BL algebras. Some examples of pseudo-hoops are given in the last section of the formalization. notify = viorel.preoteasa@aalto.fi [MonoBoolTranAlgebra] title = Algebra of Monotonic Boolean Transformers author = Viorel Preoteasa topic = Computer Science/Programming Languages/Logics date = 2011-09-22 abstract = Algebras of imperative programming languages have been successful in reasoning about programs. In general an algebra of programs is an algebraic structure with programs as elements and with program compositions (sequential composition, choice, skip) as algebra operations. Various versions of these algebras were introduced to model partial correctness, total correctness, refinement, demonic choice, and other aspects. We formalize here an algebra which can be used to model total correctness, refinement, demonic and angelic choice. The basic model of this algebra are monotonic Boolean transformers (monotonic functions from a Boolean algebra to itself). notify = viorel.preoteasa@aalto.fi [LatticeProperties] title = Lattice Properties author = Viorel Preoteasa topic = Mathematics/Order date = 2011-09-22 abstract = This formalization introduces and collects some algebraic structures based on lattices and complete lattices for use in other developments. The structures introduced are modular, and lattice ordered groups. In addition to the results proved for the new lattices, this formalization also introduces theorems about latices and complete lattices in general. extra-history = Change history: [2012-01-05]: Removed the theory about distributive complete lattices which is in the standard library now. Added a theory about well founded and transitive relations and a result about fixpoints in complete lattices and well founded relations. Moved the results about conjunctive and disjunctive functions to a new theory. Removed the syntactic classes for inf and sup which are in the standard library now. notify = viorel.preoteasa@aalto.fi [Impossible_Geometry] title = Proving the Impossibility of Trisecting an Angle and Doubling the Cube author = Ralph Romanos , Lawrence C. Paulson topic = Mathematics/Algebra, Mathematics/Geometry date = 2012-08-05 abstract = Squaring the circle, doubling the cube and trisecting an angle, using a compass and straightedge alone, are classic unsolved problems first posed by the ancient Greeks. All three problems were proved to be impossible in the 19th century. The following document presents the proof of the impossibility of solving the latter two problems using Isabelle/HOL, following a proof by Carrega. The proof uses elementary methods: no Galois theory or field extensions. The set of points constructible using a compass and straightedge is defined inductively. Radical expressions, which involve only square roots and arithmetic of rational numbers, are defined, and we find that all constructive points have radical coordinates. Finally, doubling the cube and trisecting certain angles requires solving certain cubic equations that can be proved to have no rational roots. The Isabelle proofs require a great many detailed calculations. notify = ralph.romanos@student.ecp.fr, lp15@cam.ac.uk [IP_Addresses] title = IP Addresses author = Cornelius Diekmann , Julius Michaelis , Lars Hupel notify = diekmann@net.in.tum.de date = 2016-06-28 topic = Computer Science/Networks abstract = This entry contains a definition of IP addresses and a library to work with them. Generic IP addresses are modeled as machine words of arbitrary length. Derived from this generic definition, IPv4 addresses are 32bit machine words, IPv6 addresses are 128bit words. Additionally, IPv4 addresses can be represented in dot-decimal notation and IPv6 addresses in (compressed) colon-separated notation. We support toString functions and parsers for both notations. Sets of IP addresses can be represented with a netmask (e.g. 192.168.0.0/255.255.0.0) or in CIDR notation (e.g. 192.168.0.0/16). To provide executable code for set operations on IP address ranges, the library includes a datatype to work on arbitrary intervals of machine words. [Simple_Firewall] title = Simple Firewall author = Cornelius Diekmann , Julius Michaelis , Maximilian Haslbeck notify = diekmann@net.in.tum.de, max.haslbeck@gmx.de date = 2016-08-24 topic = Computer Science/Networks abstract = We present a simple model of a firewall. The firewall can accept or drop a packet and can match on interfaces, IP addresses, protocol, and ports. It was designed to feature nice mathematical properties: The type of match expressions was carefully crafted such that the conjunction of two match expressions is only one match expression. This model is too simplistic to mirror all aspects of the real world. In the upcoming entry "Iptables Semantics", we will translate the Linux firewall iptables to this model. For a fixed service (e.g. ssh, http), we provide an algorithm to compute an overview of the firewall's filtering behavior. The algorithm computes minimal service matrices, i.e. graphs which partition the complete IPv4 and IPv6 address space and visualize the allowed accesses between partitions. For a detailed description, see Verified iptables Firewall Analysis, IFIP Networking 2016. [Iptables_Semantics] title = Iptables Semantics author = Cornelius Diekmann , Lars Hupel notify = diekmann@net.in.tum.de, hupel@in.tum.de date = 2016-09-09 topic = Computer Science/Networks abstract = We present a big step semantics of the filtering behavior of the Linux/netfilter iptables firewall. We provide algorithms to simplify complex iptables rulests to a simple firewall model (c.f. AFP entry Simple_Firewall) and to verify spoofing protection of a ruleset. Internally, we embed our semantics into ternary logic, ultimately supporting every iptables match condition by abstracting over unknowns. Using this AFP entry and all entries it depends on, we created an easy-to-use, stand-alone haskell tool called fffuu. The tool does not require any input —except for the iptables-save dump of the analyzed firewall— and presents interesting results about the user's ruleset. Real-Word firewall errors have been uncovered, and the correctness of rulesets has been proved, with the help of our tool. [Routing] title = Routing author = Julius Michaelis , Cornelius Diekmann notify = afp@liftm.de date = 2016-08-31 topic = Computer Science/Networks abstract = This entry contains definitions for routing with routing tables/longest prefix matching. A routing table entry is modelled as a record of a prefix match, a metric, an output port, and an optional next hop. A routing table is a list of entries, sorted by prefix length and metric. Additionally, a parser and serializer for the output of the ip-route command, a function to create a relation from output port to corresponding destination IP space, and a model of a Linux-style router are included. [KBPs] title = Knowledge-based programs author = Peter Gammie topic = Computer Science/Automata and Formal Languages date = 2011-05-17 abstract = Knowledge-based programs (KBPs) are a formalism for directly relating agents' knowledge and behaviour. Here we present a general scheme for compiling KBPs to executable automata with a proof of correctness in Isabelle/HOL. We develop the algorithm top-down, using Isabelle's locale mechanism to structure these proofs, and show that two classic examples can be synthesised using Isabelle's code generator. extra-history = Change history: [2012-03-06]: Add some more views and revive the code generation. notify = kleing@cse.unsw.edu.au [Tarskis_Geometry] title = The independence of Tarski's Euclidean axiom author = T. J. M. Makarios topic = Mathematics/Geometry date = 2012-10-30 abstract = Tarski's axioms of plane geometry are formalized and, using the standard real Cartesian model, shown to be consistent. A substantial theory of the projective plane is developed. Building on this theory, the Klein-Beltrami model of the hyperbolic plane is defined and shown to satisfy all of Tarski's axioms except his Euclidean axiom; thus Tarski's Euclidean axiom is shown to be independent of his other axioms of plane geometry.

An earlier version of this work was the subject of the author's MSc thesis, which contains natural-language explanations of some of the more interesting proofs. notify = tjm1983@gmail.com [General-Triangle] title = The General Triangle Is Unique author = Joachim Breitner topic = Mathematics/Geometry date = 2011-04-01 abstract = Some acute-angled triangles are special, e.g. right-angled or isoscele triangles. Some are not of this kind, but, without measuring angles, look as if they were. In that sense, there is exactly one general triangle. This well-known fact is proven here formally. notify = mail@joachim-breitner.de [LightweightJava] title = Lightweight Java author = Rok Strniša , Matthew Parkinson topic = Computer Science/Programming Languages/Language Definitions date = 2011-02-07 abstract = A fully-formalized and extensible minimal imperative fragment of Java. notify = rok@strnisa.com [Lower_Semicontinuous] title = Lower Semicontinuous Functions author = Bogdan Grechuk topic = Mathematics/Analysis date = 2011-01-08 abstract = We define the notions of lower and upper semicontinuity for functions from a metric space to the extended real line. We prove that a function is both lower and upper semicontinuous if and only if it is continuous. We also give several equivalent characterizations of lower semicontinuity. In particular, we prove that a function is lower semicontinuous if and only if its epigraph is a closed set. Also, we introduce the notion of the lower semicontinuous hull of an arbitrary function and prove its basic properties. notify = hoelzl@in.tum.de [RIPEMD-160-SPARK] title = RIPEMD-160 author = Fabian Immler topic = Computer Science/Programming Languages/Static Analysis date = 2011-01-10 abstract = This work presents a verification of an implementation in SPARK/ADA of the cryptographic hash-function RIPEMD-160. A functional specification of RIPEMD-160 is given in Isabelle/HOL. Proofs for the verification conditions generated by the static-analysis toolset of SPARK certify the functional correctness of the implementation. extra-history = Change history: [2015-11-09]: Entry is now obsolete, moved to Isabelle distribution. notify = immler@in.tum.de [Regular-Sets] title = Regular Sets and Expressions author = Alexander Krauss , Tobias Nipkow contributors = Manuel Eberl topic = Computer Science/Automata and Formal Languages date = 2010-05-12 abstract = This is a library of constructions on regular expressions and languages. It provides the operations of concatenation, Kleene star and derivative on languages. Regular expressions and their meaning are defined. An executable equivalence checker for regular expressions is verified; it does not need automata but works directly on regular expressions. By mapping regular expressions to binary relations, an automatic and complete proof method for (in)equalities of binary relations over union, concatenation and (reflexive) transitive closure is obtained.

Extended regular expressions with complement and intersection are also defined and an equivalence checker is provided. extra-history = Change history: [2011-08-26]: Christian Urban added a theory about derivatives and partial derivatives of regular expressions
[2012-05-10]: Tobias Nipkow added extended regular expressions
[2012-05-10]: Tobias Nipkow added equivalence checking with partial derivatives notify = nipkow@in.tum.de, krauss@in.tum.de, christian.urban@kcl.ac.uk [Regex_Equivalence] title = Unified Decision Procedures for Regular Expression Equivalence author = Tobias Nipkow , Dmitriy Traytel topic = Computer Science/Automata and Formal Languages date = 2014-01-30 abstract = We formalize a unified framework for verified decision procedures for regular expression equivalence. Five recently published formalizations of such decision procedures (three based on derivatives, two on marked regular expressions) can be obtained as instances of the framework. We discover that the two approaches based on marked regular expressions, which were previously thought to be the same, are different, and one seems to produce uniformly smaller automata. The common framework makes it possible to compare the performance of the different decision procedures in a meaningful way. The formalization is described in a paper of the same name presented at Interactive Theorem Proving 2014. notify = nipkow@in.tum.de, traytel@in.tum.de [MSO_Regex_Equivalence] title = Decision Procedures for MSO on Words Based on Derivatives of Regular Expressions author = Dmitriy Traytel , Tobias Nipkow topic = Computer Science/Automata and Formal Languages, Logic date = 2014-06-12 abstract = Monadic second-order logic on finite words (MSO) is a decidable yet expressive logic into which many decision problems can be encoded. Since MSO formulas correspond to regular languages, equivalence of MSO formulas can be reduced to the equivalence of some regular structures (e.g. automata). We verify an executable decision procedure for MSO formulas that is not based on automata but on regular expressions.

Decision procedures for regular expression equivalence have been formalized before, usually based on Brzozowski derivatives. Yet, for a straightforward embedding of MSO formulas into regular expressions an extension of regular expressions with a projection operation is required. We prove total correctness and completeness of an equivalence checker for regular expressions extended in that way. We also define a language-preserving translation of formulas into regular expressions with respect to two different semantics of MSO.

The formalization is described in this ICFP 2013 functional pearl. notify = traytel@in.tum.de, nipkow@in.tum.de [Formula_Derivatives] title = Derivatives of Logical Formulas author = Dmitriy Traytel topic = Computer Science/Automata and Formal Languages, Logic date = 2015-05-28 abstract = We formalize new decision procedures for WS1S, M2L(Str), and Presburger Arithmetics. Formulas of these logics denote regular languages. Unlike traditional decision procedures, we do not translate formulas into automata (nor into regular expressions), at least not explicitly. Instead we devise notions of derivatives (inspired by Brzozowski derivatives for regular expressions) that operate on formulas directly and compute a syntactic bisimulation using these derivatives. The treatment of Boolean connectives and quantifiers is uniform for all mentioned logics and is abstracted into a locale. This locale is then instantiated by different atomic formulas and their derivatives (which may differ even for the same logic under different encodings of interpretations as formal words).

The WS1S instance is described in the draft paper A Coalgebraic Decision Procedure for WS1S by the author. notify = traytel@in.tum.de [Myhill-Nerode] title = The Myhill-Nerode Theorem Based on Regular Expressions author = Chunhan Wu <>, Xingyuan Zhang <>, Christian Urban contributors = Manuel Eberl topic = Computer Science/Automata and Formal Languages date = 2011-08-26 abstract = There are many proofs of the Myhill-Nerode theorem using automata. In this library we give a proof entirely based on regular expressions, since regularity of languages can be conveniently defined using regular expressions (it is more painful in HOL to define regularity in terms of automata). We prove the first direction of the Myhill-Nerode theorem by solving equational systems that involve regular expressions. For the second direction we give two proofs: one using tagging-functions and another using partial derivatives. We also establish various closure properties of regular languages. Most details of the theories are described in our ITP 2011 paper. notify = christian.urban@kcl.ac.uk [Universal_Turing_Machine] title = Universal Turing Machine author = Jian Xu<>, Xingyuan Zhang<>, Christian Urban , Sebastiaan J. C. Joosten topic = Logic, Computer Science/Automata and Formal Languages date = 2019-02-08 notify = sjcjoosten@gmail.com, christian.urban@kcl.ac.uk abstract = We formalise results from computability theory: recursive functions, undecidability of the halting problem, and the existence of a universal Turing machine. This formalisation is the AFP entry corresponding to the paper Mechanising Turing Machines and Computability Theory in Isabelle/HOL, ITP 2013. [CYK] title = A formalisation of the Cocke-Younger-Kasami algorithm author = Maksym Bortin date = 2016-04-27 topic = Computer Science/Algorithms, Computer Science/Automata and Formal Languages abstract = The theory provides a formalisation of the Cocke-Younger-Kasami algorithm (CYK for short), an approach to solving the word problem for context-free languages. CYK decides if a word is in the languages generated by a context-free grammar in Chomsky normal form. The formalized algorithm is executable. notify = maksym.bortin@nicta.com.au [Boolean_Expression_Checkers] title = Boolean Expression Checkers author = Tobias Nipkow date = 2014-06-08 topic = Computer Science/Algorithms, Logic abstract = This entry provides executable checkers for the following properties of boolean expressions: satisfiability, tautology and equivalence. Internally, the checkers operate on binary decision trees and are reasonably efficient (for purely functional algorithms). extra-history = Change history: [2015-09-23]: Salomon Sickert added an interface that does not require the usage of the Boolean formula datatype. Furthermore the general Mapping type is used instead of an association list. notify = nipkow@in.tum.de [Presburger-Automata] title = Formalizing the Logic-Automaton Connection author = Stefan Berghofer , Markus Reiter <> date = 2009-12-03 topic = Computer Science/Automata and Formal Languages, Logic abstract = This work presents a formalization of a library for automata on bit strings. It forms the basis of a reflection-based decision procedure for Presburger arithmetic, which is efficiently executable thanks to Isabelle's code generator. With this work, we therefore provide a mechanized proof of a well-known connection between logic and automata theory. The formalization is also described in a publication [TPHOLs 2009]. notify = berghofe@in.tum.de [Functional-Automata] title = Functional Automata author = Tobias Nipkow date = 2004-03-30 topic = Computer Science/Automata and Formal Languages abstract = This theory defines deterministic and nondeterministic automata in a functional representation: the transition function/relation and the finality predicate are just functions. Hence the state space may be infinite. It is shown how to convert regular expressions into such automata. A scanner (generator) is implemented with the help of functional automata: the scanner chops the input up into longest recognized substrings. Finally we also show how to convert a certain subclass of functional automata (essentially the finite deterministic ones) into regular sets. notify = nipkow@in.tum.de [Statecharts] title = Formalizing Statecharts using Hierarchical Automata author = Steffen Helke , Florian Kammüller topic = Computer Science/Automata and Formal Languages date = 2010-08-08 abstract = We formalize in Isabelle/HOL the abtract syntax and a synchronous step semantics for the specification language Statecharts. The formalization is based on Hierarchical Automata which allow a structural decomposition of Statecharts into Sequential Automata. To support the composition of Statecharts, we introduce calculating operators to construct a Hierarchical Automaton in a stepwise manner. Furthermore, we present a complete semantics of Statecharts including a theory of data spaces, which enables the modelling of racing effects. We also adapt CTL for Statecharts to build a bridge for future combinations with model checking. However the main motivation of this work is to provide a sound and complete basis for reasoning on Statecharts. As a central meta theorem we prove that the well-formedness of a Statechart is preserved by the semantics. notify = nipkow@in.tum.de [Stuttering_Equivalence] title = Stuttering Equivalence author = Stephan Merz topic = Computer Science/Automata and Formal Languages date = 2012-05-07 abstract =

Two omega-sequences are stuttering equivalent if they differ only by finite repetitions of elements. Stuttering equivalence is a fundamental concept in the theory of concurrent and distributed systems. Notably, Lamport argues that refinement notions for such systems should be insensitive to finite stuttering. Peled and Wilke showed that all PLTL (propositional linear-time temporal logic) properties that are insensitive to stuttering equivalence can be expressed without the next-time operator. Stuttering equivalence is also important for certain verification techniques such as partial-order reduction for model checking.

We formalize stuttering equivalence in Isabelle/HOL. Our development relies on the notion of stuttering sampling functions that may skip blocks of identical sequence elements. We also encode PLTL and prove the theorem due to Peled and Wilke.

extra-history = Change history: [2013-01-31]: Added encoding of PLTL and proved Peled and Wilke's theorem. Adjusted abstract accordingly. notify = Stephan.Merz@loria.fr [Coinductive_Languages] title = A Codatatype of Formal Languages author = Dmitriy Traytel topic = Computer Science/Automata and Formal Languages date = 2013-11-15 abstract =

We define formal languages as a codataype of infinite trees branching over the alphabet. Each node in such a tree indicates whether the path to this node constitutes a word inside or outside of the language. This codatatype is isormorphic to the set of lists representation of languages, but caters for definitions by corecursion and proofs by coinduction.

Regular operations on languages are then defined by primitive corecursion. A difficulty arises here, since the standard definitions of concatenation and iteration from the coalgebraic literature are not primitively corecursive-they require guardedness up-to union/concatenation. Without support for up-to corecursion, these operation must be defined as a composition of primitive ones (and proved being equal to the standard definitions). As an exercise in coinduction we also prove the axioms of Kleene algebra for the defined regular operations.

Furthermore, a language for context-free grammars given by productions in Greibach normal form and an initial nonterminal is constructed by primitive corecursion, yielding an executable decision procedure for the word problem without further ado.

notify = traytel@in.tum.de [Tree-Automata] title = Tree Automata author = Peter Lammich date = 2009-11-25 topic = Computer Science/Automata and Formal Languages abstract = This work presents a machine-checked tree automata library for Standard-ML, OCaml and Haskell. The algorithms are efficient by using appropriate data structures like RB-trees. The available algorithms for non-deterministic automata include membership query, reduction, intersection, union, and emptiness check with computation of a witness for non-emptiness. The executable algorithms are derived from less-concrete, non-executable algorithms using data-refinement techniques. The concrete data structures are from the Isabelle Collections Framework. Moreover, this work contains a formalization of the class of tree-regular languages and its closure properties under set operations. notify = peter.lammich@uni-muenster.de, nipkow@in.tum.de [Depth-First-Search] title = Depth First Search author = Toshiaki Nishihara <>, Yasuhiko Minamide <> date = 2004-06-24 topic = Computer Science/Algorithms/Graph abstract = Depth-first search of a graph is formalized with recdef. It is shown that it visits all of the reachable nodes from a given list of nodes. Executable ML code of depth-first search is obtained using the code generation feature of Isabelle/HOL. notify = lp15@cam.ac.uk, krauss@in.tum.de [FFT] title = Fast Fourier Transform author = Clemens Ballarin date = 2005-10-12 topic = Computer Science/Algorithms/Mathematical abstract = We formalise a functional implementation of the FFT algorithm over the complex numbers, and its inverse. Both are shown equivalent to the usual definitions of these operations through Vandermonde matrices. They are also shown to be inverse to each other, more precisely, that composition of the inverse and the transformation yield the identity up to a scalar. notify = ballarin@in.tum.de [Gauss-Jordan-Elim-Fun] title = Gauss-Jordan Elimination for Matrices Represented as Functions author = Tobias Nipkow date = 2011-08-19 topic = Computer Science/Algorithms/Mathematical, Mathematics/Algebra abstract = This theory provides a compact formulation of Gauss-Jordan elimination for matrices represented as functions. Its distinctive feature is succinctness. It is not meant for large computations. notify = nipkow@in.tum.de [UpDown_Scheme] title = Verification of the UpDown Scheme author = Johannes Hölzl date = 2015-01-28 topic = Computer Science/Algorithms/Mathematical abstract = The UpDown scheme is a recursive scheme used to compute the stiffness matrix on a special form of sparse grids. Usually, when discretizing a Euclidean space of dimension d we need O(n^d) points, for n points along each dimension. Sparse grids are a hierarchical representation where the number of points is reduced to O(n * log(n)^d). One disadvantage of such sparse grids is that the algorithm now operate recursively in the dimensions and levels of the sparse grid.

The UpDown scheme allows us to compute the stiffness matrix on such a sparse grid. The stiffness matrix represents the influence of each representation function on the L^2 scalar product. For a detailed description see Dirk Pflüger's PhD thesis. This formalization was developed as an interdisciplinary project (IDP) at the Technische Universität München. notify = hoelzl@in.tum.de [GraphMarkingIBP] title = Verification of the Deutsch-Schorr-Waite Graph Marking Algorithm using Data Refinement author = Viorel Preoteasa , Ralph-Johan Back date = 2010-05-28 topic = Computer Science/Algorithms/Graph abstract = The verification of the Deutsch-Schorr-Waite graph marking algorithm is used as a benchmark in many formalizations of pointer programs. The main purpose of this mechanization is to show how data refinement of invariant based programs can be used in verifying practical algorithms. The verification starts with an abstract algorithm working on a graph given by a relation next on nodes. Gradually the abstract program is refined into Deutsch-Schorr-Waite graph marking algorithm where only one bit per graph node of additional memory is used for marking. extra-history = Change history: [2012-01-05]: Updated for the new definition of data refinement and the new syntax for demonic and angelic update statements notify = viorel.preoteasa@aalto.fi [Efficient-Mergesort] title = Efficient Mergesort topic = Computer Science/Algorithms date = 2011-11-09 author = Christian Sternagel abstract = We provide a formalization of the mergesort algorithm as used in GHC's Data.List module, proving correctness and stability. Furthermore, experimental data suggests that generated (Haskell-)code for this algorithm is much faster than for previous algorithms available in the Isabelle distribution. extra-history = Change history: [2012-10-24]: Added reference to journal article.
[2018-09-17]: Added theory Efficient_Mergesort that works exclusively with the mutual induction schemas generated by the function package.
[2018-09-19]: Added theory Mergesort_Complexity that proves an upper bound on the number of comparisons that are required by mergesort.
[2018-09-19]: Theory Efficient_Mergesort replaces theory Efficient_Sort but keeping the old name Efficient_Sort. notify = c.sternagel@gmail.com [SATSolverVerification] title = Formal Verification of Modern SAT Solvers author = Filip Marić date = 2008-07-23 topic = Computer Science/Algorithms abstract = This document contains formal correctness proofs of modern SAT solvers. Following (Krstic et al, 2007) and (Nieuwenhuis et al., 2006), solvers are described using state-transition systems. Several different SAT solver descriptions are given and their partial correctness and termination is proved. These include:

  • a solver based on classical DPLL procedure (using only a backtrack-search with unit propagation),
  • a very general solver with backjumping and learning (similar to the description given in (Nieuwenhuis et al., 2006)), and
  • a solver with a specific conflict analysis algorithm (similar to the description given in (Krstic et al., 2007)).
Within the SAT solver correctness proofs, a large number of lemmas about propositional logic and CNF formulae are proved. This theory is self-contained and could be used for further exploring of properties of CNF based SAT algorithms. notify = [Transitive-Closure] title = Executable Transitive Closures of Finite Relations topic = Computer Science/Algorithms/Graph date = 2011-03-14 author = Christian Sternagel , René Thiemann license = LGPL abstract = We provide a generic work-list algorithm to compute the transitive closure of finite relations where only successors of newly detected states are generated. This algorithm is then instantiated for lists over arbitrary carriers and red black trees (which are faster but require a linear order on the carrier), respectively. Our formalization was performed as part of the IsaFoR/CeTA project where reflexive transitive closures of large tree automata have to be computed. extra-history = Change history: [2014-09-04] added example simprocs in Finite_Transitive_Closure_Simprocs notify = c.sternagel@gmail.com, rene.thiemann@uibk.ac.at [Transitive-Closure-II] title = Executable Transitive Closures topic = Computer Science/Algorithms/Graph date = 2012-02-29 author = René Thiemann license = LGPL abstract =

We provide a generic work-list algorithm to compute the (reflexive-)transitive closure of relations where only successors of newly detected states are generated. In contrast to our previous work, the relations do not have to be finite, but each element must only have finitely many (indirect) successors. Moreover, a subsumption relation can be used instead of pure equality. An executable variant of the algorithm is available where the generic operations are instantiated with list operations.

This formalization was performed as part of the IsaFoR/CeTA project, and it has been used to certify size-change termination proofs where large transitive closures have to be computed.

notify = rene.thiemann@uibk.ac.at [MuchAdoAboutTwo] title = Much Ado About Two author = Sascha Böhme date = 2007-11-06 topic = Computer Science/Algorithms abstract = This article is an Isabelle formalisation of a paper with the same title. In a similar way as Knuth's 0-1-principle for sorting algorithms, that paper develops a 0-1-2-principle for parallel prefix computations. notify = boehmes@in.tum.de [DiskPaxos] title = Proving the Correctness of Disk Paxos date = 2005-06-22 author = Mauro Jaskelioff , Stephan Merz topic = Computer Science/Algorithms/Distributed abstract = Disk Paxos is an algorithm for building arbitrary fault-tolerant distributed systems. The specification of Disk Paxos has been proved correct informally and tested using the TLC model checker, but up to now, it has never been fully formally verified. In this work we have formally verified its correctness using the Isabelle theorem prover and the HOL logic system, showing that Isabelle is a practical tool for verifying properties of TLA+ specifications. notify = kleing@cse.unsw.edu.au [GenClock] title = Formalization of a Generalized Protocol for Clock Synchronization author = Alwen Tiu date = 2005-06-24 topic = Computer Science/Algorithms/Distributed abstract = We formalize the generalized Byzantine fault-tolerant clock synchronization protocol of Schneider. This protocol abstracts from particular algorithms or implementations for clock synchronization. This abstraction includes several assumptions on the behaviors of physical clocks and on general properties of concrete algorithms/implementations. Based on these assumptions the correctness of the protocol is proved by Schneider. His proof was later verified by Shankar using the theorem prover EHDM (precursor to PVS). Our formalization in Isabelle/HOL is based on Shankar's formalization. notify = kleing@cse.unsw.edu.au [ClockSynchInst] title = Instances of Schneider's generalized protocol of clock synchronization author = Damián Barsotti date = 2006-03-15 topic = Computer Science/Algorithms/Distributed abstract = F. B. Schneider ("Understanding protocols for Byzantine clock synchronization") generalizes a number of protocols for Byzantine fault-tolerant clock synchronization and presents a uniform proof for their correctness. In Schneider's schema, each processor maintains a local clock by periodically adjusting each value to one computed by a convergence function applied to the readings of all the clocks. Then, correctness of an algorithm, i.e. that the readings of two clocks at any time are within a fixed bound of each other, is based upon some conditions on the convergence function. To prove that a particular clock synchronization algorithm is correct it suffices to show that the convergence function used by the algorithm meets Schneider's conditions. Using the theorem prover Isabelle, we formalize the proofs that the convergence functions of two algorithms, namely, the Interactive Convergence Algorithm (ICA) of Lamport and Melliar-Smith and the Fault-tolerant Midpoint algorithm of Lundelius-Lynch, meet Schneider's conditions. Furthermore, we experiment on handling some parts of the proofs with fully automatic tools like ICS and CVC-lite. These theories are part of a joint work with Alwen Tiu and Leonor P. Nieto "Verification of Clock Synchronization Algorithms: Experiments on a combination of deductive tools" in proceedings of AVOCS 2005. In this work the correctness of Schneider schema was also verified using Isabelle (entry GenClock in AFP). notify = kleing@cse.unsw.edu.au [Heard_Of] title = Verifying Fault-Tolerant Distributed Algorithms in the Heard-Of Model date = 2012-07-27 author = Henri Debrat , Stephan Merz topic = Computer Science/Algorithms/Distributed abstract = Distributed computing is inherently based on replication, promising increased tolerance to failures of individual computing nodes or communication channels. Realizing this promise, however, involves quite subtle algorithmic mechanisms, and requires precise statements about the kinds and numbers of faults that an algorithm tolerates (such as process crashes, communication faults or corrupted values). The landmark theorem due to Fischer, Lynch, and Paterson shows that it is impossible to achieve Consensus among N asynchronously communicating nodes in the presence of even a single permanent failure. Existing solutions must rely on assumptions of "partial synchrony".

Indeed, there have been numerous misunderstandings on what exactly a given algorithm is supposed to realize in what kinds of environments. Moreover, the abundance of subtly different computational models complicates comparisons between different algorithms. Charron-Bost and Schiper introduced the Heard-Of model for representing algorithms and failure assumptions in a uniform framework, simplifying comparisons between algorithms.

In this contribution, we represent the Heard-Of model in Isabelle/HOL. We define two semantics of runs of algorithms with different unit of atomicity and relate these through a reduction theorem that allows us to verify algorithms in the coarse-grained semantics (where proofs are easier) and infer their correctness for the fine-grained one (which corresponds to actual executions). We instantiate the framework by verifying six Consensus algorithms that differ in the underlying algorithmic mechanisms and the kinds of faults they tolerate. notify = Stephan.Merz@loria.fr [Consensus_Refined] title = Consensus Refined date = 2015-03-18 author = Ognjen Maric <>, Christoph Sprenger topic = Computer Science/Algorithms/Distributed abstract = Algorithms for solving the consensus problem are fundamental to distributed computing. Despite their brevity, their ability to operate in concurrent, asynchronous and failure-prone environments comes at the cost of complex and subtle behaviors. Accordingly, understanding how they work and proving their correctness is a non-trivial endeavor where abstraction is immensely helpful. Moreover, research on consensus has yielded a large number of algorithms, many of which appear to share common algorithmic ideas. A natural question is whether and how these similarities can be distilled and described in a precise, unified way. In this work, we combine stepwise refinement and lockstep models to provide an abstract and unified view of a sizeable family of consensus algorithms. Our models provide insights into the design choices underlying the different algorithms, and classify them based on those choices. notify = sprenger@inf.ethz.ch [Key_Agreement_Strong_Adversaries] title = Refining Authenticated Key Agreement with Strong Adversaries author = Joseph Lallemand , Christoph Sprenger topic = Computer Science/Security license = LGPL date = 2017-01-31 notify = joseph.lallemand@loria.fr, sprenger@inf.ethz.ch abstract = 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. [Security_Protocol_Refinement] title = Developing Security Protocols by Refinement author = Christoph Sprenger , Ivano Somaini<> topic = Computer Science/Security license = LGPL date = 2017-05-24 notify = sprenger@inf.ethz.ch abstract = We propose a development method for security protocols based on stepwise refinement. Our refinement strategy transforms abstract security goals into protocols that are secure when operating over an insecure channel controlled by a Dolev-Yao-style intruder. As intermediate levels of abstraction, we employ messageless guard protocols and channel protocols communicating over channels with security properties. These abstractions provide insights on why protocols are secure and foster the development of families of protocols sharing common structure and properties. We have implemented our method in Isabelle/HOL and used it to develop different entity authentication and key establishment protocols, including realistic features such as key confirmation, replay caches, and encrypted tickets. Our development highlights that guard protocols and channel protocols provide fundamental abstractions for bridging the gap between security properties and standard protocol descriptions based on cryptographic messages. It also shows that our refinement approach scales to protocols of nontrivial size and complexity. [Abortable_Linearizable_Modules] title = Abortable Linearizable Modules author = Rachid Guerraoui , Viktor Kuncak , Giuliano Losa date = 2012-03-01 topic = Computer Science/Algorithms/Distributed abstract = We define the Abortable Linearizable Module automaton (ALM for short) and prove its key composition property using the IOA theory of HOLCF. The ALM is at the heart of the Speculative Linearizability framework. This framework simplifies devising correct speculative algorithms by enabling their decomposition into independent modules that can be analyzed and proved correct in isolation. It is particularly useful when working in a distributed environment, where the need to tolerate faults and asynchrony has made current monolithic protocols so intricate that it is no longer tractable to check their correctness. Our theory contains a typical example of a refinement proof in the I/O-automata framework of Lynch and Tuttle. notify = giuliano@losa.fr, nipkow@in.tum.de [Amortized_Complexity] title = Amortized Complexity Verified author = Tobias Nipkow date = 2014-07-07 topic = Computer Science/Data Structures abstract = A framework for the analysis of the amortized complexity of functional data structures is formalized in Isabelle/HOL and applied to a number of standard examples and to the folowing non-trivial ones: skew heaps, splay trees, splay heaps and pairing heaps.

A preliminary version of this work (without pairing heaps) is described in a paper published in the proceedings of the conference on Interactive Theorem Proving ITP 2015. An extended version of this publication is available here. extra-history = Change history: [2015-03-17]: Added pairing heaps by Hauke Brinkop.
[2016-07-12]: Moved splay heaps from here to Splay_Tree
[2016-07-14]: Moved pairing heaps from here to the new Pairing_Heap notify = nipkow@in.tum.de [Dynamic_Tables] title = Parameterized Dynamic Tables author = Tobias Nipkow date = 2015-06-07 topic = Computer Science/Data Structures abstract = This article formalizes the amortized analysis of dynamic tables parameterized with their minimal and maximal load factors and the expansion and contraction factors.

A full description is found in a companion paper. notify = nipkow@in.tum.de [AVL-Trees] title = AVL Trees author = Tobias Nipkow , Cornelia Pusch <> date = 2004-03-19 topic = Computer Science/Data Structures abstract = Two formalizations of AVL trees with room for extensions. The first formalization is monolithic and shorter, the second one in two stages, longer and a bit simpler. The final implementation is the same. If you are interested in developing this further, please contact gerwin.klein@nicta.com.au. extra-history = Change history: [2011-04-11]: Ondrej Kuncar added delete function notify = kleing@cse.unsw.edu.au [BDD] title = BDD Normalisation author = Veronika Ortner <>, Norbert Schirmer <> date = 2008-02-29 topic = Computer Science/Data Structures abstract = We present the verification of the normalisation of a binary decision diagram (BDD). The normalisation follows the original algorithm presented by Bryant in 1986 and transforms an ordered BDD in a reduced, ordered and shared BDD. The verification is based on Hoare logics. notify = kleing@cse.unsw.edu.au, norbert.schirmer@web.de [BinarySearchTree] title = Binary Search Trees author = Viktor Kuncak date = 2004-04-05 topic = Computer Science/Data Structures abstract = The correctness is shown of binary search tree operations (lookup, insert and remove) implementing a set. Two versions are given, for both structured and linear (tactic-style) proofs. An implementation of integer-indexed maps is also verified. notify = lp15@cam.ac.uk [Splay_Tree] title = Splay Tree author = Tobias Nipkow notify = nipkow@in.tum.de date = 2014-08-12 topic = Computer Science/Data Structures abstract = Splay trees are self-adjusting binary search trees which were invented by Sleator and Tarjan [JACM 1985]. This entry provides executable and verified functional splay trees as well as the related splay heaps (due to Okasaki).

The amortized complexity of splay trees and heaps is analyzed in the AFP entry Amortized Complexity. extra-history = Change history: [2016-07-12]: Moved splay heaps here from Amortized_Complexity [Root_Balanced_Tree] title = Root-Balanced Tree author = Tobias Nipkow notify = nipkow@in.tum.de date = 2017-08-20 topic = Computer Science/Data Structures abstract =

Andersson introduced general balanced trees, 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 root-balanced trees. Using a lightweight model of execution time, amortized logarithmic complexity is verified in the theorem prover Isabelle.

This is the Isabelle formalization of the material decribed in the APLAS 2017 article Verified Root-Balanced Trees by the same author, which also presents experimental results that show competitiveness of root-balanced with AVL and red-black trees.

[Skew_Heap] title = Skew Heap author = Tobias Nipkow date = 2014-08-13 topic = Computer Science/Data Structures abstract = Skew heaps are an amazingly simple and lightweight implementation of priority queues. They were invented by Sleator and Tarjan [SIAM 1986] and have logarithmic amortized complexity. This entry provides executable and verified functional skew heaps.

The amortized complexity of skew heaps is analyzed in the AFP entry Amortized Complexity. notify = nipkow@in.tum.de [Pairing_Heap] title = Pairing Heap author = Hauke Brinkop , Tobias Nipkow date = 2016-07-14 topic = Computer Science/Data Structures abstract = This library defines three different versions of pairing heaps: a functional version of the original design based on binary trees [Fredman et al. 1986], the version by Okasaki [1998] and a modified version of the latter that is free of structural invariants.

The amortized complexity of pairing heaps is analyzed in the AFP article Amortized Complexity. extra-0 = Origin: This library was extracted from Amortized Complexity and extended. notify = nipkow@in.tum.de [Priority_Queue_Braun] title = Priority Queues Based on Braun Trees author = Tobias Nipkow date = 2014-09-04 topic = Computer Science/Data Structures abstract = This entry verifies priority queues based on Braun trees. Insertion and deletion take logarithmic time and preserve the balanced nature of Braun trees. Two implementations of deletion are provided. notify = nipkow@in.tum.de extra-history = Change history: [2019-12-16]: Added theory Priority_Queue_Braun2 with second version of del_min [Binomial-Queues] title = Functional Binomial Queues author = René Neumann date = 2010-10-28 topic = Computer Science/Data Structures abstract = Priority queues are an important data structure and efficient implementations of them are crucial. We implement a functional variant of binomial queues in Isabelle/HOL and show its functional correctness. A verification against an abstract reference specification of priority queues has also been attempted, but could not be achieved to the full extent. notify = florian.haftmann@informatik.tu-muenchen.de [Binomial-Heaps] title = Binomial Heaps and Skew Binomial Heaps author = Rene Meis , Finn Nielsen , Peter Lammich date = 2010-10-28 topic = Computer Science/Data Structures abstract = We implement and prove correct binomial heaps and skew binomial heaps. Both are data-structures for priority queues. While binomial heaps have logarithmic findMin, deleteMin, insert, and meld operations, skew binomial heaps have constant time findMin, insert, and meld operations, and only the deleteMin-operation is logarithmic. This is achieved by using skew links to avoid cascading linking on insert-operations, and data-structural bootstrapping to get constant-time findMin and meld operations. Our implementation follows the paper by Brodal and Okasaki. notify = peter.lammich@uni-muenster.de [Finger-Trees] title = Finger Trees author = Benedikt Nordhoff , Stefan Körner , Peter Lammich date = 2010-10-28 topic = Computer Science/Data Structures abstract = We implement and prove correct 2-3 finger trees. Finger trees are a general purpose data structure, that can be used to efficiently implement other data structures, such as priority queues. Intuitively, a finger tree is an annotated sequence, where the annotations are elements of a monoid. Apart from operations to access the ends of the sequence, the main operation is to split the sequence at the point where a monotone predicate over the sum of the left part of the sequence becomes true for the first time. The implementation follows the paper of Hinze and Paterson. The code generator can be used to get efficient, verified code. notify = peter.lammich@uni-muenster.de [Trie] title = Trie author = Andreas Lochbihler , Tobias Nipkow date = 2015-03-30 topic = Computer Science/Data Structures abstract = This article formalizes the ``trie'' data structure invented by Fredkin [CACM 1960]. It also provides a specialization where the entries in the trie are lists. extra-0 = Origin: This article was extracted from existing articles by the authors. notify = nipkow@in.tum.de [FinFun] title = Code Generation for Functions as Data author = Andreas Lochbihler date = 2009-05-06 topic = Computer Science/Data Structures abstract = FinFuns are total functions that are constant except for a finite set of points, i.e. a generalisation of finite maps. They are formalised as a new type in Isabelle/HOL such that the code generator can handle equality tests and quantification on FinFuns. On the code output level, FinFuns are explicitly represented by constant functions and pointwise updates, similarly to associative lists. Inside the logic, they behave like ordinary functions with extensionality. Via the update/constant pattern, a recursion combinator and an induction rule for FinFuns allow for defining and reasoning about operators on FinFun that are also executable. extra-history = Change history: [2010-08-13]: new concept domain of a FinFun as a FinFun (revision 34b3517cbc09)
[2010-11-04]: new conversion function from FinFun to list of elements in the domain (revision 0c167102e6ed)
[2012-03-07]: replace sets as FinFuns by predicates as FinFuns because the set type constructor has been reintroduced (revision b7aa87989f3a) notify = nipkow@in.tum.de [Collections] title = Collections Framework author = Peter Lammich contributors = Andreas Lochbihler , Thomas Tuerk <> date = 2009-11-25 topic = Computer Science/Data Structures abstract = This development provides an efficient, extensible, machine checked collections framework. The library adopts the concepts of interface, implementation and generic algorithm from object-oriented programming and implements them in Isabelle/HOL. The framework features the use of data refinement techniques to refine an abstract specification (using high-level concepts like sets) to a more concrete implementation (using collection datastructures, like red-black-trees). The code-generator of Isabelle/HOL can be used to generate efficient code. extra-history = Change history: [2010-10-08]: New Interfaces: OrderedSet, OrderedMap, List. Fifo now implements list-interface: Function names changed: put/get --> enqueue/dequeue. New Implementations: ArrayList, ArrayHashMap, ArrayHashSet, TrieMap, TrieSet. Invariant-free datastructures: Invariant implicitely hidden in typedef. Record-interfaces: All operations of an interface encapsulated as record. Examples moved to examples subdirectory.
[2010-12-01]: New Interfaces: Priority Queues, Annotated Lists. Implemented by finger trees, (skew) binomial queues.
[2011-10-10]: SetSpec: Added operations: sng, isSng, bexists, size_abort, diff, filter, iterate_rule_insertP MapSpec: Added operations: sng, isSng, iterate_rule_insertP, bexists, size, size_abort, restrict, map_image_filter, map_value_image_filter Some maintenance changes
[2012-04-25]: New iterator foundation by Tuerk. Various maintenance changes.
[2012-08]: Collections V2. New features: Polymorphic iterators. Generic algorithm instantiation where required. Naming scheme changed from xx_opname to xx.opname. A compatibility file CollectionsV1 tries to simplify porting of existing theories, by providing old naming scheme and the old monomorphic iterator locales.
[2013-09]: Added Generic Collection Framework based on Autoref. The GenCF provides: Arbitrary nesting, full integration with Autoref.
[2014-06]: Maintenace changes to GenCF: Optimized inj_image on list_set. op_set_cart (Cartesian product). big-Union operation. atLeastLessThan - operation ({a..<b})
notify = lammich@in.tum.de [Containers] title = Light-weight Containers author = Andreas Lochbihler contributors = René Thiemann date = 2013-04-15 topic = Computer Science/Data Structures abstract = This development provides a framework for container types like sets and maps such that generated code implements these containers with different (efficient) data structures. Thanks to type classes and refinement during code generation, this light-weight approach can seamlessly replace Isabelle's default setup for code generation. Heuristics automatically pick one of the available data structures depending on the type of elements to be stored, but users can also choose on their own. The extensible design permits to add more implementations at any time.

To support arbitrary nesting of sets, we define a linear order on sets based on a linear order of the elements and provide efficient implementations. It even allows to compare complements with non-complements. extra-history = Change history: [2013-07-11]: add pretty printing for sets (revision 7f3f52c5f5fa)
[2013-09-20]: provide generators for canonical type class instantiations (revision 159f4401f4a8 by René Thiemann)
[2014-07-08]: add support for going from partial functions to mappings (revision 7a6fc957e8ed)
[2018-03-05]: add two application examples: depth-first search and 2SAT (revision e5e1a1da2411) notify = mail@andreas-lochbihler.de [FileRefinement] title = File Refinement author = Karen Zee , Viktor Kuncak date = 2004-12-09 topic = Computer Science/Data Structures abstract = These theories illustrates the verification of basic file operations (file creation, file read and file write) in the Isabelle theorem prover. We describe a file at two levels of abstraction: an abstract file represented as a resizable array, and a concrete file represented using data blocks. notify = kkz@mit.edu [Datatype_Order_Generator] title = Generating linear orders for datatypes author = René Thiemann date = 2012-08-07 topic = Computer Science/Data Structures abstract = We provide a framework for registering automatic methods to derive class instances of datatypes, as it is possible using Haskell's ``deriving Ord, Show, ...'' feature.

We further implemented such automatic methods to derive (linear) orders or hash-functions which are required in the Isabelle Collection Framework. Moreover, for the tactic of Huffman and Krauss to show that a datatype is countable, we implemented a wrapper so that this tactic becomes accessible in our framework.

Our formalization was performed as part of the IsaFoR/CeTA project. With our new tactic we could completely remove tedious proofs for linear orders of two datatypes.

This development is aimed at datatypes generated by the "old_datatype" command. notify = rene.thiemann@uibk.ac.at [Deriving] title = Deriving class instances for datatypes author = Christian Sternagel , René Thiemann date = 2015-03-11 topic = Computer Science/Data Structures abstract =

We provide a framework for registering automatic methods to derive class instances of datatypes, as it is possible using Haskell's ``deriving Ord, Show, ...'' feature.

We further implemented such automatic methods to derive comparators, linear orders, parametrizable equality functions, and hash-functions which are required in the Isabelle Collection Framework and the Container Framework. Moreover, for the tactic of Blanchette to show that a datatype is countable, we implemented a wrapper so that this tactic becomes accessible in our framework. All of the generators are based on the infrastructure that is provided by the BNF-based datatype package.

Our formalization was performed as part of the IsaFoR/CeTA project. With our new tactics we could remove several tedious proofs for (conditional) linear orders, and conditional equality operators within IsaFoR and the Container Framework.

notify = rene.thiemann@uibk.ac.at [List-Index] title = List Index date = 2010-02-20 author = Tobias Nipkow topic = Computer Science/Data Structures abstract = This theory provides functions for finding the index of an element in a list, by predicate and by value. notify = nipkow@in.tum.de [List-Infinite] title = Infinite Lists date = 2011-02-23 author = David Trachtenherz <> topic = Computer Science/Data Structures abstract = We introduce a theory of infinite lists in HOL formalized as functions over naturals (folder ListInf, theories ListInf and ListInf_Prefix). It also provides additional results for finite lists (theory ListInf/List2), natural numbers (folder CommonArith, esp. division/modulo, naturals with infinity), sets (folder CommonSet, esp. cutting/truncating sets, traversing sets of naturals). notify = nipkow@in.tum.de [Matrix] title = Executable Matrix Operations on Matrices of Arbitrary Dimensions topic = Computer Science/Data Structures date = 2010-06-17 author = Christian Sternagel , René Thiemann license = LGPL abstract = We provide the operations of matrix addition, multiplication, transposition, and matrix comparisons as executable functions over ordered semirings. Moreover, it is proven that strongly normalizing (monotone) orders can be lifted to strongly normalizing (monotone) orders over matrices. We further show that the standard semirings over the naturals, integers, and rationals, as well as the arctic semirings satisfy the axioms that are required by our matrix theory. Our formalization is part of the CeTA system which contains several termination techniques. The provided theories have been essential to formalize matrix-interpretations and arctic interpretations. extra-history = Change history: [2010-09-17]: Moved theory on arbitrary (ordered) semirings to Abstract Rewriting. notify = rene.thiemann@uibk.ac.at, christian.sternagel@uibk.ac.at [Matrix_Tensor] title = Tensor Product of Matrices topic = Computer Science/Data Structures, Mathematics/Algebra date = 2016-01-18 author = T.V.H. Prathamesh abstract = In this work, the Kronecker tensor product of matrices and the proofs of some of its properties are formalized. Properties which have been formalized include associativity of the tensor product and the mixed-product property. notify = prathamesh@imsc.res.in [Huffman] title = The Textbook Proof of Huffman's Algorithm author = Jasmin Christian Blanchette date = 2008-10-15 topic = Computer Science/Data Structures abstract = Huffman's algorithm is a procedure for constructing a binary tree with minimum weighted path length. This report presents a formal proof of the correctness of Huffman's algorithm written using Isabelle/HOL. Our proof closely follows the sketches found in standard algorithms textbooks, uncovering a few snags in the process. Another distinguishing feature of our formalization is the use of custom induction rules to help Isabelle's automatic tactics, leading to very short proofs for most of the lemmas. notify = jasmin.blanchette@gmail.com [Partial_Function_MR] title = Mutually Recursive Partial Functions author = René Thiemann topic = Computer Science/Functional Programming date = 2014-02-18 license = LGPL abstract = We provide a wrapper around the partial-function command that supports mutual recursion. notify = rene.thiemann@uibk.ac.at [Lifting_Definition_Option] title = Lifting Definition Option author = René Thiemann topic = Computer Science/Functional Programming date = 2014-10-13 license = LGPL abstract = We implemented a command that can be used to easily generate elements of a restricted type {x :: 'a. P x}, provided the definition is of the form f ys = (if check ys then Some(generate ys :: 'a) else None) where ys is a list of variables y1 ... yn and check ys ==> P(generate ys) can be proved.

In principle, such a definition is also directly possible using the lift_definition command. However, then this definition will not be suitable for code-generation. To this end, we automated a more complex construction of Joachim Breitner which is amenable for code-generation, and where the test check ys will only be performed once. In the automation, one auxiliary type is created, and Isabelle's lifting- and transfer-package is invoked several times. notify = rene.thiemann@uibk.ac.at [Coinductive] title = Coinductive topic = Computer Science/Functional Programming author = Andreas Lochbihler contributors = Johannes Hölzl date = 2010-02-12 abstract = This article collects formalisations of general-purpose coinductive data types and sets. Currently, it contains coinductive natural numbers, coinductive lists, i.e. lazy lists or streams, infinite streams, coinductive terminated lists, coinductive resumptions, a library of operations on coinductive lists, and a version of König's lemma as an application for coinductive lists.
The initial theory was contributed by Paulson and Wenzel. Extensions and other coinductive formalisations of general interest are welcome. extra-history = Change history: [2010-06-10]: coinductive lists: setup for quotient package (revision 015574f3bf3c)
[2010-06-28]: new codatatype terminated lazy lists (revision e12de475c558)
[2010-08-04]: terminated lazy lists: setup for quotient package; more lemmas (revision 6ead626f1d01)
[2010-08-17]: Koenig's lemma as an example application for coinductive lists (revision f81ce373fa96)
[2011-02-01]: lazy implementation of coinductive (terminated) lists for the code generator (revision 6034973dce83)
[2011-07-20]: new codatatype resumption (revision 811364c776c7)
[2012-06-27]: new codatatype stream with operations (with contributions by Peter Gammie) (revision dd789a56473c)
[2013-03-13]: construct codatatypes with the BNF package and adjust the definitions and proofs, setup for lifting and transfer packages (revision f593eda5b2c0)
[2013-09-20]: stream theory uses type and operations from HOL/BNF/Examples/Stream (revision 692809b2b262)
[2014-04-03]: ccpo structure on codatatypes used to define ldrop, ldropWhile, lfilter, lconcat as least fixpoint; ccpo topology on coinductive lists contributed by Johannes Hölzl; added examples (revision 23cd8156bd42)
notify = mail@andreas-lochbihler.de [Stream-Fusion] title = Stream Fusion author = Brian Huffman topic = Computer Science/Functional Programming date = 2009-04-29 abstract = Stream Fusion is a system for removing intermediate list structures from Haskell programs; it consists of a Haskell library along with several compiler rewrite rules. (The library is available online.)

These theories contain a formalization of much of the Stream Fusion library in HOLCF. Lazy list and stream types are defined, along with coercions between the two types, as well as an equivalence relation for streams that generate the same list. List and stream versions of map, filter, foldr, enumFromTo, append, zipWith, and concatMap are defined, and the stream versions are shown to respect stream equivalence. notify = brianh@cs.pdx.edu [Tycon] title = Type Constructor Classes and Monad Transformers author = Brian Huffman date = 2012-06-26 topic = Computer Science/Functional Programming abstract = These theories contain a formalization of first class type constructors and axiomatic constructor classes for HOLCF. This work is described in detail in the ICFP 2012 paper Formal Verification of Monad Transformers by the author. The formalization is a revised and updated version of earlier joint work with Matthews and White.

Based on the hierarchy of type classes in Haskell, we define classes for functors, monads, monad-plus, etc. Each one includes all the standard laws as axioms. We also provide a new user command, tycondef, for defining new type constructors in HOLCF. Using tycondef, we instantiate the type class hierarchy with various monads and monad transformers. notify = huffman@in.tum.de [CoreC++] title = CoreC++ author = Daniel Wasserrab date = 2006-05-15 topic = Computer Science/Programming Languages/Language Definitions abstract = We present an operational semantics and type safety proof for multiple inheritance in C++. The semantics models the behavior of method calls, field accesses, and two forms of casts in C++ class hierarchies. For explanations see the OOPSLA 2006 paper by Wasserrab, Nipkow, Snelting and Tip. notify = nipkow@in.tum.de [FeatherweightJava] title = A Theory of Featherweight Java in Isabelle/HOL author = J. Nathan Foster , Dimitrios Vytiniotis date = 2006-03-31 topic = Computer Science/Programming Languages/Language Definitions abstract = We formalize the type system, small-step operational semantics, and type soundness proof for Featherweight Java, a simple object calculus, in Isabelle/HOL. notify = kleing@cse.unsw.edu.au [Jinja] title = Jinja is not Java author = Gerwin Klein , Tobias Nipkow date = 2005-06-01 topic = Computer Science/Programming Languages/Language Definitions abstract = We introduce Jinja, a Java-like programming language with a formal semantics designed to exhibit core features of the Java language architecture. Jinja is a compromise between realism of the language and tractability and clarity of the formal semantics. The following aspects are formalised: a big and a small step operational semantics for Jinja and a proof of their equivalence; a type system and a definite initialisation analysis; a type safety proof of the small step semantics; a virtual machine (JVM), its operational semantics and its type system; a type safety proof for the JVM; a bytecode verifier, i.e. data flow analyser for the JVM; a correctness proof of the bytecode verifier w.r.t. the type system; a compiler and a proof that it preserves semantics and well-typedness. The emphasis of this work is not on particular language features but on providing a unified model of the source language, the virtual machine and the compiler. The whole development has been carried out in the theorem prover Isabelle/HOL. notify = kleing@cse.unsw.edu.au, nipkow@in.tum.de [JinjaThreads] title = Jinja with Threads author = Andreas Lochbihler date = 2007-12-03 topic = Computer Science/Programming Languages/Language Definitions abstract = We extend the Jinja source code semantics by Klein and Nipkow with Java-style arrays and threads. Concurrency is captured in a generic framework semantics for adding concurrency through interleaving to a sequential semantics, which features dynamic thread creation, inter-thread communication via shared memory, lock synchronisation and joins. Also, threads can suspend themselves and be notified by others. We instantiate the framework with the adapted versions of both Jinja source and byte code and show type safety for the multithreaded case. Equally, the compiler from source to byte code is extended, for which we prove weak bisimilarity between the source code small step semantics and the defensive Jinja virtual machine. On top of this, we formalise the JMM and show the DRF guarantee and consistency. For description of the different parts, see Lochbihler's papers at FOOL 2008, ESOP 2010, ITP 2011, and ESOP 2012. extra-history = Change history: [2008-04-23]: added bytecode formalisation with arrays and threads, added thread joins (revision f74a8be156a7)
[2009-04-27]: added verified compiler from source code to bytecode; encapsulate native methods in separate semantics (revision e4f26541e58a)
[2009-11-30]: extended compiler correctness proof to infinite and deadlocking computations (revision e50282397435)
[2010-06-08]: added thread interruption; new abstract memory model with sequential consistency as implementation (revision 0cb9e8dbd78d)
[2010-06-28]: new thread interruption model (revision c0440d0a1177)
[2010-10-15]: preliminary version of the Java memory model for source code (revision 02fee0ef3ca2)
[2010-12-16]: improved version of the Java memory model, also for bytecode executable scheduler for source code semantics (revision 1f41c1842f5a)
[2011-02-02]: simplified code generator setup new random scheduler (revision 3059dafd013f)
[2011-07-21]: new interruption model, generalized JMM proof of DRF guarantee, allow class Object to declare methods and fields, simplified subtyping relation, corrected division and modulo implementation (revision 46e4181ed142)
[2012-02-16]: added example programs (revision bf0b06c8913d)
[2012-11-21]: type safety proof for the Java memory model, allow spurious wake-ups (revision 76063d860ae0)
[2013-05-16]: support for non-deterministic memory allocators (revision cc3344a49ced)
[2017-10-20]: add an atomic compare-and-swap operation for volatile fields (revision a6189b1d6b30)
notify = mail@andreas-lochbihler.de [Locally-Nameless-Sigma] title = Locally Nameless Sigma Calculus author = Ludovic Henrio , Florian Kammüller , Bianca Lutz , Henry Sudhof date = 2010-04-30 topic = Computer Science/Programming Languages/Language Definitions abstract = We present a Theory of Objects based on the original functional sigma-calculus by Abadi and Cardelli but with an additional parameter to methods. We prove confluence of the operational semantics following the outline of Nipkow's proof of confluence for the lambda-calculus reusing his theory Commutation, a generic diamond lemma reduction. We furthermore formalize a simple type system for our sigma-calculus including a proof of type safety. The entire development uses the concept of Locally Nameless representation for binders. We reuse an earlier proof of confluence for a simpler sigma-calculus based on de Bruijn indices and lists to represent objects. notify = nipkow@in.tum.de [AutoFocus-Stream] title = AutoFocus Stream Processing for Single-Clocking and Multi-Clocking Semantics author = David Trachtenherz <> date = 2011-02-23 topic = Computer Science/Programming Languages/Language Definitions abstract = We formalize the AutoFocus Semantics (a time-synchronous subset of the Focus formalism) as stream processing functions on finite and infinite message streams represented as finite/infinite lists. The formalization comprises both the conventional single-clocking semantics (uniform global clock for all components and communications channels) and its extension to multi-clocking semantics (internal execution clocking of a component may be a multiple of the external communication clocking). The semantics is defined by generic stream processing functions making it suitable for simulation/code generation in Isabelle/HOL. Furthermore, a number of AutoFocus semantics properties are formalized using definitions from the IntervalLogic theories. notify = nipkow@in.tum.de [FocusStreamsCaseStudies] title = Stream Processing Components: Isabelle/HOL Formalisation and Case Studies author = Maria Spichkova date = 2013-11-14 topic = Computer Science/Programming Languages/Language Definitions abstract = This set of theories presents an Isabelle/HOL formalisation of stream processing components introduced in Focus, a framework for formal specification and development of interactive systems. This is an extended and updated version of the formalisation, which was elaborated within the methodology "Focus on Isabelle". In addition, we also applied the formalisation on three case studies that cover different application areas: process control (Steam Boiler System), data transmission (FlexRay communication protocol), memory and processing components (Automotive-Gateway System). notify = lp15@cam.ac.uk, maria.spichkova@rmit.edu.au [Isabelle_Meta_Model] title = A Meta-Model for the Isabelle API author = Frédéric Tuong , Burkhart Wolff date = 2015-09-16 topic = Computer Science/Programming Languages/Language Definitions abstract = We represent a theory of (a fragment of) Isabelle/HOL in Isabelle/HOL. The purpose of this exercise is to write packages for domain-specific specifications such as class models, B-machines, ..., and generally speaking, any domain-specific languages whose abstract syntax can be defined by a HOL "datatype". On this basis, the Isabelle code-generator can then be used to generate code for global context transformations as well as tactic code.

Consequently the package is geared towards parsing, printing and code-generation to the Isabelle API. It is at the moment not sufficiently rich for doing meta theory on Isabelle itself. Extensions in this direction are possible though.

Moreover, the chosen fragment is fairly rudimentary. However it should be easily adapted to one's needs if a package is written on top of it. The supported API contains types, terms, transformation of global context like definitions and data-type declarations as well as infrastructure for Isar-setups.

This theory is drawn from the Featherweight OCL project where it is used to construct a package for object-oriented data-type theories generated from UML class diagrams. The Featherweight OCL, for example, allows for both the direct execution of compiled tactic code by the Isabelle API as well as the generation of ".thy"-files for debugging purposes.

Gained experience from this project shows that the compiled code is sufficiently efficient for practical purposes while being based on a formal model on which properties of the package can be proven such as termination of certain transformations, correctness, etc. notify = tuong@users.gforge.inria.fr, wolff@lri.fr [Clean] title = Clean - An Abstract Imperative Programming Language and its Theory author = Frédéric Tuong , Burkhart Wolff topic = Computer Science/Programming Languages, Computer Science/Semantics date = 2019-10-04 notify = wolff@lri.fr, ftuong@lri.fr abstract = Clean is based on a simple, abstract execution model for an imperative target language. “Abstract” is understood in contrast to “Concrete Semantics”; alternatively, the term “shallow-style embedding” could be used. It strives for a type-safe notion of program-variables, an incremental construction of the typed state-space, support of incremental verification, and open-world extensibility of new type definitions being intertwined with the program definitions. Clean is based on a “no-frills” state-exception monad with the usual definitions of bind and unit for the compositional glue of state-based computations. Clean offers conditionals and loops supporting C-like control-flow operators such as break and return. The state-space construction is based on the extensible record package. Direct recursion of procedures is supported. Clean’s design strives for extreme simplicity. It is geared towards symbolic execution and proven correct verification tools. The underlying libraries of this package, however, deliberately restrict themselves to the most elementary infrastructure for these tasks. The package is intended to serve as demonstrator semantic backend for Isabelle/C, or for the test-generation techniques. [PCF] title = Logical Relations for PCF author = Peter Gammie date = 2012-07-01 topic = Computer Science/Programming Languages/Lambda Calculi abstract = We apply Andy Pitts's methods of defining relations over domains to several classical results in the literature. We show that the Y combinator coincides with the domain-theoretic fixpoint operator, that parallel-or and the Plotkin existential are not definable in PCF, that the continuation semantics for PCF coincides with the direct semantics, and that our domain-theoretic semantics for PCF is adequate for reasoning about contextual equivalence in an operational semantics. Our version of PCF is untyped and has both strict and non-strict function abstractions. The development is carried out in HOLCF. notify = peteg42@gmail.com [POPLmark-deBruijn] title = POPLmark Challenge Via de Bruijn Indices author = Stefan Berghofer date = 2007-08-02 topic = Computer Science/Programming Languages/Lambda Calculi abstract = We present a solution to the POPLmark challenge designed by Aydemir et al., which has as a goal the formalization of the meta-theory of System F<:. The formalization is carried out in the theorem prover Isabelle/HOL using an encoding based on de Bruijn indices. We start with a relatively simple formalization covering only the basic features of System F<:, and explain how it can be extended to also cover records and more advanced binding constructs. notify = berghofe@in.tum.de [Lam-ml-Normalization] title = Strong Normalization of Moggis's Computational Metalanguage author = Christian Doczkal date = 2010-08-29 topic = Computer Science/Programming Languages/Lambda Calculi abstract = Handling variable binding is one of the main difficulties in formal proofs. In this context, Moggi's computational metalanguage serves as an interesting case study. It features monadic types and a commuting conversion rule that rearranges the binding structure. Lindley and Stark have given an elegant proof of strong normalization for this calculus. The key construction in their proof is a notion of relational TT-lifting, using stacks of elimination contexts to obtain a Girard-Tait style logical relation. I give a formalization of their proof in Isabelle/HOL-Nominal with a particular emphasis on the treatment of bound variables. notify = doczkal@ps.uni-saarland.de, nipkow@in.tum.de [MiniML] title = Mini ML author = Wolfgang Naraschewski <>, Tobias Nipkow date = 2004-03-19 topic = Computer Science/Programming Languages/Type Systems abstract = This theory defines the type inference rules and the type inference algorithm W for MiniML (simply-typed lambda terms with let) due to Milner. It proves the soundness and completeness of W w.r.t. the rules. notify = kleing@cse.unsw.edu.au [Simpl] title = A Sequential Imperative Programming Language Syntax, Semantics, Hoare Logics and Verification Environment author = Norbert Schirmer <> date = 2008-02-29 topic = Computer Science/Programming Languages/Language Definitions, Computer Science/Programming Languages/Logics license = LGPL abstract = We present the theory of Simpl, a sequential imperative programming language. We introduce its syntax, its semantics (big and small-step operational semantics) and Hoare logics for both partial as well as total correctness. We prove soundness and completeness of the Hoare logic. We integrate and automate the Hoare logic in Isabelle/HOL to obtain a practically usable verification environment for imperative programs. Simpl is independent of a concrete programming language but expressive enough to cover all common language features: mutually recursive procedures, abrupt termination and exceptions, runtime faults, local and global variables, pointers and heap, expressions with side effects, pointers to procedures, partial application and closures, dynamic method invocation and also unbounded nondeterminism. notify = kleing@cse.unsw.edu.au, norbert.schirmer@web.de [Separation_Algebra] title = Separation Algebra author = Gerwin Klein , Rafal Kolanski , Andrew Boyton date = 2012-05-11 topic = Computer Science/Programming Languages/Logics license = BSD abstract = We present a generic type class implementation of separation algebra for Isabelle/HOL as well as lemmas and generic tactics which can be used directly for any instantiation of the type class.

The ex directory contains example instantiations that include structures such as a heap or virtual memory.

The abstract separation algebra is based upon "Abstract Separation Logic" by Calcagno et al. These theories are also the basis of the ITP 2012 rough diamond "Mechanised Separation Algebra" by the authors.

The aim of this work is to support and significantly reduce the effort for future separation logic developments in Isabelle/HOL by factoring out the part of separation logic that can be treated abstractly once and for all. This includes developing typical default rule sets for reasoning as well as automated tactic support for separation logic. notify = kleing@cse.unsw.edu.au, rafal.kolanski@nicta.com.au [Separation_Logic_Imperative_HOL] title = A Separation Logic Framework for Imperative HOL author = Peter Lammich , Rene Meis date = 2012-11-14 topic = Computer Science/Programming Languages/Logics license = BSD abstract = We provide a framework for separation-logic based correctness proofs of Imperative HOL programs. Our framework comes with a set of proof methods to automate canonical tasks such as verification condition generation and frame inference. Moreover, we provide a set of examples that show the applicability of our framework. The examples include algorithms on lists, hash-tables, and union-find trees. We also provide abstract interfaces for lists, maps, and sets, that allow to develop generic imperative algorithms and use data-refinement techniques.
As we target Imperative HOL, our programs can be translated to efficiently executable code in various target languages, including ML, OCaml, Haskell, and Scala. notify = lammich@in.tum.de [Inductive_Confidentiality] title = Inductive Study of Confidentiality author = Giampaolo Bella date = 2012-05-02 topic = Computer Science/Security abstract = This document contains the full theory files accompanying article Inductive Study of Confidentiality --- for Everyone in Formal Aspects of Computing. They aim at an illustrative and didactic presentation of the Inductive Method of protocol analysis, focusing on the treatment of one of the main goals of security protocols: confidentiality against a threat model. The treatment of confidentiality, which in fact forms a key aspect of all protocol analysis tools, has been found cryptic by many learners of the Inductive Method, hence the motivation for this work. The theory files in this document guide the reader step by step towards design and proof of significant confidentiality theorems. These are developed against two threat models, the standard Dolev-Yao and a more audacious one, the General Attacker, which turns out to be particularly useful also for teaching purposes. notify = giamp@dmi.unict.it [Possibilistic_Noninterference] title = Possibilistic Noninterference author = Andrei Popescu , Johannes Hölzl date = 2012-09-10 topic = Computer Science/Security, Computer Science/Programming Languages/Type Systems abstract = We formalize a wide variety of Volpano/Smith-style noninterference notions for a while language with parallel composition. We systematize and classify these notions according to compositionality w.r.t. the language constructs. Compositionality yields sound syntactic criteria (a.k.a. type systems) in a uniform way.

An article about these proofs is published in the proceedings of the conference Certified Programs and Proofs 2012. notify = hoelzl@in.tum.de [SIFUM_Type_Systems] title = A Formalization of Assumptions and Guarantees for Compositional Noninterference author = Sylvia Grewe , Heiko Mantel , Daniel Schoepe date = 2014-04-23 topic = Computer Science/Security, Computer Science/Programming Languages/Type Systems abstract = Research in information-flow security aims at developing methods to identify undesired information leaks within programs from private (high) sources to public (low) sinks. For a concurrent system, it is desirable to have compositional analysis methods that allow for analyzing each thread independently and that nevertheless guarantee that the parallel composition of successfully analyzed threads satisfies a global security guarantee. However, such a compositional analysis should not be overly pessimistic about what an environment might do with shared resources. Otherwise, the analysis will reject many intuitively secure programs.

The paper "Assumptions and Guarantees for Compositional Noninterference" by Mantel et. al. presents one solution for this problem: an approach for compositionally reasoning about non-interference in concurrent programs via rely-guarantee-style reasoning. We present an Isabelle/HOL formalization of the concepts and proofs of this approach. notify = grewe@cs.tu-darmstadt.de [Dependent_SIFUM_Type_Systems] title = A Dependent Security Type System for Concurrent Imperative Programs author = Toby Murray , Robert Sison<>, Edward Pierzchalski<>, Christine Rizkallah notify = toby.murray@unimelb.edu.au date = 2016-06-25 topic = Computer Science/Security, Computer Science/Programming Languages/Type Systems abstract = The paper "Compositional Verification and Refinement of Concurrent Value-Dependent Noninterference" by Murray et. al. (CSF 2016) presents a dependent security type system for compositionally verifying a value-dependent noninterference property, defined in (Murray, PLAS 2015), for concurrent programs. This development formalises that security definition, the type system and its soundness proof, and demonstrates its application on some small examples. It was derived from the SIFUM_Type_Systems AFP entry, by Sylvia Grewe, Heiko Mantel and Daniel Schoepe, and whose structure it inherits. extra-history = Change history: [2016-08-19]: Removed unused "stop" parameter and "stop_no_eval" assumption from the sifum_security locale. (revision dbc482d36372) [2016-09-27]: Added security locale support for the imposition of requirements on the initial memory. (revision cce4ceb74ddb) [Dependent_SIFUM_Refinement] title = Compositional Security-Preserving Refinement for Concurrent Imperative Programs author = Toby Murray , Robert Sison<>, Edward Pierzchalski<>, Christine Rizkallah notify = toby.murray@unimelb.edu.au date = 2016-06-28 topic = Computer Science/Security abstract = The paper "Compositional Verification and Refinement of Concurrent Value-Dependent Noninterference" by Murray et. al. (CSF 2016) presents a compositional theory of refinement for a value-dependent noninterference property, defined in (Murray, PLAS 2015), for concurrent programs. This development formalises that refinement theory, and demonstrates its application on some small examples. extra-history = Change history: [2016-08-19]: Removed unused "stop" parameters from the sifum_refinement locale. (revision dbc482d36372) [2016-09-02]: TobyM extended "simple" refinement theory to be usable for all bisimulations. (revision 547f31c25f60) +[Relational-Incorrectness-Logic] +title = An Under-Approximate Relational Logic +author = Toby Murray +topic = Computer Science/Programming Languages/Logics, Computer Science/Security +date = 2020-03-12 +notify = toby.murray@unimelb.edu.au +abstract = + Recently, authors have proposed under-approximate logics for reasoning + about programs. So far, all such logics have been confined to + reasoning about individual program behaviours. Yet there exist many + over-approximate relational logics for reasoning about pairs of + programs and relating their behaviours. We present the first + under-approximate relational logic, for the simple imperative language + IMP. We prove our logic is both sound and complete. Additionally, we + show how reasoning in this logic can be decomposed into non-relational + reasoning in an under-approximate Hoare logic, mirroring Beringer’s + result for over-approximate relational logics. We illustrate the + application of our logic on some small examples in which we provably + demonstrate the presence of insecurity. + [Strong_Security] title = A Formalization of Strong Security author = Sylvia Grewe , Alexander Lux , Heiko Mantel , Jens Sauer date = 2014-04-23 topic = Computer Science/Security, Computer Science/Programming Languages/Type Systems abstract = Research in information-flow security aims at developing methods to identify undesired information leaks within programs from private sources to public sinks. Noninterference captures this intuition. Strong security from Sabelfeld and Sands formalizes noninterference for concurrent systems.

We present an Isabelle/HOL formalization of strong security for arbitrary security lattices (Sabelfeld and Sands use a two-element security lattice in the original publication). The formalization includes compositionality proofs for strong security and a soundness proof for a security type system that checks strong security for programs in a simple while language with dynamic thread creation.

Our formalization of the security type system is abstract in the language for expressions and in the semantic side conditions for expressions. It can easily be instantiated with different syntactic approximations for these side conditions. The soundness proof of such an instantiation boils down to showing that these syntactic approximations imply the semantic side conditions. notify = grewe@cs.tu-darmstadt.de [WHATandWHERE_Security] title = A Formalization of Declassification with WHAT-and-WHERE-Security author = Sylvia Grewe , Alexander Lux , Heiko Mantel , Jens Sauer date = 2014-04-23 topic = Computer Science/Security, Computer Science/Programming Languages/Type Systems abstract = Research in information-flow security aims at developing methods to identify undesired information leaks within programs from private sources to public sinks. Noninterference captures this intuition by requiring that no information whatsoever flows from private sources to public sinks. However, in practice this definition is often too strict: Depending on the intuitive desired security policy, the controlled declassification of certain private information (WHAT) at certain points in the program (WHERE) might not result in an undesired information leak.

We present an Isabelle/HOL formalization of such a security property for controlled declassification, namely WHAT&WHERE-security from "Scheduler-Independent Declassification" by Lux, Mantel, and Perner. The formalization includes compositionality proofs for and a soundness proof for a security type system that checks for programs in a simple while language with dynamic thread creation.

Our formalization of the security type system is abstract in the language for expressions and in the semantic side conditions for expressions. It can easily be instantiated with different syntactic approximations for these side conditions. The soundness proof of such an instantiation boils down to showing that these syntactic approximations imply the semantic side conditions.

This Isabelle/HOL formalization uses theories from the entry Strong Security. notify = grewe@cs.tu-darmstadt.de [VolpanoSmith] title = A Correctness Proof for the Volpano/Smith Security Typing System author = Gregor Snelting , Daniel Wasserrab date = 2008-09-02 topic = Computer Science/Programming Languages/Type Systems, Computer Science/Security abstract = The Volpano/Smith/Irvine security type systems requires that variables are annotated as high (secret) or low (public), and provides typing rules which guarantee that secret values cannot leak to public output ports. This property of a program is called confidentiality. For a simple while-language without threads, our proof shows that typeability in the Volpano/Smith system guarantees noninterference. Noninterference means that if two initial states for program execution are low-equivalent, then the final states are low-equivalent as well. This indeed implies that secret values cannot leak to public ports. The proof defines an abstract syntax and operational semantics for programs, formalizes noninterference, and then proceeds by rule induction on the operational semantics. The mathematically most intricate part is the treatment of implicit flows. Note that the Volpano/Smith system is not flow-sensitive and thus quite unprecise, resulting in false alarms. However, due to the correctness property, all potential breaks of confidentiality are discovered. notify = [Abstract-Hoare-Logics] title = Abstract Hoare Logics author = Tobias Nipkow date = 2006-08-08 topic = Computer Science/Programming Languages/Logics abstract = These therories describe Hoare logics for a number of imperative language constructs, from while-loops to mutually recursive procedures. Both partial and total correctness are treated. In particular a proof system for total correctness of recursive procedures in the presence of unbounded nondeterminism is presented. notify = nipkow@in.tum.de [Stone_Algebras] title = Stone Algebras author = Walter Guttmann notify = walter.guttmann@canterbury.ac.nz date = 2016-09-06 topic = Mathematics/Order abstract = A range of algebras between lattices and Boolean algebras generalise the notion of a complement. We develop a hierarchy of these pseudo-complemented algebras that includes Stone algebras. Independently of this theory we study filters based on partial orders. Both theories are combined to prove Chen and Grätzer's construction theorem for Stone algebras. The latter involves extensive reasoning about algebraic structures in addition to reasoning in algebraic structures. [Kleene_Algebra] title = Kleene Algebra author = Alasdair Armstrong <>, Georg Struth , Tjark Weber date = 2013-01-15 topic = Computer Science/Programming Languages/Logics, Computer Science/Automata and Formal Languages, Mathematics/Algebra abstract = These files contain a formalisation of variants of Kleene algebras and their most important models as axiomatic type classes in Isabelle/HOL. Kleene algebras are foundational structures in computing with applications ranging from automata and language theory to computational modeling, program construction and verification.

We start with formalising dioids, which are additively idempotent semirings, and expand them by axiomatisations of the Kleene star for finite iteration and an omega operation for infinite iteration. We show that powersets over a given monoid, (regular) languages, sets of paths in a graph, sets of computation traces, binary relations and formal power series form Kleene algebras, and consider further models based on lattices, max-plus semirings and min-plus semirings. We also demonstrate that dioids are closed under the formation of matrices (proofs for Kleene algebras remain to be completed).

On the one hand we have aimed at a reference formalisation of variants of Kleene algebras that covers a wide range of variants and the core theorems in a structured and modular way and provides readable proofs at text book level. On the other hand, we intend to use this algebraic hierarchy and its models as a generic algebraic middle-layer from which programming applications can quickly be explored, implemented and verified. notify = g.struth@sheffield.ac.uk, tjark.weber@it.uu.se [KAT_and_DRA] title = Kleene Algebra with Tests and Demonic Refinement Algebras author = Alasdair Armstrong <>, Victor B. F. Gomes , Georg Struth date = 2014-01-23 topic = Computer Science/Programming Languages/Logics, Computer Science/Automata and Formal Languages, Mathematics/Algebra abstract = We formalise Kleene algebra with tests (KAT) and demonic refinement algebra (DRA) in Isabelle/HOL. KAT is relevant for program verification and correctness proofs in the partial correctness setting. While DRA targets similar applications in the context of total correctness. Our formalisation contains the two most important models of these algebras: binary relations in the case of KAT and predicate transformers in the case of DRA. In addition, we derive the inference rules for Hoare logic in KAT and its relational model and present a simple formally verified program verification tool prototype based on the algebraic approach. notify = g.struth@dcs.shef.ac.uk [KAD] title = Kleene Algebras with Domain author = Victor B. F. Gomes , Walter Guttmann , Peter Höfner , Georg Struth , Tjark Weber date = 2016-04-12 topic = Computer Science/Programming Languages/Logics, Computer Science/Automata and Formal Languages, Mathematics/Algebra abstract = Kleene algebras with domain are Kleene algebras endowed with an operation that maps each element of the algebra to its domain of definition (or its complement) in abstract fashion. They form a simple algebraic basis for Hoare logics, dynamic logics or predicate transformer semantics. We formalise a modular hierarchy of algebras with domain and antidomain (domain complement) operations in Isabelle/HOL that ranges from domain and antidomain semigroups to modal Kleene algebras and divergence Kleene algebras. We link these algebras with models of binary relations and program traces. We include some examples from modal logics, termination and program analysis. notify = walter.guttman@canterbury.ac.nz, g.struth@sheffield.ac.uk, tjark.weber@it.uu.se [Regular_Algebras] title = Regular Algebras author = Simon Foster , Georg Struth date = 2014-05-21 topic = Computer Science/Automata and Formal Languages, Mathematics/Algebra abstract = Regular algebras axiomatise the equational theory of regular expressions as induced by regular language identity. We use Isabelle/HOL for a detailed systematic study of regular algebras given by Boffa, Conway, Kozen and Salomaa. We investigate the relationships between these classes, formalise a soundness proof for the smallest class (Salomaa's) and obtain completeness of the largest one (Boffa's) relative to a deep result by Krob. In addition we provide a large collection of regular identities in the general setting of Boffa's axiom. Our regular algebra hierarchy is orthogonal to the Kleene algebra hierarchy in the Archive of Formal Proofs; we have not aimed at an integration for pragmatic reasons. notify = simon.foster@york.ac.uk, g.struth@sheffield.ac.uk [BytecodeLogicJmlTypes] title = A Bytecode Logic for JML and Types author = Lennart Beringer <>, Martin Hofmann date = 2008-12-12 topic = Computer Science/Programming Languages/Logics abstract = This document contains the Isabelle/HOL sources underlying the paper A bytecode logic for JML and types by Beringer and Hofmann, updated to Isabelle 2008. We present a program logic for a subset of sequential Java bytecode that is suitable for representing both, features found in high-level specification language JML as well as interpretations of high-level type systems. To this end, we introduce a fine-grained collection of assertions, including strong invariants, local annotations and VDM-reminiscent partial-correctness specifications. Thanks to a goal-oriented structure and interpretation of judgements, verification may proceed without recourse to an additional control flow analysis. The suitability for interpreting intensional type systems is illustrated by the proof-carrying-code style encoding of a type system for a first-order functional language which guarantees a constant upper bound on the number of objects allocated throughout an execution, be the execution terminating or non-terminating. Like the published paper, the formal development is restricted to a comparatively small subset of the JVML, lacking (among other features) exceptions, arrays, virtual methods, and static fields. This shortcoming has been overcome meanwhile, as our paper has formed the basis of the Mobius base logic, a program logic for the full sequential fragment of the JVML. Indeed, the present formalisation formed the basis of a subsequent formalisation of the Mobius base logic in the proof assistant Coq, which includes a proof of soundness with respect to the Bicolano operational semantics by Pichardie. notify = [DataRefinementIBP] title = Semantics and Data Refinement of Invariant Based Programs author = Viorel Preoteasa , Ralph-Johan Back date = 2010-05-28 topic = Computer Science/Programming Languages/Logics abstract = The invariant based programming is a technique of constructing correct programs by first identifying the basic situations (pre- and post-conditions and invariants) that can occur during the execution of the program, and then defining the transitions and proving that they preserve the invariants. Data refinement is a technique of building correct programs working on concrete datatypes as refinements of more abstract programs. In the theories presented here we formalize the predicate transformer semantics for invariant based programs and their data refinement. extra-history = Change history: [2012-01-05]: Moved some general complete lattice properties to the AFP entry Lattice Properties. Changed the definition of the data refinement relation to be more general and updated all corresponding theorems. Added new syntax for demonic and angelic update statements. notify = viorel.preoteasa@aalto.fi [RefinementReactive] title = Formalization of Refinement Calculus for Reactive Systems author = Viorel Preoteasa date = 2014-10-08 topic = Computer Science/Programming Languages/Logics abstract = We present a formalization of refinement calculus for reactive systems. Refinement calculus is based on monotonic predicate transformers (monotonic functions from sets of post-states to sets of pre-states), and it is a powerful formalism for reasoning about imperative programs. We model reactive systems as monotonic property transformers that transform sets of output infinite sequences into sets of input infinite sequences. Within this semantics we can model refinement of reactive systems, (unbounded) angelic and demonic nondeterminism, sequential composition, and other semantic properties. We can model systems that may fail for some inputs, and we can model compatibility of systems. We can specify systems that have liveness properties using linear temporal logic, and we can refine system specifications into systems based on symbolic transitions systems, suitable for implementations. notify = viorel.preoteasa@aalto.fi [SIFPL] title = Secure information flow and program logics author = Lennart Beringer <>, Martin Hofmann date = 2008-11-10 topic = Computer Science/Programming Languages/Logics, Computer Science/Security abstract = We present interpretations of type systems for secure information flow in Hoare logic, complementing previous encodings in relational program logics. We first treat the imperative language IMP, extended by a simple procedure call mechanism. For this language we consider base-line non-interference in the style of Volpano et al. and the flow-sensitive type system by Hunt and Sands. In both cases, we show how typing derivations may be used to automatically generate proofs in the program logic that certify the absence of illicit flows. We then add instructions for object creation and manipulation, and derive appropriate proof rules for base-line non-interference. As a consequence of our work, standard verification technology may be used for verifying that a concrete program satisfies the non-interference property.

The present proof development represents an update of the formalisation underlying our paper [CSF 2007] and is intended to resolve any ambiguities that may be present in the paper. notify = lennart.beringer@ifi.lmu.de [TLA] title = A Definitional Encoding of TLA* in Isabelle/HOL author = Gudmund Grov , Stephan Merz date = 2011-11-19 topic = Computer Science/Programming Languages/Logics abstract = We mechanise the logic TLA* [Merz 1999], an extension of Lamport's Temporal Logic of Actions (TLA) [Lamport 1994] for specifying and reasoning about concurrent and reactive systems. Aiming at a framework for mechanising] the verification of TLA (or TLA*) specifications, this contribution reuses some elements from a previous axiomatic encoding of TLA in Isabelle/HOL by the second author [Merz 1998], which has been part of the Isabelle distribution. In contrast to that previous work, we give here a shallow, definitional embedding, with the following highlights:

  • a theory of infinite sequences, including a formalisation of the concepts of stuttering invariance central to TLA and TLA*;
  • a definition of the semantics of TLA*, which extends TLA by a mutually-recursive definition of formulas and pre-formulas, generalising TLA action formulas;
  • a substantial set of derived proof rules, including the TLA* axioms and Lamport's proof rules for system verification;
  • a set of examples illustrating the usage of Isabelle/TLA* for reasoning about systems.
Note that this work is unrelated to the ongoing development of a proof system for the specification language TLA+, which includes an encoding of TLA+ as a new Isabelle object logic [Chaudhuri et al 2010]. notify = ggrov@inf.ed.ac.uk [Compiling-Exceptions-Correctly] title = Compiling Exceptions Correctly author = Tobias Nipkow date = 2004-07-09 topic = Computer Science/Programming Languages/Compiling abstract = An exception compilation scheme that dynamically creates and removes exception handler entries on the stack. A formalization of an article of the same name by Hutton and Wright. notify = nipkow@in.tum.de [NormByEval] title = Normalization by Evaluation author = Klaus Aehlig , Tobias Nipkow date = 2008-02-18 topic = Computer Science/Programming Languages/Compiling abstract = This article formalizes normalization by evaluation as implemented in Isabelle. Lambda calculus plus term rewriting is compiled into a functional program with pattern matching. It is proved that the result of a successful evaluation is a) correct, i.e. equivalent to the input, and b) in normal form. notify = nipkow@in.tum.de [Program-Conflict-Analysis] title = Formalization of Conflict Analysis of Programs with Procedures, Thread Creation, and Monitors topic = Computer Science/Programming Languages/Static Analysis author = Peter Lammich , Markus Müller-Olm date = 2007-12-14 abstract = In this work we formally verify the soundness and precision of a static program analysis that detects conflicts (e. g. data races) in programs with procedures, thread creation and monitors with the Isabelle theorem prover. As common in static program analysis, our program model abstracts guarded branching by nondeterministic branching, but completely interprets the call-/return behavior of procedures, synchronization by monitors, and thread creation. The analysis is based on the observation that all conflicts already occur in a class of particularly restricted schedules. These restricted schedules are suited to constraint-system-based program analysis. The formalization is based upon a flowgraph-based program model with an operational semantics as reference point. notify = peter.lammich@uni-muenster.de [Shivers-CFA] title = Shivers' Control Flow Analysis topic = Computer Science/Programming Languages/Static Analysis author = Joachim Breitner date = 2010-11-16 abstract = In his dissertation, Olin Shivers introduces a concept of control flow graphs for functional languages, provides an algorithm to statically derive a safe approximation of the control flow graph and proves this algorithm correct. In this research project, Shivers' algorithms and proofs are formalized in the HOLCF extension of HOL. notify = mail@joachim-breitner.de, nipkow@in.tum.de [Slicing] title = Towards Certified Slicing author = Daniel Wasserrab date = 2008-09-16 topic = Computer Science/Programming Languages/Static Analysis abstract = Slicing is a widely-used technique with applications in e.g. compiler technology and software security. Thus verification of algorithms in these areas is often based on the correctness of slicing, which should ideally be proven independent of concrete programming languages and with the help of well-known verifying techniques such as proof assistants. As a first step in this direction, this contribution presents a framework for dynamic and static intraprocedural slicing based on control flow and program dependence graphs. Abstracting from concrete syntax we base the framework on a graph representation of the program fulfilling certain structural and well-formedness properties.

The formalization consists of the basic framework (in subdirectory Basic/), the correctness proof for dynamic slicing (in subdirectory Dynamic/), the correctness proof for static intraprocedural slicing (in subdirectory StaticIntra/) and instantiations of the framework with a simple While language (in subdirectory While/) and the sophisticated object-oriented bytecode language of Jinja (in subdirectory JinjaVM/). For more information on the framework, see the TPHOLS 2008 paper by Wasserrab and Lochbihler and the PLAS 2009 paper by Wasserrab et al. notify = [HRB-Slicing] title = Backing up Slicing: Verifying the Interprocedural Two-Phase Horwitz-Reps-Binkley Slicer author = Daniel Wasserrab date = 2009-11-13 topic = Computer Science/Programming Languages/Static Analysis abstract = After verifying dynamic and static interprocedural slicing, we present a modular framework for static interprocedural slicing. To this end, we formalized the standard two-phase slicer from Horwitz, Reps and Binkley (see their TOPLAS 12(1) 1990 paper) together with summary edges as presented by Reps et al. (see FSE 1994). The framework is again modular in the programming language by using an abstract CFG, defined via structural and well-formedness properties. Using a weak simulation between the original and sliced graph, we were able to prove the correctness of static interprocedural slicing. We also instantiate our framework with a simple While language with procedures. This shows that the chosen abstractions are indeed valid. notify = nipkow@in.tum.de [WorkerWrapper] title = The Worker/Wrapper Transformation author = Peter Gammie date = 2009-10-30 topic = Computer Science/Programming Languages/Transformations abstract = Gill and Hutton formalise the worker/wrapper transformation, building on the work of Launchbury and Peyton-Jones who developed it as a way of changing the type at which a recursive function operates. This development establishes the soundness of the technique and several examples of its use. notify = peteg42@gmail.com, nipkow@in.tum.de [JiveDataStoreModel] title = Jive Data and Store Model author = Nicole Rauch , Norbert Schirmer <> date = 2005-06-20 license = LGPL topic = Computer Science/Programming Languages/Misc abstract = This document presents the formalization of an object-oriented data and store model in Isabelle/HOL. This model is being used in the Java Interactive Verification Environment, Jive. notify = kleing@cse.unsw.edu.au, schirmer@in.tum.de [HotelKeyCards] title = Hotel Key Card System author = Tobias Nipkow date = 2006-09-09 topic = Computer Science/Security abstract = Two models of an electronic hotel key card system are contrasted: a state based and a trace based one. Both are defined, verified, and proved equivalent in the theorem prover Isabelle/HOL. It is shown that if a guest follows a certain safety policy regarding her key cards, she can be sure that nobody but her can enter her room. notify = nipkow@in.tum.de [RSAPSS] title = SHA1, RSA, PSS and more author = Christina Lindenberg <>, Kai Wirt <> date = 2005-05-02 topic = Computer Science/Security/Cryptography abstract = Formal verification is getting more and more important in computer science. However the state of the art formal verification methods in cryptography are very rudimentary. These theories are one step to provide a tool box allowing the use of formal methods in every aspect of cryptography. Moreover we present a proof of concept for the feasibility of verification techniques to a standard signature algorithm. notify = nipkow@in.tum.de [InformationFlowSlicing] title = Information Flow Noninterference via Slicing author = Daniel Wasserrab date = 2010-03-23 topic = Computer Science/Security abstract =

In this contribution, we show how correctness proofs for intra- and interprocedural slicing can be used to prove that slicing is able to guarantee information flow noninterference. Moreover, we also illustrate how to lift the control flow graphs of the respective frameworks such that they fulfil the additional assumptions needed in the noninterference proofs. A detailed description of the intraprocedural proof and its interplay with the slicing framework can be found in the PLAS'09 paper by Wasserrab et al.

This entry contains the part for intra-procedural slicing. See entry InformationFlowSlicing_Inter for the inter-procedural part.

extra-history = Change history: [2016-06-10]: The original entry InformationFlowSlicing contained both the inter- and intra-procedural case was split into two for easier maintenance. notify = [InformationFlowSlicing_Inter] title = Inter-Procedural Information Flow Noninterference via Slicing author = Daniel Wasserrab date = 2010-03-23 topic = Computer Science/Security abstract =

In this contribution, we show how correctness proofs for intra- and interprocedural slicing can be used to prove that slicing is able to guarantee information flow noninterference. Moreover, we also illustrate how to lift the control flow graphs of the respective frameworks such that they fulfil the additional assumptions needed in the noninterference proofs. A detailed description of the intraprocedural proof and its interplay with the slicing framework can be found in the PLAS'09 paper by Wasserrab et al.

This entry contains the part for inter-procedural slicing. See entry InformationFlowSlicing for the intra-procedural part.

extra-history = Change history: [2016-06-10]: The original entry InformationFlowSlicing contained both the inter- and intra-procedural case was split into two for easier maintenance. notify = [ComponentDependencies] title = Formalisation and Analysis of Component Dependencies author = Maria Spichkova date = 2014-04-28 topic = Computer Science/System Description Languages abstract = This set of theories presents a formalisation in Isabelle/HOL of data dependencies between components. The approach allows to analyse system structure oriented towards efficient checking of system: it aims at elaborating for a concrete system, which parts of the system are necessary to check a given property. notify = maria.spichkova@rmit.edu.au [Verified-Prover] title = A Mechanically Verified, Efficient, Sound and Complete Theorem Prover For First Order Logic author = Tom Ridge <> date = 2004-09-28 topic = Logic abstract = Soundness and completeness for a system of first order logic are formally proved, building on James Margetson's formalization of work by Wainer and Wallen. The completeness proofs naturally suggest an algorithm to derive proofs. This algorithm, which can be implemented tail recursively, is formalized in Isabelle/HOL. The algorithm can be executed via the rewriting tactics of Isabelle. Alternatively, the definitions can be exported to OCaml, yielding a directly executable program. notify = lp15@cam.ac.uk [Completeness] title = Completeness theorem author = James Margetson <>, Tom Ridge <> date = 2004-09-20 topic = Logic abstract = The completeness of first-order logic is proved, following the first five pages of Wainer and Wallen's chapter of the book Proof Theory by Aczel et al., CUP, 1992. Their presentation of formulas allows the proofs to use symmetry arguments. Margetson formalized this theorem by early 2000. The Isar conversion is thanks to Tom Ridge. A paper describing the formalization is available [pdf]. notify = lp15@cam.ac.uk [Ordinal] title = Countable Ordinals author = Brian Huffman date = 2005-11-11 topic = Logic abstract = This development defines a well-ordered type of countable ordinals. It includes notions of continuous and normal functions, recursively defined functions over ordinals, least fixed-points, and derivatives. Much of ordinal arithmetic is formalized, including exponentials and logarithms. The development concludes with formalizations of Cantor Normal Form and Veblen hierarchies over normal functions. notify = lcp@cl.cam.ac.uk [Ordinals_and_Cardinals] title = Ordinals and Cardinals author = Andrei Popescu <> date = 2009-09-01 topic = Logic abstract = We develop a basic theory of ordinals and cardinals in Isabelle/HOL, up to the point where some cardinality facts relevant for the ``working mathematician" become available. Unlike in set theory, here we do not have at hand canonical notions of ordinal and cardinal. Therefore, here an ordinal is merely a well-order relation and a cardinal is an ordinal minim w.r.t. order embedding on its field. extra-history = Change history: [2012-09-25]: This entry has been discontinued because it is now part of the Isabelle distribution. notify = uuomul@yahoo.com, nipkow@in.tum.de [FOL-Fitting] title = First-Order Logic According to Fitting author = Stefan Berghofer contributors = Asta Halkjær From date = 2007-08-02 topic = Logic abstract = We present a formalization of parts of Melvin Fitting's book "First-Order Logic and Automated Theorem Proving". The formalization covers the syntax of first-order logic, its semantics, the model existence theorem, a natural deduction proof calculus together with a proof of correctness and completeness, as well as the Löwenheim-Skolem theorem. extra-history = Change history: [2018-07-21]: Proved completeness theorem for open formulas. Proofs are now written in the declarative style. Enumeration of pairs and datatypes is automated using the Countable theory. notify = berghofe@in.tum.de [Epistemic_Logic] title = Epistemic Logic author = Asta Halkjær From topic = Logic date = 2018-10-29 notify = ahfrom@dtu.dk abstract = This work is a formalization of epistemic logic with countably many agents. It includes proofs of soundness and completeness for the axiom system K. The completeness proof is based on the textbook "Reasoning About Knowledge" by Fagin, Halpern, Moses and Vardi (MIT Press 1995). [SequentInvertibility] title = Invertibility in Sequent Calculi author = Peter Chapman <> date = 2009-08-28 topic = Logic license = LGPL abstract = The invertibility of the rules of a sequent calculus is important for guiding proof search and can be used in some formalised proofs of Cut admissibility. We present sufficient conditions for when a rule is invertible with respect to a calculus. We illustrate the conditions with examples. It must be noted we give purely syntactic criteria; no guarantees are given as to the suitability of the rules. notify = pc@cs.st-andrews.ac.uk, nipkow@in.tum.de [LinearQuantifierElim] title = Quantifier Elimination for Linear Arithmetic author = Tobias Nipkow date = 2008-01-11 topic = Logic abstract = This article formalizes quantifier elimination procedures for dense linear orders, linear real arithmetic and Presburger arithmetic. In each case both a DNF-based non-elementary algorithm and one or more (doubly) exponential NNF-based algorithms are formalized, including the well-known algorithms by Ferrante and Rackoff and by Cooper. The NNF-based algorithms for dense linear orders are new but based on Ferrante and Rackoff and on an algorithm by Loos and Weisspfenning which simulates infenitesimals. All algorithms are directly executable. In particular, they yield reflective quantifier elimination procedures for HOL itself. The formalization makes heavy use of locales and is therefore highly modular. notify = nipkow@in.tum.de [Nat-Interval-Logic] title = Interval Temporal Logic on Natural Numbers author = David Trachtenherz <> date = 2011-02-23 topic = Logic abstract = We introduce a theory of temporal logic operators using sets of natural numbers as time domain, formalized in a shallow embedding manner. The theory comprises special natural intervals (theory IL_Interval: open and closed intervals, continuous and modulo intervals, interval traversing results), operators for shifting intervals to left/right on the number axis as well as expanding/contracting intervals by constant factors (theory IL_IntervalOperators.thy), and ultimately definitions and results for unary and binary temporal operators on arbitrary natural sets (theory IL_TemporalOperators). notify = nipkow@in.tum.de [Recursion-Theory-I] title = Recursion Theory I author = Michael Nedzelsky <> date = 2008-04-05 topic = Logic abstract = This document presents the formalization of introductory material from recursion theory --- definitions and basic properties of primitive recursive functions, Cantor pairing function and computably enumerable sets (including a proof of existence of a one-complete computably enumerable set and a proof of the Rice's theorem). notify = MichaelNedzelsky@yandex.ru [Free-Boolean-Algebra] topic = Logic title = Free Boolean Algebra author = Brian Huffman date = 2010-03-29 abstract = This theory defines a type constructor representing the free Boolean algebra over a set of generators. Values of type (α)formula represent propositional formulas with uninterpreted variables from type α, ordered by implication. In addition to all the standard Boolean algebra operations, the library also provides a function for building homomorphisms to any other Boolean algebra type. notify = brianh@cs.pdx.edu [Sort_Encodings] title = Sound and Complete Sort Encodings for First-Order Logic author = Jasmin Christian Blanchette , Andrei Popescu date = 2013-06-27 topic = Logic abstract = This is a formalization of the soundness and completeness properties for various efficient encodings of sorts in unsorted first-order logic used by Isabelle's Sledgehammer tool.

Essentially, the encodings proceed as follows: a many-sorted problem is decorated with (as few as possible) tags or guards that make the problem monotonic; then sorts can be soundly erased.

The development employs a formalization of many-sorted first-order logic in clausal form (clauses, structures and the basic properties of the satisfaction relation), which could be of interest as the starting point for other formalizations of first-order logic metatheory. notify = uuomul@yahoo.com [Lambda_Free_RPOs] title = Formalization of Recursive Path Orders for Lambda-Free Higher-Order Terms author = Jasmin Christian Blanchette , Uwe Waldmann , Daniel Wand date = 2016-09-23 topic = Logic/Rewriting abstract = This Isabelle/HOL formalization defines recursive path orders (RPOs) for higher-order terms without lambda-abstraction and proves many useful properties about them. The main order fully coincides with the standard RPO on first-order terms also in the presence of currying, distinguishing it from previous work. An optimized variant is formalized as well. It appears promising as the basis of a higher-order superposition calculus. notify = jasmin.blanchette@gmail.com [Lambda_Free_KBOs] title = Formalization of Knuth–Bendix Orders for Lambda-Free Higher-Order Terms author = Heiko Becker , Jasmin Christian Blanchette , Uwe Waldmann , Daniel Wand date = 2016-11-12 topic = Logic/Rewriting abstract = 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. notify = jasmin.blanchette@gmail.com [Lambda_Free_EPO] title = Formalization of the Embedding Path Order for Lambda-Free Higher-Order Terms author = Alexander Bentkamp topic = Logic/Rewriting date = 2018-10-19 notify = a.bentkamp@vu.nl abstract = 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. [Nested_Multisets_Ordinals] title = Formalization of Nested Multisets, Hereditary Multisets, and Syntactic Ordinals author = Jasmin Christian Blanchette , Mathias Fleury , Dmitriy Traytel date = 2016-11-12 topic = Logic/Rewriting abstract = 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. notify = jasmin.blanchette@gmail.com [Abstract-Rewriting] title = Abstract Rewriting topic = Logic/Rewriting date = 2010-06-14 author = Christian Sternagel , René Thiemann license = LGPL abstract = We present an Isabelle formalization of abstract rewriting (see, e.g., the book by Baader and Nipkow). First, we define standard relations like joinability, meetability, conversion, etc. Then, we formalize important properties of abstract rewrite systems, e.g., confluence and strong normalization. Our main concern is on strong normalization, since this formalization is the basis of CeTA (which is mainly about strong normalization of term rewrite systems). Hence lemmas involving strong normalization constitute by far the biggest part of this theory. One of those is Newman's lemma. extra-history = Change history: [2010-09-17]: Added theories defining several (ordered) semirings related to strong normalization and giving some standard instances.
[2013-10-16]: Generalized delta-orders from rationals to Archimedean fields. notify = christian.sternagel@uibk.ac.at, rene.thiemann@uibk.ac.at [First_Order_Terms] title = First-Order Terms author = Christian Sternagel , René Thiemann topic = Logic/Rewriting, Computer Science/Algorithms license = LGPL date = 2018-02-06 notify = c.sternagel@gmail.com, rene.thiemann@uibk.ac.at abstract = We formalize basic results on first-order terms, including matching and a first-order unification algorithm, as well as well-foundedness of the subsumption order. This entry is part of the Isabelle Formalization of Rewriting IsaFoR, 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. [Free-Groups] title = Free Groups author = Joachim Breitner date = 2010-06-24 topic = Mathematics/Algebra abstract = Free Groups are, in a sense, the most generic kind of group. They are defined over a set of generators with no additional relations in between them. They play an important role in the definition of group presentations and in other fields. This theory provides the definition of Free Group as the set of fully canceled words in the generators. The universal property is proven, as well as some isomorphisms results about Free Groups. extra-history = Change history: [2011-12-11]: Added the Ping Pong Lemma. notify = [CofGroups] title = An Example of a Cofinitary Group in Isabelle/HOL author = Bart Kastermans date = 2009-08-04 topic = Mathematics/Algebra abstract = We formalize the usual proof that the group generated by the function k -> k + 1 on the integers gives rise to a cofinitary group. notify = nipkow@in.tum.de [Group-Ring-Module] title = Groups, Rings and Modules author = Hidetsune Kobayashi <>, L. Chen <>, H. Murao <> date = 2004-05-18 topic = Mathematics/Algebra abstract = The theory of groups, rings and modules is developed to a great depth. Group theory results include Zassenhaus's theorem and the Jordan-Hoelder theorem. The ring theory development includes ideals, quotient rings and the Chinese remainder theorem. The module development includes the Nakayama lemma, exact sequences and Tensor products. notify = lp15@cam.ac.uk [Robbins-Conjecture] title = A Complete Proof of the Robbins Conjecture author = Matthew Wampler-Doty <> date = 2010-05-22 topic = Mathematics/Algebra abstract = This document gives a formalization of the proof of the Robbins conjecture, following A. Mann, A Complete Proof of the Robbins Conjecture, 2003. notify = nipkow@in.tum.de [Valuation] title = Fundamental Properties of Valuation Theory and Hensel's Lemma author = Hidetsune Kobayashi <> date = 2007-08-08 topic = Mathematics/Algebra abstract = Convergence with respect to a valuation is discussed as convergence of a Cauchy sequence. Cauchy sequences of polynomials are defined. They are used to formalize Hensel's lemma. notify = lp15@cam.ac.uk [Rank_Nullity_Theorem] title = Rank-Nullity Theorem in Linear Algebra author = Jose Divasón , Jesús Aransay topic = Mathematics/Algebra date = 2013-01-16 abstract = In this contribution, we present some formalizations based on the HOL-Multivariate-Analysis session of Isabelle. Firstly, a generalization of several theorems of such library are presented. Secondly, some definitions and proofs involving Linear Algebra and the four fundamental subspaces of a matrix are shown. Finally, we present a proof of the result known in Linear Algebra as the ``Rank-Nullity Theorem'', which states that, given any linear map f from a finite dimensional vector space V to a vector space W, then the dimension of V is equal to the dimension of the kernel of f (which is a subspace of V) and the dimension of the range of f (which is a subspace of W). The proof presented here is based on the one given by Sheldon Axler in his book Linear Algebra Done Right. As a corollary of the previous theorem, and taking advantage of the relationship between linear maps and matrices, we prove that, for every matrix A (which has associated a linear map between finite dimensional vector spaces), the sum of its null space and its column space (which is equal to the range of the linear map) is equal to the number of columns of A. extra-history = Change history: [2014-07-14]: Added some generalizations that allow us to formalize the Rank-Nullity Theorem over finite dimensional vector spaces, instead of over the more particular euclidean spaces. Updated abstract. notify = jose.divasonm@unirioja.es, jesus-maria.aransay@unirioja.es [Affine_Arithmetic] title = Affine Arithmetic author = Fabian Immler date = 2014-02-07 topic = Mathematics/Analysis abstract = We give a formalization of affine forms as abstract representations of zonotopes. We provide affine operations as well as overapproximations of some non-affine operations like multiplication and division. Expressions involving those operations can automatically be turned into (executable) functions approximating the original expression in affine arithmetic. extra-history = Change history: [2015-01-31]: added algorithm for zonotope/hyperplane intersection
[2017-09-20]: linear approximations for all symbols from the floatarith data type notify = immler@in.tum.de [Laplace_Transform] title = Laplace Transform author = Fabian Immler topic = Mathematics/Analysis date = 2019-08-14 notify = fimmler@cs.cmu.edu abstract = This entry formalizes the Laplace transform and concrete Laplace transforms for arithmetic functions, frequency shift, integration and (higher) differentiation in the time domain. It proves Lerch's lemma and uniqueness of the Laplace transform for continuous functions. In order to formalize the foundational assumptions, this entry contains a formalization of piecewise continuous functions and functions of exponential order. [Cauchy] title = Cauchy's Mean Theorem and the Cauchy-Schwarz Inequality author = Benjamin Porter <> date = 2006-03-14 topic = Mathematics/Analysis abstract = This document presents the mechanised proofs of two popular theorems attributed to Augustin Louis Cauchy - Cauchy's Mean Theorem and the Cauchy-Schwarz Inequality. notify = kleing@cse.unsw.edu.au [Integration] title = Integration theory and random variables author = Stefan Richter date = 2004-11-19 topic = Mathematics/Analysis abstract = Lebesgue-style integration plays a major role in advanced probability. We formalize concepts of elementary measure theory, real-valued random variables as Borel-measurable functions, and a stepwise inductive definition of the integral itself. All proofs are carried out in human readable style using the Isar language. extra-note = Note: This article is of historical interest only. Lebesgue-style integration and probability theory are now available as part of the Isabelle/HOL distribution (directory Probability). notify = richter@informatik.rwth-aachen.de, nipkow@in.tum.de, hoelzl@in.tum.de [Ordinary_Differential_Equations] title = Ordinary Differential Equations author = Fabian Immler , Johannes Hölzl topic = Mathematics/Analysis date = 2012-04-26 abstract =

Session Ordinary-Differential-Equations formalizes ordinary differential equations (ODEs) and initial value problems. This work comprises proofs for local and global existence of unique solutions (Picard-Lindelöf theorem). Moreover, it contains a formalization of the (continuous or even differentiable) dependency of the flow on initial conditions as the flow of ODEs.

Not in the generated document are the following sessions:

  • HOL-ODE-Numerics: Rigorous numerical algorithms for computing enclosures of solutions based on Runge-Kutta methods and affine arithmetic. Reachability analysis with splitting and reduction at hyperplanes.
  • HOL-ODE-Examples: Applications of the numerical algorithms to concrete systems of ODEs.
  • Lorenz_C0, Lorenz_C1: Verified algorithms for checking C1-information according to Tucker's proof, computation of C0-information.

extra-history = Change history: [2014-02-13]: added an implementation of the Euler method based on affine arithmetic
[2016-04-14]: added flow and variational equation
[2016-08-03]: numerical algorithms for reachability analysis (using second-order Runge-Kutta methods, splitting, and reduction) implemented using Lammich's framework for automatic refinement
[2017-09-20]: added Poincare map and propagation of variational equation in reachability analysis, verified algorithms for C1-information and computations for C0-information of the Lorenz attractor. notify = immler@in.tum.de, hoelzl@in.tum.de [Polynomials] title = Executable Multivariate Polynomials author = Christian Sternagel , René Thiemann , Alexander Maletzky , Fabian Immler , Florian Haftmann , Andreas Lochbihler , Alexander Bentkamp date = 2010-08-10 topic = Mathematics/Analysis, Mathematics/Algebra, Computer Science/Algorithms/Mathematical license = LGPL abstract = We define multivariate polynomials over arbitrary (ordered) semirings in combination with (executable) operations like addition, multiplication, and substitution. We also define (weak) monotonicity of polynomials and comparison of polynomials where we provide standard estimations like absolute positiveness or the more recent approach of Neurauter, Zankl, and Middeldorp. Moreover, it is proven that strongly normalizing (monotone) orders can be lifted to strongly normalizing (monotone) orders over polynomials. Our formalization was performed as part of the IsaFoR/CeTA-system which contains several termination techniques. The provided theories have been essential to formalize polynomial interpretations.

This formalization also contains an abstract representation as coefficient functions with finite support and a type of power-products. If this type is ordered by a linear (term) ordering, various additional notions, such as leading power-product, leading coefficient etc., are introduced as well. Furthermore, a lot of generic properties of, and functions on, multivariate polynomials are formalized, including the substitution and evaluation homomorphisms, embeddings of polynomial rings into larger rings (i.e. with one additional indeterminate), homogenization and dehomogenization of polynomials, and the canonical isomorphism between R[X,Y] and R[X][Y]. extra-history = Change history: [2010-09-17]: Moved theories on arbitrary (ordered) semirings to Abstract Rewriting.
[2016-10-28]: Added abstract representation of polynomials and authors Maletzky/Immler.
[2018-01-23]: Added authors Haftmann, Lochbihler after incorporating their formalization of multivariate polynomials based on Polynomial mappings. Moved material from Bentkamp's entry "Deep Learning".
[2019-04-18]: Added material about polynomials whose power-products are represented themselves by polynomial mappings. notify = rene.thiemann@uibk.ac.at, christian.sternagel@uibk.ac.at, alexander.maletzky@risc.jku.at, immler@in.tum.de [Sqrt_Babylonian] title = Computing N-th Roots using the Babylonian Method author = René Thiemann date = 2013-01-03 topic = Mathematics/Analysis license = LGPL abstract = We implement the Babylonian method to compute n-th roots of numbers. We provide precise algorithms for naturals, integers and rationals, and offer an approximation algorithm for square roots over linear ordered fields. Moreover, there are precise algorithms to compute the floor and the ceiling of n-th roots. extra-history = Change history: [2013-10-16]: Added algorithms to compute floor and ceiling of sqrt of integers. [2014-07-11]: Moved NthRoot_Impl from Real-Impl to this entry. notify = rene.thiemann@uibk.ac.at [Sturm_Sequences] title = Sturm's Theorem author = Manuel Eberl date = 2014-01-11 topic = Mathematics/Analysis abstract = Sturm's Theorem states that polynomial sequences with certain properties, so-called Sturm sequences, can be used to count the number of real roots of a real polynomial. This work contains a proof of Sturm's Theorem and code for constructing Sturm sequences efficiently. It also provides the “sturm” proof method, which can decide certain statements about the roots of real polynomials, such as “the polynomial P has exactly n roots in the interval I” or “P(x) > Q(x) for all x ∈ ℝ”. notify = eberlm@in.tum.de [Sturm_Tarski] title = The Sturm-Tarski Theorem author = Wenda Li date = 2014-09-19 topic = Mathematics/Analysis abstract = We have formalized the Sturm-Tarski theorem (also referred as the Tarski theorem), which generalizes Sturm's theorem. Sturm's theorem is usually used as a way to count distinct real roots, while the Sturm-Tarksi theorem forms the basis for Tarski's classic quantifier elimination for real closed field. notify = wl302@cam.ac.uk [Markov_Models] title = Markov Models author = Johannes Hölzl , Tobias Nipkow date = 2012-01-03 topic = Mathematics/Probability Theory, Computer Science/Automata and Formal Languages abstract = This is a formalization of Markov models in Isabelle/HOL. It builds on Isabelle's probability theory. The available models are currently Discrete-Time Markov Chains and a extensions of them with rewards.

As application of these models we formalize probabilistic model checking of pCTL formulas, analysis of IPv4 address allocation in ZeroConf and an analysis of the anonymity of the Crowds protocol. See here for the corresponding paper. notify = hoelzl@in.tum.de [Probabilistic_System_Zoo] title = A Zoo of Probabilistic Systems author = Johannes Hölzl , Andreas Lochbihler , Dmitriy Traytel date = 2015-05-27 topic = Computer Science/Automata and Formal Languages abstract = Numerous models of probabilistic systems are studied in the literature. Coalgebra has been used to classify them into system types and compare their expressiveness. We formalize the resulting hierarchy of probabilistic system types by modeling the semantics of the different systems as codatatypes. This approach yields simple and concise proofs, as bisimilarity coincides with equality for codatatypes.

This work is described in detail in the ITP 2015 publication by the authors. notify = traytel@in.tum.de [Density_Compiler] title = A Verified Compiler for Probability Density Functions author = Manuel Eberl , Johannes Hölzl , Tobias Nipkow date = 2014-10-09 topic = Mathematics/Probability Theory, Computer Science/Programming Languages/Compiling abstract = Bhat et al. [TACAS 2013] developed an inductive compiler that computes density functions for probability spaces described by programs in a probabilistic functional language. In this work, we implement such a compiler for a modified version of this language within the theorem prover Isabelle and give a formal proof of its soundness w.r.t. the semantics of the source and target language. Together with Isabelle's code generation for inductive predicates, this yields a fully verified, executable density compiler. The proof is done in two steps: First, an abstract compiler working with abstract functions modelled directly in the theorem prover's logic is defined and proved sound. Then, this compiler is refined to a concrete version that returns a target-language expression.

An article with the same title and authors is published in the proceedings of ESOP 2015. A detailed presentation of this work can be found in the first author's master's thesis. notify = hoelzl@in.tum.de [CAVA_Automata] title = The CAVA Automata Library author = Peter Lammich date = 2014-05-28 topic = Computer Science/Automata and Formal Languages abstract = We report on the graph and automata library that is used in the fully verified LTL model checker CAVA. As most components of CAVA use some type of graphs or automata, a common automata library simplifies assembly of the components and reduces redundancy.

The CAVA Automata Library provides a hierarchy of graph and automata classes, together with some standard algorithms. Its object oriented design allows for sharing of algorithms, theorems, and implementations between its classes, and also simplifies extensions of the library. Moreover, it is integrated into the Automatic Refinement Framework, supporting automatic refinement of the abstract automata types to efficient data structures.

Note that the CAVA Automata Library is work in progress. Currently, it is very specifically tailored towards the requirements of the CAVA model checker. Nevertheless, the formalization techniques presented here allow an extension of the library to a wider scope. Moreover, they are not limited to graph libraries, but apply to class hierarchies in general.

The CAVA Automata Library is described in the paper: Peter Lammich, The CAVA Automata Library, Isabelle Workshop 2014. notify = lammich@in.tum.de [LTL] title = Linear Temporal Logic author = Salomon Sickert contributors = Benedikt Seidl date = 2016-03-01 topic = Logic, Computer Science/Automata and Formal Languages abstract = This theory provides a formalisation of linear temporal logic (LTL) and unifies previous formalisations within the AFP. This entry establishes syntax and semantics for this logic and decouples it from existing entries, yielding a common environment for theories reasoning about LTL. Furthermore a parser written in SML and an executable simplifier are provided. extra-history = Change history: [2019-03-12]: Support for additional operators, implementation of common equivalence relations, definition of syntactic fragments of LTL and the minimal disjunctive normal form.
notify = sickert@in.tum.de [LTL_to_GBA] title = Converting Linear-Time Temporal Logic to Generalized Büchi Automata author = Alexander Schimpf , Peter Lammich date = 2014-05-28 topic = Computer Science/Automata and Formal Languages abstract = We formalize linear-time temporal logic (LTL) and the algorithm by Gerth et al. to convert LTL formulas to generalized Büchi automata. We also formalize some syntactic rewrite rules that can be applied to optimize the LTL formula before conversion. Moreover, we integrate the Stuttering Equivalence AFP-Entry by Stefan Merz, adapting the lemma that next-free LTL formula cannot distinguish between stuttering equivalent runs to our setting.

We use the Isabelle Refinement and Collection framework, as well as the Autoref tool, to obtain a refined version of our algorithm, from which efficiently executable code can be extracted. notify = lammich@in.tum.de [Gabow_SCC] title = Verified Efficient Implementation of Gabow's Strongly Connected Components Algorithm author = Peter Lammich date = 2014-05-28 topic = Computer Science/Algorithms/Graph, Mathematics/Graph Theory abstract = We present an Isabelle/HOL formalization of Gabow's algorithm for finding the strongly connected components of a directed graph. Using data refinement techniques, we extract efficient code that performs comparable to a reference implementation in Java. Our style of formalization allows for re-using large parts of the proofs when defining variants of the algorithm. We demonstrate this by verifying an algorithm for the emptiness check of generalized Büchi automata, re-using most of the existing proofs. notify = lammich@in.tum.de [Promela] title = Promela Formalization author = René Neumann date = 2014-05-28 topic = Computer Science/System Description Languages abstract = We present an executable formalization of the language Promela, the description language for models of the model checker SPIN. This formalization is part of the work for a completely verified model checker (CAVA), but also serves as a useful (and executable!) description of the semantics of the language itself, something that is currently missing. The formalization uses three steps: It takes an abstract syntax tree generated from an SML parser, removes syntactic sugar and enriches it with type information. This further gets translated into a transition system, on which the semantic engine (read: successor function) operates. notify = [CAVA_LTL_Modelchecker] title = A Fully Verified Executable LTL Model Checker author = Javier Esparza , Peter Lammich , René Neumann , Tobias Nipkow , Alexander Schimpf , Jan-Georg Smaus date = 2014-05-28 topic = Computer Science/Automata and Formal Languages abstract = We present an LTL model checker whose code has been completely verified using the Isabelle theorem prover. The checker consists of over 4000 lines of ML code. The code is produced using the Isabelle Refinement Framework, which allows us to split its correctness proof into (1) the proof of an abstract version of the checker, consisting of a few hundred lines of ``formalized pseudocode'', and (2) a verified refinement step in which mathematical sets and other abstract structures are replaced by implementations of efficient structures like red-black trees and functional arrays. This leads to a checker that, while still slower than unverified checkers, can already be used as a trusted reference implementation against which advanced implementations can be tested.

An early version of this model checker is described in the CAV 2013 paper with the same title. notify = lammich@in.tum.de [Fermat3_4] title = Fermat's Last Theorem for Exponents 3 and 4 and the Parametrisation of Pythagorean Triples author = Roelof Oosterhuis <> date = 2007-08-12 topic = Mathematics/Number Theory abstract = This document presents the mechanised proofs of

  • Fermat's Last Theorem for exponents 3 and 4 and
  • the parametrisation of Pythagorean Triples.
notify = nipkow@in.tum.de, roelofoosterhuis@gmail.com [Perfect-Number-Thm] title = Perfect Number Theorem author = Mark Ijbema date = 2009-11-22 topic = Mathematics/Number Theory abstract = These theories present the mechanised proof of the Perfect Number Theorem. notify = nipkow@in.tum.de [SumSquares] title = Sums of Two and Four Squares author = Roelof Oosterhuis <> date = 2007-08-12 topic = Mathematics/Number Theory abstract = This document presents the mechanised proofs of the following results:
  • any prime number of the form 4m+1 can be written as the sum of two squares;
  • any natural number can be written as the sum of four squares
notify = nipkow@in.tum.de, roelofoosterhuis@gmail.com [Lehmer] title = Lehmer's Theorem author = Simon Wimmer , Lars Noschinski date = 2013-07-22 topic = Mathematics/Number Theory abstract = In 1927, Lehmer presented criterions for primality, based on the converse of Fermat's litte theorem. This work formalizes the second criterion from Lehmer's paper, a necessary and sufficient condition for primality.

As a side product we formalize some properties of Euler's phi-function, the notion of the order of an element of a group, and the cyclicity of the multiplicative group of a finite field. notify = noschinl@gmail.com, simon.wimmer@tum.de [Pratt_Certificate] title = Pratt's Primality Certificates author = Simon Wimmer , Lars Noschinski date = 2013-07-22 topic = Mathematics/Number Theory abstract = In 1975, Pratt introduced a proof system for certifying primes. He showed that a number p is prime iff a primality certificate for p exists. By showing a logarithmic upper bound on the length of the certificates in size of the prime number, he concluded that the decision problem for prime numbers is in NP. This work formalizes soundness and completeness of Pratt's proof system as well as an upper bound for the size of the certificate. notify = noschinl@gmail.com, simon.wimmer@tum.de [Monad_Memo_DP] title = Monadification, Memoization and Dynamic Programming author = Simon Wimmer , Shuwei Hu , Tobias Nipkow topic = Computer Science/Programming Languages/Transformations, Computer Science/Algorithms, Computer Science/Functional Programming date = 2018-05-22 notify = wimmers@in.tum.de abstract = 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]. [Probabilistic_Timed_Automata] title = Probabilistic Timed Automata author = Simon Wimmer , Johannes Hölzl topic = Mathematics/Probability Theory, Computer Science/Automata and Formal Languages date = 2018-05-24 notify = wimmers@in.tum.de, hoelzl@in.tum.de abstract = 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]. [Hidden_Markov_Models] title = Hidden Markov Models author = Simon Wimmer topic = Mathematics/Probability Theory, Computer Science/Algorithms date = 2018-05-25 notify = wimmers@in.tum.de abstract = 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]. [ArrowImpossibilityGS] title = Arrow and Gibbard-Satterthwaite author = Tobias Nipkow date = 2008-09-01 topic = Mathematics/Games and Economics abstract = This article formalizes two proofs of Arrow's impossibility theorem due to Geanakoplos and derives the Gibbard-Satterthwaite theorem as a corollary. One formalization is based on utility functions, the other one on strict partial orders.

An article about these proofs is found here. notify = nipkow@in.tum.de [SenSocialChoice] title = Some classical results in Social Choice Theory author = Peter Gammie date = 2008-11-09 topic = Mathematics/Games and Economics abstract = Drawing on Sen's landmark work "Collective Choice and Social Welfare" (1970), this development proves Arrow's General Possibility Theorem, Sen's Liberal Paradox and May's Theorem in a general setting. The goal was to make precise the classical statements and proofs of these results, and to provide a foundation for more recent results such as the Gibbard-Satterthwaite and Duggan-Schwartz theorems. notify = nipkow@in.tum.de [Vickrey_Clarke_Groves] title = VCG - Combinatorial Vickrey-Clarke-Groves Auctions author = Marco B. Caminati <>, Manfred Kerber , Christoph Lange, Colin Rowat date = 2015-04-30 topic = Mathematics/Games and Economics abstract = A VCG auction (named after their inventors Vickrey, Clarke, and Groves) is a generalization of the single-good, second price Vickrey auction to the case of a combinatorial auction (multiple goods, from which any participant can bid on each possible combination). We formalize in this entry VCG auctions, including tie-breaking and prove that the functions for the allocation and the price determination are well-defined. Furthermore we show that the allocation function allocates goods only to participants, only goods in the auction are allocated, and no good is allocated twice. We also show that the price function is non-negative. These properties also hold for the automatically extracted Scala code. notify = mnfrd.krbr@gmail.com [Topology] title = Topology author = Stefan Friedrich <> date = 2004-04-26 topic = Mathematics/Topology abstract = This entry contains two theories. The first, Topology, develops the basic notions of general topology. The second, which can be viewed as a demonstration of the first, is called LList_Topology. It develops the topology of lazy lists. notify = lcp@cl.cam.ac.uk [Knot_Theory] title = Knot Theory author = T.V.H. Prathamesh date = 2016-01-20 topic = Mathematics/Topology abstract = This work contains a formalization of some topics in knot theory. The concepts that were formalized include definitions of tangles, links, framed links and link/tangle equivalence. The formalization is based on a formulation of links in terms of tangles. We further construct and prove the invariance of the Bracket polynomial. Bracket polynomial is an invariant of framed links closely linked to the Jones polynomial. This is perhaps the first attempt to formalize any aspect of knot theory in an interactive proof assistant. notify = prathamesh@imsc.res.in [Graph_Theory] title = Graph Theory author = Lars Noschinski date = 2013-04-28 topic = Mathematics/Graph Theory abstract = This development provides a formalization of directed graphs, supporting (labelled) multi-edges and infinite graphs. A polymorphic edge type allows edges to be treated as pairs of vertices, if multi-edges are not required. Formalized properties are i.a. walks (and related concepts), connectedness and subgraphs and basic properties of isomorphisms.

This formalization is used to prove characterizations of Euler Trails, Shortest Paths and Kuratowski subgraphs. notify = noschinl@gmail.com [Planarity_Certificates] title = Planarity Certificates author = Lars Noschinski date = 2015-11-11 topic = Mathematics/Graph Theory abstract = This development provides a formalization of planarity based on combinatorial maps and proves that Kuratowski's theorem implies combinatorial planarity. Moreover, it contains verified implementations of programs checking certificates for planarity (i.e., a combinatorial map) or non-planarity (i.e., a Kuratowski subgraph). notify = noschinl@gmail.com [Max-Card-Matching] title = Maximum Cardinality Matching author = Christine Rizkallah date = 2011-07-21 topic = Mathematics/Graph Theory abstract =

A matching in a graph G is a subset M of the edges of G such that no two share an endpoint. A matching has maximum cardinality if its cardinality is at least as large as that of any other matching. An odd-set cover OSC of a graph G is a labeling of the nodes of G with integers such that every edge of G is either incident to a node labeled 1 or connects two nodes labeled with the same number i ≥ 2.

This article proves Edmonds theorem:
Let M be a matching in a graph G and let OSC be an odd-set cover of G. For any i ≥ 0, let n(i) be the number of nodes labeled i. If |M| = n(1) + ∑i ≥ 2(n(i) div 2), then M is a maximum cardinality matching.

notify = nipkow@in.tum.de [Girth_Chromatic] title = A Probabilistic Proof of the Girth-Chromatic Number Theorem author = Lars Noschinski date = 2012-02-06 topic = Mathematics/Graph Theory abstract = This works presents a formalization of the Girth-Chromatic number theorem in graph theory, stating that graphs with arbitrarily large girth and chromatic number exist. The proof uses the theory of Random Graphs to prove the existence with probabilistic arguments. notify = noschinl@gmail.com [Random_Graph_Subgraph_Threshold] title = Properties of Random Graphs -- Subgraph Containment author = Lars Hupel date = 2014-02-13 topic = Mathematics/Graph Theory, Mathematics/Probability Theory abstract = Random graphs are graphs with a fixed number of vertices, where each edge is present with a fixed probability. We are interested in the probability that a random graph contains a certain pattern, for example a cycle or a clique. A very high edge probability gives rise to perhaps too many edges (which degrades performance for many algorithms), whereas a low edge probability might result in a disconnected graph. We prove a theorem about a threshold probability such that a higher edge probability will asymptotically almost surely produce a random graph with the desired subgraph. notify = hupel@in.tum.de [Flyspeck-Tame] title = Flyspeck I: Tame Graphs author = Gertrud Bauer <>, Tobias Nipkow date = 2006-05-22 topic = Mathematics/Graph Theory abstract = These theories present the verified enumeration of tame plane graphs as defined by Thomas C. Hales in his proof of the Kepler Conjecture in his book Dense Sphere Packings. A Blueprint for Formal Proofs. [CUP 2012]. The values of the constants in the definition of tameness are identical to those in the Flyspeck project. The IJCAR 2006 paper by Nipkow, Bauer and Schultz refers to the original version of Hales' proof, the ITP 2011 paper by Nipkow refers to the Blueprint version of the proof. extra-history = Change history: [2010-11-02]: modified theories to reflect the modified definition of tameness in Hales' revised proof.
[2014-07-03]: modified constants in def of tameness and Archive according to the final state of the Flyspeck proof. notify = nipkow@in.tum.de [Well_Quasi_Orders] title = Well-Quasi-Orders author = Christian Sternagel date = 2012-04-13 topic = Mathematics/Combinatorics abstract = Based on Isabelle/HOL's type class for preorders, we introduce a type class for well-quasi-orders (wqo) which is characterized by the absence of "bad" sequences (our proofs are along the lines of the proof of Nash-Williams, from which we also borrow terminology). Our main results are instantiations for the product type, the list type, and a type of finite trees, which (almost) directly follow from our proofs of (1) Dickson's Lemma, (2) Higman's Lemma, and (3) Kruskal's Tree Theorem. More concretely:
  • If the sets A and B are wqo then their Cartesian product is wqo.
  • If the set A is wqo then the set of finite lists over A is wqo.
  • If the set A is wqo then the set of finite trees over A is wqo.
The research was funded by the Austrian Science Fund (FWF): J3202. extra-history = Change history: [2012-06-11]: Added Kruskal's Tree Theorem.
[2012-12-19]: New variant of Kruskal's tree theorem for terms (as opposed to variadic terms, i.e., trees), plus finite version of the tree theorem as corollary.
[2013-05-16]: Simplified construction of minimal bad sequences.
[2014-07-09]: Simplified proofs of Higman's lemma and Kruskal's tree theorem, based on homogeneous sequences.
[2016-01-03]: An alternative proof of Higman's lemma by open induction.
[2017-06-08]: Proved (classical) equivalence to inductive definition of almost-full relations according to the ITP 2012 paper "Stop When You Are Almost-Full" by Vytiniotis, Coquand, and Wahlstedt. notify = c.sternagel@gmail.com [Marriage] title = Hall's Marriage Theorem author = Dongchen Jiang , Tobias Nipkow date = 2010-12-17 topic = Mathematics/Combinatorics abstract = Two proofs of Hall's Marriage Theorem: one due to Halmos and Vaughan, one due to Rado. extra-history = Change history: [2011-09-09]: Added Rado's proof notify = nipkow@in.tum.de [Bondy] title = Bondy's Theorem author = Jeremy Avigad , Stefan Hetzl date = 2012-10-27 topic = Mathematics/Combinatorics abstract = A proof of Bondy's theorem following B. Bollabas, Combinatorics, 1986, Cambridge University Press. notify = avigad@cmu.edu, hetzl@logic.at [Ramsey-Infinite] title = Ramsey's theorem, infinitary version author = Tom Ridge <> date = 2004-09-20 topic = Mathematics/Combinatorics abstract = This formalization of Ramsey's theorem (infinitary version) is taken from Boolos and Jeffrey, Computability and Logic, 3rd edition, Chapter 26. It differs slightly from the text by assuming a slightly stronger hypothesis. In particular, the induction hypothesis is stronger, holding for any infinite subset of the naturals. This avoids the rather peculiar mapping argument between kj and aikj on p.263, which is unnecessary and slightly mars this really beautiful result. notify = lp15@cam.ac.uk [Derangements] title = Derangements Formula author = Lukas Bulwahn date = 2015-06-27 topic = Mathematics/Combinatorics abstract = The Derangements Formula describes the number of fixpoint-free permutations as a closed formula. This theorem is the 88th theorem in a list of the ``Top 100 Mathematical Theorems''. notify = lukas.bulwahn@gmail.com [Euler_Partition] title = Euler's Partition Theorem author = Lukas Bulwahn date = 2015-11-19 topic = Mathematics/Combinatorics abstract = Euler's Partition Theorem states that the number of partitions with only distinct parts is equal to the number of partitions with only odd parts. The combinatorial proof follows John Harrison's HOL Light formalization. This theorem is the 45th theorem of the Top 100 Theorems list. notify = lukas.bulwahn@gmail.com [Discrete_Summation] title = Discrete Summation author = Florian Haftmann contributors = Amine Chaieb <> date = 2014-04-13 topic = Mathematics/Combinatorics abstract = These theories introduce basic concepts and proofs about discrete summation: shifts, formal summation, falling factorials and stirling numbers. As proof of concept, a simple summation conversion is provided. notify = florian.haftmann@informatik.tu-muenchen.de [Open_Induction] title = Open Induction author = Mizuhito Ogawa <>, Christian Sternagel date = 2012-11-02 topic = Mathematics/Combinatorics abstract = A proof of the open induction schema based on J.-C. Raoult, Proving open properties by induction, Information Processing Letters 29, 1988, pp.19-23.

This research was supported by the Austrian Science Fund (FWF): J3202.

notify = c.sternagel@gmail.com [Category] title = Category Theory to Yoneda's Lemma author = Greg O'Keefe date = 2005-04-21 topic = Mathematics/Category Theory license = LGPL abstract = This development proves Yoneda's lemma and aims to be readable by humans. It only defines what is needed for the lemma: categories, functors and natural transformations. Limits, adjunctions and other important concepts are not included. extra-history = Change history: [2010-04-23]: The definition of the constant equinumerous was slightly too weak in the original submission and has been fixed in revision 8c2b5b3c995f. notify = lcp@cl.cam.ac.uk [Category2] title = Category Theory author = Alexander Katovsky date = 2010-06-20 topic = Mathematics/Category Theory abstract = This article presents a development of Category Theory in Isabelle/HOL. A Category is defined using records and locales. Functors and Natural Transformations are also defined. The main result that has been formalized is that the Yoneda functor is a full and faithful embedding. We also formalize the completeness of many sorted monadic equational logic. Extensive use is made of the HOLZF theory in both cases. For an informal description see here [pdf]. notify = alexander.katovsky@cantab.net [FunWithFunctions] title = Fun With Functions author = Tobias Nipkow date = 2008-08-26 topic = Mathematics/Misc abstract = This is a collection of cute puzzles of the form ``Show that if a function satisfies the following constraints, it must be ...'' Please add further examples to this collection! notify = nipkow@in.tum.de [FunWithTilings] title = Fun With Tilings author = Tobias Nipkow , Lawrence C. Paulson date = 2008-11-07 topic = Mathematics/Misc abstract = Tilings are defined inductively. It is shown that one form of mutilated chess board cannot be tiled with dominoes, while another one can be tiled with L-shaped tiles. Please add further fun examples of this kind! notify = nipkow@in.tum.de [Lazy-Lists-II] title = Lazy Lists II author = Stefan Friedrich <> date = 2004-04-26 topic = Computer Science/Data Structures abstract = This theory contains some useful extensions to the LList (lazy list) theory by Larry Paulson, including finite, infinite, and positive llists over an alphabet, as well as the new constants take and drop and the prefix order of llists. Finally, the notions of safety and liveness in the sense of Alpern and Schneider (1985) are defined. notify = lcp@cl.cam.ac.uk [Ribbon_Proofs] title = Ribbon Proofs author = John Wickerson <> date = 2013-01-19 topic = Computer Science/Programming Languages/Logics abstract = This document concerns the theory of ribbon proofs: a diagrammatic proof system, based on separation logic, for verifying program correctness. We include the syntax, proof rules, and soundness results for two alternative formalisations of ribbon proofs.

Compared to traditional proof outlines, ribbon proofs emphasise the structure of a proof, so are intelligible and pedagogical. Because they contain less redundancy than proof outlines, and allow each proof step to be checked locally, they may be more scalable. Where proof outlines are cumbersome to modify, ribbon proofs can be visually manoeuvred to yield proofs of variant programs. notify = [Koenigsberg_Friendship] title = The Königsberg Bridge Problem and the Friendship Theorem author = Wenda Li date = 2013-07-19 topic = Mathematics/Graph Theory abstract = This development provides a formalization of undirected graphs and simple graphs, which are based on Benedikt Nordhoff and Peter Lammich's simple formalization of labelled directed graphs in the archive. Then, with our formalization of graphs, we show both necessary and sufficient conditions for Eulerian trails and circuits as well as the fact that the Königsberg Bridge Problem does not have a solution. In addition, we show the Friendship Theorem in simple graphs. notify = [Tree_Decomposition] title = Tree Decomposition author = Christoph Dittmann notify = date = 2016-05-31 topic = Mathematics/Graph Theory abstract = We formalize tree decompositions and tree width in Isabelle/HOL, proving that trees have treewidth 1. We also show that every edge of a tree decomposition is a separation of the underlying graph. As an application of this theorem we prove that complete graphs of size n have treewidth n-1. [Menger] title = Menger's Theorem author = Christoph Dittmann topic = Mathematics/Graph Theory date = 2017-02-26 notify = isabelle@christoph-d.de abstract = 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. [IEEE_Floating_Point] title = A Formal Model of IEEE Floating Point Arithmetic author = Lei Yu contributors = Fabian Hellauer , Fabian Immler date = 2013-07-27 topic = Computer Science/Data Structures abstract = This development provides a formal model of IEEE-754 floating-point arithmetic. This formalization, including formal specification of the standard and proofs of important properties of floating-point arithmetic, forms the foundation for verifying programs with floating-point computation. There is also a code generation setup for floats so that we can execute programs using this formalization in functional programming languages. notify = lp15@cam.ac.uk, immler@in.tum.de extra-history = Change history: [2017-09-25]: Added conversions from and to software floating point numbers (by Fabian Hellauer and Fabian Immler).
[2018-02-05]: 'Modernized' representation following the formalization in HOL4: former "float_format" and predicate "is_valid" is now encoded in a type "('e, 'f) float" where 'e and 'f encode the size of exponent and fraction. [Native_Word] title = Native Word author = Andreas Lochbihler contributors = Peter Lammich date = 2013-09-17 topic = Computer Science/Data Structures abstract = This entry makes machine words and machine arithmetic available for code generation from Isabelle/HOL. It provides a common abstraction that hides the differences between the different target languages. The code generator maps these operations to the APIs of the target languages. Apart from that, we extend the available bit operations on types int and integer, and map them to the operations in the target languages. extra-history = Change history: [2013-11-06]: added conversion function between native words and characters (revision fd23d9a7fe3a)
[2014-03-31]: added words of default size in the target language (by Peter Lammich) (revision 25caf5065833)
[2014-10-06]: proper test setup with compilation and execution of tests in all target languages (revision 5d7a1c9ae047)
[2017-09-02]: added 64-bit words (revision c89f86244e3c)
[2018-07-15]: added cast operators for default-size words (revision fc1f1fb8dd30)
notify = mail@andreas-lochbihler.de [XML] title = XML author = Christian Sternagel , René Thiemann date = 2014-10-03 topic = Computer Science/Functional Programming, Computer Science/Data Structures abstract = This entry provides an XML library for Isabelle/HOL. This includes parsing and pretty printing of XML trees as well as combinators for transforming XML trees into arbitrary user-defined data. The main contribution of this entry is an interface (fit for code generation) that allows for communication between verified programs formalized in Isabelle/HOL and the outside world via XML. This library was developed as part of the IsaFoR/CeTA project to which we refer for examples of its usage. notify = c.sternagel@gmail.com, rene.thiemann@uibk.ac.at [HereditarilyFinite] title = The Hereditarily Finite Sets author = Lawrence C. Paulson date = 2013-11-17 topic = Logic abstract = The theory of hereditarily finite sets is formalised, following the development of Swierczkowski. An HF set is a finite collection of other HF sets; they enjoy an induction principle and satisfy all the axioms of ZF set theory apart from the axiom of infinity, which is negated. All constructions that are possible in ZF set theory (Cartesian products, disjoint sums, natural numbers, functions) without using infinite sets are possible here. The definition of addition for the HF sets follows Kirby. This development forms the foundation for the Isabelle proof of Gödel's incompleteness theorems, which has been formalised separately. extra-history = Change history: [2015-02-23]: Added the theory "Finitary" defining the class of types that can be embedded in hf, including int, char, option, list, etc. notify = lp15@cam.ac.uk [Incompleteness] title = Gödel's Incompleteness Theorems author = Lawrence C. Paulson date = 2013-11-17 topic = Logic abstract = Gödel's two incompleteness theorems are formalised, following a careful presentation by Swierczkowski, in the theory of hereditarily finite sets. This represents the first ever machine-assisted proof of the second incompleteness theorem. Compared with traditional formalisations using Peano arithmetic (see e.g. Boolos), coding is simpler, with no need to formalise the notion of multiplication (let alone that of a prime number) in the formalised calculus upon which the theorem is based. However, other technical problems had to be solved in order to complete the argument. notify = lp15@cam.ac.uk [Finite_Automata_HF] title = Finite Automata in Hereditarily Finite Set Theory author = Lawrence C. Paulson date = 2015-02-05 topic = Computer Science/Automata and Formal Languages abstract = Finite Automata, both deterministic and non-deterministic, for regular languages. The Myhill-Nerode Theorem. Closure under intersection, concatenation, etc. Regular expressions define regular languages. Closure under reversal; the powerset construction mapping NFAs to DFAs. Left and right languages; minimal DFAs. Brzozowski's minimization algorithm. Uniqueness up to isomorphism of minimal DFAs. notify = lp15@cam.ac.uk [Decreasing-Diagrams] title = Decreasing Diagrams author = Harald Zankl license = LGPL date = 2013-11-01 topic = Logic/Rewriting abstract = This theory contains a formalization of decreasing diagrams showing that any locally decreasing abstract rewrite system is confluent. We consider the valley (van Oostrom, TCS 1994) and the conversion version (van Oostrom, RTA 2008) and closely follow the original proofs. As an application we prove Newman's lemma. notify = Harald.Zankl@uibk.ac.at [Decreasing-Diagrams-II] title = Decreasing Diagrams II author = Bertram Felgenhauer license = LGPL date = 2015-08-20 topic = Logic/Rewriting abstract = This theory formalizes the commutation version of decreasing diagrams for Church-Rosser modulo. The proof follows Felgenhauer and van Oostrom (RTA 2013). The theory also provides important specializations, in particular van Oostrom’s conversion version (TCS 2008) of decreasing diagrams. notify = bertram.felgenhauer@uibk.ac.at [GoedelGod] title = Gödel's God in Isabelle/HOL author = Christoph Benzmüller , Bruno Woltzenlogel Paleo date = 2013-11-12 topic = Logic/Philosophy abstract = Dana Scott's version of Gödel's proof of God's existence is formalized in quantified modal logic KB (QML KB). QML KB is modeled as a fragment of classical higher-order logic (HOL); thus, the formalization is essentially a formalization in HOL. notify = lp15@cam.ac.uk, c.benzmueller@fu-berlin.de [Types_Tableaus_and_Goedels_God] title = Types, Tableaus and Gödel’s God in Isabelle/HOL author = David Fuenmayor , Christoph Benzmüller topic = Logic/Philosophy date = 2017-05-01 notify = davfuenmayor@gmail.com, c.benzmueller@gmail.com abstract = A computer-formalisation of the essential parts of Fitting's textbook "Types, Tableaus and Gödel's God" in Isabelle/HOL is presented. In particular, Fitting's (and Anderson's) variant of the ontological argument is verified and confirmed. This variant avoids the modal collapse, which has been criticised as an undesirable side-effect of Kurt Gödel's (and Dana Scott's) versions of the ontological argument. Fitting's work is employing an intensional higher-order modal logic, which we shallowly embed here in classical higher-order logic. We then utilize the embedded logic for the formalisation of Fitting's argument. (See also the earlier AFP entry ``Gödel's God in Isabelle/HOL''.) [GewirthPGCProof] title = Formalisation and Evaluation of Alan Gewirth's Proof for the Principle of Generic Consistency in Isabelle/HOL author = David Fuenmayor , Christoph Benzmüller topic = Logic/Philosophy date = 2018-10-30 notify = davfuenmayor@gmail.com, c.benzmueller@gmail.com abstract = An ambitious ethical theory ---Alan Gewirth's "Principle of Generic Consistency"--- is encoded and analysed in Isabelle/HOL. Gewirth's theory has stirred much attention in philosophy and ethics and has been proposed as a potential means to bound the impact of artificial general intelligence. extra-history = Change history: [2019-04-09]: added proof for a stronger variant of the PGC and examplary inferences (revision 88182cb0a2f6)
[Lowe_Ontological_Argument] title = Computer-assisted Reconstruction and Assessment of E. J. Lowe's Modal Ontological Argument author = David Fuenmayor , Christoph Benzmüller topic = Logic/Philosophy date = 2017-09-21 notify = davfuenmayor@gmail.com, c.benzmueller@gmail.com abstract = 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. [AnselmGod] title = Anselm's God in Isabelle/HOL author = Ben Blumson topic = Logic/Philosophy date = 2017-09-06 notify = benblumson@gmail.com abstract = 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. [Tail_Recursive_Functions] title = A General Method for the Proof of Theorems on Tail-recursive Functions author = Pasquale Noce date = 2013-12-01 topic = Computer Science/Functional Programming abstract =

Tail-recursive function definitions are sometimes more straightforward than alternatives, but proving theorems on them may be roundabout because of the peculiar form of the resulting recursion induction rules.

This paper describes a proof method that provides a general solution to this problem by means of suitable invariants over inductive sets, and illustrates the application of such method by examining two case studies.

notify = pasquale.noce.lavoro@gmail.com [CryptoBasedCompositionalProperties] title = Compositional Properties of Crypto-Based Components author = Maria Spichkova date = 2014-01-11 topic = Computer Science/Security abstract = This paper presents an Isabelle/HOL set of theories which allows the specification of crypto-based components and the verification of their composition properties wrt. cryptographic aspects. We introduce a formalisation of the security property of data secrecy, the corresponding definitions and proofs. Please note that here we import the Isabelle/HOL theory ListExtras.thy, presented in the AFP entry FocusStreamsCaseStudies-AFP. notify = maria.spichkova@rmit.edu.au [Featherweight_OCL] title = Featherweight OCL: A Proposal for a Machine-Checked Formal Semantics for OCL 2.5 author = Achim D. Brucker , Frédéric Tuong , Burkhart Wolff date = 2014-01-16 topic = Computer Science/System Description Languages abstract = The Unified Modeling Language (UML) is one of the few modeling languages that is widely used in industry. While UML is mostly known as diagrammatic modeling language (e.g., visualizing class models), it is complemented by a textual language, called Object Constraint Language (OCL). The current version of OCL is based on a four-valued logic that turns UML into a formal language. Any type comprises the elements "invalid" and "null" which are propagated as strict and non-strict, respectively. Unfortunately, the former semi-formal semantics of this specification language, captured in the "Annex A" of the OCL standard, leads to different interpretations of corner cases. We formalize the core of OCL: denotational definitions, a logical calculus and operational rules that allow for the execution of OCL expressions by a mixture of term rewriting and code compilation. Our formalization reveals several inconsistencies and contradictions in the current version of the OCL standard. Overall, this document is intended to provide the basis for a machine-checked text "Annex A" of the OCL standard targeting at tool implementors. extra-history = Change history: [2015-10-13]: afp-devel@ea3b38fc54d6 and hol-testgen@12148
   Update of Featherweight OCL including a change in the abstract.
[2014-01-16]: afp-devel@9091ce05cb20 and hol-testgen@10241
   New Entry: Featherweight OCL notify = brucker@spamfence.net, tuong@users.gforge.inria.fr, wolff@lri.fr [Relation_Algebra] title = Relation Algebra author = Alasdair Armstrong <>, Simon Foster , Georg Struth , Tjark Weber date = 2014-01-25 topic = Mathematics/Algebra abstract = Tarski's algebra of binary relations is formalised along the lines of the standard textbooks of Maddux and Schmidt and Ströhlein. This includes relation-algebraic concepts such as subidentities, vectors and a domain operation as well as various notions associated to functions. Relation algebras are also expanded by a reflexive transitive closure operation, and they are linked with Kleene algebras and models of binary relations and Boolean matrices. notify = g.struth@sheffield.ac.uk, tjark.weber@it.uu.se [PSemigroupsConvolution] title = Partial Semigroups and Convolution Algebras author = Brijesh Dongol , Victor B. F. Gomes , Ian J. Hayes , Georg Struth topic = Mathematics/Algebra date = 2017-06-13 notify = g.struth@sheffield.ac.uk, victor.gomes@cl.cam.ac.uk abstract = 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. [Secondary_Sylow] title = Secondary Sylow Theorems author = Jakob von Raumer date = 2014-01-28 topic = Mathematics/Algebra abstract = These theories extend the existing proof of the first Sylow theorem (written by Florian Kammueller and L. C. Paulson) by what are often called the second, third and fourth Sylow theorems. These theorems state propositions about the number of Sylow p-subgroups of a group and the fact that they are conjugate to each other. The proofs make use of an implementation of group actions and their properties. notify = psxjv4@nottingham.ac.uk [Jordan_Hoelder] title = The Jordan-Hölder Theorem author = Jakob von Raumer date = 2014-09-09 topic = Mathematics/Algebra abstract = This submission contains theories that lead to a formalization of the proof of the Jordan-Hölder theorem about composition series of finite groups. The theories formalize the notions of isomorphism classes of groups, simple groups, normal series, composition series, maximal normal subgroups. Furthermore, they provide proofs of the second isomorphism theorem for groups, the characterization theorem for maximal normal subgroups as well as many useful lemmas about normal subgroups and factor groups. The proof is inspired by course notes of Stuart Rankin. notify = psxjv4@nottingham.ac.uk [Cayley_Hamilton] title = The Cayley-Hamilton Theorem author = Stephan Adelsberger , Stefan Hetzl , Florian Pollak date = 2014-09-15 topic = Mathematics/Algebra abstract = This document contains a proof of the Cayley-Hamilton theorem based on the development of matrices in HOL/Multivariate Analysis. notify = stvienna@gmail.com [Probabilistic_Noninterference] title = Probabilistic Noninterference author = Andrei Popescu , Johannes Hölzl date = 2014-03-11 topic = Computer Science/Security abstract = We formalize a probabilistic noninterference for a multi-threaded language with uniform scheduling, where probabilistic behaviour comes from both the scheduler and the individual threads. We define notions probabilistic noninterference in two variants: resumption-based and trace-based. For the resumption-based notions, we prove compositionality w.r.t. the language constructs and establish sound type-system-like syntactic criteria. This is a formalization of the mathematical development presented at CPP 2013 and CALCO 2013. It is the probabilistic variant of the Possibilistic Noninterference AFP entry. notify = hoelzl@in.tum.de [HyperCTL] title = A shallow embedding of HyperCTL* author = Markus N. Rabe , Peter Lammich , Andrei Popescu date = 2014-04-16 topic = Computer Science/Security, Logic abstract = We formalize HyperCTL*, a temporal logic for expressing security properties. We first define a shallow embedding of HyperCTL*, within which we prove inductive and coinductive rules for the operators. Then we show that a HyperCTL* formula captures Goguen-Meseguer noninterference, a landmark information flow property. We also define a deep embedding and connect it to the shallow embedding by a denotational semantics, for which we prove sanity w.r.t. dependence on the free variables. Finally, we show that under some finiteness assumptions about the model, noninterference is given by a (finitary) syntactic formula. notify = uuomul@yahoo.com [Bounded_Deducibility_Security] title = Bounded-Deducibility Security author = Andrei Popescu , Peter Lammich date = 2014-04-22 topic = Computer Science/Security abstract = This is a formalization of bounded-deducibility security (BD security), a flexible notion of information-flow security applicable to arbitrary input-output automata. It generalizes Sutherland's classic notion of nondeducibility by factoring in declassification bounds and trigger, whereas nondeducibility states that, in a system, information cannot flow between specified sources and sinks, BD security indicates upper bounds for the flow and triggers under which these upper bounds are no longer guaranteed. notify = uuomul@yahoo.com, lammich@in.tum.de [Network_Security_Policy_Verification] title = Network Security Policy Verification author = Cornelius Diekmann date = 2014-07-04 topic = Computer Science/Security abstract = We present a unified theory for verifying network security policies. A security policy is represented as directed graph. To check high-level security goals, security invariants over the policy are expressed. We cover monotonic security invariants, i.e. prohibiting more does not harm security. We provide the following contributions for the security invariant theory.
  • Secure auto-completion of scenario-specific knowledge, which eases usability.
  • Security violations can be repaired by tightening the policy iff the security invariants hold for the deny-all policy.
  • An algorithm to compute a security policy.
  • A formalization of stateful connection semantics in network security mechanisms.
  • An algorithm to compute a secure stateful implementation of a policy.
  • An executable implementation of all the theory.
  • Examples, ranging from an aircraft cabin data network to the analysis of a large real-world firewall.
  • More examples: A fully automated translation of high-level security goals to both firewall and SDN configurations (see Examples/Distributed_WebApp.thy).
For a detailed description, see extra-history = Change history: [2015-04-14]: Added Distributed WebApp example and improved graphviz visualization (revision 4dde08ca2ab8)
notify = diekmann@net.in.tum.de [Abstract_Completeness] title = Abstract Completeness author = Jasmin Christian Blanchette , Andrei Popescu , Dmitriy Traytel date = 2014-04-16 topic = Logic abstract = A formalization of an abstract property of possibly infinite derivation trees (modeled by a codatatype), representing the core of a proof (in Beth/Hintikka style) of the first-order logic completeness theorem, independent of the concrete syntax or inference rules. This work is described in detail in the IJCAR 2014 publication by the authors. The abstract proof can be instantiated for a wide range of Gentzen and tableau systems as well as various flavors of FOL---e.g., with or without predicates, equality, or sorts. Here, we give only a toy example instantiation with classical propositional logic. A more serious instance---many-sorted FOL with equality---is described elsewhere [Blanchette and Popescu, FroCoS 2013]. notify = traytel@in.tum.de [Pop_Refinement] title = Pop-Refinement author = Alessandro Coglio date = 2014-07-03 topic = Computer Science/Programming Languages/Misc abstract = Pop-refinement is an approach to stepwise refinement, carried out inside an interactive theorem prover by constructing a monotonically decreasing sequence of predicates over deeply embedded target programs. The sequence starts with a predicate that characterizes the possible implementations, and ends with a predicate that characterizes a unique program in explicit syntactic form. Pop-refinement enables more requirements (e.g. program-level and non-functional) to be captured in the initial specification and preserved through refinement. Security requirements expressed as hyperproperties (i.e. predicates over sets of traces) are always preserved by pop-refinement, unlike the popular notion of refinement as trace set inclusion. Two simple examples in Isabelle/HOL are presented, featuring program-level requirements, non-functional requirements, and hyperproperties. notify = coglio@kestrel.edu [VectorSpace] title = Vector Spaces author = Holden Lee date = 2014-08-29 topic = Mathematics/Algebra abstract = This formalisation of basic linear algebra is based completely on locales, building off HOL-Algebra. It includes basic definitions: linear combinations, span, linear independence; linear transformations; interpretation of function spaces as vector spaces; the direct sum of vector spaces, sum of subspaces; the replacement theorem; existence of bases in finite-dimensional; vector spaces, definition of dimension; the rank-nullity theorem. Some concepts are actually defined and proved for modules as they also apply there. Infinite-dimensional vector spaces are supported, but dimension is only supported for finite-dimensional vector spaces. The proofs are standard; the proofs of the replacement theorem and rank-nullity theorem roughly follow the presentation in Linear Algebra by Friedberg, Insel, and Spence. The rank-nullity theorem generalises the existing development in the Archive of Formal Proof (originally using type classes, now using a mix of type classes and locales). notify = holdenl@princeton.edu [Special_Function_Bounds] title = Real-Valued Special Functions: Upper and Lower Bounds author = Lawrence C. Paulson date = 2014-08-29 topic = Mathematics/Analysis abstract = This development proves upper and lower bounds for several familiar real-valued functions. For sin, cos, exp and sqrt, it defines and verifies infinite families of upper and lower bounds, mostly based on Taylor series expansions. For arctan, ln and exp, it verifies a finite collection of upper and lower bounds, originally obtained from the functions' continued fraction expansions using the computer algebra system Maple. A common theme in these proofs is to take the difference between a function and its approximation, which should be zero at one point, and then consider the sign of the derivative. The immediate purpose of this development is to verify axioms used by MetiTarski, an automatic theorem prover for real-valued special functions. Crucial to MetiTarski's operation is the provision of upper and lower bounds for each function of interest. notify = lp15@cam.ac.uk [Landau_Symbols] title = Landau Symbols author = Manuel Eberl date = 2015-07-14 topic = Mathematics/Analysis abstract = This entry provides Landau symbols to describe and reason about the asymptotic growth of functions for sufficiently large inputs. A number of simplification procedures are provided for additional convenience: cancelling of dominated terms in sums under a Landau symbol, cancelling of common factors in products, and a decision procedure for Landau expressions containing products of powers of functions like x, ln(x), ln(ln(x)) etc. notify = eberlm@in.tum.de [Error_Function] title = The Error Function author = Manuel Eberl topic = Mathematics/Analysis date = 2018-02-06 notify = eberlm@in.tum.de abstract =

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.

[Akra_Bazzi] title = The Akra-Bazzi theorem and the Master theorem author = Manuel Eberl date = 2015-07-14 topic = Mathematics/Analysis abstract = This article contains a formalisation of the Akra-Bazzi method based on a proof by Leighton. It is a generalisation of the well-known Master Theorem for analysing the complexity of Divide & Conquer algorithms. We also include a generalised version of the Master theorem based on the Akra-Bazzi theorem, which is easier to apply than the Akra-Bazzi theorem itself.

Some proof methods that facilitate applying the Master theorem are also included. For a more detailed explanation of the formalisation and the proof methods, see the accompanying paper (publication forthcoming). notify = eberlm@in.tum.de [Dirichlet_Series] title = Dirichlet Series author = Manuel Eberl topic = Mathematics/Number Theory date = 2017-10-12 notify = eberlm@in.tum.de abstract = This entry is a formalisation of much of Chapters 2, 3, and 11 of Apostol's “Introduction to Analytic Number Theory”. This includes:

  • Definitions and basic properties for several number-theoretic functions (Euler's φ, Möbius μ, Liouville's λ, the divisor function σ, von Mangoldt's Λ)
  • Executable code for most of these functions, the most efficient implementations using the factoring algorithm by Thiemann et al.
  • Dirichlet products and formal Dirichlet series
  • Analytic results connecting convergent formal Dirichlet series to complex functions
  • Euler product expansions
  • Asymptotic estimates of number-theoretic functions including the density of squarefree integers and the average number of divisors of a natural number
These results are useful as a basis for developing more number-theoretic results, such as the Prime Number Theorem. [Gauss_Sums] title = Gauss Sums and the Pólya–Vinogradov Inequality author = Rodrigo Raya , Manuel Eberl topic = Mathematics/Number Theory date = 2019-12-10 notify = manuel.eberl@tum.de abstract =

This article provides a full formalisation of Chapter 8 of Apostol's Introduction to Analytic Number Theory. Subjects that are covered are:

  • periodic arithmetic functions and their finite Fourier series
  • (generalised) Ramanujan sums
  • Gauss sums and separable characters
  • induced moduli and primitive characters
  • the Pólya—Vinogradov inequality
[Zeta_Function] title = The Hurwitz and Riemann ζ Functions author = Manuel Eberl topic = Mathematics/Number Theory, Mathematics/Analysis date = 2017-10-12 notify = eberlm@in.tum.de abstract =

This entry builds upon the results about formal and analytic Dirichlet series to define the Hurwitz ζ function ζ(a,s) and, based on that, the Riemann ζ function ζ(s). This is done by first defining them for ℜ(z) > 1 and then successively extending the domain to the left using the Euler–MacLaurin formula.

Apart from the most basic facts such as analyticity, the following results are provided:

  • the Stieltjes constants and the Laurent expansion of ζ(s) at s = 1
  • the non-vanishing of ζ(s) for ℜ(z) ≥ 1
  • the relationship between ζ(a,s) and Γ
  • the special values at negative integers and positive even integers
  • Hurwitz's formula and the reflection formula for ζ(s)
  • the Hadjicostas–Chapman formula

The entry also contains Euler's analytic proof of the infinitude of primes, based on the fact that ζ(s) has a pole at s = 1.

[Linear_Recurrences] title = Linear Recurrences author = Manuel Eberl topic = Mathematics/Analysis date = 2017-10-12 notify = eberlm@in.tum.de abstract =

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 f(n) = f(n-1) + f(n - 2) and the quite non-obvious closed form (φn - (-φ)-n) / √5 where φ is the golden ratio.

In this work, I build on existing tools in Isabelle – such as formal power series and polynomial factorisation algorithms – to develop a theory of these recurrences and derive a fully executable solver for them that can be exported to programming languages like Haskell.

[Cartan_FP] title = The Cartan Fixed Point Theorems author = Lawrence C. Paulson date = 2016-03-08 topic = Mathematics/Analysis abstract = The Cartan fixed point theorems concern the group of holomorphic automorphisms on a connected open set of Cn. Ciolli et al. have formalised the one-dimensional case of these theorems in HOL Light. This entry contains their proofs, ported to Isabelle/HOL. Thus it addresses the authors' remark that "it would be important to write a formal proof in a language that can be read by both humans and machines". notify = lp15@cam.ac.uk [Gauss_Jordan] title = Gauss-Jordan Algorithm and Its Applications author = Jose Divasón , Jesús Aransay topic = Computer Science/Algorithms/Mathematical date = 2014-09-03 abstract = The Gauss-Jordan algorithm states that any matrix over a field can be transformed by means of elementary row operations to a matrix in reduced row echelon form. The formalization is based on the Rank Nullity Theorem entry of the AFP and on the HOL-Multivariate-Analysis session of Isabelle, where matrices are represented as functions over finite types. We have set up the code generator to make this representation executable. In order to improve the performance, a refinement to immutable arrays has been carried out. We have formalized some of the applications of the Gauss-Jordan algorithm. Thanks to this development, the following facts can be computed over matrices whose elements belong to a field: Ranks, Determinants, Inverses, Bases and dimensions and Solutions of systems of linear equations. Code can be exported to SML and Haskell. notify = jose.divasonm@unirioja.es, jesus-maria.aransay@unirioja.es [Echelon_Form] title = Echelon Form author = Jose Divasón , Jesús Aransay topic = Computer Science/Algorithms/Mathematical, Mathematics/Algebra date = 2015-02-12 abstract = We formalize an algorithm to compute the Echelon Form of a matrix. We have proved its existence over Bézout domains and made it executable over Euclidean domains, such as the integer ring and the univariate polynomials over a field. This allows us to compute determinants, inverses and characteristic polynomials of matrices. The work is based on the HOL-Multivariate Analysis library, and on both the Gauss-Jordan and Cayley-Hamilton AFP entries. As a by-product, some algebraic structures have been implemented (principal ideal domains, Bézout domains...). The algorithm has been refined to immutable arrays and code can be generated to functional languages as well. notify = jose.divasonm@unirioja.es, jesus-maria.aransay@unirioja.es [QR_Decomposition] title = QR Decomposition author = Jose Divasón , Jesús Aransay topic = Computer Science/Algorithms/Mathematical, Mathematics/Algebra date = 2015-02-12 abstract = QR decomposition is an algorithm to decompose a real matrix A into the product of two other matrices Q and R, where Q is orthogonal and R is invertible and upper triangular. The algorithm is useful for the least squares problem; i.e., the computation of the best approximation of an unsolvable system of linear equations. As a side-product, the Gram-Schmidt process has also been formalized. A refinement using immutable arrays is presented as well. The development relies, among others, on the AFP entry "Implementing field extensions of the form Q[sqrt(b)]" by René Thiemann, which allows execution of the algorithm using symbolic computations. Verified code can be generated and executed using floats as well. extra-history = Change history: [2015-06-18]: The second part of the Fundamental Theorem of Linear Algebra has been generalized to more general inner product spaces. notify = jose.divasonm@unirioja.es, jesus-maria.aransay@unirioja.es [Hermite] title = Hermite Normal Form author = Jose Divasón , Jesús Aransay topic = Computer Science/Algorithms/Mathematical, Mathematics/Algebra date = 2015-07-07 abstract = Hermite Normal Form is a canonical matrix analogue of Reduced Echelon Form, but involving matrices over more general rings. In this work we formalise an algorithm to compute the Hermite Normal Form of a matrix by means of elementary row operations, taking advantage of the Echelon Form AFP entry. We have proven the correctness of such an algorithm and refined it to immutable arrays. Furthermore, we have also formalised the uniqueness of the Hermite Normal Form of a matrix. Code can be exported and some examples of execution involving integer matrices and polynomial matrices are presented as well. notify = jose.divasonm@unirioja.es, jesus-maria.aransay@unirioja.es [Imperative_Insertion_Sort] title = Imperative Insertion Sort author = Christian Sternagel date = 2014-09-25 topic = Computer Science/Algorithms abstract = The insertion sort algorithm of Cormen et al. (Introduction to Algorithms) is expressed in Imperative HOL and proved to be correct and terminating. For this purpose we also provide a theory about imperative loop constructs with accompanying induction/invariant rules for proving partial and total correctness. Furthermore, the formalized algorithm is fit for code generation. notify = lp15@cam.ac.uk [Stream_Fusion_Code] title = Stream Fusion in HOL with Code Generation author = Andreas Lochbihler , Alexandra Maximova date = 2014-10-10 topic = Computer Science/Functional Programming abstract = Stream Fusion is a system for removing intermediate list data structures from functional programs, in particular Haskell. This entry adapts stream fusion to Isabelle/HOL and its code generator. We define stream types for finite and possibly infinite lists and stream versions for most of the fusible list functions in the theories List and Coinductive_List, and prove them correct with respect to the conversion functions between lists and streams. The Stream Fusion transformation itself is implemented as a simproc in the preprocessor of the code generator. [Brian Huffman's AFP entry formalises stream fusion in HOLCF for the domain of lazy lists to prove the GHC compiler rewrite rules correct. In contrast, this work enables Isabelle's code generator to perform stream fusion itself. To that end, it covers both finite and coinductive lists from the HOL library and the Coinductive entry. The fusible list functions require specification and proof principles different from Huffman's.] notify = mail@andreas-lochbihler.de [Case_Labeling] title = Generating Cases from Labeled Subgoals author = Lars Noschinski date = 2015-07-21 topic = Tools, Computer Science/Programming Languages/Misc abstract = Isabelle/Isar provides named cases to structure proofs. This article contains an implementation of a proof method casify, which can be used to easily extend proof tools with support for named cases. Such a proof tool must produce labeled subgoals, which are then interpreted by casify.

As examples, this work contains verification condition generators producing named cases for three languages: The Hoare language from HOL/Library, a monadic language for computations with failure (inspired by the AutoCorres tool), and a language of conditional expressions. These VCGs are demonstrated by a number of example programs. notify = noschinl@gmail.com [DPT-SAT-Solver] title = A Fast SAT Solver for Isabelle in Standard ML topic = Tools author = Armin Heller <> date = 2009-12-09 abstract = This contribution contains a fast SAT solver for Isabelle written in Standard ML. By loading the theory DPT_SAT_Solver, the SAT solver installs itself (under the name ``dptsat'') and certain Isabelle tools like Refute will start using it automatically. This is a port of the DPT (Decision Procedure Toolkit) SAT Solver written in OCaml. notify = jasmin.blanchette@gmail.com [Rep_Fin_Groups] title = Representations of Finite Groups topic = Mathematics/Algebra author = Jeremy Sylvestre date = 2015-08-12 abstract = We provide a formal framework for the theory of representations of finite groups, as modules over the group ring. Along the way, we develop the general theory of groups (relying on the group_add class for the basics), modules, and vector spaces, to the extent required for theory of group representations. We then provide formal proofs of several important introductory theorems in the subject, including Maschke's theorem, Schur's lemma, and Frobenius reciprocity. We also prove that every irreducible representation is isomorphic to a submodule of the group ring, leading to the fact that for a finite group there are only finitely many isomorphism classes of irreducible representations. In all of this, no restriction is made on the characteristic of the ring or field of scalars until the definition of a group representation, and then the only restriction made is that the characteristic must not divide the order of the group. notify = jsylvest@ualberta.ca [Noninterference_Inductive_Unwinding] title = The Inductive Unwinding Theorem for CSP Noninterference Security topic = Computer Science/Security author = Pasquale Noce date = 2015-08-18 abstract =

The necessary and sufficient condition for CSP noninterference security stated by the Ipurge Unwinding Theorem is expressed in terms of a pair of event lists varying over the set of process traces. This does not render it suitable for the subsequent application of rule induction in the case of a process defined inductively, since rule induction may rather be applied to a single variable ranging over an inductively defined set.

Starting from the Ipurge Unwinding Theorem, this paper derives a necessary and sufficient condition for CSP noninterference security that involves a single event list varying over the set of process traces, and is thus suitable for rule induction; hence its name, Inductive Unwinding Theorem. Similarly to the Ipurge Unwinding Theorem, the new theorem only requires to consider individual accepted and refused events for each process trace, and applies to the general case of a possibly intransitive noninterference policy. Specific variants of this theorem are additionally proven for deterministic processes and trace set processes.

notify = pasquale.noce.lavoro@gmail.com [Password_Authentication_Protocol] title = Verification of a Diffie-Hellman Password-based Authentication Protocol by Extending the Inductive Method author = Pasquale Noce topic = Computer Science/Security date = 2017-01-03 notify = pasquale.noce.lavoro@gmail.com abstract = 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. [Jordan_Normal_Form] title = Matrices, Jordan Normal Forms, and Spectral Radius Theory topic = Mathematics/Algebra author = René Thiemann , Akihisa Yamada contributors = Alexander Bentkamp date = 2015-08-21 abstract =

Matrix interpretations are useful as measure functions in termination proving. In order to use these interpretations also for complexity analysis, the growth rate of matrix powers has to examined. Here, we formalized a central result of spectral radius theory, namely that the growth rate is polynomially bounded if and only if the spectral radius of a matrix is at most one.

To formally prove this result we first studied the growth rates of matrices in Jordan normal form, and prove the result that every complex matrix has a Jordan normal form using a constructive prove via Schur decomposition.

The whole development is based on a new abstract type for matrices, which is also executable by a suitable setup of the code generator. It completely subsumes our former AFP-entry on executable matrices, and its main advantage is its close connection to the HMA-representation which allowed us to easily adapt existing proofs on determinants.

All the results have been applied to improve CeTA, our certifier to validate termination and complexity proof certificates.

extra-history = Change history: [2016-01-07]: Added Schur-decomposition, Gram-Schmidt orthogonalization, uniqueness of Jordan normal forms
[2018-04-17]: Integrated lemmas from deep-learning AFP-entry of Alexander Bentkamp notify = rene.thiemann@uibk.ac.at, ayamada@trs.cm.is.nagoya-u.ac.jp [LTL_to_DRA] title = Converting Linear Temporal Logic to Deterministic (Generalized) Rabin Automata topic = Computer Science/Automata and Formal Languages author = Salomon Sickert date = 2015-09-04 abstract = Recently, Javier Esparza and Jan Kretinsky proposed a new method directly translating linear temporal logic (LTL) formulas to deterministic (generalized) Rabin automata. Compared to the existing approaches of constructing a non-deterministic Buechi-automaton in the first step and then applying a determinization procedure (e.g. some variant of Safra's construction) in a second step, this new approach preservers a relation between the formula and the states of the resulting automaton. While the old approach produced a monolithic structure, the new method is compositional. Furthermore, in some cases the resulting automata are much smaller than the automata generated by existing approaches. In order to ensure the correctness of the construction, this entry contains a complete formalisation and verification of the translation. Furthermore from this basis executable code is generated. extra-history = Change history: [2015-09-23]: Enable code export for the eager unfolding optimisation and reduce running time of the generated tool. Moreover, add support for the mlton SML compiler.
[2016-03-24]: Make use of the LTL entry and include the simplifier. notify = sickert@in.tum.de [Timed_Automata] title = Timed Automata author = Simon Wimmer date = 2016-03-08 topic = Computer Science/Automata and Formal Languages abstract = Timed automata are a widely used formalism for modeling real-time systems, which is employed in a class of successful model checkers such as UPPAAL [LPY97], HyTech [HHWt97] or Kronos [Yov97]. This work formalizes the theory for the subclass of diagonal-free timed automata, which is sufficient to model many interesting problems. We first define the basic concepts and semantics of diagonal-free timed automata. Based on this, we prove two types of decidability results for the language emptiness problem. The first is the classic result of Alur and Dill [AD90, AD94], which uses a finite partitioning of the state space into so-called `regions`. Our second result focuses on an approach based on `Difference Bound Matrices (DBMs)`, which is practically used by model checkers. We prove the correctness of the basic forward analysis operations on DBMs. One of these operations is the Floyd-Warshall algorithm for the all-pairs shortest paths problem. To obtain a finite search space, a widening operation has to be used for this kind of analysis. We use Patricia Bouyer's [Bou04] approach to prove that this widening operation is correct in the sense that DBM-based forward analysis in combination with the widening operation also decides language emptiness. The interesting property of this proof is that the first decidability result is reused to obtain the second one. notify = wimmers@in.tum.de [Parity_Game] title = Positional Determinacy of Parity Games author = Christoph Dittmann date = 2015-11-02 topic = Mathematics/Games and Economics, Mathematics/Graph Theory abstract = We present a formalization of parity games (a two-player game on directed graphs) and a proof of their positional determinacy in Isabelle/HOL. This proof works for both finite and infinite games. notify = [Ergodic_Theory] title = Ergodic Theory author = Sebastien Gouezel date = 2015-12-01 topic = Mathematics/Probability Theory abstract = Ergodic theory is the branch of mathematics that studies the behaviour of measure preserving transformations, in finite or infinite measure. It interacts both with probability theory (mainly through measure theory) and with geometry as a lot of interesting examples are from geometric origin. We implement the first definitions and theorems of ergodic theory, including notably Poicaré recurrence theorem for finite measure preserving systems (together with the notion of conservativity in general), induced maps, Kac's theorem, Birkhoff theorem (arguably the most important theorem in ergodic theory), and variations around it such as conservativity of the corresponding skew product, or Atkinson lemma. notify = sebastien.gouezel@univ-rennes1.fr, hoelzl@in.tum.de [Latin_Square] title = Latin Square author = Alexander Bentkamp date = 2015-12-02 topic = Mathematics/Combinatorics abstract = A Latin Square is a n x n table filled with integers from 1 to n where each number appears exactly once in each row and each column. A Latin Rectangle is a partially filled n x n table with r filled rows and n-r empty rows, such that each number appears at most once in each row and each column. The main result of this theory is that any Latin Rectangle can be completed to a Latin Square. notify = bentkamp@gmail.com [Deep_Learning] title = Expressiveness of Deep Learning author = Alexander Bentkamp date = 2016-11-10 topic = Computer Science/Machine Learning, Mathematics/Analysis abstract = 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. notify = bentkamp@gmail.com [Applicative_Lifting] title = Applicative Lifting author = Andreas Lochbihler , Joshua Schneider <> date = 2015-12-22 topic = Computer Science/Functional Programming abstract = Applicative functors augment computations with effects by lifting function application to types which model the effects. As the structure of the computation cannot depend on the effects, applicative expressions can be analysed statically. This allows us to lift universally quantified equations to the effectful types, as observed by Hinze. Thus, equational reasoning over effectful computations can be reduced to pure types.

This entry provides a package for registering applicative functors and two proof methods for lifting of equations over applicative functors. The first method normalises applicative expressions according to the laws of applicative functors. This way, equations whose two sides contain the same list of variables can be lifted to every applicative functor.

To lift larger classes of equations, the second method exploits a number of additional properties (e.g., commutativity of effects) provided the properties have been declared for the concrete applicative functor at hand upon registration.

We declare several types from the Isabelle library as applicative functors and illustrate the use of the methods with two examples: the lifting of the arithmetic type class hierarchy to streams and the verification of a relabelling function on binary trees. We also formalise and verify the normalisation algorithm used by the first proof method.

extra-history = Change history: [2016-03-03]: added formalisation of lifting with combinators
[2016-06-10]: implemented automatic derivation of lifted combinator reductions; support arbitrary lifted relations using relators; improved compatibility with locale interpretation (revision ec336f354f37)
notify = mail@andreas-lochbihler.de [Stern_Brocot] title = The Stern-Brocot Tree author = Peter Gammie , Andreas Lochbihler date = 2015-12-22 topic = Mathematics/Number Theory abstract = The Stern-Brocot tree contains all rational numbers exactly once and in their lowest terms. We formalise the Stern-Brocot tree as a coinductive tree using recursive and iterative specifications, which we have proven equivalent, and show that it indeed contains all the numbers as stated. Following Hinze, we prove that the Stern-Brocot tree can be linearised looplessly into Stern's diatonic sequence (also known as Dijkstra's fusc function) and that it is a permutation of the Bird tree.

The reasoning stays at an abstract level by appealing to the uniqueness of solutions of guarded recursive equations and lifting algebraic laws point-wise to trees and streams using applicative functors.

notify = mail@andreas-lochbihler.de [Algebraic_Numbers] title = Algebraic Numbers in Isabelle/HOL topic = Mathematics/Algebra author = René Thiemann , Akihisa Yamada , Sebastiaan Joosten date = 2015-12-22 abstract = Based on existing libraries for matrices, factorization of rational polynomials, and Sturm's theorem, we formalized algebraic numbers in Isabelle/HOL. Our development serves as an implementation for real and complex numbers, and it admits to compute roots and completely factorize real and complex polynomials, provided that all coefficients are rational numbers. Moreover, we provide two implementations to display algebraic numbers, an injective and expensive one, or a faster but approximative version.

To this end, we mechanized several results on resultants, which also required us to prove that polynomials over a unique factorization domain form again a unique factorization domain.

extra-history = Change history: [2016-01-29]: Split off Polynomial Interpolation and Polynomial Factorization
[2017-04-16]: Use certified Berlekamp-Zassenhaus factorization, use subresultant algorithm for computing resultants, improved bisection algorithm notify = rene.thiemann@uibk.ac.at, ayamada@trs.cm.is.nagoya-u.ac.jp, sebastiaan.joosten@uibk.ac.at [Polynomial_Interpolation] title = Polynomial Interpolation topic = Mathematics/Algebra author = René Thiemann , Akihisa Yamada date = 2016-01-29 abstract = We formalized three algorithms for polynomial interpolation over arbitrary fields: Lagrange's explicit expression, the recursive algorithm of Neville and Aitken, and the Newton interpolation in combination with an efficient implementation of divided differences. Variants of these algorithms for integer polynomials are also available, where sometimes the interpolation can fail; e.g., there is no linear integer polynomial p such that p(0) = 0 and p(2) = 1. Moreover, for the Newton interpolation for integer polynomials, we proved that all intermediate results that are computed during the algorithm must be integers. This admits an early failure detection in the implementation. Finally, we proved the uniqueness of polynomial interpolation.

The development also contains improved code equations to speed up the division of integers in target languages. notify = rene.thiemann@uibk.ac.at, ayamada@trs.cm.is.nagoya-u.ac.jp [Polynomial_Factorization] title = Polynomial Factorization topic = Mathematics/Algebra author = René Thiemann , Akihisa Yamada date = 2016-01-29 abstract = Based on existing libraries for polynomial interpolation and matrices, we formalized several factorization algorithms for polynomials, including Kronecker's algorithm for integer polynomials, Yun's square-free factorization algorithm for field polynomials, and Berlekamp's algorithm for polynomials over finite fields. By combining the last one with Hensel's lifting, we derive an efficient factorization algorithm for the integer polynomials, which is then lifted for rational polynomials by mechanizing Gauss' lemma. Finally, we assembled a combined factorization algorithm for rational polynomials, which combines all the mentioned algorithms and additionally uses the explicit formula for roots of quadratic polynomials and a rational root test.

As side products, we developed division algorithms for polynomials over integral domains, as well as primality-testing and prime-factorization algorithms for integers. notify = rene.thiemann@uibk.ac.at, ayamada@trs.cm.is.nagoya-u.ac.jp [Perron_Frobenius] title = Perron-Frobenius Theorem for Spectral Radius Analysis author = Jose Divasón , Ondřej Kunčar , René Thiemann , Akihisa Yamada notify = rene.thiemann@uibk.ac.at date = 2016-05-20 topic = Mathematics/Algebra abstract =

The spectral radius of a matrix A is the maximum norm of all eigenvalues of A. In previous work we already formalized that for a complex matrix A, the values in An grow polynomially in n if and only if the spectral radius is at most one. One problem with the above characterization is the determination of all complex eigenvalues. In case A contains only non-negative real values, a simplification is possible with the help of the Perron–Frobenius theorem, which tells us that it suffices to consider only the real eigenvalues of A, i.e., applying Sturm's method can decide the polynomial growth of An.

We formalize the Perron–Frobenius theorem based on a proof via Brouwer's fixpoint theorem, which is available in the HOL multivariate analysis (HMA) library. Since the results on the spectral radius is based on matrices in the Jordan normal form (JNF) library, we further develop a connection which allows us to easily transfer theorems between HMA and JNF. With this connection we derive the combined result: if A is a non-negative real matrix, and no real eigenvalue of A is strictly larger than one, then An is polynomially bounded in n.

extra-history = Change history: [2017-10-18]: added Perron-Frobenius theorem for irreducible matrices with generalization (revision bda1f1ce8a1c)
[2018-05-17]: prove conjecture of CPP'18 paper: Jordan blocks of spectral radius have maximum size (revision ffdb3794e5d5) [Stochastic_Matrices] title = Stochastic Matrices and the Perron-Frobenius Theorem author = René Thiemann topic = Mathematics/Algebra, Computer Science/Automata and Formal Languages date = 2017-11-22 notify = rene.thiemann@uibk.ac.at abstract = Stochastic matrices are a convenient way to model discrete-time and finite state Markov chains. The Perron–Frobenius theorem tells us something about the existence and uniqueness of non-negative eigenvectors of a stochastic matrix. In this entry, we formalize stochastic matrices, link the formalization to the existing AFP-entry on Markov chains, and apply the Perron–Frobenius theorem to prove that stationary distributions always exist, and they are unique if the stochastic matrix is irreducible. [Formal_SSA] title = Verified Construction of Static Single Assignment Form author = Sebastian Ullrich , Denis Lohner date = 2016-02-05 topic = Computer Science/Algorithms, Computer Science/Programming Languages/Transformations abstract =

We define a functional variant of the static single assignment (SSA) form construction algorithm described by Braun et al., which combines simplicity and efficiency. The definition is based on a general, abstract control flow graph representation using Isabelle locales.

We prove that the algorithm's output is semantically equivalent to the input according to a small-step semantics, and that it is in minimal SSA form for the common special case of reducible inputs. We then show the satisfiability of the locale assumptions by giving instantiations for a simple While language.

Furthermore, we use a generic instantiation based on typedefs in order to extract OCaml code and replace the unverified SSA construction algorithm of the CompCertSSA project with it.

A more detailed description of the verified SSA construction can be found in the paper Verified Construction of Static Single Assignment Form, CC 2016.

notify = denis.lohner@kit.edu [Minimal_SSA] title = Minimal Static Single Assignment Form author = Max Wagner , Denis Lohner topic = Computer Science/Programming Languages/Transformations date = 2017-01-17 notify = denis.lohner@kit.edu abstract =

This formalization is an extension to "Verified Construction of Static Single Assignment Form". In their work, the authors have shown that Braun et al.'s static single assignment (SSA) construction algorithm 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.
In this formalization we support that claim by giving a mechanized proof.

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 Cytron et al..

[PropResPI] title = Propositional Resolution and Prime Implicates Generation author = Nicolas Peltier notify = Nicolas.Peltier@imag.fr date = 2016-03-11 topic = Logic abstract = We provide formal proofs in Isabelle-HOL (using mostly structured Isar proofs) of the soundness and completeness of the Resolution rule in propositional logic. The completeness proofs take into account the usual redundancy elimination rules (tautology elimination and subsumption), and several refinements of the Resolution rule are considered: ordered resolution (with selection functions), positive and negative resolution, semantic resolution and unit resolution (the latter refinement is complete only for clause sets that are Horn- renamable). We also define a concrete procedure for computing saturated sets and establish its soundness and completeness. The clause sets are not assumed to be finite, so that the results can be applied to formulas obtained by grounding sets of first-order clauses (however, a total ordering among atoms is assumed to be given). Next, we show that the unrestricted Resolution rule is deductive- complete, in the sense that it is able to generate all (prime) implicates of any set of propositional clauses (i.e., all entailment- minimal, non-valid, clausal consequences of the considered set). The generation of prime implicates is an important problem, with many applications in artificial intelligence and verification (for abductive reasoning, knowledge compilation, diagnosis, debugging etc.). We also show that implicates can be computed in an incremental way, by fixing an ordering among all the atoms in the considered sets and resolving upon these atoms one by one in the considered order (with no backtracking). This feature is critical for the efficient computation of prime implicates. Building on these results, we provide a procedure for computing such implicates and establish its soundness and completeness. [SuperCalc] title = A Variant of the Superposition Calculus author = Nicolas Peltier notify = Nicolas.Peltier@imag.fr date = 2016-09-06 topic = Logic abstract = We provide a formalization of a variant of the superposition calculus, together with formal proofs of soundness and refutational completeness (w.r.t. the usual redundancy criteria based on clause ordering). This version of the calculus uses all the standard restrictions of the superposition rules, together with the following refinement, inspired by the basic superposition calculus: each clause is associated with a set of terms which are assumed to be in normal form -- thus any application of the replacement rule on these terms is blocked. The set is initially empty and terms may be added or removed at each inference step. The set of terms that are assumed to be in normal form includes any term introduced by previous unifiers as well as any term occurring in the parent clauses at a position that is smaller (according to some given ordering on positions) than a previously replaced term. The standard superposition calculus corresponds to the case where the set of irreducible terms is always empty. [Nominal2] title = Nominal 2 author = Christian Urban , Stefan Berghofer , Cezary Kaliszyk date = 2013-02-21 topic = Tools abstract =

Dealing with binders, renaming of bound variables, capture-avoiding substitution, etc., is very often a major problem in formal proofs, especially in proofs by structural and rule induction. Nominal Isabelle is designed to make such proofs easy to formalise: it provides an infrastructure for declaring nominal datatypes (that is alpha-equivalence classes) and for defining functions over them by structural recursion. It also provides induction principles that have Barendregt’s variable convention already built in.

This entry can be used as a more advanced replacement for HOL/Nominal in the Isabelle distribution.

notify = christian.urban@kcl.ac.uk [First_Welfare_Theorem] title = Microeconomics and the First Welfare Theorem author = Julian Parsert , Cezary Kaliszyk topic = Mathematics/Games and Economics license = LGPL date = 2017-09-01 notify = julian.parsert@uibk.ac.at, cezary.kaliszyk@uibk.ac.at abstract = 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 First Theorem of Welfare Economics holds within both. The theorem is the mathematical formulation of Adam Smith's famous invisible hand and states that a group of self-interested and rational actors will eventually achieve an efficient allocation of goods and services. extra-history = Change history: [2018-06-17]: Added some lemmas and a theory file, also introduced Microeconomics folder.
[Noninterference_Sequential_Composition] title = Conservation of CSP Noninterference Security under Sequential Composition author = Pasquale Noce date = 2016-04-26 topic = Computer Science/Security, Computer Science/Concurrency/Process Calculi abstract =

In his outstanding work on Communicating Sequential Processes, Hoare has defined two fundamental binary operations allowing to compose the input processes into another, typically more complex, process: sequential composition and concurrent composition. Particularly, the output of the former operation is a process that initially behaves like the first operand, and then like the second operand once the execution of the first one has terminated successfully, as long as it does.

This paper formalizes Hoare's definition of sequential composition and proves, in the general case of a possibly intransitive policy, that CSP noninterference security is conserved under this operation, provided that successful termination cannot be affected by confidential events and cannot occur as an alternative to other events in the traces of the first operand. Both of these assumptions are shown, by means of counterexamples, to be necessary for the theorem to hold.

notify = pasquale.noce.lavoro@gmail.com [Noninterference_Concurrent_Composition] title = Conservation of CSP Noninterference Security under Concurrent Composition author = Pasquale Noce notify = pasquale.noce.lavoro@gmail.com date = 2016-06-13 topic = Computer Science/Security, Computer Science/Concurrency/Process Calculi abstract =

In his outstanding work on Communicating Sequential Processes, Hoare has defined two fundamental binary operations allowing to compose the input processes into another, typically more complex, process: sequential composition and concurrent composition. Particularly, the output of the latter operation is a process in which any event not shared by both operands can occur whenever the operand that admits the event can engage in it, whereas any event shared by both operands can occur just in case both can engage in it.

This paper formalizes Hoare's definition of concurrent composition and proves, in the general case of a possibly intransitive policy, that CSP noninterference security is conserved under this operation. This result, along with the previous analogous one concerning sequential composition, enables the construction of more and more complex processes enforcing noninterference security by composing, sequentially or concurrently, simpler secure processes, whose security can in turn be proven using either the definition of security, or unwinding theorems.

[ROBDD] title = Algorithms for Reduced Ordered Binary Decision Diagrams author = Julius Michaelis , Maximilian Haslbeck , Peter Lammich , Lars Hupel date = 2016-04-27 topic = Computer Science/Algorithms, Computer Science/Data Structures abstract = We present a verified and executable implementation of ROBDDs in Isabelle/HOL. Our implementation relates pointer-based computation in the Heap monad to operations on an abstract definition of boolean functions. Internally, we implemented the if-then-else combinator in a recursive fashion, following the Shannon decomposition of the argument functions. The implementation mixes and adapts known techniques and is built with efficiency in mind. notify = bdd@liftm.de, haslbecm@in.tum.de [No_FTL_observers] title = No Faster-Than-Light Observers author = Mike Stannett , István Németi date = 2016-04-28 topic = Mathematics/Physics abstract = We provide a formal proof within First Order Relativity Theory that no observer can travel faster than the speed of light. Originally reported in Stannett & Németi (2014) "Using Isabelle/HOL to verify first-order relativity theory", Journal of Automated Reasoning 52(4), pp. 361-378. notify = m.stannett@sheffield.ac.uk [Groebner_Bases] title = Gröbner Bases Theory author = Fabian Immler , Alexander Maletzky date = 2016-05-02 topic = Mathematics/Algebra, Computer Science/Algorithms/Mathematical abstract = This formalization is concerned with the theory of Gröbner bases in (commutative) multivariate polynomial rings over fields, originally developed by Buchberger in his 1965 PhD thesis. Apart from the statement and proof of the main theorem of the theory, the formalization also implements Buchberger's algorithm for actually computing Gröbner bases as a tail-recursive function, thus allowing to effectively decide ideal membership in finitely generated polynomial ideals. Furthermore, all functions can be executed on a concrete representation of multivariate polynomials as association lists. extra-history = Change history: [2019-04-18]: Specialized Gröbner bases to less abstract representation of polynomials, where power-products are represented as polynomial mappings.
notify = alexander.maletzky@risc.jku.at [Nullstellensatz] title = Hilbert's Nullstellensatz author = Alexander Maletzky topic = Mathematics/Algebra, Mathematics/Geometry date = 2019-06-16 notify = alexander.maletzky@risc-software.at abstract = This entry formalizes Hilbert's Nullstellensatz, an important theorem in algebraic geometry that can be viewed as the generalization of the Fundamental Theorem of Algebra to multivariate polynomials: If a set of (multivariate) polynomials over an algebraically closed field has no common zero, then the ideal it generates is the entire polynomial ring. The formalization proves several equivalent versions of this celebrated theorem: the weak Nullstellensatz, the strong Nullstellensatz (connecting algebraic varieties and radical ideals), and the field-theoretic Nullstellensatz. The formalization follows Chapter 4.1. of Ideals, Varieties, and Algorithms by Cox, Little and O'Shea. [Bell_Numbers_Spivey] title = Spivey's Generalized Recurrence for Bell Numbers author = Lukas Bulwahn date = 2016-05-04 topic = Mathematics/Combinatorics abstract = This entry defines the Bell numbers as the cardinality of set partitions for a carrier set of given size, and derives Spivey's generalized recurrence relation for Bell numbers following his elegant and intuitive combinatorial proof.

As the set construction for the combinatorial proof requires construction of three intermediate structures, the main difficulty of the formalization is handling the overall combinatorial argument in a structured way. The introduced proof structure allows us to compose the combinatorial argument from its subparts, and supports to keep track how the detailed proof steps are related to the overall argument. To obtain this structure, this entry uses set monad notation for the set construction's definition, introduces suitable predicates and rules, and follows a repeating structure in its Isar proof. notify = lukas.bulwahn@gmail.com [Randomised_Social_Choice] title = Randomised Social Choice Theory author = Manuel Eberl date = 2016-05-05 topic = Mathematics/Games and Economics abstract = This work contains a formalisation of basic Randomised Social Choice, including Stochastic Dominance and Social Decision Schemes (SDSs) along with some of their most important properties (Anonymity, Neutrality, ex-post- and SD-Efficiency, SD-Strategy-Proofness) and two particular SDSs – Random Dictatorship and Random Serial Dictatorship (with proofs of the properties that they satisfy). Many important properties of these concepts are also proven – such as the two equivalent characterisations of Stochastic Dominance and the fact that SD-efficiency of a lottery only depends on the support. The entry also provides convenient commands to define Preference Profiles, prove their well-formedness, and automatically derive restrictions that sufficiently nice SDSs need to satisfy on the defined profiles. Currently, the formalisation focuses on weak preferences and Stochastic Dominance, but it should be easy to extend it to other domains – such as strict preferences – or other lottery extensions – such as Bilinear Dominance or Pairwise Comparison. notify = eberlm@in.tum.de [SDS_Impossibility] title = The Incompatibility of SD-Efficiency and SD-Strategy-Proofness author = Manuel Eberl date = 2016-05-04 topic = Mathematics/Games and Economics abstract = This formalisation contains the proof that there is no anonymous and neutral Social Decision Scheme for at least four voters and alternatives that fulfils both SD-Efficiency and SD-Strategy- Proofness. The proof is a fully structured and quasi-human-redable one. It was derived from the (unstructured) SMT proof of the case for exactly four voters and alternatives by Brandl et al. Their proof relies on an unverified translation of the original problem to SMT, and the proof that lifts the argument for exactly four voters and alternatives to the general case is also not machine-checked. In this Isabelle proof, on the other hand, all of these steps are fully proven and machine-checked. This is particularly important seeing as a previously published informal proof of a weaker statement contained a mistake in precisely this lifting step. notify = eberlm@in.tum.de [Median_Of_Medians_Selection] title = The Median-of-Medians Selection Algorithm author = Manuel Eberl topic = Computer Science/Algorithms date = 2017-12-21 notify = eberlm@in.tum.de abstract =

This entry provides an executable functional implementation of the Median-of-Medians algorithm for selecting the k-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.

[Mason_Stothers] title = The Mason–Stothers Theorem author = Manuel Eberl topic = Mathematics/Algebra date = 2017-12-21 notify = eberlm@in.tum.de abstract =

This article provides a formalisation of Snyder’s simple and elegant proof of the Mason–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.

In short, the statement of the theorem is that three non-zero coprime polynomials A, B, C over a field which sum to 0 and do not all have vanishing derivatives fulfil max{deg(A), deg(B), deg(C)} < deg(rad(ABC)) where the rad(P) denotes the radical of P, i. e. the product of all unique irreducible factors of P.

This theorem also implies a kind of polynomial analogue of Fermat’s Last Theorem for polynomials: except for trivial cases, An + Bn + Cn = 0 implies n ≤ 2 for coprime polynomials A, B, C over a field.

[FLP] title = A Constructive Proof for FLP author = Benjamin Bisping , Paul-David Brodmann , Tim Jungnickel , Christina Rickmann , Henning Seidler , Anke Stüber , Arno Wilhelm-Weidner , Kirstin Peters , Uwe Nestmann date = 2016-05-18 topic = Computer Science/Concurrency abstract = The impossibility of distributed consensus with one faulty process is a result with important consequences for real world distributed systems e.g., commits in replicated databases. Since proofs are not immune to faults and even plausible proofs with a profound formalism can conclude wrong results, we validate the fundamental result named FLP after Fischer, Lynch and Paterson. We present a formalization of distributed systems and the aforementioned consensus problem. Our proof is based on Hagen Völzer's paper "A constructive proof for FLP". In addition to the enhanced confidence in the validity of Völzer's proof, we contribute the missing gaps to show the correctness in Isabelle/HOL. We clarify the proof details and even prove fairness of the infinite execution that contradicts consensus. Our Isabelle formalization can also be reused for further proofs of properties of distributed systems. notify = henning.seidler@mailbox.tu-berlin.de [IMAP-CRDT] title = The IMAP CmRDT author = Tim Jungnickel , Lennart Oldenburg <>, Matthias Loibl <> topic = Computer Science/Algorithms/Distributed, Computer Science/Data Structures date = 2017-11-09 notify = tim.jungnickel@tu-berlin.de abstract = We provide our Isabelle/HOL formalization of a Conflict-free Replicated Datatype for Internet Message Access Protocol commands. We show that Strong Eventual Consistency (SEC) is guaranteed by proving the commutativity of concurrent operations. We base our formalization on the recently proposed "framework for establishing Strong Eventual Consistency for Conflict-free Replicated Datatypes" (AFP.CRDT) from Gomes et al. Hence, we provide an additional example of how the recently proposed framework can be used to design and prove CRDTs. [Incredible_Proof_Machine] title = The meta theory of the Incredible Proof Machine author = Joachim Breitner , Denis Lohner date = 2016-05-20 topic = Logic abstract = The Incredible Proof Machine is an interactive visual theorem prover which represents proofs as port graphs. We model this proof representation in Isabelle, and prove that it is just as powerful as natural deduction. notify = mail@joachim-breitner.de [Word_Lib] title = Finite Machine Word Library author = Joel Beeren<>, Matthew Fernandez<>, Xin Gao<>, Gerwin Klein , Rafal Kolanski<>, Japheth Lim<>, Corey Lewis<>, Daniel Matichuk<>, Thomas Sewell<> notify = kleing@unsw.edu.au date = 2016-06-09 topic = Computer Science/Data Structures abstract = This entry contains an extension to the Isabelle library for fixed-width machine words. In particular, the entry adds quickcheck setup for words, printing as hexadecimals, additional operations, reasoning about alignment, signed words, enumerations of words, normalisation of word numerals, and an extensive library of properties about generic fixed-width words, as well as an instantiation of many of these to the commonly used 32 and 64-bit bases. [Catalan_Numbers] title = Catalan Numbers author = Manuel Eberl notify = eberlm@in.tum.de date = 2016-06-21 topic = Mathematics/Combinatorics abstract =

In this work, we define the Catalan numbers Cn and prove several equivalent definitions (including some closed-form formulae). We also show one of their applications (counting the number of binary trees of size n), prove the asymptotic growth approximation Cn ∼ 4n / (√π · n1.5), and provide reasonably efficient executable code to compute them.

The derivation of the closed-form formulae uses algebraic manipulations of the ordinary generating function of the Catalan numbers, and the asymptotic approximation is then done using generalised binomial coefficients and the Gamma function. Thanks to these highly non-elementary mathematical tools, the proofs are very short and simple.

[Fisher_Yates] title = Fisher–Yates shuffle author = Manuel Eberl notify = eberlm@in.tum.de date = 2016-09-30 topic = Computer Science/Algorithms abstract =

This work defines and proves the correctness of the Fisher–Yates algorithm for shuffling – i.e. producing a random permutation – of a list. The algorithm proceeds by traversing the list and in each step swapping the current element with a random element from the remaining list.

[Bertrands_Postulate] title = Bertrand's postulate author = Julian Biendarra<>, Manuel Eberl contributors = Lawrence C. Paulson topic = Mathematics/Number Theory date = 2017-01-17 notify = eberlm@in.tum.de abstract =

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.

[Rewriting_Z] title = The Z Property author = Bertram Felgenhauer<>, Julian Nagele<>, Vincent van Oostrom<>, Christian Sternagel notify = bertram.felgenhauer@uibk.ac.at, julian.nagele@uibk.ac.at, c.sternagel@gmail.com date = 2016-06-30 topic = Logic/Rewriting abstract = We formalize the Z property introduced by Dehornoy and van Oostrom. First we show that for any abstract rewrite system, Z implies confluence. Then we give two examples of proofs using Z: confluence of lambda-calculus with respect to beta-reduction and confluence of combinatory logic. [Resolution_FOL] title = The Resolution Calculus for First-Order Logic author = Anders Schlichtkrull notify = andschl@dtu.dk date = 2016-06-30 topic = Logic abstract = This theory is a formalization of the resolution calculus for first-order logic. It is proven sound and complete. The soundness proof uses the substitution lemma, which shows a correspondence between substitutions and updates to an environment. The completeness proof uses semantic trees, i.e. trees whose paths are partial Herbrand interpretations. It employs Herbrand's theorem in a formulation which states that an unsatisfiable set of clauses has a finite closed semantic tree. It also uses the lifting lemma which lifts resolution derivation steps from the ground world up to the first-order world. The theory is presented in a paper in the Journal of Automated Reasoning [Sch18] which extends a paper presented at the International Conference on Interactive Theorem Proving [Sch16]. An earlier version was presented in an MSc thesis [Sch15]. The formalization mostly follows textbooks by Ben-Ari [BA12], Chang and Lee [CL73], and Leitsch [Lei97]. The theory is part of the IsaFoL project [IsaFoL].

[Sch18] Anders Schlichtkrull. "Formalization of the Resolution Calculus for First-Order Logic". Journal of Automated Reasoning, 2018.
[Sch16] Anders Schlichtkrull. "Formalization of the Resolution Calculus for First-Order Logic". In: ITP 2016. Vol. 9807. LNCS. Springer, 2016.
[Sch15] Anders Schlichtkrull. "Formalization of Resolution Calculus in Isabelle". https://people.compute.dtu.dk/andschl/Thesis.pdf. MSc thesis. Technical University of Denmark, 2015.
[BA12] Mordechai Ben-Ari. Mathematical Logic for Computer Science. 3rd. Springer, 2012.
[CL73] Chin-Liang Chang and Richard Char-Tung Lee. Symbolic Logic and Mechanical Theorem Proving. 1st. Academic Press, Inc., 1973.
[Lei97] Alexander Leitsch. The Resolution Calculus. Texts in theoretical computer science. Springer, 1997.
[IsaFoL] IsaFoL authors. IsaFoL: Isabelle Formalization of Logic. https://bitbucket.org/jasmin_blanchette/isafol. extra-history = Change history: [2018-01-24]: added several new versions of the soundness and completeness theorems as described in the paper [Sch18].
[2018-03-20]: added a concrete instance of the unification and completeness theorems using the First-Order Terms AFP-entry from IsaFoR as described in the papers [Sch16] and [Sch18]. [Surprise_Paradox] title = Surprise Paradox author = Joachim Breitner notify = mail@joachim-breitner.de date = 2016-07-17 topic = Logic abstract = In 1964, Fitch showed that the paradox of the surprise hanging can be resolved by showing that the judge’s verdict is inconsistent. His formalization builds on Gödel’s coding of provability. In this theory, we reproduce his proof in Isabelle, building on Paulson’s formalisation of Gödel’s incompleteness theorems. [Ptolemys_Theorem] title = Ptolemy's Theorem author = Lukas Bulwahn notify = lukas.bulwahn@gmail.com date = 2016-08-07 topic = Mathematics/Geometry abstract = This entry provides an analytic proof to Ptolemy's Theorem using polar form transformation and trigonometric identities. In this formalization, we use ideas from John Harrison's HOL Light formalization and the proof sketch on the Wikipedia entry of Ptolemy's Theorem. This theorem is the 95th theorem of the Top 100 Theorems list. [Falling_Factorial_Sum] title = The Falling Factorial of a Sum author = Lukas Bulwahn topic = Mathematics/Combinatorics date = 2017-12-22 notify = lukas.bulwahn@gmail.com abstract = 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. [InfPathElimination] title = Infeasible Paths Elimination by Symbolic Execution Techniques: Proof of Correctness and Preservation of Paths author = Romain Aissat<>, Frederic Voisin<>, Burkhart Wolff notify = wolff@lri.fr date = 2016-08-18 topic = Computer Science/Programming Languages/Static Analysis abstract = TRACER is a tool for verifying safety properties of sequential C programs. TRACER attempts at building a finite symbolic execution graph which over-approximates the set of all concrete reachable states and the set of feasible paths. We present an abstract framework for TRACER and similar CEGAR-like systems. The framework provides 1) a graph- transformation based method for reducing the feasible paths in control-flow graphs, 2) a model for symbolic execution, subsumption, predicate abstraction and invariant generation. In this framework we formally prove two key properties: correct construction of the symbolic states and preservation of feasible paths. The framework focuses on core operations, leaving to concrete prototypes to “fit in” heuristics for combining them. The accompanying paper (published in ITP 2016) can be found at https://www.lri.fr/∼wolff/papers/conf/2016-itp-InfPathsNSE.pdf. [Stirling_Formula] title = Stirling's formula author = Manuel Eberl notify = eberlm@in.tum.de date = 2016-09-01 topic = Mathematics/Analysis abstract = This work contains a proof of Stirling's formula both for the factorial n! ∼ √2πn (n/e)n on natural numbers and the real Gamma function Γ(x) ∼ √2π/x (x/e)x. The proof is based on work by Graham Jameson. [Lp] title = Lp spaces author = Sebastien Gouezel notify = sebastien.gouezel@univ-rennes1.fr date = 2016-10-05 topic = Mathematics/Analysis abstract = Lp is the space of functions whose p-th power is integrable. It is one of the most fundamental Banach spaces that is used in analysis and probability. We develop a framework for function spaces, and then implement the Lp spaces in this framework using the existing integration theory in Isabelle/HOL. Our development contains most fundamental properties of Lp spaces, notably the Hölder and Minkowski inequalities, completeness of Lp, duality, stability under almost sure convergence, multiplication of functions in Lp and Lq, stability under conditional expectation. [Berlekamp_Zassenhaus] title = The Factorization Algorithm of Berlekamp and Zassenhaus author = Jose Divasón , Sebastiaan Joosten , René Thiemann , Akihisa Yamada notify = rene.thiemann@uibk.ac.at date = 2016-10-14 topic = Mathematics/Algebra abstract =

We formalize the Berlekamp-Zassenhaus algorithm for factoring square-free integer polynomials in Isabelle/HOL. We further adapt an existing formalization of Yun’s square-free factorization algorithm to integer polynomials, and thus provide an efficient and certified factorization algorithm for arbitrary univariate polynomials.

The algorithm first performs a factorization in the prime field GF(p) and then performs computations in the integer ring modulo p^k, where both p and k are determined at runtime. Since a natural modeling of these structures via dependent types is not possible in Isabelle/HOL, we formalize the whole algorithm using Isabelle’s recent addition of local type definitions.

Through experiments we verify that our algorithm factors polynomials of degree 100 within seconds.

[Allen_Calculus] title = Allen's Interval Calculus author = Fadoua Ghourabi <> notify = fadouaghourabi@gmail.com date = 2016-09-29 topic = Logic, Mathematics/Order abstract = Allen’s interval calculus is a qualitative temporal representation of time events. Allen introduced 13 binary relations that describe all the possible arrangements between two events, i.e. intervals with non-zero finite length. The compositions are pertinent to reasoning about knowledge of time. In particular, a consistency problem of relation constraints is commonly solved with a guideline from these compositions. We formalize the relations together with an axiomatic system. We proof the validity of the 169 compositions of these relations. We also define nests as the sets of intervals that share a meeting point. We prove that nests give the ordering properties of points without introducing a new datatype for points. [1] J.F. Allen. Maintaining Knowledge about Temporal Intervals. In Commun. ACM, volume 26, pages 832–843, 1983. [2] J. F. Allen and P. J. Hayes. A Common-sense Theory of Time. In Proceedings of the 9th International Joint Conference on Artificial Intelligence (IJCAI’85), pages 528–531, 1985. [Source_Coding_Theorem] title = Source Coding Theorem author = Quentin Hibon , Lawrence C. Paulson notify = qh225@cl.cam.ac.uk date = 2016-10-19 topic = Mathematics/Probability Theory abstract = This document contains a proof of the necessary condition on the code rate of a source code, namely that this code rate is bounded by the entropy of the source. This represents one half of Shannon's source coding theorem, which is itself an equivalence. [Buffons_Needle] title = Buffon's Needle Problem author = Manuel Eberl topic = Mathematics/Probability Theory, Mathematics/Geometry date = 2017-06-06 notify = eberlm@in.tum.de abstract = 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. [SPARCv8] title = A formal model for the SPARCv8 ISA and a proof of non-interference for the LEON3 processor author = Zhe Hou , David Sanan , Alwen Tiu , Yang Liu notify = zhe.hou@ntu.edu.sg, sanan@ntu.edu.sg date = 2016-10-19 topic = Computer Science/Security, Computer Science/Hardware abstract = We formalise the SPARCv8 instruction set architecture (ISA) which is used in processors such as LEON3. Our formalisation can be specialised to any SPARCv8 CPU, here we use LEON3 as a running example. Our model covers the operational semantics for all the instructions in the integer unit of the SPARCv8 architecture and it supports Isabelle code export, which effectively turns the Isabelle model into a SPARCv8 CPU simulator. We prove the language-based non-interference property for the LEON3 processor. Our model is based on deterministic monad, which is a modified version of the non-deterministic monad from NICTA/l4v. [Separata] title = Separata: Isabelle tactics for Separation Algebra author = Zhe Hou , David Sanan , Alwen Tiu , Rajeev Gore , Ranald Clouston notify = zhe.hou@ntu.edu.sg date = 2016-11-16 topic = Computer Science/Programming Languages/Logics, Tools abstract = 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. [LOFT] title = LOFT — Verified Migration of Linux Firewalls to SDN author = Julius Michaelis , Cornelius Diekmann notify = isabelleopenflow@liftm.de date = 2016-10-21 topic = Computer Science/Networks abstract = We present LOFT — Linux firewall OpenFlow Translator, a system that transforms the main routing table and FORWARD chain of iptables of a Linux-based firewall into a set of static OpenFlow rules. Our implementation is verified against a model of a simplified Linux-based router and we can directly show how much of the original functionality is preserved. [Stable_Matching] title = Stable Matching author = Peter Gammie notify = peteg42@gmail.com date = 2016-10-24 topic = Mathematics/Games and Economics abstract = 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. [Modal_Logics_for_NTS] title = Modal Logics for Nominal Transition Systems author = Tjark Weber , Lars-Henrik Eriksson , Joachim Parrow , Johannes Borgström , Ramunas Gutkovas notify = tjark.weber@it.uu.se date = 2016-10-25 topic = Computer Science/Concurrency/Process Calculi, Logic abstract = 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. extra-history = Change history: [2017-01-29]: Formalization of weak bisimilarity added (revision c87cc2057d9c) [Abs_Int_ITP2012] title = Abstract Interpretation of Annotated Commands author = Tobias Nipkow notify = nipkow@in.tum.de date = 2016-11-23 topic = Computer Science/Programming Languages/Static Analysis abstract = This is the Isabelle formalization of the material decribed in the eponymous ITP 2012 paper. 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 Concrete Semantics. [Complx] title = COMPLX: A Verification Framework for Concurrent Imperative Programs author = Sidney Amani<>, June Andronick<>, Maksym Bortin<>, Corey Lewis<>, Christine Rizkallah<>, Joseph Tuong<> notify = sidney.amani@data61.csiro.au, corey.lewis@data61.csiro.au date = 2016-11-29 topic = Computer Science/Programming Languages/Logics, Computer Science/Programming Languages/Language Definitions abstract = 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. extra-history = Change history: [2017-01-13]: Improve VCG for nested parallels and sequential sections (revision 30739dbc3dcb) [Paraconsistency] title = Paraconsistency author = Anders Schlichtkrull , Jørgen Villadsen topic = Logic date = 2016-12-07 notify = andschl@dtu.dk, jovi@dtu.dk abstract = 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. [Proof_Strategy_Language] title = Proof Strategy Language author = Yutaka Nagashima<> topic = Tools date = 2016-12-20 notify = Yutaka.Nagashima@data61.csiro.au abstract = 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. [Concurrent_Ref_Alg] title = Concurrent Refinement Algebra and Rely Quotients author = Julian Fell , Ian J. Hayes , Andrius Velykis topic = Computer Science/Concurrency date = 2016-12-30 notify = Ian.Hayes@itee.uq.edu.au abstract = 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 c and i is the process that, if executed in parallel with i implements c. It represents an abstract version of a rely condition generalised to a process. [FOL_Harrison] title = First-Order Logic According to Harrison author = Alexander Birch Jensen , Anders Schlichtkrull , Jørgen Villadsen topic = Logic date = 2017-01-01 notify = aleje@dtu.dk, andschl@dtu.dk, jovi@dtu.dk abstract =

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.

Reference: Programming and Verifying a Declarative First-Order Prover in Isabelle/HOL. Alexander Birch Jensen, John Bruntse Larsen, Anders Schlichtkrull & Jørgen Villadsen. AI Communications 31:281-299 2018. https://content.iospress.com/articles/ai-communications/aic764

See also: Students' Proof Assistant (SPA). https://github.com/logic-tools/spa

extra-history = Change history: [2018-07-21]: Proof of Pelletier's problem 34 (Andrews's Challenge) thanks to Asta Halkjær From. [Bernoulli] title = Bernoulli Numbers author = Lukas Bulwahn, Manuel Eberl topic = Mathematics/Analysis, Mathematics/Number Theory date = 2017-01-24 notify = eberlm@in.tum.de abstract =

Bernoulli numbers were first discovered in the closed-form expansion of the sum 1m + 2m + … + nm 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.

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, and some advanced facts like their relationship to the Riemann zeta function on positive even integers.

We also prove the correctness of the Akiyama–Tanigawa algorithm for computing Bernoulli numbers with reasonable efficiency, and we define the periodic Bernoulli polynomials (which appear e.g. in the Euler–MacLaurin summation formula and the expansion of the log-Gamma function) and prove their basic properties.

[Stone_Relation_Algebras] title = Stone Relation Algebras author = Walter Guttmann topic = Mathematics/Algebra date = 2017-02-07 notify = walter.guttmann@canterbury.ac.nz abstract = 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. [Stone_Kleene_Relation_Algebras] title = Stone-Kleene Relation Algebras author = Walter Guttmann topic = Mathematics/Algebra date = 2017-07-06 notify = walter.guttmann@canterbury.ac.nz abstract = 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. [Abstract_Soundness] title = Abstract Soundness author = Jasmin Christian Blanchette , Andrei Popescu , Dmitriy Traytel topic = Logic date = 2017-02-10 notify = jasmin.blanchette@gmail.com abstract = 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 Journal of Automated Reasoning. The abstract proof can be instantiated for various formalisms, including first-order logic with inductive predicates. [Differential_Dynamic_Logic] title = Differential Dynamic Logic author = Brandon Bohrer topic = Logic, Computer Science/Programming Languages/Logics date = 2017-02-13 notify = bbohrer@cs.cmu.edu abstract = 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. [Elliptic_Curves_Group_Law] title = The Group Law for Elliptic Curves author = Stefan Berghofer topic = Computer Science/Security/Cryptography date = 2017-02-28 notify = berghofe@in.tum.de abstract = 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. [Example-Submission] title = Example Submission author = Gerwin Klein topic = Mathematics/Analysis, Mathematics/Number Theory date = 2004-02-25 notify = kleing@cse.unsw.edu.au abstract = This is an example submission to the Archive of Formal Proofs. It shows submission requirements and explains the structure of a simple typical submission. extra-no-index = no-index: true [CRDT] title = A framework for establishing Strong Eventual Consistency for Conflict-free Replicated Datatypes author = Victor B. F. Gomes , Martin Kleppmann, Dominic P. Mulligan, Alastair R. Beresford topic = Computer Science/Algorithms/Distributed, Computer Science/Data Structures date = 2017-07-07 notify = vb358@cam.ac.uk, dominic.p.mulligan@googlemail.com abstract = 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. [HOLCF-Prelude] title = HOLCF-Prelude author = Joachim Breitner, Brian Huffman<>, Neil Mitchell<>, Christian Sternagel topic = Computer Science/Functional Programming date = 2017-07-15 notify = c.sternagel@gmail.com, joachim@cis.upenn.edu, hupel@in.tum.de abstract = 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. [Decl_Sem_Fun_PL] title = Declarative Semantics for Functional Languages author = Jeremy Siek topic = Computer Science/Programming Languages date = 2017-07-21 notify = jsiek@indiana.edu abstract = 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.
The paper that accompanies these Isabelle theories is available on arXiv. [DynamicArchitectures] title = Dynamic Architectures author = Diego Marmsoler topic = Computer Science/System Description Languages date = 2017-07-28 notify = diego.marmsoler@tum.de abstract = 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. extra-history = Change history: [2018-06-07]: adding logical operators to specify configuration traces (revision 09178f08f050)
[Stewart_Apollonius] title = Stewart's Theorem and Apollonius' Theorem author = Lukas Bulwahn topic = Mathematics/Geometry date = 2017-07-31 notify = lukas.bulwahn@gmail.com abstract = 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. [LambdaMu] title = The LambdaMu-calculus author = Cristina Matache , Victor B. F. Gomes , Dominic P. Mulligan topic = Computer Science/Programming Languages/Lambda Calculi, Logic date = 2017-08-16 notify = victorborgesfg@gmail.com, dominic.p.mulligan@googlemail.com abstract = 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. [Orbit_Stabiliser] title = Orbit-Stabiliser Theorem with Application to Rotational Symmetries author = Jonas Rädle topic = Mathematics/Algebra date = 2017-08-20 notify = jonas.raedle@tum.de abstract = 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. [PLM] title = Representation and Partial Automation of the Principia Logico-Metaphysica in Isabelle/HOL author = Daniel Kirchner topic = Logic/Philosophy date = 2017-09-17 notify = daniel@ekpyron.org abstract =

We present an embedding of the second-order fragment of the Theory of Abstract Objects as described in Edward Zalta's upcoming work Principia Logico-Metaphysica (PLM) 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 abstract objects 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 known to be challenging.

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.

Our work thereby supports the concept of shallow semantical embeddings of logical systems in HOL as a universal tool for logical reasoning as promoted by Christoph Benzmüller.

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.

[KD_Tree] title = Multidimensional Binary Search Trees author = Martin Rau<> topic = Computer Science/Data Structures date = 2019-05-30 notify = martin.rau@tum.de, mrtnrau@googlemail.com abstract = This entry provides a formalization of multidimensional binary trees, also known as k-d trees. It includes a balanced build algorithm as well as the nearest neighbor algorithm and the range search algorithm. It is based on the papers Multidimensional binary search trees used for associative searching and An Algorithm for Finding Best Matches in Logarithmic Expected Time. [Closest_Pair_Points] title = Closest Pair of Points Algorithms author = Martin Rau , Tobias Nipkow topic = Computer Science/Algorithms/Geometry date = 2020-01-13 notify = martin.rau@tum.de, nipkow@in.tum.de abstract = This entry provides two related verified divide-and-conquer algorithms solving the fundamental Closest Pair of Points problem in Computational Geometry. Functional correctness and the optimal running time of O(n log n) are proved. Executable code is generated which is empirically competitive with handwritten reference implementations. [Approximation_Algorithms] title = Verified Approximation Algorithms author = Robin Eßmann , Tobias Nipkow , Simon Robillard topic = Computer Science/Algorithms/Approximation date = 2020-01-16 notify = nipkow@in.tum.de abstract = We present the first formal verification of approximation algorithms for NP-complete optimization problems: vertex cover, independent set, load balancing, and bin packing. The proofs correct incompletenesses in existing proofs and improve the approximation ratio in one case. [Diophantine_Eqns_Lin_Hom] title = Homogeneous Linear Diophantine Equations author = Florian Messner , Julian Parsert , Jonas Schöpf , Christian Sternagel topic = Computer Science/Algorithms/Mathematical, Mathematics/Number Theory, Tools license = LGPL date = 2017-10-14 notify = c.sternagel@gmail.com, julian.parsert@gmail.com abstract = 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. [Winding_Number_Eval] title = Evaluate Winding Numbers through Cauchy Indices author = Wenda Li topic = Mathematics/Analysis date = 2017-10-17 notify = wl302@cam.ac.uk, liwenda1990@hotmail.com abstract = 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_Complex_Roots] title = Count the Number of Complex Roots author = Wenda Li topic = Mathematics/Analysis date = 2017-10-17 notify = wl302@cam.ac.uk, liwenda1990@hotmail.com abstract = 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). [Buchi_Complementation] title = Büchi Complementation author = Julian Brunner topic = Computer Science/Automata and Formal Languages date = 2017-10-19 notify = brunnerj@in.tum.de abstract = This entry provides a verified implementation of rank-based Büchi Complementation. The verification is done in three steps:
  1. Definition of odd rankings and proof that an automaton rejects a word iff there exists an odd ranking for it.
  2. Definition of the complement automaton and proof that it accepts exactly those words for which there is an odd ranking.
  3. Verified implementation of the complement automaton using the Isabelle Collections Framework.
[Transition_Systems_and_Automata] title = Transition Systems and Automata author = Julian Brunner topic = Computer Science/Automata and Formal Languages date = 2017-10-19 notify = brunnerj@in.tum.de abstract = 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. [Kuratowski_Closure_Complement] title = The Kuratowski Closure-Complement Theorem author = Peter Gammie , Gianpaolo Gioiosa<> topic = Mathematics/Topology date = 2017-10-26 notify = peteg42@gmail.com abstract = 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. [Hybrid_Multi_Lane_Spatial_Logic] title = Hybrid Multi-Lane Spatial Logic author = Sven Linker topic = Logic date = 2017-11-06 notify = s.linker@liverpool.ac.uk abstract = We present a semantic embedding of a spatio-temporal multi-modal logic, specifically defined to reason about motorway traffic, into Isabelle/HOL. The semantic model is an abstraction of a motorway, emphasising local spatial properties, and parameterised by the types of sensors deployed in the vehicles. We use the logic to define controller constraints to ensure safety, i.e., the absence of collisions on the motorway. After proving safety with a restrictive definition of sensors, we relax these assumptions and show how to amend the controller constraints to still guarantee safety. [Dirichlet_L] title = Dirichlet L-Functions and Dirichlet's Theorem author = Manuel Eberl topic = Mathematics/Number Theory, Mathematics/Algebra date = 2017-12-21 notify = eberlm@in.tum.de abstract =

This article provides a formalisation of Dirichlet characters and Dirichlet L-functions including proofs of their basic properties – most notably their analyticity, their areas of convergence, and their non-vanishing for ℜ(s) ≥ 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.

This also leads to a relatively short proof of Dirichlet’s Theorem, which states that, if h and n are coprime, there are infinitely many primes p with ph (mod n).

[Symmetric_Polynomials] title = Symmetric Polynomials author = Manuel Eberl topic = Mathematics/Algebra date = 2018-09-25 notify = eberlm@in.tum.de abstract =

A symmetric polynomial is a polynomial in variables X1,…,Xn that does not discriminate between its variables, i. 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.

This article provides a definition of symmetric polynomials and the elementary symmetric polynomials e1,…,en and proofs of their basic properties, including three notable ones:

  • Vieta's formula, which gives an explicit expression for the k-th coefficient of a univariate monic polynomial in terms of its roots x1,…,xn, namely ck = (-1)n-k en-k(x1,…,xn).
  • 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.
  • Third, as a corollary of the previous two, that given a polynomial over some ring R, any symmetric polynomial combination of its roots is also in R even when the roots are not.

Both the symmetry property itself and the witness for the Fundamental Theorem are executable.

[Taylor_Models] title = Taylor Models author = Christoph Traut<>, Fabian Immler topic = Computer Science/Algorithms/Mathematical, Computer Science/Data Structures, Mathematics/Analysis, Mathematics/Algebra date = 2018-01-08 notify = immler@in.tum.de abstract = 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. [Green] title = An Isabelle/HOL formalisation of Green's Theorem author = Mohammad Abdulaziz , Lawrence C. Paulson topic = Mathematics/Analysis date = 2018-01-11 notify = mohammad.abdulaziz8@gmail.com, lp15@cam.ac.uk abstract = 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. [Gromov_Hyperbolicity] title = Gromov Hyperbolicity author = Sebastien Gouezel<> topic = Mathematics/Geometry date = 2018-01-16 notify = sebastien.gouezel@univ-rennes1.fr abstract = 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. [Ordered_Resolution_Prover] title = Formalization of Bachmair and Ganzinger's Ordered Resolution Prover author = Anders Schlichtkrull , Jasmin Christian Blanchette , Dmitriy Traytel , Uwe Waldmann topic = Logic date = 2018-01-18 notify = andschl@dtu.dk, j.c.blanchette@vu.nl abstract = This Isabelle/HOL formalization covers Sections 2 to 4 of Bachmair and Ganzinger's "Resolution Theorem Proving" chapter in the Handbook of Automated Reasoning. 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. [BNF_Operations] title = Operations on Bounded Natural Functors author = Jasmin Christian Blanchette , Andrei Popescu , Dmitriy Traytel topic = Tools date = 2017-12-19 notify = jasmin.blanchette@gmail.com,uuomul@yahoo.com,traytel@inf.ethz.ch abstract = This entry formalizes the closure property of bounded natural functors (BNFs) under seven operations. These operations and the corresponding proofs constitute the core of Isabelle's (co)datatype package. To be close to the implemented tactics, the proofs are deliberately formulated as detailed apply scripts. The (co)datatypes together with (co)induction principles and (co)recursors are byproducts of the fixpoint operations LFP and GFP. Composition of BNFs is subdivided into four simpler operations: Compose, Kill, Lift, and Permute. The N2M operation provides mutual (co)induction principles and (co)recursors for nested (co)datatypes. [LLL_Basis_Reduction] title = A verified LLL algorithm author = Ralph Bottesch <>, Jose Divasón , Maximilian Haslbeck , Sebastiaan Joosten , René Thiemann , Akihisa Yamada<> topic = Computer Science/Algorithms/Mathematical, Mathematics/Algebra date = 2018-02-02 notify = ralph.bottesch@uibk.ac.at, jose.divason@unirioja.es, maximilian.haslbeck@uibk.ac.at, s.j.c.joosten@utwente.nl, rene.thiemann@uibk.ac.at, ayamada@trs.cm.is.nagoya-u.ac.jp abstract = 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. extra-history = Change history: [2018-04-16]: Integrated formal complexity bounds (Haslbeck, Thiemann) [2018-05-25]: Integrated much faster LLL implementation based on integer arithmetic (Bottesch, Haslbeck, Thiemann) [LLL_Factorization] title = A verified factorization algorithm for integer polynomials with polynomial complexity author = Jose Divasón , Sebastiaan Joosten , René Thiemann , Akihisa Yamada topic = Mathematics/Algebra date = 2018-02-06 notify = jose.divason@unirioja.es, s.j.c.joosten@utwente.nl, rene.thiemann@uibk.ac.at, ayamada@trs.cm.is.nagoya-u.ac.jp abstract = 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. [Treaps] title = Treaps author = Maximilian Haslbeck , Manuel Eberl , Tobias Nipkow topic = Computer Science/Data Structures date = 2018-02-06 notify = eberlm@in.tum.de abstract =

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.

In particular, by choosing these priorities at random upon insertion of an element, we can pretend that we inserted the elements in random order, 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.

[Skip_Lists] title = Skip Lists author = Max W. Haslbeck , Manuel Eberl topic = Computer Science/Data Structures date = 2020-01-09 notify = max.haslbeck@gmx.de abstract =

Skip lists are sorted linked lists enhanced with shortcuts and are an alternative to binary search trees. A skip lists consists of multiple levels of sorted linked lists where a list on level n is a subsequence of the list on level n − 1. In the ideal case, elements are skipped in such a way that a lookup in a skip lists takes O(log n) time. In a randomised skip list the skipped elements are choosen randomly.

This entry contains formalized proofs of the textbook results about the expected height and the expected length of a search path in a randomised skip list.

[Mersenne_Primes] title = Mersenne primes and the Lucas–Lehmer test author = Manuel Eberl topic = Mathematics/Number Theory date = 2020-01-17 notify = eberlm@in.tum.de abstract =

This article provides formal proofs of basic properties of Mersenne numbers, i. e. numbers of the form 2n - 1, and especially of Mersenne primes.

In particular, an efficient, verified, and executable version of the Lucas–Lehmer test is developed. This test decides primality for Mersenne numbers in time polynomial in n.

[Hoare_Time] title = Hoare Logics for Time Bounds author = Maximilian P. L. Haslbeck , Tobias Nipkow topic = Computer Science/Programming Languages/Logics date = 2018-02-26 notify = haslbema@in.tum.de abstract = 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 et al. and a separation logic 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. [Architectural_Design_Patterns] title = A Theory of Architectural Design Patterns author = Diego Marmsoler topic = Computer Science/System Description Languages date = 2018-03-01 notify = diego.marmsoler@tum.de abstract = 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. extra-history = Change history: [2018-05-25]: changing the major assumption for blockchain architectures from alternative minings to relative mining frequencies (revision 5043c5c71685)
[2019-04-08]: adapting the terminology: honest instead of trusted, dishonest instead of untrusted (revision 7af3431a22ae) [Weight_Balanced_Trees] title = Weight-Balanced Trees author = Tobias Nipkow , Stefan Dirix<> topic = Computer Science/Data Structures date = 2018-03-13 notify = nipkow@in.tum.de abstract = This theory provides a verified implementation of weight-balanced trees following the work of Hirai and Yamamoto 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. [Fishburn_Impossibility] title = The Incompatibility of Fishburn-Strategyproofness and Pareto-Efficiency author = Felix Brandt , Manuel Eberl , Christian Saile , Christian Stricker topic = Mathematics/Games and Economics date = 2018-03-22 notify = eberlm@in.tum.de abstract =

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 Brandt et al., 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.

[BNF_CC] title = Bounded Natural Functors with Covariance and Contravariance author = Andreas Lochbihler , Joshua Schneider topic = Computer Science/Functional Programming, Tools date = 2018-04-24 notify = mail@andreas-lochbihler.de, joshua.schneider@inf.ethz.ch abstract = 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 BNFCC that extends the mapper and relator to covariant and contravariant parameters. We show that
  1. BNFCCs are closed under functor composition and least and greatest fixpoints,
  2. subtypes inherit the BNFCC structure under conditions that generalise those for the BNF case, and
  3. BNFCCs preserve quotients under mild conditions.
These proofs are carried out for abstract BNFCCs similar to the AFP entry BNF Operations. In addition, we apply the BNFCC theory to several concrete functors. [Modular_Assembly_Kit_Security] title = An Isabelle/HOL Formalization of the Modular Assembly Kit for Security Properties author = Oliver Bračevac , Richard Gay , Sylvia Grewe , Heiko Mantel , Henning Sudbrock , Markus Tasch topic = Computer Science/Security date = 2018-05-07 notify = tasch@mais.informatik.tu-darmstadt.de abstract = 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. [AxiomaticCategoryTheory] title = Axiom Systems for Category Theory in Free Logic author = Christoph Benzmüller , Dana Scott topic = Mathematics/Category Theory date = 2018-05-23 notify = c.benzmueller@gmail.com abstract = 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. [OpSets] title = OpSets: Sequential Specifications for Replicated Datatypes author = Martin Kleppmann , Victor B. F. Gomes , Dominic P. Mulligan , Alastair R. Beresford topic = Computer Science/Algorithms/Distributed, Computer Science/Data Structures date = 2018-05-10 notify = vb358@cam.ac.uk abstract = 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. [Irrationality_J_Hancl] title = Irrational Rapidly Convergent Series author = Angeliki Koutsoukou-Argyraki , Wenda Li topic = Mathematics/Number Theory, Mathematics/Analysis date = 2018-05-23 notify = ak2110@cam.ac.uk, wl302@cam.ac.uk abstract = 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. [Optimal_BST] title = Optimal Binary Search Trees author = Tobias Nipkow , Dániel Somogyi <> topic = Computer Science/Algorithms, Computer Science/Data Structures date = 2018-05-27 notify = nipkow@in.tum.de abstract = 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 Monadification, Memoization and Dynamic Programming, thus yielding dynamic programming algorithms. [Projective_Geometry] title = Projective Geometry author = Anthony Bordg topic = Mathematics/Geometry date = 2018-06-14 notify = apdb3@cam.ac.uk abstract = 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. [Localization_Ring] title = The Localization of a Commutative Ring author = Anthony Bordg topic = Mathematics/Algebra date = 2018-06-14 notify = apdb3@cam.ac.uk abstract = 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. [Minsky_Machines] title = Minsky Machines author = Bertram Felgenhauer<> topic = Logic date = 2018-08-14 notify = int-e@gmx.de abstract =

We formalize undecidablity results for Minsky machines. To this end, we also formalize recursive inseparability.

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.

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.

We do not prove that recursive functions can simulate Minsky machines.

[Neumann_Morgenstern_Utility] title = Von-Neumann-Morgenstern Utility Theorem author = Julian Parsert, Cezary Kaliszyk topic = Mathematics/Games and Economics license = LGPL date = 2018-07-04 notify = julian.parsert@uibk.ac.at, cezary.kaliszyk@uibk.ac.at abstract = 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. [Simplex] title = An Incremental Simplex Algorithm with Unsatisfiable Core Generation author = Filip Marić , Mirko Spasić , René Thiemann topic = Computer Science/Algorithms/Optimization date = 2018-08-24 notify = rene.thiemann@uibk.ac.at abstract = 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 minimal unsatisfiable cores, incremental assertion of constraints and backtracking. The 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. [Budan_Fourier] title = The Budan-Fourier Theorem and Counting Real Roots with Multiplicity author = Wenda Li topic = Mathematics/Analysis date = 2018-09-02 notify = wl302@cam.ac.uk, liwenda1990@hotmail.com abstract = 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. [Quaternions] title = Quaternions author = Lawrence C. Paulson topic = Mathematics/Algebra, Mathematics/Geometry date = 2018-09-05 notify = lp15@cam.ac.uk abstract = 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. [Octonions] title = Octonions author = Angeliki Koutsoukou-Argyraki topic = Mathematics/Algebra, Mathematics/Geometry date = 2018-09-14 notify = ak2110@cam.ac.uk abstract = 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. [Aggregation_Algebras] title = Aggregation Algebras author = Walter Guttmann topic = Mathematics/Algebra date = 2018-09-15 notify = walter.guttmann@canterbury.ac.nz abstract = 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. [Prime_Number_Theorem] title = The Prime Number Theorem author = Manuel Eberl , Lawrence C. Paulson topic = Mathematics/Number Theory date = 2018-09-19 notify = eberlm@in.tum.de abstract =

This article provides a short proof of the Prime Number Theorem in several equivalent forms, most notably π(x) ~ x/ln x where π(x) is the number of primes no larger than x. It also defines other basic number-theoretic functions related to primes like Chebyshev's functions ϑ and ψ and the “n-th prime number” function pn. We also show various bounds and relationship between these functions are shown. Lastly, we derive Mertens' First and Second Theorem, i. e. ∑px ln p/p = ln x + O(1) and ∑px 1/p = ln ln x + M + O(1/ln x). We also give explicit bounds for the remainder terms.

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 ∑px ln p/p = ln x + c + o(1).

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 et al. 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.

[Signature_Groebner] title = Signature-Based Gröbner Basis Algorithms author = Alexander Maletzky topic = Mathematics/Algebra, Computer Science/Algorithms/Mathematical date = 2018-09-20 notify = alexander.maletzky@risc.jku.at abstract =

This article formalizes signature-based algorithms for computing Grö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.

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öbner bases if an input parameter is chosen in the right way.

The formalization follows the recent survey article by Eder and Faugère.

[Factored_Transition_System_Bounding] title = Upper Bounding Diameters of State Spaces of Factored Transition Systems author = Friedrich Kurz <>, Mohammad Abdulaziz topic = Computer Science/Automata and Formal Languages, Mathematics/Graph Theory date = 2018-10-12 notify = friedrich.kurz@tum.de, mohammad.abdulaziz@in.tum.de abstract = 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. [Smooth_Manifolds] title = Smooth Manifolds author = Fabian Immler , Bohua Zhan topic = Mathematics/Analysis, Mathematics/Topology date = 2018-10-22 notify = immler@in.tum.de, bzhan@ios.ac.cn abstract = 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. [Matroids] title = Matroids author = Jonas Keinholz<> topic = Mathematics/Combinatorics date = 2018-11-16 notify = eberlm@in.tum.de abstract =

This article defines the combinatorial structures known as Independence Systems and Matroids and provides basic concepts and theorems related to them. These structures play an important role in combinatorial optimisation, e. g. greedy algorithms such as Kruskal's algorithm. The development is based on Oxley's `What is a Matroid?'.

[Graph_Saturation] title = Graph Saturation author = Sebastiaan J. C. Joosten<> topic = Logic/Rewriting, Mathematics/Graph Theory date = 2018-11-23 notify = sjcjoosten@gmail.com abstract = This is an Isabelle/HOL formalisation of graph saturation, closely following a paper by the author on graph saturation. Nine out of ten lemmas of the original paper are proven in this formalisation. The formalisation additionally includes two theorems that show the main premise of the paper: that consistency and entailment are decided through graph saturation. This formalisation does not give executable code, and it did not implement any of the optimisations suggested in the paper. [Functional_Ordered_Resolution_Prover] title = A Verified Functional Implementation of Bachmair and Ganzinger's Ordered Resolution Prover author = Anders Schlichtkrull , Jasmin Christian Blanchette , Dmitriy Traytel topic = Logic date = 2018-11-23 notify = andschl@dtu.dk,j.c.blanchette@vu.nl,traytel@inf.ethz.ch abstract = This Isabelle/HOL formalization refines the abstract ordered resolution prover presented in Section 4.3 of Bachmair and Ganzinger's "Resolution Theorem Proving" chapter in the Handbook of Automated Reasoning. The result is a functional implementation of a first-order prover. [Auto2_HOL] title = Auto2 Prover author = Bohua Zhan topic = Tools date = 2018-11-20 notify = bzhan@ios.ac.cn abstract = Auto2 is a saturation-based heuristic prover for higher-order logic, implemented as a tactic in Isabelle. This entry contains the instantiation of auto2 for Isabelle/HOL, along with two basic examples: solutions to some of the Pelletier’s problems, and elementary number theory of primes. [Order_Lattice_Props] title = Properties of Orderings and Lattices author = Georg Struth topic = Mathematics/Order date = 2018-12-11 notify = g.struth@sheffield.ac.uk abstract = These components add further fundamental order and lattice-theoretic concepts and properties to Isabelle's libraries. They follow by and large the introductory sections of the Compendium of Continuous Lattices, covering directed and filtered sets, down-closed and up-closed sets, ideals and filters, Galois connections, closure and co-closure operators. Some emphasis is on duality and morphisms between structures, as in the Compendium. To this end, three ad-hoc approaches to duality are compared. [Quantales] title = Quantales author = Georg Struth topic = Mathematics/Algebra date = 2018-12-11 notify = g.struth@sheffield.ac.uk abstract = These mathematical components formalise basic properties of quantales, together with some important models, constructions, and concepts, including quantic nuclei and conuclei. [Transformer_Semantics] title = Transformer Semantics author = Georg Struth topic = Mathematics/Algebra, Computer Science/Semantics date = 2018-12-11 notify = g.struth@sheffield.ac.uk abstract = These mathematical components formalise predicate transformer semantics for programs, yet currently only for partial correctness and in the absence of faults. A first part for isotone (or monotone), Sup-preserving and Inf-preserving transformers follows Back and von Wright's approach, with additional emphasis on the quantalic structure of algebras of transformers. The second part develops Sup-preserving and Inf-preserving predicate transformers from the powerset monad, via its Kleisli category and Eilenberg-Moore algebras, with emphasis on adjunctions and dualities, as well as isomorphisms between relations, state transformers and predicate transformers. [Concurrent_Revisions] title = Formalization of Concurrent Revisions author = Roy Overbeek topic = Computer Science/Concurrency date = 2018-12-25 notify = Roy.Overbeek@cwi.nl abstract = Concurrent revisions is a concurrency control model developed by Microsoft Research. It has many interesting properties that distinguish it from other well-known models such as transactional memory. One of these properties is determinacy: programs written within the model always produce the same outcome, independent of scheduling activity. The concurrent revisions model has an operational semantics, with an informal proof of determinacy. This document contains an Isabelle/HOL formalization of this semantics and the proof of determinacy. [Core_DOM] title = A Formal Model of the Document Object Model author = Achim D. Brucker , Michael Herzberg topic = Computer Science/Data Structures date = 2018-12-26 notify = adbrucker@0x5f.org abstract = In this AFP entry, we formalize the core of the Document Object Model (DOM). At its core, the DOM defines a tree-like data structure for representing documents in general and HTML documents in particular. It is the heart of any modern web browser. Formalizing the key concepts of the DOM is a prerequisite for the formal reasoning over client-side JavaScript programs and for the analysis of security concepts in modern web browsers. We present a formalization of the core DOM, with focus on the node-tree and the operations defined on node-trees, in Isabelle/HOL. We use the formalization to verify the functional correctness of the most important functions defined in the DOM standard. Moreover, our formalization is 1) extensible, i.e., can be extended without the need of re-proving already proven properties and 2) executable, i.e., we can generate executable code from our specification. [Store_Buffer_Reduction] title = A Reduction Theorem for Store Buffers author = Ernie Cohen , Norbert Schirmer topic = Computer Science/Concurrency date = 2019-01-07 notify = norbert.schirmer@web.de abstract = When verifying a concurrent program, it is usual to assume that memory is sequentially consistent. However, most modern multiprocessors depend on store buffering for efficiency, and provide native sequential consistency only at a substantial performance penalty. To regain sequential consistency, a programmer has to follow an appropriate programming discipline. However, naïve disciplines, such as protecting all shared accesses with locks, are not flexible enough for building high-performance multiprocessor software. We present a new discipline for concurrent programming under TSO (total store order, with store buffer forwarding). It does not depend on concurrency primitives, such as locks. Instead, threads use ghost operations to acquire and release ownership of memory addresses. A thread can write to an address only if no other thread owns it, and can read from an address only if it owns it or it is shared and the thread has flushed its store buffer since it last wrote to an address it did not own. This discipline covers both coarse-grained concurrency (where data is protected by locks) as well as fine-grained concurrency (where atomic operations race to memory). We formalize this discipline in Isabelle/HOL, and prove that if every execution of a program in a system without store buffers follows the discipline, then every execution of the program with store buffers is sequentially consistent. Thus, we can show sequential consistency under TSO by ordinary assertional reasoning about the program, without having to consider store buffers at all. [IMP2] title = IMP2 – Simple Program Verification in Isabelle/HOL author = Peter Lammich , Simon Wimmer topic = Computer Science/Programming Languages/Logics, Computer Science/Algorithms date = 2019-01-15 notify = lammich@in.tum.de abstract = IMP2 is a simple imperative language together with Isabelle tooling to create a program verification environment in Isabelle/HOL. The tools include a C-like syntax, a verification condition generator, and Isabelle commands for the specification of programs. The framework is modular, i.e., it allows easy reuse of already proved programs within larger programs. This entry comes with a quickstart guide and a large collection of examples, spanning basic algorithms with simple proofs to more advanced algorithms and proof techniques like data refinement. Some highlights from the examples are:
  • Bisection Square Root,
  • Extended Euclid,
  • Exponentiation by Squaring,
  • Binary Search,
  • Insertion Sort,
  • Quicksort,
  • Depth First Search.
The abstract syntax and semantics are very simple and well-documented. They are suitable to be used in a course, as extension to the IMP language which comes with the Isabelle distribution. While this entry is limited to a simple imperative language, the ideas could be extended to more sophisticated languages. [Farkas] title = Farkas' Lemma and Motzkin's Transposition Theorem author = Ralph Bottesch , Max W. Haslbeck , René Thiemann topic = Mathematics/Algebra date = 2019-01-17 notify = rene.thiemann@uibk.ac.at abstract = We formalize a proof of Motzkin's transposition theorem and Farkas' lemma in Isabelle/HOL. Our proof is based on the formalization of the simplex algorithm which, given a set of linear constraints, either returns a satisfying assignment to the problem or detects unsatisfiability. By reusing facts about the simplex algorithm we show that a set of linear constraints is unsatisfiable if and only if there is a linear combination of the constraints which evaluates to a trivially unsatisfiable inequality. [Auto2_Imperative_HOL] title = Verifying Imperative Programs using Auto2 author = Bohua Zhan topic = Computer Science/Algorithms, Computer Science/Data Structures date = 2018-12-21 notify = bzhan@ios.ac.cn abstract = This entry contains the application of auto2 to verifying functional and imperative programs. Algorithms and data structures that are verified include linked lists, binary search trees, red-black trees, interval trees, priority queue, quicksort, union-find, Dijkstra's algorithm, and a sweep-line algorithm for detecting rectangle intersection. The imperative verification is based on Imperative HOL and its separation logic framework. A major goal of this work is to set up automation in order to reduce the length of proof that the user needs to provide, both for verifying functional programs and for working with separation logic. [UTP] title = Isabelle/UTP: Mechanised Theory Engineering for Unifying Theories of Programming author = Simon Foster , Frank Zeyda<>, Yakoub Nemouchi , Pedro Ribeiro<>, Burkhart Wolff topic = Computer Science/Programming Languages/Logics date = 2019-02-01 notify = simon.foster@york.ac.uk abstract = Isabelle/UTP is a mechanised theory engineering toolkit based on Hoare and He’s Unifying Theories of Programming (UTP). UTP enables the creation of denotational, algebraic, and operational semantics for different programming languages using an alphabetised relational calculus. We provide a semantic embedding of the alphabetised relational calculus in Isabelle/HOL, including new type definitions, relational constructors, automated proof tactics, and accompanying algebraic laws. Isabelle/UTP can be used to both capture laws of programming for different languages, and put these fundamental theorems to work in the creation of associated verification tools, using calculi like Hoare logics. This document describes the relational core of the UTP in Isabelle/HOL. [HOL-CSP] title = HOL-CSP Version 2.0 author = Safouan Taha , Lina Ye , Burkhart Wolff topic = Computer Science/Concurrency/Process Calculi, Computer Science/Semantics date = 2019-04-26 notify = wolff@lri.fr abstract = This is a complete formalization of the work of Hoare and Roscoe on the denotational semantics of the Failure/Divergence Model of CSP. It follows essentially the presentation of CSP in Roscoe’s Book ”Theory and Practice of Concurrency” [8] and the semantic details in a joint Paper of Roscoe and Brooks ”An improved failures model for communicating processes". The present work is based on a prior formalization attempt, called HOL-CSP 1.0, done in 1997 by H. Tej and B. Wolff with the Isabelle proof technology available at that time. This work revealed minor, but omnipresent foundational errors in key concepts like the process invariant. The present version HOL-CSP profits from substantially improved libraries (notably HOLCF), improved automated proof techniques, and structured proof techniques in Isar and is substantially shorter but more complete. [Probabilistic_Prime_Tests] title = Probabilistic Primality Testing author = Daniel Stüwe<>, Manuel Eberl topic = Mathematics/Number Theory date = 2019-02-11 notify = eberlm@in.tum.de abstract =

The most efficient known primality tests are probabilistic in the sense that they use randomness and may, with some probability, mistakenly classify a composite number as prime – but never a prime number as composite. Examples of this are the Miller–Rabin test, the Solovay–Strassen test, and (in most cases) Fermat's test.

This entry defines these three tests and proves their correctness. It also develops some of the number-theoretic foundations, such as Carmichael numbers and the Jacobi symbol with an efficient executable algorithm to compute it.

[Kruskal] title = Kruskal's Algorithm for Minimum Spanning Forest author = Maximilian P.L. Haslbeck , Peter Lammich , Julian Biendarra<> topic = Computer Science/Algorithms/Graph date = 2019-02-14 notify = haslbema@in.tum.de, lammich@in.tum.de abstract = This Isabelle/HOL formalization defines a greedy algorithm for finding a minimum weight basis on a weighted matroid and proves its correctness. This algorithm is an abstract version of Kruskal's algorithm. We interpret the abstract algorithm for the cycle matroid (i.e. forests in a graph) and refine it to imperative executable code using an efficient union-find data structure. Our formalization can be instantiated for different graph representations. We provide instantiations for undirected graphs and symmetric directed graphs. [List_Inversions] title = The Inversions of a List author = Manuel Eberl topic = Computer Science/Algorithms date = 2019-02-01 notify = eberlm@in.tum.de abstract =

This entry defines the set of inversions of a list, i.e. the pairs of indices that violate sortedness. It also proves the correctness of the well-known O(n log n) divide-and-conquer algorithm to compute the number of inversions.

[Prime_Distribution_Elementary] title = Elementary Facts About the Distribution of Primes author = Manuel Eberl topic = Mathematics/Number Theory date = 2019-02-21 notify = eberlm@in.tum.de abstract =

This entry is a formalisation of Chapter 4 (and parts of Chapter 3) of Apostol's Introduction to Analytic Number Theory. The main topics that are addressed are properties of the distribution of prime numbers that can be shown in an elementary way (i. e. without the Prime Number Theorem), the various equivalent forms of the PNT (which imply each other in elementary ways), and consequences that follow from the PNT in elementary ways. The latter include, most notably, asymptotic bounds for the number of distinct prime factors of n, the divisor function d(n), Euler's totient function φ(n), and lcm(1,…,n).

[Safe_OCL] title = Safe OCL author = Denis Nikiforov <> topic = Computer Science/Programming Languages/Language Definitions license = LGPL date = 2019-03-09 notify = denis.nikif@gmail.com abstract =

The theory is a formalization of the OCL type system, its abstract syntax and expression typing rules. The theory does not define a concrete syntax and a semantics. In contrast to Featherweight OCL, it is based on a deep embedding approach. The type system is defined from scratch, it is not based on the Isabelle HOL type system.

The Safe OCL distincts nullable and non-nullable types. Also the theory gives a formal definition of safe navigation operations. The Safe OCL typing rules are much stricter than rules given in the OCL specification. It allows one to catch more errors on a type checking phase.

The type theory presented is four-layered: classes, basic types, generic types, errorable types. We introduce the following new types: non-nullable types (T[1]), nullable types (T[?]), OclSuper. OclSuper is a supertype of all other types (basic types, collections, tuples). This type allows us to define a total supremum function, so types form an upper semilattice. It allows us to define rich expression typing rules in an elegant manner.

The Preliminaries Chapter of the theory defines a number of helper lemmas for transitive closures and tuples. It defines also a generic object model independent from OCL. It allows one to use the theory as a reference for formalization of analogous languages.

[QHLProver] title = Quantum Hoare Logic author = Junyi Liu<>, Bohua Zhan , Shuling Wang<>, Shenggang Ying<>, Tao Liu<>, Yangjia Li<>, Mingsheng Ying<>, Naijun Zhan<> topic = Computer Science/Programming Languages/Logics, Computer Science/Semantics date = 2019-03-24 notify = bzhan@ios.ac.cn abstract = We formalize quantum Hoare logic as given in [1]. In particular, we specify the syntax and denotational semantics of a simple model of quantum programs. Then, we write down the rules of quantum Hoare logic for partial correctness, and show the soundness and completeness of the resulting proof system. As an application, we verify the correctness of Grover’s algorithm. [Transcendence_Series_Hancl_Rucki] title = The Transcendence of Certain Infinite Series author = Angeliki Koutsoukou-Argyraki , Wenda Li topic = Mathematics/Analysis, Mathematics/Number Theory date = 2019-03-27 notify = wl302@cam.ac.uk, ak2110@cam.ac.uk abstract = We formalize the proofs of two transcendence criteria by J. Hančl and P. Rucki that assert the transcendence of the sums of certain infinite series built up by sequences that fulfil certain properties. Both proofs make use of Roth's celebrated theorem on diophantine approximations to algebraic numbers from 1955 which we implement as an assumption without having formalised its proof. [Binding_Syntax_Theory] title = A General Theory of Syntax with Bindings author = Lorenzo Gheri , Andrei Popescu topic = Computer Science/Programming Languages/Lambda Calculi, Computer Science/Functional Programming, Logic date = 2019-04-06 notify = a.popescu@mdx.ac.uk, lor.gheri@gmail.com abstract = We formalize a theory of syntax with bindings that has been developed and refined over the last decade to support several large formalization efforts. Terms are defined for an arbitrary number of constructors of varying numbers of inputs, quotiented to alpha-equivalence and sorted according to a binding signature. The theory includes many properties of the standard operators on terms: substitution, swapping and freshness. It also includes bindings-aware induction and recursion principles and support for semantic interpretation. This work has been presented in the ITP 2017 paper “A Formalized General Theory of Syntax with Bindings”. [LTL_Master_Theorem] title = A Compositional and Unified Translation of LTL into ω-Automata author = Benedikt Seidl , Salomon Sickert topic = Computer Science/Automata and Formal Languages date = 2019-04-16 notify = benedikt.seidl@tum.de, s.sickert@tum.de abstract = We present a formalisation of the unified translation approach of linear temporal logic (LTL) into ω-automata from [1]. This approach decomposes LTL formulas into ``simple'' languages and allows a clear separation of concerns: first, we formalise the purely logical result yielding this decomposition; second, we instantiate this generic theory to obtain a construction for deterministic (state-based) Rabin automata (DRA). We extract from this particular instantiation an executable tool translating LTL to DRAs. To the best of our knowledge this is the first verified translation from LTL to DRAs that is proven to be double exponential in the worst case which asymptotically matches the known lower bound.

[1] Javier Esparza, Jan Kretínský, Salomon Sickert. One Theorem to Rule Them All: A Unified Translation of LTL into ω-Automata. LICS 2018 [LambdaAuth] title = Formalization of Generic Authenticated Data Structures author = Matthias Brun<>, Dmitriy Traytel topic = Computer Science/Security, Computer Science/Programming Languages/Lambda Calculi date = 2019-05-14 notify = traytel@inf.ethz.ch abstract = Authenticated data structures are a technique for outsourcing data storage and maintenance to an untrusted server. The server is required to produce an efficiently checkable and cryptographically secure proof that it carried out precisely the requested computation. Miller et al. introduced λ• (pronounced lambda auth)—a functional programming language with a built-in primitive authentication construct, which supports a wide range of user-specified authenticated data structures while guaranteeing certain correctness and security properties for all well-typed programs. We formalize λ• and prove its correctness and security properties. With Isabelle's help, we uncover and repair several mistakes in the informal proofs and lemma statements. Our findings are summarized in a paper draft. [IMP2_Binary_Heap] title = Binary Heaps for IMP2 author = Simon Griebel<> topic = Computer Science/Data Structures, Computer Science/Algorithms date = 2019-06-13 notify = s.griebel@tum.de abstract = In this submission array-based binary minimum heaps are formalized. The correctness of the following heap operations is proved: insert, get-min, delete-min and make-heap. These are then used to verify an in-place heapsort. The formalization is based on IMP2, an imperative program verification framework implemented in Isabelle/HOL. The verified heap functions are iterative versions of the partly recursive functions found in "Algorithms and Data Structures – The Basic Toolbox" by K. Mehlhorn and P. Sanders and "Introduction to Algorithms" by T. H. Cormen, C. E. Leiserson, R. L. Rivest and C. Stein. [Groebner_Macaulay] title = Gröbner Bases, Macaulay Matrices and Dubé's Degree Bounds author = Alexander Maletzky topic = Mathematics/Algebra date = 2019-06-15 notify = alexander.maletzky@risc.jku.at abstract = This entry formalizes the connection between Gröbner bases and Macaulay matrices (sometimes also referred to as `generalized Sylvester matrices'). In particular, it contains a method for computing Gröbner bases, which proceeds by first constructing some Macaulay matrix of the initial set of polynomials, then row-reducing this matrix, and finally converting the result back into a set of polynomials. The output is shown to be a Gröbner basis if the Macaulay matrix constructed in the first step is sufficiently large. In order to obtain concrete upper bounds on the size of the matrix (and hence turn the method into an effectively executable algorithm), Dubé's degree bounds on Gröbner bases are utilized; consequently, they are also part of the formalization. [Linear_Inequalities] title = Linear Inequalities author = Ralph Bottesch , Alban Reynaud <>, René Thiemann topic = Mathematics/Algebra date = 2019-06-21 notify = rene.thiemann@uibk.ac.at abstract = We formalize results about linear inqualities, mainly from Schrijver's book. The main results are the proof of the fundamental theorem on linear inequalities, Farkas' lemma, Carathéodory's theorem, the Farkas-Minkowsky-Weyl theorem, the decomposition theorem of polyhedra, and Meyer's result that the integer hull of a polyhedron is a polyhedron itself. Several theorems include bounds on the appearing numbers, and in particular we provide an a-priori bound on mixed-integer solutions of linear inequalities. [Linear_Programming] title = Linear Programming author = Julian Parsert , Cezary Kaliszyk topic = Mathematics/Algebra date = 2019-08-06 notify = julian.parsert@gmail.com, cezary.kaliszyk@uibk.ac.at abstract = We use the previous formalization of the general simplex algorithm to formulate an algorithm for solving linear programs. We encode the linear programs using only linear constraints. Solving these constraints also solves the original linear program. This algorithm is proven to be sound by applying the weak duality theorem which is also part of this formalization. [Differential_Game_Logic] title = Differential Game Logic author = André Platzer topic = Computer Science/Programming Languages/Logics date = 2019-06-03 notify = aplatzer@cs.cmu.edu abstract = This formalization provides differential game logic (dGL), a logic for proving properties of hybrid game. In addition to the syntax and semantics, it formalizes a uniform substitution calculus for dGL. Church's uniform substitutions substitute a term or formula for a function or predicate symbol everywhere. The uniform substitutions for dGL also substitute hybrid games for a game symbol everywhere. We prove soundness of one-pass uniform substitutions and the axioms of differential game logic with respect to their denotational semantics. One-pass uniform substitutions are faster by postponing soundness-critical admissibility checks with a linear pass homomorphic application and regain soundness by a variable condition at the replacements. The formalization is based on prior non-mechanized soundness proofs for dGL. [Complete_Non_Orders] title = Complete Non-Orders and Fixed Points author = Akihisa Yamada , Jérémy Dubut topic = Mathematics/Order date = 2019-06-27 notify = akihisayamada@nii.ac.jp, dubut@nii.ac.jp abstract = We develop an Isabelle/HOL library of order-theoretic concepts, such as various completeness conditions and fixed-point theorems. We keep our formalization as general as possible: we reprove several well-known results about complete orders, often without any properties of ordering, thus complete non-orders. In particular, we generalize the Knaster–Tarski theorem so that we ensure the existence of a quasi-fixed point of monotone maps over complete non-orders, and show that the set of quasi-fixed points is complete under a mild condition—attractivity—which is implied by either antisymmetry or transitivity. This result generalizes and strengthens a result by Stauti and Maaden. Finally, we recover Kleene’s fixed-point theorem for omega-complete non-orders, again using attractivity to prove that Kleene’s fixed points are least quasi-fixed points. [Priority_Search_Trees] title = Priority Search Trees author = Peter Lammich , Tobias Nipkow topic = Computer Science/Data Structures date = 2019-06-25 notify = lammich@in.tum.de abstract = We present a new, purely functional, simple and efficient data structure combining a search tree and a priority queue, which we call a priority search tree. The salient feature of priority search trees is that they offer a decrease-key operation, something that is missing from other simple, purely functional priority queue implementations. Priority search trees can be implemented on top of any search tree. This entry does the implementation for red-black trees. This entry formalizes the first part of our ITP-2019 proof pearl Purely Functional, Simple and Efficient Priority Search Trees and Applications to Prim and Dijkstra. [Prim_Dijkstra_Simple] title = Purely Functional, Simple, and Efficient Implementation of Prim and Dijkstra author = Peter Lammich , Tobias Nipkow topic = Computer Science/Algorithms/Graph date = 2019-06-25 notify = lammich@in.tum.de abstract = We verify purely functional, simple and efficient implementations of Prim's and Dijkstra's algorithms. This constitutes the first verification of an executable and even efficient version of Prim's algorithm. This entry formalizes the second part of our ITP-2019 proof pearl Purely Functional, Simple and Efficient Priority Search Trees and Applications to Prim and Dijkstra. [MFOTL_Monitor] title = Formalization of a Monitoring Algorithm for Metric First-Order Temporal Logic author = Joshua Schneider , Dmitriy Traytel topic = Computer Science/Algorithms, Logic, Computer Science/Automata and Formal Languages date = 2019-07-04 notify = joshua.schneider@inf.ethz.ch, traytel@inf.ethz.ch abstract = A monitor is a runtime verification tool that solves the following problem: Given a stream of time-stamped events and a policy formulated in a specification language, decide whether the policy is satisfied at every point in the stream. We verify the correctness of an executable monitor for specifications given as formulas in metric first-order temporal logic (MFOTL), an expressive extension of linear temporal logic with real-time constraints and first-order quantification. The verified monitor implements a simplified variant of the algorithm used in the efficient MonPoly monitoring tool. The formalization is presented in a forthcoming RV 2019 paper, which also compares the output of the verified monitor to that of other monitoring tools on randomly generated inputs. This case study revealed several errors in the optimized but unverified tools. [FOL_Seq_Calc1] title = A Sequent Calculus for First-Order Logic author = Asta Halkjær From contributors = Alexander Birch Jensen , Anders Schlichtkrull , Jørgen Villadsen topic = Logic date = 2019-07-18 notify = ahfrom@dtu.dk abstract = This work formalizes soundness and completeness of a one-sided sequent calculus for first-order logic. The completeness is shown via a translation from a complete semantic tableau calculus, the proof of which is based on the First-Order Logic According to Fitting theory. The calculi and proof techniques are taken from Ben-Ari's Mathematical Logic for Computer Science. [Szpilrajn] title = Szpilrajn Extension Theorem author = Peter Zeller topic = Mathematics/Order date = 2019-07-27 notify = p_zeller@cs.uni-kl.de abstract = We formalize the Szpilrajn extension theorem, also known as order-extension principal: Every strict partial order can be extended to a strict linear order. [TESL_Language] title = A Formal Development of a Polychronous Polytimed Coordination Language author = Hai Nguyen Van , Frédéric Boulanger , Burkhart Wolff topic = Computer Science/System Description Languages, Computer Science/Semantics, Computer Science/Concurrency date = 2019-07-30 notify = frederic.boulanger@centralesupelec.fr, burkhart.wolff@lri.fr abstract = The design of complex systems involves different formalisms for modeling their different parts or aspects. The global model of a system may therefore consist of a coordination of concurrent sub-models that use different paradigms. We develop here a theory for a language used to specify the timed coordination of such heterogeneous subsystems by addressing the following issues:

  • the behavior of the sub-systems is observed only at a series of discrete instants,
  • events may occur in different sub-systems at unrelated times, leading to polychronous systems, which do not necessarily have a common base clock,
  • coordination between subsystems involves causality, so the occurrence of an event may enforce the occurrence of other events, possibly after a certain duration has elapsed or an event has occurred a given number of times,
  • the domain of time (discrete, rational, continuous...) may be different in the subsystems, leading to polytimed systems,
  • the time frames of different sub-systems may be related (for instance, time in a GPS satellite and in a GPS receiver on Earth are related although they are not the same).
Firstly, a denotational semantics of the language is defined. Then, in order to be able to incrementally check the behavior of systems, an operational semantics is given, with proofs of progress, soundness and completeness with regard to the denotational semantics. These proofs are made according to a setup that can scale up when new operators are added to the language. In order for specifications to be composed in a clean way, the language should be invariant by stuttering (i.e., adding observation instants at which nothing happens). The proof of this invariance is also given. [Stellar_Quorums] title = Stellar Quorum Systems author = Giuliano Losa topic = Computer Science/Algorithms/Distributed date = 2019-08-01 notify = giuliano@galois.com abstract = We formalize the static properties of personal Byzantine quorum systems (PBQSs) and Stellar quorum systems, as described in the paper ``Stellar Consensus by Reduction'' (to appear at DISC 2019). [IMO2019] title = Selected Problems from the International Mathematical Olympiad 2019 author = Manuel Eberl topic = Mathematics/Misc date = 2019-08-05 notify = eberlm@in.tum.de abstract =

This entry contains formalisations of the answers to three of the six problem of the International Mathematical Olympiad 2019, namely Q1, Q4, and Q5.

The reason why these problems were chosen is that they are particularly amenable to formalisation: they can be solved with minimal use of libraries. The remaining three concern geometry and graph theory, which, in the author's opinion, are more difficult to formalise resp. require a more complex library.

[Adaptive_State_Counting] title = Formalisation of an Adaptive State Counting Algorithm author = Robert Sachtleben topic = Computer Science/Automata and Formal Languages, Computer Science/Algorithms date = 2019-08-16 notify = rob_sac@uni-bremen.de abstract = This entry provides a formalisation of a refinement of an adaptive state counting algorithm, used to test for reduction between finite state machines. The algorithm has been originally presented by Hierons in the paper Testing from a Non-Deterministic Finite State Machine Using Adaptive State Counting. Definitions for finite state machines and adaptive test cases are given and many useful theorems are derived from these. The algorithm is formalised using mutually recursive functions, for which it is proven that the generated test suite is sufficient to test for reduction against finite state machines of a certain fault domain. Additionally, the algorithm is specified in a simple WHILE-language and its correctness is shown using Hoare-logic. [Jacobson_Basic_Algebra] title = A Case Study in Basic Algebra author = Clemens Ballarin topic = Mathematics/Algebra date = 2019-08-30 notify = ballarin@in.tum.de abstract = The focus of this case study is re-use in abstract algebra. It contains locale-based formalisations of selected parts of set, group and ring theory from Jacobson's Basic Algebra leading to the respective fundamental homomorphism theorems. The study is not intended as a library base for abstract algebra. It rather explores an approach towards abstract algebra in Isabelle. [Hybrid_Systems_VCs] title = Verification Components for Hybrid Systems author = Jonathan Julian Huerta y Munive <> topic = Mathematics/Algebra, Mathematics/Analysis date = 2019-09-10 notify = jjhuertaymunive1@sheffield.ac.uk, jonjulian23@gmail.com abstract = These components formalise a semantic framework for the deductive verification of hybrid systems. They support reasoning about continuous evolutions of hybrid programs in the style of differential dynamics logic. Vector fields or flows model these evolutions, and their verification is done with invariants for the former or orbits for the latter. Laws of modal Kleene algebra or categorical predicate transformers implement the verification condition generation. Examples show the approach at work. [Generic_Join] title = Formalization of Multiway-Join Algorithms author = Thibault Dardinier<> topic = Computer Science/Algorithms date = 2019-09-16 notify = tdardini@student.ethz.ch, traytel@inf.ethz.ch abstract = Worst-case optimal multiway-join algorithms are recent seminal achievement of the database community. These algorithms compute the natural join of multiple relational databases and improve in the worst case over traditional query plan optimizations of nested binary joins. In 2014, Ngo, Ré, and Rudra gave a unified presentation of different multi-way join algorithms. We formalized and proved correct their "Generic Join" algorithm and extended it to support negative joins. [Aristotles_Assertoric_Syllogistic] title = Aristotle's Assertoric Syllogistic author = Angeliki Koutsoukou-Argyraki topic = Logic/Philosophy date = 2019-10-08 notify = ak2110@cam.ac.uk abstract = We formalise with Isabelle/HOL some basic elements of Aristotle's assertoric syllogistic following the article from the Stanford Encyclopedia of Philosophy by Robin Smith. To this end, we use a set theoretic formulation (covering both individual and general predication). In particular, we formalise the deductions in the Figures and after that we present Aristotle's metatheoretical observation that all deductions in the Figures can in fact be reduced to either Barbara or Celarent. As the formal proofs prove to be straightforward, the interest of this entry lies in illustrating the functionality of Isabelle and high efficiency of Sledgehammer for simple exercises in philosophy. [VerifyThis2019] title = VerifyThis 2019 -- Polished Isabelle Solutions author = Peter Lammich<>, Simon Wimmer topic = Computer Science/Algorithms date = 2019-10-16 notify = lammich@in.tum.de, wimmers@in.tum.de abstract = VerifyThis 2019 (http://www.pm.inf.ethz.ch/research/verifythis.html) was a program verification competition associated with ETAPS 2019. It was the 8th event in the VerifyThis competition series. In this entry, we present polished and completed versions of our solutions that we created during the competition. [ZFC_in_HOL] title = Zermelo Fraenkel Set Theory in Higher-Order Logic author = Lawrence C. Paulson topic = Mathematics/Set Theory date = 2019-10-24 notify = lp15@cam.ac.uk abstract =

This entry is a new formalisation of ZFC set theory in Isabelle/HOL. It is logically equivalent to Obua's HOLZF; the point is to have the closest possible integration with the rest of Isabelle/HOL, minimising the amount of new notations and exploiting type classes.

There is a type V of sets and a function elts :: V => V set mapping a set to its elements. Classes simply have type V set, and a predicate identifies the small classes: those that correspond to actual sets. Type classes connected with orders and lattices are used to minimise the amount of new notation for concepts such as the subset relation, union and intersection. Basic concepts — Cartesian products, disjoint sums, natural numbers, functions, etc. — are formalised.

More advanced set-theoretic concepts, such as transfinite induction, ordinals, cardinals and the transitive closure of a set, are also provided. The definition of addition and multiplication for general sets (not just ordinals) follows Kirby.

The theory provides two type classes with the aim of facilitating developments that combine V with other Isabelle/HOL types: embeddable, the class of types that can be injected into V (including V itself as well as V*V, etc.), and small, the class of types that correspond to some ZF set.

extra-history = Change history: [2020-01-28]: Generalisation of the "small" predicate and order types to arbitrary sets; ordinal exponentiation; introduction of the coercion ord_of_nat :: "nat => V"; numerous new lemmas. (revision 6081d5be8d08) [Interval_Arithmetic_Word32] title = Interval Arithmetic on 32-bit Words author = Brandon Bohrer topic = Computer Science/Data Structures date = 2019-11-27 notify = bjbohrer@gmail.com, bbohrer@cs.cmu.edu abstract = Interval_Arithmetic implements conservative interval arithmetic computations, then uses this interval arithmetic to implement a simple programming language where all terms have 32-bit signed word values, with explicit infinities for terms outside the representable bounds. Our target use case is interpreters for languages that must have a well-understood low-level behavior. We include a formalization of bounded-length strings which are used for the identifiers of our language. Bounded-length identifiers are useful in some applications, for example the Differential_Dynamic_Logic article, where a Euclidean space indexed by identifiers demands that identifiers are finitely many. [Generalized_Counting_Sort] title = An Efficient Generalization of Counting Sort for Large, possibly Infinite Key Ranges author = Pasquale Noce topic = Computer Science/Algorithms, Computer Science/Functional Programming date = 2019-12-04 notify = pasquale.noce.lavoro@gmail.com abstract = Counting sort is a well-known algorithm that sorts objects of any kind mapped to integer keys, or else to keys in one-to-one correspondence with some subset of the integers (e.g. alphabet letters). However, it is suitable for direct use, viz. not just as a subroutine of another sorting algorithm (e.g. radix sort), only if the key range is not significantly larger than the number of the objects to be sorted. This paper describes a tail-recursive generalization of counting sort making use of a bounded number of counters, suitable for direct use in case of a large, or even infinite key range of any kind, subject to the only constraint of being a subset of an arbitrary linear order. After performing a pen-and-paper analysis of how such algorithm has to be designed to maximize its efficiency, this paper formalizes the resulting generalized counting sort (GCsort) algorithm and then formally proves its correctness properties, namely that (a) the counters' number is maximized never exceeding the fixed upper bound, (b) objects are conserved, (c) objects get sorted, and (d) the algorithm is stable. [Poincare_Bendixson] title = The Poincaré-Bendixson Theorem author = Fabian Immler , Yong Kiam Tan topic = Mathematics/Analysis date = 2019-12-18 notify = fimmler@cs.cmu.edu, yongkiat@cs.cmu.edu abstract = The Poincaré-Bendixson theorem is a classical result in the study of (continuous) dynamical systems. Colloquially, it restricts the possible behaviors of planar dynamical systems: such systems cannot be chaotic. In practice, it is a useful tool for proving the existence of (limiting) periodic behavior in planar systems. The theorem is an interesting and challenging benchmark for formalized mathematics because proofs in the literature rely on geometric sketches and only hint at symmetric cases. It also requires a substantial background of mathematical theories, e.g., the Jordan curve theorem, real analysis, ordinary differential equations, and limiting (long-term) behavior of dynamical systems. [Isabelle_C] title = Isabelle/C author = Frédéric Tuong , Burkhart Wolff topic = Computer Science/Programming Languages/Language Definitions, Computer Science/Semantics, Tools date = 2019-10-22 notify = tuong@users.gforge.inria.fr, wolff@lri.fr abstract = We present a framework for C code in C11 syntax deeply integrated into the Isabelle/PIDE development environment. Our framework provides an abstract interface for verification back-ends to be plugged-in independently. Thus, various techniques such as deductive program verification or white-box testing can be applied to the same source, which is part of an integrated PIDE document model. Semantic back-ends are free to choose the supported C fragment and its semantics. In particular, they can differ on the chosen memory model or the specification mechanism for framing conditions. Our framework supports semantic annotations of C sources in the form of comments. Annotations serve to locally control back-end settings, and can express the term focus to which an annotation refers. Both the logical and the syntactic context are available when semantic annotations are evaluated. As a consequence, a formula in an annotation can refer both to HOL or C variables. Our approach demonstrates the degree of maturity and expressive power the Isabelle/PIDE sub-system has achieved in recent years. Our integration technique employs Lex and Yacc style grammars to ensure efficient deterministic parsing. This is the core-module of Isabelle/C; the AFP package for Clean and Clean_wrapper as well as AutoCorres and AutoCorres_wrapper (available via git) are applications of this front-end. [Zeta_3_Irrational] title = The Irrationality of ζ(3) author = Manuel Eberl topic = Mathematics/Number Theory date = 2019-12-27 notify = manuel.eberl@tum.de abstract =

This article provides a formalisation of Beukers's straightforward analytic proof that ζ(3) is irrational. This was first proven by Apéry (which is why this result is also often called ‘Apéry's Theorem’) using a more algebraic approach. This formalisation follows Filaseta's presentation of Beukers's proof.

[Hybrid_Logic] title = Formalizing a Seligman-Style Tableau System for Hybrid Logic author = Asta Halkjær From topic = Logic date = 2019-12-20 notify = ahfrom@dtu.dk abstract = This work is a formalization of soundness and completeness proofs for a Seligman-style tableau system for hybrid logic. The completeness result is obtained via a synthetic approach using maximally consistent sets of tableau blocks. The formalization differs from the cited work in a few ways. First, to avoid the need to backtrack in the construction of a tableau, the formalized system has no unnamed initial segment, and therefore no Name rule. Second, I show that the full Bridge rule is admissible in the system. Third, I start from rules restricted to only extend the branch with new formulas, including only witnessing diamonds that are not already witnessed, and show that the unrestricted rules are admissible. Similarly, I start from simpler versions of the @-rules and show the general ones admissible. Finally, the GoTo rule is restricted using a notion of coins such that each application consumes a coin and coins are earned through applications of the remaining rules. I show that if a branch can be closed then it can be closed starting from a single coin. These restrictions are imposed to rule out some means of nontermination. [Bicategory] title = Bicategories author = Eugene W. Stark topic = Mathematics/Category Theory date = 2020-01-06 notify = stark@cs.stonybrook.edu abstract = Taking as a starting point the author's previous work on developing aspects of category theory in Isabelle/HOL, this article gives a compatible formalization of the notion of "bicategory" and develops a framework within which formal proofs of facts about bicategories can be given. The framework includes a number of basic results, including the Coherence Theorem, the Strictness Theorem, pseudofunctors and biequivalence, and facts about internal equivalences and adjunctions in a bicategory. As a driving application and demonstration of the utility of the framework, it is used to give a formal proof of a theorem, due to Carboni, Kasangian, and Street, that characterizes up to biequivalence the bicategories of spans in a category with pullbacks. The formalization effort necessitated the filling-in of many details that were not evident from the brief presentation in the original paper, as well as identifying a few minor corrections along the way. extra-history = Change history: [2020-02-15]: Move ConcreteCategory.thy from Bicategory to Category3 and use it systematically. Make other minor improvements throughout. (revision a51840d36867)
[Subset_Boolean_Algebras] title = A Hierarchy of Algebras for Boolean Subsets author = Walter Guttmann , Bernhard Möller topic = Mathematics/Algebra date = 2020-01-31 notify = walter.guttmann@canterbury.ac.nz -abstract = +abstract = We present a collection of axiom systems for the construction of Boolean subalgebras of larger overall algebras. The subalgebras are defined as the range of a complement-like operation on a semilattice. This technique has been used, for example, with the antidomain operation, dynamic negation and Stone algebras. We present a common ground for these constructions based on a new equational axiomatisation of Boolean algebras. +[Goodstein_Lambda] +title = Implementing the Goodstein Function in λ-Calculus +author = Bertram Felgenhauer +topic = Logic/Rewriting +date = 2020-02-21 +notify = int-e@gmx.de +abstract = + In this formalization, we develop an implementation of the Goodstein + function G in plain λ-calculus, linked to a concise, self-contained + specification. The implementation works on a Church-encoded + representation of countable ordinals. The initial conversion to + hereditary base 2 is not covered, but the material is sufficient to + compute the particular value G(16), and easily extends to other fixed + arguments. + +[VeriComp] +title = A Generic Framework for Verified Compilers +author = Martin Desharnais +topic = Computer Science/Programming Languages/Compiling +date = 2020-02-10 +notify = martin.desharnais@unibw.de +abstract = + This is a generic framework for formalizing compiler transformations. + It leverages Isabelle/HOL’s locales to abstract over concrete + languages and transformations. It states common definitions for + language semantics, program behaviours, forward and backward + simulations, and compilers. We provide generic operations, such as + simulation and compiler composition, and prove general (partial) + correctness theorems, resulting in reusable proof components. + +[Hello_World] +title = Hello World +author = Cornelius Diekmann , Lars Hupel +topic = Computer Science/Functional Programming +date = 2020-03-07 +notify = diekmann@net.in.tum.de +abstract = + In this article, we present a formalization of the well-known + "Hello, World!" code, including a formal framework for + reasoning about IO. Our model is inspired by the handling of IO in + Haskell. We start by formalizing the 🌍 and embrace the IO monad + afterwards. Then we present a sample main :: IO (), followed by its + proof of correctness. + +[WOOT_Strong_Eventual_Consistency] +title = Strong Eventual Consistency of the Collaborative Editing Framework WOOT +author = Emin Karayel , Edgar Gonzàlez +topic = Computer Science/Algorithms/Distributed +date = 2020-03-25 +notify = eminkarayel@google.com, edgargip@google.com, me@eminkarayel.de +abstract = + Commutative Replicated Data Types (CRDTs) are a promising new class of + data structures for large-scale shared mutable content in applications + that only require eventual consistency. The WithOut Operational + Transforms (WOOT) framework is a CRDT for collaborative text editing + introduced by Oster et al. (CSCW 2006) for which the eventual + consistency property was verified only for a bounded model to date. We + contribute a formal proof for WOOTs strong eventual consistency. + +[Furstenberg_Topology] +title = Furstenberg's topology and his proof of the infinitude of primes +author = Manuel Eberl +topic = Mathematics/Number Theory +date = 2020-03-22 +notify = manuel.eberl@tum.de +abstract = +

This article gives a formal version of Furstenberg's + topological proof of the infinitude of primes. He defines a topology + on the integers based on arithmetic progressions (or, equivalently, + residue classes). Using some fairly obvious properties of this + topology, the infinitude of primes is then easily obtained.

+

Apart from this, this topology is also fairly `nice' in + general: it is second countable, metrizable, and perfect. All of these + (well-known) facts are formally proven, including an explicit metric + for the topology given by Zulfeqarr.

+ + + diff --git a/thys/Furstenberg_Topology/Furstenberg_Topology.thy b/thys/Furstenberg_Topology/Furstenberg_Topology.thy new file mode 100644 --- /dev/null +++ b/thys/Furstenberg_Topology/Furstenberg_Topology.thy @@ -0,0 +1,880 @@ +(* + File: Furstenberg_Topology.thy + Author: Manuel Eberl, TU München +*) +section \Furstenberg's topology and his proof of the infinitude of primes\ +theory Furstenberg_Topology + imports + "HOL-Real_Asymp.Real_Asymp" + "HOL-Analysis.Analysis" + "HOL-Number_Theory.Number_Theory" +begin + +text \ + This article gives a formal version of Furstenberg's topological proof of the infinitude of + primes~\cite{furstenberg}. He defines a topology on the integers based on arithmetic progressions + (or, equivalently, residue classes). + + Apart from yielding a short proof of the infinitude of primes, this topology is also fairly + `nice' in general: it is second countable, metrizable, and perfect. All of these (well-known) + facts will be formally proven below. +\ + +subsection \Arithmetic progressions of integers\ + +text \ + We first define `bidirectional infinite arithmetic progressions' on \\\ in the sense that + to an integer \a\ and a positive integer \b\, we associate all the integers \x\ such that + $x \equiv a\ (\text{mod}\ b)$, or, equivalently, $\{a + nb\mid n\in\mathbb{Z}\}$. +\ + +definition arith_prog :: "int \ nat \ int set" where + "arith_prog a b = {x. [x = a] (mod int b)}" + +lemma arith_prog_0_right [simp]: "arith_prog a 0 = {a}" + by (simp add: arith_prog_def) + +lemma arith_prog_Suc_0_right [simp]: "arith_prog a (Suc 0) = UNIV" + by (auto simp: arith_prog_def) + +lemma in_arith_progI [intro]: "[x = a] (mod b) \ x \ arith_prog a b" + by (auto simp: arith_prog_def) + +text \ + Two arithmetic progressions with the same period and noncongruent starting points are + disjoint. +\ +lemma arith_prog_disjoint: + assumes "[a \ a'] (mod int b)" and "b > 0" + shows "arith_prog a b \ arith_prog a' b = {}" + using assms by (auto simp: arith_prog_def cong_def) + +text \ + Multiplying the period gives us a subset of the original progression. +\ +lemma arith_prog_dvd_mono: "b dvd b' \ arith_prog a b' \ arith_prog a b" + by (auto simp: arith_prog_def cong_dvd_modulus) + +text \ + The following proves the alternative definition mentioned above. +\ +lemma bij_betw_arith_prog: + assumes "b > 0" + shows "bij_betw (\n. a + int b * n) UNIV (arith_prog a b)" +proof (rule bij_betwI[of _ _ _ "\x. (x - a) div int b"], goal_cases) + case 1 + thus ?case + by (auto simp: arith_prog_def cong_add_lcancel_0 cong_mult_self_right mult_of_nat_commute) +next + case 4 + thus ?case + by (auto simp: arith_prog_def cong_iff_lin) +qed (use \b > 0\ in \auto simp: arith_prog_def\) + +lemma arith_prog_altdef: "arith_prog a b = range (\n. a + int b * n)" +proof (cases "b = 0") + case False + thus ?thesis + using bij_betw_arith_prog[of b] by (auto simp: bij_betw_def) +qed auto + +text \ + A simple corollary from this is also that any such arithmetic progression is infinite. +\ +lemma infinite_arith_prog: "b > 0 \ infinite (arith_prog a b)" + using bij_betw_finite[OF bij_betw_arith_prog[of b]] by simp + + +subsection \The Furstenberg topology on \\\\ + +text \ + The typeclass-based topology is somewhat nicer to use in Isabelle/HOL, but the integers, + of course, already have a topology associated to them. We therefore need to introduce a type + copy of the integers and furnish them with the new topology. We can easily convert between + them and the `proper' integers using Lifting and Transfer. +\ +typedef fbint = "UNIV :: int set" + morphisms int_of_fbint fbint .. + +setup_lifting type_definition_fbint + +lift_definition arith_prog_fb :: "int \ nat \ fbint set" is "arith_prog" . + +instantiation fbint :: topological_space +begin + +text \ + Furstenberg defined the topology as the one generated by all arithmetic progressions. + We use a slightly more explicit equivalent formulation that exploits the fact that + the intersection of two arithmetic progressions is again an arithmetic progression (or empty). +\ +lift_definition open_fbint :: "fbint set \ bool" is + "\U. (\x\U. \b>0. arith_prog x b \ U)" . + +text \ + We now prove that this indeed forms a topology. +\ +instance proof + show "open (UNIV :: fbint set)" + by transfer auto +next + fix U V :: "fbint set" + assume "open U" and "open V" + show "open (U \ V)" + proof (use \open U\ \open V\ in transfer, safe) + fix U V :: "int set" and x :: int + assume U: "\x\U. \b>0. arith_prog x b \ U" and V: "\x\V. \b>0. arith_prog x b \ V" + assume x: "x \ U" "x \ V" + from U x obtain b1 where b1: "b1 > 0" "arith_prog x b1 \ U" by auto + from V x obtain b2 where b2: "b2 > 0" "arith_prog x b2 \ V" by auto + from b1 b2 have "lcm b1 b2 > 0" "arith_prog x (lcm b1 b2) \ U \ V" + using arith_prog_dvd_mono[of b1 "lcm b1 b2" x] arith_prog_dvd_mono[of b2 "lcm b1 b2" x] + by (auto simp: lcm_pos_nat) + thus "\b>0. arith_prog x b \ U \ V" by blast + qed +next + fix F :: "fbint set set" + assume *: "\U\F. open U" + show "open (\F)" + proof (use * in transfer, safe) + fix F :: "int set set" and U :: "int set" and x :: int + assume F: "\U\F. \x\U. \b>0. arith_prog x b \ U" + assume "x \ U" "U \ F" + with F obtain b where b: "b > 0" "arith_prog x b \ U" by blast + with \U \ F\ show "\b>0. arith_prog x b \ \F" + by blast + qed +qed + +end + +text \ + Since any non-empty open set contains an arithmetic progression and arithmetic progressions + are infinite, we obtain that all nonempty open sets are infinite. +\ +lemma open_fbint_imp_infinite: + fixes U :: "fbint set" + assumes "open U" and "U \ {}" + shows "infinite U" + using assms +proof transfer + fix U :: "int set" + assume *: "\x\U. \b>0. arith_prog x b \ U" and "U \ {}" + from \U \ {}\ obtain x where "x \ U" by auto + with * obtain b where b: "b > 0" "arith_prog x b \ U" by auto + from b have "infinite (arith_prog x b)" + using infinite_arith_prog by blast + with b show "infinite U" + using finite_subset by blast +qed + +lemma not_open_finite_fbint [simp]: + assumes "finite (U :: fbint set)" "U \ {}" + shows "\open U" + using open_fbint_imp_infinite assms by blast + +text \ + More or less by definition, any arithmetic progression is open. +\ +lemma open_arith_prog_fb [intro]: + assumes "b > 0" + shows "open (arith_prog_fb a b)" + using assms +proof transfer + fix a :: int and b :: nat + assume "b > 0" + show "\x\arith_prog a b. \b'>0. arith_prog x b' \ arith_prog a b" + proof (intro ballI exI[of _ b] conjI) + fix x assume "x \ arith_prog a b" + thus "arith_prog x b \ arith_prog a b" + using cong_trans by (auto simp: arith_prog_def ) + qed (use \b > 0\ in auto) +qed + +text \ + Slightly less obviously, any arithmetic progression is also closed. + This can be seen by realising that for a period \b\, we can partition the integers + into \b\ congruence classes and then the complement of each congruence class is the + union of the other \b - 1\ classes, and unions of open sets are open. +\ +lemma closed_arith_prog_fb [intro]: + assumes "b > 0" + shows "closed (arith_prog_fb a b)" +proof - + have "open (-arith_prog_fb a b)" + proof - + have "-arith_prog_fb a b = (\i\{1.. arith_prog a b" if "x \ arith_prog (a + int i) b" "i \ {1.. a + int i] (mod int b)" + proof + assume "[a = a + int i] (mod int b)" + hence "[a + 0 = a + int i] (mod int b)" by simp + hence "[0 = int i] (mod int b)" by (subst (asm) cong_add_lcancel) auto + with that show False by (auto simp: cong_def) + qed + thus ?thesis using arith_prog_disjoint[of a "a + int i" b] \b > 0\ that by auto + qed + + have covering: "x \ arith_prog a b \ x \ (\i\{1..b > 0\ by simp + also have "[a + (x - a) mod int b = a + (x - a)] (mod int b)" + by (intro cong_add) auto + finally have "[x = a + int i] (mod int b)" + by (simp add: cong_sym_eq) + hence "x \ arith_prog (a + int i) b" + using \b > 0\ by (auto simp: arith_prog_def) + moreover have "i < b" using \b > 0\ + by (auto simp: i_def nat_less_iff) + ultimately show ?thesis using \b > 0\ + by (cases "i = 0") auto + qed + + from disjoint and covering show "- arith_prog a b = (\i\{1..b > 0\ have "open \" + by auto + finally show ?thesis . + qed + thus ?thesis by (simp add: closed_def) +qed + +subsection \The infinitude of primes\ + +text \ + The infinite of the primes now follows quite obviously: The multiples of any prime form a + closed set, so if there were only finitely many primes, the union of all of these would also + be open. However, since any number other than \\1\ has a prime divisor, the union of all these + sets is simply \\\{\1}\, which is obviously \<^emph>\not\ closed since the finite set \{\1}\ is not + open. +\ +theorem "infinite {p::nat. prime p}" +proof + assume fin: "finite {p::nat. prime p}" + define A where "A = (\p\{p::nat. prime p}. arith_prog_fb 0 p)" + have "closed A" + unfolding A_def using fin by (intro closed_Union) (auto simp: prime_gt_0_nat) + hence "open (-A)" + by (simp add: closed_def) + also have "A = -{fbint 1, fbint (-1)}" + unfolding A_def + proof transfer + show "(\p\{p::nat. prime p}. arith_prog 0 p) = - {1, - 1}" + proof (intro equalityI subsetI) + fix x :: int assume x: "x \ -{1, -1}" + hence "\x\ \ 1" by auto + show "x \ (\p\{p::nat. prime p}. arith_prog 0 p)" + proof (cases "x = 0") + case True + thus ?thesis + by (auto simp: A_def intro!: exI[of _ 2]) + next + case [simp]: False + obtain p where p: "prime p" "p dvd x" + using prime_divisor_exists[of x] and \\x\ \ 1\ by auto + hence "x \ arith_prog 0 (nat p)" using prime_gt_0_int[of p] + by (auto simp: arith_prog_def cong_0_iff) + thus ?thesis using p + by (auto simp: A_def intro!: exI[of _ "nat p"]) + qed + qed (auto simp: A_def arith_prog_def cong_0_iff) + qed + also have "-(-{fbint 1, fbint (-1)}) = {fbint 1, fbint (-1)}" + by simp + finally have "open {fbint 1, fbint (-1)}" . + thus False by simp +qed + + + + +subsection \Additional topological properties\ + +text \ + Just for fun, let us also show a few more properties of Furstenberg's topology. + First, we show the equivalence to the above to Furstenberg's original definition + (the topology generated by all arithmetic progressions). +\ + +theorem topological_basis_fbint: "topological_basis {arith_prog_fb a b |a b. b > 0}" + unfolding topological_basis_def +proof safe + fix a :: int and b :: nat + assume "b > 0" + thus "open (arith_prog_fb a b)" + by auto +next + fix U :: "fbint set" assume "open U" + hence "\x\U. \b. b > 0 \ arith_prog_fb (int_of_fbint x) b \ U" + by transfer + hence "\f. \x\U. f x > 0 \ arith_prog_fb (int_of_fbint x) (f x) \ U" + by (subst (asm) bchoice_iff) + then obtain f where f: "\x\U. f x > 0 \ arith_prog_fb (int_of_fbint x) (f x) \ U" .. + define B where "B = (\x. arith_prog_fb (int_of_fbint x) (f x)) ` U" + have "B \ {arith_prog_fb a b |a b. b > 0}" + using f by (auto simp: B_def) + moreover have "\B = U" + proof safe + fix x assume "x \ U" + hence "x \ arith_prog_fb (int_of_fbint x) (f x)" + using f by transfer auto + with \x \ U\ show "x \ \B" by (auto simp: B_def) + qed (use f in \auto simp: B_def\) + ultimately show "\B'\{arith_prog_fb a b |a b. 0 < b}. \ B' = U" by auto +qed + +lemma open_fbint_altdef: "open = generate_topology {arith_prog_fb a b |a b. b > 0}" + using topological_basis_imp_subbasis[OF topological_basis_fbint] . + + +text \ + From this, we can immediately see that it is second countable: +\ +instance fbint :: second_countable_topology +proof + have "countable ((\(a,b). arith_prog_fb a b) ` (UNIV \ {b. b > 0}))" + by (intro countable_image) auto + also have "\ = {arith_prog_fb a b |a b. b > 0}" + by auto + ultimately show "\B::fbint set set. countable B \ open = generate_topology B" + unfolding open_fbint_altdef by auto +qed + +text \ + A trivial consequence of the fact that nonempty open sets in this topology are infinite + is that it is a perfect space: +\ +instance fbint :: perfect_space + by standard auto + + +text \ + It is also Hausdorff, since given any two distinct integers, we can easily + construct two non-overlapping arithmetic progressions that each contain one of them. + We do not \<^emph>\really\ have to prove this since we will get it for free later on when we + show that it is a metric space, but here is the proof anyway: +\ +instance fbint :: t2_space +proof + fix x y :: fbint + assume "x \ y" + define d where "d = nat \int_of_fbint x - int_of_fbint y\ + 1" + from \x \ y\ have "d > 0" + unfolding d_def by transfer auto + define U where "U = arith_prog_fb (int_of_fbint x) d" + define V where "V = arith_prog_fb (int_of_fbint y) d" + + have "U \ V = {}" unfolding U_def V_def d_def + proof (use \x \ y\ in transfer, rule arith_prog_disjoint) + fix x y :: int + assume "x \ y" + show "[x \ y] (mod int (nat \x - y\ + 1))" + proof + assume "[x = y] (mod int (nat \x - y\ + 1))" + hence "\x - y\ + 1 dvd \x - y\" + by (auto simp: cong_iff_dvd_diff algebra_simps) + hence "\x - y\ + 1 \ \x - y\" + by (rule zdvd_imp_le) (use \x \ y\ in auto) + thus False by simp + qed + qed auto + moreover have "x \ U" "y \ V" + unfolding U_def V_def by (use \d > 0\ in transfer, fastforce)+ + moreover have "open U" "open V" + using \d > 0\ by (auto simp: U_def V_def) + ultimately show "\U V. open U \ open V \ x \ U \ y \ V \ U \ V = {}" by blast +qed + +(* TODO Move? *) +text \ + Next, we need a small lemma: Given an additional assumption, a $T_2$ space is also $T_3$: +\ +lemma t2_space_t3_spaceI: + assumes "\(x :: 'a :: t2_space) U. x \ U \ open U \ + \V. x \ V \ open V \ closure V \ U" + shows "OFCLASS('a, t3_space_class)" +proof + fix X :: "'a set" and z :: 'a + assume X: "closed X" "z \ X" + with assms[of z "-X"] obtain V where V: "z \ V" "open V" "closure V \ -X" + by auto + show "\U V. open U \ open V \ z \ U \ X \ V \ U \ V = {}" + by (rule exI[of _ V], rule exI[of _ "-closure V"]) + (use X V closure_subset[of V] in auto) +qed + +text \ + Since the Fürstenberg topology is $T_2$ and every arithmetic progression is also closed, + we can now easily show that it is also $T_3$ (i.\,e.\ regular). + Again, we do not really need this proof, but here it is: +\ +instance fbint :: t3_space +proof (rule t2_space_t3_spaceI) + fix x :: fbint and U :: "fbint set" + assume "x \ U" and "open U" + then obtain b where b: "b > 0" "arith_prog_fb (int_of_fbint x) b \ U" + by transfer blast + define V where "V = arith_prog_fb (int_of_fbint x) b" + have "x \ V" + unfolding V_def by transfer auto + moreover have "open V" "closed V" + using \b > 0\ by (auto simp: V_def) + ultimately show "\V. x \ V \ open V \ closure V \ U" + using b by (intro exI[of _ V]) (auto simp: V_def) +qed + + +subsection \Metrizability\ + +text \ + The metrizability of Furstenberg's topology (i.\,e.\ that it is induced by some metric) can + be shown from the fact that it is second countable and $T_3$ using Urysohn's Metrization Theorem, + but this is not available in Isabelle yet. Let us therefore give an \<^emph>\explicit\ metric, + as described by Zulfeqarr~\cite{zulfeqarr}. We follow the exposition by Dirmeier~\cite{dirmeier}. + + First, we define a kind of norm on the integers. The norm depends on a real parameter \q > 1\. + The value of \q\ does not matter in the sense that all values induce the same topology + (which we will show). For the final definition, we then simply pick \q = 2\. +\ + +locale fbnorm = + fixes q :: "real" + assumes q_gt_1: "q > 1" +begin + +definition N :: "int \ real" where + "N n = (\k. if k = 0 \ int k dvd n then 0 else 1 / q ^ k)" + +lemma N_summable: "summable (\k. if k = 0 \ int k dvd n then 0 else 1 / q ^ k)" + by (rule summable_comparison_test[OF _ summable_geometric[of "1/q"]]) + (use q_gt_1 in \auto intro!: exI[of _ 0] simp: power_divide\) + +lemma N_sums: "(\k. if k = 0 \ int k dvd n then 0 else 1 / q ^ k) sums N n" + using N_summable unfolding N_def by (rule summable_sums) + +lemma N_nonneg: "N n \ 0" + by (rule sums_le[OF _ sums_zero N_sums]) (use q_gt_1 in auto) + +lemma N_uminus [simp]: "N (-n) = N n" + by (simp add: N_def) + +lemma N_minus_commute: "N (x - y) = N (y - x)" + using N_uminus[of "x - y"] by (simp del: N_uminus) + +lemma N_zero [simp]: "N 0 = 0" + by (simp add: N_def) + +lemma not_dvd_imp_N_ge: + assumes "\n dvd a" "n > 0" + shows "N a \ 1 / q ^ n" + by (rule sums_le[OF _ sums_single[of n] N_sums]) (use q_gt_1 assms in auto) + +lemma N_lt_imp_dvd: + assumes "N a < 1 / q ^ n" and "n > 0" + shows "n dvd a" + using not_dvd_imp_N_ge[of n a] assms by auto + +lemma N_pos: + assumes "n \ 0" + shows "N n > 0" +proof - + have "0 < 1 / q ^ (nat \n\+1)" + using q_gt_1 by simp + also have "\1 + \n\ dvd \n\" + using zdvd_imp_le[of "1 + \n\" "\n\"] assms by auto + hence "1 / q ^ (nat \n\+1) \ N n" + by (intro not_dvd_imp_N_ge) (use assms in auto) + finally show ?thesis . +qed + +lemma N_zero_iff [simp]: "N n = 0 \ n = 0" + using N_pos[of n] by (cases "n = 0") auto + +lemma N_triangle_ineq: "N (n + m) \ N n + N m" +proof (rule sums_le) + let ?I = "\n k. if k = 0 \ int k dvd n then 0 else 1 / q ^ k" + show "?I (n + m) sums N (n + m)" + by (rule N_sums) + show "(\k. ?I n k + ?I m k) sums (N n + N m)" + by (intro sums_add N_sums) + show "\k. ?I (n + m) k \ ?I n k + ?I m k" + using q_gt_1 by auto +qed + +lemma N_1: "N 1 = 1 / (q * (q - 1))" +proof (rule sums_unique2) + have "(\k. if k = 0 \ int k dvd 1 then 0 else 1 / q ^ k) sums N 1" + by (rule N_sums) + also have "(\k. if k = 0 \ int k dvd 1 then 0 else 1 / q ^ k) = + (\k. if k \ {0, 1} then 0 else (1 / q) ^ k)" + by (simp add: power_divide cong: if_cong) + finally show "(\k. if k \ {0, 1} then 0 else (1 / q) ^ k) sums N 1" . + + have "(\k. if k \ {0, 1} then 0 else (1 / q) ^ k) sums + (1 / (1 - 1 / q) + (- (1 / q) - 1))" + by (rule sums_If_finite_set'[OF geometric_sums]) (use q_gt_1 in auto) + also have "\ = 1 / (q * (q - 1))" + using q_gt_1 by (simp add: field_simps) + finally show "(\k. if k \ {0, 1} then 0 else (1 / q) ^ k) sums \" . +qed + +text \ + It follows directly from the definition that norms fulfil a kind of monotonicity property + with respect to divisibility: the norm of a number is at most as large as the norm of any of + its factors: +\ +lemma N_dvd_mono: + assumes "m dvd n" + shows "N n \ N m" +proof (rule sums_le[OF allI N_sums N_sums]) + fix k :: nat + show "(if k = 0 \ int k dvd n then 0 else 1 / q ^ k) \ + (if k = 0 \ int k dvd m then 0 else 1 / q ^ k)" + using q_gt_1 assms by auto +qed + +text \ + In particular, this means that 1 and -1 have the greatest norm. +\ +lemma N_le_N_1: "N n \ N 1" + by (rule N_dvd_mono) auto + +text \ + Primes have relatively large norms, almost reaching the norm of 1: +\ +lemma N_prime: + assumes "prime p" + shows "N p = N 1 - 1 / q ^ nat p" +proof (rule sums_unique2) + define p' where "p' = nat p" + have p: "p = int p'" + using assms by (auto simp: p'_def prime_ge_0_int) + have "prime p'" + using assms by (simp add: p) + + have "(\k. if k = 0 \ int k dvd p then 0 else 1 / q ^ k) sums N p" + by (rule N_sums) + also have "int k dvd p \ k \ {1, p'}" for k + using assms by (auto simp: p prime_nat_iff) + hence "(\k. if k = 0 \ int k dvd p then 0 else 1 / q ^ k) = + (\k. if k \ {0, 1, p'} then 0 else (1 / q) ^ k)" + using assms q_gt_1 by (simp add: power_divide cong: if_cong) + finally show "\ sums N p" . + + have "(\k. if k \ {0, 1, p'} then 0 else (1 / q) ^ k) sums + (1 / (1 - 1 / q) + (- (1 / q) - (1 / q) ^ p' - 1))" + by (rule sums_If_finite_set'[OF geometric_sums]) + (use \prime p'\ q_gt_1 prime_gt_Suc_0_nat[of p'] in \auto simp: \) + also have "\ = N 1 - 1 / q ^ p'" + using q_gt_1 by (simp add: field_simps N_1) + finally show "(\k. if k \ {0, 1, p'} then 0 else (1 / q) ^ k) sums \" . +qed + +lemma N_2: "N 2 = 1 / (q ^ 2 * (q - 1))" + using q_gt_1 by (auto simp: N_prime N_1 field_simps power2_eq_square) + +lemma N_less_N_1: + assumes "n \ 1" "n \ -1" + shows "N n < N 1" +proof (cases "n = 0") + case False + then obtain p where p: "prime p" "p dvd n" + using prime_divisor_exists[of n] assms by force + hence "N n \ N p" by (intro N_dvd_mono) + also from p have "N p < N 1" + using q_gt_1 by (simp add: N_prime) + finally show ?thesis . +qed (use q_gt_1 in \auto simp: N_1\) + +text \ + Composites, on the other hand, do not achieve this: +\ +lemma nonprime_imp_N_lt: + assumes "\prime_elem n" "\n\ \ 1" "n \ 0" + shows "N n < N 1 - 1 / q ^ nat \n\" +proof - + obtain p where p: "prime p" "p dvd n" + using prime_divisor_exists[of n] assms by auto + define p' where "p' = nat p" + have p': "p = int p'" + using p by (auto simp: p'_def prime_ge_0_int) + have "prime p'" + using p by (simp add: p') + + define n' where "n' = nat \n\" + have "n' > 1" + using assms by (auto simp: n'_def) + + have "N n \ 1 / (q * (q - 1)) - 1 / q ^ p' - 1 / q ^ n'" + proof (rule sums_le) + show "(\k. if k = 0 \ int k dvd n then 0 else 1 / q ^ k) sums N n" + by (rule N_sums) + next + from assms p have "n' \ p'" + by (auto simp: n'_def p'_def nat_eq_iff) + hence "(\k. if k \ {0, 1, p', n'} then 0 else (1 / q) ^ k) sums + (1 / (1 - 1 / q) + (- (1 / q) - (1 / q) ^ p' - (1 / q) ^ n' - 1))" + by (intro sums_If_finite_set'[OF geometric_sums]) + (use \prime p'\ q_gt_1 prime_gt_Suc_0_nat[of p'] \n' > 1\ in \auto simp: \) + also have "\ = 1 / (q * (q - 1)) - 1 / q ^ p' - 1 / q ^ n'" + using q_gt_1 by (simp add: field_simps) + finally show "(\k. if k \ {0, 1, p', n'} then 0 else (1 / q) ^ k) sums \" . + next + show " \na. (if na = 0 \ int na dvd n then 0 else 1 / q ^ na) + \ (if na \ {0, 1, p', n'} then 0 else (1 / q) ^ na)" + using q_gt_1 assms p by (auto simp: p'_def n'_def power_divide) + qed + also have "\ < 1 / (q * (q - 1)) - 1 / q ^ n'" + using q_gt_1 by simp + finally show ?thesis by (simp add: n'_def N_1) +qed + +text \ + This implies that one can use the norm as a primality test: +\ +lemma prime_iff_N_eq: + assumes "n \ 0" + shows "prime_elem n \ N n = N 1 - 1 / q ^ nat \n\" +proof - + have *: "prime_elem n \ N n = N 1 - 1 / q ^ nat \n\" if "n > 0" for n + proof - + consider "n = 1" | "prime n" | "\prime n" "n > 1" + using \n > 0\ by force + thus ?thesis + proof cases + assume "n = 1" + thus ?thesis using q_gt_1 + by (auto simp: N_1) + next + assume n: "\prime n" "n > 1" + with nonprime_imp_N_lt[of n] show ?thesis by simp + qed (auto simp: N_prime prime_ge_0_int) + qed + + show ?thesis + proof (cases "n > 0") + case True + with * show ?thesis by blast + next + case False + with *[of "-n"] assms show ?thesis by simp + qed +qed + +text \ + Factorials, on the other hand, have very small norms: +\ +lemma N_fact_le: "N (fact m) \ 1 / (q - 1) * 1 / q ^ m" +proof (rule sums_le[OF allI N_sums]) + have "(\k. 1 / q ^ k / q ^ Suc m) sums (q / (q - 1) / q ^ Suc m)" + using geometric_sums[of "1 / q"] q_gt_1 + by (intro sums_divide) (auto simp: field_simps) + also have "(q / (q - 1) / q ^ Suc m) = 1 / (q - 1) * 1 / q ^ m" + using q_gt_1 by (simp add: field_simps) + also have "(\k. 1 / q ^ k / q ^ Suc m) = (\k. 1 / q ^ (k + Suc m))" + using q_gt_1 by (simp add: field_simps power_add) + also have "\ = (\k. if k + Suc m \ m then 0 else 1 / q ^ (k + Suc m))" + by auto + finally have "\ sums (1 / (q - 1) * 1 / q ^ m)" . + also have "?this \ (\k. if k \ m then 0 else 1 / q ^ k) sums (1 / (q - 1) * 1 / q ^ m)" + by (rule sums_zero_iff_shift) auto + finally show \ . +next + fix k :: nat + have "int k dvd fact m" if "k > 0" "k \ m" + proof - + have "int k dvd int (fact m)" + unfolding int_dvd_int_iff using that by (simp add: dvd_fact) + thus "int k dvd fact m" + unfolding of_nat_fact by simp + qed + thus "(if k = 0 \ int k dvd fact m then 0 else 1 / q ^ k) \ + (if k \ m then 0 else 1 / q ^ k)" using q_gt_1 by auto +qed + +lemma N_prime_mono: + assumes "prime p" "prime p'" "p \ p'" + shows "N p \ N p'" + using assms q_gt_1 by (auto simp add: N_prime field_simps nat_le_iff prime_ge_0_int) + +lemma N_prime_ge: + assumes "prime p" + shows "N p \ 1 / (q\<^sup>2 * (q - 1))" +proof - + have "1 / (q ^ 2 * (q - 1)) = N 2" + using q_gt_1 by (auto simp: N_prime N_1 field_simps power2_eq_square) + also have "\ \ N p" + using assms by (intro N_prime_mono) (auto simp: prime_ge_2_int) + finally show ?thesis . +qed + +lemma N_prime_elem_ge: + assumes "prime_elem p" + shows "N p \ 1 / (q\<^sup>2 * (q - 1))" +proof (cases "p \ 0") + case True + with assms N_prime_ge show ?thesis by auto +next + case False + with assms N_prime_ge[of "-p"] show ?thesis by auto +qed + + +text \ + Next, we use this norm to derive a metric: +\ + +lift_definition dist :: "fbint \ fbint \ real" is + "\x y. N (x - y)" . + +lemma dist_self [simp]: "dist x x = 0" + by transfer simp + +lemma dist_sym [simp]: "dist x y = dist y x" + by transfer (simp add: N_minus_commute) + +lemma dist_pos: "x \ y \ dist x y > 0" + by transfer (use N_pos in simp) + +lemma dist_eq_0_iff [simp]: "dist x y = 0 \ x = y" + using dist_pos[of x y] by (cases "x = y") auto + +lemma dist_triangle_ineq: "dist x z \ dist x y + dist y z" +proof transfer + fix x y z :: int + show "N (x - z) \ N (x - y) + N (y - z)" + using N_triangle_ineq[of "x - y" "y - z"] by simp +qed + + +text \ + Lastly, we show that the metric we defined indeed induces the Furstenberg topology. +\ +theorem dist_induces_open: + "open U \ (\x\U. \e>0. \y. dist x y < e \ y \ U)" +proof (transfer, safe) + fix U :: "int set" and x :: int + assume *: "\x\U. \b>0. arith_prog x b \ U" + assume "x \ U" + with * obtain b where b: "b > 0" "arith_prog x b \ U" by blast + define e where "e = 1 / q ^ b" + + show "\e>0. \y. N (x - y) < e \ y \ U" + proof (rule exI; safe?) + show "e > 0" using q_gt_1 by (simp add: e_def) + next + fix y assume "N (x - y) < e" + also have "\ = 1 / q ^ b" by fact + finally have "b dvd (x - y)" + by (rule N_lt_imp_dvd) fact + hence "y \ arith_prog x b" + by (auto simp: arith_prog_def cong_iff_dvd_diff dvd_diff_commute) + with b show "y \ U" by blast + qed + +next + + fix U :: "int set" and x :: int + assume *: "\x\U. \e>0. \y. N (x - y) < e \ y \ U" + assume "x \ U" + with * obtain e where e: "e > 0" "\y. N (x - y) < e \ y \ U" by blast + have "eventually (\N. 1 / (q - 1) * 1 / q ^ N < e) at_top" + using q_gt_1 \e > 0\ by real_asymp + then obtain m where m: "1 / (q - 1) * 1 / q ^ m < e" + by (auto simp: eventually_at_top_linorder) + define b :: nat where "b = fact m" + + have "arith_prog x b \ U" + proof + fix y assume "y \ arith_prog x b" + show "y \ U" + proof (cases "y = x") + case False + from \y \ arith_prog x b\ obtain n where y: "y = x + int b * n" + by (auto simp: arith_prog_altdef) + from y and \y \ x\ have [simp]: "n \ 0" by auto + have "N (x - y) = N (int b * n)" by (simp add: y) + also have "\ \ N (int b)" + by (rule N_dvd_mono) auto + also have "\ \ 1 / (q - 1) * 1 / q ^ m" + using N_fact_le by (simp add: b_def) + also have "\ < e" by fact + finally show "y \ U" using e by auto + qed (use \x \ U\ in auto) + qed + moreover have "b > 0" by (auto simp: b_def) + ultimately show "\b>0. arith_prog x b \ U" + by blast +qed + +end + + +text \ + We now show that the Fürstenberg space is a metric space with this metric (with \q = 2\), + which essentially only amounts to plugging together all the results from above. +\ + +interpretation fb: fbnorm 2 + by standard auto + + +instantiation fbint :: dist +begin + +definition dist_fbint where "dist_fbint = fb.dist" + +instance .. + +end + + +instantiation fbint :: uniformity_dist +begin + +definition uniformity_fbint :: "(fbint \ fbint) filter" where + "uniformity_fbint = (INF e\{0 <..}. principal {(x, y). dist x y < e})" + +instance by standard (simp add: uniformity_fbint_def) + +end + + +instance fbint :: open_uniformity +proof + fix U :: "fbint set" + show "open U = (\x\U. eventually (\(x',y). x' = x \ y \ U) uniformity)" + unfolding eventually_uniformity_metric dist_fbint_def + using fb.dist_induces_open by simp +qed + + +instance fbint :: metric_space + by standard (use fb.dist_triangle_ineq in \auto simp: dist_fbint_def\) + +text \ + In particular, we can now show that the sequence \n!\ tends to 0 in the Furstenberg topology: +\ +lemma tendsto_fbint_fact: "(\n. fbint (fact n)) \ fbint 0" +proof - + have "(\n. dist (fbint (fact n)) (fbint 0)) \ 0" + proof (rule tendsto_sandwich[OF always_eventually always_eventually]; safe?) + fix n :: nat + show "dist (fbint (fact n)) (fbint 0) \ 1 / 2 ^ n" + unfolding dist_fbint_def by (transfer fixing: n) (use fb.N_fact_le[of n] in simp) + show "dist (fbint (fact n)) (fbint 0) \ 0" + by simp + show "(\n. 1 / 2 ^ n :: real) \ 0" + by real_asymp + qed simp_all + thus ?thesis + using tendsto_dist_iff by metis +qed + +end \ No newline at end of file diff --git a/thys/Furstenberg_Topology/ROOT b/thys/Furstenberg_Topology/ROOT new file mode 100644 --- /dev/null +++ b/thys/Furstenberg_Topology/ROOT @@ -0,0 +1,13 @@ +chapter AFP + +session Furstenberg_Topology (AFP) = "HOL-Analysis" + + options [timeout = 1200] + sessions + "HOL-Number_Theory" + "HOL-Real_Asymp" + theories + Furstenberg_Topology + document_files + "root.tex" + "root.bib" + diff --git a/thys/Furstenberg_Topology/document/root.bib b/thys/Furstenberg_Topology/document/root.bib new file mode 100644 --- /dev/null +++ b/thys/Furstenberg_Topology/document/root.bib @@ -0,0 +1,37 @@ +@article{zulfeqarr, + doi = {10.1007/s12045-019-0837-x}, + url = {https://doi.org/10.1007/s12045-019-0837-x}, + year = {2019}, + month = jul, + publisher = {Springer Science and Business Media {LLC}}, + volume = {24}, + number = {7}, + pages = {755--765}, + author = {Fahed Zulfeqarr}, + title = {Some Interesting Consequences of {F}urstenberg Topology}, + journal = {Resonance} +} + +@misc{dirmeier, + title={On Metrics Inducing the {F}ürstenberg Topology on the Integers}, + author={Alexander Dirmeier}, + year={2019}, + eprint={1912.11663}, + howpublished="\url{https://arxiv.org/abs/1912.11663}", + archivePrefix={arXiv}, + primaryClass={math.GN} +} + +@article{furstenberg, + doi = {10.2307/2307043}, + url = {https://doi.org/10.2307/2307043}, + year = {1955}, + month = may, + publisher = {Informa {UK} Limited}, + volume = {62}, + number = {5}, + pages = {353}, + author = {Harry Furstenberg}, + title = {On the Infinitude of Primes}, + journal = {The American Mathematical Monthly} +} diff --git a/thys/Furstenberg_Topology/document/root.tex b/thys/Furstenberg_Topology/document/root.tex new file mode 100644 --- /dev/null +++ b/thys/Furstenberg_Topology/document/root.tex @@ -0,0 +1,41 @@ +\documentclass[11pt,a4paper]{article} +\usepackage{isabelle,isabellesym} +\usepackage{amsfonts, amsmath, amssymb} + +% this should be the last package used +\usepackage{pdfsetup} + +% urls in roman style, theory text in math-similar italics +\urlstyle{rm} +\isabellestyle{it} + +\begin{document} + +\title{Furstenberg's Topology And\\ His Proof of the Infinitude of Primes} +\author{Manuel Eberl} +\maketitle + +\begin{abstract} +This article gives a formal version of Furstenberg's topological proof of the infinitude of +primes. He defines a topology on the integers based on arithmetic progressions (or, equivalently, residue classes). +Using some fairly obvious properties of this topology, the infinitude of primes is then easily obtained. + +Apart from this, this topology is also fairly `nice' in general: it is second countable, metrizable, and perfect. All of these (well-known) +facts are formally proven, including an explicit metric for the topology given by Zulfeqarr. +\end{abstract} + +\tableofcontents +\newpage +\parindent 0pt\parskip 0.5ex + +\input{session} + +\bibliographystyle{abbrv} +\bibliography{root} + +\end{document} + +%%% Local Variables: +%%% mode: latex +%%% TeX-master: t +%%% End: diff --git a/thys/Goodstein_Lambda/Goodstein_Lambda.thy b/thys/Goodstein_Lambda/Goodstein_Lambda.thy new file mode 100644 --- /dev/null +++ b/thys/Goodstein_Lambda/Goodstein_Lambda.thy @@ -0,0 +1,755 @@ +section \Specification\ + +theory Goodstein_Lambda + imports Main +begin + +subsection \Hereditary base representation\ + +text \We define a data type of trees and an evaluation function that sums siblings and + exponentiates with respect to the given base on nesting.\ + +datatype C = C (unC: "C list") + +fun evalC where + "evalC b (C []) = 0" +| "evalC b (C (x # xs)) = b^evalC b x + evalC b (C xs)" + +value "evalC 2 (C [])" \ \$0$\ +value "evalC 2 (C [C []])" \ \$2^0 = 1$\ +value "evalC 2 (C [C [C []]])" \ \$2^1 = 2$\ +value "evalC 2 (C [C [], C []])" \ \$2^0 + 2^0 = 2^0 \cdot 2 = 2$; not in hereditary base $2$\ + +text \The hereditary base representation is characterized as trees (i.e., nested lists) whose + lists have monotonically increasing evaluations, with fewer than @{term "b"} repetitions for + each value. We will show later that this representation is unique.\ + +inductive_set hbase for b where + "C [] \ hbase b" +| "i \ 0 \ i < b \ n \ hbase b \ + C ms \ hbase b \ (\m'. m' \ set ms \ evalC b n < evalC b m') \ + C (replicate i n @ ms) \ hbase b" + +text \We can convert to and from natural numbers as follows.\ + +definition H2N where + "H2N b n = evalC b n" + +text \As we will show later, @{term "H2N b"} restricted to @{term "hbase n"} is bijective + if @{prop "b \ (2 :: nat)"}, so we can convert from natural numbers by taking the inverse.\ + +definition N2H where + "N2H b n = inv_into (hbase b) (H2N b) n" + +subsection \The Goodstein function\ + +text \We define a function that computes the length of the Goodstein sequence whose $c$-th element + is $g_c = n$. Termination will be shown later, thereby establishing Goodstein's theorem.\ + +function (sequential) goodstein :: "nat \ nat \ nat" where + "goodstein 0 n = 0" + \ \we start counting at 1; also note that the initial base is @{term "c+1 :: nat"} and\ + \ \hereditary base 1 makes no sense, so we have to avoid this case\ +| "goodstein c 0 = c" +| "goodstein c n = goodstein (c+1) (H2N (c+2) (N2H (c+1) n) - 1)" + by pat_completeness auto + +abbreviation \ where + "\ n \ goodstein (Suc 0) n" + +section \Ordinals\ + +text \The following type contains countable ordinals, by the usual case distinction into 0, + successor ordinal, or limit ordinal; limit ordinals are given by their fundamental sequence. + Hereditary base @{term "b"} representations carry over to such ordinals by replacing each + occurrence of the base by @{term "\"}.\ + +datatype Ord = Z | S Ord | L "nat \ Ord" + +text \Note that the following arithmetic operations are not correct for all ordinals. However, they + will only be used in cases where they actually correspond to the ordinal arithmetic operations.\ + +primrec addO where + "addO n Z = n" +| "addO n (S m) = S (addO n m)" +| "addO n (L f) = L (\i. addO n (f i))" + +primrec mulO where + "mulO n Z = Z" +| "mulO n (S m) = addO (mulO n m) n" +| "mulO n (L f) = L (\i. mulO n (f i))" + +definition \ where + "\ = L (\n. (S ^^ n) Z)" + +primrec exp\ where + "exp\ Z = S Z" +| "exp\ (S n) = mulO (exp\ n) \" +| "exp\ (L f) = L (\i. exp\ (f i))" + +subsection \Evaluation\ + +text \Evaluating an ordinal number at base $b$ is accomplished by taking the $b$-th element of + all fundamental sequences and interpreting zero and successor over the natural numbers.\ + +primrec evalO where + "evalO b Z = 0" +| "evalO b (S n) = Suc (evalO b n)" +| "evalO b (L f) = evalO b (f b)" + +subsection \Goodstein function and sequence\ + +text \We can define the Goodstein function very easily, but proving correctness will take a while.\ + +primrec goodsteinO where + "goodsteinO c Z = c" +| "goodsteinO c (S n) = goodsteinO (c+1) n" +| "goodsteinO c (L f) = goodsteinO c (f (c+2))" + +primrec stepO where + "stepO c Z = Z" +| "stepO c (S n) = n" +| "stepO c (L f) = stepO c (f (c+2))" + +text \We can compute a few values of the Goodstein sequence starting at $4$.\ + +definition g4O where + "g4O n = fold stepO [1.. ^^ 3) Z)" + +value "map (\n. evalO (n+2) (g4O n)) [0..<10]" +\ \@{value "[4, 26, 41, 60, 83, 109, 139, 173, 211, 253] :: nat list"}\ + +subsection \Properties of evaluation\ + +lemma evalO_addO [simp]: + "evalO b (addO n m) = evalO b n + evalO b m" + by (induct m) auto + +lemma evalO_mulO [simp]: + "evalO b (mulO n m) = evalO b n * evalO b m" + by (induct m) auto + +lemma evalO_n [simp]: + "evalO b ((S ^^ n) Z) = n" + by (induct n) auto + +lemma evalO_\ [simp]: + "evalO b \ = b" + by (auto simp: \_def) + +lemma evalO_exp\ [simp]: + "evalO b (exp\ n) = b^(evalO b n)" + by (induct n) auto + +text \Note that evaluation is useful for proving that @{type "Ord"} values are distinct:\ +notepad begin + have "addO n (exp\ m) \ n" for n m by (auto dest: arg_cong[of _ _ "evalO 1"]) +end + +subsection \Arithmetic properties\ + +lemma addO_Z [simp]: + "addO Z n = n" + by (induct n) auto + +lemma addO_assoc [simp]: + "addO n (addO m p) = addO (addO n m) p" + by (induct p) auto + +lemma mul0_distrib [simp]: + "mulO n (addO p q) = addO (mulO n p) (mulO n q)" + by (induct q) auto + +lemma mulO_assoc [simp]: + "mulO n (mulO m p) = mulO (mulO n m) p" + by (induct p) auto + +lemma exp\_addO [simp]: + "exp\ (addO n m) = mulO (exp\ n) (exp\ m)" + by (induct m) auto + + +section \Cantor normal form\ + +text \The previously introduced tree type @{type C} can be used to represent Cantor normal forms; + they are trees (evaluated at base @{term \}) such that siblings are in non-decreasing order. + One can think of this as hereditary base @{term \}. The plan is to mirror selected operations on + ordinals in Cantor normal forms.\ + +subsection \Conversion to and from the ordinal type @{type Ord}\ + +fun C2O where + "C2O (C []) = Z" +| "C2O (C (n # ns)) = addO (C2O (C ns)) (exp\ (C2O n))" + +definition O2C where + "O2C = inv C2O" + +text \We show that @{term C2O} is injective, meaning the inverse is unique.\ + +lemma addO_exp\_inj: + assumes "addO n (exp\ m) = addO n' (exp\ m')" + shows "n = n'" and "m = m'" +proof - + have "addO n (exp\ m) = addO n' (exp\ m') \ n = n'" + by (induct m arbitrary: m'; case_tac m'; + force simp: \_def dest!: fun_cong[of _ _ 1]) + moreover have "addO n (exp\ m) = addO n (exp\ m') \ m = m'" + apply (induct m arbitrary: n m'; case_tac m') + apply (auto 0 3 simp: \_def intro: rangeI + dest: arg_cong[of _ _ "evalO 1"] fun_cong[of _ _ 0] fun_cong[of _ _ 1])[8] (* 1 left *) + by simp (meson ext rangeI) + ultimately show "n = n'" and "m = m'" using assms by simp_all +qed + +lemma C2O_inj: + "C2O n = C2O m \ n = m" + by (induct n arbitrary: m rule: C2O.induct; case_tac m rule: C2O.cases) + (auto dest: addO_exp\_inj arg_cong[of _ _ "evalO 1"]) + +lemma O2C_C2O [simp]: + "O2C (C2O n) = n" + by (auto intro!: inv_f_f simp: O2C_def inj_def C2O_inj) + +lemma O2C_Z [simp]: + "O2C Z = C []" + using O2C_C2O[of "C []", unfolded C2O.simps] . + +lemma C2O_replicate: + "C2O (C (replicate i n)) = mulO (exp\ (C2O n)) ((S ^^ i) Z)" + by (induct i) auto + +lemma C2O_app: + "C2O (C (xs @ ys)) = addO (C2O (C ys)) (C2O (C xs))" + by (induct xs arbitrary: ys) auto + +subsection \Evaluation\ + +lemma evalC_def': + "evalC b n = evalO b (C2O n)" + by (induct n rule: C2O.induct) auto + +lemma evalC_app [simp]: + "evalC b (C (ns @ ms)) = evalC b (C ns) + evalC b (C ms)" + by (induct ns) auto + +lemma evalC_replicate [simp]: + "evalC b (C (replicate c n)) = c * evalC b (C [n])" + by (induct c) auto + +subsection \Transfer of the @{type Ord} induction principle to @{type C}\ + +fun funC where \ \@{term funC} computes the fundamental sequence on @{type C}\ + "funC (C []) = (\i. [C []])" +| "funC (C (C [] # ns)) = (\i. replicate i (C ns))" +| "funC (C (n # ns)) = (\i. [C (funC n i @ ns)])" + +lemma C2O_cons: + "C2O (C (n # ns)) = + (if n = C [] then S (C2O (C ns)) else L (\i. C2O (C (funC n i @ ns))))" + by (induct n arbitrary: ns rule: funC.induct) + (simp_all add: \_def C2O_replicate C2O_app flip: exp\_addO) + +lemma C_Ord_induct: + assumes "P (C [])" + and "\ns. P (C ns) \ P (C (C [] # ns))" + and "\n ns ms. (\i. P (C (funC (C (n # ns)) i @ ms))) \ + P (C (C (n # ns) # ms))" + shows "P n" +proof - + have "\n. C2O n = m \ P n" for m + by (induct m; intro allI; case_tac n rule: funC.cases) + (auto simp: C2O_cons simp del: C2O.simps(2) intro: assms) + then show ?thesis by simp +qed + +subsection \Goodstein function and sequence on @{type C}\ + +function (domintros) goodsteinC where + "goodsteinC c (C []) = c" +| "goodsteinC c (C (C [] # ns)) = goodsteinC (c+1) (C ns)" +| "goodsteinC c (C (C (n # ns) # ms)) = + goodsteinC c (C (funC (C (n # ns)) (c+2) @ ms))" + by pat_completeness auto + +termination +proof - + have "goodsteinC_dom (c, n)" for c n + by (induct n arbitrary: c rule: C_Ord_induct) (auto intro: goodsteinC.domintros) + then show ?thesis by simp +qed + +lemma goodsteinC_def': + "goodsteinC c n = goodsteinO c (C2O n)" + by (induct c n rule: goodsteinC.induct) (simp_all add: C2O_cons del: C2O.simps(2)) + +function (domintros) stepC where + "stepC c (C []) = C []" +| "stepC c (C (C [] # ns)) = C ns" +| "stepC c (C (C (n # ns) # ms)) = + stepC c (C (funC (C (n # ns)) (Suc (Suc c)) @ ms))" + by pat_completeness auto + +termination +proof - + have "stepC_dom (c, n)" for c n + by (induct n arbitrary: c rule: C_Ord_induct) (auto intro: stepC.domintros) + then show ?thesis by simp +qed + +definition g4C where + "g4C n = fold stepC [1..n. evalC (n+2) (g4C n)) [0..<10]" +\ \@{value "[4, 26, 41, 60, 83, 109, 139, 173, 211, 253] :: nat list"}\ + +subsection \Properties\ + +lemma stepC_def': + "stepC c n = O2C (stepO c (C2O n))" + by (induct c n rule: stepC.induct) (simp_all add: C2O_cons del: C2O.simps(2)) + +lemma funC_ne [simp]: + "funC m (Suc n) \ []" + by (cases m rule: funC.cases) simp_all + +lemma evalC_funC [simp]: + "evalC b (C (funC n b)) = evalC b (C [n])" + by (induct n rule: funC.induct) simp_all + +lemma stepC_app [simp]: + "n \ C [] \ stepC c (C (unC n @ ns)) = C (unC (stepC c n) @ ns)" + by (induct n arbitrary: ns rule: stepC.induct) simp_all + +lemma stepC_cons [simp]: + "ns \ [] \ stepC c (C (n # ns)) = C (unC (stepC c (C [n])) @ ns)" + using stepC_app[of "C[n]" c ns] by simp + +lemma stepC_dec: + "n \ C [] \ Suc (evalC (Suc (Suc c)) (stepC c n)) = evalC (Suc (Suc c)) n" + by (induct c n rule: stepC.induct) simp_all + +lemma stepC_dec': + "n \ C [] \ evalC (c+3) (stepC c n) < evalC (c+3) n" +proof (induct c n rule: stepC.induct) + case (3 c n ns ms) + have "evalC (c+3) (C (funC (C (n # ns)) (Suc (Suc c)))) \ + (c+3) ^ ((c+3) ^ evalC (c+3) n + evalC (c+3) (C ns))" + by (induct n rule: funC.induct) (simp_all add: distrib_right) + then show ?case using 3 by simp +qed simp_all + + +section \Hereditary base @{term b} representation\ + +text \We now turn to properties of the @{term "hbase b"} subset of trees.\ + +subsection \Uniqueness\ + +text \We show uniqueness of the hereditary base representation by showing that @{term "evalC b"} + restricted to @{term "hbase b"} is injective.\ + +lemma hbaseI2: + "i < b \ n \ hbase b \ C m \ hbase b \ + (\m'. m' \ set m \ evalC b n < evalC b m') \ + C (replicate i n @ m) \ hbase b" + by (cases i) (auto intro: hbase.intros simp del: replicate.simps(2)) + +lemmas hbase_singletonI = + hbase.intros(2)[of 1 "Suc (Suc b)" for b, OF _ _ _ hbase.intros(1), simplified] + +lemma hbase_hd: + "C ns \ hbase b \ ns \ [] \ hd ns \ hbase b" + by (cases rule: hbase.cases) auto + +lemmas hbase_hd' [dest] = hbase_hd[of "n # ns" for n ns, simplified] + +lemma hbase_tl: + "C ns \ hbase b \ ns \ [] \ C (tl ns) \ hbase b" + by (cases "C ns" b rule: hbase.cases) (auto intro: hbaseI2) + +lemmas hbase_tl' [dest] = hbase_tl[of "n # ns" for n ns, simplified] + +lemma hbase_elt [dest]: + "C ns \ hbase b \ n \ set ns \ n \ hbase b" + by (induct ns) auto + +lemma evalC_sum_list: + "evalC b (C ns) = sum_list (map (\n. b^evalC b n) ns)" + by (induct ns) auto + +lemma sum_list_replicate: + "sum_list (replicate n x) = n * x" + by (induct n) auto + +lemma base_red: + fixes b :: nat + assumes n: "\n'. n' \ set ns \ n < n'" "i < b" "i \ 0" + and m: "\m'. m' \ set ms \ m < m'" "j < b" "j \ 0" + and s: "i * b^n + sum_list (map (\n. b^n) ns) = j * b^m + sum_list (map (\n. b^n) ms)" + shows "i = j \ n = m" + using n(1) m(1) s +proof (induct n arbitrary: m ns ms) + { fix ns ms :: "nat list" and i j m :: nat + assume n': "\n'. n' \ set ns \ 0 < n'" "i < b" "i \ 0" + assume m': "\m'. m' \ set ms \ m < m'" "j < b" "j \ 0" + assume s': "i * b^0 + sum_list (map (\n. b^n) ns) = j * b^m + sum_list (map (\n. b^n) ms)" + obtain x where [simp]: "sum_list (map ((^) b) ns) = x*b" + using n'(1) + by (intro that[of "sum_list (map (\n. b^(n-1)) ns)"]) + (simp add: ac_simps flip: sum_list_const_mult power_Suc cong: map_cong) + obtain y where [simp]: "sum_list (map ((^) b) ms) = y*b" + using order.strict_trans1[OF le0 m'(1)] + by (intro that[of "sum_list (map (\n. b^(n-1)) ms)"]) + (simp add: ac_simps flip: sum_list_const_mult power_Suc cong: map_cong) + have [simp]: "m = 0" + using s' n'(2,3) + by (cases m, simp_all) + (metis Groups.mult_ac(2) Groups.mult_ac(3) Suc_pred div_less mod_div_mult_eq + mod_mult_self2 mod_mult_self2_is_0 mult_zero_right nat.simps(3)) + have "i = j \ 0 = m" using s' n'(2,3) m'(2,3) + by simp (metis div_less mod_div_mult_eq mod_mult_self1) + } note BASE = this + { + case 0 show ?case by (rule BASE; fact) + next + case (Suc n m') + have "j = i \ 0 = Suc n" if "m' = 0" using Suc(2-4) + by (intro BASE[of ms j ns "Suc n" i]) (simp_all add: ac_simps that n(2,3) m(2,3)) + then obtain m where m' [simp]: "m' = Suc m" + by (cases m') auto + obtain ns' where [simp]: "ns = map Suc ns'" "\n'. n' \ set ns' \ n < n'" + using Suc(2) less_trans[OF zero_less_Suc Suc(2)] + by (intro that[of "map (\n. n-1) ns"]; force cong: map_cong) + obtain ms' where [simp]: "ms = map Suc ms'" "\m'. m' \ set ms' \ m < m'" + using Suc(3)[unfolded m'] less_trans[OF zero_less_Suc Suc(3)[unfolded m']] + by (intro that[of "map (\n. n-1) ms"]; force cong: map_cong) + have *: "b * x = b * y \ x = y" for x y using n(2) by simp + have "i = j \ n = m" + proof (rule Suc(1)[of "map (\n. n-1) ns" "map (\n. n-1) ms" m, OF _ _ *], goal_cases) + case 3 show ?case using Suc(4) unfolding add_mult_distrib2 + by (simp add: comp_def ac_simps flip: sum_list_const_mult) + qed simp_all + then show ?case by simp + } +qed + +lemma evalC_inj_on_hbase: + "n \ hbase b \ m \ hbase b \ evalC b n = evalC b m \ n = m" +proof (induct n arbitrary: m rule: hbase.induct) + case 1 + then show ?case by (cases m rule: hbase.cases) simp_all +next + case (2 i n ns m') + obtain j m ms where [simp]: "m' = C (replicate j m @ ms)" and + m: "j \ 0" "j < b" "m \ hbase b" "C ms \ hbase b" "\m'. m' \ set ms \ evalC b m < evalC b m'" + using 2(8,1,2,9) by (cases m' rule: hbase.cases) simp_all + have "i = j \ evalC b n = evalC b m" using 2(1,2,7,9) m(1,2,5) + by (intro base_red[of "map (evalC b) ns" _ _ b "map (evalC b) ms"]) + (auto simp: comp_def evalC_sum_list sum_list_replicate) + then show ?case + using 2(4)[OF m(3)] 2(6)[OF m(4)] 2(9) by simp +qed + +subsection \Correctness of @{const stepC}\ + +text \We show that @{term "stepC c"} preserves hereditary base @{term "c + 2 :: nat"} + representations. In order to cover intermediate results produced by @{const stepC}, we extend + the hereditary base representation to allow the least significant digit to be equal to @{term b}, + which essentially means that we may have an extra sibling in front on every level.\ + +inductive_set hbase_ext for b where + "n \ hbase b \ n \ hbase_ext b" +| "n \ hbase_ext b \ + C m \ hbase b \ (\m'. m' \ set m \ evalC b n \ evalC b m') \ + C (n # m) \ hbase_ext b" + +lemma hbase_ext_hd' [dest]: + "C (n # ns) \ hbase_ext b \ n \ hbase_ext b" + by (cases rule: hbase_ext.cases) (auto intro: hbase_ext.intros(1)) + +lemma hbase_ext_tl: + "C ns \ hbase_ext b \ ns \ [] \ C (tl ns) \ hbase b" + by (cases "C ns" b rule: hbase_ext.cases; cases ns) (simp_all add: hbase_tl') + +lemmas hbase_ext_tl' [dest] = hbase_ext_tl[of "n # ns" for n ns, simplified] + +lemma hbase_funC: + "c \ 0 \ C (n # ns) \ hbase_ext (Suc c) \ + C (funC n (Suc c) @ ns) \ hbase_ext (Suc c)" +proof (induct n arbitrary: ns rule: funC.induct) + case (2 ms) + have [simp]: "evalC (Suc c) (C ms) < evalC (Suc c) m'" if "m' \ set ns" for m' + using 2(2) + proof (cases rule: hbase_ext.cases) + case 1 then show ?thesis using that + by (cases rule: hbase.cases, case_tac i) (auto intro: Suc_lessD) + qed (auto simp: Suc_le_eq that) + show ?case using 2 + by (auto 0 4 intro: hbase_ext.intros hbase.intros(2) order.strict_implies_order) +next + case (3 m ms ms') + show ?case + unfolding funC.simps append_Cons append_Nil + proof (rule hbase_ext.intros(2), goal_cases 31 32 33) + case (33 m') + show ?case using 3(3) + proof (cases rule: hbase_ext.cases) + case 1 show ?thesis using 1 3(1,2) 33 + by (cases rule: hbase.cases, case_tac i) (auto intro: less_or_eq_imp_le) + qed (insert 33, simp) + qed (insert 3, blast+) +qed auto + +lemma stepC_sound: + "n \ hbase_ext (Suc (Suc c)) \ stepC c n \ hbase (Suc (Suc c))" +proof (induct c n rule: stepC.induct) + case (3 c n ns ms) + show ?case using 3(2,1) + by (cases rule: hbase_ext.cases; unfold stepC.simps) (auto intro: hbase_funC) +qed (auto intro: hbase.intros) + +subsection \Surjectivity of @{const evalC}\ + +text \Note that the base must be at least @{term "2 :: nat"}.\ + +lemma evalC_surjective: + "\n' \ hbase (Suc (Suc b)). evalC (Suc (Suc b)) n' = n" +proof (induct n) + case 0 then show ?case by (auto intro: bexI[of _ "C []"] hbase.intros) +next + have [simp]: "Suc x \ Suc (Suc b)^x" for x by (induct x) auto + case (Suc n) + then guess n' by (rule bexE) + then obtain n' j where n': "Suc n \ j" "j = evalC (Suc (Suc b)) n'" "n' \ hbase (Suc (Suc b))" + by (intro that[of _ "C [n']"]) + (auto intro!: intro: hbase.intros(1) dest!: hbaseI2[of 1 "b+2" n' "[]", simplified]) + then show ?case + proof (induct rule: inc_induct) + case (step m) + guess n' using step(3)[OF step(4,5)] by (rule bexE) + then show ?case using stepC_dec[of n' "b"] + by (cases n' rule: C2O.cases) (auto intro: stepC_sound hbase_ext.intros(1)) + qed blast +qed + +subsection \Monotonicity of @{const hbase}\ + +text \Here we show that every hereditary base @{term "b :: nat"} number is also a valid hereditary + base @{term "b+1 :: nat"} number. This is not immediate because we have to show that monotonicity + of siblings is preserved.\ + +lemma hbase_evalC_mono: + assumes "n \ hbase b" "m \ hbase b" "evalC b n < evalC b m" + shows "evalC (Suc b) n < evalC (Suc b) m" +proof (cases "b < 2") + case True show ?thesis using assms(2,3) True by (cases rule: hbase.cases) simp_all +next + case False + then obtain b' where [simp]: "b = Suc (Suc b')" + by (auto simp: numeral_2_eq_2 not_less_eq dest: less_imp_Suc_add) + show ?thesis using assms(3,1,2) + proof (induct "evalC b n" "evalC b m" arbitrary: n m rule: less_Suc_induct) + case 1 then show ?case using stepC_sound[of m b', OF hbase_ext.intros(1)] + stepC_dec[of m b'] stepC_dec'[of m b'] evalC_inj_on_hbase + by (cases m rule: C2O.cases) (fastforce simp: eval_nat_numeral)+ + next + case (2 j) then show ?case + using evalC_surjective[of b' j] less_trans by fastforce + qed +qed + +lemma hbase_mono: + "n \ hbase b \ n \ hbase (Suc b)" + by (induct n rule: hbase.induct) (auto 0 3 intro: hbase.intros hbase_evalC_mono) + +subsection \Conversion to and from @{type nat}\ + +text \We have previously defined @{term "H2N b = evalC b"} and @{term "N2H b"} as its inverse. + So we can use the injectivity and surjectivity of @{term "evalC b"} for simplification.\ + +lemma N2H_inv: + "n \ hbase b \ N2H b (H2N b n) = n" + using evalC_inj_on_hbase + by (auto simp: N2H_def H2N_def[abs_def] inj_on_def intro!: inv_into_f_f) + +lemma H2N_inv: + "H2N (Suc (Suc b)) (N2H (Suc (Suc b)) n) = n" + using evalC_surjective[of "b" n] + by (auto simp: N2H_def H2N_def[abs_def] intro: f_inv_into_f) + +lemma N2H_eqI: + "n \ hbase (Suc (Suc b)) \ + H2N (Suc (Suc b)) n = m \ N2H (Suc (Suc b)) m = n" + using N2H_inv by blast + +lemma N2H_neI: + "n \ hbase (Suc (Suc b)) \ + H2N (Suc (Suc b)) n \ m \ N2H (Suc (Suc b)) m \ n" + using H2N_inv by blast + +lemma N2H_0 [simp]: + "N2H (Suc (Suc c)) 0 = C []" + using H2N_def N2H_inv hbase.intros(1) by fastforce + +lemma N2H_nz [simp]: + "0 < n \ N2H (Suc (Suc c)) n \ C []" + by (metis N2H_0 H2N_inv neq0_conv) + + +section \The Goodstein function revisited\ + +text \We are now ready to prove termination of the Goodstein function @{const goodstein} as well + as its relation to @{const goodsteinC} and @{const goodsteinO}.\ + +lemma goodstein_aux: + "goodsteinC (Suc c) (N2H (Suc (Suc c)) (Suc n)) = + goodsteinC (c+2) (N2H (c+3) (H2N (c+3) (N2H (c+2) (n+1)) - 1))" +proof - + have [simp]: "n \ C [] \ goodsteinC c n = goodsteinC (c+1) (stepC c n)" for c n + by (induct c n rule: stepC.induct) simp_all + have [simp]: "stepC (Suc c) (N2H (Suc (Suc c)) (Suc n)) \ hbase (Suc (Suc (Suc c)))" + by (metis H2N_def N2H_inv evalC_surjective hbase_ext.intros(1) hbase_mono stepC_sound) + show ?thesis + using arg_cong[OF stepC_dec[of "N2H (c+2) (n+1)" "c+1", folded H2N_def], of "\n. N2H (c+3) (n-1)"] + by (simp add: eval_nat_numeral N2H_inv) +qed + +termination goodstein +proof (relation "measure (\(c, n). goodsteinC c (N2H (c+1) n) - c)", goal_cases _ 1) + case (1 c n) + have *: "goodsteinC c n \ c" for c n + by (induct c n rule: goodsteinC.induct) simp_all + show ?case by (simp add: goodstein_aux eval_nat_numeral) (meson Suc_le_eq diff_less_mono2 lessI *) +qed simp + +lemma goodstein_def': + "c \ 0 \ goodstein c n = goodsteinC c (N2H (c+1) n)" + by (induct c n rule: goodstein.induct) (simp_all add: goodstein_aux eval_nat_numeral) + +lemma goodstein_impl: + "c \ 0 \ goodstein c n = goodsteinO c (C2O (N2H (c+1) n))" + \ \but note that @{term N2H} is not executable as currently defined\ + using goodstein_def'[unfolded goodsteinC_def'] . + +lemma goodstein_16: + "\ 16 = goodsteinO 1 (exp\ (exp\ (exp\ (exp\ Z))))" +proof - + have "N2H (Suc (Suc 0)) 16 = C [C [C [C [C []]]]]" + by (auto simp: H2N_def intro!: N2H_eqI hbase_singletonI hbase.intros(1)) + then show ?thesis by (simp add: goodstein_impl) +qed + + +section \Translation to $\lambda$-calculus\ + +text \We define Church encodings for @{type nat} and @{type Ord}. Note that we are basically in a + Hindley-Milner type system, so we cannot use a proper polymorphic type. We can still express + Church encodings as folds over values of the original type.\ + +abbreviation Z\<^sub>N where "Z\<^sub>N \ (\s z. z)" +abbreviation S\<^sub>N where "S\<^sub>N \ (\n s z. s (n s z))" + +primrec fold_nat ("\_\\<^sub>N") where + "\0\\<^sub>N = Z\<^sub>N" +| "\Suc n\\<^sub>N = S\<^sub>N \n\\<^sub>N" + +lemma one\<^sub>N: + "\1\\<^sub>N = (\x. x)" + by simp + +abbreviation Z\<^sub>O where "Z\<^sub>O \ (\z s l. z)" +abbreviation S\<^sub>O where "S\<^sub>O \ (\n z s l. s (n z s l))" +abbreviation L\<^sub>O where "L\<^sub>O \ (\f z s l. l (\i. f i z s l))" + +primrec fold_Ord ("\_\\<^sub>O") where + "\Z\\<^sub>O = Z\<^sub>O" +| "\S n\\<^sub>O = S\<^sub>O \n\\<^sub>O" +| "\L f\\<^sub>O = L\<^sub>O (\i. \f i\\<^sub>O)" + +text \The following abbreviations and lemmas show how to implement the arithmetic functions and + the Goodstein function on a Church-encoded @{type Ord} in lambda calculus.\ + +abbreviation (input) add\<^sub>O where + "add\<^sub>O n m \ (\z s l. m (n z s l) s l)" + +lemma add\<^sub>O: + "\addO n m\\<^sub>O = add\<^sub>O \n\\<^sub>O \m\\<^sub>O" + by (induct m) simp_all + +abbreviation (input) mul\<^sub>O where + "mul\<^sub>O n m \ (\z s l. m z (\m. n m s l) l)" + +lemma mul\<^sub>O: + "\mulO n m\\<^sub>O = mul\<^sub>O \n\\<^sub>O \m\\<^sub>O" + by (induct m) (simp_all add: add\<^sub>O) + +abbreviation (input) \\<^sub>O where + "\\<^sub>O \ (\z s l. l (\n. \n\\<^sub>N s z))" + +lemma \\<^sub>O: + "\\\\<^sub>O = \\<^sub>O" +proof - + have [simp]: "\(S ^^ i) Z\\<^sub>O z s l = \i\\<^sub>N s z" for i z s l by (induct i) simp_all + show ?thesis by (simp add: \_def) +qed + +abbreviation (input) exp\\<^sub>O where + "exp\\<^sub>O n \ (\z s l. n s (\x z. l (\n. \n\\<^sub>N x z)) (\f z. l (\n. f n z)) z)" + +lemma exp\\<^sub>O: + "\exp\ n\\<^sub>O = exp\\<^sub>O \n\\<^sub>O" + by (induct n) (simp_all add: mul\<^sub>O \\<^sub>O) + +abbreviation (input) goodstein\<^sub>O where + "goodstein\<^sub>O \ (\c n. n (\x. x) (\n m. n (m + 1)) (\f m. f (m + 2) m) c)" + +lemma goodstein\<^sub>O: + "goodsteinO c n = goodstein\<^sub>O c \n\\<^sub>O" + by (induct n arbitrary: c) simp_all + +text \Note that modeling Church encodings with folds is still limited. For example, the meaningful + expression @{text "\n\\<^sub>N exp\\<^sub>O Z\<^sub>O"} cannot be typed in Isabelle/HOL, as that would require rank-2 + polymorphism.\ + +subsection \Alternative: free theorems\ + +text \The following is essentially the free theorem for Church-encoded @{type Ord} values.\ + +lemma freeOrd: + assumes "\n. h (s n) = s' (h n)" and "\f. h (l f) = l' (\i. h (f i))" + shows "h (\n\\<^sub>O z s l) = \n\\<^sub>O (h z) s' l'" + by (induct n) (simp_all add: assms) + +text \Each of the following proofs first states a naive definition of the corresponding function + (which is proved correct by induction), from which we then derive the optimized version using + the free theorem, by (conditional) rewriting (without induction).\ + +lemma add\<^sub>O': + "\addO n m\\<^sub>O = add\<^sub>O \n\\<^sub>O \m\\<^sub>O" +proof - + have [simp]: "\addO n m\\<^sub>O = \m\\<^sub>O \n\\<^sub>O S\<^sub>O L\<^sub>O" + by (induct m) simp_all + show ?thesis + by (intro ext) (simp add: freeOrd[where h = "\n. n _ _ _"]) +qed + +lemma mul\<^sub>O': + "\mulO n m\\<^sub>O = mul\<^sub>O \n\\<^sub>O \m\\<^sub>O" +proof - + have [simp]: "\mulO n m\\<^sub>O = \m\\<^sub>O Z\<^sub>O (\m. add\<^sub>O m \n\\<^sub>O) L\<^sub>O" + by (induct m) (simp_all add: add\<^sub>O) + show ?thesis + by (intro ext) (simp add: freeOrd[where h = "\n. n _ _ _"]) +qed + +lemma exp\\<^sub>O': + "\exp\ n\\<^sub>O = exp\\<^sub>O \n\\<^sub>O" +proof - + have [simp]: "\exp\ n\\<^sub>O = \n\\<^sub>O (S\<^sub>O Z\<^sub>O) (\m. mul\<^sub>O m \\<^sub>O) L\<^sub>O" + by (induct n) (simp_all add: mul\<^sub>O \\<^sub>O) + show ?thesis + by (intro ext) (simp add: fun_cong[OF freeOrd[where h = "\n z. n z _ _"]]) +qed + +end \ No newline at end of file diff --git a/thys/Goodstein_Lambda/ROOT b/thys/Goodstein_Lambda/ROOT new file mode 100644 --- /dev/null +++ b/thys/Goodstein_Lambda/ROOT @@ -0,0 +1,12 @@ +chapter AFP + +session Goodstein_Lambda (AFP) = HOL + + +options [timeout = 300] + + theories + Goodstein_Lambda + + document_files + "root.bib" + "root.tex" diff --git a/thys/Goodstein_Lambda/document/root.bib b/thys/Goodstein_Lambda/document/root.bib new file mode 100644 --- /dev/null +++ b/thys/Goodstein_Lambda/document/root.bib @@ -0,0 +1,53 @@ +@article{NMO, + author = {Jasmin Christian Blanchette and Mathias Fleury and + Dmitriy Traytel}, + title = {Formalization of Nested Multisets, Hereditary Multisets, + and Syntactic Ordinals}, + journal = {Archive of Formal Proofs}, + month = nov, + year = 2016, + note = {\url{http://isa-afp.org/entries/Nested_Multisets_Ordinals.html}, + Formal proof development}, + ISSN = {2150-914x}, +} + +@article{C83, + author = "E. A. Cichon", + title = "A short proof of two recently discovered independence results + using recursion theoretic methods", + journal = "Proceedings of the American Mathematical Society", + volume = 87, + volume = 4, + pages = "704--706", + note = "\doi{10.2307/2043364}", + month = apr, + year = 1983 +} + +@article{G44, + author = "R. L. Goodstein", + title = "On the restricted ordinal theorem", + journal = "Journal of Symbolic Logic", + volume = 9, + issue = 2, + pages = "33--41", + note = "\doi{10.2307/2268019}", + year = 1944 +} + +@incollection{T08, + author = "John Tromp", + title = "Binary Lambda Calculus and Combinatory Logic", + booktitle = "Randomness And Complexity, from Leibniz To Chaitin", + editor = "Cristian S. Calude", + publisher = "World Scientific Publishing Company", + pages = "237--260", + month = oct, + year = 2008 +} + +@misc{BLC, + author = "John Tromp", + title = "Binary lambda calculus", + note = "\url{https://tromp.github.io/cl/Binary_lambda_calculus.html}" +} diff --git a/thys/Goodstein_Lambda/document/root.tex b/thys/Goodstein_Lambda/document/root.tex new file mode 100644 --- /dev/null +++ b/thys/Goodstein_Lambda/document/root.tex @@ -0,0 +1,177 @@ +\documentclass[11pt,a4paper]{article} +\usepackage{isabelle,isabellesym} + +\newcommand{\doi}[1]{doi:\href{https://dx.doi.org/#1}{#1}} + +% further packages required for unusual symbols (see also +% isabellesym.sty), use only when needed + +\usepackage{amsmath} + +%\usepackage{amssymb} + %for \, \, \, \, \, \, + %\, \, \, \, \, + %\, \, \ + +%\usepackage{eurosym} + %for \ + +%\usepackage[only,bigsqcap]{stmaryrd} + %for \ + +%\usepackage{eufrak} + %for \ ... \, \ ... \ (also included in amssymb) + +%\usepackage{textcomp} + %for \, \, \, \, \, + %\ + +% this should be the last package used +\usepackage{pdfsetup} + +% urls in roman style, theory text in math-similar italics +\urlstyle{rm} +\isabellestyle{it} + +% for uniform font size +%\renewcommand{\isastyle}{\isastyleminor} + + +\begin{document} + +\title{Implementing the Goodstein Function in $\lambda$-Calculus} +\author{Bertram Felgenhauer} +\maketitle + +\begin{abstract} +In this formalization, we develop an implementation of the Goodstein +function $\mathcal{G}$ in plain $\lambda$-calculus, linked to a +concise, self-contained specification. The implementation works on a +Church-encoded representation of countable ordinals. The initial +conversion to hereditary base $2$ is not covered, but the material is +sufficient to compute the particular value $\mathcal{G}(16)$, and +easily extends to other fixed arguments. +\end{abstract} + +\tableofcontents + +\section{Introduction} + +Given a number $n$ and a base $b$, we can write $n$ in +\emph{hereditary base $b$}, which results from writing $n$ in +base $b$, and then each exponent in hereditary base $b$ again. +For example, $7$ in hereditary base $3$ is $3^1 \cdot 2 + 1$. +Given the hereditary base $b$ representation of $n$, +we can reinterpret it in base $b+1$ +by replacing all occurrences of $b$ by $b+1$. + +The Goodstein sequence starting at $n$ in base $2$ is obtained by +iteratively taking a number in hereditary base $b$, +reinterpreting it in base $b+1$, and subtracting $1$. +The next step is the same with $b$ incremented by $1$, and so on. +So starting for example at $4$, we compute +\begin{align*} +4 = 2^{2^1} +&\:\to\: 3^{3^1} - 1 += 26\\ +26 = 3^2 \cdot 2 + 3^1 \cdot 2 + 2 +&\:\to\: +4^2 \cdot 2 + 4^1 \cdot 2 + 1 \cdot 2 - 1 += 41\\ +41 = +4^2 \cdot 2 + 4^1 \cdot 2 + 1 +&\:\to\: +5^2 \cdot 2 + 5^1 \cdot 2 + 1 - 1 += 60 +\end{align*} +and so on. +We stop when we reach $0$. +Goodstein's theorem states that this process always terminates~\cite{G44}. +This result is independent of Peano Arithmetic, +and is intimately connected to countable ordinals and the +slow growing hierarchy (e.g., the Hardy function)~\cite{C83}. +The length of the resulting sequence is the Goodstein function, +denoted by $\mathcal G(n)$. +For example, $\mathcal G(3) = 6$. + +For this formalization, we are interested in implementing the Goodstein +function in $\lambda$-calculus. +More concretely, we want to define the value $\mathcal G(16)$ +(which is huge; for example, it exceeds Graham's number), +in order to bound its Kolmogorov complexity. +Our concrete measure of Kolmogorov complexity is the program length +in the Binary Lambda Calculus~\cite{BLC,T08}. +It turns out that we can define $\mathcal G(16)$ as follows, +giving a complexity bound of 195 bits. +\begin{align*} +\mathit{exp\omega} &= +(\lambda z\:s\:l.\:n\:s\:(\lambda x\:z.\:l\:(\lambda n.\:n\:x\:z))\: +(\lambda f\:z.\:l\:(\lambda n.\:f\:n\:z))\:z)\\ +\mathit{goodstein} &= (\lambda n\:c.\:n\\ +&\phantom{{}=(}(\lambda x.\:x)\\ +&\phantom{{}=(}(\lambda n\:m.\:n\:(\lambda f\:x.\:m\:f\:(f\:x)))\\ +&\phantom{{}=(}(\lambda f\:m.\:f\:(\lambda f\:x.\:m\:f\:(f\:(f\:x)))\:m)\\ +&\phantom{{}=(}c) +\\ +\mathcal G_{16} &= +(\lambda e.\:\mathit{goodstein}\: +(e\:(e\:(e\:(e\:(\lambda z\:s\:l.\:z)))))\:(\lambda x.\:x))\: +\mathit{exp\omega} +\end{align*} +We rely on a shallow embedding of the $\lambda$-calculus throughout +the formalization, so it turns out that we cannot quite prove this +claim in Isabelle/HOL; the expression for $\mathcal G_{16}$ cannot +be typed. +However, we can prove that the building blocks $\mathit{exp\omega}$ +and $\mathit{goodstein}$ work correctly in the sense that +\begin{itemize} +\item $\mathit{exp\omega}^4\:(\lambda z\:s\:l.\:z)$ + is the hereditary base $2$ representation of $16$; and +\item $\mathit{goodstein}\:c\:n$ computes the length of a Goodstein + sequence given that the hereditary base $c+1$ representation of + the $c$-th value in the sequence is equal to $n$. +\end{itemize} +The remaining steps are easily verified by a human. + +\paragraph{Contributions.} +Our main contributions are a concise specification of the Goodstein function, +another proof of Goodstein's theorem, +and establishing the connection to $\lambda$-calculus as already outlined. + +\paragraph{Related work.} +There is already a formalization of Goodstein's theorem in the +AFP entry on nested multisets~\cite{NMO}, +which comes with a formalization of ordinal arithmetic. +Our focus is different, +since our goal is to obtain an implementation of the Goodstein function +in $\lambda$-calculus. +Most notably, the intermediate type $\mathit{Ord}$ that we use to +represent ordinal numbers has far more structure than the ordinals themselves. +In particular it can represent arbitrary trees; +if we were to compute $\omega + 1$, $1 + \omega$ and $\omega$ on this type, +we would get three different results. +However, we will use the operations such that $1 + \omega$ is never computed, +keeping the connection to countable ordinals intact. +Proving this is a large, albeit hidden, part of our formalization. + +\paragraph{Acknowledgement.} +John Tromp raised the question of a concise $\lambda$-calculus term computing +$\mathcal{G}(16)$. +He also provided feedback on a draft version of this document. + +% sane default for proof documents +\parindent 0pt\parskip 0.5ex + +% generated text of all theories +\input{session} + +% optional bibliography +\bibliographystyle{abbrv} +\bibliography{root} + +\end{document} + +%%% Local Variables: +%%% mode: latex +%%% TeX-master: t +%%% End: diff --git a/thys/Hello_World/HelloWorld.thy b/thys/Hello_World/HelloWorld.thy new file mode 100644 --- /dev/null +++ b/thys/Hello_World/HelloWorld.thy @@ -0,0 +1,56 @@ +theory HelloWorld + imports IO +begin + +section\Hello, World!\ + +text\ + The idea of a \<^term>\main :: unit io\ function is that, upon start of your program, you will be + handed a value of type \<^typ>\\<^url>\. You can pass this world through your code and modify it. + Be careful with the \<^typ>\\<^url>\, it's the only one we have. +\ + + +text\The main function, defined in Isabelle. It should have the right type in Haskell.\ +definition main :: "unit io" where + "main \ do { + _ \ println (STR ''Hello World! What is your name?''); + name \ getLine; + println (STR ''Hello, '' + name + STR ''!'') + }" + + +section\Generating Code\ + +text\Checking that the generated code compiles.\ +export_code main checking Haskell? SML + + +ML_val\Isabelle_System.bash "echo ${ISABELLE_TMP} > ${ISABELLE_TMP}/self"\ +text\ +During the build of this session, the code generated in the following subsections will be +written to +\ +text_raw\\verbatiminput{${ISABELLE_TMP}/self}\ + + +subsection\Haskell\ + +export_code main in Haskell file "$ISABELLE_TMP/exported_hs" + +text\The generated helper module \<^file>\$ISABELLE_TMP/exported_hs/StdIO.hs\ is shown below.\ +text_raw\\verbatiminput{$ISABELLE_TMP/exported_hs/StdIO.hs}\ + +text\The generated main file \<^file>\$ISABELLE_TMP/exported_hs/HelloWorld.hs\ is shown below.\ +text_raw\\verbatiminput{$ISABELLE_TMP/exported_hs/HelloWorld.hs}\ + + +subsection\SML\ + +export_code main in SML file "$ISABELLE_TMP/exported.sml" + +text\The generated SML code in \<^file>\$ISABELLE_TMP/exported.sml\ is shown below.\ +text_raw\\verbatiminput{$ISABELLE_TMP/exported.sml}\ + + +end \ No newline at end of file diff --git a/thys/Hello_World/HelloWorld_Proof.thy b/thys/Hello_World/HelloWorld_Proof.thy new file mode 100644 --- /dev/null +++ b/thys/Hello_World/HelloWorld_Proof.thy @@ -0,0 +1,73 @@ +theory HelloWorld_Proof + imports HelloWorld +begin + +section\Correctness\ + + +subsection\Modeling Input and Output\ + +text\ + With the appropriate assumptions about \<^const>\println\ and \<^const>\getLine\, + we can even prove something. + We summarize our model about input and output in the assumptions of a \<^theory_text>\locale\. +\ +locale io_stdio = + \ \We model \<^verbatim>\STDIN\ and \<^verbatim>\STDOUT\ as part of the \<^typ>\\<^url>\. + Note that we know nothing about \<^typ>\\<^url>\, + we just model that we can find \<^verbatim>\STDIN\ and \<^verbatim>\STDOUT\ somewhere in there.\ + fixes stdout_of::"\<^url> \ string list" + and stdin_of::"\<^url> \ string list" + + \ \Assumptions about \<^verbatim>\STDIN\: + Calling \<^const>\println\ appends to the end of \<^verbatim>\STDOUT\ and \<^const>\getLine\ does not change + anything.\ +assumes stdout_of_println[simp]: + "stdout_of (exec (println str) world) = stdout_of world@[String.explode str]" + and stdout_of_getLine[simp]: + "stdout_of (exec getLine world) = stdout_of world" + + \ \Assumptions about \<^verbatim>\STDIN\: + Calling \<^const>\println\ does not change anything and \<^const>\getLine\ removes the first element + from the \<^verbatim>\STDIN\ stream.\ + and stdin_of_println[simp]: + "stdin_of (exec (println str) world) = stdin_of world" + and stdin_of_getLine: + "stdin_of world = inp#stdin \ + stdin_of (exec getLine world) = stdin \ eval getLine world = String.implode inp" +begin +end + + +subsection\Correctness of Hello World\ + +text\Correctness of \<^const>\main\: + If \<^verbatim>\STDOUT\ is initially empty and only \<^term>\''corny''\ will be typed into \<^verbatim>\STDIN\, + then the program will output: \<^term>\[''Hello World! What is your name?'', ''Hello, corny!'']\. + \ +theorem (in io_stdio) + assumes stdout: "stdout_of world = []" + and stdin: "stdin_of world = [''corny'']" + shows "stdout_of (exec main world) = + [''Hello World! What is your name?'', + ''Hello, corny!'']" +proof - + let ?world1="exec (println (STR ''Hello World! What is your name?'')) world" + have stdout_world2: + "literal.explode STR ''Hello World! What is your name?'' = + ''Hello World! What is your name?''" + by code_simp + from stdin_of_getLine[where stdin="[]", OF stdin] have stdin_world2: + "eval getLine ?world1 = String.implode ''corny''" + by (simp add: stdin_of_getLine stdin) + show ?thesis + unfolding main_def + apply(simp add: exec_bind) + apply(simp add: stdout) + apply(simp add: stdout_world2 stdin_world2) + apply(simp add: plus_literal.rep_eq) + apply code_simp + done +qed + +end \ No newline at end of file diff --git a/thys/Hello_World/IO.thy b/thys/Hello_World/IO.thy new file mode 100644 --- /dev/null +++ b/thys/Hello_World/IO.thy @@ -0,0 +1,272 @@ +theory IO + imports + Main + "HOL-Library.Monad_Syntax" +begin + +section\IO Monad\ +text \ + Inspired by Haskell. + Definitions from \<^url>\https://wiki.haskell.org/IO_inside\ +\ + +subsection\Real World\ +text \ + We model the real world with a fake type. + + WARNING: + Using low-level commands such as \<^theory_text>\typedecl\ instead of high-level \<^theory_text>\datatype\ is dangerous. + We explicitly use a \<^theory_text>\typedecl\ instead of a \<^theory_text>\datatype\ because we never want to instantiate + the world. We don't need a constructor, we just need the type. + + The following models an arbitrary type we cannot reason about. + Don't reason about the complete world! Only write down some assumptions about parts of the world. +\ +typedecl real_world (\\<^url>\) + +text\ + For examples, see \<^file>\HelloWorld_Proof.thy\. + In said theory, we model \<^verbatim>\STDIN\ and \<^verbatim>\STDOUT\ as parts of the world and describe how this part + of the wold can be affected. We don't model the rest of the world. This allows us to reason about + \<^verbatim>\STDIN\ and \<^verbatim>\STDOUT\ as part of the world, but nothing more. +\ + + +subsection\IO Monad\ +text \ + The set of all functions which take a \<^typ>\\<^url>\ and return an \<^typ>\'\\ and a \<^typ>\\<^url>\. + + The rough idea of all IO functions is the following: You are given the world in its current state. + You can do whatever you like to the world. You can produce some value of type \<^typ>\'\\ and you + have to return the modified world. + + For example, the \<^verbatim>\main\ function is Haskell does not produce a value, therefore, \<^verbatim>\main\ in + Haskell is of type \<^verbatim>\IO ()\. Another example in Haskell is \<^verbatim>\getLine\, which returns \<^verbatim>\String\. + It's type in Haskell is \<^verbatim>\IO String\. All those functions may also modify the state of the world. +\ + +typedef '\ io = "UNIV :: (\<^url> \ '\ \ \<^url>) set" +proof - + show "\x. x \ UNIV" by simp +qed + +text \ + Related Work: + \<^emph>\Programming TLS in Isabelle/HOL\ by Andreas Lochbihler and Marc Züst uses a partial function + (\\\). + \<^theory_text>\ + typedecl real_world + typedef '\ io = "UNIV :: (\<^url> \ '\ \ \<^url>) set" by simp + \ + We use a total function. This implies the dangerous assumption that all IO functions are total + (i.e., terminate). +\ + +text \ + The \<^theory_text>\typedef\ above gives us some convenient definitions. + Since the model of \<^typ>\'\ io\ is just a mode, those definitions should not end up in generated + code. +\ +term Abs_io \ \Takes a \<^typ>\(\<^url> \ '\ \ \<^url>)\ and abstracts it to an \<^typ>\'\ io\.\ +term Rep_io \ \Unpacks an \<^typ>\'\ io\ to a \<^typ>\(\<^url> \ '\ \ \<^url>)\\ + + +subsection\Monad Operations\ +text\ + Within an \<^typ>\'\ io\ context, execute \<^term>\action\<^sub>1\ and \<^term>\action\<^sub>2\ sequentially. + The world is passed through and potentially modified by each action. +\ +definition bind :: "'\ io \ ('\ \ '\ io) \ '\ io" where [code del]: + "bind action\<^sub>1 action\<^sub>2 = Abs_io (\world\<^sub>0. + let (a, world\<^sub>1) = (Rep_io action\<^sub>1) world\<^sub>0; + (b, world\<^sub>2) = (Rep_io (action\<^sub>2 a)) world\<^sub>1 + in (b, world\<^sub>2))" + +text \ + In Haskell, the definition for \<^verbatim>\bind\ (\<^verbatim>\>>=\) is: + \<^verbatim>\ + (>>=) :: IO a -> (a -> IO b) -> IO b + (action1 >>= action2) world0 = + let (a, world1) = action1 world0 + (b, world2) = action2 a world1 + in (b, world2) + \ +\ + +hide_const (open) bind +adhoc_overloading bind IO.bind + +text \Thanks to \<^theory_text>\adhoc_overloading\, we can use monad syntax.\ +lemma "bind (foo :: '\ io) (\a. bar a) = foo \ (\a. bar a)" + by simp + + +definition return :: "'\ \ '\ io" where [code del]: + "return a \ Abs_io (\world. (a, world))" + +hide_const (open) return + +text \ + In Haskell, the definition for \<^verbatim>\return\ is:: + \<^verbatim>\ + return :: a -> IO a + return a world0 = (a, world0) + \ +\ + + +subsection\Monad Laws\ +lemma left_id: + fixes f :: "'\ \ '\ io" \ \Make sure we use our \<^const>\IO.bind\.\ + shows "(IO.return a \ f) = f a" + by(simp add: return_def IO.bind_def Abs_io_inverse Rep_io_inverse) + +lemma right_id: + fixes m :: "'\ io" \ \Make sure we use our \<^const>\IO.bind\.\ + shows "(m \ IO.return) = m" + by(simp add: return_def IO.bind_def Abs_io_inverse Rep_io_inverse) + +lemma bind_assoc: + fixes m :: "'\ io" \ \Make sure we use our \<^const>\IO.bind\.\ + shows "((m \ f) \ g) = (m \ (\x. f x \ g))" + by(simp add: IO.bind_def Abs_io_inverse Abs_io_inject fun_eq_iff split: prod.splits) + + +subsection\Code Generator Setup\ +text \ + We don't expose our \<^const>\IO.bind\ definition to code. + We use the built-in definitions of the target language (e.g., Haskell, SML). +\ +code_printing constant IO.bind \ (Haskell) "_ >>= _" + and (SML) "bind" + | constant IO.return \ (Haskell) "return" + and (SML) "(() => _)" + +text\SML does not come with a bind function. We just define it (hopefully correct).\ +code_printing code_module Bind \ (SML) \ +fun bind x f () = f (x ()) (); +\ +code_reserved SML bind return + +text\ + Make sure the code generator does not try to define \<^typ>\'\ io\ by itself, but always uses + the one of the target language. + For Haskell, this is the fully qualified Prelude.IO. + For SML, we wrap it in a nullary function. +\ +code_printing type_constructor io \ (Haskell) "Prelude.IO _" + and (SML) "unit -> _" + + +text\ +In Isabelle, a \<^typ>\string\ is just a type synonym for \<^typ>\char list\. +When translating a \<^typ>\string\ to Haskell, Isabelle does not use Haskell's \<^verbatim>\String\ or +\<^verbatim>\[Prelude.Char]\. Instead, Isabelle serializes its own + \<^verbatim>\data Char = Char Bool Bool Bool Bool Bool Bool Bool Bool\. +The resulting code will look just ugly. + +To use the native strings of Haskell, we use the Isabelle type \<^typ>\String.literal\. +This gets translated to a Haskell \<^verbatim>\String\. + +A string literal in Isabelle is created with \<^term>\STR ''foo'' :: String.literal\. +\ + +text\ + We define IO functions in Isabelle without implementation. + For a proof in Isabelle, we will only describe their externally observable properties. + For code generation, we map those functions to the corresponding function of the target language. + + Our assumption is that our description in Isabelle corresponds to the real behavior of those + functions in the respective target language. + + We use \<^theory_text>\axiomatization\ instead of \<^theory_text>\consts\ to axiomatically define that those functions exist, + but there is no implementation of them. This makes sure that we have to explicitly write down all + our assumptions about their behavior. Currently, no assumptions (apart from their type) can be + made about those functions. +\ +axiomatization + println :: "String.literal \ unit io" and + getLine :: "String.literal io" + +text \A Haskell module named \<^verbatim>\StdIO\ which just implements \<^verbatim>\println\ and \<^verbatim>\getLine\.\ +code_printing code_module StdIO \ (Haskell) \ +module StdIO (println, getLine) where +import qualified Prelude (putStrLn, getLine) +println = Prelude.putStrLn +getLine = Prelude.getLine +\ and (SML) \ +(* Newline behavior in SML is odd.*) +fun println s () = TextIO.print (s ^ "\n"); +fun getLine () = case (TextIO.inputLine TextIO.stdIn) of + SOME s => String.substring (s, 0, String.size s - 1) + | NONE => raise Fail "getLine"; +\ + +code_reserved Haskell StdIO println getLine +code_reserved SML println print getLine TextIO + +text\ + When the code generator sees the functions \<^const>\println\ or \<^const>\getLine\, we tell it to use + our language-specific implementation. + \ +code_printing constant println \ (Haskell) "StdIO.println" + and (SML) "println" + | constant getLine \ (Haskell) "StdIO.getLine" + and (SML) "getLine" + + +text\Monad syntax and \<^const>\println\ examples.\ +lemma "bind (println (STR ''foo'')) + (\_. println (STR ''bar'')) = + println (STR ''foo'') \ (\_. println (STR ''bar''))" + by simp +lemma "do { _ \ println (STR ''foo''); + println (STR ''bar'')} = + println (STR ''foo'') \ (println (STR ''bar''))" + by simp + + + +subsection\Modelling Running an \<^typ>\'\ io\ Function\ +text\ + Apply some function \<^term>\iofun :: '\ io\ to a specific world and return the new world + (discarding the result of \<^term>\iofun\). +\ +definition exec :: "'\ io \ \<^url> \ \<^url>" where + "exec iofun world = snd (Rep_io iofun world)" + +text\Similar, but only get the result.\ +definition eval :: "'\ io \ \<^url> \ '\" where + "eval iofun world = fst (Rep_io iofun world)" + +text\ + Essentially, \<^const>\exec\ and \<^const>\eval\ extract the payload \<^typ>\'\\ and \<^typ>\\<^url>\ + when executing an \<^typ>\'\ io\. +\ +lemma "Abs_io (\world. (eval iofun world, exec iofun world)) = iofun" + by(simp add: exec_def eval_def Rep_io_inverse) + +lemma exec_Abs_io: "exec (Abs_io f) world = snd (f world)" + by(simp add: exec_def Abs_io_inverse) + + +lemma exec_then: + "exec (io\<^sub>1 \ io\<^sub>2) world = exec io\<^sub>2 (exec io\<^sub>1 world)" + and eval_then: + "eval (io\<^sub>1 \ io\<^sub>2) world = eval io\<^sub>2 (exec io\<^sub>1 world)" + by (simp_all add: exec_def eval_def bind_def Abs_io_inverse split_beta) + +lemma exec_bind: + "exec (io\<^sub>1 \ io\<^sub>2) world = exec (io\<^sub>2 (eval io\<^sub>1 world)) (exec io\<^sub>1 world)" + and eval_bind: + "eval (io\<^sub>1 \ io\<^sub>2) world = eval (io\<^sub>2 (eval io\<^sub>1 world)) (exec io\<^sub>1 world)" + by(simp_all add: exec_def eval_def bind_def Abs_io_inverse split_beta) + +lemma exec_return: + "exec (IO.return a) world = world" + and + "eval (IO.return a) world = a" + by (simp_all add: exec_def eval_def Abs_io_inverse return_def) + + +end \ No newline at end of file diff --git a/thys/Hello_World/ROOT b/thys/Hello_World/ROOT new file mode 100644 --- /dev/null +++ b/thys/Hello_World/ROOT @@ -0,0 +1,14 @@ +chapter AFP + +session Hello_World (AFP) = HOL + + options [timeout = 600] + sessions + "HOL-Library" + theories + IO + HelloWorld + HelloWorld_Proof + theories [document = false] + RunningCodeFromIsabelle + document_files + "root.tex" diff --git a/thys/Hello_World/RunningCodeFromIsabelle.thy b/thys/Hello_World/RunningCodeFromIsabelle.thy new file mode 100644 --- /dev/null +++ b/thys/Hello_World/RunningCodeFromIsabelle.thy @@ -0,0 +1,81 @@ +theory RunningCodeFromIsabelle + imports HelloWorld +begin + +section\Running the Generated Code inside Isabelle\ + +(*Maintainer note: We invoke the generated code ON PURPOSE from bash to demonstrate how to use + the generated code from outside Isabelle and make sure the code runs.*) + + +text\ + Usually, one would use \<^theory_text>\export_code\ to generate code. Here, we want to write the code to + a temp directory and execute it right afterwards inside Isablle, so we invoke the code generator + directly from Isabelle/ML. +\ + +subsection\Haskell\ + +ML\ +val (files, _) = + Code_Target.produce_code @{context} false [@{const_name main}] "Haskell" "Main" NONE [] + +val target = File.tmp_path (Path.basic ("export" ^ serial_string ())) + +val ghc = getenv "ISABELLE_GHC"; + +val cmd = + "cd " ^ Path.implode target ^ " && " ^ + Bash.string ghc ^ " Main.hs && " ^ + "( echo 'Cyber Cat 42' | ./Main )"; + +Isabelle_System.mkdirs target; + +app (fn ([file], content) => + let + val path = Path.append target (Path.basic file) + in + File.write path content + end) files; + +val exitcode = + if ghc <> "" then + Isabelle_System.bash cmd + else + (writeln "not running Haskell, because $ISABELLE_GHC is not set."; 0); + +if exitcode <> 0 then + raise (Fail ("example Haskell code did not run as expected, " ^ + "exit code was " ^ (Int.toString exitcode))) +else () +\ + + +subsection\SML\ + +ML\ + +val ([(_, content)], _) = + Code_Target.produce_code @{context} false [@{const_name main}] "SML" "HelloWorld" NONE [] + +val target = File.tmp_path (Path.basic ("export" ^ serial_string ())) +val file = Path.append target (Path.basic "main.ML") + +val cmd = + "echo 'Super Goat 2000' | " ^ + "\"${POLYML_EXE?}\" --use " ^ Path.implode file ^ + " --eval 'HelloWorld.main ()'"; + +Isabelle_System.mkdirs target; +File.write file content; + +val exitcode = Isabelle_System.bash cmd; + +if exitcode <> 0 then + raise (Fail ("example SML code did not run as expected, " ^ + "exit code was " ^ (Int.toString exitcode))) +else () +\ + + +end \ No newline at end of file diff --git a/thys/Hello_World/document/root.tex b/thys/Hello_World/document/root.tex new file mode 100644 --- /dev/null +++ b/thys/Hello_World/document/root.tex @@ -0,0 +1,48 @@ +\documentclass[11pt,a4paper]{article} +\usepackage{isabelle,isabellesym} + +\usepackage{marvosym} % world symbol +\newcommand{\isactrlurl}[0]{\Mundus} + +\usepackage{verbatim} + + +% this should be the last package used +\usepackage{pdfsetup} + +% urls in roman style, theory text in math-similar italics +\urlstyle{rm} +\isabellestyle{it} + + +\begin{document} + +\title{Hello World} +\author{Cornelius Diekmann, Lars Hupel} +\maketitle + +\begin{abstract} +In this article, we present a formalization of the well-known ``Hello, World!'' code, including a formal framework for reasoning about IO. +Our model is inspired by the handling of IO in Haskell. +We start by formalizing the \isactrlurl{} and embrace the IO monad afterwards. +Then we present a sample \verb~main :: IO ()~, followed by its proof of correctness. +\end{abstract} + +\tableofcontents + +% sane default for proof documents +\parindent 0pt\parskip 0.5ex + +% generated text of all theories +\input{session} + +% optional bibliography +%\bibliographystyle{abbrv} +%\bibliography{root} + +\end{document} + +%%% Local Variables: +%%% mode: latex +%%% TeX-master: t +%%% End: diff --git a/thys/ROOTS b/thys/ROOTS --- a/thys/ROOTS +++ b/thys/ROOTS @@ -1,519 +1,525 @@ AODV Auto2_HOL Auto2_Imperative_HOL AVL-Trees AWN Abortable_Linearizable_Modules Abs_Int_ITP2012 Abstract-Hoare-Logics Abstract-Rewriting Abstract_Completeness Abstract_Soundness Adaptive_State_Counting Affine_Arithmetic Aggregation_Algebras Akra_Bazzi Algebraic_Numbers Algebraic_VCs Allen_Calculus Amortized_Complexity AnselmGod Applicative_Lifting Approximation_Algorithms Architectural_Design_Patterns Aristotles_Assertoric_Syllogistic Arith_Prog_Rel_Primes ArrowImpossibilityGS AutoFocus-Stream Automatic_Refinement AxiomaticCategoryTheory BDD BNF_Operations Bell_Numbers_Spivey Berlekamp_Zassenhaus Bernoulli Bertrands_Postulate Bicategory BinarySearchTree Binding_Syntax_Theory Binomial-Heaps Binomial-Queues BNF_CC Bondy Boolean_Expression_Checkers Bounded_Deducibility_Security Buchi_Complementation Budan_Fourier Buffons_Needle Buildings BytecodeLogicJmlTypes C2KA_DistributedSystems CAVA_Automata CAVA_LTL_Modelchecker CCS CISC-Kernel CRDT CYK CakeML CakeML_Codegen Call_Arity Card_Equiv_Relations Card_Multisets Card_Number_Partitions Card_Partitions Cartan_FP Case_Labeling Catalan_Numbers Category Category2 Category3 Cauchy Cayley_Hamilton Certification_Monads Chord_Segments Circus Clean ClockSynchInst Closest_Pair_Points CofGroups Coinductive Coinductive_Languages Collections Comparison_Sort_Lower_Bound Compiling-Exceptions-Correctly Completeness Complete_Non_Orders Complex_Geometry Complx ComponentDependencies ConcurrentGC ConcurrentIMP Concurrent_Ref_Alg Concurrent_Revisions Consensus_Refined Constructive_Cryptography Constructor_Funs Containers CoreC++ Core_DOM Count_Complex_Roots CryptHOL CryptoBasedCompositionalProperties DFS_Framework DPT-SAT-Solver DataRefinementIBP Datatype_Order_Generator Decl_Sem_Fun_PL Decreasing-Diagrams Decreasing-Diagrams-II Deep_Learning Density_Compiler Dependent_SIFUM_Refinement Dependent_SIFUM_Type_Systems Depth-First-Search Derangements Deriving Descartes_Sign_Rule Dict_Construction Differential_Dynamic_Logic Differential_Game_Logic Dijkstra_Shortest_Path Diophantine_Eqns_Lin_Hom Dirichlet_L Dirichlet_Series Discrete_Summation DiscretePricing DiskPaxos DynamicArchitectures Dynamic_Tables E_Transcendental Echelon_Form EdmondsKarp_Maxflow Efficient-Mergesort Elliptic_Curves_Group_Law Encodability_Process_Calculi Epistemic_Logic Ergodic_Theory Error_Function Euler_MacLaurin Euler_Partition Example-Submission Factored_Transition_System_Bounding Farkas FFT FLP FOL-Fitting FOL_Harrison FOL_Seq_Calc1 Falling_Factorial_Sum FeatherweightJava Featherweight_OCL Fermat3_4 FileRefinement FinFun Finger-Trees Finite_Automata_HF First_Order_Terms First_Welfare_Theorem Fishburn_Impossibility Fisher_Yates Flow_Networks Floyd_Warshall Flyspeck-Tame FocusStreamsCaseStudies Formal_SSA Formula_Derivatives Fourier Free-Boolean-Algebra Free-Groups FunWithFunctions FunWithTilings Functional-Automata Functional_Ordered_Resolution_Prover +Furstenberg_Topology GPU_Kernel_PL Gabow_SCC Game_Based_Crypto Gauss-Jordan-Elim-Fun Gauss_Jordan Gauss_Sums GenClock General-Triangle Generalized_Counting_Sort Generic_Deriving Generic_Join GewirthPGCProof Girth_Chromatic GoedelGod +Goodstein_Lambda GraphMarkingIBP Graph_Saturation Graph_Theory Green Groebner_Bases Groebner_Macaulay Gromov_Hyperbolicity Group-Ring-Module HOL-CSP HOLCF-Prelude HRB-Slicing Heard_Of +Hello_World HereditarilyFinite Hermite Hidden_Markov_Models Higher_Order_Terms Hoare_Time HotelKeyCards Huffman Hybrid_Logic Hybrid_Multi_Lane_Spatial_Logic Hybrid_Systems_VCs HyperCTL IEEE_Floating_Point IMAP-CRDT IMO2019 IMP2 IMP2_Binary_Heap IP_Addresses Imperative_Insertion_Sort Impossible_Geometry Incompleteness Incredible_Proof_Machine Inductive_Confidentiality InfPathElimination InformationFlowSlicing InformationFlowSlicing_Inter Integration Interval_Arithmetic_Word32 Iptables_Semantics Irrationality_J_Hancl Isabelle_C Isabelle_Meta_Model Jacobson_Basic_Algebra Jinja JinjaThreads JiveDataStoreModel Jordan_Hoelder Jordan_Normal_Form KAD KAT_and_DRA KBPs KD_Tree Key_Agreement_Strong_Adversaries Kleene_Algebra Knot_Theory Knuth_Morris_Pratt Koenigsberg_Friendship Kruskal Kuratowski_Closure_Complement LLL_Basis_Reduction LLL_Factorization LOFT LTL LTL_to_DRA LTL_to_GBA LTL_Master_Theorem Lam-ml-Normalization LambdaAuth LambdaMu Lambda_Free_KBOs Lambda_Free_RPOs Landau_Symbols Laplace_Transform Latin_Square LatticeProperties Lambda_Free_EPO Launchbury Lazy-Lists-II Lazy_Case Lehmer Lifting_Definition_Option LightweightJava LinearQuantifierElim Linear_Inequalities Linear_Programming Linear_Recurrences Liouville_Numbers List-Index List-Infinite List_Interleaving List_Inversions List_Update LocalLexing Localization_Ring Locally-Nameless-Sigma Lowe_Ontological_Argument Lower_Semicontinuous Lp MFMC_Countable MSO_Regex_Equivalence Markov_Models Marriage Mason_Stothers Matrix Matrix_Tensor Matroids Max-Card-Matching Median_Of_Medians_Selection Menger Mersenne_Primes MFOTL_Monitor MiniML Minimal_SSA Minkowskis_Theorem Minsky_Machines Modal_Logics_for_NTS Modular_Assembly_Kit_Security Monad_Memo_DP Monad_Normalisation MonoBoolTranAlgebra MonoidalCategory Monomorphic_Monad MuchAdoAboutTwo Multirelations Multi_Party_Computation Myhill-Nerode Name_Carrying_Type_Inference Nat-Interval-Logic Native_Word Nested_Multisets_Ordinals Network_Security_Policy_Verification Neumann_Morgenstern_Utility No_FTL_observers Nominal2 Noninterference_CSP Noninterference_Concurrent_Composition Noninterference_Generic_Unwinding Noninterference_Inductive_Unwinding Noninterference_Ipurge_Unwinding Noninterference_Sequential_Composition NormByEval Nullstellensatz Octonions Open_Induction OpSets Optics Optimal_BST Orbit_Stabiliser Order_Lattice_Props Ordered_Resolution_Prover Ordinal Ordinals_and_Cardinals Ordinary_Differential_Equations PCF PLM Pell POPLmark-deBruijn PSemigroupsConvolution Pairing_Heap Paraconsistency Parity_Game Partial_Function_MR Partial_Order_Reduction Password_Authentication_Protocol Perfect-Number-Thm Perron_Frobenius Pi_Calculus Pi_Transcendental Planarity_Certificates Polynomial_Factorization Polynomial_Interpolation Polynomials Poincare_Bendixson Poincare_Disc Pop_Refinement Posix-Lexing Possibilistic_Noninterference Pratt_Certificate Presburger-Automata Prim_Dijkstra_Simple Prime_Distribution_Elementary Prime_Harmonic_Series Prime_Number_Theorem Priority_Queue_Braun Priority_Search_Trees Probabilistic_Noninterference Probabilistic_Prime_Tests Probabilistic_System_Zoo Probabilistic_Timed_Automata Probabilistic_While Projective_Geometry Program-Conflict-Analysis Promela Proof_Strategy_Language PropResPI Propositional_Proof_Systems Prpu_Maxflow PseudoHoops Psi_Calculi Ptolemys_Theorem QHLProver QR_Decomposition Quantales Quaternions Quick_Sort_Cost RIPEMD-160-SPARK ROBDD RSAPSS Ramsey-Infinite Random_BSTs Randomised_BSTs Random_Graph_Subgraph_Threshold Randomised_Social_Choice Rank_Nullity_Theorem Real_Impl Recursion-Theory-I Refine_Imperative_HOL Refine_Monadic RefinementReactive Regex_Equivalence Regular-Sets Regular_Algebras Relation_Algebra +Relational-Incorrectness-Logic Rep_Fin_Groups Residuated_Lattices Resolution_FOL Rewriting_Z Ribbon_Proofs Robbins-Conjecture Root_Balanced_Tree Routing Roy_Floyd_Warshall Safe_OCL SATSolverVerification SDS_Impossibility SIFPL SIFUM_Type_Systems SPARCv8 Secondary_Sylow Security_Protocol_Refinement Selection_Heap_Sort SenSocialChoice Separata Separation_Algebra Separation_Logic_Imperative_HOL SequentInvertibility Shivers-CFA ShortestPath Show Sigma_Commit_Crypto Signature_Groebner Simpl Simple_Firewall Simplex Skew_Heap Skip_Lists Slicing Smooth_Manifolds Sort_Encodings Source_Coding_Theorem Special_Function_Bounds Splay_Tree Sqrt_Babylonian Stable_Matching Statecharts Stellar_Quorums Stern_Brocot Stewart_Apollonius Stirling_Formula Stochastic_Matrices Stone_Algebras Stone_Kleene_Relation_Algebras Stone_Relation_Algebras Store_Buffer_Reduction Stream-Fusion Stream_Fusion_Code Strong_Security Sturm_Sequences Sturm_Tarski Stuttering_Equivalence Subresultants Subset_Boolean_Algebras SumSquares SuperCalc Surprise_Paradox Symmetric_Polynomials Szpilrajn TESL_Language TLA Tail_Recursive_Functions Tarskis_Geometry Taylor_Models Timed_Automata Topology TortoiseHare Transcendence_Series_Hancl_Rucki Transformer_Semantics Transition_Systems_and_Automata Transitive-Closure Transitive-Closure-II Treaps Tree-Automata Tree_Decomposition Triangle Trie Twelvefold_Way Tycon Types_Tableaus_and_Goedels_God Universal_Turing_Machine UPF UPF_Firewall UpDown_Scheme UTP Valuation VectorSpace +VeriComp Verified-Prover VerifyThis2018 VerifyThis2019 Vickrey_Clarke_Groves VolpanoSmith WHATandWHERE_Security WebAssembly Weight_Balanced_Trees Well_Quasi_Orders Winding_Number_Eval +WOOT_Strong_Eventual_Consistency Word_Lib WorkerWrapper XML Zeta_Function Zeta_3_Irrational ZFC_in_HOL pGCL diff --git a/thys/Relational-Incorrectness-Logic/ROOT b/thys/Relational-Incorrectness-Logic/ROOT new file mode 100644 --- /dev/null +++ b/thys/Relational-Incorrectness-Logic/ROOT @@ -0,0 +1,10 @@ +chapter AFP + +session "Relational-Incorrectness-Logic" (AFP) = "HOL-IMP" + + options [timeout = 600] + theories + RelationalIncorrectness + + document_files + "root.bib" + "root.tex" diff --git a/thys/Relational-Incorrectness-Logic/RelationalIncorrectness.thy b/thys/Relational-Incorrectness-Logic/RelationalIncorrectness.thy new file mode 100644 --- /dev/null +++ b/thys/Relational-Incorrectness-Logic/RelationalIncorrectness.thy @@ -0,0 +1,834 @@ +theory RelationalIncorrectness + imports "HOL-IMP.Big_Step" +begin + +(* Author: Toby Murray *) + +section "Under-Approximate Relational Judgement" + +text {* + This is the relational analogue of OHearn's~\cite{OHearn_19} and de Vries \& Koutavas'~\cite{deVries_Koutavas_11} + judgements. + + Note that in our case it doesn't really make sense to talk about ``erroneous'' states: the + presence of an error can be seen only by the violation of a relation. Unlike O'Hearn, we cannot + encode it directly into the semantics of our programs, without giving them a relational semantics. + We use the standard big step semantics of IMP unchanged. +*} + +type_synonym rassn = "state \ state \ bool" + +definition + ir_valid :: "rassn \ com \ com \ rassn \ bool" + where + "ir_valid P c c' Q \ (\ t t'. Q t t' \ (\s s'. P s s' \ (c,s) \ t \ (c',s') \ t'))" + + +section "Rules of the Logic" + +definition + flip :: "rassn \ rassn" + where + "flip P \ \s s'. P s' s" + + +inductive + ir_hoare :: "rassn \ com \ com \ rassn \ bool" + where + ir_Skip: "(\t t'. Q t t' \ \s'. P t s' \ (c',s') \ t') \ + ir_hoare P SKIP c' Q" | + ir_If_True: "ir_hoare (\s s'. P s s' \ bval b s) c\<^sub>1 c' Q \ + ir_hoare P (IF b THEN c\<^sub>1 ELSE c\<^sub>2) c' Q" | + ir_If_False: "ir_hoare (\s s'. P s s' \ \ bval b s) c\<^sub>2 c' Q \ + ir_hoare P (IF b THEN c\<^sub>1 ELSE c\<^sub>2) c' Q" | + ir_Seq1: "ir_hoare P c c' Q \ ir_hoare Q d SKIP R \ ir_hoare P (Seq c d) c' R" | + ir_Assign: "ir_hoare (\t t'. \ v. P (t(x := v)) t' \ (t x) = aval e (t(x := v))) SKIP c' Q \ + ir_hoare P (Assign x e) c' Q" | + ir_While_False: "ir_hoare (\s s'. P s s' \ \ bval b s) SKIP c' Q \ + ir_hoare P (WHILE b DO c) c' Q" | + ir_While_True: "ir_hoare (\s s'. P s s' \ bval b s) (c;; WHILE b DO c) c' Q \ + ir_hoare P (WHILE b DO c) c' Q" | + ir_While_backwards_frontier: "(\n. ir_hoare (\ s s'. P n s s' \ bval b s) c SKIP (P (Suc n))) \ + ir_hoare (\s s'. \n. P n s s') (WHILE b DO c) c' Q \ + ir_hoare (P 0) (WHILE b DO c) c' Q" | + ir_conseq: "ir_hoare P c c' Q \ (\s s'. P s s' \ P' s s') \ (\s s'. Q' s s' \ Q s s') \ + ir_hoare P' c c' Q'" | + ir_disj: "ir_hoare P\<^sub>1 c c' Q\<^sub>1 \ ir_hoare P\<^sub>2 c c' Q\<^sub>2 \ + ir_hoare (\s s'. P\<^sub>1 s s' \ P\<^sub>2 s s') c c' (\ t t'. Q\<^sub>1 t t' \ Q\<^sub>2 t t')" | + ir_sym: "ir_hoare (flip P) c c' (flip Q) \ ir_hoare P c' c Q" + +section "Simple Derived Rules" + +lemma meh_simp[simp]: "(SKIP, s') \ t' = (s' = t')" + by auto + + +lemma ir_pre: "ir_hoare P c c' Q \ (\s s'. P s s' \ P' s s') \ + ir_hoare P' c c' Q" + by(erule ir_conseq, blast+) + +lemma ir_post: "ir_hoare P c c' Q \ (\s s'. Q' s s' \ Q s s') \ + ir_hoare P c c' Q'" + by(erule ir_conseq, blast+) + +section "Soundness" + +lemma Skip_ir_valid[intro]: + "(\t t'. Q t t' \ \s'. P t s' \ (c', s') \ t') \ ir_valid P SKIP c' Q" + by(auto simp: ir_valid_def) + +lemma sym_ir_valid[intro]: + "ir_valid (flip P) c' c (flip Q) \ ir_valid P c c' Q" + by(fastforce simp: ir_valid_def flip_def) + +lemma If_True_ir_valid[intro]: + "ir_valid (\a c. P a c \ bval b a) c\<^sub>1 c' Q \ + ir_valid P (IF b THEN c\<^sub>1 ELSE c\<^sub>2) c' Q" + by(fastforce simp: ir_valid_def) + +lemma If_False_ir_valid[intro]: + "ir_valid (\a c. P a c \ \ bval b a) c\<^sub>2 c' Q \ + ir_valid P (IF b THEN c\<^sub>1 ELSE c\<^sub>2) c' Q" + by(fastforce simp: ir_valid_def) + +lemma Seq1_ir_valid[intro]: + "ir_valid P c c' Q \ ir_valid Q d SKIP R \ ir_valid P (c;; d) c' R" + by(fastforce simp: ir_valid_def) + +lemma Seq2_ir_valid[intro]: + "ir_valid P c SKIP Q \ ir_valid Q d c' R \ ir_valid P (c;; d) c' R" + by(fastforce simp: ir_valid_def) + +lemma Seq_ir_valid[intro]: + "ir_valid P c c' Q \ ir_valid Q d d' R \ ir_valid P (c;; d) (c';; d') R" + by(fastforce simp: ir_valid_def) + +lemma Assign_blah[intro]: + "t x = aval e (t(x := v)) + \ (x ::= e, t(x := v)) \ t" + using Assign + by (metis fun_upd_triv fun_upd_upd) + +lemma Assign_ir_valid[intro]: + "ir_valid (\t t'. \ v. P (t(x := v)) t' \ (t x) = aval e (t(x := v))) SKIP c' Q \ ir_valid P (Assign x e) c' Q" + by(fastforce simp: ir_valid_def) + +lemma While_False_ir_valid[intro]: + "ir_valid (\s s'. P s s' \ \ bval b s) SKIP c' Q \ + ir_valid P (WHILE b DO c) c' Q" + by(fastforce simp: ir_valid_def) + +lemma While_True_ir_valid[intro]: + "ir_valid (\s s'. P s s' \ bval b s) (Seq c (WHILE b DO c)) c' Q \ + ir_valid P (WHILE b DO c) c' Q" + by(clarsimp simp: ir_valid_def, blast) + + +lemma While_backwards_frontier_ir_valid': + assumes asm: "\n. \t t'. P (k + Suc n) t t' \ + (\s. P (k + n) s t' \ bval b s \ (c, s) \ t)" + assumes last: "\t t'. Q t t' \ (\s s'. (\n. P (k + n) s s') \ (WHILE b DO c, s) \ t \ (c', s') \ t')" + assumes post: "Q t t'" + shows "\s s'. P k s s' \ (WHILE b DO c, s) \ t \ (c', s') \ t'" +proof - + from post last obtain s s' n where + "P (k + n) s s'" "(WHILE b DO c, s) \ t" "(c', s') \ t'" + by blast + with asm show ?thesis + proof(induction n arbitrary: k t t') + case 0 + then show ?case + by (metis WhileFalse WhileTrue add.right_neutral) + next + case (Suc n) + from Suc + obtain r r' where final_iteration: "P (Suc k) r r'" "(WHILE b DO c, r) \ t" "(c', r') \ t'" + by (metis add_Suc_shift) + from final_iteration(1) obtain q q' where + "P k q r' \ bval b q \ (c, q) \ r" + by (metis Nat.add_0_right Suc.prems(1) plus_1_eq_Suc semiring_normalization_rules(24)) + with final_iteration show ?case by blast + qed +qed + + +lemma While_backwards_frontier_ir_valid[intro]: + "(\n. ir_valid (\ s s'. P n s s' \ bval b s) c SKIP (P (Suc n))) \ + ir_valid (\s s'. \n. P n s s') (WHILE b DO c) c' Q \ + ir_valid (P 0) (WHILE b DO c) c' Q" + by(auto simp: meh_simp ir_valid_def intro: While_backwards_frontier_ir_valid') + +lemma conseq_ir_valid: + "ir_valid P c c' Q \ (\s s'. P s s' \ P' s s') \ (\s s'. Q' s s' \ Q s s') \ + ir_valid P' c c' Q'" + by(clarsimp simp: ir_valid_def, blast) + +lemma disj_ir_valid[intro]: + "ir_valid P\<^sub>1 c c' Q\<^sub>1 \ ir_valid P\<^sub>2 c c' Q\<^sub>2 \ + ir_valid (\s s'. P\<^sub>1 s s' \ P\<^sub>2 s s') c c' (\ t t'. Q\<^sub>1 t t' \ Q\<^sub>2 t t')" + by(fastforce simp: ir_valid_def) + + +theorem soundness: + "ir_hoare P c c' Q \ ir_valid P c c' Q" + apply(induction rule: ir_hoare.induct) + apply(blast intro!: Skip_ir_valid) + by (blast intro: conseq_ir_valid)+ + +section "Completeness" + +lemma ir_Skip_Skip[intro]: + "ir_hoare P SKIP SKIP P" + by(rule ir_Skip, simp) + +lemma ir_hoare_Skip_Skip[simp]: + "ir_hoare P SKIP SKIP Q = (\s s'. Q s s' \ P s s')" + using soundness ir_valid_def meh_simp ir_conseq ir_Skip by metis + +lemma ir_valid_Seq1: + "ir_valid P (c1;; c2) c' Q \ ir_valid P c1 c' (\t t'. \s s'. P s s' \ (c1,s) \ t \ (c',s') \ t' \ (\u. (c2,t) \ u \ Q u t'))" + by(auto simp: ir_valid_def) + +lemma ir_valid_Seq1': + "ir_valid P (c1;; c2) c' Q \ ir_valid (\t t'. \s s'. P s s' \ (c1,s) \ t \ (c',s') \ t' \ (\u. (c2,t) \ u \ Q u t')) c2 SKIP Q" + by(clarsimp simp: ir_valid_def, meson SeqE) + +lemma ir_valid_track_history: + "ir_valid P c c' Q \ + ir_valid P c c' (\t t'. Q s s' \ (\s s'. P s s' \ (c,s) \ t \ (c',s') \ t'))" + by(auto simp: ir_valid_def) + +lemma ir_valid_If: + "ir_valid (\s s'. P s s') (IF b THEN c1 ELSE c2) c' Q \ + ir_valid (\s s'. P s s' \ bval b s) c1 c' (\t t'. Q t t' \ (\s s'. P s s' \ (c1,s) \ t \ (c',s') \ t' \ bval b s)) \ + ir_valid (\s s'. P s s' \ \ bval b s) c2 c' (\t t'. Q t t' \ (\s s'. P s s' \ (c2,s) \ t \ (c',s') \ t' \ \ bval b s))" + by(clarsimp simp: ir_valid_def, blast) + +text {* + Inspired by the + ``@{text "p(n) = {\ | you can get back from \ to some state in p by executing C backwards n times}"}'' + part of OHearn~\cite{OHearn_19}. +*} +primrec get_back where + "get_back P b c 0 = (\t t'. P t t')" | + "get_back P b c (Suc n) = (\t t'. \s. (c,s) \ t \ bval b s \ get_back P b c n s t')" + +(* Currently not used anywhere *) +lemma ir_valid_get_back: + "ir_valid (get_back P b c (Suc k)) (WHILE b DO c) c' Q \ + ir_valid (get_back P b c k) (WHILE b DO c) c' Q" +proof(induct k) + case 0 + then show ?case by(clarsimp simp: ir_valid_def, blast) +next + case (Suc k) + then show ?case using WhileTrue get_back.simps(2) ir_valid_def by smt +qed + +(* both this an the next one get used in the completeness proof *) +lemma ir_valid_While1: + "ir_valid (get_back P b c k) (WHILE b DO c) c' Q \ + (ir_valid (\s s'. get_back P b c k s s' \ bval b s) c SKIP (\t t'. get_back P b c (Suc k) t t' \ (\u u'. (WHILE b DO c,t) \ u \ (c',t') \ u' \ Q u u')))" +proof (subst ir_valid_def, clarsimp) + fix t t' s u u' + assume "ir_valid (get_back P b c k) (WHILE b DO c) c' Q" + "(WHILE b DO c, t) \ u" + "(c, s) \ t" + "(c', t') \ u'" + "Q u u'" + "bval b s" + "get_back P b c k s t'" + thus "\s. get_back P b c k s t' \ bval b s \ (c, s) \ t" + proof(induction k arbitrary: t t' s u u') + case 0 + then show ?case + by auto + next + case (Suc k) + show ?case + using Suc.prems(3) Suc.prems(6) Suc.prems(7) by blast + qed +qed + +lemma ir_valid_While3: + "ir_valid (get_back P b c k) (WHILE b DO c) c' Q \ + (ir_valid (\s s'. get_back P b c k s s' \ bval b s) c c' (\t t'. (\s'. (c',s') \ t' \ get_back P b c (Suc k) t s' \ (\u. (WHILE b DO c,t) \ u \ Q u t'))))" + apply(subst ir_valid_def, clarsimp) +proof - + fix t t' s' s u + assume "ir_valid (get_back P b c k) (WHILE b DO c) c' Q" + "(WHILE b DO c, t) \ u" + "(c, s) \ t" + "(c', s') \ t'" + "Q u t'" + "bval b s" + "get_back P b c k s s'" + thus "\s s'. get_back P b c k s s' \ bval b s \ (c, s) \ t \ (c',s') \ t'" + proof(induction k arbitrary: t t' s' s u) + case 0 + then show ?case + by auto + next + case (Suc k) + show ?case + using Suc.prems(3) Suc.prems(4) Suc.prems(6) Suc.prems(7) by blast + qed +qed + +(* not used anywhere *) +lemma ir_valid_While2: + "ir_valid P (WHILE b DO c) c' Q \ + ir_valid (\s s'. P s s' \ \ bval b s) SKIP c' (\t t'. Q t t' \ (\s'. (c',s') \ t' \ P t s' \ \ bval b t))" + by(clarsimp simp: ir_valid_def, blast) + +lemma assign_upd_blah: + "(\a. if a = x1 then s x1 else (s(x1 := aval x2 s)) a) = s" + by(rule ext, auto) + +lemma Assign_complete: + assumes v: "ir_valid P (x1 ::= x2) c' Q" + assumes q: "Q t t'" + shows "\s'. (\v. P (t(x1 := v)) s' \ t x1 = aval x2 (t(x1 := v))) \ (c', s') \ t'" +proof - + from v and q obtain s s' where a: "P s s' \ (x1 ::= x2,s) \ t \ (c',s') \ t'" + using ir_valid_def by smt + hence "P (\a. if a = x1 then s x1 else (s(x1 := aval x2 s)) a) s' \ aval x2 s = aval x2 (s(x1 := s x1))" + using assign_upd_blah + by simp + thus ?thesis + using assign_upd_blah a + by (metis AssignE fun_upd_same fun_upd_triv fun_upd_upd) +qed + +lemmas ir_Skip_sym = ir_sym[OF ir_Skip, simplified flip_def] + +theorem completeness: + "ir_valid P c c' Q \ ir_hoare P c c' Q" +proof(induct c arbitrary: P c' Q) +case SKIP + show ?case + apply(rule ir_Skip) + using SKIP by(fastforce simp: ir_valid_def) +next + case (Assign x1 x2) + show ?case + apply(rule ir_Assign) + apply(rule ir_Skip) + using Assign_complete Assign by blast +next + case (Seq c1 c2) + have a: "ir_hoare P c1 c' (\t t'. \s s'. P s s' \ (c1, s) \ t \ (c', s') \ t' \ (\u. (c2, t) \ u \ Q u t'))" + using ir_valid_Seq1 Seq by blast + show ?case + apply(rule ir_Seq1) + apply (blast intro: a) + apply(rule ir_Skip_sym) + by(metis SeqE ir_valid_def Seq) +next + case (If x1 c1 c2) + have t: "ir_hoare (\s s'. P s s' \ bval x1 s) c1 c' + (\t t'. Q t t' \ (\s s'. P s s' \ (c1, s) \ t \ (c', s') \ t' \ bval x1 s))" and + f: " ir_hoare (\s s'. P s s' \ \ bval x1 s) c2 c' + (\t t'. Q t t' \ (\s s'. P s s' \ (c2, s) \ t \ (c', s') \ t' \ \ bval x1 s))" + using ir_valid_If If by blast+ + show ?case + (* consider both cases of the if via conseq, disj, then _True and _False *) + apply(rule ir_conseq) + apply(rule ir_disj) + apply(rule ir_If_True,fastforce intro: t) + apply(rule ir_If_False, fastforce intro: f) + apply blast + by (smt IfE ir_valid_def If) +next + case (While x1 c) + have a: "\n. ir_hoare (\s s'. get_back P x1 c n s s' \ bval x1 s) c SKIP (get_back P x1 c (Suc n))" + using ir_valid_While1 While + by (smt get_back.simps(2) ir_valid_def meh_simp) + have b: "ir_hoare (\s s'. P s s' \ bval x1 s) c c' + (\t t'. \s'. (c', s') \ t' \ (\s. (c, s) \ t \ bval x1 s \ P s s') \ + (\u. (WHILE x1 DO c, t) \ u \ Q u t'))" + using ir_valid_While3[where k=0,simplified] While by blast + have gb: "\t t'. Q t t' \ (\s'. (c', s') \ t' \ P t s' \ \ bval x1 t) \ + \s'. ((\n. get_back P x1 c n t s') \ \ bval x1 t) \ (c', s') \ t'" + by (meson get_back.simps(1)) + + show ?case + (* use the frontier rule much as in OHearn POPL *) + apply(rule ir_conseq) + apply(rule_tac P="get_back P x1 c" in ir_While_backwards_frontier) + apply(blast intro: a) + (* consider both cases of the While via conseq, disj, then _True and _False *) + apply(rule ir_conseq) + apply(rule ir_disj) + apply(rule_tac P="\s s'. \n. get_back P x1 c n s s'" and Q="(\t t'. Q t t' \ (\s'. (c', s') \ t' \ P t s' \ \ bval x1 t))" in ir_While_False) + apply(rule ir_Skip, blast intro: gb) + apply(rule ir_While_True) + apply(rule ir_Seq1[OF b]) + apply(rule ir_Skip_sym) + apply(fastforce) + apply (metis get_back.simps(1)) + apply assumption + apply simp + by (metis While.prems WhileE ir_valid_def) +qed + + + + +section "A Decomposition Principle: Proofs via Under-Approximate Hoare Logic" + +text {* + We show the under-approximate analogue holds for Beringer's~\cite{Beringer_11} decomposition + principle for over-approximate relational logic. +*} + + +definition + decomp :: "rassn \ com \ com \ rassn \ rassn" where + "decomp P c c' Q \ \t s'. \s t'. P s s' \ (c,s) \ t \ (c',s') \ t' \ Q t t'" + + +lemma ir_valid_decomp1: + "ir_valid P c c' Q \ ir_valid P c SKIP (decomp P c c' Q) \ ir_valid (decomp P c c' Q) SKIP c' Q" + by(fastforce simp: ir_valid_def meh_simp decomp_def) + +lemma ir_valid_decomp2: + "ir_valid P c SKIP R \ ir_valid R SKIP c' Q \ ir_valid P c c' Q" + by(fastforce simp: ir_valid_def meh_simp decomp_def) + +lemma ir_valid_decomp: + "ir_valid P c c' Q = (ir_valid P c SKIP (decomp P c c' Q) \ ir_valid (decomp P c c' Q) SKIP c' Q)" + using ir_valid_decomp1 ir_valid_decomp2 by blast + +text {* + Completeness with soundness means we can prove proof rules about @{term ir_hoare} in terms + of @{term ir_valid}. +*} + +lemma ir_to_Skip: + "ir_hoare P c c' Q = (ir_hoare P c SKIP (decomp P c c' Q) \ ir_hoare (decomp P c c' Q) SKIP c' Q)" + using soundness completeness ir_valid_decomp + by meson + +text {* + O'Hearn's under-approximate Hoare triple, for the ``ok'' case (since that is the only case we have) + This is also likely the same as from the "Reverse Hoare Logic" paper (SEFM). +*} +type_synonym assn = "state \ bool" +definition + ohearn :: "assn \ com \ assn \ bool" + where + "ohearn P c Q \ (\t. Q t \ (\s. P s \ (c,s) \ t))" + +lemma fold_ohearn1: + "ir_valid P c SKIP Q = (\t'. ohearn (\t. P t t') c (\t. Q t t'))" + by(fastforce simp add: ir_valid_def ohearn_def) + +lemma fold_ohearn2: + "ir_valid P SKIP c' Q = (\t. ohearn (P t) c' (Q t))" + by(simp add: ir_valid_def ohearn_def) + +theorem relational_via_hoare: + "ir_hoare P c c' Q = ((\t'. ohearn (\t. P t t') c (\t. decomp P c c' Q t t')) \ (\t. ohearn (decomp P c c' Q t) c' (Q t)))" +proof - + have a: "\P c c' Q. ir_hoare P c c' Q = ir_valid P c c' Q" + using soundness completeness by auto + show ?thesis + using ir_to_Skip a fold_ohearn1 fold_ohearn2 by metis +qed + +section "Deriving Proof Rules from Completeness" + +text {* + Note that we can more easily derive proof rules sometimes by appealing to the + corresponding properties of @{term ir_valid} than from the proof rules directly. + + We see more examples of this later on when we consider examples. +*} + +lemma ir_Seq2: + "ir_hoare P c SKIP Q \ ir_hoare Q d c' R \ ir_hoare P (Seq c d) c' R" + using soundness completeness Seq2_ir_valid by metis + +lemma ir_Seq: + "ir_hoare P c c' Q \ ir_hoare Q d d' R \ ir_hoare P (Seq c d) (Seq c' d') R" + using soundness completeness Seq_ir_valid by metis + +section "Examples" + +subsection "Some Derived Proof Rules" + +text {* +First derive some proof rules -- here not by appealing to completeness but just using +the existing rules +*} + +lemma ir_If_True_False: + "ir_hoare (\s s'. P s s' \ bval b s \ \ bval b' s') c\<^sub>1 c\<^sub>2' Q \ + ir_hoare P (IF b THEN c\<^sub>1 ELSE c\<^sub>2) (IF b' THEN c\<^sub>1' ELSE c\<^sub>2') Q" + apply(rule ir_If_True) + apply(rule ir_sym) + apply(rule ir_If_False) + apply(rule ir_sym) + by(simp add: flip_def) + + +lemma ir_Assign_Assign: + "ir_hoare P (x ::= e) (x' ::= e') (\t t'. \v v'. P (t(x := v)) (t'(x' := v')) \ t x = aval e (t(x := v)) \ t' x' = aval e' (t'(x' := v')))" + apply(rule ir_Assign) + apply(rule ir_sym) + apply(rule ir_Assign) + by(simp add: flip_def, auto) + +subsection "prog1" + +text {* + A tiny insecure program. Note that we only need to reason on one path through this program to + detect that it is insecure. +*} + +abbreviation low_eq :: rassn where "low_eq s s' \ s ''low'' = s' ''low''" +abbreviation low_neq :: rassn where "low_neq s s' \ \ low_eq s s'" +definition prog1 :: com where + "prog1 \ (IF (Less (N 0) (V ''x'')) THEN (Assign ''low'' (N 1)) ELSE (Assign ''low'' (N 0)))" + +text {* + We prove that @{term prog1} is definitely insecure. To do that, we need to find some non-empty + post-relation that implies insecurity. The following property encodes the idea that the + post-relation is non-empty, i.e. represents a feasible pair of execution paths. +*} +definition + nontrivial :: "rassn \ bool" + where + "nontrivial Q \ (\t t'. Q t t')" + +text {* + Note the property we prove here explicitly encodes the fact that the postcondition can be anything + that implies insecurity, i.e. implies @{term low_neq}. In particular we should not necessarily + expect it to cover the entirely of all states that satisfy @{term low_neq}. + + Also note that we also have to prove that the postcondition is non-trivial. This is necessary to + make sure that the violation we find is not an infeasible path. +*} +lemma prog1: + "\Q. ir_hoare low_eq prog1 prog1 Q \ (\s s'. Q s s' \ low_neq s s') \ nontrivial Q" + apply(rule exI) + apply(rule conjI) + apply(simp add: prog1_def) + apply(rule ir_If_True_False) + apply(rule ir_Assign_Assign) + apply(rule conjI) + apply auto[1] + apply(clarsimp simp: nontrivial_def) + apply(rule_tac x="\v. 1" in exI) + apply simp + apply(rule_tac x="\v. 0" in exI) + by auto + +subsection "More Derived Proof Rules for Examples" + +definition BEq :: "aexp \ aexp \ bexp" where + "BEq a b \ And (Less a (Plus b (N 1))) (Less b (Plus a (N 1)))" + + +lemma BEq_aval[simp]: + "bval (BEq a b) s = ((aval a s) = (aval b s))" + by(auto simp add: BEq_def) + +lemma ir_If_True_True: + "ir_hoare (\s s'. P s s' \ bval b s \ bval b' s') c\<^sub>1 c\<^sub>1' Q\<^sub>1 \ + ir_hoare P (IF b THEN c\<^sub>1 ELSE c\<^sub>2) (IF b' THEN c\<^sub>1' ELSE c\<^sub>2') (\t t'. Q\<^sub>1 t t')" + by(simp add: ir_If_True ir_sym flip_def) + +lemma ir_If_False_False: + "ir_hoare (\s s'. P s s' \ \ bval b s \ \ bval b' s') c\<^sub>2 c\<^sub>2' Q\<^sub>2 \ + ir_hoare P (IF b THEN c\<^sub>1 ELSE c\<^sub>2) (IF b' THEN c\<^sub>1' ELSE c\<^sub>2') (\t t'. Q\<^sub>2 t t')" + by(simp add: ir_If_False ir_sym flip_def) + +lemma ir_If': + "ir_hoare (\s s'. P s s' \ bval b s \ bval b' s') c\<^sub>1 c\<^sub>1' Q\<^sub>1 \ + ir_hoare (\s s'. P s s' \ \ bval b s \ \ bval b' s') c\<^sub>2 c\<^sub>2' Q\<^sub>2 \ + ir_hoare P (IF b THEN c\<^sub>1 ELSE c\<^sub>2) (IF b' THEN c\<^sub>1' ELSE c\<^sub>2') (\t t'. Q\<^sub>1 t t' \ Q\<^sub>2 t t')" + apply(rule ir_pre) + apply(rule ir_disj) + apply(rule ir_If_True_True) + apply assumption + apply(rule ir_If_False_False) + apply assumption + apply blast + done + +lemma ir_While_triv: + "ir_hoare (\s s'. P s s' \ \ bval b s \ \ bval b' s') SKIP SKIP Q\<^sub>2 \ + ir_hoare P (WHILE b DO c) (WHILE b' DO c') (\s s'. (Q\<^sub>2 s s'))" + by(simp add: ir_While_False ir_sym flip_def) + +lemma ir_While': + "ir_hoare (\s s'. P s s' \ bval b s \ bval b' s') (c;;WHILE b DO c) (c';;WHILE b' DO c') Q\<^sub>1 \ + ir_hoare (\s s'. P s s' \ \ bval b s \ \ bval b' s') SKIP SKIP Q\<^sub>2 \ + ir_hoare P (WHILE b DO c) (WHILE b' DO c') (\s s'. (Q\<^sub>1 s s' \ Q\<^sub>2 s s'))" + apply(rule ir_pre) + apply(rule ir_disj) + apply(rule ir_While_True) + apply(rule ir_sym) + apply(simp add: flip_def) + apply(rule ir_While_True) + apply(rule ir_sym) + apply(simp add: flip_def) + apply(rule ir_While_triv) + apply assumption + apply simp + done + +subsection "client0" + +definition low_eq_strong where + "low_eq_strong s s' \ (s ''high'' \ s' ''high'') \ low_eq s s'" + +lemma low_eq_strong_upd[simp]: + "var \ ''high'' \ var \ ''low'' \ low_eq_strong(s(var := v)) (s'(var := v')) = low_eq_strong s s'" + by(auto simp: low_eq_strong_def) + +text {* + A variation on client0 from O'Hearn~\cite{OHearn_19}: how to reason about loops via a single unfolding +*} +definition client0 :: com where + "client0 \ (Assign ''x'' (N 0);; + (While (Less (N 0) (V ''n'')) + ((Assign ''x'' (Plus (V ''x'') (V ''n'')));; + (Assign ''n'' (V ''nondet''))));; + (If (BEq (V ''x'') (N 2000000)) (Assign ''low'' (V ''high'')) SKIP))" + + + +lemma client0: + "\Q. ir_hoare low_eq client0 client0 Q \ (\s s'. Q s s' \ low_neq s s') \ nontrivial Q" + apply(rule exI, rule conjI, simp add: client0_def) + apply(rule_tac P=low_eq_strong in ir_pre) + apply(rule ir_Seq) + apply(rule ir_Seq) + apply(rule ir_Assign_Assign) + apply clarsimp + + apply(rule ir_While') + apply clarsimp + + apply(rule ir_Seq) + apply(rule ir_Seq) + apply(rule ir_Assign_Assign) + apply(rule ir_Assign_Assign) + apply clarsimp + + apply(rule ir_While_triv) + apply clarsimp + apply assumption + + apply clarsimp + apply assumption + + + apply(rule ir_If_True_True) + apply(rule ir_Assign_Assign) + apply(fastforce simp: low_eq_strong_def) + apply(rule conjI) + apply(clarsimp simp: low_eq_strong_def split: if_splits) + + (* ugh having to manually do constraint solving here... *) + apply(clarsimp simp: low_eq_strong_def nontrivial_def) + apply(rule_tac x="\v. if v = ''x'' then 2000000 else if v = ''high'' then 1 else if v = ''n'' then -1 else if v = ''nondet'' then -1 else if v = ''low'' then 1 else undefined" in exI) + apply(rule_tac x="\v. if v = ''x'' then 2000000 else if v = ''high'' then 0 else if v = ''n'' then -1 else if v = ''nondet'' then -1 else if v = ''low'' then 0 else undefined" in exI) + apply clarsimp + done + +(* Not needed? *) +lemma ir_While_backwards: + "(\n. ir_hoare (\ s s'. P n s s' \ bval b s) c SKIP (P (Suc n))) \ + ir_hoare (\s s'. \n. P n s s' \ \ bval b s) SKIP c' Q \ + ir_hoare (P 0) (WHILE b DO c) c' Q" + apply(rule ir_While_backwards_frontier) + apply assumption + apply(rule ir_While_False) + apply auto + done + +subsection "Derive a variant of the backwards variant rule" + +text {* Here we appeal to completeness again to derive this rule from the corresponding + property about @{term ir_valid}. *} + +subsection "A variant of the frontier rule" + +text {* + Agin we derive this rule by appealing to completeness and the corresponding property of + @{term ir_valid} +*} + +lemma While_backwards_frontier_both_ir_valid': + assumes asm: "\n. \t t'. P (k + Suc n) t t' \ + (\s s'. P (k + n) s s' \ bval b s \ bval b' s' \ (c, s) \ t \ (c', s') \ t')" + assumes last: "\t t'. Q t t' \ (\s s'. (\n. P (k + n) s s') \ (WHILE b DO c, s) \ t \ (WHILE b' DO c', s') \ t')" + assumes post: "Q t t'" + shows "\s s'. P k s s' \ (WHILE b DO c, s) \ t \ (WHILE b' DO c', s') \ t'" +proof - + from post last obtain s s' n where + "P (k + n) s s'" "(WHILE b DO c, s) \ t" "(WHILE b' DO c', s') \ t'" + by blast + with asm show ?thesis + proof(induction n arbitrary: k t t') + case 0 + then show ?case + by (metis WhileFalse WhileTrue add.right_neutral) + next + case (Suc n) + from Suc + obtain r r' where final_iteration: "P (Suc k) r r'" "(WHILE b DO c, r) \ t" "(WHILE b' DO c', r') \ t'" + by (metis add_Suc_shift) + from final_iteration(1) obtain q q' where + "P k q q' \ bval b q \ bval b' q' \ (c, q) \ r \ (c', q') \ r'" + by (metis Nat.add_0_right Suc.prems(1) plus_1_eq_Suc semiring_normalization_rules(24)) + with final_iteration show ?case by blast + qed +qed + +lemma While_backwards_frontier_both_ir_valid[intro]: + "(\n. ir_valid (\ s s'. P n s s' \ bval b s \ bval b' s') c c' (P (Suc n))) \ + ir_valid (\s s'. \n. P n s s') (WHILE b DO c) (WHILE b' DO c') Q \ + ir_valid (P 0) (WHILE b DO c) (WHILE b' DO c') (\s s'. Q s s')" + by(auto simp: ir_valid_def intro: While_backwards_frontier_both_ir_valid') + +lemma ir_While_backwards_frontier_both: + "\\n. ir_hoare (\s s'. P n s s' \ bval b s \ bval b' s') c c' (P (Suc n)); + ir_hoare (\s s'. \n. P n s s') (WHILE b DO c) (WHILE b' DO c') Q\ + \ ir_hoare (P 0) (WHILE b DO c) (WHILE b' DO c') (\s s'. Q s s')" + using soundness completeness While_backwards_frontier_both_ir_valid by auto + +text {* + The following rule then follows easily as a special case +*} +lemma ir_While_backwards_both: + "(\n. ir_hoare (\ s s'. P n s s' \ bval b s \ bval b' s') c c' (P (Suc n))) \ + ir_hoare (P 0) (WHILE b DO c) (WHILE b' DO c') (\s s'. \n. P n s s' \ \ bval b s \ \ bval b' s')" + apply(rule ir_While_backwards_frontier_both) + apply blast + by(simp add: ir_While_False ir_sym flip_def) + + +subsection "client1" + + +text {* + An example roughly equivalent to cient1 from O'Hearn~\cite{OHearn_19}0 + + In particular we use the backwards variant rule to reason about the loop. +*} +definition client1 :: com where + "client1 \ (Assign ''x'' (N 0);; + (While (Less (V ''x'') (V ''n'')) + ((Assign ''x'' (Plus (V ''x'') (N 1)))));; + (If (BEq (V ''x'') (N 2000000)) (Assign ''low'' (V ''high'')) SKIP))" + + +lemma client1: + "\Q. ir_hoare low_eq client1 client1 Q \ (\s s'. Q s s' \ low_neq s s') \ nontrivial Q" + apply(rule exI, rule conjI, simp add: client1_def) + apply(rule_tac P=low_eq_strong in ir_pre) + apply(rule ir_Seq) + apply(rule ir_Seq) + apply(rule ir_Assign_Assign) + apply clarsimp + + apply(rule ir_pre) + apply(rule ir_While_backwards_both[where P="\n s s'. low_eq_strong s s' \ s ''x'' = int n \ s' ''x'' = int n \ int n \ s ''n'' \ int n \ s' ''n''"]) + apply(rule ir_post) + apply(rule ir_Assign_Assign) + apply clarsimp + + apply clarsimp + + apply(rule ir_If_True_True) + apply(rule ir_Assign_Assign) + apply(fastforce simp: low_eq_strong_def) + apply(rule conjI) + apply(clarsimp simp: low_eq_strong_def split: if_splits) + + apply clarsimp + (* ugh having to manually do constraint solving here... *) + apply(clarsimp simp: low_eq_strong_def nontrivial_def) + apply(rule_tac x="\v. if v = ''x'' then 2000000 else if v = ''high'' then 1 else if v = ''n'' then 2000000 else if v = ''nondet'' then -1 else if v = ''low'' then 1 else undefined" in exI) + apply(rule_tac x="\v. if v = ''x'' then 2000000 else if v = ''high'' then 0 else if v = ''n'' then 2000000 else if v = ''nondet'' then -1 else if v = ''low'' then 0 else undefined" in exI) + apply clarsimp + done + + +subsection "client2" + +text {* + An example akin to client2 from O'Hearn~\cite{OHearn_19}. + + Note that this example is carefully written to show use of the frontier rule first to + reason up to the broken loop iteration, and then we unfold the loop at that point to + reason about the broken iteration, and then use the plain backwards variant rule to + reason over the remainder of the loop. +*} +definition client2 :: com where + "client2 \ (Assign ''x'' (N 0);; + (While (Less (V ''x'') (N 4000000)) + ((Assign ''x'' (Plus (V ''x'') (N 1)));; + (If (BEq (V ''x'') (N 2000000)) (Assign ''low'' (V ''high'')) SKIP)) + ) + )" + +lemma client2: + "\Q. ir_hoare low_eq client2 client2 Q \ (\s s'. Q s s' \ low_neq s s') \ nontrivial Q" + apply(rule exI, rule conjI, simp add: client2_def) + apply(rule_tac P=low_eq_strong in ir_pre) + apply(rule ir_Seq) + apply(rule ir_Assign_Assign) + apply clarsimp + + apply(rule ir_pre) + apply(rule ir_While_backwards_frontier_both[where P="\n s s'. low_eq_strong s s' \ s ''x'' = int n \ s' ''x'' = int n \ s ''x'' \ 0 \ s ''x'' \ 2000000 - 1 \ s' ''x'' \ 0 \ s' ''x'' \ 2000000 - 1"]) + apply(rule ir_Seq) + apply(rule ir_Assign_Assign) + apply clarsimp + apply(rule ir_post) + apply(rule ir_If') + apply(rule ir_Assign_Assign) + apply(rule ir_Skip_Skip) + apply clarsimp + + apply clarsimp + apply(rule ir_While') + apply clarsimp + apply(rule ir_Seq) + apply(rule ir_Seq) + apply(rule ir_Assign_Assign) + apply(rule ir_If_True_True) + apply(rule ir_Assign_Assign) + apply clarsimp + + apply(rule ir_pre) + apply(rule ir_While_backwards_both[where P="\n s s'. s ''x'' = 2000000 + int n \ s' ''x'' = 2000000 + int n \ s ''x'' \ 2000000 \ s ''x'' \ 4000000 \ s' ''x'' \ 2000000 \ s' ''x'' \ 4000000 \ s ''low'' = s ''high'' \ s' ''low'' = s' ''high'' \ s ''high'' \ s' ''high''"]) + + + apply(rule ir_Seq) + apply(rule ir_Assign_Assign) + apply(rule ir_If_False_False) + apply fastforce + apply (fastforce simp: low_eq_strong_def) + apply fastforce + apply(fastforce simp: low_eq_strong_def) + apply(fastforce simp: low_eq_strong_def) + + apply(rule conjI) + apply(clarsimp simp: low_eq_strong_def split: if_splits) + + apply clarsimp + (* ugh having to manually do constraint solving here... *) + apply(clarsimp simp: low_eq_strong_def nontrivial_def) + apply(rule_tac x="\v. if v = ''x'' then 4000000 else if v = ''high'' then 1 else if v = ''n'' then 2000000 else if v = ''nondet'' then -1 else if v = ''low'' then 1 else undefined" in exI) + apply(rule_tac x="\v. if v = ''x'' then 4000000 else if v = ''high'' then 0 else if v = ''n'' then 2000000 else if v = ''nondet'' then -1 else if v = ''low'' then 0 else undefined" in exI) + apply clarsimp + done + +end diff --git a/thys/Relational-Incorrectness-Logic/document/root.bib b/thys/Relational-Incorrectness-Logic/document/root.bib new file mode 100644 --- /dev/null +++ b/thys/Relational-Incorrectness-Logic/document/root.bib @@ -0,0 +1,37 @@ +@article{OHearn_19, + title={Incorrectness logic}, + author={O'Hearn, Peter W}, + journal={Proceedings of the ACM on Programming Languages}, + volume={4}, + number={POPL}, + pages={1--32}, + year={2019}, + publisher={ACM New York, NY, USA} +} + +@inproceedings{deVries_Koutavas_11, + title={Reverse hoare logic}, + author={De Vries, Edsko and Koutavas, Vasileios}, + booktitle={International Conference on Software Engineering and Formal Methods (SEFM)}, + pages={155--171}, + year={2011}, + publisher={Springer} + } + +@inproceedings{Beringer_11, + title={Relational Decomposition}, + author={Beringer, Lennart}, + booktitle={International Conference on Interactive Theorem Proving (ITP)}, + pages={39--54}, + year={2011}, + publisher={Springer}, +} + + +@misc{murray2020underapproximate, + title={An Under-Approximate Relational Logic: Heralding Logics of Insecurity, Incorrect Implementation \& More}, + author={Toby Murray}, + year={2020}, + howpublished={arXiv eprint arXiv:2003.04791 [cs.LO]}, + note = {\url{https://arxiv.org/abs/2003.04791}} +} \ No newline at end of file diff --git a/thys/Relational-Incorrectness-Logic/document/root.tex b/thys/Relational-Incorrectness-Logic/document/root.tex new file mode 100644 --- /dev/null +++ b/thys/Relational-Incorrectness-Logic/document/root.tex @@ -0,0 +1,50 @@ +\documentclass[11pt,a4paper]{article} +\usepackage{isabelle,isabellesym} + +% this should be the last package used +\usepackage{pdfsetup} + +% urls in roman style, theory text in math-similar italics +\urlstyle{rm} +\isabellestyle{it} + + +\begin{document} + +\title{An Under-Approximate Relational Logic} +\author{Toby Murray} +\maketitle + +\begin{abstract} + Recently, authors have proposed \emph{under-approximate} logics for + reasoning about programs~\cite{OHearn_19,deVries_Koutavas_11}. + So far, all such logics have been confined to + reasoning about individual program behaviours. Yet there exist many + over-approximate \emph{relational} logics for reasoning about pairs of + programs and relating their behaviours. + + We present the first under-approximate relational + logic, for the simple imperative language IMP. + We prove our logic + is both sound and complete. + Additionally, + we show how reasoning in this logic + can be decomposed into non-relational reasoning in an under-approximate + Hoare logic, mirroring Beringer's result for over-approximate + relational logics. + We illustrate the application of our logic on some small + examples in which we provably demonstrate the presence of insecurity. + + These proofs accompany a paper~\cite{murray2020underapproximate} + that explains the results in more detail. +\end{abstract} + +\tableofcontents + +% include generated text of all theories +\input{session} + +\bibliographystyle{abbrv} +\bibliography{root} + +\end{document} diff --git a/thys/VeriComp/Behaviour.thy b/thys/VeriComp/Behaviour.thy new file mode 100644 --- /dev/null +++ b/thys/VeriComp/Behaviour.thy @@ -0,0 +1,14 @@ +theory Behaviour + imports Main +begin + +datatype 'state behaviour = + Terminates 'state | Diverges | is_wrong: Goes_wrong 'state + +text \ +Terminating behaviours are annotated with the last state of the execution in order to compare the result of two executions with the @{const rel_behaviour} relation. + +The exact meaning of the three behaviours is defined in the semantics locale +\ + +end \ No newline at end of file diff --git a/thys/VeriComp/Compiler.thy b/thys/VeriComp/Compiler.thy new file mode 100644 --- /dev/null +++ b/thys/VeriComp/Compiler.thy @@ -0,0 +1,154 @@ +section \Compiler Between Static Representations\ + +theory Compiler + imports Language Simulation +begin + +definition option_comp :: "('a \ 'b option) \ ('c \ 'a option) \ 'c \ 'b option" (infix "\" 50) where + "(f \ g) x \ Option.bind (g x) f" + +context + fixes f :: "('a \ 'a option)" +begin + +fun option_comp_pow :: "nat \ 'a \ 'a option" where + "option_comp_pow 0 = (\_. None)" | + "option_comp_pow (Suc 0) = f" | + "option_comp_pow (Suc n) = (option_comp_pow n \ f)" + +end + +locale compiler = + L1: language step1 final1 load1 + + L2: language step2 final2 load2 + + backward_simulation step1 step2 final1 final2 order match + for + step1 and step2 and + final1 and final2 and + load1 :: "'prog1 \ 'state1 option" and + load2 :: "'prog2 \ 'state2 option" and + order :: "'index \ 'index \ bool" and + match + + fixes + compile :: "'prog1 \ 'prog2 option" + assumes + compile_load: + "compile p1 = Some p2 \ load1 p1 = Some s1 \ \s2 i. load2 p2 = Some s2 \ match i s1 s2" +begin + +text \ +The @{locale compiler} locale relates two languages, L1 and L2, by a backward simulation and provides a @{term compile} partial function from a concrete program in L1 to a concrete program in L2. +The only assumption is that a successful compilation results in a program which, when loaded, is equivalent to the loaded initial program. +\ + + +subsection \Preservation of behaviour\ + +corollary behaviour_preservation: + assumes + compiles: "compile p1 = Some p2" and + loads: "load1 p1 = Some s1" "load2 p2 = Some s2" and + behaves: "L2.behaves s2 b2" and + not_wrong: "\ is_wrong b2" + shows "\b1 i. L1.behaves s1 b1 \ rel_behaviour (match i) b1 b2" +proof - + obtain i where "match i s1 s2" + using compile_load[OF compiles] loads by auto + then show ?thesis + using simulation_behaviour[OF behaves not_wrong] + by simp +qed + +end + +subsection \Composition of compilers\ + +lemma compiler_composition: + assumes + "compiler step1 step2 final1 final2 load1 load2 order1 match1 compile1" and + "compiler step2 step3 final2 final3 load2 load3 order2 match2 compile2" + shows "compiler step1 step3 final1 final3 load1 load3 + (lex_prodp order1\<^sup>+\<^sup>+ order2) (rel_comp match1 match2) (compile2 \ compile1)" +proof (rule compiler.intro) + show "language step1 final1" + using assms(1)[THEN compiler.axioms(1)] . +next + show "language step3 final3" + using assms(2)[THEN compiler.axioms(2)] . +next + show "backward_simulation step1 step3 final1 final3 + (lex_prodp order1\<^sup>+\<^sup>+ order2) (rel_comp match1 match2)" + using backward_simulation_composition[OF assms[THEN compiler.axioms(3)]] . +next + show "compiler_axioms load1 load3 (rel_comp match1 match2) (compile2 \ compile1)" + proof unfold_locales + fix p1 p3 s1 + assume + compile: "(compile2 \ compile1) p1 = Some p3" and + load: "load1 p1 = Some s1" + obtain p2 where "compile1 p1 = Some p2" and "compile2 p2 = Some p3" + using compile by (auto simp: bind_eq_Some_conv option_comp_def) + then obtain s2 i where "load2 p2 = Some s2" and "match1 i s1 s2" + using assms(1)[THEN compiler.compile_load] load + by blast + moreover obtain s3 i' where "load3 p3 = Some s3" and "match2 i' s2 s3" + using assms(2)[THEN compiler.compile_load, OF \compile2 p2 = Some p3\ \load2 p2 = Some s2\] + by auto + ultimately show "\s3 i. load3 p3 = Some s3 \ rel_comp match1 match2 i s1 s3" + unfolding rel_comp_def by auto + qed +qed + +lemma compiler_composition_pow: + assumes + "compiler step step final final load load order match compile" + shows "compiler step step final final load load + (lexp order\<^sup>+\<^sup>+) (rel_comp_pow match) (option_comp_pow compile n)" +proof (induction n rule: option_comp_pow.induct) + case 1 + show ?case + using assms + by (auto intro: compiler.axioms compiler.intro compiler_axioms.intro backward_simulation_pow) +next + case 2 + show ?case + proof (rule compiler.intro) + show "compiler_axioms load load (rel_comp_pow match) (option_comp_pow compile (Suc 0))" + proof unfold_locales + fix p1 p2 s1 + assume + "option_comp_pow compile (Suc 0) p1 = Some p2" and + "load p1 = Some s1" + thus "\s2 i. load p2 = Some s2 \ rel_comp_pow match i s1 s2" + using compiler.compile_load[OF assms(1)] + by (metis option_comp_pow.simps(2) rel_comp_pow.simps(2)) + qed + qed (auto intro: assms compiler.axioms backward_simulation_pow) +next + case (3 n') + show ?case + proof (rule compiler.intro) + show "compiler_axioms load load (rel_comp_pow match) (option_comp_pow compile (Suc (Suc n')))" + proof unfold_locales + fix p1 p3 s1 + assume + "option_comp_pow compile (Suc (Suc n')) p1 = Some p3" and + "load p1 = Some s1" + then obtain p2 where + comp: "compile p1 = Some p2" and + comp_IH: "option_comp_pow compile (Suc n') p2 = Some p3" + by (auto simp: option_comp_def bind_eq_Some_conv) + then obtain s2 i where "load p2 = Some s2" and "match i s1 s2" + using compiler.compile_load[OF assms(1) _ \load p1 = Some s1\] by blast + then obtain s3 i' where "load p3 = Some s3" and "rel_comp_pow match i' s2 s3" + using compiler.compile_load[OF "3.IH" comp_IH] by blast + moreover have "rel_comp_pow match (i # i') s1 s3" + using \match i s1 s2\ \rel_comp_pow match i' s2 s3\ + using rel_comp_pow.elims(2) by fastforce + ultimately show "\s3 i. load p3 = Some s3 \ rel_comp_pow match i s1 s3" + by auto + qed + qed (auto intro: assms compiler.axioms backward_simulation_pow) +qed + +end \ No newline at end of file diff --git a/thys/VeriComp/Fixpoint.thy b/thys/VeriComp/Fixpoint.thy new file mode 100644 --- /dev/null +++ b/thys/VeriComp/Fixpoint.thy @@ -0,0 +1,84 @@ +section \Fixpoint of Converging Program Transformations\ + +theory Fixpoint + imports Compiler +begin + +context + fixes + m :: "'a \ nat" and + f :: "'a \ 'a option" +begin + +function fixpoint :: "'a \ 'a option" where + "fixpoint x = ( + case f x of + None \ None | + Some x' \ if m x' < m x then fixpoint x' else Some x' + )" +by pat_completeness auto +termination +proof (relation "measure m") + show "wf (measure m)" by auto +next + fix x x' + assume "f x = Some x'" and "m x' < m x" + thus "(x', x) \ measure m" by simp +qed + +end + +lemma fixpoint_to_comp_pow: + "fixpoint m f x = y \ \n. option_comp_pow f n x = y" +proof (induction x arbitrary: y rule: fixpoint.induct[where f = f and m = m]) + case (1 x) + show ?case + proof (cases "f x") + case None + then show ?thesis + using "1.prems" + by (metis (no_types, lifting) fixpoint.simps option.case_eq_if option_comp_pow.simps(1)) + next + case (Some a) + show ?thesis + proof (cases "m a < m x") + case True + hence "fixpoint m f a = y" + using "1.prems" Some by simp + then show ?thesis + using "1.IH"[OF Some True] + by (metis Some bind.simps(2) old.nat.exhaust option_comp_def option_comp_pow.simps(1,3)) + next + case False + then show ?thesis + using "1.prems" Some + apply simp + by (metis option_comp_pow.simps(2)) + qed + qed +qed + +lemma fixpoint_eq_comp_pow: + "\n. fixpoint m f x = option_comp_pow f n x" + by (metis fixpoint_to_comp_pow) + +lemma compiler_composition_fixpoint: + assumes + "compiler step step final final load load order match compile" + shows "compiler step step final final load load + (lexp order\<^sup>+\<^sup>+) (rel_comp_pow match) (fixpoint m compile)" +proof (rule compiler.intro) + show "compiler_axioms load load (rel_comp_pow match) (fixpoint m compile)" + proof unfold_locales + fix p1 p2 s1 + assume "fixpoint m compile p1 = Some p2" and "load p1 = Some s1" + obtain n where "fixpoint m compile p1 = option_comp_pow compile n p1" + using fixpoint_eq_comp_pow by metis + + thus "\s2 i. load p2 = Some s2 \ rel_comp_pow match i s1 s2" + using \fixpoint m compile p1 = Some p2\ assms compiler.compile_load compiler_composition_pow + using \load p1 = Some s1\ by fastforce + qed +qed (auto intro: assms compiler.axioms backward_simulation_pow) + +end diff --git a/thys/VeriComp/Inf.thy b/thys/VeriComp/Inf.thy new file mode 100644 --- /dev/null +++ b/thys/VeriComp/Inf.thy @@ -0,0 +1,59 @@ +section \Infinitely Transitive Closure\ + +theory Inf + imports Well_founded +begin + +coinductive inf :: "('a \ 'a \ bool) \ 'a \ bool" for r where + inf_step: "r x y \ inf r y \ inf r x" + +coinductive inf_wf :: "('a \ 'a \ bool) \ ('b \ 'b \ bool) \ 'b \ 'a \ bool" for r order where + inf_wf: "order n m \ inf_wf r order n x \ inf_wf r order m x" | + inf_wf_step: "r\<^sup>+\<^sup>+ x y \ inf_wf r order n y \ inf_wf r order m x" + +lemma inf_wf_to_step_inf_wf: + assumes "well_founded order" + shows "inf_wf r order n x \ \y m. r x y \ inf_wf r order m y" +proof (induction n arbitrary: x rule: well_founded.induct[OF assms(1)]) + case (1 n) + from "1.prems"(1) show ?case + proof (induction rule: inf_wf.cases) + case (inf_wf m n' x') + then show ?case using "1.IH" by simp + next + case (inf_wf_step x' y m n') + then show ?case + by (metis converse_tranclpE inf_wf.inf_wf_step) + qed +qed + +lemma inf_wf_to_inf: + assumes "well_founded order" + shows "inf_wf r order n x \ inf r x" +proof (coinduction arbitrary: x n rule: inf.coinduct) + case (inf x n) + then obtain y m where "r x y" and "inf_wf r order m y" + using inf_wf_to_step_inf_wf[OF assms(1) inf(1)] by metis + thus ?case by auto +qed + +lemma step_inf: + assumes + deterministic: "\x y z. r x y \ r x z \ y = z" + shows "r x y \ inf r x \ inf r y" + by (metis deterministic inf.cases) + +lemma star_inf: + assumes + deterministic: "\x y z. r x y \ r x z \ y = z" + shows "r\<^sup>*\<^sup>* x y \ inf r x \ inf r y" +proof (induction y rule: rtranclp_induct) + case base + then show ?case . +next + case (step y z) + then show ?case + using step_inf deterministic by metis +qed + +end \ No newline at end of file diff --git a/thys/VeriComp/LICENSE.txt b/thys/VeriComp/LICENSE.txt new file mode 100644 --- /dev/null +++ b/thys/VeriComp/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright 2019 Martin Desharnais + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/thys/VeriComp/Language.thy b/thys/VeriComp/Language.thy new file mode 100644 --- /dev/null +++ b/thys/VeriComp/Language.thy @@ -0,0 +1,24 @@ +section \The Static Representation of a Language\ + +theory Language + imports Semantics +begin + +locale language = + semantics step final + for + step :: "'state \ 'state \ bool" and + final :: "'state \ bool" + + fixes + load :: "'prog \ 'state option" + +context language begin + +text \ +The language locale represents the concrete program representation (type variable @{typ 'prog}), which can be transformed into a program state (type variable @{typ 'state}) by the @{term load } function. +The set of initial states of the transition system is implicitly defined by the codomain of @{term load}. +\ + +end + +end \ No newline at end of file diff --git a/thys/VeriComp/ROOT b/thys/VeriComp/ROOT new file mode 100644 --- /dev/null +++ b/thys/VeriComp/ROOT @@ -0,0 +1,9 @@ +chapter AFP +session VeriComp (AFP) = HOL + + options [timeout = 600] + theories + Compiler + Fixpoint + document_files + "root.bib" + "root.tex" diff --git a/thys/VeriComp/Semantics.thy b/thys/VeriComp/Semantics.thy new file mode 100644 --- /dev/null +++ b/thys/VeriComp/Semantics.thy @@ -0,0 +1,138 @@ +section \The Dynamic Representation of a Language\ + +theory Semantics + imports Main Behaviour Inf begin + +text \ +The definition of programming languages is separated into two parts: an abstract semantics and a concrete program representation. +\ + +definition finished :: "('a \ 'a \ bool) \ 'a \ bool" where + "finished r x = (\y. r x y)" + +lemma finished_star: + assumes "finished r x" + shows "r\<^sup>*\<^sup>* x y \ x = y" +proof (induction y rule: rtranclp_induct) + case base + then show ?case by simp +next + case (step y z) + then show ?case + using assms by (auto simp: finished_def) +qed + +locale semantics = + fixes + step :: "'state \ 'state \ bool" (infix "\" 50) and + final :: "'state \ bool" + assumes + final_finished: "final s \ finished step s" +begin + +text \ +The semantics locale represents the semantics as an abstract machine. +It is expressed by a transition system with a transition relation @{term step}---usually written as an infix @{text \} arrow---and final states @{term final}. +\ + +lemma finished_step: + "step s s' \ \finished step s" +by (auto simp add: finished_def) + +abbreviation eval :: "'state \ 'state \ bool" (infix "\\<^sup>*" 50) where + "eval \ step\<^sup>*\<^sup>*" + +abbreviation inf_step :: "'state \ bool" where + "inf_step \ inf step" + +notation + inf_step ("'(\\<^sup>\')" [] 50) and + inf_step ("_ \\<^sup>\" [55] 50) + +lemma finished_inf: "s \\<^sup>\ \ \ finished step s" + using inf.cases finished_step by metis + +lemma eval_deterministic: + assumes + deterministic: "\x y z. step x y \ step x z \ y = z" + shows "s1 \\<^sup>* s2 \ s1 \\<^sup>* s3 \ finished step s2 \ finished step s3 \ s2 = s3" +proof(induction s1 arbitrary: s3 rule: converse_rtranclp_induct) + case base + then show ?case by (simp add: finished_star) +next + case (step y z) + then show ?case + by (metis converse_rtranclpE deterministic finished_step) +qed + +subsection \Behaviour of a dynamic execution\ + +inductive behaves :: "'state \ 'state behaviour \ bool" (infix "\" 50) where + state_terminates: + "s1 \\<^sup>* s2 \ finished step s2 \ final s2 \ s1 \ (Terminates s2)" | + state_diverges: + "s1 \\<^sup>\ \ s1 \ Diverges" | + state_goes_wrong: + "s1 \\<^sup>* s2 \ finished step s2 \ \ final s2 \ s1 \ (Goes_wrong s2)" + + +text \ +Even though the @{term step} transition relation in the @{locale semantics} locale need not be deterministic, if it happens to be, then the behaviour of a program becomes deterministic too. +\ + +lemma behaves_deterministic: + assumes + deterministic: "\x y z. step x y \ step x z \ y = z" + shows "s \ b1 \ s \ b2 \ b1 = b2" +proof (induction s b1 rule: behaves.induct) + case (state_terminates s1 s2) + show ?case using state_terminates.prems state_terminates.hyps + proof (induction s1 b2 rule: behaves.induct) + case (state_terminates s1 s3) + then show ?case + using eval_deterministic deterministic by simp + next + case (state_diverges s1) + then show ?case + using deterministic star_inf[THEN finished_inf] by simp + next + case (state_goes_wrong s1 s3) + then show ?case + using eval_deterministic deterministic by blast + qed +next + case (state_diverges s1) + show ?case using state_diverges.prems state_diverges.hyps + proof (induction s1 b2 rule: behaves.induct) + case (state_terminates s1 s2) + then show ?case + using deterministic star_inf[THEN finished_inf] by simp + next + case (state_diverges s1) + then show ?case by simp + next + case (state_goes_wrong s1 s2) + then show ?case + using deterministic star_inf[THEN finished_inf] by simp + qed +next + case (state_goes_wrong s1 s2) + show ?case using state_goes_wrong.prems state_goes_wrong.hyps + proof (induction s1 b2) + case (state_terminates s1 s3) + then show ?case + using eval_deterministic deterministic by blast + next + case (state_diverges s1) + then show ?case + using deterministic star_inf[THEN finished_inf] by simp + next + case (state_goes_wrong s1 s3) + then show ?case + using eval_deterministic deterministic by simp + qed +qed + +end + +end \ No newline at end of file diff --git a/thys/VeriComp/Simulation.thy b/thys/VeriComp/Simulation.thy new file mode 100644 --- /dev/null +++ b/thys/VeriComp/Simulation.thy @@ -0,0 +1,445 @@ +section \Simulations Between Dynamic Executions\ + +theory Simulation + imports Semantics Inf Well_founded +begin + +locale backward_simulation = + L1: semantics step1 final1 + + L2: semantics step2 final2 + + well_founded "(\)" + for + step1 :: "'state1 \ 'state1 \ bool" and + step2 :: "'state2 \ 'state2 \ bool" and + final1 :: "'state1 \ bool" and + final2 :: "'state2 \ bool" and + order :: "'index \ 'index \ bool" (infix "\" 70) + + fixes + match :: "'index \ 'state1 \ 'state2 \ bool" + assumes + match_final: + "match i s1 s2 \ final2 s2 \ final1 s1" and + simulation: + "match i1 s1 s2 \ step2 s2 s2' \ + (\i2 s1'. step1\<^sup>+\<^sup>+ s1 s1' \ match i2 s1' s2') \ (\i2. match i2 s1 s2' \ i2 \ i1)" +begin + +text \ +A simulation is defined between two @{locale semantics} L1 and L2. +A @{term match} predicate expresses that two states from L1 and L2 are equivalent. +The @{term match} predicate is also parameterized with an ordering used to avoid stuttering. +The only two assumptions of a backward simulation are that a final state in L2 will also be a final in L1,and that a step in L2 will either represent a non-empty sequence of steps in L1 or will result in an equivalent state. +Stuttering is ruled out by the requirement that the index on the @{term match} predicate decreases with respect to the well-founded @{term order} ordering. +\ + +end + + +locale forward_simulation = + L1: semantics step1 final1 + + L2: semantics step2 final2 + + well_founded "(\)" + for + step1 :: "'state1 \ 'state1 \ bool" and + step2 :: "'state2 \ 'state2 \ bool" and + final1 :: "'state1 \ bool" and + final2 :: "'state2 \ bool" and + order :: "'index \ 'index \ bool" (infix "\" 70) + + fixes + match :: "'index \ 'state1 \ 'state2 \ bool" + assumes + match_final: + "match i s1 s2 \ final1 s1 \ final2 s2" and + simulation: + "match i1 s1 s2 \ step1 s1 s1' \ + (\i' s2'. step2\<^sup>+\<^sup>+ s2 s2' \ match i' s1' s2') \ (\i'. match i' s1 s2' \ i' \ i1)" + +locale bisimulation = + forward_simulation step1 step2 final1 final2 order match + + backward_simulation step1 step2 final1 final2 order match + for + step1 :: "'state1 \ 'state1 \ bool" and + step2 :: "'state2 \ 'state2 \ bool" and + final1 :: "'state1 \ bool" and + final2 :: "'state2 \ bool" and + order :: "'index \ 'index \ bool" and + match :: "'index \ 'state1 \ 'state2 \ bool" + +context backward_simulation begin + +lemma lift_simulation_plus: + "step2\<^sup>+\<^sup>+ s2 s2' \ match i1 s1 s2 \ + (\i2 s1'. step1\<^sup>+\<^sup>+ s1 s1' \ match i2 s1' s2') \ + (\i2. match i2 s1 s2' \ order\<^sup>+\<^sup>+ i2 i1)" + thm tranclp_induct +proof(induction s2' arbitrary: i1 s1 rule: tranclp_induct) + case (base s2') + from simulation[OF base.prems(1) base.hyps(1)] show ?case + by auto +next + case (step s2' s2'') + show ?case + using step.IH[OF \match i1 s1 s2\] + proof + assume "\i2 s1'. step1\<^sup>+\<^sup>+ s1 s1' \ match i2 s1' s2'" + then obtain i2 s1' where "step1\<^sup>+\<^sup>+ s1 s1'" and "match i2 s1' s2'" by auto + from simulation[OF \match i2 s1' s2'\ \step2 s2' s2''\] show ?thesis + proof + assume "\i3 s1''. step1\<^sup>+\<^sup>+ s1' s1'' \ match i3 s1'' s2''" + then obtain i3 s1'' where "step1\<^sup>+\<^sup>+ s1' s1''" and "match i3 s1'' s2''" by auto + then show ?thesis + using tranclp_trans[OF \step1\<^sup>+\<^sup>+ s1 s1'\] by auto + next + assume "\i3. match i3 s1' s2'' \ i3 \ i2" + then obtain i3 where "match i3 s1' s2''" and "i3 \ i2" by auto + then show ?thesis + using \step1\<^sup>+\<^sup>+ s1 s1'\ by auto + qed + next + assume "\i2. match i2 s1 s2' \ (\)\<^sup>+\<^sup>+ i2 i1" + then obtain i3 where "match i3 s1 s2'" and "(\)\<^sup>+\<^sup>+ i3 i1" by auto + then show ?thesis + using simulation[OF \match i3 s1 s2'\ \step2 s2' s2''\] by auto + qed +qed + +lemma lift_simulation_eval: + "L2.eval s2 s2' \ match i1 s1 s2 \ \i2 s1'. L1.eval s1 s1' \ match i2 s1' s2'" +proof(induction s2 arbitrary: i1 s1 rule: converse_rtranclp_induct) + case (base s2) + thus ?case by auto +next + case (step s2 s2'') + from simulation[OF \match i1 s1 s2\ \step2 s2 s2''\] show ?case + proof + assume "\i2 s1'. step1\<^sup>+\<^sup>+ s1 s1' \ match i2 s1' s2''" + thus ?thesis + by (meson rtranclp_trans step.IH tranclp_into_rtranclp) + next + assume "\i2. match i2 s1 s2'' \ i2 \ i1" + thus ?thesis + by (auto intro: step.IH) + qed +qed + +lemma backward_simulation_inf: + assumes + "match i s1 s2" and + "inf step2 s2" + shows "inf step1 s1" +proof - + from assms have "inf_wf step1 order i s1" + proof (coinduction arbitrary: i s1 s2) + case inf_wf + obtain s2' where "step2 s2 s2'" and "inf step2 s2'" + using inf_wf(2) by (auto elim: inf.cases) + from simulation[OF \match i s1 s2\ \step2 s2 s2'\] show ?case + using \inf step2 s2'\ by auto + qed + thus ?thesis using inf_wf_to_inf + by (auto intro: inf_wf_to_inf well_founded_axioms) +qed + +subsection \Preservation of behaviour\ + +text \ +The main correctness theorem states that, for any two matching programs, any not wrong behaviour of the later is also a behaviour of the former. +In other words, if the compiled program does not crash, then its behaviour, whether it terminates or not, is a also a valid behaviour of the source program. +\ + +lemma simulation_behaviour : + "L2.behaves s\<^sub>2 b\<^sub>2 \ \is_wrong b\<^sub>2 \ match i s\<^sub>1 s\<^sub>2 \ + \b\<^sub>1 i'. L1.behaves s\<^sub>1 b\<^sub>1 \ rel_behaviour (match i') b\<^sub>1 b\<^sub>2" +proof(induction rule: L2.behaves.cases) + case (state_terminates s2 s2') + then obtain i' s1' where "L1.eval s\<^sub>1 s1'" and "match i' s1' s2'" + using lift_simulation_eval by blast + hence "final1 s1'" + by (auto intro: state_terminates.hyps match_final) + hence "L1.behaves s\<^sub>1 (Terminates s1')" + using L1.final_finished + by (simp add: L1.state_terminates \L1.eval s\<^sub>1 s1'\) + moreover have "rel_behaviour (match i') (Terminates s1') b\<^sub>2" + by (simp add: \match i' s1' s2'\ state_terminates.hyps) + ultimately show ?case by blast +next + case (state_diverges s2) + then show ?case + using backward_simulation_inf L1.state_diverges by fastforce +next + case (state_goes_wrong s2 s2') + then show ?case using \\is_wrong b\<^sub>2\ by simp +qed + +end + +subsection \Composition of backward simulations\ + +definition rel_comp :: + "('a \ 'b \ 'c \ bool) \ ('d \ 'c \ 'e \ bool) \ ('a \ 'd) \ 'b \ 'e \ bool" where + "rel_comp r1 r2 i \ (r1 (fst i) OO r2 (snd i))" + +lemma backward_simulation_composition: + assumes + "backward_simulation step1 step2 final1 final2 order1 match1" + "backward_simulation step2 step3 final2 final3 order2 match2" + shows + "backward_simulation step1 step3 final1 final3 + (lex_prodp order1\<^sup>+\<^sup>+ order2) (rel_comp match1 match2)" +proof intro_locales + show "semantics step1 final1" + by (auto intro: backward_simulation.axioms assms) +next + show "semantics step3 final3" + by (auto intro: backward_simulation.axioms assms) +next + show "well_founded (lex_prodp order1\<^sup>+\<^sup>+ order2)" + using assms[THEN backward_simulation.axioms(3)] + by (simp add: lex_prodp_well_founded well_founded.intro well_founded.wf wfP_trancl) +next + show "backward_simulation_axioms step1 step3 final1 final3 + (lex_prodp order1\<^sup>+\<^sup>+ order2) (rel_comp match1 match2)" + proof + fix i s1 s3 + assume + match: "rel_comp match1 match2 i s1 s3" and + final: "final3 s3" + obtain i1 i2 s2 where "match1 i1 s1 s2" and "match2 i2 s2 s3" and "i = (i1, i2)" + using match unfolding rel_comp_def by auto + thus "final1 s1" + using final assms[THEN backward_simulation.match_final] + by simp + next + fix i s1 s3 s3' + assume + match: "rel_comp match1 match2 i s1 s3" and + step: "step3 s3 s3'" + obtain i1 i2 s2 where "match1 i1 s1 s2" and "match2 i2 s2 s3" and i_def: "i = (i1, i2)" + using match unfolding rel_comp_def by auto + from backward_simulation.simulation[OF assms(2) \match2 i2 s2 s3\ step] + show "(\i' s1'. step1\<^sup>+\<^sup>+ s1 s1' \ rel_comp match1 match2 i' s1' s3') \ + (\i'. rel_comp match1 match2 i' s1 s3' \ lex_prodp order1\<^sup>+\<^sup>+ order2 i' i)" + (is "(\i' s1'. ?STEPS i' s1') \ ?STALL") + proof + assume "\i2' s2'. step2\<^sup>+\<^sup>+ s2 s2' \ match2 i2' s2' s3'" + then obtain i2' s2' where "step2\<^sup>+\<^sup>+ s2 s2'" and "match2 i2' s2' s3'" by auto + from backward_simulation.lift_simulation_plus[OF assms(1) \step2\<^sup>+\<^sup>+ s2 s2'\ \match1 i1 s1 s2\] + show ?thesis + proof + assume "\i2 s1'. step1\<^sup>+\<^sup>+ s1 s1' \ match1 i2 s1' s2'" + then obtain i2 s1' where "step1\<^sup>+\<^sup>+ s1 s1'" and "match1 i2 s1' s2'" by auto + hence "?STEPS (i2, i2') s1'" + by (auto intro: \match2 i2' s2' s3'\ simp: rel_comp_def) + thus ?thesis by auto + next + assume "\i2. match1 i2 s1 s2' \ order1\<^sup>+\<^sup>+ i2 i1" + then obtain i2'' where "match1 i2'' s1 s2'" and "order1\<^sup>+\<^sup>+ i2'' i1" by auto + hence ?STALL + unfolding rel_comp_def i_def lex_prodp_def + using \match2 i2' s2' s3'\ by auto + thus ?thesis by simp + qed + next + assume "\i2'. match2 i2' s2 s3' \ order2 i2' i2" + then obtain i2' where "match2 i2' s2 s3'" and "order2 i2' i2" by auto + hence ?STALL + unfolding rel_comp_def i_def lex_prodp_def + using \match1 i1 s1 s2\ by auto + thus ?thesis by simp + qed + qed +qed + +context + fixes r :: "'i \ 'a \ 'a \ bool" +begin + +fun rel_comp_pow where + "rel_comp_pow [] x y = False" | + "rel_comp_pow [i] x y = r i x y" | + "rel_comp_pow (i # is) x z = (\y. r i x y \ rel_comp_pow is y z)" + +end + +lemma backward_simulation_pow: + assumes + "backward_simulation step step final final order match" + shows + "backward_simulation step step final final (lexp order\<^sup>+\<^sup>+) (rel_comp_pow match)" +proof intro_locales + show "semantics step final" + by (auto intro: backward_simulation.axioms assms) +next + show "well_founded (lexp order\<^sup>+\<^sup>+)" + using backward_simulation.axioms(3)[OF assms] lex_list_well_founded + using well_founded.intro well_founded.wf wfP_trancl by blast +next + show "backward_simulation_axioms step step final final (lexp order\<^sup>+\<^sup>+) (rel_comp_pow match)" + proof unfold_locales + fix "is" s1 s2 + assume "rel_comp_pow match is s1 s2" and "final s2" + thus "final s1" thm rel_comp_pow.induct + proof (induction "is" s1 s2 rule: rel_comp_pow.induct) + case (1 x y) + then show ?case by simp + next + case (2 i x y) + then show ?case + using backward_simulation.match_final[OF assms(1)] by simp + next + case (3 i1 i2 "is" x z) + from "3.prems"[simplified] obtain y where + match: "match i1 x y" and "rel_comp_pow match (i2 # is) y z" + by auto + hence "final y" using "3.IH" "3.prems" by simp + thus ?case + using "3.prems" match backward_simulation.match_final[OF assms(1)] by auto + qed + next + fix "is" s1 s3 s3' + assume "rel_comp_pow match is s1 s3" and "step s3 s3'" + hence "(\is' s1'. step\<^sup>+\<^sup>+ s1 s1' \ length is' = length is \ rel_comp_pow match is' s1' s3') \ + (\is'. rel_comp_pow match is' s1 s3' \ lexp order\<^sup>+\<^sup>+ is' is)" + proof (induction "is" s1 s3 arbitrary: s3' rule: rel_comp_pow.induct) + case 1 + then show ?case by simp + next + case (2 i s1 s3) + from backward_simulation.simulation[OF assms(1) "2.prems"[simplified]] show ?case + proof + assume "\i' s1'. step\<^sup>+\<^sup>+ s1 s1' \ match i' s1' s3'" + then obtain i' s1' where "step\<^sup>+\<^sup>+ s1 s1'" and "match i' s1' s3'" by auto + hence "step\<^sup>+\<^sup>+ s1 s1' \ rel_comp_pow match [i'] s1' s3'" by simp + thus ?thesis + by (metis length_Cons) + next + assume "\i'. match i' s1 s3' \ order i' i" + then obtain i' where "match i' s1 s3'" and "order i' i" by auto + hence "rel_comp_pow match [i'] s1 s3' \ lexp order\<^sup>+\<^sup>+ [i'] [i]" + by (simp add: lexp_head tranclp.r_into_trancl) + thus ?thesis by blast + qed + next + case (3 i1 i2 "is" s1 s3) + from "3.prems"[simplified] obtain s2 where + "match i1 s1 s2" and 0: "rel_comp_pow match (i2 # is) s2 s3" + by auto + from "3.IH"[OF 0 "3.prems"(2)] show ?case + proof + assume "\is' s2'. step\<^sup>+\<^sup>+ s2 s2' \ length is' = length (i2 # is) \ + rel_comp_pow match is' s2' s3'" + then obtain i2' is' s2' where + "step\<^sup>+\<^sup>+ s2 s2'" and "length is' = length is" and "rel_comp_pow match (i2' # is') s2' s3'" + by (metis Suc_length_conv) + from backward_simulation.lift_simulation_plus[OF assms(1) \step\<^sup>+\<^sup>+ s2 s2'\ \match i1 s1 s2\] + show ?thesis + proof + assume "\i2 s1'. step\<^sup>+\<^sup>+ s1 s1' \ match i2 s1' s2'" + thus ?thesis + using \rel_comp_pow match (i2' # is') s2' s3'\ + by (metis \length is' = length is\ length_Cons rel_comp_pow.simps(3)) + next + assume "\i2. match i2 s1 s2' \ order\<^sup>+\<^sup>+ i2 i1" + then obtain i1' where "match i1' s1 s2'" and "order\<^sup>+\<^sup>+ i1' i1" by auto + hence "rel_comp_pow match (i1' # i2' # is') s1 s3'" + using \rel_comp_pow match (i2' # is') s2' s3'\ by auto + moreover have "lexp order\<^sup>+\<^sup>+ (i1' # i2' # is') (i1 # i2 # is)" + using \order\<^sup>+\<^sup>+ i1' i1\ \length is' = length is\ + by (auto intro: lexp_head) + ultimately show ?thesis by fast + qed + next + assume "\i'. rel_comp_pow match i' s2 s3' \ lexp order\<^sup>+\<^sup>+ i' (i2 # is)" + then obtain i2' is' where + "rel_comp_pow match (i2' # is') s2 s3'" and "lexp order\<^sup>+\<^sup>+ (i2' # is') (i2 # is)" + by (metis lexp.simps) + thus ?thesis + by (metis \match i1 s1 s2\ lexp.simps(1) rel_comp_pow.simps(3)) + qed + qed + thus "(\is' s1'. step\<^sup>+\<^sup>+ s1 s1' \ rel_comp_pow match is' s1' s3') \ + (\is'. rel_comp_pow match is' s1 s3' \ lexp order\<^sup>+\<^sup>+ is' is)" + by auto + qed +qed + +definition lockstep_backward_simulation where + "lockstep_backward_simulation step1 step2 match \ + \s1 s2 s2'. match s1 s2 \ step2 s2 s2' \ (\s1'. step1 s1 s1' \ match s1' s2')" + +definition plus_backward_simulation where + "plus_backward_simulation step1 step2 match \ + \s1 s2 s2'. match s1 s2 \ step2 s2 s2' \ (\s1'. step1\<^sup>+\<^sup>+ s1 s1' \ match s1' s2')" + +lemma + assumes "lockstep_backward_simulation step1 step2 match" + shows "plus_backward_simulation step1 step2 match" +unfolding plus_backward_simulation_def +proof safe + fix s1 s2 s2' + assume "match s1 s2" and "step2 s2 s2'" + then obtain s1' where "step1 s1 s1'" and "match s1' s2'" + using assms(1) unfolding lockstep_backward_simulation_def by blast + then show "\s1'. step1\<^sup>+\<^sup>+ s1 s1' \ match s1' s2'" + by auto +qed + +lemma lockstep_to_plus_backward_simulation: + fixes + match :: "'state1 \ 'state2 \ bool" and + step1 :: "'state1 \ 'state1 \ bool" and + step2 :: "'state2 \ 'state2 \ bool" + assumes + lockstep_simulation: "\s1 s2 s2'. match s1 s2 \ step2 s2 s2' \ (\s1'. step1 s1 s1' \ match s1' s2')" and + match: "match s1 s2" and + step: "step2 s2 s2'" + shows "\s1'. step1\<^sup>+\<^sup>+ s1 s1' \ match s1' s2'" +proof - + obtain s1' where "step1 s1 s1'" and "match s1' s2'" + using lockstep_simulation[OF match step] by auto + thus ?thesis by auto +qed + +lemma lockstep_to_option_backward_simulation: + fixes + match :: "'state1 \ 'state2 \ bool" and + step1 :: "'state1 \ 'state1 \ bool" and + step2 :: "'state2 \ 'state2 \ bool" and + measure :: "'state2 \ nat" + assumes + lockstep_simulation: "\s1 s2 s2'. match s1 s2 \ step2 s2 s2' \ (\s1'. step1 s1 s1' \ match s1' s2')" and + match: "match s1 s2" and + step: "step2 s2 s2'" + shows "(\s1'. step1 s1 s1' \ match s1' s2') \ match s1 s2' \ measure s2' < measure s2" + using lockstep_simulation[OF match step] .. + +lemma plus_to_star_backward_simulation: + fixes + match :: "'state1 \ 'state2 \ bool" and + step1 :: "'state1 \ 'state1 \ bool" and + step2 :: "'state2 \ 'state2 \ bool" and + measure :: "'state2 \ nat" + assumes + star_simulation: "\s1 s2 s2'. match s1 s2 \ step2 s2 s2' \ (\s1'. step1\<^sup>+\<^sup>+ s1 s1' \ match s1' s2')" and + match: "match s1 s2" and + step: "step2 s2 s2'" + shows "(\s1'. step1\<^sup>+\<^sup>+ s1 s1' \ match s1' s2') \ match s1 s2' \ measure s2' < measure s2" + using star_simulation[OF match step] .. + +lemma lockstep_to_plus_forward_simulation: + fixes + match :: "'state1 \ 'state2 \ bool" and + step1 :: "'state1 \ 'state1 \ bool" and + step2 :: "'state2 \ 'state2 \ bool" + assumes + lockstep_simulation: "\s1 s2 s2'. match s1 s2 \ step1 s1 s1' \ (\s2'. step2 s2 s2' \ match s1' s2')" and + match: "match s1 s2" and + step: "step1 s1 s1'" + shows "\s2'. step2\<^sup>+\<^sup>+ s2 s2' \ match s1' s2'" +proof - + obtain s2' where "step2 s2 s2'" and "match s1' s2'" + using lockstep_simulation[OF match step] by auto + thus ?thesis by auto +qed + +end \ No newline at end of file diff --git a/thys/VeriComp/Well_founded.thy b/thys/VeriComp/Well_founded.thy new file mode 100644 --- /dev/null +++ b/thys/VeriComp/Well_founded.thy @@ -0,0 +1,99 @@ +section \Well-foundedness of Relations Defined as Predicate Functions\ + +theory Well_founded + imports Main +begin + +locale well_founded = + fixes R :: "'a \ 'a \ bool" (infix "\" 70) + assumes + wf: "wfP (\)" +begin + +lemmas induct = wfP_induct_rule[OF wf] + +end + +subsection \Lexicographic product\ + +context + fixes + r1 :: "'a \ 'a \ bool" and + r2 :: "'b \ 'b \ bool" +begin + +definition lex_prodp :: "'a \ 'b \ 'a \ 'b \ bool" where + "lex_prodp x y \ r1 (fst x) (fst y) \ fst x = fst y \ r2 (snd x) (snd y)" + +lemma lex_prodp_lex_prod: + shows "lex_prodp x y \ (x, y) \ lex_prod { (x, y). r1 x y } { (x, y). r2 x y }" + by (auto simp: lex_prod_def lex_prodp_def) + +lemma lex_prodp_wfP: + assumes + "wfP r1" and + "wfP r2" + shows "wfP lex_prodp" +proof (rule wfPUNIVI) + show "\P. \x. (\y. lex_prodp y x \ P y) \ P x \ (\x. P x)" + proof - + fix P + assume "\x. (\y. lex_prodp y x \ P y) \ P x" + hence hyps: "(\y1 y2. lex_prodp (y1, y2) (x1, x2) \ P (y1, y2)) \ P (x1, x2)" for x1 x2 + by fast + show "(\x. P x)" + apply (simp only: split_paired_all) + apply (atomize (full)) + apply (rule allI) + apply (rule wfP_induct_rule[OF assms(1), of "\y. \b. P (y, b)"]) + apply (rule allI) + apply (rule wfP_induct_rule[OF assms(2), of "\b. P (x, b)" for x]) + using hyps[unfolded lex_prodp_def, simplified] + by blast + qed +qed + +end + +lemma lex_prodp_well_founded: + assumes + "well_founded r1" and + "well_founded r2" + shows "well_founded (lex_prodp r1 r2)" + using well_founded.intro lex_prodp_wfP assms[THEN well_founded.wf] by auto + +subsection \Lexicographic list\ + +context + fixes order :: "'a \ 'a \ bool" +begin + +inductive lexp :: "'a list \ 'a list \ bool" where + lexp_head: "order x y \ length xs = length ys \ lexp (x # xs) (y # ys)" | + lexp_tail: "lexp xs ys \ lexp (x # xs) (x # ys)" + +end + +lemma lexp_prepend: "lexp order ys zs \ lexp order (xs @ ys) (xs @ zs)" + by (induction xs) (simp_all add: lexp_tail) + +lemma lexp_lex: "lexp order xs ys \ (xs, ys) \ lex {(x, y). order x y}" +proof + assume "lexp order xs ys" + thus "(xs, ys) \ lex {(x, y). order x y}" + by (induction xs ys rule: lexp.induct) simp_all +next + assume "(xs, ys) \ lex {(x, y). order x y}" + thus "lexp order xs ys" + by (auto intro!: lexp_prepend intro: lexp_head simp: lex_conv) +qed + +lemma lex_list_wfP: "wfP order \ wfP (lexp order)" + by (simp add: lexp_lex wf_lex wfP_def) + +lemma lex_list_well_founded: + assumes "well_founded order" + shows "well_founded (lexp order)" + using well_founded.intro assms(1)[THEN well_founded.wf, THEN lex_list_wfP] by auto + +end \ No newline at end of file diff --git a/thys/VeriComp/document/root.bib b/thys/VeriComp/document/root.bib new file mode 100644 --- /dev/null +++ b/thys/VeriComp/document/root.bib @@ -0,0 +1,8 @@ +@article{desharnais-jfla2020, + title={A Generic Framework for Verified Compilers Using {I}sabelle/{HOL}’s Locales}, + author={Desharnais, Martin and Brunthaler, Stefan}, + journal={31 {\`e}me Journ{\'e}es Francophones des Langages Applicatifs}, + pages={198}, + year = {2020}, + url = {https://hal.inria.fr/hal-02427360} +} diff --git a/thys/VeriComp/document/root.tex b/thys/VeriComp/document/root.tex new file mode 100644 --- /dev/null +++ b/thys/VeriComp/document/root.tex @@ -0,0 +1,67 @@ +\documentclass[11pt,a4paper]{article} +\usepackage{isabelle,isabellesym} + +% further packages required for unusual symbols (see also +% isabellesym.sty), use only when needed + +\usepackage{amssymb} + %for \, \, \, \, \, \, + %\, \, \, \, \, + %\, \, \ + +%\usepackage{eurosym} + %for \ + +%\usepackage[only,bigsqcap]{stmaryrd} + %for \ + +%\usepackage{eufrak} + %for \ ... \, \ ... \ (also included in amssymb) + +%\usepackage{textcomp} + %for \, \, \, \, \, + %\ + +% this should be the last package used +\usepackage{pdfsetup} + +% urls in roman style, theory text in math-similar italics +\urlstyle{rm} +\isabellestyle{it} + +% for uniform font size +%\renewcommand{\isastyle}{\isastyleminor} + + +\begin{document} + +\title{A Generic Framework for Verified Compilers} +\author{Martin Desharnais} +\maketitle + +\begin{abstract} + This is a generic framework for formalizing compiler transformations. + It leverages Isabelle/HOL’s locales to abstract over concrete languages and transformations. + It states common definitions for language semantics, program behaviours, forward and backward simulations, and compilers. + We provide generic operations, such as simulation and compiler composition, and prove general (partial) correctness theorems, resulting in reusable proof components. + For more details, please see our paper \cite{desharnais-jfla2020}. +\end{abstract} + +\tableofcontents + +% sane default for proof documents +\parindent 0pt\parskip 0.5ex + +% generated text of all theories +\input{session} + +% optional bibliography +\bibliographystyle{abbrv} +\bibliography{root} + +\end{document} + +%%% Local Variables: +%%% mode: latex +%%% TeX-master: t +%%% End: diff --git a/thys/WOOT_Strong_Eventual_Consistency/BasicAlgorithms.thy b/thys/WOOT_Strong_Eventual_Consistency/BasicAlgorithms.thy new file mode 100644 --- /dev/null +++ b/thys/WOOT_Strong_Eventual_Consistency/BasicAlgorithms.thy @@ -0,0 +1,67 @@ +subsection \Basic Algorithms\ + +theory BasicAlgorithms + imports Data ErrorMonad +begin + +text \ + In this section, we introduce preliminary definitions and functions, required by the + integration and edit algorithms in the following sections. +\ + +definition ext_ids :: "('\, '\) woot_character list \ '\ extended list" + where "ext_ids s = \#(map (\x. \ I x \) s)@[\]" + +text \ + The function @{term ext_ids} returns the set of extended identifiers in a string @{term s}, + including the beginning and end markers @{term "\"} and @{term "\"}. +\ + +fun idx :: "('\, '\) woot_character list \ '\ extended \ error + nat" + where + "idx s i = fromSingleton (filter (\j. (ext_ids s ! j = i)) [0..<(length (ext_ids s))])" + +text \ + The function @{term idx} returns the index in @{term w} of a W-character with a given identifier + @{term i}: + % + \begin{itemize} + \item If the identifier @{term i} occurs exactly once in the string then + @{term "idx s \i\ = return (j+1)"} where @{term "I (s ! j) = i"}, otherwise + @{term "idx s \i\"} will be an error. + \item @{term "idx s \ = Inr 0"} and @{term "idx s \ = return (length w + 1)"}. + \end{itemize} +\ + +fun nth :: "('\, '\) woot_character list \ nat \ error + ('\, '\) woot_character" + where + "nth s 0 = error (STR ''Index has to be >= 1.'')" | + "nth s (Suc k) = ( + if k < (length s) then + return (s ! k) + else + error (STR ''Index has to be <= length s''))" + +text \ + The function @{text nth} returns the W-character at a given index in @{term s}. + The first character has the index 1. +\ + +fun list_update :: + "('\, '\) woot_character list \ nat \ ('\, '\) woot_character \ + error + ('\, '\) woot_character list" + where + "list_update s (Suc k) v = ( + if k < length s then + return (List.list_update s k v) + else + error (STR ''Illegal arguments.''))" | + "list_update _ 0 _ = error (STR ''Illegal arguments.'')" + +text \ + The function @{text list_update} substitutes the W-character at the index @{term "k"} in + @{term s} with the W-character @{term v}. As before, we use the convention of using the index 1 + for the first character. +\ + +end diff --git a/thys/WOOT_Strong_Eventual_Consistency/Consistency.thy b/thys/WOOT_Strong_Eventual_Consistency/Consistency.thy new file mode 100644 --- /dev/null +++ b/thys/WOOT_Strong_Eventual_Consistency/Consistency.thy @@ -0,0 +1,141 @@ +subsection \Consistency of sets of WOOT Messages \label{sec:consistency}\ + +theory Consistency + imports SortKeys Psi Sorting DistributedExecution +begin + +definition insert_messages :: "('\, '\) message set \ ('\, '\) insert_message set" + where "insert_messages M = {x. Insert x \ M}" + +lemma insert_insert_message: + "insert_messages (M \ {Insert m}) = insert_messages M \ {m}" + by (simp add:insert_messages_def, simp add:set_eq_iff) + +definition delete_messages :: "('a, 's) message set \ 'a delete_message set" + where "delete_messages M = {x. Delete x \ M}" + +fun depends_on where "depends_on M x y = (x \ M \ y \ M \ I x \ deps (Insert y))" + +definition a_conditions :: + "(('a :: linorder), 's) insert_message set \ ('a extended \ 'a position) \ bool" + where "a_conditions M a = ( + a \ < a \ \ + (\m. m \ M \ a (P m) < a (S m) \ + a \I m\ = \\ (a (P m), a (S m)) (I m)\))" + +definition consistent :: "('a :: linorder, 's) message set \ bool" + where "consistent M \ + inj_on I (insert_messages M) \ + (\ (deps ` M) \ (I ` insert_messages M)) \ + wfP (depends_on (insert_messages M)) \ + (\a. a_conditions (insert_messages M) a)" + +lemma consistent_subset: + assumes "consistent N" + assumes "M \ N" + assumes "\ (deps ` M) \ (I ` insert_messages M)" + shows "consistent M" +proof - + have a:"insert_messages M \ insert_messages N" + using assms(2) insert_messages_def by blast + hence b:"inj_on I (insert_messages M)" + using assms(1) consistent_def inj_on_subset by blast + have "wfP (depends_on (insert_messages N))" + using assms(1) consistent_def by blast + moreover have + "depends_on (insert_messages M) \ depends_on (insert_messages N)" + using a by auto + ultimately have c:"wfP (depends_on (insert_messages M))" + using a wf_subset [to_pred] by blast + obtain a where "a_conditions (insert_messages N) a" + using assms(1) consistent_def by blast + hence "a_conditions (insert_messages M) a" + by (meson a a_conditions_def subset_iff) + thus ?thesis using b c assms(3) consistent_def by blast +qed + +lemma pred_is_dep: "P m = \ i \ \ i \ deps (Insert m)" + by (metis Un_iff deps.simps(1) extended.set_intros extended.simps(27) + extended_to_set.simps(1) insert_message.exhaust_sel) + +lemma succ_is_dep: "S m = \ i \ \ i \ deps (Insert m)" + by (metis Un_insert_right deps.simps(1) extended_to_set.simps(1) insertI1 + insert_message.exhaust_sel) + +lemma a_subset: + fixes M N a + assumes "M \ N" + assumes "a_conditions (insert_messages N) a" + shows "a_conditions (insert_messages M) a" + using assms by (simp add:a_conditions_def insert_messages_def, blast) + +definition delete_maybe :: "'\ \ ('\, '\) message set \ '\ \ '\ option" where + "delete_maybe i D s = (if Delete (DeleteMessage i) \ D then None else Some s)" + +definition to_woot_character :: + "('\, '\) message set \ ('\, '\) insert_message \ ('\, '\) woot_character" + where + "to_woot_character D m = ( + case m of + (InsertMessage l i u s) \ InsertMessage l i u (delete_maybe i D s))" + +lemma to_woot_character_keeps_i [simp]: "I (to_woot_character M m) = I m" + by (cases m, simp add:to_woot_character_def) + +lemma to_woot_character_keeps_i_lifted [simp]: + "I ` to_woot_character M ` X = I ` X" + by (metis (no_types, lifting) image_cong image_image to_woot_character_keeps_i) + +lemma to_woot_character_keeps_P [simp]: "P (to_woot_character M m) = P m" + by (cases m, simp add:to_woot_character_def) + +lemma to_woot_character_keeps_S [simp]: "S (to_woot_character M m) = S m" + by (cases m, simp add:to_woot_character_def) + +lemma to_woot_character_insert_no_eff: + "to_woot_character (insert (Insert m) M) = to_woot_character M" + by (rule HOL.ext, simp add:delete_maybe_def to_woot_character_def insert_message.case_eq_if) + +definition is_associated_string :: + "('a, 's) message set \ ('a :: linorder, 's) woot_character list \ bool" + where "is_associated_string M s \ ( + consistent M \ + set s = to_woot_character M ` (insert_messages M) \ + (\a. a_conditions (insert_messages M) a \ + sorted_wrt (<) (map a (ext_ids s))))" + +fun is_certified_associated_string where + "is_certified_associated_string M (Inr v) = is_associated_string M v" | + "is_certified_associated_string M (Inl _) = False" + +lemma associated_string_unique: + assumes "is_associated_string M s" + assumes "is_associated_string M t" + shows "s = t" + using assms + apply (simp add:ext_ids_def is_associated_string_def consistent_def + sorted_wrt_append) + by (metis sort_set_unique) + +lemma is_certified_associated_string_unique: + assumes "is_certified_associated_string M s" + assumes "is_certified_associated_string M t" + shows "s = t" + using assms by (case_tac s, case_tac [!] t, (simp add:associated_string_unique)+) + +lemma empty_consistent: "consistent {}" +proof - + have "a_conditions {} (\x. (case x of \ \ \ | \ \ \))" + by (simp add: a_conditions_def) + hence "\f. a_conditions {} f" by blast + moreover have "wfP (depends_on {})" by (simp add: wfP_eq_minimal) + ultimately show ?thesis by (simp add:consistent_def insert_messages_def) +qed + +lemma empty_associated: "is_associated_string {} []" + by (simp add:is_associated_string_def insert_messages_def empty_consistent + ext_ids_def a_conditions_def) + +text \The empty set of messages is consistent and the associated string is the empty string.\ + +end diff --git a/thys/WOOT_Strong_Eventual_Consistency/CreateAlgorithms.thy b/thys/WOOT_Strong_Eventual_Consistency/CreateAlgorithms.thy new file mode 100644 --- /dev/null +++ b/thys/WOOT_Strong_Eventual_Consistency/CreateAlgorithms.thy @@ -0,0 +1,70 @@ +subsection \Edit Operations \label{sec:edit}\ + +theory CreateAlgorithms + imports BasicAlgorithms +begin + +fun is_visible :: "('\, '\) woot_character \ bool" + where "is_visible (InsertMessage _ _ _ s) = (s \ None)" + +fun nth_visible :: "('\, '\) woot_character list \ nat \ error + '\ extended" + where + "nth_visible s k = (let v = ext_ids (filter is_visible s) in + if k < length v then + return (v ! k) + else + error (STR ''Argument k out of bounds.''))" + +text \Let @{term l} be the count of visible symbols in @{term s}. The function + @{term "nth_visible s n"}: + % + \begin{itemize} + \item Returns the identifier of the $n$-th visible element in $s$ if $1 \leq n \leq l$. + \item Returns @{term \} if $n = 0$, and @{term \} if $n = l + 1$. + \item Returns an error otherwise. + \end{itemize} + % + Note that, with this definition, the first visible character in the string has the index $1$. + + Algorithms @{text create_insert} and @{term create_delete} detail the process by which messages + are created in response to a user action.\ + +fun from_non_extended :: "'\ extended \ error + '\" + where + "from_non_extended \ i \ = Inr i" | + "from_non_extended _ = error (STR ''Expected InString'')" + +fun create_insert :: + "('\, '\) woot_character list \ nat \ '\ \ '\ \ error + ('\, '\) message" + where "create_insert s n \' i = + do { + p \ nth_visible s n; + q \ nth_visible s (n + 1); + return (Insert (InsertMessage p i q \')) + }" + +text \In particular, when a user inserts a character @{term \'} between visible position + @{term n} and its successor of the string of a peer with state @{term s}, @{term create_insert} + starts by retrieving the identifiers @{term p} of the last visible character before @{term n} + in @{term w} (or @{term \} if no such character exists) and @{text q} of the first + visible one after @{term n} (or @{term \}). + + It then broadcasts the message @{term "Insert (InsertMessage p i q \')"} with the new + identifier @{term i}.\ + +fun create_delete :: "('\, '\) woot_character list \ nat \ error + ('\, '\) message" + where "create_delete s n = + do { + m \ nth_visible s n; + i \ from_non_extended m; + return (Delete (DeleteMessage i)) + }" + +text \When the user deletes the visible character at position @{term n}, @{term create_delete} + retrieves the identifier @{term i} of the @{term n}'th visible character in @{term s} and + broadcasts the message @{term "Delete (DeleteMessage i)"}. + + In both cases the message will be integrated into the peer's own state, with the same + algorithm that integrates messages received from other peers.\ + +end \ No newline at end of file diff --git a/thys/WOOT_Strong_Eventual_Consistency/CreateConsistent.thy b/thys/WOOT_Strong_Eventual_Consistency/CreateConsistent.thy new file mode 100644 --- /dev/null +++ b/thys/WOOT_Strong_Eventual_Consistency/CreateConsistent.thy @@ -0,0 +1,225 @@ +subsection \Create Consistent\label{sec:create_consistent}\ + +theory CreateConsistent + imports CreateAlgorithms Consistency +begin + +lemma nth_visible_inc': + assumes "sorted_wrt (<) (map a (ext_ids s))" + assumes "nth_visible s n = Inr i" + assumes "nth_visible s (Suc n) = Inr j" + shows "a i < a j" +proof - + have "subseq (ext_ids (filter is_visible s)) (ext_ids s)" + by (simp add: ext_ids_def subseq_map) + hence "sorted_wrt (<) (map a (ext_ids (filter is_visible s)))" + using assms(1) subseq_imp_sorted sorted_wrt_map by blast + moreover have a:"Suc n < length (ext_ids (filter is_visible s))" + apply (rule classical) using assms(3) by simp + ultimately show ?thesis using assms(2) assms(3) apply (simp) + using sorted_wrt_nth_less by fastforce +qed + +lemma nth_visible_eff: + assumes "nth_visible s n = Inr i" + shows "extended_to_set i \ I ` set s" +proof - + have "i \ set (ext_ids (filter is_visible s))" + apply (cases "n < length (ext_ids (filter is_visible s))") + using assms by auto + thus ?thesis + apply (simp add: ext_ids_def) + using extended.inject by auto +qed + +lemma subset_mono: + assumes "N \ M" + shows "I ` insert_messages N \ I ` insert_messages M" +proof - + have "insert_messages N \ insert_messages M" using assms + by (metis (no_types, lifting) Collect_mono_iff insert_messages_def subsetCE) + thus ?thesis by (simp add: image_mono) +qed + +lemma deps_insert: + assumes "\ (deps ` M) \ (I ` insert_messages M)" + assumes "deps m \ I ` insert_messages M" + shows "\ (deps ` (M \ {m})) \ (I ` insert_messages (M \ {m}))" +proof - + have "deps m \ I ` insert_messages (M \ {m})" using assms(2) subset_mono + by (metis Un_upper1 order_trans) + thus ?thesis using assms(1) apply (simp) + by (meson rev_subsetD subsetI subset_insertI subset_mono) +qed + +lemma wf_add: + fixes m :: "('a,'b) insert_message" + assumes "wfP (depends_on M)" + assumes "\n. n \ (M \ {m}) \ I m \ deps (Insert n)" + assumes "m \ M" + shows "wfP (depends_on (M \ {m}))" +proof - + have "\Q. Q \ {} \ (\z\Q. \y. (y \ M \ {m}) \ (z \ M \ {m}) \ + I y \ deps (Insert z) \ y \ Q)" + proof - + fix Q :: "('a, 'b) insert_message set" + assume b:"Q \ {}" + show "\z\Q. \y. (y \ M \ {m}) \ (z \ M \ {m}) \ I y \ deps (Insert z) + \ y \ Q" + proof (cases "\x. x \ Q - {m}") + case True + hence "\z\ Q - {m}. \y. (y \ M) \ (z \ M) \ I y \ deps (Insert z) + \ y \ Q - {m}" + by (metis depends_on.simps assms(1) wfP_eq_minimal) + then show ?thesis using assms(2) DiffD2 by auto + next + case False + hence "Q = {m}" using b by blast + thus ?thesis using assms(2) by blast + qed + qed + thus ?thesis by (simp add:wfP_eq_minimal, blast) +qed + +lemma create_insert_p_s_ordered: + assumes "is_associated_string N s" + assumes "a_conditions (insert_messages N) a" + assumes "Inr (Insert m) = create_insert s n \ new_id" + shows "a (P m) < a (S m)" +proof - + obtain p q where pq_def: + "create_insert s n \ new_id = Inr (Insert (InsertMessage p new_id q \))" + by (metis (no_types, lifting) One_nat_def add.right_neutral add_Suc_right + create_insert.elims sum.case_eq_if sum.simps(4) assms(3) bind_def) + have "Inr p = nth_visible s n" using pq_def Error_Monad.bindE by fastforce + moreover have "Inr q = nth_visible s (Suc n)" + using pq_def Error_Monad.bindE by fastforce + ultimately have "a p < a q" + using assms by (metis is_associated_string_def nth_visible_inc') + moreover have "m = InsertMessage p new_id q \" + using assms(3) pq_def by auto + ultimately show ?thesis by (simp add: pq_def) +qed + +lemma create_insert_consistent: + assumes "consistent M" + assumes "is_associated_string N s" + assumes "N \ M" + assumes "Inr m = create_insert s n \ new_id" + assumes "new_id \ I ` insert_messages M" + shows "consistent (M \ {m})" +proof - + obtain p q where pq_def: + "create_insert s n \ new_id = Inr (Insert (InsertMessage p new_id q \))" + by (metis (no_types, lifting) One_nat_def add.right_neutral add_Suc_right + create_insert.elims assms(4) sum.case_eq_if sum.simps(4) bind_def) + define m' where "m' = InsertMessage p new_id q \" + hence a:"m = Insert m'" using pq_def assms(4) by auto + hence d: "create_insert s n \ new_id = Inr (Insert m')" + using pq_def assms by simp + have b:"I m' = new_id" using m'_def by (simp add:I_def) + hence "inj_on I (insert_messages M \ {m'})" using assms(5) assms(1) + using consistent_def by fastforce + hence "inj_on I (insert_messages (M \ {m}))" using assms(4) pq_def m'_def + by (metis Inr_inject insert_insert_message) + moreover + have p:"extended_to_set p \ I ` set s" using pq_def nth_visible_eff by fastforce + have q: "extended_to_set q \ I ` set s" + using pq_def apply (simp add:bind_def del:nth_visible.simps) + apply (cases "nth_visible s n", simp) + by (cases "nth_visible s (Suc n)", simp, simp add: nth_visible_eff) + have "extended_to_set p \ extended_to_set q \ I ` set s" using p q by simp + hence "extended_to_set p \ extended_to_set q \ I ` insert_messages N" + by (metis assms(2) is_associated_string_def to_woot_character_keeps_i_lifted) + hence "extended_to_set p \ extended_to_set q \ I ` insert_messages M" + using assms(3) subset_mono by blast + hence c:"deps m \ I ` insert_messages M" using pq_def assms(4) by auto + hence "\ (deps ` (M \ {m})) \ (I ` insert_messages (M \ {m}))" + by (metis consistent_def assms(1) deps_insert) + moreover have w: + "\n \ insert_messages M \ {m'}. deps (Insert n) \ I ` insert_messages M" + by (metis a c consistent_def assms(1) Sup_le_iff imageI insert_iff + insert_is_Un insert_messages_def mem_Collect_eq sup.commute) + hence "\n \ insert_messages M \ {m'}. I m' \ deps (Insert n)" + using b assms(5) by blast + hence "wfP (depends_on (insert_messages M \ {m'}))" + by (metis Un_insert_right insert_absorb wf_add assms(1) + consistent_def sup_bot.right_neutral) + moreover obtain a where a_def: "a_conditions (insert_messages M) a" + using consistent_def assms(1) by blast + define a' where + "a' = (\i. if i = \ new_id \ then \\ (a (P m'), a(S m')) new_id\ else a i)" + hence "a_conditions (insert_messages (M \ {m})) a'" + proof - + have "a' \ < a' \" using a'_def a_conditions_def a_def by auto + moreover have + "\m''. m'' \ (insert_messages M \ {m'}) \ + a'(P m'') < a'(S m'') \ + a' \I m''\ = \\ (a'(P m''), a'(S m'')) (I m'')\" + proof + fix m'' + assume e:" m'' \ (insert_messages M \ {m'})" + show "a'(P m'') < a'(S m'') \ a' \ I m''\ = + \\ (a'(P m''), a'(S m'')) (I m'')\" + proof (cases "m'' \ insert_messages M") + case True + moreover have "deps (Insert m'') \ I ` insert_messages M" + using e w by blast + hence "P m'' \ \ new_id \ \ S m'' \ \ new_id \" + by (meson assms(5) contra_subsetD pred_is_dep succ_is_dep) + moreover have "I m'' \ new_id" + using assms(5) True by blast + ultimately show ?thesis using a_def True + by (simp add: a_conditions_def a'_def) + next + case False + moreover have "I m'' = new_id" using False b e by blast + moreover have "deps (Insert m'') \ I ` insert_messages M" + using False a c e by blast + hence "P m'' \ \ new_id \ \ S m'' \ \ new_id \" + by (meson assms(5) contra_subsetD pred_is_dep succ_is_dep) + moreover have "a_conditions (insert_messages N) a" + using a_def a_subset assms is_associated_string_def by blast + hence "a (P m') < a (S m')" + by (metis assms(2) d create_insert_p_s_ordered) + hence "a' (P m'') < a' (S m'')" using calculation a'_def False e by auto + ultimately show ?thesis using e a'_def by auto + qed + qed + ultimately show "?thesis" using a_conditions_def + by (metis a insert_insert_message) + qed + ultimately show "?thesis" using consistent_def a by (metis insert_insert_message) +qed + +lemma bind_simp: "(x \ (\l. y l) = Inr r) \ (y (projr x) = Inr r)" + using isOK_I by force + +lemma create_delete_consistent: + assumes "consistent M" + assumes "is_associated_string N s" + assumes "N \ M" + assumes "Inr m = create_delete s n" + shows "consistent (M \ {m})" +proof - + obtain i where pq_def: "create_delete s n = Inr (Delete (DeleteMessage i))" + by (metis (no_types, lifting) Error_Monad.bindE create_delete.simps assms(4)) + hence a: "m = Delete (DeleteMessage i)" using assms(4) by auto + hence b: "insert_messages (M \ {m}) = insert_messages M" + by (simp add:insert_messages_def) + have "n \ 0" apply (rule classical) using pq_def by (simp add:bind_def ext_ids_def) + then obtain u where "n = Suc u" using not0_implies_Suc by blast + then have "i \ I ` set s" using pq_def + apply (cases "u < length (filter is_visible s)") + apply (simp add:bind_simp ext_ids_def nth_append) + apply (meson filter_is_subset imageI in_set_conv_nth subset_code(1)) + apply (cases "u = length (filter is_visible s)") + by (simp add:bind_def ext_ids_def nth_append)+ + hence "i \ I ` insert_messages N" using assms + by (metis is_associated_string_def to_woot_character_keeps_i_lifted) + hence c:"deps m \ I ` insert_messages M" using a + by (metis assms(3) deps.simps(2) singletonD subsetCE subsetI subset_mono) + then show "?thesis" using assms(1) b by (simp add:consistent_def) +qed + +end \ No newline at end of file diff --git a/thys/WOOT_Strong_Eventual_Consistency/Data.thy b/thys/WOOT_Strong_Eventual_Consistency/Data.thy new file mode 100644 --- /dev/null +++ b/thys/WOOT_Strong_Eventual_Consistency/Data.thy @@ -0,0 +1,194 @@ +section \The WOOT Framework \label{sec:wootFramework}\ + +theory Data + imports Main Datatype_Order_Generator.Order_Generator +begin + +text \% + \begin{figure}[t] + \centering + \begin{tikzpicture}[ + peernode/.style={rectangle, draw=black, thick, scale=0.8}, + eventnode/.style={rectangle, draw=black, fill=black!20, thick,rounded corners=.1cm, + scale=0.8}, + statenode/.style={rectangle, draw=black, thick,rounded corners=.1cm, + scale=0.8}, + ] + % Nodes. + \node[peernode] (peerA) at (0, 0) {Peer A}; + \node[peernode] (peerB) at (4, 0) {Peer B}; + \node[peernode] (peerC) at (8, 0) {Peer C}; + \node[statenode] (stateA1) at (0, -1) {$[]$}; + \node[statenode] (stateB1) at (4, -1) {$[]$}; + \node[statenode] (stateC1) at (8, -1) {$[]$}; + \node[eventnode] (eventA1) at (0, -2) {\emph{Send} (InsM $\vdash (A,0) \dashv I)$}; + \node[eventnode] (eventB1) at (4, -2) {\emph{Send} (InsM $\vdash (B,0) \dashv N)$}; + \node[eventnode] (eventB2) at (4, -3) {\emph{Recv} $(B,0)$}; + % Lines. + \node[statenode] (stateB2) at (4, -4) {$[N_{(B,0)}]$}; + \node[eventnode] (eventB3) at (4, -6) {\emph{Recv} $(A,0)$}; + % Lines + \node[statenode] (stateB3) at (4, -7) {$[I_{(A,0)} N_{(B,0)}]$}; + \node[eventnode] (eventB4) at (4, -8) {\emph{Recv} $(C,1)$}; + % Lines. + \node[statenode] (stateB4) at (4, -9) {$[I_{(A,0)} N_{(B,0)} K_{(C,1)}]$}; + \node[eventnode] (eventA2) at (0, -3) {\emph{Recv} $(A,0)$}; + \node[statenode] (stateA2) at (0, -4) {$[I_{(A,0)}]$}; + \node[eventnode] (eventA3) at (0, -6) {\emph{Recv} $(B,0)$}; + \node[statenode] (stateA3) at (0, -7) {$[I_{(A,0)} N_{(B,0)}]$}; + \node[eventnode] (eventA4) at (0, -8) {\emph{Recv} $(C,1)$}; + \node[statenode] (stateA4) at (0, -9) {$[I_{(A,0)} N_{(B,0)} K_{(C,1)}]$}; + \node[eventnode] (eventC1) at (8, -3) {\emph{Recv} $(A,0)$}; + \node[statenode] (stateC2) at (8, -4) {$[I_{(A,0)}]$}; + \node[eventnode] (eventC2) at (8, -5) {\emph{Send} $InsM (A,0) (C,1) \dashv K$}; + \node[eventnode] (eventC3) at (8, -6) {\emph{Recv} $(C,1)$}; + \node[statenode] (stateC3) at (8, -7) {$[I_{(A,0)} K_{(C,1)}]$}; + \node[eventnode] (eventC4) at (8, -8) {\emph{Recv} $(B,0)$}; + \node[statenode] (stateC4) at (8, -9) {$[I_{(A,0)} N_{(B,0)} K_{(C,1)}]$}; + % Lines. + \draw[->] (peerA.south) -- (stateA1.north); + \draw[->] (peerB.south) -- (stateB1.north); + \draw[->] (peerC.south) -- (stateC1.north); + \draw[->] (stateA1.south) -- (eventA1.north); + \draw[->] (eventA1.south) -- (eventA2.north); + \draw[->] (eventA2.south) -- (stateA2.north); + \draw[->] (stateA2.south) -- (eventA3.north); + \draw[->] (eventA3.south) -- (stateA3.north); + \draw[->] (stateA3.south) -- (eventA4.north); + \draw[->] (eventA4.south) -- (stateA4.north); + \draw[->] (stateB1.south) -- (eventB1.north); + \draw[->] (eventB1.south) -- (eventB2.north); + \draw[->] (eventB2.south) -- (stateB2.north); + \draw[->] (stateB2.south) -- (eventB3.north); + \draw[->] (eventB3.south) -- (stateB3.north); + \draw[->] (stateB3.south) -- (eventB4.north); + \draw[->] (eventB4.south) -- (stateB4.north); + \draw[->] (stateC1.south) -- (eventC1.north); + \draw[->] (eventC1.south) -- (stateC2.north); + \draw[->] (stateC2.south) -- (eventC2.north); + \draw[->] (eventC2.south) -- (eventC3.north); + \draw[->] (eventC3.south) -- (stateC3.north); + \draw[->] (stateC3.south) -- (eventC4.north); + \draw[->] (eventC4.south) -- (stateC4.north); + \end{tikzpicture}% + \caption{Example session with 3 peers. Each peer creates an update message and sends a copy of + it to the other two peers. Each peer integrates the messages in a different order. + The white rounded boxes represent states, for brevity we only show the W-character's symbol and + identifier. Although a W-character's data structure stores the identifiers of its predecessor + and successor from its original creation event. The gray round boxes represent events, + we abbreviate the reception events, with the identifier of the W-character, although the peer + receives the full insert message.}% + \label{fig:session}% + \end{figure} + Following the presentation by Oster et al.~\cite{oster2006data} we describe the WOOT framework as + an operation-based CRDT~\cite{shapiro2011conflict}. + + In WOOT, the shared data type is a string over an alphabet @{text "'\"}. + Each peer starts with a prescribed initial state representing the empty string. + Users can perform two types of edit operations on the string at their peer: + \begin{itemize} + \item Insert a new character. + \item Delete an existing character. + \end{itemize} + + Whenever a user performs one of these operations, their peer will create an update message (see + Section~\ref{sec:edit}), integrate it immediately into its state, and send it to every other peer. + + An update message created at a peer may depend on at most two of the previously integrated + messages at that peer. + A message cannot be delivered to a peer if its antecedents have not been delivered to it yet. + In Section~\ref{sec:networkModel} we describe a few possible methods to implement this + requirement, as there is a trade-off between causal consistency and scalability. + + Once delivered to a remote peer, an update message will be integrated to the peers' state. + The integration algorithm for an update message is the same whether the message originated at the + same or at a different peer (see Section~\ref{sec:integrate}). + + The interaction of the WOOT Framework can be visualized using a space-time + diagram~\cite{kshemkalyani2011distributed}. + An example session between 3 peers is shown in Figure~\ref{fig:session}. + Note that, each peer sees the edit operations in a different order.\ + +subsection \Symbol Identifiers \label{sec:symbolIdentifiers}\ + +text \The WOOT Framework requires a unique identifier for each insert operation, which it keeps + associated with the inserted symbol. + The identifier may not be used for another insertion operation on the same or any other peer. + Moreover the set of identifiers must be endowed with a total linear order. + We will denote the set of identifiers by @{text "'\ :: linorder" }. + + Note that the order on the identifiers is not directly used as a global order over the inserted + symbols, in contrast to the sort-key based approaches: LSEQ, LOGOOT, or TreeDoc. In particular, + this means we do not require the identifier space to be dense. + + In the modelling in Section \ref{sec:networkModel}, we will use the pair consisting of a unique + identifier for the peer and the count of messages integrated or sent by that peer, with the + lexicographic order induced by the Cartesian product of the peer identifier and the counter. + + It is however possible to use other methods to generate unique identifiers, as long as the above + requirements are fulfilled.\ + +subsubsection \Extended Identifiers\ + +datatype '\ extended + = Begin ("\") + | InString '\ ("(1\_\)") + | End ("\") +derive linorder extended + +text \We embed the set of identifiers in an extension containing two additional elements + denoting the smallest (resp. largest) element of the extension. The order of identifiers with + respect to each other is preserved. The extended set is used in the corner cases, where a + W-character is inserted at the beginning or end of the string - and there is no preceeding resp. + succeeding W-character to reference. See also the following section.\ + +subsection \Messages \label{sec:messages}\ + +datatype ('\, '\) insert_message = + InsertMessage (P:"'\ extended") (I:'\) (S:"'\ extended") (\:'\) + +datatype '\ delete_message = DeleteMessage '\ + +datatype ('\, '\) message = + Insert "('\, '\) insert_message" | + Delete "'\ delete_message" + +text \Two kinds of update messages are exchanged in the WOOT Framework, indicating + respectively an insertion or a deletion of a character. Thus the set of messages is a sum + type @{type "message"}. + + An insert message @{term "Insert m"} has the following four components: + \begin{itemize} + \item @{term "P m"} and @{term "S m"} denote the identifiers of the character immediately + preceding (resp. succeeding) the character at the time of its insertion. + The special value @{term "\"} (resp. @{term "\"}) indicates that there + was no such character, i.e., that it was inserted at the beginning (resp. end) of the string. + \item @{term "I m"} denotes the unique identifier associated to the character (as described in + Subsection~\ref{sec:symbolIdentifiers}). + \item @{term "\ m"} denotes the inserted character. + \end{itemize}\ + +subsection \States \label{sec:states}\ + +type_synonym ('\, '\) woot_character = "('\, '\ option) insert_message" + +text \A W-character @{term "w"} is the representation of an inserted character in the state of a + peer. It has the same semantics and notation for its components as an insert message, with the + difference that @{term "\ w"} can be @{term "Some \"} denoting an inserted character, or + @{term "None"} if the character has already been deleted. + Because of this overlap in semantics, we define the type of W-characters as a type synonym. + + The state of a peer is then a string of W-characters + @{text "s :: ('\, '\) woot_character list"}. + The initial state is the empty string @{term "[]"}. + The string the user sees is the sequence of symbols omitting @{term "None"}s, i.e., the sequence: + @{text "[\. Some \ \ map \ s]"}.\ + +fun to_woot_char :: "('\, '\) insert_message \ ('\, '\) woot_character" + where + "to_woot_char (InsertMessage p i s \) = InsertMessage p i s (Some \)" + +text \An insert message can be converted into a W-character by applying @{term Some} to the symbol + component.\ + +end diff --git a/thys/WOOT_Strong_Eventual_Consistency/DistributedExecution.thy b/thys/WOOT_Strong_Eventual_Consistency/DistributedExecution.thy new file mode 100644 --- /dev/null +++ b/thys/WOOT_Strong_Eventual_Consistency/DistributedExecution.thy @@ -0,0 +1,189 @@ +subsection \Network Model \label{sec:networkModel}\ + +text \In the past subsections, we described the algorithms each peer uses to integrate received + messages and broadcast new messages when an edit operation has been made on that peer. + + In this section, we model the WOOT Framework as a distributed application and set the + basis for the consistency properties, we want to establish. + + We assume a finite set of peers starting with the same initial state of an empty W-string, each + peer reaches a finite set of subsequent states, caused by the integration of received (or locally + generated messages). A message is always generated from a concrete state of a peer, using the + algorithms described in Section \ref{sec:edit}. Moreover, we assume that the same message will only + be delivered once to a peer. Finally, we assume that the happened before relation, formed by + \begin{itemize} + \item Subsequent states of the same peer + \item States following the reception and states that were the generation sites + \end{itemize} + do not contain loops. (Equivalently that the transitive closure of the relation is a strict + partial order.) + + The latter is a standard assumption in the modelling of distributed systems (compare e.g. + \cite[Chapter 6.1]{raynal2013}) effectively implied by the fact that there are no physical causal + loops. + + Additionally, we assume that a message will be only received by a peer, when the antecedent + messages have already been received by the peer. This is a somewhat technical assumption to + simplify the description of the system. In a practical implementation a peer would buffer the set + of messages that cannot yet be integrated. Note that this assumption is automatically implied if + causal delivery is assumed. + + We establish two properties under the above assumptions + \begin{itemize} + \item The integration algorithm never fails. + \item Two peers having received the same set of messages will be in the same state. + \end{itemize} + + The model assumptions are derived from Gomes et al.\cite{gomes2017verifying} and + Shapiro et al.\cite{shapiro:inria-00555588} with minor modifications required for WOOT.\ + +theory DistributedExecution + imports IntegrateAlgorithm CreateAlgorithms "HOL-Library.Product_Lexorder" +begin + +type_synonym 'p event_id = "'p \ nat" + +datatype ('p,'s) event = + Send "('p event_id, 's) message" | + Receive "'p event_id" "('p event_id, 's) message" + +text \The type variable @{typ "'p"} denotes a unique identifier identifying a peer. + We model each peer's history as a finite sequence of events, where each event is either + the reception or broadcast of a message. + The index of the event in a peer's history and its identifier form a pair uniquely identifying + an event in a distributed execution of the framework. + In the case of a reception, @{term "Receive s m"} indicated the reception of the message @{term m} + sent at event @{term "s"}. + + In the following we introduce the locale @{text "dist_execution_preliminary"} from which the + @{text "dist_execution"} locale will inherit. The reason for the introduction of two + locales is technical - in particular, it is not possible to interleave definitions and assumptions + within the definition of a locale. The preliminary locale only introduces the assumption that the + set of participating peers is finite.\ + +locale dist_execution_preliminary = + fixes events :: "('p :: linorder) \ ('p,'s) event list" + \ \We introduce a locale fixing the sequence of events per peer.\ + + assumes fin_peers: "finite (UNIV :: 'p set)" + \ \We are assuming a finite set of peers.\ + +begin + +fun is_valid_event_id + where "is_valid_event_id (i,j) = (j < length (events i))" + +fun event_pred + where "event_pred (i,j) p = (is_valid_event_id (i,j) \ p (events i ! j))" + +fun event_at + where "event_at i m = event_pred i ((=) m)" + +fun is_reception + where + "is_reception i j = event_pred j (\e. case e of Receive s _ \ s = i | _ \ False)" + +fun happened_immediately_before where + "happened_immediately_before i j = ( + is_valid_event_id i \ + is_valid_event_id j \ + ((fst i = fst j \ Suc (snd i) = snd j) \ is_reception i j))" + +text \ + The @{term happened_immediately_before} describes immediate causal precedence: + \begin{itemize} + \item An events causally precedes the following event on the same peer. + \item A message broadcast event causally precedes the reception event of it. + \end{itemize} + + The transitive closure of this relation is the famous happened before relation introduced + by Lamport\cite{Lamport1978}. + + In the @{text "dist_execution"} we will assume that the relation is acyclic - which implies that + the transitive closure @{term "happened_immediately_before\<^sup>+\<^sup>+"} is a strict partial + order. +\ + +text \Each peer passes through a sequence of states, which may change after receiving a message. + We denote the initial state of peer $p$ as $(p,0)$ and the state after + event $(p,i)$ as $(p,i+1)$. Note that there is one more state per peer than events, since we + are count both the initial and terminal state of a peer.\ + +fun is_valid_state_id + where "is_valid_state_id (i,j) = (j \ length (events i))" + +fun received_messages + where + "received_messages (i,j) = [m. (Receive _ m) \ (take j (events i))]" + +fun state where "state i = foldM integrate [] (received_messages i)" + +text \Everytime a peer receives a message its state is updated by integrating the message. The + function @{term state} returns the state for a given state id.\ + +end + +text \ The function @{text deps} computes the identifiers a message depends on. \ + +fun extended_to_set :: "'a extended \ 'a set" + where + "extended_to_set \i\ = {i}" | + "extended_to_set _ = {}" + +fun deps :: "('id, 's) message \ 'id set" + where + "deps (Insert (InsertMessage l _ u _)) = extended_to_set l \ extended_to_set u" | + "deps (Delete (DeleteMessage i)) = {i}" + +locale dist_execution = dist_execution_preliminary + + assumes no_data_corruption: + "\i s m. event_at i (Receive s m) \ event_at s (Send m)" + \ \A received message must also have been actually broadcast. Note that, we do not + assume that a broadcast message will be received by all peers, similar to the modelling made by + \cite[Section 5.2]{gomes2017verifying}.\ + + assumes at_most_once: + "\i j s m. + event_at i (Receive s m) \ + event_at j (Receive s m) \ + fst i = fst j \ i = j" + \ \A peer will never receive the same message twice. Note that this is something + that can be easily implemented in the application layer, if the underlying transport mechanism + does not guarantee it.\ + + assumes acyclic_happened_before: + "acyclicP happened_immediately_before" + \ \The immediate causal precendence relation is acyclic, which implies that its + closure, the \emph{happened before} relation is a strict partial order.\ + + assumes semantic_causal_delivery: + "\m s i j i'. event_at (i,j) (Receive s m) \ i' \ deps m \ + \s' j' m'. event_at (i,j') (Receive s' (Insert m')) \ j' < j \ I m' = i'" + \ \A message will only be delivered to a peer, if its + antecedents have already been delivered. (See beginning of this Section for the reason of this + assumption).\ + + assumes send_correct: + "\m i. event_at i (Send m) \ + (\n \. return m = state i \ (\s. create_insert s n \ i)) \ + (\n. return m = state i \ (\s. create_delete s n))" + \ \A peer broadcasts messages by running the @{term create_insert} or @{term create_delete} + algorithm on its current state. In the case of an insertion the new character is assigned + the event id as its identifier. Note that, it would be possible to assume, a different choice + for allocating unique identifiers to new W-characters. We choose the event id since it is + automatically unique.\ + +begin + +text \Based on the assumptions above we show in Section \ref{sec:strong_eventual_consistency}: + \begin{itemize} + \item \emph{Progress}: All reached states @{term "state i"} will be successful, i.e., the + algorithm @{term integrate} terminates and does not fail. + \item \emph{Strong Eventual Consistency}: Any pair of states @{term "state i"} + and @{term "state j"} which have been reached after receiving the same set of messages, + i.e., @{term "set (received_messages i) = set (received_messages j)"} will be equal. + \end{itemize}\ + +end + +end diff --git a/thys/WOOT_Strong_Eventual_Consistency/ErrorMonad.thy b/thys/WOOT_Strong_Eventual_Consistency/ErrorMonad.thy new file mode 100644 --- /dev/null +++ b/thys/WOOT_Strong_Eventual_Consistency/ErrorMonad.thy @@ -0,0 +1,52 @@ +section \Preliminary Notes\ + +subsection \Algorithms in Isabelle\ +theory ErrorMonad + imports + "Certification_Monads.Error_Monad" +begin + +text \\noindent Isabelle's functions are mathematical functions and not necessarily algorithms. For + example, it is possible to define a non-constructible function:\ + +fun non_constructible_function where + "non_constructible_function f = (if (\n. f n = 0) then 1 else 0)" + +text \\noindent and even prove properties of them, like for example: + + \begin{center} + @{lemma "non_constructible_function (\x. (Suc 0)) = (0 :: nat)" by auto} + \end{center} + + In addition to that, some native functions in Isabelle are under-defined, e.g., + @{term "[] ! 1"}. But it is still possible to show lemmas about these undefined values, e.g.: + @{lemma "[] ! 1 = [a,b] ! 3" by simp}. + While it is possible to define a notion of algorithm in Isabelle~\cite{klein2018java}, we think + that this is not necessary for the purpose of this formalization, since the reader needs to verify + that the formalized functions correctly model the algorithms described by + Oster et al.~\cite{oster2006data} anyway. + However, we show that Isabelle can generate code for the functions, indicating that + non-constructible terms are not being used within the algorithms.\ + +type_synonym error = String.literal + +fun assert :: "bool \ error + unit" + where + "assert False = error (STR ''Assertion failed.'')" | + "assert True = return ()" + +fun fromSingleton :: "'a list \ error + 'a" + where + "fromSingleton [] = error (STR ''Expected list of length 1'')" | + "fromSingleton (x # []) = return x" | + "fromSingleton (x # y # ys) = error (STR ''Expected list of length 1'')" + +text \Moreover, we use the error monad---modelled using the @{type sum} type---and + build wrappers around partially defined Isabelle functions such that the + evaluation of undefined terms and violation of invariants expected by the + algorithms result in error values. + + We are able to show that all operations succeed without reaching unexpected states during the + execution of the framework.\ + +end diff --git a/thys/WOOT_Strong_Eventual_Consistency/Example.thy b/thys/WOOT_Strong_Eventual_Consistency/Example.thy new file mode 100644 --- /dev/null +++ b/thys/WOOT_Strong_Eventual_Consistency/Example.thy @@ -0,0 +1,211 @@ +section \Example\label{sec:example}\ + +theory Example + imports SEC +begin + +text \In this section we formalize the example from Figure \ref{fig:session} for a possible run of +the WOOT framework with three peers, each performing an edit operation. We verify that it fulfills +the conditions of the locale @{locale dist_execution} and apply the theorems.\ + +datatype example_peers + = PeerA + | PeerB + | PeerC +derive linorder example_peers + +fun example_events :: "example_peers \ (example_peers, char) event list" where + "example_events PeerA = [ + Send (Insert (InsertMessage \ (PeerA, 0) \ CHR ''B'')), + Receive (PeerA, 0) (Insert (InsertMessage \ (PeerA, 0) \ CHR ''B'')), + Receive (PeerB, 0) (Insert (InsertMessage \ (PeerB, 0) \ CHR ''A'')), + Receive (PeerC, 1) (Insert (InsertMessage \(PeerA, 0)\ (PeerC, 1) \ CHR ''R'')) + ]" | + "example_events PeerB = [ + Send (Insert (InsertMessage \ (PeerB, 0) \ CHR ''A'')), + Receive (PeerB, 0) (Insert (InsertMessage \ (PeerB, 0) \ CHR ''A'')), + Receive (PeerA, 0) (Insert (InsertMessage \ (PeerA, 0) \ CHR ''B'')), + Receive (PeerC, 1) (Insert (InsertMessage \(PeerA, 0)\ (PeerC, 1) \ CHR ''R'')) + ]" | + "example_events PeerC = [ + Receive (PeerA, 0) (Insert (InsertMessage \ (PeerA, 0) \ CHR ''B'')), + Send (Insert (InsertMessage \(PeerA, 0)\ (PeerC, 1) \ CHR ''R'')), + Receive (PeerC, 1) (Insert (InsertMessage \(PeerA, 0)\ (PeerC, 1) \ CHR ''R'')), + Receive (PeerB, 0) (Insert (InsertMessage \ (PeerB, 0) \ CHR ''A'')) + ]" + +text \The function @{term example_events} returns the sequence of events that each +peer evaluates. We instantiate the preliminary context by showing that the set of +peers is finite.\ + +interpretation example: dist_execution_preliminary "example_events" +proof + have a:"UNIV = {PeerA, PeerB, PeerC}" + using example_events.cases by auto + show "finite (UNIV :: example_peers set)" by (simp add:a) +qed + +text \ + To prove that the @{term happened_before} relation is acyclic, we provide an order on the state + that is consistent with it, i.e.: + \begin{itemize} + \item The assigned indicies for + successive states of the same peer are increasing. + \item The assigned index of a state receiving a message is + larger than the assigned index of the messages source state. + \end{itemize} +\ + +fun witness_acyclic_events :: "example_peers event_id \ nat" + where + "witness_acyclic_events (PeerA, 0) = 0" | + "witness_acyclic_events (PeerB, 0) = 1" | + "witness_acyclic_events (PeerA, (Suc 0)) = 2" | + "witness_acyclic_events (PeerB, (Suc 0)) = 3" | + "witness_acyclic_events (PeerC, 0) = 4" | + "witness_acyclic_events (PeerC, (Suc 0)) = 5" | + "witness_acyclic_events (PeerC, (Suc (Suc 0))) = 6" | + "witness_acyclic_events (PeerC, (Suc (Suc (Suc 0)))) = 7" | + "witness_acyclic_events (PeerA, (Suc (Suc 0))) = 8" | + "witness_acyclic_events (PeerA, (Suc (Suc (Suc 0)))) = 9" | + "witness_acyclic_events (PeerB, (Suc (Suc 0))) = 8" | + "witness_acyclic_events (PeerB, (Suc (Suc (Suc 0)))) = 9" | + "witness_acyclic_events (PeerA, (Suc (Suc (Suc (Suc n))))) = undefined" | + "witness_acyclic_events (PeerB, (Suc (Suc (Suc (Suc n))))) = undefined" | + "witness_acyclic_events (PeerC, (Suc (Suc (Suc (Suc n))))) = undefined" + +text \ + To prove that the created messages make sense, we provide the edit operation + that results with it. The first function is the inserted letter and the second + function is the position the letter was inserted. +\ + +fun witness_create_letter :: "example_peers event_id \ char" + where + "witness_create_letter (PeerA, 0) = CHR ''B''" | + "witness_create_letter (PeerB, 0) = CHR ''A''" | + "witness_create_letter (PeerC, Suc 0) = CHR ''R''" + +fun witness_create_position :: "example_peers event_id \ nat" + where + "witness_create_position (PeerA, 0) = 0" | + "witness_create_position (PeerB, 0) = 0" | + "witness_create_position (PeerC, Suc 0) = 1" + +text \ + To prove that dependencies of a message are received before a message, we + provide the event id as well as the message, when the peer received a + messages dependency.\ + +fun witness_deps_received_at :: "example_peers event_id \ example_peers event_id \ nat" + where + "witness_deps_received_at (PeerA, Suc (Suc (Suc 0))) (PeerA, 0) = 1" | + "witness_deps_received_at (PeerB, Suc (Suc (Suc 0))) (PeerA, 0) = 2" | + "witness_deps_received_at (PeerC, Suc (Suc 0)) (PeerA, 0) = 0" + +fun witness_deps_received_is :: "example_peers event_id \ example_peers event_id \ (example_peers event_id, char) insert_message" + where + "witness_deps_received_is (PeerA, Suc (Suc (Suc 0))) (PeerA, 0) = (InsertMessage \ (PeerA, 0) \ CHR ''B'')" | + "witness_deps_received_is (PeerB, Suc (Suc (Suc 0))) (PeerA, 0) = (InsertMessage \ (PeerA, 0) \ CHR ''B'')" | + "witness_deps_received_is (PeerC, Suc (Suc 0)) (PeerA, 0) = (InsertMessage \ (PeerA, 0) \ CHR ''B'')" + +lemma well_order_consistent: + fixes i j + assumes "example.happened_immediately_before i j" + shows "witness_acyclic_events i < witness_acyclic_events j" + using assms + apply (rule_tac [!] witness_acyclic_events.cases [where x="i"]) + apply (rule_tac [!] witness_acyclic_events.cases [where x="j"]) + by simp+ + +text \Finally we show that the @{term example_events} meet the assumptions + for the distributed execution context.\ + +interpretation example: dist_execution "example_events" +proof + fix i s m + show + "dist_execution_preliminary.event_at example_events i (Receive s m) \ + dist_execution_preliminary.event_at example_events s (Send m)" + apply (rule_tac [!] witness_acyclic_events.cases [where x="i"]) + by simp+ +next + fix i j s :: "example_peers event_id" + fix m + show "example.event_at i (Receive s m) \ + example.event_at j (Receive s m) \ fst i = fst j \ i = j" + apply (rule_tac [!] witness_acyclic_events.cases [where x="i"]) + apply (rule_tac [!] witness_acyclic_events.cases [where x="j"]) + by simp+ +next + have "wf (inv_image {(x,y). x < y} witness_acyclic_events)" + by (simp add: wf_less) + moreover have "{(x, y). example.happened_immediately_before x y} \ + inv_image {(x,y). x < y} witness_acyclic_events" + using well_order_consistent by auto + ultimately have "wfP example.happened_immediately_before" + using well_order_consistent wfP_def wf_subset by blast + thus "acyclicP example.happened_immediately_before" + using wfP_acyclicP by blast +next + fix m s i j i' + have "example.event_at (i, j) (Receive s m) \ + i' \ deps m \ + example.event_at (i, witness_deps_received_at (i, j) i') (Receive (I (witness_deps_received_is (i, j) i')) (Insert (witness_deps_received_is (i, j) i'))) \ witness_deps_received_at (i, j) i' < j \ I (witness_deps_received_is (i, j) i') = i'" + apply (rule_tac [!] witness_acyclic_events.cases [where x="(i,j)"]) + by simp+ + thus "example.event_at (i, j) (Receive s m) \ + i' \ deps m \ + \s' j' m'. + example.event_at (i, j') (Receive s' (Insert m')) \ j' < j \ I m' = i'" + by blast +next + fix m i + have "example.event_at i (Send m) \ + Inr m = example.state i \ (\s. create_insert s (witness_create_position i) (witness_create_letter i) i)" + apply (rule_tac [!] witness_acyclic_events.cases [where x="i"]) + by (simp add:ext_ids_def)+ + thus "example.event_at i (Send m) \ + (\n \. return m = example.state i \ (\s. create_insert s n \ i)) \ + (\n. return m = example.state i \ (\s. create_delete s n))" + by blast +qed + +text \As expected all peers reach the same final state.\ + +lemma + "example.state (PeerA, 4) = Inr [ + InsertMessage \ (PeerA, 0) \ (Some CHR ''B''), + InsertMessage \ (PeerB, 0) \ (Some CHR ''A''), + InsertMessage \(PeerA, 0)\ (PeerC, 1) \ (Some CHR ''R'')]" + "example.state (PeerA, 4) = example.state (PeerB, 4)" + "example.state (PeerB, 4) = example.state (PeerC, 4)" + by (simp del:substr_simp add:ext_ids_def substr.simps less_example_peers_def)+ + +text \We can also derive the equivalence of states using the strong + convergence theorem. For example the set of received messages in + the third state of peer A and B is equivalent, even though they were + not received in the same order:\ + +lemma + "example.state (PeerA, 3) = example.state (PeerB, 3)" +proof - + have "example.is_valid_state_id (PeerA, 3)" by auto + moreover have "example.is_valid_state_id (PeerB, 3)" by auto + moreover have + "set (example.received_messages (PeerA, 3)) = + set (example.received_messages (PeerB, 3))" + by auto + ultimately show ?thesis + by (rule example.strong_convergence) +qed + +text \Similarly we can conclude that reached states are successful.\ +lemma + "isOK (example.state (PeerC, 4))" +proof - + have "example.is_valid_state_id (PeerC, 4)" by auto + thus ?thesis by (rule example.no_failure) +qed + +end \ No newline at end of file diff --git a/thys/WOOT_Strong_Eventual_Consistency/IntegrateAlgorithm.thy b/thys/WOOT_Strong_Eventual_Consistency/IntegrateAlgorithm.thy new file mode 100644 --- /dev/null +++ b/thys/WOOT_Strong_Eventual_Consistency/IntegrateAlgorithm.thy @@ -0,0 +1,118 @@ +subsection \Integration algorithm \label{sec:integrate}\ + +text \In this section we describe the algorithm to integrate a received message into a peers' + state.\ + +theory IntegrateAlgorithm + imports BasicAlgorithms Data +begin + +fun fromSome :: "'a option \ error + 'a" + where + "fromSome (Some x) = return x" | + "fromSome None = error (STR ''Expected Some'')" + +lemma fromSome_ok_simp [simp]: "(fromSome x = Inr y) = (x = Some y)" + by (cases x, simp+) + +fun substr :: "'a list \ nat \ nat \ 'a list" where + "substr s l u = take (u - (Suc l)) (drop l s)" + +fun concurrent :: + "('a, 's) woot_character list + \ nat + \ nat + \ ('a, 's) woot_character + \ error + ('a extended list)" + where + "concurrent s l u w = + do { + p_pos \ idx s (P w); + s_pos \ idx s (S w); + return (if (p_pos \ l \ s_pos \ u) then [\I w\] else []) + }" + +function integrate_insert + where + "integrate_insert m w p s = + do { + l \ idx w p; + u \ idx w s; + assert (l < u); + if Suc l = u then + return ((take l w)@[to_woot_char m]@(drop l w)) + else do { + d \ mapM (concurrent w l u) (substr w l u); + assert (concat d \ []); + (p', s') \ fromSome (find ((\x.\I m\ < x \ x = s) \ snd) + (zip (p#concat d) (concat d@[s]))); + integrate_insert m w p' s' + } + }" + by fastforce+ + +fun integrate_delete :: + "('a :: linorder) delete_message + \ ('a, 's) woot_character list + \ error + ('a, 's) woot_character list" + where + "integrate_delete (DeleteMessage i) s = + do { + k \ idx s \i\; + w \ nth s k; + list_update s k + (case w of (InsertMessage p i u _) \ InsertMessage p i u None) + }" + +fun integrate :: + "('a, 's) woot_character list + \ ('a :: linorder, 's) message + \ error + ('a, 's) woot_character list" + where + "integrate s (Insert m) = integrate_insert m s (P m) (S m)" | + "integrate s (Delete m) = integrate_delete m s" + +text \Algorithm @{term integrate} describes the main function that is called when a new message + @{term m} has to be integrated into the state @{term s} of a peer. + It is called both when @{term m} was generated locally or received from another peer. + Note that we require that the antecedant messages have already been integrated. See also + Section \ref{sec:networkModel} for the delivery assumptions that ensure this requirement. + + Algorithm @{term integrate_delete} describes the procedure to integrate a delete message: + @{term "DeleteMessage i"}. + The algorithm just replaces the symbol of the W-character with identifier @{term i} with the value + @{term "None"}. + It is not possible to entirely remove a W-character if it is deleted, since there might be + unreceived insertion messages that depend on its position. + + Algorithm @{term integrate_insert} describes the procedure to integrate an insert message: + @{term "m = InsertMessage p i s \"}. + Since insertion operations can happen concurrently and the order of message delivery is not fixed, + it can happen that a remote peer receiving @{term m} finds multiple possible insertion points + between the predecessor @{term p} and successor @{term s} that were recorded when the message + was generated. + An example of this situation is the conflict between + @{term "InsertMessage \ (A,0 :: nat) \ (CHR ''I'')"} and @{term "InsertMessage \ (B,0 :: nat) \ (CHR ''N'')"} + in Figure~\ref{fig:session}. + + A first attempt to resolve this would be to insert the W-characters by choosing an insertion point + using the order induced by their identifiers to achieve a consistent ordering. + But this method fails in some cases: a counter-example was found by + Oster et al.~\cite[section 2]{oster2006data}. + + The solution introduced by the authors of WOOT is to restrict the identifier comparison to the + set of W-characters in the range @{term "substr l u s"} whose predecessor and successor are + outside of the possible range, i.e. @{text "idx s (P w) \ l"} and @{text "idx s (S w) \ u"}. + + New narrowed bounds are selected by finding the first W-character within that restricted set + with an identifier strictly larger than the identifier of the new W-character. + + This leads to a narrowed range where the found character forms an upper bound and its immediately + preceeding character the lower bound. The method is applied recursively until the insertion point + is uniquely determined. + + Note that the fact that this strategy leads to a consistent ordering has only been verified for a + bounded model. + One of the contributions of this paper is to provide a complete proof for it.\ + +end \ No newline at end of file diff --git a/thys/WOOT_Strong_Eventual_Consistency/IntegrateInsertCommute.thy b/thys/WOOT_Strong_Eventual_Consistency/IntegrateInsertCommute.thy new file mode 100644 --- /dev/null +++ b/thys/WOOT_Strong_Eventual_Consistency/IntegrateInsertCommute.thy @@ -0,0 +1,665 @@ +subsection \Termination Proof for @{term integrate_insert}\label{sec:integrate_term}\ + +theory IntegrateInsertCommute + imports IntegrateAlgorithm Consistency CreateConsistent +begin + +text \In the following we show that @{term integrate_insert} terminates. Note that, this does not + yet imply that the return value will not be an error state.\ + +lemma substr_simp [simp]: "substr s l u = nths s {k. l < Suc k \ Suc k < u}" +proof (cases "l \ length s") + case True + have "set (nths (take l s) {k. l < Suc k \ Suc k < u}) = {}" + by (simp add:set_nths) + hence "nths (take l s) {k. l < Suc k \ Suc k < u} = []" by blast + moreover have "{j. Suc (j + l) < u} = {..<(u-Suc l)}" by auto + moreover have "min (length s) l = l" using True by auto + ultimately + have "nths (take l s @ drop l s) {k. l < Suc k \ Suc k < u} = substr s l u" + by (simp add:nths_append del:append_take_drop_id) + then show ?thesis by simp +next + case False + hence "set (nths s {k. l < Suc k \ Suc k < u}) = {}" + by (simp add:set_nths) + hence "nths s {k. l < Suc k \ Suc k < u} = []" by blast + thus ?thesis using False by simp +qed + +declare substr.simps [simp del] + +text \Instead of simplifying @{term substr} with its definition we use @{thm [source] substr_simp} + as a simplification rule. The right hand side of @{thm [source] substr_simp} is a better + representation within proofs. However, we cannot directly define @{term substr} using the right + hand side as it is not constructible term for Isabelle.\ + +lemma int_ins_loop_term_1: + assumes "isOK (mapM (concurrent w l u) t)" + assumes "x \ set (concat (projr (mapM (concurrent w l u) t)))" + shows "x \ (InString \ I) ` (set t)" + using assms + by (induction t, simp, simp add: bind_simp del:idx.simps set_concat, blast) + +lemma fromSingleton_simp: "(fromSingleton xs = Inr x) = ([x] = xs)" + by (cases xs rule: fromSingleton.cases, auto) + +lemma filt_simp: "([b] = filter p [0.. b < n \ (\y < n. p y \ b = y))" + apply (induction n, simp, simp) + by (metis atLeast_upt cancel_comm_monoid_add_class.diff_cancel + filter_empty_conv lessThan_iff less_Suc_eq neq0_conv zero_less_diff) + +lemma substr_eff: + assumes "x \ (InString \ I) ` set (substr w l u)" + assumes "isOK (idx w x)" + shows "l < (projr (idx w x)) \ (projr (idx w x)) < u" +proof - + obtain i where i_def: "idx w x = Inr i" using assms(2) by blast + then have "l < i \ i < u" using assms(1) + apply (simp add: set_nths image_iff fromSingleton_simp filt_simp) + apply (simp add:ext_ids_def) + by (metis (no_types, lifting) Suc_mono length_map less_SucI list_update_id + list_update_same_conv map_update nth_Cons_Suc nth_append) + thus ?thesis using i_def by auto +qed + +lemma find_zip: + assumes "find (cond \ snd) (zip (p#v) (v@[s])) = Some (x,y)" + assumes "v \ []" + shows + "cond y" + "x \ set v \ y \ set v" + "x = p \ (x \ set v \ \(cond x))" + "y = s \ (y \ set v)" +proof - + obtain i where i_def: + "i < Suc (length v)" + "(zip (p#v) (v@[s])) ! i = (x,y)" + "cond y" + "\j. j < i \ \(cond ((v@[s])!j))" + using assms apply (simp add:find_Some_iff) by force + show "cond y" using i_def by auto + show "x \ set v \ y \ set v" using assms(2) i_def(1,2) + by (metis fst_conv in_set_conv_nth length_0_conv length_Cons length_append_singleton + less_Suc_eq less_Suc_eq_0_disj nth_Cons_Suc nth_append nth_zip snd_conv) + show "x = p \ (x \ set v \ (\(cond x)))" + apply (cases i) + using i_def(2) apply auto[1] + by (metis Suc_less_eq fst_conv i_def(1,2,4) length_Cons + length_append_singleton lessI nth_Cons_Suc nth_append nth_mem nth_zip) + show "y = s \ y \ set v" + by (metis diff_is_0_eq' i_def(1,2) in_set_conv_nth length_Cons + length_append_singleton less_Suc_eq_le nth_Cons_0 nth_append nth_zip snd_conv) +qed + +fun int_ins_measure' + where + "int_ins_measure' (m,w,p,s) = ( + do { + l \ idx w p; + u \ idx w s; + assert (l < u); + return (u - l) + })" + +fun int_ins_measure + where + "int_ins_measure (m,w,p,s) = case_sum (\e. 0) id (int_ins_measure' (m,w,p,s))" + +text \We show that during the iteration of @{term integrate_insert}, the arguments are decreasing + with respect to @{term int_ins_measure}. Note, this means that the distance between the + W-characters with identifiers @{term p} (resp. @{term s}) is decreasing.\ + +lemma int_ins_loop_term: + assumes "idx w p = Inr l" + assumes "idx w s = Inr u" + assumes "mapM (concurrent w l u) (substr w l u) = Inr d" + assumes "concat d \ []" + assumes "find ((\x.\I m\ < x \ x = s) \ snd) + (zip (p#concat d) (concat d@[s])) = Some r" + shows "int_ins_measure (m, w, r) < u - l" +proof - + have a: "\x y. x \ set (concat d) \ idx w x = Inr y \ l < y \ y < u" + using int_ins_loop_term_1 substr_eff assms(3) by (metis isOK_I sum.sel(2)) + hence b: "l < u" using assms + by (metis concat.simps(1) diff_is_0_eq less_imp_le_nat + mapM.simps(1) not_less_eq substr.simps sum.sel(2) take0) + obtain p' s' where ps_def: "r = (p', s')" by (cases r, simp+) + show ?thesis + proof (cases "int_ins_measure' (m, w, r)") + case (Inl a) + then show ?thesis using b by (simp add:ps_def) + next + case (Inr b) + then obtain l' u' where ps'_def: "idx w p' = Inr l'" "idx w s' = Inr u'" + using ps_def apply (simp add:bind_simp del:idx.simps) by blast + then have "l' \ l \ l' < u \ u' > l \ u' \ u \ (l' > l \ u' < u)" + using a b ps_def find_zip(2,3,4) assms(1,2,4,5) + by (metis (no_types, lifting) Inr_inject order.order_iff_strict) + thus ?thesis using ps_def ps'_def apply (simp add:bind_simp del:idx.simps) + by (cases "l' < u'", simp del:idx.simps, linarith, simp del:idx.simps) + qed +qed + +lemma assert_ok_simp [simp]: "(assert p = Inr z) = p" by (cases p, simp+) + +termination integrate_insert + apply (relation "measure int_ins_measure", simp) + using int_ins_loop_term by (simp del:idx.simps, blast) + +subsection \Integrate Commutes\ + +locale integrate_insert_commute = + fixes M :: "('a :: linorder, 's) message set" + fixes a :: "'a extended \ 'a position" + fixes s :: "('a, 's) woot_character list" + assumes associated_string_assm: "is_associated_string M s" + assumes a_conditions_assm: "a_conditions (insert_messages M) a" +begin + +lemma dist_ext_ids: "distinct (ext_ids s)" + using associated_string_assm a_conditions_assm + apply (simp add:is_associated_string_def sorted_wrt_map) + by (metis (mono_tags) irreflp_def le_less not_le sorted_wrt_irrefl_distinct) + +lemma I_inj_on_S: + "l < length s \ u < length s \ I(s ! l) = I(s ! u) \ l = u" + using dist_ext_ids apply (simp add:ext_ids_def) + using nth_eq_iff_index_eq by fastforce + +lemma idx_find: + assumes "x < length (ext_ids s)" + assumes "ext_ids s ! x = i" + shows "idx s i = Inr x" + using assms dist_ext_ids nth_eq_iff_index_eq + by (simp add:filt_simp fromSingleton_simp, blast) + +lemma obtain_idx: + assumes "x \ set (ext_ids s)" + shows "\i. idx s x = Inr i" + using idx_find assms by (metis in_set_conv_nth) + +lemma sorted_a: + assumes "idx s x = Inr l" + assumes "idx s y = Inr u" + shows "(l \ u) = (a x \ a y)" +proof - + have "sorted_wrt (<) (map a (ext_ids s))" + using associated_string_assm a_conditions_assm is_associated_string_def by blast + then show ?thesis + using assms apply (simp add:filt_simp fromSingleton_simp) + by (metis leD leI le_less length_map nth_map sorted_wrt_nth_less) +qed + +lemma sorted_a_le: "idx s x = Inr l \ idx s y = Inr u \ (l < u) = (a x < a y)" + by (meson sorted_a not_le) + +lemma idx_intro_ext: "i < length (ext_ids s) \ idx s (ext_ids s ! i) = Inr i" + using dist_ext_ids by (simp add:fromSingleton_simp filt_simp nth_eq_iff_index_eq) + +lemma idx_intro: + assumes "i < length s" + shows "idx s \I (s ! i)\ = Inr (Suc i)" +proof - + have "ext_ids s ! (Suc i) = \I (s ! i)\ \ Suc i < length (ext_ids s)" + using assms by (simp add:ext_ids_def nth_append) + thus ?thesis using idx_intro_ext by force +qed + +end + +locale integrate_insert_commute_insert = integrate_insert_commute + + fixes m + assumes consistent_assm: "consistent (M \ {Insert m})" + assumes insert_assm: "Insert m \ M" + assumes a_conditions_assm_2: + "a_conditions (insert_messages (M \ {Insert m})) a" +begin + +definition invariant where + "invariant pm sm = (pm \ set (ext_ids s) \ sm \ set (ext_ids s) \ + subset (a pm, a sm) (a (P m), a (S m)) \ + elem (a \I m\) (a pm, a sm))" + +fun is_concurrent where + "is_concurrent pm sm x = (x \ set s \ + subset (a pm, a sm) (a (P x), a (S x)) \ + elem (a \I x\) (a pm, a sm))" + +lemma no_id_collision: "I m \ I ` insert_messages M" +proof - + have "inj_on I (insert_messages (M \ {Insert m}))" + using consistent_def consistent_assm by fastforce + hence "I m \ I ` insert_messages M \ Insert m \ M" + by (simp add: image_iff inj_on_eq_iff insert_messages_def) + thus ?thesis using insert_assm by blast +qed + +lemma not_deleted: "to_woot_char m = to_woot_character M m" +proof - + have "Delete (DeleteMessage (I m)) \ M" + proof + assume "Delete (DeleteMessage (I m)) \ M" + hence "deps (Delete (DeleteMessage (I m))) \ I ` insert_messages M" + using consistent_assm associated_string_assm + apply (simp add:consistent_def is_associated_string_def) + using image_subset_iff by fastforce + thus "False" using no_id_collision by simp + qed + thus "to_woot_char m = to_woot_character M m" + by (cases m, simp add:to_woot_character_def delete_maybe_def) +qed + +lemma invariant_imp_sorted: + assumes "Suc l < length (ext_ids s)" + assumes "a(ext_ids s ! l) < a \I m\ \ a \I m\ < a(ext_ids s ! (l+1))" + shows "sorted_wrt (<) (map a (ext_ids ((take l s)@to_woot_char m#drop l s)))" +proof - + have "l \ length s" using assms(1) by (simp add:ext_ids_def) + hence "ext_ids (take l s@to_woot_char m#drop l s) = + (take (Suc l) (ext_ids s))@\I m\#(drop (Suc l) (ext_ids s))" + by (cases m, simp add:ext_ids_def take_map drop_map) + thus ?thesis + using assms associated_string_assm is_associated_string_def a_conditions_assm + apply (simp flip:take_map drop_map) + by (rule insort, simp+, blast) +qed + +lemma no_self_dep: "\ depends_on (insert_messages M \ {m}) m m" +proof - + have "wfP (depends_on (insert_messages M \ {m}))" + using consistent_assm + apply (simp add:consistent_def) + by (metis Un_insert_right insert_insert_message sup_bot.right_neutral) + thus ?thesis + by (metis mem_Collect_eq wfP_eq_minimal) +qed + +lemma pred_succ_order: + "m' \ (insert_messages M \ {m}) \ a(P m') < a \I m'\ \ a(S m') > a \I m'\" + by (metis elem.simps is_interval.simps psi_elem a_conditions_def + a_conditions_assm_2 insert_insert_message) + +lemma find_dep: + assumes "Insert m' \ (M \ {Insert m})" + assumes "i \ deps (Insert m')" + shows "\i\ \ set (ext_ids s)" +proof - + have "i \ I ` insert_messages M" + proof (cases "m' = m") + case True + hence "i \ I ` insert_messages (M \ {Insert m})" + using assms consistent_assm + by (simp add:consistent_def, blast) + moreover have "i \ I m" using assms True no_self_dep by auto + ultimately show ?thesis + by (metis (no_types, lifting) UnE image_Un image_empty image_insert + insert_insert_message singletonD) + next + case False + hence "Insert m' \ M" using assms by simp + then show "i \ I ` insert_messages M" + using assms is_associated_string_def associated_string_assm consistent_def + by (metis (no_types, hide_lams) Union_iff contra_subsetD image_iff) + qed + hence "i \ I ` (set s)" + using associated_string_assm by (simp add:is_associated_string_def) + thus "\i\ \ set (ext_ids s)" + by (simp add:ext_ids_def image_iff) +qed + +lemma find_pred: + "m' \ (insert_messages M \ {m}) \ P m' \ set (ext_ids s)" + using find_dep by (cases "P m'", (simp add:ext_ids_def insert_messages_def pred_is_dep)+) + +lemma find_succ: + "m' \ (insert_messages M \ {m}) \ S m' \ set (ext_ids s)" + using find_dep by (cases "S m'", (simp add:ext_ids_def insert_messages_def succ_is_dep)+) + +fun is_certified_associated_string' where + "is_certified_associated_string' (Inr v) = ( + set v = to_woot_character (M \ {Insert m}) ` + (insert_messages (M \ {Insert m})) \ + sorted_wrt (<) (map a (ext_ids v)))" | + "is_certified_associated_string' (Inl _) = False" + +lemma integrate_insert_final_step: + assumes "invariant pm sm" + assumes "idx s pm = Inr l" + assumes "idx s sm = Inr (Suc l)" + shows "is_certified_associated_string' (Inr (take l s@(to_woot_char m)#drop l s))" +proof - + define t where "t = (take l s@(to_woot_char m)#drop l s)" + hence "set t = set s \ {to_woot_char m}" + by (metis Un_insert_right append_take_drop_id list.simps(15) + set_append sup_bot.right_neutral) + hence + "set t = to_woot_character M ` insert_messages M \ {to_woot_character M m}" + using not_deleted by (metis associated_string_assm is_associated_string_def) + hence + "set t = to_woot_character (M \ {Insert m}) ` insert_messages (M \ {Insert m})" + apply (simp add: to_woot_character_insert_no_eff) + using insert_insert_message by fastforce + moreover have "sorted_wrt (<) (map a (ext_ids t))" using assms invariant_imp_sorted + by (simp add:invariant_def fromSingleton_simp filt_simp t_def) + ultimately show ?thesis + using t_def associated_string_assm by (simp add:is_associated_string_def) +qed + +lemma concurrent_eff: + assumes "idx s pm = Inr l" + assumes "idx s sm = Inr u" + obtains d where "mapM (concurrent s l u) (substr s l u) = Inr d \ + set (concat d) = InString ` I ` {x. is_concurrent pm sm x}" +proof - + define t where "t = substr s l u" + have "set t \ set s \ (isOK (mapM (concurrent s l u) t) \ + set (concat (projr (mapM (concurrent s l u) t))) = + InString ` I ` {x. x \ set t \ a (P x) \ a pm \ a (S x) \ a sm})" + proof (induction t) + case Nil + then show ?case by simp + next + case (Cons th tt) + hence "th \ to_woot_character M ` insert_messages M" + using associated_string_assm by (simp add: is_associated_string_def) + then obtain th' where th'_def: + "th' \ insert_messages M \ P th' = P th \ S th' = S th" + by (metis image_iff to_woot_character_keeps_P to_woot_character_keeps_S) + obtain l' where l'_def: "idx s (P th) = Inr l'" + using th'_def find_pred obtain_idx by fastforce + obtain u' where u'_def: "idx s (S th) = Inr u'" + using th'_def find_succ obtain_idx by fastforce + have "{x. x = \I th\ \ l' \ l \ u \ u'} = + InString ` I ` {x. x = th \ a (P x) \ a pm \ a sm \ a (S x)}" + using sorted_a l'_def u'_def assms + by (rule_tac set_eqI, simp add:image_iff, blast) + then show ?case + using Cons + by (simp add:bind_simp l'_def u'_def + concurrent.simps[where w=th] del:idx.simps, auto) + qed + moreover have + "\x. (x \ set (substr s l u)) = (x \ set s \ a pm < a \I x\ \ a \I x\ < a sm)" + apply (simp add:set_nths in_set_conv_nth) + using sorted_a_le idx_intro assms by blast + ultimately have " + isOK (mapM (concurrent s l u) (substr s l u)) \ + set (concat (projr (mapM (concurrent s l u) (substr s l u)))) = + InString ` I ` {x. is_concurrent pm sm x}" + by (simp only:t_def, fastforce) + thus ?thesis using that by auto +qed + +lemma concurrent_eff_2: + assumes "invariant pm sm" + assumes "is_concurrent pm sm x" + shows "preserve_order \I x\ \I m\ (a \I x\) (a \I m\)" +proof - + have "x \ to_woot_character M ` insert_messages M" + using assms(2) associated_string_assm is_associated_string_def + is_concurrent.elims(2) by blast + then obtain x' where x'_def: "I x = I x' \ P x = P x' \ S x = S x' \ x' \ insert_messages M" + using to_woot_character_keeps_P to_woot_character_keeps_S + to_woot_character_keeps_i by fastforce + have "elem (a \I x\) (a (P m), a (S m))" + using assms by (simp add: invariant_def, auto) + moreover have "elem (a \I m\) (a (P x), a (S x))" + using assms by (simp add: invariant_def, auto) + moreover have "a_conditions (insert_messages M \ {m}) a" + by (metis insert_insert_message a_conditions_assm_2) + ultimately have "preserve_order (I x) (I m) (a \I x\) (a \I m\)" + by (simp add: a_conditions_def psi_preserve_order x'_def) + thus ?thesis by (simp add: preserve_order_def) +qed + +lemma concurrent_eff_3: + assumes "idx s pm = Inr l" + assumes "idx s sm = Inr u" + assumes "Suc l < u" + shows "{x. is_concurrent pm sm x} \ {}" +proof - + define H where + "H = {x. x \ insert_messages M \ a pm < a \I x\ \ a \I x\ < a sm}" + have "wfP (depends_on (insert_messages M))" + using associated_string_assm by (simp add: consistent_def is_associated_string_def) + moreover have f:"H \ insert_messages M" using H_def by blast + hence "depends_on H \ depends_on (insert_messages M)" by auto + ultimately have "wfP (depends_on H)" using wf_subset [to_pred] by blast + moreover + have u: "l < length s" using assms(2) assms(3) + by (simp add:fromSingleton_simp filt_simp, simp add:ext_ids_def) + hence v:"a pm < a \I(s ! l)\ \ a \I(s ! l)\ < a sm" + using sorted_a_le assms u idx_intro by blast + have "I (s ! l) \ I ` insert_messages M" + by (metis image_eqI associated_string_assm is_associated_string_def nth_mem + to_woot_character_keeps_i_lifted u) + hence "\x. x \ H" using v H_def by auto + ultimately obtain z where z_def: "z \ H" "\ y. depends_on H y z \ y \ H" + by (metis wfP_eq_minimal) + have a:"\x. x \ deps (Insert z) \ \(a pm < a \x\ \ a \x\ < a sm)" + proof - + fix x + assume a:"x \ deps (Insert z)" + hence "x \ I ` insert_messages M" + using insert_messages_def associated_string_assm + apply (simp add:consistent_def is_associated_string_def) + using H_def z_def(1) by blast + then obtain x' where x'_def: "x' \ insert_messages M \ x = I x'" by blast + hence "x' \ H" using z_def + using a depends_on.simps by blast + thus "\(a pm < a \x\ \ a \x\ < a sm)" using H_def x'_def by blast + qed + have "ext_ids s ! 0 = \ \ 0 < length (ext_ids s)" by (simp add:ext_ids_def) + hence b:"\(a pm < a \)" + by (metis not_less_zero sorted_a_le assms(1) idx_intro_ext) + have "ext_ids s ! (Suc (length s)) = \ \ Suc (length s) < length (ext_ids s)" + by (simp add:nth_append ext_ids_def) + moreover have "\(Suc (length s) < u)" using assms(2) + by (simp add:fromSingleton_simp filt_simp, simp add:ext_ids_def) + ultimately have c:"\(a \ < a sm)" by (metis sorted_a_le assms(2) idx_intro_ext) + have d:"a (P z) \ a pm" + using a b c pred_is_dep pred_succ_order H_def z_def(1) by (cases "P z", fastforce+) + have e:"a (S z) \ a sm" + using a b c succ_is_dep pred_succ_order H_def z_def(1) by (cases "S z", fastforce+) + have "to_woot_character M z \ set s" + using f associated_string_assm is_associated_string_def z_def(1) by fastforce + hence "is_concurrent pm sm (to_woot_character M z)" + using H_def z_def(1) d e by simp + thus ?thesis by blast +qed + +lemma integrate_insert_result_helper: + "invariant pm sm \ m' = m \ s' = s \ + is_certified_associated_string' (integrate_insert m' s' pm sm)" +proof (induction m' s' pm sm rule:integrate_insert.induct) + case (1 m' s' pm sm) + obtain l where l_def: "idx s pm = Inr l" + using "1"(2) invariant_def obtain_idx by blast + obtain u where u_def: "idx s sm = Inr u" + using "1"(2) invariant_def obtain_idx by blast + show ?case + proof (cases "Suc l = u") + case True + then show ?thesis + apply (simp add:l_def u_def 1 del:idx.simps is_certified_associated_string'.simps) + using "1"(2) l_def u_def integrate_insert_final_step by blast + next + case False + have "a pm < a sm" using invariant_def "1"(2) by auto + hence a:"l < u" using sorted_a_le l_def u_def by blast + obtain d where d_def: "mapM (concurrent s l u) (substr s l u) = Inr d \ + set (concat d) = InString ` I ` {x. is_concurrent pm sm x}" + by (metis concurrent_eff l_def u_def) + have b:"concat d \ []" + by (metis Suc_lessI concurrent_eff_3 False l_def u_def + a d_def empty_set image_is_empty) + have c:"\x. x \ set (concat d) \ + preserve_order x \I m\ (a x) (a \I m\) \ x \ set (ext_ids s) \ + a pm < a x \ a x < a sm" + using 1(2) d_def concurrent_eff_2 + by (simp del:set_concat add:ext_ids_def, blast) + obtain pm' sm' where ps'_def: "find ((\x.\I m\ < x \ x = sm) \ snd) + (zip (pm # concat d) (concat d @ [sm])) = Some (pm',sm')" + (is "?lhs = ?rhs") + apply (cases "?lhs") + apply (simp add:find_None_iff) + apply (metis in_set_conv_decomp in_set_impl_in_set_zip2 length_Cons + length_append_singleton) + by fastforce + have d:"pm' = pm \ pm' \ set (concat d)" using ps'_def b + by (metis (full_types) find_zip(3)) + hence "pm' \ set (ext_ids s)" using c 1(2) invariant_def by auto + hence "pm' \ InString ` I ` insert_messages M \ pm' = \ \ pm' = \" + apply (simp add:ext_ids_def) + by (metis image_image associated_string_assm is_associated_string_def + to_woot_character_keeps_i_lifted) + hence "pm' \ \I m\" using no_id_collision by blast + hence "(pm' = pm \ pm' < \I m\) \ (sm' = sm \ sm' > \I m\ \ sm' \ set (concat d))" + by (metis (mono_tags, lifting) ps'_def b find_zip(1) find_zip(3) find_zip(4) less_linear) + hence e:"invariant pm' sm'" + using 1(2) c d apply (simp add:invariant_def del:set_concat) + by (meson dual_order.strict_trans leD leI preserve_order_def) + show ?thesis apply (subst integrate_insert.simps) + using a b e ps'_def 1 d_def False l_def u_def + by (simp add:1 del:idx.simps integrate_insert.simps) + qed +qed + +lemma integrate_insert_result: + "is_certified_associated_string' (integrate_insert m s (P m) (S m))" +proof - + have "invariant (P m) (S m)" + using find_pred find_succ pred_succ_order by (simp add:invariant_def) + thus ?thesis using integrate_insert_result_helper by blast +qed +end + +lemma integrate_insert_result: + assumes "consistent (M \ {Insert m})" + assumes "Insert m \ M" + assumes "is_associated_string M s" + shows "is_certified_associated_string (M \ {Insert m}) (integrate_insert m s (P m) (S m))" +proof - + obtain t where t_def: "(integrate_insert m s (P m) (S m)) = Inr t \ + set t = to_woot_character (M \ {Insert m}) ` (insert_messages (M \ {Insert m}))" + proof - + fix tt + assume a:"(\t. (integrate_insert m s (P m) (S m)) = Inr t \ + set t = to_woot_character (M \ {Insert m}) ` insert_messages (M \ {Insert m}) \ + tt)" + obtain a where a_def: "a_conditions (insert_messages (M \ {Insert m})) a" + using consistent_def assms by blast + moreover have "a_conditions (insert_messages M) a" + using assms a_subset is_associated_string_def a_def by blast + ultimately interpret integrate_insert_commute_insert "M" "a" "s" "m" + using assms by (simp add: integrate_insert_commute_insert_def integrate_insert_commute_def (* + *) integrate_insert_commute_insert_axioms.intro) + show tt using a integrate_insert_result + apply (cases "integrate_insert m s (P m) (S m)") by auto + qed + have b:"\a. a_conditions (insert_messages (M \ {Insert m})) a \ + sorted_wrt (<) (map a (ext_ids t))" + proof - + fix a + assume c:"a_conditions (insert_messages (M \ {Insert m})) a" + moreover have "a_conditions (insert_messages M) a" + using assms a_subset is_associated_string_def c by blast + ultimately interpret integrate_insert_commute_insert "M" "a" "s" "m" + using assms by (simp add: integrate_insert_commute_insert_def integrate_insert_commute_def (* + *) integrate_insert_commute_insert_axioms.intro) + show "sorted_wrt (<) (map a (ext_ids t))" + using integrate_insert_result t_def by simp + qed + show "?thesis" using b t_def assms(1) by (simp add:is_associated_string_def) +qed + +locale integrate_insert_commute_delete = integrate_insert_commute + + fixes m + assumes consistent_assm: "consistent (M \ {Delete m})" +begin + +fun delete :: "('a, 's) woot_character \ ('a, 's) woot_character" + where "delete (InsertMessage p i u _) = InsertMessage p i u None" + +definition delete_only_m :: "('a, 's) woot_character \ ('a, 's) woot_character" + where "delete_only_m x = (if DeleteMessage (I x) = m then delete x else x)" + +lemma set_s: "set s = to_woot_character M ` insert_messages M" + using associated_string_assm by (simp add:is_associated_string_def) + +lemma delete_only_m_effect: + "delete_only_m (to_woot_character M x) = to_woot_character (M \ {Delete m}) x" + apply (cases x, simp add:to_woot_character_def delete_maybe_def) + by (metis delete_only_m_def insert_message.sel(2) delete.simps) + +lemma integrate_delete_result: + "is_certified_associated_string (M \ {Delete m}) (integrate_delete m s)" +proof (cases m) + case (DeleteMessage i) + have "deps (Delete m) \ I ` insert_messages (M \ {Delete m})" + using consistent_assm by (simp add:consistent_def DeleteMessage) + hence "i \ I ` insert_messages (M \ {Delete m})" using DeleteMessage by auto + hence "i \ I ` set s" using set_s by (simp add:insert_messages_def) + then obtain k where k_def: "I (s ! k) = i \ k < length s" + by (metis imageE in_set_conv_nth) + hence "ext_ids s ! (Suc k) = \i\ \ Suc k < length (ext_ids s)" + by (simp add:ext_ids_def nth_append) + hence g:"idx s \i\ = Inr (Suc k)" apply (simp add:fromSingleton_simp filt_simp) + using dist_ext_ids nth_eq_iff_index_eq by fastforce + moreover define t where "t = List.list_update s k (delete (s ! k))" + ultimately have a: "integrate_delete m s = Inr t" + using k_def DeleteMessage by (cases "s ! k", simp) + have "\j. j < length s \ (DeleteMessage (I(s ! j)) = m) = (j = k)" + apply (simp add: DeleteMessage) using I_inj_on_S k_def by blast + hence "List.list_update s k (delete (s ! k)) = map delete_only_m s" + by (rule_tac nth_equalityI, (simp add:k_def delete_only_m_def)+) + hence "set t = delete_only_m ` set s" using t_def by auto + also have "... = to_woot_character (M \ {Delete m}) ` (insert_messages M)" + using set_s delete_only_m_effect image_cong by (metis (no_types, lifting) image_image) + finally have b: + "set t = to_woot_character (M \ {Delete m}) ` (insert_messages (M \ {Delete m}))" + by (simp add: insert_messages_def) + have "ext_ids s = ext_ids t" + apply (cases "s ! k", simp add:t_def ext_ids_def) + by (metis (no_types, lifting) insert_message.sel(2) list_update_id map_update) + moreover have "\a. a_conditions (insert_messages M) a \ sorted_wrt (<) (map a (ext_ids s))" + using associated_string_assm is_associated_string_def by blast + ultimately have c: "\a. a_conditions (insert_messages (M \ {Delete m})) a + \ sorted_wrt (<) (map a (ext_ids t))" + by (simp add:insert_messages_def) + show ?thesis + apply (simp add:a is_associated_string_def b c) + using consistent_assm by fastforce +qed +end + +lemma integrate_delete_result: + assumes "consistent (M \ {Delete m})" + assumes "is_associated_string M s" + shows "is_certified_associated_string (M \ {Delete m}) (integrate_delete m s)" +proof - + obtain a where a_def: "a_conditions (insert_messages (M \ {Delete m})) a" + using consistent_def assms by blast + moreover have "a_conditions (insert_messages M) a" + using assms a_subset is_associated_string_def a_def by blast + ultimately interpret integrate_insert_commute_delete "M" "a" "s" "m" + using assms by (simp add: integrate_insert_commute_def integrate_insert_commute_delete.intro + integrate_insert_commute_delete_axioms.intro) + show "?thesis" using integrate_delete_result by blast +qed + +fun is_delete :: "(('a, 's) message) \ bool" + where + "is_delete (Insert m) = False" | + "is_delete (Delete m) = True" + +proposition integrate_insert_commute: + assumes "consistent (M \ {m})" + assumes "is_delete m \ m \ M" + assumes "is_associated_string M s" + shows "is_certified_associated_string (M \ {m}) (integrate s m)" + using assms integrate_insert_result integrate_delete_result by (cases m, fastforce+) + +end \ No newline at end of file diff --git a/thys/WOOT_Strong_Eventual_Consistency/Psi.thy b/thys/WOOT_Strong_Eventual_Consistency/Psi.thy new file mode 100644 --- /dev/null +++ b/thys/WOOT_Strong_Eventual_Consistency/Psi.thy @@ -0,0 +1,272 @@ +subsection \Definition of \texorpdfstring{$\Psi$}{Psi}\label{sec:psi}\ + +theory Psi + imports SortKeys "HOL-Eisbach.Eisbach" +begin + +fun extended_size :: "('a sort_key) extended \ nat" + where + "extended_size \x\ = size x" | + "extended_size _ = 0" + +lemma extended_simps [simp]: + "(\ < x) = (x \ \)" + "(\x'\ < \y'\) = (x' < y')" + "\x'\ < \" + "\(\x'\ < \)" + "\(\ < x)" + "\ \ x" + "(\x'\ \ \y'\) = ((x' :: 'a :: linorder) \ y')" + "x \ \" + "\(\x'\ \ \)" + "(\ \ x) = (x = \)" + by (case_tac [!] x, simp_all add:less_extended_def less_eq_extended_def le_less) + +fun int_size where "int_size (l,u) = max (extended_size l) (extended_size u)" + +lemma position_cases: + assumes "\ y z. x = \NonFinal (y,Left) z\ \ p" + assumes "\ y z. x = \NonFinal (y,Right) z\ \ p" + assumes "\ y. x = \Final y\ \ p" + assumes "x = \ \ p" + assumes "x = \ \ p" + shows "p" + by (metis assms embed_dir.cases extended_size.cases sort_key_embedding.cases) + +fun derive_pos :: + "('a :: linorder) \ sort_dir \ 'a sort_key extended \ 'a sort_key extended" + where + "derive_pos h \NonFinal x y\ = + (if h < x then \ else (if x < h then \ else \y\))" | + "derive_pos h \Final x\ = + (if fst h < x \ fst h = x \ snd h = Left then \ else \)" | + "derive_pos _ \ = \" | + "derive_pos _ \ = \" + +lemma derive_pos_mono: "x \ y \ derive_pos h x \ derive_pos h y" + apply (cases h, cases "snd h") + apply (rule_tac [!] position_cases [where x=x]) + apply (rule_tac [!] position_cases [where x=y]) + by (simp_all, auto) + +fun \ :: "('a :: linorder) position \ sort_dir \ 'a \ sort_dir" + where + "\ \NonFinal x y\ _ = x" | + "\ \Final x\ d = (x,d)" | + "\ \ _ = undefined" | + "\ \ _ = undefined" + +fun derive_left where + "derive_left (l, u) = (derive_pos (\ l Right) l, derive_pos (\ l Right) u)" + +fun derive_right where + "derive_right (l, u) = (derive_pos (\ u Left) l, derive_pos (\ u Left) u)" + +fun is_interval where "is_interval (l,u) = (l < u)" + +fun elem where "elem x (l,u) = (l < x \ x < u)" + +fun subset where "subset (l,u) (l',u') = (l' \ l \ u \ u')" + +method interval_split for x :: "('a :: linorder) position \ 'a position" = + (case_tac [!] x, + rule_tac [!] position_cases [where x="fst x"], + rule_tac [!] position_cases [where x="snd x"]) + +lemma derive_size: + "\Final i\ \ fst x \ is_interval x \ int_size (derive_left x) < int_size x" + "snd x \ \Final i\ \ is_interval x \ int_size (derive_right x) < int_size x" + by (interval_split x, simp_all add:less_SucI) + +lemma derive_interval: + "\Final i\ \ fst x \ is_interval x \ is_interval (derive_left x)" + "snd x \ \Final i\ \ is_interval x \ is_interval (derive_right x)" + by (interval_split x, simp_all, auto) + +function \ :: "('a :: linorder) position \ 'a position \ 'a \ 'a sort_key" + where + "\ (l,u) i = Final i" + if "l < \Final i\ \ \Final i\ < u" | + "\ (l,u) i = NonFinal (\ l Right) (\ (derive_left (l,u)) i)" + if "\Final i\ \ l \ l < u" | + "\ (l,u) i = NonFinal (\ u Left) (\ (derive_right (l,u)) i)" + if "u \ \Final i\ \ l < u" | + "\ (l,u) i = undefined" if "u \ l" + by (metis leI old.prod.exhaust, auto) + +termination + apply (relation "measure (\(p,i). int_size p)", simp) + using derive_size by fastforce+ + +proposition psi_elem: "is_interval x \ elem \\ x i\ x" +proof (induct "int_size x" arbitrary:x rule: nat_less_induct) + case 1 + consider (a) "\Final i\ \ fst x" | (b) "elem \Final i\ x" | (c) "snd x \ \Final i\" + using not_le by (metis elem.simps prod.collapse) + then show ?case + proof (cases) + case a + hence "elem \\ (derive_left x) i\ (derive_left x)" + by (metis 1 derive_size(1) derive_interval(1)) + then show ?thesis using a "1"(2) + by (interval_split x, simp_all del:\.simps, auto) + next + case b + then show ?thesis by (cases x, simp) + next + case c + hence "elem \\ (derive_right x) i\ (derive_right x)" + by (metis 1 derive_size(2) derive_interval(2)) + then show ?thesis using c "1"(2) + by (interval_split x, simp_all del:\.simps, auto) + qed +qed + +proposition psi_mono: + assumes "i1 < i2" + shows "is_interval x \ \ x i1 < \ x i2" +proof (induct "int_size x" arbitrary:x rule: nat_less_induct) + case 1 + have a:"\Final i1\ < \Final i2\" + using assms by auto + then consider + (a) "\Final i1\ \ fst x \ \Final i2\ \ fst x" | + (b) "\Final i1\ \ fst x \ elem \Final i2\ x" | + (c) "\Final i1\ \ fst x \ snd x \ \Final i2\" | + (d) "elem \Final i1\ x \ elem \Final i2\ x" | + (e) "elem \Final i1\ x \ snd x \ \Final i2\" | + (f) "snd x \ \Final i2\ \ snd x \ \Final i1\" + using assms "1"(2) apply (cases x) + by (metis (mono_tags, hide_lams) dual_order.strict_trans elem.simps + fst_conv leI snd_conv) + then show ?case + proof (cases) + case a + hence "\ (derive_left x) i1 < \ (derive_left x) i2" + by (metis 1 derive_size(1) derive_interval(1)) + thus ?thesis using a "1"(2) by (cases x, simp) + next + case b + thus ?thesis using "1"(2) apply (cases x, simp) + by (rule_tac [!] position_cases [where x="fst x"], simp_all) + next + case c + show ?thesis + proof (cases "\ (fst x) Right = \ (snd x) Left") + case True + have e:"is_interval (derive_left x)" using c "1"(2) derive_interval(1) by blast + have f:"derive_left x = derive_right x" using True by (cases x, simp) + have h:"\ (derive_left x) i1 < \ (derive_right x) i2" + apply (cases x, simp only: f) + by (metis "1.hyps" "1.prems" c derive_size(2) e f) + show ?thesis using c "1"(2) h True by (cases x, simp) + next + case False + hence "\ (fst x) Right < \ (snd x) Left" using "1"(2) c + by (interval_split x, simp_all, auto) + then show ?thesis using c "1"(2) by (cases x, simp) + qed + next + case d + thus ?thesis using "1"(2) a by (cases x, simp) + next + case e + thus ?thesis using "1"(2) apply (cases x, simp) + by (rule_tac [!] position_cases [where x="snd x"], simp_all del:\.simps) + next + case f + hence b:"\ (derive_right x) i1 < \ (derive_right x) i2" + by (metis 1 derive_size(2) derive_interval(2)) + thus ?thesis using f "1"(2) by (cases x, simp) + qed +qed + +proposition psi_narrow: + "elem \\ x' i\ x \ subset x x' \ \ x' i = \ x i" +proof (induct "int_size x'" arbitrary: x x' rule: nat_less_induct) + case 1 + have a: "is_interval x" using "1"(2) + by (metis dual_order.strict_trans elem.elims(2) is_interval.simps) + have d: "is_interval x'" using a "1"(3) apply (cases x', cases x, simp) by auto + consider + (before) "\Final i\ \ fst x'" | + (between) "elem \Final i\ x'" | + (after) "snd x' \ \Final i\" using 1 apply simp + by (metis elem.simps leI prod.collapse) + then show ?case + proof (cases) + case before + have b: "\Final i\ \ fst x" using before 1 apply (cases x) + by (metis dual_order.trans fst_conv subset.elims(2)) + obtain z where z_def: "\ x' i = NonFinal (\ (fst x') Right) z" + using before d apply (cases x') by simp + have c:"\ (fst x') Right = \ (fst x) Right" + using "1"(3) z_def "1"(2) apply (cases x, cases x', simp) + apply (rule_tac [!] position_cases [where x="fst x"]) + apply (rule_tac [!] position_cases [where x="fst x'"]) + using before by (simp_all del:\.simps, auto) + have c1:"subset (derive_left x) (derive_left x')" + using c "1"(3) by (cases x, cases x', simp add:derive_pos_mono) + have g:"z = \ (derive_left x') i" using z_def before d by (cases x', simp) + have "elem \NonFinal (\ (fst x) Right) z\ x" + using "1"(2) z_def by (simp add: c) + hence "elem \z\ (derive_left x)" using before b + by (interval_split x, simp_all del:\.simps, auto) + hence "\ (derive_left x') i = \ (derive_left x) i" + using "1"(1) before d c1 apply (simp only:g) + by (metis (no_types) derive_size(1)) + thus ?thesis using before b a d c by (cases x, cases x', simp) + next + case between + thus ?thesis using 1 by (cases x, cases x', auto) + next + case after + have b: "snd x \ \Final i\" using after 1 apply (cases x) + by (metis (mono_tags, hide_lams) dual_order.trans prod.exhaust_sel + subset.simps) + obtain z where z_def:"\ x' i = NonFinal (\ (snd x') Left) z" + using after d by (cases x', simp) + have c:"\ (snd x') Left = \ (snd x) Left" + using "1"(3) z_def "1"(2) apply (simp, cases x, cases x') + apply (rule_tac [!] position_cases [where x="snd x"]) + apply (rule_tac [!] position_cases [where x="snd x'"]) using after + by (simp_all del:\.simps, auto) + have c1:"subset (derive_right x) (derive_right x')" + using c "1"(3) by (cases x, cases x', simp add:derive_pos_mono) + have g:"z = \ (derive_right x') i" using z_def after d by (cases x', simp) + have "elem \NonFinal (\ (snd x) Left) z\ x" + using "1"(2) z_def by (simp add: c) + hence "elem \z\ (derive_right x)" using after b + by (interval_split x, simp_all del:\.simps, auto) + hence "\ (derive_right x') i = \ (derive_right x) i" + using "1"(1) after d c1 apply (simp only:g) + by (metis (no_types) derive_size(2)) + thus ?thesis using after b a d c by (cases x, cases x', simp) + qed +qed + +definition preserve_order :: "'a :: linorder \ 'a \ 'b :: linorder \ 'b \ bool" + where "preserve_order x y u v \ (x < y \ u < v) \ (x > y \ u > v)" + +proposition psi_preserve_order: + fixes l l' u u' i i' + assumes "elem \\ (l, u) i\ (l',u')" + assumes "elem \\ (l', u') i'\ (l, u)" + shows "preserve_order i i' \\ (l,u) i\ \\ (l', u') i'\" +proof - + have "l < u" using assms(2) by auto + hence a:"elem \\ (l, u) i\ (max l l', min u u')" + using assms(1) psi_elem by fastforce + hence b:"\ (l,u) i = \ (max l l', min u u') i" + by (simp add: psi_narrow) + have "l' < u'" using assms(1) by auto + hence "elem \\ (l',u') i'\ (max l l', min u u')" + using assms(2) psi_elem by fastforce + hence c:"\ (l',u') i' = \ (max l l', min u u') i'" + by (simp add: psi_narrow) + hence "max l l' < min u u'" using a min_def by auto + then show ?thesis apply (simp only: preserve_order_def b c) + using psi_mono extended_simps(2) is_interval.simps by blast +qed + +end diff --git a/thys/WOOT_Strong_Eventual_Consistency/ROOT b/thys/WOOT_Strong_Eventual_Consistency/ROOT new file mode 100644 --- /dev/null +++ b/thys/WOOT_Strong_Eventual_Consistency/ROOT @@ -0,0 +1,25 @@ +chapter AFP + +session WOOT_Strong_Eventual_Consistency (AFP) = HOL + + options [timeout = 600] + sessions + Certification_Monads + Datatype_Order_Generator + theories + ErrorMonad + Data + BasicAlgorithms + CreateAlgorithms + IntegrateAlgorithm + DistributedExecution + SortKeys + Psi + Sorting + CreateConsistent + IntegrateInsertCommute + StrongConvergence + SEC + Example + document_files + "root.tex" + "root.bib" diff --git a/thys/WOOT_Strong_Eventual_Consistency/SEC.thy b/thys/WOOT_Strong_Eventual_Consistency/SEC.thy new file mode 100644 --- /dev/null +++ b/thys/WOOT_Strong_Eventual_Consistency/SEC.thy @@ -0,0 +1,275 @@ +section \Strong Eventual Consistency \label{sec:strong_eventual_consistency}\ + +theory SEC + imports StrongConvergence +begin + +text \In the following theorem we establish that all reached states are successful. This +implies with the unconditional termination property (Section \ref{sec:integrate_term}) of it that +the integration algorithm never fails.\ + +theorem (in dist_execution) no_failure: + fixes i + assumes "is_valid_state_id i" + shows "isOK (state i)" + apply (cases "state i") + by (metis assms state_is_associated_string is_certified_associated_string.simps(2), simp) + +text \The following theorem establishes that any pair of peers having received the same +set of updates, will be in the same state.\ + +theorem (in dist_execution) strong_convergence: + assumes "is_valid_state_id i" + assumes "is_valid_state_id j" + assumes "set (received_messages i) = set (received_messages j)" + shows "state i = state j" + using state_is_associated_string is_certified_associated_string_unique by (metis assms) + +text \As we noted in Section~\ref{sec:networkModel}, we have not assumed eventual delivery, but + a corollary of this theorem with the eventual delivery assumption implies eventual consistency. + Since finally all peer would have received all messages, i.e., an equal set.\ + +section \Code generation\ + +export_code integrate create_insert create_delete in Haskell + module_name WOOT file_prefix "code" + +section \Proof Outline\label{sec:proof_outline}\ + +text \ + In this section we outline and motivate the approach we took to prove the strong eventual + consistency of WOOT. + + While introducing operation-based CRDTs Shapiro et al. also establish + \cite{shapiro2011conflict}[Theorem 2.2]. If the following two conditions are met: + \begin{itemize} + \item + Concurrent operations commute, i.e., if a pair of operations @{text "m\<^sub>1"}, + @{text "m\<^sub>2"} is concurrent with respect to the order induced by the happened-before + relation, and they are both applicable to a state @{text "s"}, then the message + @{text "m\<^sub>1"} (resp. @{text "m\<^sub>2"}) is still applicable on the state reached by + applying @{text "m\<^sub>2"} (resp. @{text "m\<^sub>1"}) on @{text "s"} and the resulting + states are equal. + \item Assuming causal delivery, the messages are applicable. + \end{itemize} + Then the CRDT has strong convergence. + The same authors extend the above result in \cite[Proposition 2.2]{shapiro:inria-00555588} + to more general delivery orders $\xrightarrow{d}$ (weaker than the one induced by the + happened-before relation), i.e., two messages may be causally dependent but concurrent with + respect to $\xrightarrow{d}$. Assuming operations that are concurrent with respect to + $\xrightarrow{d}$ commute, and messages are applicable, when the + delivery order respects $\xrightarrow{d}$ then again the CRDT has strong convergence. + + A key difficulty of the consistency proof of the WOOT framework is that the applicability + condition for the WOOT framework has three constraints: + \begin{enumerate} + \item \label{en:proof:deps_are_met} Dependencies must be met. + \item \label{en:proof:id_distinct} Identifiers must be distinct. + \item The order must be consistent, i.e. the predecessor W-character must appear before the + successor W-character in the state an insert message is being integrated. + \end{enumerate} + + The first constraint is a direct consequence of the semantic causal delivery order. The uniqueness + of identifiers can be directly established by analyzing the implementation of the message creation + algorithms. Alternatively, Gomes et al.~\cite{gomes2017verifying} use an axiomatic approach, where + they require the underlying network protocol to deliver messages with unique identifiers. They + provide a formal framework in Isabelle/HOL that can be used to show consistency of arbitrary + CRDTs. Their results could be used to establish constraints \ref{en:proof:deps_are_met} and + \ref{en:proof:id_distinct}. + + The last constraint is the most intricate one, and forces us to use a different method to + establish the strong eventual consistency. The fact that the order constraint is fulfilled is a + consequence of the consistency property. But the current fundamental lemmas require applicability + of the operations in the first place to establish consistency, which would result in a circular + argument. + + Zeller et. al. actually predict the above circumstance in the context of state-based CRDTs + \cite{DBLP:conf/forte/ZellerBP14}: + \begin{displayquote} + In theory it could even be the case that there are two reachable states for which the merge + operation does not yield the correct result, but where the two states can never be reached in the + same execution. + \end{displayquote} + + Because of the above, we treat WOOT as a distributed message passing algorithm and show + convergence by establishing a global invariant, which is maintained during the execution of the + framework. The invariant captures that the W-characters appear in the same order on all peers. + It has strong convergence as a consequence, in the special case, when peers have received + the same set of updates. It also implies that the generated messages will be applicable. + + \begin{figure} + \centering + \begin{tikzpicture}[ + statenode/.style={circle, draw=black, fill=black!20, thick, minimum size=5mm}, + curstatenode/.style={circle, draw=black, fill=black!60, thick, minimum size=5mm}, + peernode/.style={rectangle, draw=black, thick, minimum size=5mm}, + ] + %Nodes + \node[peernode] (peerA) at (1.5cm, 3cm) {Peer A}; + \node[peernode] (peerB) at (1.5cm, 2cm) {Peer B}; + \node[peernode] (peerC) at (1.5cm, 1cm) {Peer C}; + \node[statenode] (stateA2) at (4cm, 3cm) {}; + \node[curstatenode] (stateB2) at (5cm, 2cm) {}; + \node[statenode] (stateC2) at (3.5cm, 1cm) {}; + \node[statenode] (stateA3) at (5.5cm, 3cm) {}; + \node[statenode] (stateB3) at (7cm, 2cm) {}; + \node[statenode] (stateC3) at (6.5cm, 1cm) {}; + \node[statenode] (stateA4) at (7.5cm, 3cm) {}; + \draw[->] (peerA.east) -- (stateA2.west); + \draw[->] (peerB.east) -- (stateB2.west); + \draw[->] (peerC.east) -- (stateC2.west); + \draw[->] (stateA2.east) -- (stateA3.west); + \draw[->] (stateB2.east) -- (stateB3.west); + \draw[->] (stateC2.east) -- (stateC3.west); + \draw[->] (stateC2) -- (stateA2); + \draw[->] (stateC2) -- (stateB2); + \draw[->] (stateA3) -- (stateC3); + \draw[->] (stateA3) -- (stateB3); + \draw[->] (stateA3) -- (stateA4); + \draw (5cm,3.5cm) to[bend right] (4.8cm,0.5cm); + \end{tikzpicture} + \caption{Example state graph, where the consistency is established left of the bend curve.} + \label{fig:state_graph} + \end{figure} + + In Figure~\ref{fig:state_graph}, we exemplify an induction step in a proof over the execution + of the framework. The invariant is established for all states left of the dashed lines, and we + show that it remains true if we include the state, drawn in dark gray. Note that induction + proceeds in an order consistent with the happened-before relation. + + The technique we are using is to define a relation @{term is_associated_string} from a set of + messages to the final state their application leads to. Crucially, that relation can be defined + in a message-order independent way. We show that it correctly models the behaviour of Algorithm + @{term "integrate"} by establishing that applying the integration algorithm to the associated + string of a set @{term "M"} leads to the associated string of the set @{term "M \ {m}"} + in Proposition @{thm [source] integrate_insert_commute}. + + We also show that at most one @{text s} fulfills @{term "is_associated_string M s"}, + which automatically implies commutativity (cf. Lemma @{thm [source] "associated_string_unique"}). + + Note that the domain of the relation @{term "is_associated_string"} consists of the sets of + messages that we call @{term "consistent"}. We show that, in every state of a peer, the set of + received messages will be consistent. + The main ingredient required for the definition of a consistent set of messages as the relation + @{term "is_associated_string"} are \emph{sort keys} associated to the W-characters, which we will + explain in the following Section. +\ + +subsection \ Sort Keys \ + +text \ + There is an implicit sort key, which is deterministically computable, using the immutable data + associated to a W-character and the data of the W-characters it (transitively) depends on. + + We show that Algorithm @{term "integrate"} effectively maintains the W-characters ordered with + respect to that sort key, which is the reason we can construct the mapping + @{term "is_associated_string"} in a message-order + independent way. An alternative viewpoint would be to see Algorithm @{term "integrate_insert"} as + an optimized version of a more mundane algorithm, that just inserts the W-characters using this + implicit sort key. + + Since the sort key is deterministically computable using the immutable data associated to a + W-character and the data of the W-characters it (transitively) depends on, all peers could + perform this computation independently, which leads to the conclusion that the W-characters + will be ordered consistently across all peers. + + The construction relies on a combinator @{term "\"} that computes the sort key for a + W-character, and which requires as input: + \begin{itemize} + \item The unique identifier associated to a W-character. + \item The sort keys of the predecessor/successor W-characters. + \end{itemize} + Its values are elements of a totally ordered space. + + Note that the predecessor (resp. successor) W-character of a W-character is the W-character that + was immediately before (resp. after) it at the time it was inserted. Like its unique identifier, + it is immutable data associated with that W-character. Sometimes a W-character is inserted at the + beginning (resp. end) of the string. For those W-characters, we use the special smallest + (resp. largest) sort keys, denoted by @{term "\"} (resp. @{term "\"}) as predecessor + (resp. successor). These keys themselves are never associated to a W-character. + + We will write @{term "\ (l,u) i"} for the value computed by the combinator for a W-character + with identifier @{term "i"}, assuming the sort key of its predecessor (resp. successor) is + @{term "l"} (resp. @{term "u"}). + + For example, the sort key for a W-character with identifier @{term "i"} inserted in an empty + string (hence its predecessor is @{term "\"} and its successor is @{term "\"}) + will be @{term "\ (\,\) i"}. A W-character + inserted between that character and the end of the string, with identifier j, would be assigned + the sort key @{term "\ (\\ (\,\) i\,\) j"}. + + The sort key needs to fulfill a couple of properties, to be useful: + + There should never be a pair of W-characters with the same sort key. Note, if this happens, even + if those W-characters were equal or ordered consistently, we would not be able to insert a new + W-character between those W-characters. + + Since the W-characters have themselves unique identifiers, a method to insure the above property + is to require that @{term "\"} be injective with respect to the identifier of the W-character + it computes a sort key for, i.e., + @{term "\ (l,u) i = \ (l',u') i' \ i = i'"}. + + Another essential property is that the W-characters with predecessor having the sort key + @{term "l"} and successor having the sort key @{term "u"} should have a sort key that is between + @{term "l"} and @{term "u"}, such that the W-character is inserted between the preceding and + succeeding W-character, i.e., @{text "l < \ (l,u) i < u"}. + + This latter property ensures intention preservation, i.e. the inserted W-character will be placed + at the place the user intended. + + If we review function @{term "concurrent"}, then we see that the algorithm compares W-characters + by identifier, in the special case, when the inserted W-character is compared to a W-character + whose predecessor and successor are outside of the range it is to be inserted in. A careful + investigation, leads to the conclusion that: + + If @{text "l \ l' < \ (l,u) i < u' \ u"} then @{text "\(l,u) i"} can be compared + with @{text "\(l',u') i'"} by comparing @{text "i"} with @{text "i'"}, i.e.: + \begin{itemize} + \item @{text "i < i' \ \ (l,u) i < \(l',u') i'"} + \end{itemize} + + In Section \ref{sec:psi} we show that a combinator @{term "\"} with the above properties can + be constructed (cf. Propositions @{thm [source] psi_narrow psi_mono psi_elem}). + Using the sort keys we can define the notion of a consistent set of messages as well as the + relation @{term "is_associated_string"} in a message-order independent way.\ + +subsection \ Induction \ + +text \ + We have a couple of criteria that define a consistent set of messages: + + \begin{itemize} + \item Each insert message in the set has a unique identifier. + \item If a message depends on another message identifier, a message with that identifier will + be present. Note that for insert messages, these are the predecessor/successor W-characters + if present. For delete messages it is the corresponding insert message. + \item The dependencies form a well-order, i.e., there is no dependency cycle. + \item It is possible to assign sort keys to each insert message, such that + the assigned sort key for each insert message is equal to the value returned by the + @{term "\"} for it, using the associated sort keys of its predecessor and successors, + i.e., + @{term "a (P m) < a (S m) \ + a \I m\ = \\ (a (P m), a (S m)) (I m)\"}. + Note that we also require that sort key of the predecessor is smaller than the sort key of the + successor. + \end{itemize} + + The relation @{term "is_associated_string"} is then defined by ordering the insert messages + according to the assigned sort keys above and marking W-characters, for which there are delete + messages as deleted. + + The induction proof (Lemma @{thm [source] dist_execution.sent_messages_consistent}) over the + states of the framework is straight forward: Using Lemma @{thm [source] top_sort} we find a + possible order of the states consistent with the happened before relation. The induction invariant + is that the set of generated messages by all peers is + consistent (independent of whether they have been received by all peers (yet)). The latter also + implies that the subset a peer has received in any of those states is consistent, using the + additional fact that each messages dependencies will be delivered before the message itself + (see also Lemma @{thm [source] consistent_subset} and + Proposition @{thm [source] integrate_insert_commute'}). + For the induction step, we rely on the results from Section \ref{sec:create_consistent} that any + additional created messages will keep the set of messages consistent and that the peers' states + will be consistent with the (consistent subset of) messages they received (Lemma @{thm [source] + dist_execution.state_is_associated_string'}).\ +end + diff --git a/thys/WOOT_Strong_Eventual_Consistency/SortKeys.thy b/thys/WOOT_Strong_Eventual_Consistency/SortKeys.thy new file mode 100644 --- /dev/null +++ b/thys/WOOT_Strong_Eventual_Consistency/SortKeys.thy @@ -0,0 +1,65 @@ +section \Formalized Proof \label{sec:proof}\ + +theory SortKeys + imports Data "HOL-Library.List_Lexorder" "HOL-Library.Product_Lexorder" +begin + +datatype sort_dir = + Left | + Right +derive linorder sort_dir + +lemma sort_dir_less_def [simp]: "(x < y) = (x = Left \ y = Right)" + by (cases x, case_tac [!] y, simp_all add:less_sort_dir_def) + +datatype 'a sort_key = + NonFinal "('a \ sort_dir)" "'a sort_key" | + Final 'a + +type_synonym 'id position = "'id sort_key extended" + +fun embed_dir where "embed_dir (x,Left) = (x, 0)" | "embed_dir (x,Right) = (x, Suc (Suc 0))" + +lemma embed_dir_inj [simp]: "(embed_dir x = embed_dir y) = (x = y)" + by (cases x, cases y, case_tac [!] "snd x", case_tac [!] "snd y", simp+) + +lemma embed_dir_mono [simp]: "(embed_dir x < embed_dir y) = (x < y)" + by (cases x, cases y, case_tac [!] "snd x", case_tac [!] "snd y", (simp add:less_sort_dir_def)+) + +fun sort_key_embedding :: "'a sort_key \ ('a \ nat) list" + where + "sort_key_embedding (NonFinal x y) = embed_dir x#(sort_key_embedding y)" | + "sort_key_embedding (Final i) = [(i, Suc 0)]" + +lemma sort_key_embedding_injective: + "sort_key_embedding x = sort_key_embedding y \ x = y" + apply (induct x arbitrary: y) + apply (metis embed_dir_inj list.distinct(1) list.inject sort_key.exhaust + sort_key_embedding.simps) + by (metis fst_conv list.distinct(1) list.inject sort_key.exhaust + sort_key_embedding.simps) + +instantiation sort_key :: (ord) ord +begin +definition sort_key_less_eq_def [simp]: + "(x :: ('a :: ord) sort_key) \ y \ + (sort_key_embedding x \ sort_key_embedding y)" + +definition sort_key_less_def [simp]: + "(x :: ('a :: ord) sort_key) < y \ + (sort_key_embedding x < sort_key_embedding y)" + +instance .. +end + +instantiation sort_key :: (order) order +begin +instance by (intro_classes, simp_all add: less_le_not_le sort_key_embedding_injective) +end + +instantiation sort_key :: (linorder) linorder +begin +instance by (intro_classes, meson less_imp_le not_le sort_key_less_eq_def) +end + +end \ No newline at end of file diff --git a/thys/WOOT_Strong_Eventual_Consistency/Sorting.thy b/thys/WOOT_Strong_Eventual_Consistency/Sorting.thy new file mode 100644 --- /dev/null +++ b/thys/WOOT_Strong_Eventual_Consistency/Sorting.thy @@ -0,0 +1,141 @@ +subsection \Sorting\ + +text \Some preliminary lemmas about sorting.\ + +theory Sorting + imports Main "HOL.List" "HOL-Library.Sublist" +begin + +lemma insort: + assumes "Suc l < length s" + assumes "s ! l < (v :: 'a :: linorder)" + assumes "s ! (l+1) > v" + assumes "sorted_wrt (<) s" + shows "sorted_wrt (<) ((take (Suc l) s)@v#(drop (Suc l) s))" +proof - + have "sorted_wrt (<) (take (Suc l) s@(drop (Suc l) s))" + using assms(4) by simp + moreover have + "\x. x \ set (take (Suc l) s) = (\i. i < (Suc l) \ i < length s \ s ! i = x)" + by (metis in_set_conv_nth length_take min_less_iff_conj nth_take) + hence "\x. x \ set (take (Suc l) s) \ x < v" + using assms apply (simp) + using less_Suc_eq sorted_wrt_nth_less by fastforce + moreover have + "\x. x \ set (drop (Suc l) s) = (\i. Suc l + i < length s \ s ! (Suc l + i) = x)" + using assms(1) by (simp add:in_set_conv_nth add.commute less_diff_conv) + hence "\x. x \ set (drop (Suc l) s) \ x > v" + using assms apply (simp) + by (metis add.right_neutral add_diff_cancel_left' diff_Suc_Suc diff_is_0_eq' + leI le_less_trans less_imp_le sorted_wrt_iff_nth_less) + ultimately show ?thesis + by (simp add:sorted_wrt_append del:append_take_drop_id) +qed + +lemma sorted_wrt_irrefl_distinct: + assumes "irreflp r" + shows "sorted_wrt r xs \ distinct xs" + using assms by (induction xs, simp, simp, meson irreflp_def) + +lemma sort_set_unique_h: + assumes "irreflp r \ transp r" + assumes "set (x#xs) = set (y#ys)" + assumes "\z \ set xs. r x z" + assumes "\z \ set ys. r y z" + shows "x = y \ set xs = set ys" + by (metis assms insert_eq_iff irreflp_def list.set_intros(1) + list.simps(15) set_ConsD transpD) + +lemma sort_set_unique_rel: + assumes "irreflp r \ transp r" + assumes "set x = set y" + assumes "sorted_wrt r x" + assumes "sorted_wrt r y" + shows "x = y" +proof - + have "length x = length y" + using assms by (metis sorted_wrt_irrefl_distinct distinct_card) + then show ?thesis using assms + apply(induct rule:list_induct2, simp, simp) + by (metis assms(1) list.simps(15) sort_set_unique_h) +qed + +lemma sort_set_unique: + assumes "set x = set y" + assumes "sorted_wrt (<) (map (f :: ('a \ ('b :: linorder))) x)" + assumes "sorted_wrt (<) (map f y)" + shows "x = y" + using assms apply (simp add:sorted_wrt_map) + by (metis (no_types, lifting) irreflp_def less_irrefl sort_set_unique_rel + transpD transpI transp_less) + +text \If two sequences contain the same element and strictly increasing with respect.\ + +lemma subseq_imp_sorted: + assumes "subseq s t" + assumes "sorted_wrt p t" + shows "sorted_wrt p s" +proof - + have "sorted_wrt p s \ \ sorted_wrt p t" + apply (rule list_emb.induct[where P="(=)"]) + using list_emb_set assms by fastforce+ + thus ?thesis using assms by blast +qed + +text \If a sequence @{text t} is sorted with respect to a relation @{text p} then a subsequence will + be as well.\ + +fun to_ord where "to_ord r x y = (\(r\<^sup>*\<^sup>* y x))" + +lemma trancl_idemp: "r\<^sup>+\<^sup>+\<^sup>+\<^sup>+ x y = r\<^sup>+\<^sup>+ x y" + by (metis r_into_rtranclp reflclp_tranclp rtranclp_idemp rtranclp_reflclp + rtranclp_tranclp_tranclp tranclp.cases tranclp.r_into_trancl) + +lemma top_sort: + fixes rp + assumes "acyclicP r" + shows "finite s \ (\l. set l = s \ sorted_wrt (to_ord r) l \ distinct l)" +proof (induction "card s" arbitrary:s) + case 0 + then show ?case by auto +next + case (Suc n) + hence "s \ {}" by auto + moreover + have "acyclicP (r\<^sup>+\<^sup>+)" using assms + by (simp add:acyclic_def trancl_def trancl_idemp) + hence "acyclic ({(x,y). r\<^sup>+\<^sup>+ x y} \ s \ s)" + by (meson acyclic_subset inf_le1) + hence "wf ({(x,y). r\<^sup>+\<^sup>+ x y} \ s \ s)" using Suc + by (metis card_infinite finite_Int finite_SigmaI nat.distinct(1) + wf_iff_acyclic_if_finite) + ultimately obtain z where + "z \ s \ (\y. (y, z) \ ({(x,y). r\<^sup>+\<^sup>+ x y} \ s \ s) \ y \ s)" + by (metis ex_in_conv wf_eq_minimal) + hence z_def: "z \ s \ (\y. r\<^sup>+\<^sup>+ y z \ y \ s)" by blast + hence "card (s - {z}) = n" + by (metis One_nat_def Suc.hyps(2) card_Diff_singleton_if card_infinite + diff_Suc_Suc diff_zero nat.simps(3)) + then obtain l where l_def: + "set l = s - {z} \ sorted_wrt (to_ord r) l \ distinct l" + by (metis Zero_not_Suc card_infinite finite_Diff Suc) + hence "set (z#l) = s" using z_def by auto + moreover have "\y \ set l. \(r\<^sup>*\<^sup>* y z)" using z_def l_def rtranclpD by force + ultimately show ?case + by (metis distinct.simps(2) insert_absorb l_def list.simps(15) + sorted_wrt.simps(2) to_ord.elims(3)) +qed + +lemma top_sort_eff: + assumes "irreflp p\<^sup>+\<^sup>+" + assumes "sorted_wrt (to_ord p) x" + assumes "i < length x" + assumes "j < length x" + assumes "(p\<^sup>+\<^sup>+ (x ! i) (x ! j))" + shows "i < j" + using assms apply (cases "i > j") + apply (metis sorted_wrt_nth_less r_into_rtranclp reflclp_tranclp + rtranclp_idemp rtranclp_reflclp to_ord.simps) + by (metis irreflp_def nat_neq_iff) + +end \ No newline at end of file diff --git a/thys/WOOT_Strong_Eventual_Consistency/StrongConvergence.thy b/thys/WOOT_Strong_Eventual_Consistency/StrongConvergence.thy new file mode 100644 --- /dev/null +++ b/thys/WOOT_Strong_Eventual_Consistency/StrongConvergence.thy @@ -0,0 +1,237 @@ +subsection \Strong Convergence\ + +theory StrongConvergence + imports IntegrateInsertCommute CreateConsistent HOL.Finite_Set DistributedExecution +begin + +lemma (in dist_execution) happened_before_same: + assumes "i < j" + assumes "j < length (events k)" + shows "(happened_immediately_before)\<^sup>+\<^sup>+ (k,i) (k,j)" +proof - + obtain v where v_def: "j = Suc i + v" using assms(1) less_iff_Suc_add by auto + have "is_valid_event_id (k, Suc i + v) \ (happened_immediately_before)\<^sup>+\<^sup>+ (k,i) (k, Suc i + v)" + apply (induction v, simp add: tranclp.r_into_trancl) + by (metis Suc_lessD add_Suc_right fst_conv happened_immediately_before.elims(3) + is_valid_event_id.simps snd_conv tranclp.simps) + then show ?thesis + using is_valid_event_id.simps v_def assms by blast +qed + +definition make_set where "make_set (k :: nat) p = {x. \j. p j x \ j < k}" + +lemma make_set_nil [simp]: "make_set 0 p = {}" by (simp add:make_set_def) + +lemma make_set_suc [simp]: "make_set (Suc k) p = make_set k p \ {x. p k x}" + using less_Suc_eq by (simp add:make_set_def, blast) + +lemma (in dist_execution) received_messages_eff: + assumes "is_valid_state_id (i,j)" + shows "set (received_messages (i,j)) = make_set j (\k x. (\s. event_at (i, k) (Receive s x)))" + using assms by (induction j, simp add:make_set_def, simp add: take_Suc_conv_app_nth) + +lemma (in dist_execution) finite_valid_event_ids: + "finite {i. is_valid_event_id i}" +proof - + define X where "X = {p. events p = events p}" + have "finite X \ \m. (\p \ X. (length (events p)) < m)" + apply (induction rule:finite_induct, simp) + by (metis gt_ex insert_iff le_less_trans less_imp_not_less not_le_imp_less) + then obtain m where m_def: "\p. length (events p) < m" using X_def fin_peers by auto + have "{(i,j). is_valid_event_id (i,j)} \ {(i,j). j < m}" + using m_def by (simp add: Collect_mono_iff less_trans) + also have "... \ X \ {j. j < m}" using X_def by blast + finally have "{i. is_valid_event_id i} \ X \ {j. j < m}" + by (simp add: subset_iff) + thus ?thesis + using fin_peers finite_Collect_less_nat finite_cartesian_product + infinite_super subset_eq + by (metis UNIV_I) +qed + +lemma (in dist_execution) send_insert_id_1: + "state i \ (\s. create_insert s n \ i) = Inr (Insert m) \ I m = i" + by fastforce + +lemma (in dist_execution) send_insert_id_2: + "state i \ (\s. create_delete s n) = Inr (Insert m) \ False" + by fastforce + +lemma (in dist_execution) send_insert_id: + "event_at i (Send (Insert m)) \ I m = i" + using send_correct send_insert_id_1 send_insert_id_2 by metis + +lemma (in dist_execution) recv_insert_once: + "event_at (i,j) (Receive s (Insert m)) \ event_at (i,k) (Receive t (Insert m)) \ j = k" + using no_data_corruption send_insert_id at_most_once + by (simp, metis (mono_tags) Pair_inject event_pred.simps fst_conv is_valid_event_id.simps) + +proposition integrate_insert_commute': + fixes M m s + assumes "consistent M" + assumes "is_delete m \ m \ T" + assumes "m \ M" + assumes "T \ M" + assumes "deps m \ I ` insert_messages T" + assumes "is_certified_associated_string T s" + shows "is_certified_associated_string (T \ {m}) (s \ (\t. integrate t m))" +proof (cases s) + case (Inl a) + then show ?thesis using assms by simp +next + case (Inr b) + have "T \ {m} \ M" using assms(3) assms(4) by simp + moreover have "\ (deps ` (T \ {m})) \ I ` insert_messages (T \ {m})" + using assms(5) assms(6) Inr apply (simp add:is_associated_string_def consistent_def) + by (meson dual_order.trans subset_insertI subset_mono) + ultimately have "consistent (T \ {m})" + using assms consistent_subset by force + then show ?thesis using integrate_insert_commute assms(2) assms(6) Inr by auto +qed + +lemma foldM_rev: "foldM f s (li@[ll]) = foldM f s li \ (\t. f t ll)" + by (induction li arbitrary:s, simp+) + +lemma (in dist_execution) state_is_associated_string': + fixes i M + assumes "j \ length (events i)" + assumes "consistent M" + assumes "make_set j (\k m. \s. event_at (i,k) (Receive s m)) \ M" + shows "is_certified_associated_string (make_set j (\k m. \s. event_at (i,k) (Receive s m))) (state (i,j))" + using assms +proof (induction j) + case 0 + then show ?case by (simp add: empty_associated) +next + case (Suc j) + have b:"j < length (events i)" using Suc by auto + show ?case + proof (cases "events i ! j") + case (Send m) + then show ?thesis using Suc by (simp add: take_Suc_conv_app_nth) + next + case (Receive s m) + moreover have "is_delete m \ m \ (make_set j (\k m. \s. event_at (i,k) (Receive s m)))" + apply (cases m) using recv_insert_once Receive b apply (simp add: make_set_def) + apply (metis nat_neq_iff) + by (simp) + moreover have "deps m \ I ` insert_messages (make_set j (\k m. \s. event_at (i,k) (Receive s m)))" + apply (rule subsetI) + using semantic_causal_delivery Receive b apply (simp add:insert_messages_def image_iff make_set_def) by metis + ultimately show ?thesis + using Suc apply (cases s, simp add:take_Suc_conv_app_nth foldM_rev) + using integrate_insert_commute' by fastforce + qed +qed + +lemma (in dist_execution) sent_before_recv: + assumes "event_at (i,k) (Receive s m)" + assumes "j < length (events i)" + assumes "k < j" + shows "event_at s (Send m) \ happened_immediately_before\<^sup>+\<^sup>+ s (i,j)" +proof - + have a:"event_at s (Send m)" + using assms no_data_corruption by blast + hence "happened_immediately_before s (i,k)" + using assms by (cases s, simp, metis (mono_tags, lifting) event.simps(6)) + hence "(happened_immediately_before)\<^sup>+\<^sup>+ s (i,j)" using happened_before_same + by (meson assms(2) assms(3) tranclp_into_tranclp2) + thus ?thesis using a by blast +qed + +lemma (in dist_execution) irrefl_p: "irreflp (happened_immediately_before\<^sup>+\<^sup>+)" + by (meson acyclic_def dist_execution.acyclic_happened_before + dist_execution_axioms irreflpI tranclp_unfold) + +lemma (in dist_execution) new_messages_keep_consistency: + assumes "consistent M" + assumes "event_at i (Send m)" + assumes "set (received_messages i) \ M" + assumes "i \ I ` insert_messages M" + shows "consistent (insert m M)" +proof - + have a:"is_valid_state_id i" using assms(2) by (cases i, simp) + consider + (1) "(\n \. Inr m = (state i) \ (\s. create_insert s n \ i))" | + (2) "(\n. Inr m = (state i) \ (\s. create_delete s n))" + by (metis (full_types) send_correct assms(2)) + then show ?thesis + proof (cases) + case 1 + then obtain s n' \ where s_def: + "Inr s = state i" "Inr m = create_insert s n' \ i" + by (cases "state i", simp, simp add:bind_def, blast) + moreover have "is_associated_string (set (received_messages i)) s" + using a assms(1) assms(3) apply (cases i, simp only:received_messages_eff) + using s_def(1) state_is_associated_string' + by (simp, metis (mono_tags, lifting) is_certified_associated_string.simps(1)) + ultimately show ?thesis using create_insert_consistent s_def assms + by (metis Un_insert_right sup_bot.right_neutral) + next + case 2 + then obtain s n' where s_def: + "Inr s = state i" "Inr m = create_delete s n'" + by (cases "state i", simp, simp add:bind_def, blast) + moreover have "is_associated_string (set (received_messages i)) s" + using a assms(1) assms(3) apply (cases i, simp only:received_messages_eff) + using s_def(1) state_is_associated_string' + by (simp, metis (mono_tags, lifting) is_certified_associated_string.simps(1)) + ultimately show ?thesis using create_delete_consistent s_def assms + by (metis Un_insert_right sup_bot.right_neutral) + qed +qed + +lemma (in dist_execution) sent_messages_consistent: + "consistent {m. (\i. event_at i (Send m))}" +proof - + obtain ids where ids_def: "set ids = {i. is_valid_event_id i} \ + sorted_wrt (to_ord (happened_immediately_before)) ids \ distinct ids" + using top_sort finite_valid_event_ids by (metis acyclic_happened_before) + have "\x y. happened_immediately_before\<^sup>+\<^sup>+ x y \ x \ set ids \ y \ set ids" + using converse_tranclpE ids_def tranclp.cases by fastforce + hence a:"\x y. happened_immediately_before\<^sup>+\<^sup>+ x y \ + (\i j. i < j \ j < length ids \ ids ! i = x \ ids ! j = y)" + by (metis top_sort_eff ids_def distinct_Ex1 irrefl_p) + define n where "n = length ids" + have "n \ length ids \ consistent (make_set n (\k x. event_at (ids ! k) (Send x)))" + proof (induction n) + case 0 + then show ?case using empty_consistent by simp + next + case (Suc n) + moreover obtain i j where ij_def: + "ids ! n = (i,j)" "n < length ids" + "is_valid_event_id (i,j)" "is_valid_state_id (i,j)" + by (metis Suc.prems Suc_le_lessD ids_def is_valid_event_id.elims(2) is_valid_state_id.simps + le_eq_less_or_eq mem_Collect_eq nth_mem) + moreover have "set (received_messages (i,j)) \ make_set n (\k x. event_at (ids ! k) (Send x))" + using ij_def apply (simp add:received_messages_eff del:received_messages.simps, rule_tac subsetI) + using sent_before_recv a apply (simp add:make_set_def) + by (metis (no_types, hide_lams) distinct_Ex1 ids_def in_set_conv_nth) + moreover have "(i,j) \ I ` insert_messages (make_set n (\k x. event_at (ids ! k) (Send x)))" + apply (simp add:insert_messages_def image_iff make_set_def del:event_at.simps) + using ids_def le_eq_less_or_eq nth_eq_iff_index_eq send_insert_id + by (metis dual_order.strict_trans1 ij_def(1) ij_def(2) less_not_refl) + ultimately show ?case using Suc + apply (cases "events i ! j") + using new_messages_keep_consistency [where i = "(i,j)"] by simp+ + qed + moreover have "make_set n (\k x. event_at (ids ! k) (Send x)) = {x. (\i. event_at i (Send x))}" + apply (simp add:make_set_def n_def, rule set_eqI, subst surjective_pairing, simp only:event_pred.simps) + using ids_def apply simp + by (metis fst_conv in_set_conv_nth is_valid_event_id.simps mem_Collect_eq prod.exhaust_sel snd_conv) + ultimately show ?thesis using ids_def n_def by simp +qed + +lemma (in dist_execution) received_messages_were_sent: + assumes "is_valid_state_id (i,j)" + shows "make_set j (\k m. (\s. event_at (i, k) (Receive s m))) \ {m. \i. event_at i (Send m)}" + using no_data_corruption by (simp add:make_set_def, rule_tac subsetI, fastforce) + +lemma (in dist_execution) state_is_associated_string: + assumes "is_valid_state_id i" + shows "is_certified_associated_string (set (received_messages i)) (state i)" + using state_is_associated_string' received_messages_eff + sent_messages_consistent received_messages_were_sent assms by (cases i, simp) + +end diff --git a/thys/WOOT_Strong_Eventual_Consistency/document/root.bib b/thys/WOOT_Strong_Eventual_Consistency/document/root.bib new file mode 100644 --- /dev/null +++ b/thys/WOOT_Strong_Eventual_Consistency/document/root.bib @@ -0,0 +1,340 @@ +@book{kshemkalyani2011distributed, + title = {Distributed Computing: Principles, Algorithms, and Systems}, + author = {Kshemkalyani, Ajay D. and Singhal, Mukesh}, + year = {2011}, + publisher = {Cambridge University Press}, +} + +@article{lahiri2002simple, + title = {A Simple Proof of {Suzumura's} Extension Theorem for Finite Domains with Applications}, + author = {Lahiri, Somdeb}, + journal = {Advances in Decision Sciences}, + volume = {6}, + number = {3}, + pages = {183--190}, + year = {2002}, + publisher = {Hindawi Publishing Corporation}, +} + +@article{klein2018java, + title={Java Source and Bytecode Formalizations in Isabelle: $\mu$Java}, + author={Klein, Gerwin and Nipkow, Tobias and von Oheimb, David and Pusch, Cornelia and Strecker, Martin} +} + +@inproceedings{ellis1989concurrency, + title = {Concurrency Control in Groupware Systems}, + author = {Ellis, Clarence A. and Gibbs, Simon J.}, + booktitle = {ACM SIGMOD Record}, + volume = {18}, + number = {2}, + pages = {399--407}, + year = {1989}, + organization = {ACM}, +} + +@article{li2010admissibility, + title = {An Admissibility-based Operational Transformation Framework for Collaborative Editing Systems}, + author = {Li, Du and Li, Rui}, + journal = {Computer Supported Cooperative Work (CSCW)}, + volume = {19}, + number = {1}, + pages = {1--43}, + year = {2010}, + publisher = {Springer}, +} + +@article{letia2010consistency, + title = {Consistency without Concurrency Control in Large, Dynamic Systems}, + author = {Letia, Mihai and Pregui{\c{c}}a, Nuno and Shapiro, Marc}, + journal = {ACM SIGOPS Operating Systems Review}, + volume = {44}, + number = {2}, + pages = {29--34}, + year = {2010}, + publisher = {ACM}, +} + +@inproceedings{weiss2009logoot, + title = {Logoot: A Scalable Optimistic Replication Algorithm for Collaborative Editing on {P2P} networks}, + author = {Weiss, St{\'e}phane and Urso, Pascal and Molli, Pascal}, + booktitle = {International Conference on Distributed Computing Systems (ICDCS)}, + pages = {404--412}, + year = {2009}, + organization = {IEEE}, +} + +@inproceedings{brown2014riak, + title = {Riak {DT} Map: a Composable, Convergent Replicated Dictionary}, + author = {Brown, Russell and Cribbs, Sean and Meiklejohn, Christopher and Elliott, Sam}, + booktitle = {Workshop on Principles and Practice of Eventual Consistency}, + pages = {1}, + year = {2014}, + organization = {ACM}, +} + +@inproceedings{oster2006data, + title = {Data Consistency for {P2P} Collaborative Editing}, + author = {Oster, G{\'e}rald and Urso, Pascal and Molli, Pascal and Imine, Abdessamad}, + booktitle = {Conference on Computer Supported Cooperative Work (CSCW)}, + pages = {259--268}, + year = {2006}, + organization = {ACM}, +} + +@techreport{oster2005real, + title = {Real Time Group Editors without Operational Transformation}, + author = {Oster, G{\'e}rald and Urso, Pascal and Molli, Pascal and Imine, Abdessamad}, + year = {2005}, + institution = {INRIA}, + number = {RR-5580}, +} + +@inproceedings{nedelec2013lseq, + title = {{LSEQ}: an Adaptive Structure for Sequences in Distributed Collaborative Editing}, + author = {N{\'e}delec, Brice and Molli, Pascal and Mostefaoui, Achour and Desmontils, Emmanuel}, + booktitle = {Symposium on Document Engineering (DocEng)}, + pages = {37--46}, + year = {2013}, + organization = {ACM}, +} + +@misc{dallaway2016wootjs, + title = {{WOOT} Model for {Scala} and {JavaScript} via {Scala.js}}, + author = {Dallaway, Richard}, + year = {2016}, + howpublished = {\url{https://github.com/d6y/wootjs}}, + note = {Accessed: 2017-01-25}, +} + +@misc{emanouilov2016woot, + title = {Collaborative Rich Text Editor}, + author = {Emanouilov, Victor}, + year = {2016}, + howpublished = {\url{https://github.com/kroky/woot}}, + note = {Accessed: 2017-01-25}, +} + +@misc{kaplan2016woot, + title = {A Real Time Collaboration Toy Project Based on {WOOT}}, + author = {Kaplan, Ryan}, + year = {2016}, + howpublished = {\url{https://github.com/ryankaplan/woot-collaborative-editor}}, + note = {Accessed: 2017-01-25}, +} + +@misc{olson2016woot, + title = {Real Time Group Editor without Operational Transformation.}, + author = {Olson, Tyler}, + year = {2016}, + howpublished = {\url{https://github.com/TGOlson/woot-haskell}}, + note = {Accessed: 2017-01-25}, +} + +@inproceedings{Aho:1973:FLC:800125.804056, + title = {On Finding Lowest Common Ancestors in Trees}, + author = {Aho, Alfred V. and Hopcroft, John E. and Ullman, Jeffrey D.}, + booktitle = {Symposium on Theory of Computing (STOC)}, + pages = {253--265}, + year = {1973}, + publisher = {ACM}, +} + +@inproceedings{shapiro2011conflict, + title = {Conflict-Free Replicated Data Types}, + author = {Shapiro, Marc and Pregui\c{c}a, Nuno and Baquero, Carlos and Zawirski, Marek}, + booktitle = {International Conference on Stabilization, Safety, and Security of Distributed Systems (SSS)}, + pages = {386--400}, + year = {2011}, + publisher = {Springer-Verlag}, +} + +@incollection{jelasity2011gossip, + title = {Gossip}, + author = {Jelasity, M{\'a}rk}, + booktitle = {Self-Organising Software}, + pages = {139--162}, + year = {2011}, + publisher = {Springer}, +} + +@inproceedings{weiss2007wooki, + title = {Wooki: a {P2P} Wiki-based Collaborative Writing Tool}, + author = {Weiss, St{\'e}phane and Urso, Pascal and Molli, Pascal}, + booktitle = {International Conference on Web Information Systems Engineering}, + pages = {503--512}, + year = {2007}, + organization = {Springer}, +} + +@inproceedings{preguica2009commutative, + title = {A Commutative Replicated Data Type for Cooperative Editing}, + author = {Preguica, Nuno and Marques, Joan Manuel and Shapiro, Marc and Letia, Mihai}, + booktitle = {International Conference on Distributed Computing Systems (ICDCS)}, + pages = {395--403}, + year = {2009}, + organization = {IEEE}, +} + +@inproceedings{nacer2011, + title = {Evaluating {CRDTs} for Real-time Document Editing}, + author = {Ahmed-Nacer, Mehdi and Ignat, Claudia-Lavinia and Oster, G{\'e}rald and Roh, Hyun-Gul and Urso, Pascal}, + booktitle = {Symposium on Document Engineering (DocEng)}, + pages = {103--112}, + year = {2011}, + publisher = {ACM}, +} + +@inproceedings{molli2006tombstone, + title = {Tombstone Transformation Functions for Ensuring Consistency in Collaborative Editing Systems}, + author = {Oster, G{\'e}rald and Molli, Pascal and Urso, Pascal and Imine, Abdessamad}, + booktitle = {International Conference on Collaborative Computing: Networking, Applications and Worksharing (CollaborateCom)}, + pages = {1--10}, + year = {2006}, + organization = {IEEE}, +} +@techreport{roh2009optimistic, + title = {Optimistic Operations for Replicated Abstract Data Types}, + author = {Roh, Hyun-Gul and Kim, Jin-Soo and Lee, Joonwon and Maeng, Seungryoul}, + year = {2009}, +} + +@article{kumawat2010survey, + title = {A Survey on Operational Transformation Algorithms: Challenges, Issues and Achievements}, + author = {Kumawat, Santosh and Khunteta, Ajay}, + journal = {International Journal of Computer Applications}, + volume = {3}, + number = {12}, + pages = {30--38}, + year = {2010}, + publisher = {FCS}, +} + +@techreport{shapiro:inria-00555588, + TITLE = {{A comprehensive study of Convergent and Commutative Replicated Data Types}}, + AUTHOR = {Shapiro, Marc and Pregui{\c c}a, Nuno and Baquero, Carlos and Zawirski, Marek}, + URL = {https://hal.inria.fr/inria-00555588}, + TYPE = {Research Report}, + NUMBER = {RR-7506}, + PAGES = {50}, + INSTITUTION = {{Inria -- Centre Paris-Rocquencourt ; INRIA}}, + YEAR = {2011}, + MONTH = Jan, + KEYWORDS = {eventual consistency ; optimistic replication ; replicated data types ; distributed algorithms ; distributed systems ; Data replication ; commutative operations}, + PDF = {https://hal.inria.fr/inria-00555588/file/techreport.pdf}, + HAL_ID = {inria-00555588}, + HAL_VERSION = {v1}, +} + +@article{gomes2017verifying, + title = {Verifying Strong Eventual Consistency in Distributed Systems}, + author = {Gomes, Victor B. F. and Kleppmann, Martin and Mulligan, Dominic P. and Beresford, Alastair R.}, + journal = {Proceedings of the ACM on Programming Languages (PACMPL)}, + volume = {1}, + number = {OOPSLA}, + year = {2017}, + publisher = {ACM}, +} + +@inproceedings{Briot2016, + title = {High Responsiveness for Group Editing CRDTs}, + author = {Briot, Lo{\"\i}ck and Urso, Pascal and Shapiro, Marc}, + booktitle = {International Conference on Supporting Group Work (GROUP)}, + year = {2016}, + pages = {51--60}, + publisher = {ACM}, +} + +@article{Lamport1978, + title = {Time, Clocks, and the Ordering of Events in a Distributed System}, + author = {Lamport, Leslie}, + journal = {Communications of the ACM}, + volume = {21}, + number = {7}, + month = {July}, + year = {1978}, + pages = {558--565}, + publisher = {ACM}, +} + +@article{raynal1991, + title = {The causal ordering abstraction and a simple way to implement it}, + author = {Raynal, Michel and Schiper, Andr{\'e} and Toueg, Sam}, + journal = {Information Processing Letters}, + volume = 39, + number = 6, + pages = {343--350}, + year = 1991, +} + +@book{raynal2013, + author = {Michel Raynal}, + title = {Distributed Algorithms for Message-Passing Systems}, + publisher = {Springer}, + year = {2013}, + url = {https://doi.org/10.1007/978-3-642-38123-2}, + doi = {10.1007/978-3-642-38123-2}, + isbn = {978-3-642-38122-5}, + timestamp = {Tue, 16 May 2017 14:01:34 +0200}, + biburl = {https://dblp.org/rec/bib/books/daglib/0032304}, + bibsource = {dblp computer science bibliography, https://dblp.org} +} + +@article{birman1991lightweight, + title={Lightweight causal and atomic group multicast}, + author={Birman, Kenneth and Schiper, Andre and Stephenson, Pat}, + journal={ACM Transactions on Computer Systems (TOCS)}, + volume={9}, + number={3}, + pages={272--314}, + year={1991}, + publisher={ACM} +} + +@InProceedings{Mostefaoui2017, +author="Most{\'e}faoui, Achour +and Weiss, St{\'e}phane", +editor="Malyshkin, Victor", +title="Probabilistic Causal Message Ordering", +booktitle="Parallel Computing Technologies", +year="2017", +publisher="Springer International Publishing", +address="Cham", +pages="315--326", +isbn="978-3-319-62932-2" +} + +@inproceedings{yen2003scalable, + title={A scalable scheme for causal message ordering}, + author={Yen, Li-Hsing and Chi, Kuang-Hwei and Huang, Ting-Lu}, + booktitle={Proceedings of the National Computer Symposium (NCS'03), Taiwan}, + year={2003} +} + +@misc{wardX, + author = {Ward, Paul A. S.}, + title = {Algorithms for Causal Message Ordering in Distributed Systems}, +} + +@inproceedings{DBLP:conf/forte/ZellerBP14, + author = {Peter Zeller and + Annette Bieniusa and + Arnd Poetzsch{-}Heffter}, + editor = {Erika {\'{A}}brah{\'{a}}m and + Catuscia Palamidessi}, + title = {Formal Specification and Verification of CRDTs}, + booktitle = {Formal Techniques for Distributed Objects, Components, and Systems + - 34th {IFIP} {WG} 6.1 International Conference, {FORTE} 2014, Held + as Part of the 9th International Federated Conference on Distributed + Computing Techniques, DisCoTec 2014, Berlin, Germany, June 3-5, 2014. + Proceedings}, + series = {Lecture Notes in Computer Science}, + volume = {8461}, + pages = {33--48}, + publisher = {Springer}, + year = {2014}, + url = {https://doi.org/10.1007/978-3-662-43613-4\_3}, + doi = {10.1007/978-3-662-43613-4\_3}, + timestamp = {Mon, 06 Jan 2020 16:23:43 +0100}, + biburl = {https://dblp.org/rec/bib/conf/forte/ZellerBP14}, + bibsource = {dblp computer science bibliography, https://dblp.org} +} \ No newline at end of file diff --git a/thys/WOOT_Strong_Eventual_Consistency/document/root.tex b/thys/WOOT_Strong_Eventual_Consistency/document/root.tex new file mode 100644 --- /dev/null +++ b/thys/WOOT_Strong_Eventual_Consistency/document/root.tex @@ -0,0 +1,217 @@ +\documentclass[11pt,a4paper]{article} + +\usepackage{algorithmicx} +\usepackage{algorithm} +\usepackage{algpseudocode} +\usepackage{amssymb} +\usepackage{graphicx} +\usepackage{hyphenat} +\usepackage[utf8]{inputenc} +\usepackage{isabelle} +\usepackage{isabellesym} +\usepackage{subfig} +\usepackage{tikz} +\usepackage{todonotes} +\usepackage{mathtools} +\usepackage{csquotes} +\usepackage{authblk} + +\usetikzlibrary{positioning} + +% further packages required for unusual symbols (see also +% isabellesym.sty), use only when needed + +%for \, \, \, \, \, \, + %\, \, \, \, \, + %\, \, \ + +%\usepackage{eurosym} + %for \ + +%\usepackage[only,bigsqcap]{stmaryrd} + %for \ + +%\usepackage{eufrak} + %for \ ... \, \ ... \ (also included in amssymb) + +%\usepackage{textcomp} + %for \, \, \, \, \, + %\ + +% This should be the last package used. +\usepackage{pdfsetup} + +% URLs in roman style, theory text in math-similar italics. +\urlstyle{rm} +\isabellestyle{it} + +% For uniform font size. +%\renewcommand{\isastyle}{\isastyleminor} + +\begin{document} + +\title{Strong Eventual Consistency of the Collaborative Editing Framework WOOT} +\author{Emin Karayel} +\author{Edgar Gonzàlez} +\affil{Google, Mountain View} +\maketitle + +% Sane default for proof documents. +% \parindent 0pt\parskip 0.5ex +\setlength\parindent{1em} +\setlength\parskip{0.5ex} + +\begin{abstract} + Commutative Replicated Data Types (CRDTs) are a promising new class of data structures for large-scale shared mutable content in applications that only require eventual consistency. +The WithOut Operational Transforms (WOOT) framework is a CRDT for collaborative text editing introduced by Oster et al. (CSCW 2006) for which the eventual consistency property was verified only for a bounded model to date. +We contribute a formal proof for WOOTs strong eventual consistency. +\end{abstract} + +\tableofcontents + +\section{Introduction}% +A \emph{Replicated (Abstract) Data Type (RDT)} consists of ``\emph{multiple copies of a shared Abstract Data Type (ADT) replicated over distributed sites, [which] provides a set of primitive operation types corresponding to that of normal ADTs, concealing details for consistency maintenance}''~\cite{roh2009optimistic}. +RDTs can be classified as \emph{state-based} or \emph{operation-based} depending on whether full states (e.g., a document's text) or only the operations performed on them (e.g., character insertions and deletions) are exchanged among replicas. +Operation-based RDTs are \emph{commutative} when the integration of any two concurrent operations on any reachable replica state commutes~\cite{shapiro2011conflict}. + +Commutative (Operation-Based) Replicated Data Types (CRDTs\footnote{Note that other authors like Shapiro et al.~\cite{shapiro2011conflict} use CmRDT to refer to Commutative RDTs, with CRDT standing for \emph{Conflict-free RDTs}.} from now on) enable sharing mutable content with optimistic replication---ensu\-ring high\hyp{}availability, responsive interaction, and eventual consistency without consensus\hyp{}ba\-sed concurrency control~\cite{letia2010consistency}. +They are used in highly scalable robust distributed applications~\cite{weiss2009logoot,brown2014riak}. + +An RDT is \emph{eventually consistent} when, if after some point in time no further updates are made at any replica, all replicas eventually converge to equivalent states. +It is \emph{strongly eventually consistent} when it is eventually consistent and, whenever any two peers have seen the same set of updates (in possibly different order), they reach equivalent states immediately~\cite{shapiro2011conflict}. + +The WithOut Operational Transforms (WOOT) Framework~\cite{oster2006data} was the first proposed CRDT for collaborative text editing~\cite{Briot2016}. +It has been implemented as part of several OSS projects~\cite{dallaway2016wootjs,emanouilov2016woot,kaplan2016woot,olson2016woot}. +However, the eventual consistency of WOOT has only been verified for a bounded model~\cite{oster2006data, oster2005real}. +A formal proof of WOOTs consistency can rigorously establish that there is no complex counter-example not identified by model checking. + +The contribution of this work is one such proof that the WOOT Framework is strongly eventually consistent. +Its central idea is the association of a value from a dense totally ordered space to each inserted (and potentially deleted) character, using a recursive definition with respect to the acyclic graph induced by the predecessor and successor relation of the characters. +We then show that the strings in each peer remain sorted with respect to that value, i.e., that the values form a sort key for W-characters.\footnote{Note that the values themselves do not have to be actually computed, during the execution of the framework. Their existence and compatibility with the integration algorithm forms a witness for the consistency proof we are presenting.} +This resolves the conjecture posed by Oster et al.~\cite[conjecture 1]{oster2005real} and is also the key lemma to establish that the WOOT Framework has the strong eventual consistency property. + +After reviewing related work in the following section, we formalize the WOOT Framework as a distributed application in Section~\ref{sec:wootFramework}. +We follow with the complete eventual consistency proof in Section~\ref{sec:proof} and summarize the established results in Section~\ref{sec:strong_eventual_consistency}. In Section~\ref{sec:proof_outline} we given overview of the proof +and follow up with a conrete formalized example in Section~\ref{sec:example}. + +The presentation is structured such that all the definitions necessary to review the established results in Section~\ref{sec:strong_eventual_consistency} are part of Section~\ref{sec:wootFramework}. +This means it is possible to skip Section~\ref{sec:proof} entirely. + +\section{Related Work}% +\label{sec:relatedWork}% +The first collaborative text editing tools were based on operational transformations (OT), and introduced by Ellis and Gibbs~\cite{ellis1989concurrency}. +The basic idea behind OT-based frameworks is to adjust edit operations, based on the effects of previously executed concurrent operations. +For instance, in Figure~\ref{fig:otDrawing}, peer B can execute the message received from peer A without correction, but peer A needs to transform the one received from peer B to reach the same state. + +Proving the correctness of OT-based frameworks is error-prone and requires complicated case coverage~\cite{li2010admissibility,molli2006tombstone}. +Counter-examples have been found in most OT algorithms~\cite{roh2009optimistic}\cite[section 8.2]{gomes2017verifying}. + +\begin{figure}[t] +\centering +\subfloat[Transformation-based]{\label{fig:otDrawing}% +\begin{tikzpicture}[ + peernode/.style={rectangle, draw=black, thick}, + editnode/.style={rectangle, draw=black, fill=black!20, thick,rounded corners=.1cm}, + statenode/.style={rectangle, draw=black, thick,rounded corners=.1cm}, +] +% Nodes. +\node[peernode] (peerA) at (0, 4.6) {Peer A}; +\node[peernode] (peerB) at (2.4, 4.6) {Peer B}; +\node[statenode] (stateA1) at (0, 3.6) {c a u s e}; +\node[statenode] (stateB1) at (2.4, 3.6) {c a u s e}; +\node[editnode] (editA1) at (0, 2.6) {Ins 2 l}; +\node[editnode] (editB1) at (2.4, 2.6) {Ins 5 s}; +\node[statenode] (stateA2) at (0, 1.8) {c l a u s e}; +\node[statenode] (stateB2) at (2.4, 1.8) {c a u s e s}; +\node[editnode] (editA2) at (0, 0.8) {Ins 6 s}; +\node[editnode] (editB2) at (2.4, 0.8) {Ins 1 l}; +\node[statenode] (stateA3) at (0, 0) {c l a u s e s}; +\node[statenode] (stateB3) at (2.4, 0) {c l a u s e s}; +% Lines. +\draw[->] (peerA.south) -- (stateA1.north); +\draw[->] (peerB.south) -- (stateB1.north); +\draw[->] (stateA1.south) -- (editA1.north); +\draw[->] (stateB1.south) -- (editB1.north); +\draw[->] (editA1.south) -- (stateA2.north); +\draw[->] (editB1.south) -- (stateB2.north); +\draw[->] (stateA2.south) -- (editA2.north); +\draw[->] (stateB2.south) -- (editB2.north); +\draw[->] (editA2.south) -- (stateA3.north); +\draw[->] (editB2.south) -- (stateB3.north); +\draw[->] (editA1.east) to[out=-40,in=140] (editB2.west); +\draw[->] (editB1.west) to[out=220,in=40] (editA2.east); +\end{tikzpicture}} +\hspace{0.5em}\vline\hspace{0.5em}% +\subfloat[Sort-key based]{\label{fig:crdtDrawing}% +\begin{tikzpicture}[ + peernode/.style={rectangle, draw=black, thick}, + editnode/.style={rectangle, draw=black, fill=black!20, thick,rounded corners=.1cm}, + statenode/.style={rectangle, draw=black, thick,rounded corners=.1cm}, +] +% Nodes. 5.5 - 1.7 = 4.5 - 0.7 +\node[peernode] (peerA) at (0, 4.6) {Peer A}; +\node[peernode] (peerB) at (3.8, 4.6) {Peer B}; +\node[statenode] (stateA1) at (0, 3.6) {$\textrm{c}_1$ $\textrm{a}_2$ $\textrm{u}_3$ $\textrm{s}_4$ $\textrm{e}_5$}; +\node[statenode] (stateB1) at (3.8, 3.6) {$\textrm{c}_1$ $\textrm{a}_2$ $\textrm{u}_3$ $\textrm{s}_4$ $\textrm{e}_5$}; +\node[editnode] (editA1) at (0, 2.6) {Ins 1.5 l}; +\node[editnode] (editB1) at (3.8, 2.6) {Ins 6 s}; +\node[statenode] (stateA2) at (0, 1.8) {$\textrm{c}_1$ $\textrm{l}_{1.5}$ $\textrm{a}_2$ $\textrm{u}_3$ $\textrm{s}_4$ $\textrm{e}_5$}; +\node[statenode] (stateB2) at (3.8, 1.8) {$\textrm{c}_1$ $\textrm{a}_2$ $\textrm{u}_3$ $\textrm{s}_4$ $\textrm{e}_5$ $\textrm{s}_6$}; +\node[editnode] (editA2) at (0, 0.8) {Ins 6 s}; +\node[editnode] (editB2) at (3.8, 0.8) {Ins 1.5 l}; +\node[statenode] (stateA3) at (0, 0) {$\textrm{c}_1$ $\textrm{l}_{1.5}$ $\textrm{a}_2$ $\textrm{u}_3$ $\textrm{s}_4$ $\textrm{e}_5$ $\textrm{s}_{6}$}; +\node[statenode] (stateB3) at (3.8, 0) {$\textrm{c}_1$ $\textrm{l}_{1.5}$ $\textrm{a}_2$ $\textrm{u}_3$ $\textrm{s}_4$ $\textrm{e}_5$ $\textrm{s}_{6}$}; +% Lines. +\draw[->] (peerA.south) -- (stateA1.north); +\draw[->] (peerB.south) -- (stateB1.north); +\draw[->] (stateA1.south) -- (editA1.north); +\draw[->] (stateB1.south) -- (editB1.north); +\draw[->] (editA1.south) -- (stateA2.north); +\draw[->] (editB1.south) -- (stateB2.north); +\draw[->] (stateA2.south) -- (editA2.north); +\draw[->] (stateB2.south) -- (editB2.north); +\draw[->] (editA2.south) -- (stateA3.north); +\draw[->] (editB2.south) -- (stateB3.north); +\draw[->] (editA1.east) to[out=0,in=180] (editB2.west); +\draw[->] (editB1.west) to[out=180,in=0] (editA2.east); +\end{tikzpicture}} +\caption{Collaborative text editing}% +\end{figure}% + +LSEQ~\cite{nedelec2013lseq}, LOGOOT~\cite{weiss2009logoot} and TreeDoc~\cite{preguica2009commutative} are CRDTs that create and send sort keys for symbols (e.g., $1.5$ and $6$ in Figure~\ref{fig:crdtDrawing}). +These keys can then be directly used to order them, without requiring any transformations, and are drawn from a dense totally ordered space. +In the figure rational numbers were chosen for simplicity, but more commonly lexicographically ordered sequences are used.\footnote{In addition, peers draw sort keys from disjoint (but dense) subsets to avoid concurrently choosing the same sort key.} +The consistency property of these frameworks can be established easily. +However, the space required per sort key potentially grows linearly with the count of edit operations. +In LSEQ, a randomized allocation strategy for new identifiers is used to reduce the key growth, based on empirically determined edit patterns---but in the worst-case the size of the keys will still grow linearly with the count of insert operations. +Preguica et al.~\cite{preguica2009commutative} propose a solution for this problem using regular rebalancing operations. +However, this can only be done using a consensus\hyp{}based mechanism, which is only possible when the number of participating peers is small. + +A benefit of LSEQ, LOGOOT, and TreeDoc is that deleted symbols can be garbage-collected (though delete messages may have to be kept in a buffer if the corresponding insertion message has not arrived at a peer), in contrast to the WOOT Framework, where deleted symbols (tombstones) cannot be removed. + +Replicated Growable Arrays (RGAs) are another data structure for collaborative editing, introduced by Roh et al.~\cite{roh2009optimistic}. +Contrary to the previous approaches, the identifiers associated to the symbols are not sort keys, but are instead ordered consistently with the happened-before relation. +A peer sends the identifier of the symbol immediately preceeding the new symbol at the time it was created and the actual identifier associated to the new symbol. +The integration algorithm starts by finding the preceeding symbol and skipping following symbols with a larger identifier before placing the new symbol. +The authors provide a mathematical eventual consistency proof. Recently, Gomes et. al.~\cite{gomes2017verifying} also formalized the eventual consistency property of RGAs using Isabelle/HOL. + +In addition to the original design of WOOT by Oster et al.~\cite{oster2006data}, a number of extensions have also been proposed. +For instance, Weiss et al.~\cite{weiss2007wooki} propose a line-based version WOOTO, and Ahmed-Nacer et al.~\cite{nacer2011} introduce a second extension WOOTH which improves performance by using hash tables. +The latter compare their implementation in benchmarks against LOGOOT, RGA, and an OT algorithm. + +To the best of our knowledge there are no publications that further expand on the correctness of the WOOT Framework. +The fact that the general convergence proof is missing is also mentioned by Kumawat and Khun\-teta~\cite[Section 3.10]{kumawat2010survey}. + +% Generated text of all theories. +\input{session} + +% Optional bibliography. +\bibliographystyle{abbrv} +\bibliography{root} + +\end{document} + +%%% Local Variables: +%%% mode: latex +%%% TeX-master: t +%%% End: diff --git a/web/entries/Bicategory.html b/web/entries/Bicategory.html --- a/web/entries/Bicategory.html +++ b/web/entries/Bicategory.html @@ -1,181 +1,188 @@ Bicategories - Archive of Formal Proofs

 

 

 

 

 

 

Bicategories

 

+ + + +
Title: Bicategories
Author: Eugene W. Stark (stark /at/ cs /dot/ stonybrook /dot/ edu)
Submission date: 2020-01-06
Abstract: Taking as a starting point the author's previous work on developing aspects of category theory in Isabelle/HOL, this article gives a compatible formalization of the notion of "bicategory" and develops a framework within which formal proofs of facts about bicategories can be given. The framework includes a number of basic results, including the Coherence Theorem, the Strictness Theorem, pseudofunctors and biequivalence, and facts about internal equivalences and adjunctions in a bicategory. As a driving application and demonstration of the utility of the framework, it is used to give a formal proof of a theorem, due to Carboni, Kasangian, and Street, that characterizes up to biequivalence the bicategories of spans in a category with pullbacks. The formalization effort necessitated the filling-in of many details that were not evident from the brief presentation in the original paper, as well as identifying a few minor corrections along the way.
Change history:[2020-02-15]: +Move ConcreteCategory.thy from Bicategory to Category3 and use it systematically. +Make other minor improvements throughout. +(revision a51840d36867)
BibTeX:
@article{Bicategory-AFP,
   author  = {Eugene W. Stark},
   title   = {Bicategories},
   journal = {Archive of Formal Proofs},
   month   = jan,
   year    = 2020,
   note    = {\url{http://isa-afp.org/entries/Bicategory.html},
             Formal proof development},
   ISSN    = {2150-914x},
 }
License: BSD License
Depends on: MonoidalCategory

\ No newline at end of file diff --git a/web/entries/Category3.html b/web/entries/Category3.html --- a/web/entries/Category3.html +++ b/web/entries/Category3.html @@ -1,236 +1,240 @@ Category Theory with Adjunctions and Limits - Archive of Formal Proofs

 

 

 

 

 

 

Category Theory with Adjunctions and Limits

 

+(revision 8318366d4575)
+[2020-02-15]: +Move ConcreteCategory.thy from Bicategory to Category3 and use it systematically. +Make other minor improvements throughout. +(revision a51840d36867)
Title: Category Theory with Adjunctions and Limits
Author: Eugene W. Stark (stark /at/ cs /dot/ stonybrook /dot/ edu)
Submission date: 2016-06-26
Abstract: This article attempts to develop a usable framework for doing category theory in Isabelle/HOL. Our point of view, which to some extent differs from that of the previous AFP articles on the subject, is to try to explore how category theory can be done efficaciously within HOL, rather than trying to match exactly the way things are done using a traditional approach. To this end, we define the notion of category in an "object-free" style, in which a category is represented by a single partial composition operation on arrows. This way of defining categories provides some advantages in the context of HOL, including the ability to avoid the use of records and the possibility of defining functors and natural transformations simply as certain functions on arrows, rather than as composite objects. We define various constructions associated with the basic notions, including: dual category, product category, functor category, discrete category, free category, functor composition, and horizontal and vertical composite of natural transformations. A "set category" locale is defined that axiomatizes the notion "category of all sets at a type and all functions between them," and a fairly extensive set of properties of set categories is derived from the locale assumptions. The notion of a set category is used to prove the Yoneda Lemma in a general setting of a category equipped with a "hom embedding," which maps arrows of the category to the "universe" of the set category. We also give a treatment of adjunctions, defining adjunctions via left and right adjoint functors, natural bijections between hom-sets, and unit and counit natural transformations, and showing the equivalence of these definitions. We also develop the theory of limits, including representations of functors, diagrams and cones, and diagonal functors. We show that right adjoint functors preserve limits, and that limits can be constructed via products and equalizers. We characterize the conditions under which limits exist in a set category. We also examine the case of limits in a functor category, ultimately culminating in a proof that the Yoneda embedding preserves limits.
Change history: [2018-05-29]: Revised axioms for the category locale. Introduced notation for composition and "in hom". -(revision 8318366d4575)
BibTeX:
@article{Category3-AFP,
   author  = {Eugene W. Stark},
   title   = {Category Theory with Adjunctions and Limits},
   journal = {Archive of Formal Proofs},
   month   = jun,
   year    = 2016,
   note    = {\url{http://isa-afp.org/entries/Category3.html},
             Formal proof development},
   ISSN    = {2150-914x},
 }
License: BSD License
Used by: MonoidalCategory

\ No newline at end of file diff --git a/web/entries/Certification_Monads.html b/web/entries/Certification_Monads.html --- a/web/entries/Certification_Monads.html +++ b/web/entries/Certification_Monads.html @@ -1,202 +1,202 @@ Certification Monads - Archive of Formal Proofs

 

 

 

 

 

 

Certification Monads

 

- +
Title: Certification Monads
Authors: Christian Sternagel (c /dot/ sternagel /at/ gmail /dot/ com) and René Thiemann
Submission date: 2014-10-03
Abstract: This entry provides several monads intended for the development of stand-alone certifiers via code generation from Isabelle/HOL. More specifically, there are three flavors of error monads (the sum type, for the case where all monadic functions are total; an instance of the former, the so called check monad, yielding either success without any further information or an error message; as well as a variant of the sum type that accommodates partial functions by providing an explicit bottom element) and a parser monad built on top. All of this monads are heavily used in the IsaFoR/CeTA project which thus provides many examples of their usage.
BibTeX:
@article{Certification_Monads-AFP,
   author  = {Christian Sternagel and René Thiemann},
   title   = {Certification Monads},
   journal = {Archive of Formal Proofs},
   month   = oct,
   year    = 2014,
   note    = {\url{http://isa-afp.org/entries/Certification_Monads.html},
             Formal proof development},
   ISSN    = {2150-914x},
 }
License: BSD License
Depends on: Partial_Function_MR, Show
Used by:XML
WOOT_Strong_Eventual_Consistency, XML

\ No newline at end of file diff --git a/web/entries/Datatype_Order_Generator.html b/web/entries/Datatype_Order_Generator.html --- a/web/entries/Datatype_Order_Generator.html +++ b/web/entries/Datatype_Order_Generator.html @@ -1,245 +1,245 @@ Generating linear orders for datatypes - Archive of Formal Proofs

 

 

 

 

 

 

Generating linear orders for datatypes

 

- +
Title: Generating linear orders for datatypes
Author: René Thiemann
Submission date: 2012-08-07
Abstract: We provide a framework for registering automatic methods to derive class instances of datatypes, as it is possible using Haskell's ``deriving Ord, Show, ...'' feature.

We further implemented such automatic methods to derive (linear) orders or hash-functions which are required in the Isabelle Collection Framework. Moreover, for the tactic of Huffman and Krauss to show that a datatype is countable, we implemented a wrapper so that this tactic becomes accessible in our framework.

Our formalization was performed as part of the IsaFoR/CeTA project. With our new tactic we could completely remove tedious proofs for linear orders of two datatypes.

This development is aimed at datatypes generated by the "old_datatype" command.

BibTeX:
@article{Datatype_Order_Generator-AFP,
   author  = {René Thiemann},
   title   = {Generating linear orders for datatypes},
   journal = {Archive of Formal Proofs},
   month   = aug,
   year    = 2012,
   note    = {\url{http://isa-afp.org/entries/Datatype_Order_Generator.html},
             Formal proof development},
   ISSN    = {2150-914x},
 }
License: BSD License
Depends on: Deriving, Native_Word
Used by:Higher_Order_Terms
Higher_Order_Terms, WOOT_Strong_Eventual_Consistency

\ No newline at end of file diff --git a/web/entries/Decreasing-Diagrams-II.html b/web/entries/Decreasing-Diagrams-II.html --- a/web/entries/Decreasing-Diagrams-II.html +++ b/web/entries/Decreasing-Diagrams-II.html @@ -1,196 +1,196 @@ Decreasing Diagrams II - Archive of Formal Proofs

 

 

 

 

 

 

Decreasing Diagrams II

 

Title: Decreasing Diagrams II
Author: - Bertram Felgenhauer + Bertram Felgenhauer (int-e /at/ gmx /dot/ de)
Submission date: 2015-08-20
Abstract: This theory formalizes the commutation version of decreasing diagrams for Church-Rosser modulo. The proof follows Felgenhauer and van Oostrom (RTA 2013). The theory also provides important specializations, in particular van Oostrom’s conversion version (TCS 2008) of decreasing diagrams.
BibTeX:
@article{Decreasing-Diagrams-II-AFP,
   author  = {Bertram Felgenhauer},
   title   = {Decreasing Diagrams II},
   journal = {Archive of Formal Proofs},
   month   = aug,
   year    = 2015,
   note    = {\url{http://isa-afp.org/entries/Decreasing-Diagrams-II.html},
             Formal proof development},
   ISSN    = {2150-914x},
 }
License: GNU Lesser General Public License (LGPL)
Depends on: Abstract-Rewriting, Open_Induction, Well_Quasi_Orders

\ No newline at end of file diff --git a/web/entries/Dependent_SIFUM_Refinement.html b/web/entries/Dependent_SIFUM_Refinement.html --- a/web/entries/Dependent_SIFUM_Refinement.html +++ b/web/entries/Dependent_SIFUM_Refinement.html @@ -1,217 +1,217 @@ Compositional Security-Preserving Refinement for Concurrent Imperative Programs - Archive of Formal Proofs

 

 

 

 

 

 

Compositional Security-Preserving Refinement for Concurrent Imperative Programs

 

Title: Compositional Security-Preserving Refinement for Concurrent Imperative Programs
Authors: - Toby Murray, + Toby Murray, Robert Sison, Edward Pierzchalski and Christine Rizkallah
Submission date: 2016-06-28
Abstract: The paper "Compositional Verification and Refinement of Concurrent Value-Dependent Noninterference" by Murray et. al. (CSF 2016) presents a compositional theory of refinement for a value-dependent noninterference property, defined in (Murray, PLAS 2015), for concurrent programs. This development formalises that refinement theory, and demonstrates its application on some small examples.
Change history: [2016-08-19]: Removed unused "stop" parameters from the sifum_refinement locale. (revision dbc482d36372) [2016-09-02]: TobyM extended "simple" refinement theory to be usable for all bisimulations. (revision 547f31c25f60)
BibTeX:
@article{Dependent_SIFUM_Refinement-AFP,
   author  = {Toby Murray and Robert Sison and Edward Pierzchalski and Christine Rizkallah},
   title   = {Compositional Security-Preserving Refinement for Concurrent Imperative Programs},
   journal = {Archive of Formal Proofs},
   month   = jun,
   year    = 2016,
   note    = {\url{http://isa-afp.org/entries/Dependent_SIFUM_Refinement.html},
             Formal proof development},
   ISSN    = {2150-914x},
 }
License: BSD License
Depends on: Dependent_SIFUM_Type_Systems

\ No newline at end of file diff --git a/web/entries/Dependent_SIFUM_Type_Systems.html b/web/entries/Dependent_SIFUM_Type_Systems.html --- a/web/entries/Dependent_SIFUM_Type_Systems.html +++ b/web/entries/Dependent_SIFUM_Type_Systems.html @@ -1,224 +1,224 @@ A Dependent Security Type System for Concurrent Imperative Programs - Archive of Formal Proofs

 

 

 

 

 

 

A Dependent Security Type System for Concurrent Imperative Programs

 

Title: A Dependent Security Type System for Concurrent Imperative Programs
Authors: - Toby Murray, + Toby Murray, Robert Sison, Edward Pierzchalski and Christine Rizkallah
Submission date: 2016-06-25
Abstract: The paper "Compositional Verification and Refinement of Concurrent Value-Dependent Noninterference" by Murray et. al. (CSF 2016) presents a dependent security type system for compositionally verifying a value-dependent noninterference property, defined in (Murray, PLAS 2015), for concurrent programs. This development formalises that security definition, the type system and its soundness proof, and demonstrates its application on some small examples. It was derived from the SIFUM_Type_Systems AFP entry, by Sylvia Grewe, Heiko Mantel and Daniel Schoepe, and whose structure it inherits.
Change history: [2016-08-19]: Removed unused "stop" parameter and "stop_no_eval" assumption from the sifum_security locale. (revision dbc482d36372) [2016-09-27]: Added security locale support for the imposition of requirements on the initial memory. (revision cce4ceb74ddb)
BibTeX:
@article{Dependent_SIFUM_Type_Systems-AFP,
   author  = {Toby Murray and Robert Sison and Edward Pierzchalski and Christine Rizkallah},
   title   = {A Dependent Security Type System for Concurrent Imperative Programs},
   journal = {Archive of Formal Proofs},
   month   = jun,
   year    = 2016,
   note    = {\url{http://isa-afp.org/entries/Dependent_SIFUM_Type_Systems.html},
             Formal proof development},
   ISSN    = {2150-914x},
 }
License: BSD License
Used by: Dependent_SIFUM_Refinement

\ No newline at end of file diff --git a/web/entries/Epistemic_Logic.html b/web/entries/Epistemic_Logic.html --- a/web/entries/Epistemic_Logic.html +++ b/web/entries/Epistemic_Logic.html @@ -1,177 +1,177 @@ Epistemic Logic - Archive of Formal Proofs

 

 

 

 

 

 

Epistemic Logic

 

Title: Epistemic Logic
Author: - Asta Halkjær From + Asta Halkjær From
Submission date: 2018-10-29
Abstract: This work is a formalization of epistemic logic with countably many agents. It includes proofs of soundness and completeness for the axiom system K. The completeness proof is based on the textbook "Reasoning About Knowledge" by Fagin, Halpern, Moses and Vardi (MIT Press 1995).
BibTeX:
@article{Epistemic_Logic-AFP,
   author  = {Asta Halkjær From},
   title   = {Epistemic Logic},
   journal = {Archive of Formal Proofs},
   month   = oct,
   year    = 2018,
   note    = {\url{http://isa-afp.org/entries/Epistemic_Logic.html},
             Formal proof development},
   ISSN    = {2150-914x},
 }
License: BSD License

\ No newline at end of file diff --git a/web/entries/FOL-Fitting.html b/web/entries/FOL-Fitting.html --- a/web/entries/FOL-Fitting.html +++ b/web/entries/FOL-Fitting.html @@ -1,277 +1,277 @@ First-Order Logic According to Fitting - Archive of Formal Proofs

 

 

 

 

 

 

First-Order Logic According to Fitting

 

Title: First-Order Logic According to Fitting
Author: Stefan Berghofer
Contributor: - Asta Halkjær From + Asta Halkjær From
Submission date: 2007-08-02
Abstract: We present a formalization of parts of Melvin Fitting's book "First-Order Logic and Automated Theorem Proving". The formalization covers the syntax of first-order logic, its semantics, the model existence theorem, a natural deduction proof calculus together with a proof of correctness and completeness, as well as the Löwenheim-Skolem theorem.
Change history: [2018-07-21]: Proved completeness theorem for open formulas. Proofs are now written in the declarative style. Enumeration of pairs and datatypes is automated using the Countable theory.
BibTeX:
@article{FOL-Fitting-AFP,
   author  = {Stefan Berghofer},
   title   = {First-Order Logic According to Fitting},
   journal = {Archive of Formal Proofs},
   month   = aug,
   year    = 2007,
   note    = {\url{http://isa-afp.org/entries/FOL-Fitting.html},
             Formal proof development},
   ISSN    = {2150-914x},
 }
License: BSD License
Used by: FOL_Seq_Calc1

\ No newline at end of file diff --git a/web/entries/FOL_Harrison.html b/web/entries/FOL_Harrison.html --- a/web/entries/FOL_Harrison.html +++ b/web/entries/FOL_Harrison.html @@ -1,208 +1,208 @@ First-Order Logic According to Harrison - Archive of Formal Proofs

 

 

 

 

 

 

First-Order Logic According to Harrison

 

Title: First-Order Logic According to Harrison
Authors: Alexander Birch Jensen, - Anders Schlichtkrull (andschl /at/ dtu /dot/ dk) and + Anders Schlichtkrull and Jørgen Villadsen
Submission date: 2017-01-01
Abstract:

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.

Reference: Programming and Verifying a Declarative First-Order Prover in Isabelle/HOL. Alexander Birch Jensen, John Bruntse Larsen, Anders Schlichtkrull & Jørgen Villadsen. AI Communications 31:281-299 2018. https://content.iospress.com/articles/ai-communications/aic764

See also: Students' Proof Assistant (SPA). https://github.com/logic-tools/spa

Change history: [2018-07-21]: Proof of Pelletier's problem 34 (Andrews's Challenge) thanks to Asta Halkjær From.
BibTeX:
@article{FOL_Harrison-AFP,
   author  = {Alexander Birch Jensen and Anders Schlichtkrull and Jørgen Villadsen},
   title   = {First-Order Logic According to Harrison},
   journal = {Archive of Formal Proofs},
   month   = jan,
   year    = 2017,
   note    = {\url{http://isa-afp.org/entries/FOL_Harrison.html},
             Formal proof development},
   ISSN    = {2150-914x},
 }
License: BSD License

\ No newline at end of file diff --git a/web/entries/FOL_Seq_Calc1.html b/web/entries/FOL_Seq_Calc1.html --- a/web/entries/FOL_Seq_Calc1.html +++ b/web/entries/FOL_Seq_Calc1.html @@ -1,192 +1,192 @@ A Sequent Calculus for First-Order Logic - Archive of Formal Proofs

 

 

 

 

 

 

A Sequent Calculus for First-Order Logic

 

Title: A Sequent Calculus for First-Order Logic
Author: - Asta Halkjær From + Asta Halkjær From
Contributors: Alexander Birch Jensen, Anders Schlichtkrull and Jørgen Villadsen
Submission date: 2019-07-18
Abstract: This work formalizes soundness and completeness of a one-sided sequent calculus for first-order logic. The completeness is shown via a translation from a complete semantic tableau calculus, the proof of which is based on the First-Order Logic According to Fitting theory. The calculi and proof techniques are taken from Ben-Ari's Mathematical Logic for Computer Science.
BibTeX:
@article{FOL_Seq_Calc1-AFP,
   author  = {Asta Halkjær From},
   title   = {A Sequent Calculus for First-Order Logic},
   journal = {Archive of Formal Proofs},
   month   = jul,
   year    = 2019,
   note    = {\url{http://isa-afp.org/entries/FOL_Seq_Calc1.html},
             Formal proof development},
   ISSN    = {2150-914x},
 }
License: BSD License
Depends on: FOL-Fitting

\ No newline at end of file diff --git a/web/entries/Functional_Ordered_Resolution_Prover.html b/web/entries/Functional_Ordered_Resolution_Prover.html --- a/web/entries/Functional_Ordered_Resolution_Prover.html +++ b/web/entries/Functional_Ordered_Resolution_Prover.html @@ -1,199 +1,199 @@ A Verified Functional Implementation of Bachmair and Ganzinger's Ordered Resolution Prover - Archive of Formal Proofs

 

 

 

 

 

 

A Verified Functional Implementation of Bachmair and Ganzinger's Ordered Resolution Prover

 

Title: A Verified Functional Implementation of Bachmair and Ganzinger's Ordered Resolution Prover
Authors: - Anders Schlichtkrull (andschl /at/ dtu /dot/ dk), + Anders Schlichtkrull, Jasmin Christian Blanchette (j /dot/ c /dot/ blanchette /at/ vu /dot/ nl) and Dmitriy Traytel
Submission date: 2018-11-23
Abstract: This Isabelle/HOL formalization refines the abstract ordered resolution prover presented in Section 4.3 of Bachmair and Ganzinger's "Resolution Theorem Proving" chapter in the Handbook of Automated Reasoning. The result is a functional implementation of a first-order prover.
BibTeX:
@article{Functional_Ordered_Resolution_Prover-AFP,
   author  = {Anders Schlichtkrull and Jasmin Christian Blanchette and Dmitriy Traytel},
   title   = {A Verified Functional Implementation of Bachmair and Ganzinger's Ordered Resolution Prover},
   journal = {Archive of Formal Proofs},
   month   = nov,
   year    = 2018,
   note    = {\url{http://isa-afp.org/entries/Functional_Ordered_Resolution_Prover.html},
             Formal proof development},
   ISSN    = {2150-914x},
 }
License: BSD License
Depends on: First_Order_Terms, Nested_Multisets_Ordinals, Open_Induction, Ordered_Resolution_Prover, Polynomial_Factorization

\ No newline at end of file diff --git a/web/entries/Furstenberg_Topology.html b/web/entries/Furstenberg_Topology.html new file mode 100644 --- /dev/null +++ b/web/entries/Furstenberg_Topology.html @@ -0,0 +1,191 @@ + + + + +Furstenberg's topology and his proof of the infinitude of primes - Archive of Formal Proofs + + + + + + + + + + + + + + + + + + + + + +
+

 

+ + + +

 

+

 

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

 

+

 

+
+
+

 

+

Furstenberg's + + topology + + and + + his + + proof + + of + + the + + infinitude + + of + + primes + +

+

 

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Title:Furstenberg's topology and his proof of the infinitude of primes
+ Author: + + Manuel Eberl +
Submission date:2020-03-22
Abstract: +

This article gives a formal version of Furstenberg's +topological proof of the infinitude of primes. He defines a topology +on the integers based on arithmetic progressions (or, equivalently, +residue classes). Using some fairly obvious properties of this +topology, the infinitude of primes is then easily obtained.

+

Apart from this, this topology is also fairly `nice' in +general: it is second countable, metrizable, and perfect. All of these +(well-known) facts are formally proven, including an explicit metric +for the topology given by Zulfeqarr.

BibTeX: +
@article{Furstenberg_Topology-AFP,
+  author  = {Manuel Eberl},
+  title   = {Furstenberg's topology and his proof of the infinitude of primes},
+  journal = {Archive of Formal Proofs},
+  month   = mar,
+  year    = 2020,
+  note    = {\url{http://isa-afp.org/entries/Furstenberg_Topology.html},
+            Formal proof development},
+  ISSN    = {2150-914x},
+}
+
License:BSD License
+ +

+ + + + + + + + + + + + + + + + + + +
+
+ + + + + + \ No newline at end of file diff --git a/web/entries/Goodstein_Lambda.html b/web/entries/Goodstein_Lambda.html new file mode 100644 --- /dev/null +++ b/web/entries/Goodstein_Lambda.html @@ -0,0 +1,181 @@ + + + + +Implementing the Goodstein Function in λ-Calculus - Archive of Formal Proofs + + + + + + + + + + + + + + + + + + + + + +
+

 

+ + + +

 

+

 

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

 

+

 

+
+
+

 

+

Implementing + + the + + Goodstein + + Function + + in + + &lambda;-Calculus + +

+

 

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Title:Implementing the Goodstein Function in λ-Calculus
+ Author: + + Bertram Felgenhauer (int-e /at/ gmx /dot/ de) +
Submission date:2020-02-21
Abstract: +In this formalization, we develop an implementation of the Goodstein +function G in plain λ-calculus, linked to a concise, self-contained +specification. The implementation works on a Church-encoded +representation of countable ordinals. The initial conversion to +hereditary base 2 is not covered, but the material is sufficient to +compute the particular value G(16), and easily extends to other fixed +arguments.
BibTeX: +
@article{Goodstein_Lambda-AFP,
+  author  = {Bertram Felgenhauer},
+  title   = {Implementing the Goodstein Function in λ-Calculus},
+  journal = {Archive of Formal Proofs},
+  month   = feb,
+  year    = 2020,
+  note    = {\url{http://isa-afp.org/entries/Goodstein_Lambda.html},
+            Formal proof development},
+  ISSN    = {2150-914x},
+}
+
License:BSD License
+ +

+ + + + + + + + + + + + + + + + + + +
+
+ + + + + + \ No newline at end of file diff --git a/web/entries/Hello_World.html b/web/entries/Hello_World.html new file mode 100644 --- /dev/null +++ b/web/entries/Hello_World.html @@ -0,0 +1,173 @@ + + + + +Hello World - Archive of Formal Proofs + + + + + + + + + + + + + + + + + + + + + +
+

 

+ + + +

 

+

 

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

 

+

 

+
+
+

 

+

Hello + + World + +

+

 

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Title:Hello World
+ Authors: + + Cornelius Diekmann and + Lars Hupel +
Submission date:2020-03-07
Abstract: +In this article, we present a formalization of the well-known +"Hello, World!" code, including a formal framework for +reasoning about IO. Our model is inspired by the handling of IO in +Haskell. We start by formalizing the 🌍 and embrace the IO monad +afterwards. Then we present a sample main :: IO (), followed by its +proof of correctness.
BibTeX: +
@article{Hello_World-AFP,
+  author  = {Cornelius Diekmann and Lars Hupel},
+  title   = {Hello World},
+  journal = {Archive of Formal Proofs},
+  month   = mar,
+  year    = 2020,
+  note    = {\url{http://isa-afp.org/entries/Hello_World.html},
+            Formal proof development},
+  ISSN    = {2150-914x},
+}
+
License:BSD License
+ +

+ + + + + + + + + + + + + + + + + + +
+
+ + + + + + \ No newline at end of file diff --git a/web/entries/Hybrid_Logic.html b/web/entries/Hybrid_Logic.html --- a/web/entries/Hybrid_Logic.html +++ b/web/entries/Hybrid_Logic.html @@ -1,191 +1,195 @@ Formalizing a Seligman-Style Tableau System for Hybrid Logic - Archive of Formal Proofs

 

 

 

 

 

 

Formalizing a Seligman-Style Tableau System for Hybrid Logic

 

+witnessing diamonds that are not already witnessed, and show that +the unrestricted rules are admissible. Similarly, I start from simpler +versions of the @-rules and show the general ones admissible. Finally, +the GoTo rule is restricted using a notion of coins such that each +application consumes a coin and coins are earned through applications of +the remaining rules. I show that if a branch can be closed then it can +be closed starting from a single coin. These restrictions are imposed +to rule out some means of nontermination.
Title: Formalizing a Seligman-Style Tableau System for Hybrid Logic
Author: - Asta Halkjær From + Asta Halkjær From
Submission date: 2019-12-20
Abstract: -This work is a formalization of soundness and completeness proofs for -a Seligman-style tableau system for hybrid logic. The completeness -result is obtained via a synthetic approach using maximally consistent -sets of tableau blocks. The formalization differs from the cited work -in a few ways. First, to avoid the need to backtrack in the -construction of a tableau, the formalized system has no unnamed +This work is a formalization of soundness and completeness proofs +for a Seligman-style tableau system for hybrid logic. The completeness +result is obtained via a synthetic approach using maximally +consistent sets of tableau blocks. The formalization differs from +the cited work in a few ways. First, to avoid the need to backtrack in +the construction of a tableau, the formalized system has no unnamed initial segment, and therefore no Name rule. Second, I show that the -full Bridge rule is derivable in the system. Third, I start from rules +full Bridge rule is admissible in the system. Third, I start from rules restricted to only extend the branch with new formulas, including only -witnessing diamonds that are not already witnessed, and show that the -unrestricted rules are derivable. Similarly, I start from simpler -versions of the @-rules and derive the general ones. These -restrictions are imposed to rule out some means of nontermination.
BibTeX:
@article{Hybrid_Logic-AFP,
   author  = {Asta Halkjær From},
   title   = {Formalizing a Seligman-Style Tableau System for Hybrid Logic},
   journal = {Archive of Formal Proofs},
   month   = dec,
   year    = 2019,
   note    = {\url{http://isa-afp.org/entries/Hybrid_Logic.html},
             Formal proof development},
   ISSN    = {2150-914x},
 }
License: BSD License

\ No newline at end of file diff --git a/web/entries/Minsky_Machines.html b/web/entries/Minsky_Machines.html --- a/web/entries/Minsky_Machines.html +++ b/web/entries/Minsky_Machines.html @@ -1,193 +1,193 @@ Minsky Machines - Archive of Formal Proofs

 

 

 

 

 

 

Minsky Machines

 

Title: Minsky Machines
Author: - Bertram Felgenhauer + Bertram Felgenhauer (int-e /at/ gmx /dot/ de)
Submission date: 2018-08-14
Abstract:

We formalize undecidablity results for Minsky machines. To this end, we also formalize recursive inseparability.

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.

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.

We do not prove that recursive functions can simulate Minsky machines.

BibTeX:
@article{Minsky_Machines-AFP,
   author  = {Bertram Felgenhauer},
   title   = {Minsky Machines},
   journal = {Archive of Formal Proofs},
   month   = aug,
   year    = 2018,
   note    = {\url{http://isa-afp.org/entries/Minsky_Machines.html},
             Formal proof development},
   ISSN    = {2150-914x},
 }
License: BSD License
Depends on: Abstract-Rewriting, Recursion-Theory-I

\ No newline at end of file diff --git a/web/entries/MonoidalCategory.html b/web/entries/MonoidalCategory.html --- a/web/entries/MonoidalCategory.html +++ b/web/entries/MonoidalCategory.html @@ -1,212 +1,215 @@ Monoidal Categories - Archive of Formal Proofs

 

 

 

 

 

 

Monoidal Categories

 

+(revision 8318366d4575)
+[2020-02-15]: +Cosmetic improvements. +(revision a51840d36867)
Title: Monoidal Categories
Author: Eugene W. Stark (stark /at/ cs /dot/ stonybrook /dot/ edu)
Submission date: 2017-05-04
Abstract: Building on the formalization of basic category theory set out in the author's previous AFP article, the present article formalizes some basic aspects of the theory of monoidal categories. Among the notions defined here are monoidal category, monoidal functor, and equivalence of monoidal categories. The main theorems formalized are MacLane's coherence theorem and the constructions of the free monoidal category and free strict monoidal category generated by a given category. The coherence theorem is proved syntactically, using a structurally recursive approach to reduction of terms that might have some novel aspects. We also give proofs of some results given by Etingof et al, which may prove useful in a formal setting. In particular, we show that the left and right unitors need not be taken as given data in the definition of monoidal category, nor does the definition of monoidal functor need to take as given a specific isomorphism expressing the preservation of the unit object. Our definitions of monoidal category and monoidal functor are stated so as to take advantage of the economy afforded by these facts.
Change history: [2017-05-18]: Integrated material from MonoidalCategory/Category3Adapter into Category3/ and deleted adapter. (revision 015543cdd069)
[2018-05-29]: Modifications required due to 'Category3' changes. Introduced notation for "in hom". -(revision 8318366d4575)
BibTeX:
@article{MonoidalCategory-AFP,
   author  = {Eugene W. Stark},
   title   = {Monoidal Categories},
   journal = {Archive of Formal Proofs},
   month   = may,
   year    = 2017,
   note    = {\url{http://isa-afp.org/entries/MonoidalCategory.html},
             Formal proof development},
   ISSN    = {2150-914x},
 }
License: BSD License
Depends on: Category3
Used by: Bicategory

\ No newline at end of file diff --git a/web/entries/Optics.html b/web/entries/Optics.html --- a/web/entries/Optics.html +++ b/web/entries/Optics.html @@ -1,193 +1,203 @@ Optics - Archive of Formal Proofs

 

 

 

 

 

 

Optics

 

+ + + +
Title: Optics
Authors: Simon Foster and Frank Zeyda
Submission date: 2017-05-25
Abstract: Lenses provide an abstract interface for manipulating data types through spatially-separated views. They are defined abstractly in terms of two functions, get, the return a value from the source type, and put 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.
Change history:[2020-03-02]: +Added partial bijective and symmetric lenses. +Improved alphabet command generating additional lenses and results. +Several additional lens relations, including observational equivalence. +Additional theorems throughout. +Adaptations for Isabelle 2020. +(revision 44e2e5c)
BibTeX:
@article{Optics-AFP,
   author  = {Simon Foster and Frank Zeyda},
   title   = {Optics},
   journal = {Archive of Formal Proofs},
   month   = may,
   year    = 2017,
   note    = {\url{http://isa-afp.org/entries/Optics.html},
             Formal proof development},
   ISSN    = {2150-914x},
 }
License: BSD License

\ No newline at end of file diff --git a/web/entries/Ordered_Resolution_Prover.html b/web/entries/Ordered_Resolution_Prover.html --- a/web/entries/Ordered_Resolution_Prover.html +++ b/web/entries/Ordered_Resolution_Prover.html @@ -1,203 +1,203 @@ Formalization of Bachmair and Ganzinger's Ordered Resolution Prover - Archive of Formal Proofs

 

 

 

 

 

 

Formalization of Bachmair and Ganzinger's Ordered Resolution Prover

 

Title: Formalization of Bachmair and Ganzinger's Ordered Resolution Prover
Authors: - Anders Schlichtkrull (andschl /at/ dtu /dot/ dk), + Anders Schlichtkrull, Jasmin Christian Blanchette (j /dot/ c /dot/ blanchette /at/ vu /dot/ nl), Dmitriy Traytel and Uwe Waldmann (uwe /at/ mpi-inf /dot/ mpg /dot/ de)
Submission date: 2018-01-18
Abstract: This Isabelle/HOL formalization covers Sections 2 to 4 of Bachmair and Ganzinger's "Resolution Theorem Proving" chapter in the Handbook of Automated Reasoning. 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.
BibTeX:
@article{Ordered_Resolution_Prover-AFP,
   author  = {Anders Schlichtkrull and Jasmin Christian Blanchette and Dmitriy Traytel and Uwe Waldmann},
   title   = {Formalization of Bachmair and Ganzinger's Ordered Resolution Prover},
   journal = {Archive of Formal Proofs},
   month   = jan,
   year    = 2018,
   note    = {\url{http://isa-afp.org/entries/Ordered_Resolution_Prover.html},
             Formal proof development},
   ISSN    = {2150-914x},
 }
License: BSD License
Depends on: Coinductive, Nested_Multisets_Ordinals
Used by: Functional_Ordered_Resolution_Prover

\ No newline at end of file diff --git a/web/entries/Paraconsistency.html b/web/entries/Paraconsistency.html --- a/web/entries/Paraconsistency.html +++ b/web/entries/Paraconsistency.html @@ -1,201 +1,201 @@ Paraconsistency - Archive of Formal Proofs

 

 

 

 

 

 

Paraconsistency

 

Title: Paraconsistency
Authors: - Anders Schlichtkrull (andschl /at/ dtu /dot/ dk) and + Anders Schlichtkrull and Jørgen Villadsen
Submission date: 2016-12-07
Abstract: 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.
BibTeX:
@article{Paraconsistency-AFP,
   author  = {Anders Schlichtkrull and Jørgen Villadsen},
   title   = {Paraconsistency},
   journal = {Archive of Formal Proofs},
   month   = dec,
   year    = 2016,
   note    = {\url{http://isa-afp.org/entries/Paraconsistency.html},
             Formal proof development},
   ISSN    = {2150-914x},
 }
License: BSD License

\ No newline at end of file diff --git a/web/entries/Relational-Incorrectness-Logic.html b/web/entries/Relational-Incorrectness-Logic.html new file mode 100644 --- /dev/null +++ b/web/entries/Relational-Incorrectness-Logic.html @@ -0,0 +1,182 @@ + + + + +An Under-Approximate Relational Logic - Archive of Formal Proofs + + + + + + + + + + + + + + + + + + + + + +
+

 

+ + + +

 

+

 

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

 

+

 

+
+
+

 

+

An + + Under-Approximate + + Relational + + Logic + +

+

 

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Title:An Under-Approximate Relational Logic
+ Author: + + Toby Murray +
Submission date:2020-03-12
Abstract: +Recently, authors have proposed under-approximate logics for reasoning +about programs. So far, all such logics have been confined to +reasoning about individual program behaviours. Yet there exist many +over-approximate relational logics for reasoning about pairs of +programs and relating their behaviours. We present the first +under-approximate relational logic, for the simple imperative language +IMP. We prove our logic is both sound and complete. Additionally, we +show how reasoning in this logic can be decomposed into non-relational +reasoning in an under-approximate Hoare logic, mirroring Beringer’s +result for over-approximate relational logics. We illustrate the +application of our logic on some small examples in which we provably +demonstrate the presence of insecurity.
BibTeX: +
@article{Relational-Incorrectness-Logic-AFP,
+  author  = {Toby Murray},
+  title   = {An Under-Approximate Relational Logic},
+  journal = {Archive of Formal Proofs},
+  month   = mar,
+  year    = 2020,
+  note    = {\url{http://isa-afp.org/entries/Relational-Incorrectness-Logic.html},
+            Formal proof development},
+  ISSN    = {2150-914x},
+}
+
License:BSD License
+ +

+ + + + + + + + + + + + + + + + + + +
+
+ + + + + + \ No newline at end of file diff --git a/web/entries/Resolution_FOL.html b/web/entries/Resolution_FOL.html --- a/web/entries/Resolution_FOL.html +++ b/web/entries/Resolution_FOL.html @@ -1,236 +1,236 @@ The Resolution Calculus for First-Order Logic - Archive of Formal Proofs

 

 

 

 

 

 

The Resolution Calculus for First-Order Logic

 

Title: The Resolution Calculus for First-Order Logic
Author: - Anders Schlichtkrull (andschl /at/ dtu /dot/ dk) + Anders Schlichtkrull
Submission date: 2016-06-30
Abstract: This theory is a formalization of the resolution calculus for first-order logic. It is proven sound and complete. The soundness proof uses the substitution lemma, which shows a correspondence between substitutions and updates to an environment. The completeness proof uses semantic trees, i.e. trees whose paths are partial Herbrand interpretations. It employs Herbrand's theorem in a formulation which states that an unsatisfiable set of clauses has a finite closed semantic tree. It also uses the lifting lemma which lifts resolution derivation steps from the ground world up to the first-order world. The theory is presented in a paper in the Journal of Automated Reasoning [Sch18] which extends a paper presented at the International Conference on Interactive Theorem Proving [Sch16]. An earlier version was presented in an MSc thesis [Sch15]. The formalization mostly follows textbooks by Ben-Ari [BA12], Chang and Lee [CL73], and Leitsch [Lei97]. The theory is part of the IsaFoL project [IsaFoL].

[Sch18] Anders Schlichtkrull. "Formalization of the Resolution Calculus for First-Order Logic". Journal of Automated Reasoning, 2018.
[Sch16] Anders Schlichtkrull. "Formalization of the Resolution Calculus for First-Order Logic". In: ITP 2016. Vol. 9807. LNCS. Springer, 2016.
[Sch15] Anders Schlichtkrull. "Formalization of Resolution Calculus in Isabelle". https://people.compute.dtu.dk/andschl/Thesis.pdf. MSc thesis. Technical University of Denmark, 2015.
[BA12] Mordechai Ben-Ari. Mathematical Logic for Computer Science. 3rd. Springer, 2012.
[CL73] Chin-Liang Chang and Richard Char-Tung Lee. Symbolic Logic and Mechanical Theorem Proving. 1st. Academic Press, Inc., 1973.
[Lei97] Alexander Leitsch. The Resolution Calculus. Texts in theoretical computer science. Springer, 1997.
[IsaFoL] IsaFoL authors. IsaFoL: Isabelle Formalization of Logic. https://bitbucket.org/jasmin_blanchette/isafol.

Change history: [2018-01-24]: added several new versions of the soundness and completeness theorems as described in the paper [Sch18].
[2018-03-20]: added a concrete instance of the unification and completeness theorems using the First-Order Terms AFP-entry from IsaFoR as described in the papers [Sch16] and [Sch18].
BibTeX:
@article{Resolution_FOL-AFP,
   author  = {Anders Schlichtkrull},
   title   = {The Resolution Calculus for First-Order Logic},
   journal = {Archive of Formal Proofs},
   month   = jun,
   year    = 2016,
   note    = {\url{http://isa-afp.org/entries/Resolution_FOL.html},
             Formal proof development},
   ISSN    = {2150-914x},
 }
License: BSD License
Depends on: First_Order_Terms

\ No newline at end of file diff --git a/web/entries/Rewriting_Z.html b/web/entries/Rewriting_Z.html --- a/web/entries/Rewriting_Z.html +++ b/web/entries/Rewriting_Z.html @@ -1,199 +1,199 @@ The Z Property - Archive of Formal Proofs

 

 

 

 

 

 

The Z Property

 

Title: The Z Property
Authors: - Bertram Felgenhauer, + Bertram Felgenhauer (int-e /at/ gmx /dot/ de), Julian Nagele, Vincent van Oostrom and Christian Sternagel (c /dot/ sternagel /at/ gmail /dot/ com)
Submission date: 2016-06-30
Abstract: We formalize the Z property introduced by Dehornoy and van Oostrom. First we show that for any abstract rewrite system, Z implies confluence. Then we give two examples of proofs using Z: confluence of lambda-calculus with respect to beta-reduction and confluence of combinatory logic.
BibTeX:
@article{Rewriting_Z-AFP,
   author  = {Bertram Felgenhauer and Julian Nagele and Vincent van Oostrom and Christian Sternagel},
   title   = {The Z Property},
   journal = {Archive of Formal Proofs},
   month   = jun,
   year    = 2016,
   note    = {\url{http://isa-afp.org/entries/Rewriting_Z.html},
             Formal proof development},
   ISSN    = {2150-914x},
 }
License: BSD License
Depends on: Abstract-Rewriting, Nominal2

\ No newline at end of file diff --git a/web/entries/VeriComp.html b/web/entries/VeriComp.html new file mode 100644 --- /dev/null +++ b/web/entries/VeriComp.html @@ -0,0 +1,181 @@ + + + + +A Generic Framework for Verified Compilers - Archive of Formal Proofs + + + + + + + + + + + + + + + + + + + + + +
+

 

+ + + +

 

+

 

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

 

+

 

+
+
+

 

+

A + + Generic + + Framework + + for + + Verified + + Compilers + +

+

 

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Title:A Generic Framework for Verified Compilers
+ Author: + + Martin Desharnais +
Submission date:2020-02-10
Abstract: +This is a generic framework for formalizing compiler transformations. +It leverages Isabelle/HOL’s locales to abstract over concrete +languages and transformations. It states common definitions for +language semantics, program behaviours, forward and backward +simulations, and compilers. We provide generic operations, such as +simulation and compiler composition, and prove general (partial) +correctness theorems, resulting in reusable proof components.
BibTeX: +
@article{VeriComp-AFP,
+  author  = {Martin Desharnais},
+  title   = {A Generic Framework for Verified Compilers},
+  journal = {Archive of Formal Proofs},
+  month   = feb,
+  year    = 2020,
+  note    = {\url{http://isa-afp.org/entries/VeriComp.html},
+            Formal proof development},
+  ISSN    = {2150-914x},
+}
+
License:BSD License
+ +

+ + + + + + + + + + + + + + + + + + +
+
+ + + + + + \ No newline at end of file diff --git a/web/entries/WOOT_Strong_Eventual_Consistency.html b/web/entries/WOOT_Strong_Eventual_Consistency.html new file mode 100644 --- /dev/null +++ b/web/entries/WOOT_Strong_Eventual_Consistency.html @@ -0,0 +1,190 @@ + + + + +Strong Eventual Consistency of the Collaborative Editing Framework WOOT - Archive of Formal Proofs + + + + + + + + + + + + + + + + + + + + + +
+

 

+ + + +

 

+

 

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

 

+

 

+
+
+

 

+

Strong + + Eventual + + Consistency + + of + + the + + Collaborative + + Editing + + Framework + + WOOT + +

+

 

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Title:Strong Eventual Consistency of the Collaborative Editing Framework WOOT
+ Authors: + + Emin Karayel and + Edgar Gonzàlez (edgargip /at/ google /dot/ com) +
Submission date:2020-03-25
Abstract: +Commutative Replicated Data Types (CRDTs) are a promising new class of +data structures for large-scale shared mutable content in applications +that only require eventual consistency. The WithOut Operational +Transforms (WOOT) framework is a CRDT for collaborative text editing +introduced by Oster et al. (CSCW 2006) for which the eventual +consistency property was verified only for a bounded model to date. We +contribute a formal proof for WOOTs strong eventual consistency.
BibTeX: +
@article{WOOT_Strong_Eventual_Consistency-AFP,
+  author  = {Emin Karayel and Edgar Gonzàlez},
+  title   = {Strong Eventual Consistency of the Collaborative Editing Framework WOOT},
+  journal = {Archive of Formal Proofs},
+  month   = mar,
+  year    = 2020,
+  note    = {\url{http://isa-afp.org/entries/WOOT_Strong_Eventual_Consistency.html},
+            Formal proof development},
+  ISSN    = {2150-914x},
+}
+
License:BSD License
Depends on:Certification_Monads, Datatype_Order_Generator
+ +

+ + + + + + + + + + + + + + + + + + +
+
+ + + + + + \ No newline at end of file diff --git a/web/index.html b/web/index.html --- a/web/index.html +++ b/web/index.html @@ -1,4771 +1,4821 @@ Archive of Formal Proofs

 

 

 

 

 

 

Archive of Formal Proofs

 

The Archive of Formal Proofs is a collection of proof libraries, examples, and larger scientific developments, mechanically checked in the theorem prover Isabelle. It is organized in the way of a scientific journal, is indexed by dblp and has an ISSN: 2150-914x. Submissions are refereed. The preferred citation style is available [here]. We encourage companion AFP submissions to conference and journal publications.

A development version of the archive is available as well.

 

 

+ + + + + + + + + + + + + + + + + +
2020
+ 2020-03-25: Strong Eventual Consistency of the Collaborative Editing Framework WOOT +
+ Authors: + Emin Karayel + and Edgar Gonzàlez +
+ 2020-03-22: Furstenberg's topology and his proof of the infinitude of primes +
+ Author: + Manuel Eberl +
+ 2020-03-12: An Under-Approximate Relational Logic +
+ Author: + Toby Murray +
+ 2020-03-07: Hello World +
+ Authors: + Cornelius Diekmann + and Lars Hupel +
+ 2020-02-21: Implementing the Goodstein Function in λ-Calculus +
+ Author: + Bertram Felgenhauer +
+ 2020-02-10: A Generic Framework for Verified Compilers +
+ Author: + Martin Desharnais +
2020-02-01: Arithmetic progressions and relative primes
Author: José Manuel Rodríguez Caballero
2020-01-31: A Hierarchy of Algebras for Boolean Subsets
Authors: Walter Guttmann and Bernhard Möller
2020-01-17: Mersenne primes and the Lucas–Lehmer test
Author: Manuel Eberl
2020-01-16: Verified Approximation Algorithms
Authors: Robin Eßmann, Tobias Nipkow and Simon Robillard
2020-01-13: Closest Pair of Points Algorithms
Authors: Martin Rau and Tobias Nipkow
2020-01-09: Skip Lists
Authors: Max W. Haslbeck and Manuel Eberl
2020-01-06: Bicategories
Author: Eugene W. Stark

 

2019
2019-12-27: The Irrationality of ζ(3)
Author: Manuel Eberl
2019-12-20: Formalizing a Seligman-Style Tableau System for Hybrid Logic
Author: - Asta Halkjær From + Asta Halkjær From
2019-12-18: The Poincaré-Bendixson Theorem
Authors: Fabian Immler and Yong Kiam Tan
2019-12-16: Poincaré Disc Model
Authors: Danijela Simić, Filip Marić and Pierre Boutry
2019-12-16: Complex Geometry
Authors: Filip Marić and Danijela Simić
2019-12-10: Gauss Sums and the Pólya–Vinogradov Inequality
Authors: Rodrigo Raya and Manuel Eberl
2019-12-04: An Efficient Generalization of Counting Sort for Large, possibly Infinite Key Ranges
Author: Pasquale Noce
2019-11-27: Interval Arithmetic on 32-bit Words
Author: Brandon Bohrer
2019-10-24: Zermelo Fraenkel Set Theory in Higher-Order Logic
Author: Lawrence C. Paulson
2019-10-22: Isabelle/C
Authors: Frédéric Tuong and Burkhart Wolff
2019-10-16: VerifyThis 2019 -- Polished Isabelle Solutions
Authors: Peter Lammich and Simon Wimmer
2019-10-08: Aristotle's Assertoric Syllogistic
Author: Angeliki Koutsoukou-Argyraki
2019-10-07: Sigma Protocols and Commitment Schemes
Authors: David Butler and Andreas Lochbihler
2019-10-04: Clean - An Abstract Imperative Programming Language and its Theory
Authors: Frédéric Tuong and Burkhart Wolff
2019-09-16: Formalization of Multiway-Join Algorithms
Author: Thibault Dardinier
2019-09-10: Verification Components for Hybrid Systems
Author: Jonathan Julian Huerta y Munive
2019-09-06: Fourier Series
Author: Lawrence C Paulson
2019-08-30: A Case Study in Basic Algebra
Author: Clemens Ballarin
2019-08-16: Formalisation of an Adaptive State Counting Algorithm
Author: Robert Sachtleben
2019-08-14: Laplace Transform
Author: Fabian Immler
2019-08-06: Linear Programming
Authors: Julian Parsert and Cezary Kaliszyk
2019-08-06: Communicating Concurrent Kleene Algebra for Distributed Systems Specification
Authors: Maxime Buyse and Jason Jaskolka
2019-08-05: Selected Problems from the International Mathematical Olympiad 2019
Author: Manuel Eberl
2019-08-01: Stellar Quorum Systems
Author: Giuliano Losa
2019-07-30: A Formal Development of a Polychronous Polytimed Coordination Language
Authors: Hai Nguyen Van, Frédéric Boulanger and Burkhart Wolff
2019-07-27: Szpilrajn Extension Theorem
Author: Peter Zeller
2019-07-18: A Sequent Calculus for First-Order Logic
Author: - Asta Halkjær From + Asta Halkjær From
2019-07-08: A Verified Code Generator from Isabelle/HOL to CakeML
Author: Lars Hupel
2019-07-04: Formalization of a Monitoring Algorithm for Metric First-Order Temporal Logic
Authors: Joshua Schneider and Dmitriy Traytel
2019-06-27: Complete Non-Orders and Fixed Points
Authors: Akihisa Yamada and Jérémy Dubut
2019-06-25: Priority Search Trees
Authors: Peter Lammich and Tobias Nipkow
2019-06-25: Purely Functional, Simple, and Efficient Implementation of Prim and Dijkstra
Authors: Peter Lammich and Tobias Nipkow
2019-06-21: Linear Inequalities
Authors: Ralph Bottesch, Alban Reynaud and René Thiemann
2019-06-16: Hilbert's Nullstellensatz
Author: Alexander Maletzky
2019-06-15: Gröbner Bases, Macaulay Matrices and Dubé's Degree Bounds
Author: Alexander Maletzky
2019-06-13: Binary Heaps for IMP2
Author: Simon Griebel
2019-06-03: Differential Game Logic
Author: André Platzer
2019-05-30: Multidimensional Binary Search Trees
Author: Martin Rau
2019-05-14: Formalization of Generic Authenticated Data Structures
Authors: Matthias Brun and Dmitriy Traytel
2019-05-09: Multi-Party Computation
Authors: David Aspinall and David Butler
2019-04-26: HOL-CSP Version 2.0
Authors: Safouan Taha, Lina Ye and Burkhart Wolff
2019-04-16: A Compositional and Unified Translation of LTL into ω-Automata
Authors: Benedikt Seidl and Salomon Sickert
2019-04-06: A General Theory of Syntax with Bindings
Authors: Lorenzo Gheri and Andrei Popescu
2019-03-27: The Transcendence of Certain Infinite Series
Authors: Angeliki Koutsoukou-Argyraki and Wenda Li
2019-03-24: Quantum Hoare Logic
Authors: Junyi Liu, Bohua Zhan, Shuling Wang, Shenggang Ying, Tao Liu, Yangjia Li, Mingsheng Ying and Naijun Zhan
2019-03-09: Safe OCL
Author: Denis Nikiforov
2019-02-21: Elementary Facts About the Distribution of Primes
Author: Manuel Eberl
2019-02-14: Kruskal's Algorithm for Minimum Spanning Forest
Authors: Maximilian P.L. Haslbeck, Peter Lammich and Julian Biendarra
2019-02-11: Probabilistic Primality Testing
Authors: Daniel Stüwe and Manuel Eberl
2019-02-08: Universal Turing Machine
Authors: Jian Xu, Xingyuan Zhang, Christian Urban and Sebastiaan J. C. Joosten
2019-02-01: Isabelle/UTP: Mechanised Theory Engineering for Unifying Theories of Programming
Authors: Simon Foster, Frank Zeyda, Yakoub Nemouchi, Pedro Ribeiro and Burkhart Wolff
2019-02-01: The Inversions of a List
Author: Manuel Eberl
2019-01-17: Farkas' Lemma and Motzkin's Transposition Theorem
Authors: Ralph Bottesch, Max W. Haslbeck and René Thiemann
2019-01-15: IMP2 – Simple Program Verification in Isabelle/HOL
Authors: Peter Lammich and Simon Wimmer
2019-01-15: An Algebra for Higher-Order Terms
Author: Lars Hupel
2019-01-07: A Reduction Theorem for Store Buffers
Authors: Ernie Cohen and Norbert Schirmer

 

2018
2018-12-26: A Formal Model of the Document Object Model
Authors: Achim D. Brucker and Michael Herzberg
2018-12-25: Formalization of Concurrent Revisions
Author: Roy Overbeek
2018-12-21: Verifying Imperative Programs using Auto2
Author: Bohua Zhan
2018-12-17: Constructive Cryptography in HOL
Authors: Andreas Lochbihler and S. Reza Sefidgar
2018-12-11: Transformer Semantics
Author: Georg Struth
2018-12-11: Quantales
Author: Georg Struth
2018-12-11: Properties of Orderings and Lattices
Author: Georg Struth
2018-11-23: Graph Saturation
Author: Sebastiaan J. C. Joosten
2018-11-23: A Verified Functional Implementation of Bachmair and Ganzinger's Ordered Resolution Prover
Authors: - Anders Schlichtkrull, + Anders Schlichtkrull, Jasmin Christian Blanchette and Dmitriy Traytel
2018-11-20: Auto2 Prover
Author: Bohua Zhan
2018-11-16: Matroids
Author: Jonas Keinholz
2018-11-06: Deriving generic class instances for datatypes
Authors: Jonas Rädle and Lars Hupel
2018-10-30: Formalisation and Evaluation of Alan Gewirth's Proof for the Principle of Generic Consistency in Isabelle/HOL
Authors: David Fuenmayor and Christoph Benzmüller
2018-10-29: Epistemic Logic
Author: - Asta Halkjær From + Asta Halkjær From
2018-10-22: Smooth Manifolds
Authors: Fabian Immler and Bohua Zhan
2018-10-19: Randomised Binary Search Trees
Author: Manuel Eberl
2018-10-19: Formalization of the Embedding Path Order for Lambda-Free Higher-Order Terms
Author: Alexander Bentkamp
2018-10-12: Upper Bounding Diameters of State Spaces of Factored Transition Systems
Authors: Friedrich Kurz and Mohammad Abdulaziz
2018-09-28: The Transcendence of π
Author: Manuel Eberl
2018-09-25: Symmetric Polynomials
Author: Manuel Eberl
2018-09-20: Signature-Based Gröbner Basis Algorithms
Author: Alexander Maletzky
2018-09-19: The Prime Number Theorem
Authors: Manuel Eberl and Lawrence C. Paulson
2018-09-15: Aggregation Algebras
Author: Walter Guttmann
2018-09-14: Octonions
Author: Angeliki Koutsoukou-Argyraki
2018-09-05: Quaternions
Author: Lawrence C. Paulson
2018-09-02: The Budan-Fourier Theorem and Counting Real Roots with Multiplicity
Author: Wenda Li
2018-08-24: An Incremental Simplex Algorithm with Unsatisfiable Core Generation
Authors: Filip Marić, Mirko Spasić and René Thiemann
2018-08-14: Minsky Machines
Author: Bertram Felgenhauer
2018-07-16: Pricing in discrete financial models
Author: Mnacho Echenim
2018-07-04: Von-Neumann-Morgenstern Utility Theorem
Authors: Julian Parsert and Cezary Kaliszyk
2018-06-23: Pell's Equation
Author: Manuel Eberl
2018-06-14: Projective Geometry
Author: Anthony Bordg
2018-06-14: The Localization of a Commutative Ring
Author: Anthony Bordg
2018-06-05: Partial Order Reduction
Author: Julian Brunner
2018-05-27: Optimal Binary Search Trees
Authors: Tobias Nipkow and Dániel Somogyi
2018-05-25: Hidden Markov Models
Author: Simon Wimmer
2018-05-24: Probabilistic Timed Automata
Authors: Simon Wimmer and Johannes Hölzl
2018-05-23: Irrational Rapidly Convergent Series
Authors: Angeliki Koutsoukou-Argyraki and Wenda Li
2018-05-23: Axiom Systems for Category Theory in Free Logic
Authors: Christoph Benzmüller and Dana Scott
2018-05-22: Monadification, Memoization and Dynamic Programming
Authors: Simon Wimmer, Shuwei Hu and Tobias Nipkow
2018-05-10: OpSets: Sequential Specifications for Replicated Datatypes
Authors: Martin Kleppmann, Victor B. F. Gomes, Dominic P. Mulligan and Alastair R. Beresford
2018-05-07: An Isabelle/HOL Formalization of the Modular Assembly Kit for Security Properties
Authors: Oliver Bračevac, Richard Gay, Sylvia Grewe, Heiko Mantel, Henning Sudbrock and Markus Tasch
2018-04-29: WebAssembly
Author: Conrad Watt
2018-04-27: VerifyThis 2018 - Polished Isabelle Solutions
Authors: Peter Lammich and Simon Wimmer
2018-04-24: Bounded Natural Functors with Covariance and Contravariance
Authors: Andreas Lochbihler and Joshua Schneider
2018-03-22: The Incompatibility of Fishburn-Strategyproofness and Pareto-Efficiency
Authors: Felix Brandt, Manuel Eberl, Christian Saile and Christian Stricker
2018-03-13: Weight-Balanced Trees
Authors: Tobias Nipkow and Stefan Dirix
2018-03-12: CakeML
Authors: Lars Hupel and Yu Zhang
2018-03-01: A Theory of Architectural Design Patterns
Author: Diego Marmsoler
2018-02-26: Hoare Logics for Time Bounds
Authors: Maximilian P. L. Haslbeck and Tobias Nipkow
2018-02-06: Treaps
Authors: Maximilian Haslbeck, Manuel Eberl and Tobias Nipkow
2018-02-06: A verified factorization algorithm for integer polynomials with polynomial complexity
Authors: Jose Divasón, Sebastiaan Joosten, René Thiemann and Akihisa Yamada
2018-02-06: First-Order Terms
Authors: Christian Sternagel and René Thiemann
2018-02-06: The Error Function
Author: Manuel Eberl
2018-02-02: A verified LLL algorithm
Authors: Ralph Bottesch, Jose Divasón, Maximilian Haslbeck, Sebastiaan Joosten, René Thiemann and Akihisa Yamada
2018-01-18: Formalization of Bachmair and Ganzinger's Ordered Resolution Prover
Authors: - Anders Schlichtkrull, + Anders Schlichtkrull, Jasmin Christian Blanchette, Dmitriy Traytel and Uwe Waldmann
2018-01-16: Gromov Hyperbolicity
Author: Sebastien Gouezel
2018-01-11: An Isabelle/HOL formalisation of Green's Theorem
Authors: Mohammad Abdulaziz and Lawrence C. Paulson
2018-01-08: Taylor Models
Authors: Christoph Traut and Fabian Immler

 

2017
2017-12-22: The Falling Factorial of a Sum
Author: Lukas Bulwahn
2017-12-21: The Median-of-Medians Selection Algorithm
Author: Manuel Eberl
2017-12-21: The Mason–Stothers Theorem
Author: Manuel Eberl
2017-12-21: Dirichlet L-Functions and Dirichlet's Theorem
Author: Manuel Eberl
2017-12-19: Operations on Bounded Natural Functors
Authors: Jasmin Christian Blanchette, Andrei Popescu and Dmitriy Traytel
2017-12-18: The string search algorithm by Knuth, Morris and Pratt
Authors: Fabian Hellauer and Peter Lammich
2017-11-22: Stochastic Matrices and the Perron-Frobenius Theorem
Author: René Thiemann
2017-11-09: The IMAP CmRDT
Authors: Tim Jungnickel, Lennart Oldenburg and Matthias Loibl
2017-11-06: Hybrid Multi-Lane Spatial Logic
Author: Sven Linker
2017-10-26: The Kuratowski Closure-Complement Theorem
Authors: Peter Gammie and Gianpaolo Gioiosa
2017-10-19: Transition Systems and Automata
Author: Julian Brunner
2017-10-19: Büchi Complementation
Author: Julian Brunner
2017-10-17: Evaluate Winding Numbers through Cauchy Indices
Author: Wenda Li
2017-10-17: Count the Number of Complex Roots
Author: Wenda Li
2017-10-14: Homogeneous Linear Diophantine Equations
Authors: Florian Messner, Julian Parsert, Jonas Schöpf and Christian Sternagel
2017-10-12: The Hurwitz and Riemann ζ Functions
Author: Manuel Eberl
2017-10-12: Linear Recurrences
Author: Manuel Eberl
2017-10-12: Dirichlet Series
Author: Manuel Eberl
2017-09-21: Computer-assisted Reconstruction and Assessment of E. J. Lowe's Modal Ontological Argument
Authors: David Fuenmayor and Christoph Benzmüller
2017-09-17: Representation and Partial Automation of the Principia Logico-Metaphysica in Isabelle/HOL
Author: Daniel Kirchner
2017-09-06: Anselm's God in Isabelle/HOL
Author: Ben Blumson
2017-09-01: Microeconomics and the First Welfare Theorem
Authors: Julian Parsert and Cezary Kaliszyk
2017-08-20: Root-Balanced Tree
Author: Tobias Nipkow
2017-08-20: Orbit-Stabiliser Theorem with Application to Rotational Symmetries
Author: Jonas Rädle
2017-08-16: The LambdaMu-calculus
Authors: Cristina Matache, Victor B. F. Gomes and Dominic P. Mulligan
2017-07-31: Stewart's Theorem and Apollonius' Theorem
Author: Lukas Bulwahn
2017-07-28: Dynamic Architectures
Author: Diego Marmsoler
2017-07-21: Declarative Semantics for Functional Languages
Author: Jeremy Siek
2017-07-15: HOLCF-Prelude
Authors: Joachim Breitner, Brian Huffman, Neil Mitchell and Christian Sternagel
2017-07-13: Minkowski's Theorem
Author: Manuel Eberl
2017-07-09: Verified Metatheory and Type Inference for a Name-Carrying Simply-Typed Lambda Calculus
Author: Michael Rawson
2017-07-07: A framework for establishing Strong Eventual Consistency for Conflict-free Replicated Datatypes
Authors: Victor B. F. Gomes, Martin Kleppmann, Dominic P. Mulligan and Alastair R. Beresford
2017-07-06: Stone-Kleene Relation Algebras
Author: Walter Guttmann
2017-06-21: Propositional Proof Systems
Authors: Julius Michaelis and Tobias Nipkow
2017-06-13: Partial Semigroups and Convolution Algebras
Authors: Brijesh Dongol, Victor B. F. Gomes, Ian J. Hayes and Georg Struth
2017-06-06: Buffon's Needle Problem
Author: Manuel Eberl
2017-06-01: Formalizing Push-Relabel Algorithms
Authors: Peter Lammich and S. Reza Sefidgar
2017-06-01: Flow Networks and the Min-Cut-Max-Flow Theorem
Authors: Peter Lammich and S. Reza Sefidgar
2017-05-25: Optics
Authors: Simon Foster and Frank Zeyda
2017-05-24: Developing Security Protocols by Refinement
Authors: Christoph Sprenger and Ivano Somaini
2017-05-24: Dictionary Construction
Author: Lars Hupel
2017-05-08: The Floyd-Warshall Algorithm for Shortest Paths
Authors: Simon Wimmer and Peter Lammich
2017-05-05: Probabilistic while loop
Author: Andreas Lochbihler
2017-05-05: Effect polymorphism in higher-order logic
Author: Andreas Lochbihler
2017-05-05: Monad normalisation
Authors: Joshua Schneider, Manuel Eberl and Andreas Lochbihler
2017-05-05: Game-based cryptography in HOL
Authors: Andreas Lochbihler, S. Reza Sefidgar and Bhargav Bhatt
2017-05-05: CryptHOL
Author: Andreas Lochbihler
2017-05-04: Monoidal Categories
Author: Eugene W. Stark
2017-05-01: Types, Tableaus and Gödel’s God in Isabelle/HOL
Authors: David Fuenmayor and Christoph Benzmüller
2017-04-28: Local Lexing
Author: Steven Obua
2017-04-19: Constructor Functions
Author: Lars Hupel
2017-04-18: Lazifying case constants
Author: Lars Hupel
2017-04-06: Subresultants
Authors: Sebastiaan Joosten, René Thiemann and Akihisa Yamada
2017-04-04: Expected Shape of Random Binary Search Trees
Author: Manuel Eberl
2017-03-15: The number of comparisons in QuickSort
Author: Manuel Eberl
2017-03-15: Lower bound on comparison-based sorting algorithms
Author: Manuel Eberl
2017-03-10: The Euler–MacLaurin Formula
Author: Manuel Eberl
2017-02-28: The Group Law for Elliptic Curves
Author: Stefan Berghofer
2017-02-26: Menger's Theorem
Author: Christoph Dittmann
2017-02-13: Differential Dynamic Logic
Author: Brandon Bohrer
2017-02-10: Abstract Soundness
Authors: Jasmin Christian Blanchette, Andrei Popescu and Dmitriy Traytel
2017-02-07: Stone Relation Algebras
Author: Walter Guttmann
2017-01-31: Refining Authenticated Key Agreement with Strong Adversaries
Authors: Joseph Lallemand and Christoph Sprenger
2017-01-24: Bernoulli Numbers
Authors: Lukas Bulwahn and Manuel Eberl
2017-01-17: Minimal Static Single Assignment Form
Authors: Max Wagner and Denis Lohner
2017-01-17: Bertrand's postulate
Authors: Julian Biendarra and Manuel Eberl
2017-01-12: The Transcendence of e
Author: Manuel Eberl
2017-01-08: Formal Network Models and Their Application to Firewall Policies
Authors: Achim D. Brucker, Lukas Brügger and Burkhart Wolff
2017-01-03: Verification of a Diffie-Hellman Password-based Authentication Protocol by Extending the Inductive Method
Author: Pasquale Noce
2017-01-01: First-Order Logic According to Harrison
Authors: Alexander Birch Jensen, - Anders Schlichtkrull + Anders Schlichtkrull and Jørgen Villadsen

 

2016
2016-12-30: Concurrent Refinement Algebra and Rely Quotients
Authors: Julian Fell, Ian J. Hayes and Andrius Velykis
2016-12-29: The Twelvefold Way
Author: Lukas Bulwahn
2016-12-20: Proof Strategy Language
Author: Yutaka Nagashima
2016-12-07: Paraconsistency
Authors: - Anders Schlichtkrull + Anders Schlichtkrull and Jørgen Villadsen
2016-11-29: COMPLX: A Verification Framework for Concurrent Imperative Programs
Authors: Sidney Amani, June Andronick, Maksym Bortin, Corey Lewis, Christine Rizkallah and Joseph Tuong
2016-11-23: Abstract Interpretation of Annotated Commands
Author: Tobias Nipkow
2016-11-16: Separata: Isabelle tactics for Separation Algebra
Authors: Zhe Hou, David Sanan, Alwen Tiu, Rajeev Gore and Ranald Clouston
2016-11-12: Formalization of Nested Multisets, Hereditary Multisets, and Syntactic Ordinals
Authors: Jasmin Christian Blanchette, Mathias Fleury and Dmitriy Traytel
2016-11-12: Formalization of Knuth–Bendix Orders for Lambda-Free Higher-Order Terms
Authors: Heiko Becker, Jasmin Christian Blanchette, Uwe Waldmann and Daniel Wand
2016-11-10: Expressiveness of Deep Learning
Author: Alexander Bentkamp
2016-10-25: Modal Logics for Nominal Transition Systems
Authors: Tjark Weber, Lars-Henrik Eriksson, Joachim Parrow, Johannes Borgström and Ramunas Gutkovas
2016-10-24: Stable Matching
Author: Peter Gammie
2016-10-21: LOFT — Verified Migration of Linux Firewalls to SDN
Authors: Julius Michaelis and Cornelius Diekmann
2016-10-19: Source Coding Theorem
Authors: Quentin Hibon and Lawrence C. Paulson
2016-10-19: A formal model for the SPARCv8 ISA and a proof of non-interference for the LEON3 processor
Authors: Zhe Hou, David Sanan, Alwen Tiu and Yang Liu
2016-10-14: The Factorization Algorithm of Berlekamp and Zassenhaus
Authors: Jose Divasón, Sebastiaan Joosten, René Thiemann and Akihisa Yamada
2016-10-11: Intersecting Chords Theorem
Author: Lukas Bulwahn
2016-10-05: Lp spaces
Author: Sebastien Gouezel
2016-09-30: Fisher–Yates shuffle
Author: Manuel Eberl
2016-09-29: Allen's Interval Calculus
Author: Fadoua Ghourabi
2016-09-23: Formalization of Recursive Path Orders for Lambda-Free Higher-Order Terms
Authors: Jasmin Christian Blanchette, Uwe Waldmann and Daniel Wand
2016-09-09: Iptables Semantics
Authors: Cornelius Diekmann and Lars Hupel
2016-09-06: A Variant of the Superposition Calculus
Author: Nicolas Peltier
2016-09-06: Stone Algebras
Author: Walter Guttmann
2016-09-01: Stirling's formula
Author: Manuel Eberl
2016-08-31: Routing
Authors: Julius Michaelis and Cornelius Diekmann
2016-08-24: Simple Firewall
Authors: Cornelius Diekmann, Julius Michaelis and Maximilian Haslbeck
2016-08-18: Infeasible Paths Elimination by Symbolic Execution Techniques: Proof of Correctness and Preservation of Paths
Authors: Romain Aissat, Frederic Voisin and Burkhart Wolff
2016-08-12: Formalizing the Edmonds-Karp Algorithm
Authors: Peter Lammich and S. Reza Sefidgar
2016-08-08: The Imperative Refinement Framework
Author: Peter Lammich
2016-08-07: Ptolemy's Theorem
Author: Lukas Bulwahn
2016-07-17: Surprise Paradox
Author: Joachim Breitner
2016-07-14: Pairing Heap
Authors: Hauke Brinkop and Tobias Nipkow
2016-07-05: A Framework for Verifying Depth-First Search Algorithms
Authors: Peter Lammich and René Neumann
2016-07-01: Chamber Complexes, Coxeter Systems, and Buildings
Author: Jeremy Sylvestre
2016-06-30: The Z Property
Authors: Bertram Felgenhauer, Julian Nagele, Vincent van Oostrom and Christian Sternagel
2016-06-30: The Resolution Calculus for First-Order Logic
Author: - Anders Schlichtkrull + Anders Schlichtkrull
2016-06-28: IP Addresses
Authors: Cornelius Diekmann, Julius Michaelis and Lars Hupel
2016-06-28: Compositional Security-Preserving Refinement for Concurrent Imperative Programs
Authors: - Toby Murray, + Toby Murray, Robert Sison, Edward Pierzchalski and Christine Rizkallah
2016-06-26: Category Theory with Adjunctions and Limits
Author: Eugene W. Stark
2016-06-26: Cardinality of Multisets
Author: Lukas Bulwahn
2016-06-25: A Dependent Security Type System for Concurrent Imperative Programs
Authors: - Toby Murray, + Toby Murray, Robert Sison, Edward Pierzchalski and Christine Rizkallah
2016-06-21: Catalan Numbers
Author: Manuel Eberl
2016-06-18: Program Construction and Verification Components Based on Kleene Algebra
Authors: Victor B. F. Gomes and Georg Struth
2016-06-13: Conservation of CSP Noninterference Security under Concurrent Composition
Author: Pasquale Noce
2016-06-09: Finite Machine Word Library
Authors: Joel Beeren, Matthew Fernandez, Xin Gao, Gerwin Klein, Rafal Kolanski, Japheth Lim, Corey Lewis, Daniel Matichuk and Thomas Sewell
2016-05-31: Tree Decomposition
Author: Christoph Dittmann
2016-05-24: POSIX Lexing with Derivatives of Regular Expressions
Authors: Fahad Ausaf, Roy Dyckhoff and Christian Urban
2016-05-24: Cardinality of Equivalence Relations
Author: Lukas Bulwahn
2016-05-20: Perron-Frobenius Theorem for Spectral Radius Analysis
Authors: Jose Divasón, Ondřej Kunčar, René Thiemann and Akihisa Yamada
2016-05-20: The meta theory of the Incredible Proof Machine
Authors: Joachim Breitner and Denis Lohner
2016-05-18: A Constructive Proof for FLP
Authors: Benjamin Bisping, Paul-David Brodmann, Tim Jungnickel, Christina Rickmann, Henning Seidler, Anke Stüber, Arno Wilhelm-Weidner, Kirstin Peters and Uwe Nestmann
2016-05-09: A Formal Proof of the Max-Flow Min-Cut Theorem for Countable Networks
Author: Andreas Lochbihler
2016-05-05: Randomised Social Choice Theory
Author: Manuel Eberl
2016-05-04: The Incompatibility of SD-Efficiency and SD-Strategy-Proofness
Author: Manuel Eberl
2016-05-04: Spivey's Generalized Recurrence for Bell Numbers
Author: Lukas Bulwahn
2016-05-02: Gröbner Bases Theory
Authors: Fabian Immler and Alexander Maletzky
2016-04-28: No Faster-Than-Light Observers
Authors: Mike Stannett and István Németi
2016-04-27: Algorithms for Reduced Ordered Binary Decision Diagrams
Authors: Julius Michaelis, Maximilian Haslbeck, Peter Lammich and Lars Hupel
2016-04-27: A formalisation of the Cocke-Younger-Kasami algorithm
Author: Maksym Bortin
2016-04-26: Conservation of CSP Noninterference Security under Sequential Composition
Author: Pasquale Noce
2016-04-12: Kleene Algebras with Domain
Authors: Victor B. F. Gomes, Walter Guttmann, Peter Höfner, Georg Struth and Tjark Weber
2016-03-11: Propositional Resolution and Prime Implicates Generation
Author: Nicolas Peltier
2016-03-08: Timed Automata
Author: Simon Wimmer
2016-03-08: The Cartan Fixed Point Theorems
Author: Lawrence C. Paulson
2016-03-01: Linear Temporal Logic
Author: Salomon Sickert
2016-02-17: Analysis of List Update Algorithms
Authors: Maximilian P.L. Haslbeck and Tobias Nipkow
2016-02-05: Verified Construction of Static Single Assignment Form
Authors: Sebastian Ullrich and Denis Lohner
2016-01-29: Polynomial Interpolation
Authors: René Thiemann and Akihisa Yamada
2016-01-29: Polynomial Factorization
Authors: René Thiemann and Akihisa Yamada
2016-01-20: Knot Theory
Author: T.V.H. Prathamesh
2016-01-18: Tensor Product of Matrices
Author: T.V.H. Prathamesh
2016-01-14: Cardinality of Number Partitions
Author: Lukas Bulwahn

 

2015
2015-12-28: Basic Geometric Properties of Triangles
Author: Manuel Eberl
2015-12-28: The Divergence of the Prime Harmonic Series
Author: Manuel Eberl
2015-12-28: Liouville numbers
Author: Manuel Eberl
2015-12-28: Descartes' Rule of Signs
Author: Manuel Eberl
2015-12-22: The Stern-Brocot Tree
Authors: Peter Gammie and Andreas Lochbihler
2015-12-22: Applicative Lifting
Authors: Andreas Lochbihler and Joshua Schneider
2015-12-22: Algebraic Numbers in Isabelle/HOL
Authors: René Thiemann, Akihisa Yamada and Sebastiaan Joosten
2015-12-12: Cardinality of Set Partitions
Author: Lukas Bulwahn
2015-12-02: Latin Square
Author: Alexander Bentkamp
2015-12-01: Ergodic Theory
Author: Sebastien Gouezel
2015-11-19: Euler's Partition Theorem
Author: Lukas Bulwahn
2015-11-18: The Tortoise and Hare Algorithm
Author: Peter Gammie
2015-11-11: Planarity Certificates
Author: Lars Noschinski
2015-11-02: Positional Determinacy of Parity Games
Author: Christoph Dittmann
2015-09-16: A Meta-Model for the Isabelle API
Authors: Frédéric Tuong and Burkhart Wolff
2015-09-04: Converting Linear Temporal Logic to Deterministic (Generalized) Rabin Automata
Author: Salomon Sickert
2015-08-21: Matrices, Jordan Normal Forms, and Spectral Radius Theory
Authors: René Thiemann and Akihisa Yamada
2015-08-20: Decreasing Diagrams II
Author: Bertram Felgenhauer
2015-08-18: The Inductive Unwinding Theorem for CSP Noninterference Security
Author: Pasquale Noce
2015-08-12: Representations of Finite Groups
Author: Jeremy Sylvestre
2015-08-10: Analysing and Comparing Encodability Criteria for Process Calculi
Authors: Kirstin Peters and Rob van Glabbeek
2015-07-21: Generating Cases from Labeled Subgoals
Author: Lars Noschinski
2015-07-14: Landau Symbols
Author: Manuel Eberl
2015-07-14: The Akra-Bazzi theorem and the Master theorem
Author: Manuel Eberl
2015-07-07: Hermite Normal Form
Authors: Jose Divasón and Jesús Aransay
2015-06-27: Derangements Formula
Author: Lukas Bulwahn
2015-06-11: The Ipurge Unwinding Theorem for CSP Noninterference Security
Author: Pasquale Noce
2015-06-11: The Generic Unwinding Theorem for CSP Noninterference Security
Author: Pasquale Noce
2015-06-11: Binary Multirelations
Authors: Hitoshi Furusawa and Georg Struth
2015-06-11: Reasoning about Lists via List Interleaving
Author: Pasquale Noce
2015-06-07: Parameterized Dynamic Tables
Author: Tobias Nipkow
2015-05-28: Derivatives of Logical Formulas
Author: Dmitriy Traytel
2015-05-27: A Zoo of Probabilistic Systems
Authors: Johannes Hölzl, Andreas Lochbihler and Dmitriy Traytel
2015-04-30: VCG - Combinatorial Vickrey-Clarke-Groves Auctions
Authors: Marco B. Caminati, Manfred Kerber, Christoph Lange and Colin Rowat
2015-04-15: Residuated Lattices
Authors: Victor B. F. Gomes and Georg Struth
2015-04-13: Concurrent IMP
Author: Peter Gammie
2015-04-13: Relaxing Safely: Verified On-the-Fly Garbage Collection for x86-TSO
Authors: Peter Gammie, Tony Hosking and Kai Engelhardt
2015-03-30: Trie
Authors: Andreas Lochbihler and Tobias Nipkow
2015-03-18: Consensus Refined
Authors: Ognjen Maric and Christoph Sprenger
2015-03-11: Deriving class instances for datatypes
Authors: Christian Sternagel and René Thiemann
2015-02-20: The Safety of Call Arity
Author: Joachim Breitner
2015-02-12: QR Decomposition
Authors: Jose Divasón and Jesús Aransay
2015-02-12: Echelon Form
Authors: Jose Divasón and Jesús Aransay
2015-02-05: Finite Automata in Hereditarily Finite Set Theory
Author: Lawrence C. Paulson
2015-01-28: Verification of the UpDown Scheme
Author: Johannes Hölzl

 

2014
2014-11-28: The Unified Policy Framework (UPF)
Authors: Achim D. Brucker, Lukas Brügger and Burkhart Wolff
2014-10-23: Loop freedom of the (untimed) AODV routing protocol
Authors: Timothy Bourke and Peter Höfner
2014-10-13: Lifting Definition Option
Author: René Thiemann
2014-10-10: Stream Fusion in HOL with Code Generation
Authors: Andreas Lochbihler and Alexandra Maximova
2014-10-09: A Verified Compiler for Probability Density Functions
Authors: Manuel Eberl, Johannes Hölzl and Tobias Nipkow
2014-10-08: Formalization of Refinement Calculus for Reactive Systems
Author: Viorel Preoteasa
2014-10-03: XML
Authors: Christian Sternagel and René Thiemann
2014-10-03: Certification Monads
Authors: Christian Sternagel and René Thiemann
2014-09-25: Imperative Insertion Sort
Author: Christian Sternagel
2014-09-19: The Sturm-Tarski Theorem
Author: Wenda Li
2014-09-15: The Cayley-Hamilton Theorem
Authors: Stephan Adelsberger, Stefan Hetzl and Florian Pollak
2014-09-09: The Jordan-Hölder Theorem
Author: Jakob von Raumer
2014-09-04: Priority Queues Based on Braun Trees
Author: Tobias Nipkow
2014-09-03: Gauss-Jordan Algorithm and Its Applications
Authors: Jose Divasón and Jesús Aransay
2014-08-29: Vector Spaces
Author: Holden Lee
2014-08-29: Real-Valued Special Functions: Upper and Lower Bounds
Author: Lawrence C. Paulson
2014-08-13: Skew Heap
Author: Tobias Nipkow
2014-08-12: Splay Tree
Author: Tobias Nipkow
2014-07-29: Haskell's Show Class in Isabelle/HOL
Authors: Christian Sternagel and René Thiemann
2014-07-18: Formal Specification of a Generic Separation Kernel
Authors: Freek Verbeek, Sergey Tverdyshev, Oto Havle, Holger Blasum, Bruno Langenstein, Werner Stephan, Yakoub Nemouchi, Abderrahmane Feliachi, Burkhart Wolff and Julien Schmaltz
2014-07-13: pGCL for Isabelle
Author: David Cock
2014-07-07: Amortized Complexity Verified
Author: Tobias Nipkow
2014-07-04: Network Security Policy Verification
Author: Cornelius Diekmann
2014-07-03: Pop-Refinement
Author: Alessandro Coglio
2014-06-12: Decision Procedures for MSO on Words Based on Derivatives of Regular Expressions
Authors: Dmitriy Traytel and Tobias Nipkow
2014-06-08: Boolean Expression Checkers
Author: Tobias Nipkow
2014-05-28: Promela Formalization
Author: René Neumann
2014-05-28: Converting Linear-Time Temporal Logic to Generalized Büchi Automata
Authors: Alexander Schimpf and Peter Lammich
2014-05-28: Verified Efficient Implementation of Gabow's Strongly Connected Components Algorithm
Author: Peter Lammich
2014-05-28: A Fully Verified Executable LTL Model Checker
Authors: Javier Esparza, Peter Lammich, René Neumann, Tobias Nipkow, Alexander Schimpf and Jan-Georg Smaus
2014-05-28: The CAVA Automata Library
Author: Peter Lammich
2014-05-23: Transitive closure according to Roy-Floyd-Warshall
Author: Makarius Wenzel
2014-05-23: Noninterference Security in Communicating Sequential Processes
Author: Pasquale Noce
2014-05-21: Regular Algebras
Authors: Simon Foster and Georg Struth
2014-04-28: Formalisation and Analysis of Component Dependencies
Author: Maria Spichkova
2014-04-23: A Formalization of Declassification with WHAT-and-WHERE-Security
Authors: Sylvia Grewe, Alexander Lux, Heiko Mantel and Jens Sauer
2014-04-23: A Formalization of Strong Security
Authors: Sylvia Grewe, Alexander Lux, Heiko Mantel and Jens Sauer
2014-04-23: A Formalization of Assumptions and Guarantees for Compositional Noninterference
Authors: Sylvia Grewe, Heiko Mantel and Daniel Schoepe
2014-04-22: Bounded-Deducibility Security
Authors: Andrei Popescu and Peter Lammich
2014-04-16: A shallow embedding of HyperCTL*
Authors: Markus N. Rabe, Peter Lammich and Andrei Popescu
2014-04-16: Abstract Completeness
Authors: Jasmin Christian Blanchette, Andrei Popescu and Dmitriy Traytel
2014-04-13: Discrete Summation
Author: Florian Haftmann
2014-04-03: Syntax and semantics of a GPU kernel programming language
Author: John Wickerson
2014-03-11: Probabilistic Noninterference
Authors: Andrei Popescu and Johannes Hölzl
2014-03-08: Mechanization of the Algebra for Wireless Networks (AWN)
Author: Timothy Bourke
2014-02-18: Mutually Recursive Partial Functions
Author: René Thiemann
2014-02-13: Properties of Random Graphs -- Subgraph Containment
Author: Lars Hupel
2014-02-11: Verification of Selection and Heap Sort Using Locales
Author: Danijela Petrovic
2014-02-07: Affine Arithmetic
Author: Fabian Immler
2014-02-06: Implementing field extensions of the form Q[sqrt(b)]
Author: René Thiemann
2014-01-30: Unified Decision Procedures for Regular Expression Equivalence
Authors: Tobias Nipkow and Dmitriy Traytel
2014-01-28: Secondary Sylow Theorems
Author: Jakob von Raumer
2014-01-25: Relation Algebra
Authors: Alasdair Armstrong, Simon Foster, Georg Struth and Tjark Weber
2014-01-23: Kleene Algebra with Tests and Demonic Refinement Algebras
Authors: Alasdair Armstrong, Victor B. F. Gomes and Georg Struth
2014-01-16: Featherweight OCL: A Proposal for a Machine-Checked Formal Semantics for OCL 2.5
Authors: Achim D. Brucker, Frédéric Tuong and Burkhart Wolff
2014-01-11: Sturm's Theorem
Author: Manuel Eberl
2014-01-11: Compositional Properties of Crypto-Based Components
Author: Maria Spichkova

 

2013
2013-12-01: A General Method for the Proof of Theorems on Tail-recursive Functions
Author: Pasquale Noce
2013-11-17: Gödel's Incompleteness Theorems
Author: Lawrence C. Paulson
2013-11-17: The Hereditarily Finite Sets
Author: Lawrence C. Paulson
2013-11-15: A Codatatype of Formal Languages
Author: Dmitriy Traytel
2013-11-14: Stream Processing Components: Isabelle/HOL Formalisation and Case Studies
Author: Maria Spichkova
2013-11-12: Gödel's God in Isabelle/HOL
Authors: Christoph Benzmüller and Bruno Woltzenlogel Paleo
2013-11-01: Decreasing Diagrams
Author: Harald Zankl
2013-10-02: Automatic Data Refinement
Author: Peter Lammich
2013-09-17: Native Word
Author: Andreas Lochbihler
2013-07-27: A Formal Model of IEEE Floating Point Arithmetic
Author: Lei Yu
2013-07-22: Pratt's Primality Certificates
Authors: Simon Wimmer and Lars Noschinski
2013-07-22: Lehmer's Theorem
Authors: Simon Wimmer and Lars Noschinski
2013-07-19: The Königsberg Bridge Problem and the Friendship Theorem
Author: Wenda Li
2013-06-27: Sound and Complete Sort Encodings for First-Order Logic
Authors: Jasmin Christian Blanchette and Andrei Popescu
2013-05-22: An Axiomatic Characterization of the Single-Source Shortest Path Problem
Author: Christine Rizkallah
2013-04-28: Graph Theory
Author: Lars Noschinski
2013-04-15: Light-weight Containers
Author: Andreas Lochbihler
2013-02-21: Nominal 2
Authors: Christian Urban, Stefan Berghofer and Cezary Kaliszyk
2013-01-31: The Correctness of Launchbury's Natural Semantics for Lazy Evaluation
Author: Joachim Breitner
2013-01-19: Ribbon Proofs
Author: John Wickerson
2013-01-16: Rank-Nullity Theorem in Linear Algebra
Authors: Jose Divasón and Jesús Aransay
2013-01-15: Kleene Algebra
Authors: Alasdair Armstrong, Georg Struth and Tjark Weber
2013-01-03: Computing N-th Roots using the Babylonian Method
Author: René Thiemann

 

2012
2012-11-14: A Separation Logic Framework for Imperative HOL
Authors: Peter Lammich and Rene Meis
2012-11-02: Open Induction
Authors: Mizuhito Ogawa and Christian Sternagel
2012-10-30: The independence of Tarski's Euclidean axiom
Author: T. J. M. Makarios
2012-10-27: Bondy's Theorem
Authors: Jeremy Avigad and Stefan Hetzl
2012-09-10: Possibilistic Noninterference
Authors: Andrei Popescu and Johannes Hölzl
2012-08-07: Generating linear orders for datatypes
Author: René Thiemann
2012-08-05: Proving the Impossibility of Trisecting an Angle and Doubling the Cube
Authors: Ralph Romanos and Lawrence C. Paulson
2012-07-27: Verifying Fault-Tolerant Distributed Algorithms in the Heard-Of Model
Authors: Henri Debrat and Stephan Merz
2012-07-01: Logical Relations for PCF
Author: Peter Gammie
2012-06-26: Type Constructor Classes and Monad Transformers
Author: Brian Huffman
2012-05-29: Psi-calculi in Isabelle
Author: Jesper Bengtson
2012-05-29: The pi-calculus in nominal logic
Author: Jesper Bengtson
2012-05-29: CCS in nominal logic
Author: Jesper Bengtson
2012-05-27: Isabelle/Circus
Authors: Abderrahmane Feliachi, Burkhart Wolff and Marie-Claude Gaudel
2012-05-11: Separation Algebra
Authors: Gerwin Klein, Rafal Kolanski and Andrew Boyton
2012-05-07: Stuttering Equivalence
Author: Stephan Merz
2012-05-02: Inductive Study of Confidentiality
Author: Giampaolo Bella
2012-04-26: Ordinary Differential Equations
Authors: Fabian Immler and Johannes Hölzl
2012-04-13: Well-Quasi-Orders
Author: Christian Sternagel
2012-03-01: Abortable Linearizable Modules
Authors: Rachid Guerraoui, Viktor Kuncak and Giuliano Losa
2012-02-29: Executable Transitive Closures
Author: René Thiemann
2012-02-06: A Probabilistic Proof of the Girth-Chromatic Number Theorem
Author: Lars Noschinski
2012-01-30: Refinement for Monadic Programs
Author: Peter Lammich
2012-01-30: Dijkstra's Shortest Path Algorithm
Authors: Benedikt Nordhoff and Peter Lammich
2012-01-03: Markov Models
Authors: Johannes Hölzl and Tobias Nipkow

 

2011
2011-11-19: A Definitional Encoding of TLA* in Isabelle/HOL
Authors: Gudmund Grov and Stephan Merz
2011-11-09: Efficient Mergesort
Author: Christian Sternagel
2011-09-22: Pseudo Hoops
Authors: George Georgescu, Laurentiu Leustean and Viorel Preoteasa
2011-09-22: Algebra of Monotonic Boolean Transformers
Author: Viorel Preoteasa
2011-09-22: Lattice Properties
Author: Viorel Preoteasa
2011-08-26: The Myhill-Nerode Theorem Based on Regular Expressions
Authors: Chunhan Wu, Xingyuan Zhang and Christian Urban
2011-08-19: Gauss-Jordan Elimination for Matrices Represented as Functions
Author: Tobias Nipkow
2011-07-21: Maximum Cardinality Matching
Author: Christine Rizkallah
2011-05-17: Knowledge-based programs
Author: Peter Gammie
2011-04-01: The General Triangle Is Unique
Author: Joachim Breitner
2011-03-14: Executable Transitive Closures of Finite Relations
Authors: Christian Sternagel and René Thiemann
2011-02-23: Interval Temporal Logic on Natural Numbers
Author: David Trachtenherz
2011-02-23: Infinite Lists
Author: David Trachtenherz
2011-02-23: AutoFocus Stream Processing for Single-Clocking and Multi-Clocking Semantics
Author: David Trachtenherz
2011-02-07: Lightweight Java
Authors: Rok Strniša and Matthew Parkinson
2011-01-10: RIPEMD-160
Author: Fabian Immler
2011-01-08: Lower Semicontinuous Functions
Author: Bogdan Grechuk

 

2010
2010-12-17: Hall's Marriage Theorem
Authors: Dongchen Jiang and Tobias Nipkow
2010-11-16: Shivers' Control Flow Analysis
Author: Joachim Breitner
2010-10-28: Finger Trees
Authors: Benedikt Nordhoff, Stefan Körner and Peter Lammich
2010-10-28: Functional Binomial Queues
Author: René Neumann
2010-10-28: Binomial Heaps and Skew Binomial Heaps
Authors: Rene Meis, Finn Nielsen and Peter Lammich
2010-08-29: Strong Normalization of Moggis's Computational Metalanguage
Author: Christian Doczkal
2010-08-10: Executable Multivariate Polynomials
Authors: Christian Sternagel, René Thiemann, Alexander Maletzky, Fabian Immler, Florian Haftmann, Andreas Lochbihler and Alexander Bentkamp
2010-08-08: Formalizing Statecharts using Hierarchical Automata
Authors: Steffen Helke and Florian Kammüller
2010-06-24: Free Groups
Author: Joachim Breitner
2010-06-20: Category Theory
Author: Alexander Katovsky
2010-06-17: Executable Matrix Operations on Matrices of Arbitrary Dimensions
Authors: Christian Sternagel and René Thiemann
2010-06-14: Abstract Rewriting
Authors: Christian Sternagel and René Thiemann
2010-05-28: Verification of the Deutsch-Schorr-Waite Graph Marking Algorithm using Data Refinement
Authors: Viorel Preoteasa and Ralph-Johan Back
2010-05-28: Semantics and Data Refinement of Invariant Based Programs
Authors: Viorel Preoteasa and Ralph-Johan Back
2010-05-22: A Complete Proof of the Robbins Conjecture
Author: Matthew Wampler-Doty
2010-05-12: Regular Sets and Expressions
Authors: Alexander Krauss and Tobias Nipkow
2010-04-30: Locally Nameless Sigma Calculus
Authors: Ludovic Henrio, Florian Kammüller, Bianca Lutz and Henry Sudhof
2010-03-29: Free Boolean Algebra
Author: Brian Huffman
2010-03-23: Inter-Procedural Information Flow Noninterference via Slicing
Author: Daniel Wasserrab
2010-03-23: Information Flow Noninterference via Slicing
Author: Daniel Wasserrab
2010-02-20: List Index
Author: Tobias Nipkow
2010-02-12: Coinductive
Author: Andreas Lochbihler

 

2009
2009-12-09: A Fast SAT Solver for Isabelle in Standard ML
Author: Armin Heller
2009-12-03: Formalizing the Logic-Automaton Connection
Authors: Stefan Berghofer and Markus Reiter
2009-11-25: Tree Automata
Author: Peter Lammich
2009-11-25: Collections Framework
Author: Peter Lammich
2009-11-22: Perfect Number Theorem
Author: Mark Ijbema
2009-11-13: Backing up Slicing: Verifying the Interprocedural Two-Phase Horwitz-Reps-Binkley Slicer
Author: Daniel Wasserrab
2009-10-30: The Worker/Wrapper Transformation
Author: Peter Gammie
2009-09-01: Ordinals and Cardinals
Author: Andrei Popescu
2009-08-28: Invertibility in Sequent Calculi
Author: Peter Chapman
2009-08-04: An Example of a Cofinitary Group in Isabelle/HOL
Author: Bart Kastermans
2009-05-06: Code Generation for Functions as Data
Author: Andreas Lochbihler
2009-04-29: Stream Fusion
Author: Brian Huffman

 

2008
2008-12-12: A Bytecode Logic for JML and Types
Authors: Lennart Beringer and Martin Hofmann
2008-11-10: Secure information flow and program logics
Authors: Lennart Beringer and Martin Hofmann
2008-11-09: Some classical results in Social Choice Theory
Author: Peter Gammie
2008-11-07: Fun With Tilings
Authors: Tobias Nipkow and Lawrence C. Paulson
2008-10-15: The Textbook Proof of Huffman's Algorithm
Author: Jasmin Christian Blanchette
2008-09-16: Towards Certified Slicing
Author: Daniel Wasserrab
2008-09-02: A Correctness Proof for the Volpano/Smith Security Typing System
Authors: Gregor Snelting and Daniel Wasserrab
2008-09-01: Arrow and Gibbard-Satterthwaite
Author: Tobias Nipkow
2008-08-26: Fun With Functions
Author: Tobias Nipkow
2008-07-23: Formal Verification of Modern SAT Solvers
Author: Filip Marić
2008-04-05: Recursion Theory I
Author: Michael Nedzelsky
2008-02-29: A Sequential Imperative Programming Language Syntax, Semantics, Hoare Logics and Verification Environment
Author: Norbert Schirmer
2008-02-29: BDD Normalisation
Authors: Veronika Ortner and Norbert Schirmer
2008-02-18: Normalization by Evaluation
Authors: Klaus Aehlig and Tobias Nipkow
2008-01-11: Quantifier Elimination for Linear Arithmetic
Author: Tobias Nipkow

 

2007
2007-12-14: Formalization of Conflict Analysis of Programs with Procedures, Thread Creation, and Monitors
Authors: Peter Lammich and Markus Müller-Olm
2007-12-03: Jinja with Threads
Author: Andreas Lochbihler
2007-11-06: Much Ado About Two
Author: Sascha Böhme
2007-08-12: Sums of Two and Four Squares
Author: Roelof Oosterhuis
2007-08-12: Fermat's Last Theorem for Exponents 3 and 4 and the Parametrisation of Pythagorean Triples
Author: Roelof Oosterhuis
2007-08-08: Fundamental Properties of Valuation Theory and Hensel's Lemma
Author: Hidetsune Kobayashi
2007-08-02: POPLmark Challenge Via de Bruijn Indices
Author: Stefan Berghofer
2007-08-02: First-Order Logic According to Fitting
Author: Stefan Berghofer

 

2006
2006-09-09: Hotel Key Card System
Author: Tobias Nipkow
2006-08-08: Abstract Hoare Logics
Author: Tobias Nipkow
2006-05-22: Flyspeck I: Tame Graphs
Authors: Gertrud Bauer and Tobias Nipkow
2006-05-15: CoreC++
Author: Daniel Wasserrab
2006-03-31: A Theory of Featherweight Java in Isabelle/HOL
Authors: J. Nathan Foster and Dimitrios Vytiniotis
2006-03-15: Instances of Schneider's generalized protocol of clock synchronization
Author: Damián Barsotti
2006-03-14: Cauchy's Mean Theorem and the Cauchy-Schwarz Inequality
Author: Benjamin Porter

 

2005
2005-11-11: Countable Ordinals
Author: Brian Huffman
2005-10-12: Fast Fourier Transform
Author: Clemens Ballarin
2005-06-24: Formalization of a Generalized Protocol for Clock Synchronization
Author: Alwen Tiu
2005-06-22: Proving the Correctness of Disk Paxos
Authors: Mauro Jaskelioff and Stephan Merz
2005-06-20: Jive Data and Store Model
Authors: Nicole Rauch and Norbert Schirmer
2005-06-01: Jinja is not Java
Authors: Gerwin Klein and Tobias Nipkow
2005-05-02: SHA1, RSA, PSS and more
Authors: Christina Lindenberg and Kai Wirt
2005-04-21: Category Theory to Yoneda's Lemma
Author: Greg O'Keefe

 

2004
2004-12-09: File Refinement
Authors: Karen Zee and Viktor Kuncak
2004-11-19: Integration theory and random variables
Author: Stefan Richter
2004-09-28: A Mechanically Verified, Efficient, Sound and Complete Theorem Prover For First Order Logic
Author: Tom Ridge
2004-09-20: Ramsey's theorem, infinitary version
Author: Tom Ridge
2004-09-20: Completeness theorem
Authors: James Margetson and Tom Ridge
2004-07-09: Compiling Exceptions Correctly
Author: Tobias Nipkow
2004-06-24: Depth First Search
Authors: Toshiaki Nishihara and Yasuhiko Minamide
2004-05-18: Groups, Rings and Modules
Authors: Hidetsune Kobayashi, L. Chen and H. Murao
2004-04-26: Topology
Author: Stefan Friedrich
2004-04-26: Lazy Lists II
Author: Stefan Friedrich
2004-04-05: Binary Search Trees
Author: Viktor Kuncak
2004-03-30: Functional Automata
Author: Tobias Nipkow
2004-03-19: Mini ML
Authors: Wolfgang Naraschewski and Tobias Nipkow
2004-03-19: AVL Trees
Authors: Tobias Nipkow and Cornelia Pusch
\ No newline at end of file diff --git a/web/rss.xml b/web/rss.xml --- a/web/rss.xml +++ b/web/rss.xml @@ -1,567 +1,565 @@ 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. - 01 Feb 2020 00:00:00 +0000 + 25 Mar 2020 00:00:00 +0000 + + Strong Eventual Consistency of the Collaborative Editing Framework WOOT + https://www.isa-afp.org/entries/WOOT_Strong_Eventual_Consistency.html + https://www.isa-afp.org/entries/WOOT_Strong_Eventual_Consistency.html + Emin Karayel, Edgar Gonzàlez + 25 Mar 2020 00:00:00 +0000 + +Commutative Replicated Data Types (CRDTs) are a promising new class of +data structures for large-scale shared mutable content in applications +that only require eventual consistency. The WithOut Operational +Transforms (WOOT) framework is a CRDT for collaborative text editing +introduced by Oster et al. (CSCW 2006) for which the eventual +consistency property was verified only for a bounded model to date. We +contribute a formal proof for WOOTs strong eventual consistency. + + + Furstenberg's topology and his proof of the infinitude of primes + https://www.isa-afp.org/entries/Furstenberg_Topology.html + https://www.isa-afp.org/entries/Furstenberg_Topology.html + Manuel Eberl + 22 Mar 2020 00:00:00 +0000 + +<p>This article gives a formal version of Furstenberg's +topological proof of the infinitude of primes. He defines a topology +on the integers based on arithmetic progressions (or, equivalently, +residue classes). Using some fairly obvious properties of this +topology, the infinitude of primes is then easily obtained.</p> +<p>Apart from this, this topology is also fairly `nice' in +general: it is second countable, metrizable, and perfect. All of these +(well-known) facts are formally proven, including an explicit metric +for the topology given by Zulfeqarr.</p> + + + An Under-Approximate Relational Logic + https://www.isa-afp.org/entries/Relational-Incorrectness-Logic.html + https://www.isa-afp.org/entries/Relational-Incorrectness-Logic.html + Toby Murray + 12 Mar 2020 00:00:00 +0000 + +Recently, authors have proposed under-approximate logics for reasoning +about programs. So far, all such logics have been confined to +reasoning about individual program behaviours. Yet there exist many +over-approximate relational logics for reasoning about pairs of +programs and relating their behaviours. We present the first +under-approximate relational logic, for the simple imperative language +IMP. We prove our logic is both sound and complete. Additionally, we +show how reasoning in this logic can be decomposed into non-relational +reasoning in an under-approximate Hoare logic, mirroring Beringer’s +result for over-approximate relational logics. We illustrate the +application of our logic on some small examples in which we provably +demonstrate the presence of insecurity. + + + Hello World + https://www.isa-afp.org/entries/Hello_World.html + https://www.isa-afp.org/entries/Hello_World.html + Cornelius Diekmann, Lars Hupel + 07 Mar 2020 00:00:00 +0000 + +In this article, we present a formalization of the well-known +"Hello, World!" code, including a formal framework for +reasoning about IO. Our model is inspired by the handling of IO in +Haskell. We start by formalizing the 🌍 and embrace the IO monad +afterwards. Then we present a sample main :: IO (), followed by its +proof of correctness. + + + Implementing the Goodstein Function in λ-Calculus + https://www.isa-afp.org/entries/Goodstein_Lambda.html + https://www.isa-afp.org/entries/Goodstein_Lambda.html + Bertram Felgenhauer + 21 Feb 2020 00:00:00 +0000 + +In this formalization, we develop an implementation of the Goodstein +function G in plain &lambda;-calculus, linked to a concise, self-contained +specification. The implementation works on a Church-encoded +representation of countable ordinals. The initial conversion to +hereditary base 2 is not covered, but the material is sufficient to +compute the particular value G(16), and easily extends to other fixed +arguments. + + + A Generic Framework for Verified Compilers + https://www.isa-afp.org/entries/VeriComp.html + https://www.isa-afp.org/entries/VeriComp.html + Martin Desharnais + 10 Feb 2020 00:00:00 +0000 + +This is a generic framework for formalizing compiler transformations. +It leverages Isabelle/HOL’s locales to abstract over concrete +languages and transformations. It states common definitions for +language semantics, program behaviours, forward and backward +simulations, and compilers. We provide generic operations, such as +simulation and compiler composition, and prove general (partial) +correctness theorems, resulting in reusable proof components. + Arithmetic progressions and relative primes https://www.isa-afp.org/entries/Arith_Prog_Rel_Primes.html https://www.isa-afp.org/entries/Arith_Prog_Rel_Primes.html José Manuel Rodríguez Caballero 01 Feb 2020 00:00:00 +0000 This article provides a formalization of the solution obtained by the author of the Problem “ARITHMETIC PROGRESSIONS” from the <a href="https://www.ocf.berkeley.edu/~wwu/riddles/putnam.shtml"> Putnam exam problems of 2002</a>. The statement of the problem is as follows: For which integers <em>n</em> > 1 does the set of positive integers less than and relatively prime to <em>n</em> constitute an arithmetic progression? A Hierarchy of Algebras for Boolean Subsets https://www.isa-afp.org/entries/Subset_Boolean_Algebras.html https://www.isa-afp.org/entries/Subset_Boolean_Algebras.html Walter Guttmann, Bernhard Möller 31 Jan 2020 00:00:00 +0000 We present a collection of axiom systems for the construction of Boolean subalgebras of larger overall algebras. The subalgebras are defined as the range of a complement-like operation on a semilattice. This technique has been used, for example, with the antidomain operation, dynamic negation and Stone algebras. We present a common ground for these constructions based on a new equational axiomatisation of Boolean algebras. Mersenne primes and the Lucas–Lehmer test https://www.isa-afp.org/entries/Mersenne_Primes.html https://www.isa-afp.org/entries/Mersenne_Primes.html Manuel Eberl 17 Jan 2020 00:00:00 +0000 <p>This article provides formal proofs of basic properties of Mersenne numbers, i. e. numbers of the form 2<sup><em>n</em></sup> - 1, and especially of Mersenne primes.</p> <p>In particular, an efficient, verified, and executable version of the Lucas&ndash;Lehmer test is developed. This test decides primality for Mersenne numbers in time polynomial in <em>n</em>.</p> Verified Approximation Algorithms https://www.isa-afp.org/entries/Approximation_Algorithms.html https://www.isa-afp.org/entries/Approximation_Algorithms.html Robin Eßmann, Tobias Nipkow, Simon Robillard 16 Jan 2020 00:00:00 +0000 We present the first formal verification of approximation algorithms for NP-complete optimization problems: vertex cover, independent set, load balancing, and bin packing. The proofs correct incompletenesses in existing proofs and improve the approximation ratio in one case. Closest Pair of Points Algorithms https://www.isa-afp.org/entries/Closest_Pair_Points.html https://www.isa-afp.org/entries/Closest_Pair_Points.html Martin Rau, Tobias Nipkow 13 Jan 2020 00:00:00 +0000 This entry provides two related verified divide-and-conquer algorithms solving the fundamental <em>Closest Pair of Points</em> problem in Computational Geometry. Functional correctness and the optimal running time of <em>O</em>(<em>n</em> log <em>n</em>) are proved. Executable code is generated which is empirically competitive with handwritten reference implementations. Skip Lists https://www.isa-afp.org/entries/Skip_Lists.html https://www.isa-afp.org/entries/Skip_Lists.html Max W. Haslbeck, Manuel Eberl 09 Jan 2020 00:00:00 +0000 <p> Skip lists are sorted linked lists enhanced with shortcuts and are an alternative to binary search trees. A skip lists consists of multiple levels of sorted linked lists where a list on level n is a subsequence of the list on level n − 1. In the ideal case, elements are skipped in such a way that a lookup in a skip lists takes O(log n) time. In a randomised skip list the skipped elements are choosen randomly. </p> <p> This entry contains formalized proofs of the textbook results about the expected height and the expected length of a search path in a randomised skip list. </p> Bicategories https://www.isa-afp.org/entries/Bicategory.html https://www.isa-afp.org/entries/Bicategory.html Eugene W. Stark 06 Jan 2020 00:00:00 +0000 Taking as a starting point the author's previous work on developing aspects of category theory in Isabelle/HOL, this article gives a compatible formalization of the notion of "bicategory" and develops a framework within which formal proofs of facts about bicategories can be given. The framework includes a number of basic results, including the Coherence Theorem, the Strictness Theorem, pseudofunctors and biequivalence, and facts about internal equivalences and adjunctions in a bicategory. As a driving application and demonstration of the utility of the framework, it is used to give a formal proof of a theorem, due to Carboni, Kasangian, and Street, that characterizes up to biequivalence the bicategories of spans in a category with pullbacks. The formalization effort necessitated the filling-in of many details that were not evident from the brief presentation in the original paper, as well as identifying a few minor corrections along the way. The Irrationality of ζ(3) https://www.isa-afp.org/entries/Zeta_3_Irrational.html https://www.isa-afp.org/entries/Zeta_3_Irrational.html Manuel Eberl 27 Dec 2019 00:00:00 +0000 <p>This article provides a formalisation of Beukers's straightforward analytic proof that ζ(3) is irrational. This was first proven by Apéry (which is why this result is also often called ‘Apéry's Theorem’) using a more algebraic approach. This formalisation follows <a href="http://people.math.sc.edu/filaseta/gradcourses/Math785/Math785Notes4.pdf">Filaseta's presentation</a> of Beukers's proof.</p> Formalizing a Seligman-Style Tableau System for Hybrid Logic https://www.isa-afp.org/entries/Hybrid_Logic.html https://www.isa-afp.org/entries/Hybrid_Logic.html Asta Halkjær From 20 Dec 2019 00:00:00 +0000 -This work is a formalization of soundness and completeness proofs for -a Seligman-style tableau system for hybrid logic. The completeness -result is obtained via a synthetic approach using maximally consistent -sets of tableau blocks. The formalization differs from the cited work -in a few ways. First, to avoid the need to backtrack in the -construction of a tableau, the formalized system has no unnamed +This work is a formalization of soundness and completeness proofs +for a Seligman-style tableau system for hybrid logic. The completeness +result is obtained via a synthetic approach using maximally +consistent sets of tableau blocks. The formalization differs from +the cited work in a few ways. First, to avoid the need to backtrack in +the construction of a tableau, the formalized system has no unnamed initial segment, and therefore no Name rule. Second, I show that the -full Bridge rule is derivable in the system. Third, I start from rules +full Bridge rule is admissible in the system. Third, I start from rules restricted to only extend the branch with new formulas, including only -witnessing diamonds that are not already witnessed, and show that the -unrestricted rules are derivable. Similarly, I start from simpler -versions of the @-rules and derive the general ones. These -restrictions are imposed to rule out some means of nontermination. +witnessing diamonds that are not already witnessed, and show that +the unrestricted rules are admissible. Similarly, I start from simpler +versions of the @-rules and show the general ones admissible. Finally, +the GoTo rule is restricted using a notion of coins such that each +application consumes a coin and coins are earned through applications of +the remaining rules. I show that if a branch can be closed then it can +be closed starting from a single coin. These restrictions are imposed +to rule out some means of nontermination. The Poincaré-Bendixson Theorem https://www.isa-afp.org/entries/Poincare_Bendixson.html https://www.isa-afp.org/entries/Poincare_Bendixson.html Fabian Immler, Yong Kiam Tan 18 Dec 2019 00:00:00 +0000 The Poincaré-Bendixson theorem is a classical result in the study of (continuous) dynamical systems. Colloquially, it restricts the possible behaviors of planar dynamical systems: such systems cannot be chaotic. In practice, it is a useful tool for proving the existence of (limiting) periodic behavior in planar systems. The theorem is an interesting and challenging benchmark for formalized mathematics because proofs in the literature rely on geometric sketches and only hint at symmetric cases. It also requires a substantial background of mathematical theories, e.g., the Jordan curve theorem, real analysis, ordinary differential equations, and limiting (long-term) behavior of dynamical systems. Poincaré Disc Model https://www.isa-afp.org/entries/Poincare_Disc.html https://www.isa-afp.org/entries/Poincare_Disc.html Danijela Simić, Filip Marić, Pierre Boutry 16 Dec 2019 00:00:00 +0000 We describe formalization of the Poincaré disc model of hyperbolic geometry within the Isabelle/HOL proof assistant. The model is defined within the extended complex plane (one dimensional complex projectives space &#8450;P1), formalized in the AFP entry “Complex Geometry”. Points, lines, congruence of pairs of points, betweenness of triples of points, circles, and isometries are defined within the model. It is shown that the model satisfies all Tarski's axioms except the Euclid's axiom. It is shown that it satisfies its negation and the limiting parallels axiom (which proves it to be a model of hyperbolic geometry). Complex Geometry https://www.isa-afp.org/entries/Complex_Geometry.html https://www.isa-afp.org/entries/Complex_Geometry.html Filip Marić, Danijela Simić 16 Dec 2019 00:00:00 +0000 A formalization of geometry of complex numbers is presented. Fundamental objects that are investigated are the complex plane extended by a single infinite point, its objects (points, lines and circles), and groups of transformations that act on them (e.g., inversions and Möbius transformations). Most objects are defined algebraically, but correspondence with classical geometric definitions is shown. Gauss Sums and the Pólya–Vinogradov Inequality https://www.isa-afp.org/entries/Gauss_Sums.html https://www.isa-afp.org/entries/Gauss_Sums.html Rodrigo Raya, Manuel Eberl 10 Dec 2019 00:00:00 +0000 <p>This article provides a full formalisation of Chapter 8 of Apostol's <em><a href="https://www.springer.com/de/book/9780387901633">Introduction to Analytic Number Theory</a></em>. Subjects that are covered are:</p> <ul> <li>periodic arithmetic functions and their finite Fourier series</li> <li>(generalised) Ramanujan sums</li> <li>Gauss sums and separable characters</li> <li>induced moduli and primitive characters</li> <li>the Pólya&mdash;Vinogradov inequality</li> </ul> An Efficient Generalization of Counting Sort for Large, possibly Infinite Key Ranges https://www.isa-afp.org/entries/Generalized_Counting_Sort.html https://www.isa-afp.org/entries/Generalized_Counting_Sort.html Pasquale Noce 04 Dec 2019 00:00:00 +0000 Counting sort is a well-known algorithm that sorts objects of any kind mapped to integer keys, or else to keys in one-to-one correspondence with some subset of the integers (e.g. alphabet letters). However, it is suitable for direct use, viz. not just as a subroutine of another sorting algorithm (e.g. radix sort), only if the key range is not significantly larger than the number of the objects to be sorted. This paper describes a tail-recursive generalization of counting sort making use of a bounded number of counters, suitable for direct use in case of a large, or even infinite key range of any kind, subject to the only constraint of being a subset of an arbitrary linear order. After performing a pen-and-paper analysis of how such algorithm has to be designed to maximize its efficiency, this paper formalizes the resulting generalized counting sort (GCsort) algorithm and then formally proves its correctness properties, namely that (a) the counters' number is maximized never exceeding the fixed upper bound, (b) objects are conserved, (c) objects get sorted, and (d) the algorithm is stable. Interval Arithmetic on 32-bit Words https://www.isa-afp.org/entries/Interval_Arithmetic_Word32.html https://www.isa-afp.org/entries/Interval_Arithmetic_Word32.html Brandon Bohrer 27 Nov 2019 00:00:00 +0000 Interval_Arithmetic implements conservative interval arithmetic computations, then uses this interval arithmetic to implement a simple programming language where all terms have 32-bit signed word values, with explicit infinities for terms outside the representable bounds. Our target use case is interpreters for languages that must have a well-understood low-level behavior. We include a formalization of bounded-length strings which are used for the identifiers of our language. Bounded-length identifiers are useful in some applications, for example the <a href="https://www.isa-afp.org/entries/Differential_Dynamic_Logic.html">Differential_Dynamic_Logic</a> article, where a Euclidean space indexed by identifiers demands that identifiers are finitely many. Zermelo Fraenkel Set Theory in Higher-Order Logic https://www.isa-afp.org/entries/ZFC_in_HOL.html https://www.isa-afp.org/entries/ZFC_in_HOL.html Lawrence C. Paulson 24 Oct 2019 00:00:00 +0000 <p>This entry is a new formalisation of ZFC set theory in Isabelle/HOL. It is logically equivalent to Obua's HOLZF; the point is to have the closest possible integration with the rest of Isabelle/HOL, minimising the amount of new notations and exploiting type classes.</p> <p>There is a type <em>V</em> of sets and a function <em>elts :: V =&gt; V set</em> mapping a set to its elements. Classes simply have type <em>V set</em>, and a predicate identifies the small classes: those that correspond to actual sets. Type classes connected with orders and lattices are used to minimise the amount of new notation for concepts such as the subset relation, union and intersection. Basic concepts — Cartesian products, disjoint sums, natural numbers, functions, etc. — are formalised.</p> <p>More advanced set-theoretic concepts, such as transfinite induction, ordinals, cardinals and the transitive closure of a set, are also provided. The definition of addition and multiplication for general sets (not just ordinals) follows Kirby.</p> <p>The theory provides two type classes with the aim of facilitating developments that combine <em>V</em> with other Isabelle/HOL types: <em>embeddable</em>, the class of types that can be injected into <em>V</em> (including <em>V</em> itself as well as <em>V*V</em>, etc.), and <em>small</em>, the class of types that correspond to some ZF set.</p> extra-history = Change history: [2020-01-28]: Generalisation of the "small" predicate and order types to arbitrary sets; ordinal exponentiation; introduction of the coercion ord_of_nat :: "nat => V"; numerous new lemmas. (revision 6081d5be8d08) Isabelle/C https://www.isa-afp.org/entries/Isabelle_C.html https://www.isa-afp.org/entries/Isabelle_C.html Frédéric Tuong, Burkhart Wolff 22 Oct 2019 00:00:00 +0000 We present a framework for C code in C11 syntax deeply integrated into the Isabelle/PIDE development environment. Our framework provides an abstract interface for verification back-ends to be plugged-in independently. Thus, various techniques such as deductive program verification or white-box testing can be applied to the same source, which is part of an integrated PIDE document model. Semantic back-ends are free to choose the supported C fragment and its semantics. In particular, they can differ on the chosen memory model or the specification mechanism for framing conditions. Our framework supports semantic annotations of C sources in the form of comments. Annotations serve to locally control back-end settings, and can express the term focus to which an annotation refers. Both the logical and the syntactic context are available when semantic annotations are evaluated. As a consequence, a formula in an annotation can refer both to HOL or C variables. Our approach demonstrates the degree of maturity and expressive power the Isabelle/PIDE sub-system has achieved in recent years. Our integration technique employs Lex and Yacc style grammars to ensure efficient deterministic parsing. This is the core-module of Isabelle/C; the AFP package for Clean and Clean_wrapper as well as AutoCorres and AutoCorres_wrapper (available via git) are applications of this front-end. VerifyThis 2019 -- Polished Isabelle Solutions https://www.isa-afp.org/entries/VerifyThis2019.html https://www.isa-afp.org/entries/VerifyThis2019.html Peter Lammich, Simon Wimmer 16 Oct 2019 00:00:00 +0000 VerifyThis 2019 (http://www.pm.inf.ethz.ch/research/verifythis.html) was a program verification competition associated with ETAPS 2019. It was the 8th event in the VerifyThis competition series. In this entry, we present polished and completed versions of our solutions that we created during the competition. Aristotle's Assertoric Syllogistic https://www.isa-afp.org/entries/Aristotles_Assertoric_Syllogistic.html https://www.isa-afp.org/entries/Aristotles_Assertoric_Syllogistic.html Angeliki Koutsoukou-Argyraki 08 Oct 2019 00:00:00 +0000 We formalise with Isabelle/HOL some basic elements of Aristotle's assertoric syllogistic following the <a href="https://plato.stanford.edu/entries/aristotle-logic/">article from the Stanford Encyclopedia of Philosophy by Robin Smith.</a> To this end, we use a set theoretic formulation (covering both individual and general predication). In particular, we formalise the deductions in the Figures and after that we present Aristotle's metatheoretical observation that all deductions in the Figures can in fact be reduced to either Barbara or Celarent. As the formal proofs prove to be straightforward, the interest of this entry lies in illustrating the functionality of Isabelle and high efficiency of Sledgehammer for simple exercises in philosophy. Sigma Protocols and Commitment Schemes https://www.isa-afp.org/entries/Sigma_Commit_Crypto.html https://www.isa-afp.org/entries/Sigma_Commit_Crypto.html David Butler, Andreas Lochbihler 07 Oct 2019 00:00:00 +0000 We use CryptHOL to formalise commitment schemes and Sigma-protocols. Both are widely used fundamental two party cryptographic primitives. Security for commitment schemes is considered using game-based definitions whereas the security of Sigma-protocols is considered using both the game-based and simulation-based security paradigms. In this work, we first define security for both primitives and then prove secure multiple case studies: the Schnorr, Chaum-Pedersen and Okamoto Sigma-protocols as well as a construction that allows for compound (AND and OR statements) Sigma-protocols and the Pedersen and Rivest commitment schemes. We also prove that commitment schemes can be constructed from Sigma-protocols. We formalise this proof at an abstract level, only assuming the existence of a Sigma-protocol; consequently, the instantiations of this result for the concrete Sigma-protocols we consider come for free. Clean - An Abstract Imperative Programming Language and its Theory https://www.isa-afp.org/entries/Clean.html https://www.isa-afp.org/entries/Clean.html Frédéric Tuong, Burkhart Wolff 04 Oct 2019 00:00:00 +0000 Clean is based on a simple, abstract execution model for an imperative target language. “Abstract” is understood in contrast to “Concrete Semantics”; alternatively, the term “shallow-style embedding” could be used. It strives for a type-safe notion of program-variables, an incremental construction of the typed state-space, support of incremental verification, and open-world extensibility of new type definitions being intertwined with the program definitions. Clean is based on a “no-frills” state-exception monad with the usual definitions of bind and unit for the compositional glue of state-based computations. Clean offers conditionals and loops supporting C-like control-flow operators such as break and return. The state-space construction is based on the extensible record package. Direct recursion of procedures is supported. Clean’s design strives for extreme simplicity. It is geared towards symbolic execution and proven correct verification tools. The underlying libraries of this package, however, deliberately restrict themselves to the most elementary infrastructure for these tasks. The package is intended to serve as demonstrator semantic backend for Isabelle/C, or for the test-generation techniques. Formalization of Multiway-Join Algorithms https://www.isa-afp.org/entries/Generic_Join.html https://www.isa-afp.org/entries/Generic_Join.html Thibault Dardinier 16 Sep 2019 00:00:00 +0000 Worst-case optimal multiway-join algorithms are recent seminal achievement of the database community. These algorithms compute the natural join of multiple relational databases and improve in the worst case over traditional query plan optimizations of nested binary joins. In 2014, <a href="https://doi.org/10.1145/2590989.2590991">Ngo, Ré, and Rudra</a> gave a unified presentation of different multi-way join algorithms. We formalized and proved correct their "Generic Join" algorithm and extended it to support negative joins. Verification Components for Hybrid Systems https://www.isa-afp.org/entries/Hybrid_Systems_VCs.html https://www.isa-afp.org/entries/Hybrid_Systems_VCs.html Jonathan Julian Huerta y Munive 10 Sep 2019 00:00:00 +0000 These components formalise a semantic framework for the deductive verification of hybrid systems. They support reasoning about continuous evolutions of hybrid programs in the style of differential dynamics logic. Vector fields or flows model these evolutions, and their verification is done with invariants for the former or orbits for the latter. Laws of modal Kleene algebra or categorical predicate transformers implement the verification condition generation. Examples show the approach at work. Fourier Series https://www.isa-afp.org/entries/Fourier.html https://www.isa-afp.org/entries/Fourier.html Lawrence C Paulson 06 Sep 2019 00:00:00 +0000 This development formalises the square integrable functions over the reals and the basics of Fourier series. It culminates with a proof that every well-behaved periodic function can be approximated by a Fourier series. The material is ported from HOL Light: https://github.com/jrh13/hol-light/blob/master/100/fourier.ml - - A Case Study in Basic Algebra - https://www.isa-afp.org/entries/Jacobson_Basic_Algebra.html - https://www.isa-afp.org/entries/Jacobson_Basic_Algebra.html - Clemens Ballarin - 30 Aug 2019 00:00:00 +0000 - -The focus of this case study is re-use in abstract algebra. It -contains locale-based formalisations of selected parts of set, group -and ring theory from Jacobson's <i>Basic Algebra</i> -leading to the respective fundamental homomorphism theorems. The -study is not intended as a library base for abstract algebra. It -rather explores an approach towards abstract algebra in Isabelle. - - - Formalisation of an Adaptive State Counting Algorithm - https://www.isa-afp.org/entries/Adaptive_State_Counting.html - https://www.isa-afp.org/entries/Adaptive_State_Counting.html - Robert Sachtleben - 16 Aug 2019 00:00:00 +0000 - -This entry provides a formalisation of a refinement of an adaptive -state counting algorithm, used to test for reduction between finite -state machines. The algorithm has been originally presented by Hierons -in the paper <a -href="https://doi.org/10.1109/TC.2004.85">Testing from a -Non-Deterministic Finite State Machine Using Adaptive State -Counting</a>. Definitions for finite state machines and -adaptive test cases are given and many useful theorems are derived -from these. The algorithm is formalised using mutually recursive -functions, for which it is proven that the generated test suite is -sufficient to test for reduction against finite state machines of a -certain fault domain. Additionally, the algorithm is specified in a -simple WHILE-language and its correctness is shown using Hoare-logic. - - - Laplace Transform - https://www.isa-afp.org/entries/Laplace_Transform.html - https://www.isa-afp.org/entries/Laplace_Transform.html - Fabian Immler - 14 Aug 2019 00:00:00 +0000 - -This entry formalizes the Laplace transform and concrete Laplace -transforms for arithmetic functions, frequency shift, integration and -(higher) differentiation in the time domain. It proves Lerch's -lemma and uniqueness of the Laplace transform for continuous -functions. In order to formalize the foundational assumptions, this -entry contains a formalization of piecewise continuous functions and -functions of exponential order. - - - Linear Programming - https://www.isa-afp.org/entries/Linear_Programming.html - https://www.isa-afp.org/entries/Linear_Programming.html - Julian Parsert, Cezary Kaliszyk - 06 Aug 2019 00:00:00 +0000 - -We use the previous formalization of the general simplex algorithm to -formulate an algorithm for solving linear programs. We encode the -linear programs using only linear constraints. Solving these -constraints also solves the original linear program. This algorithm is -proven to be sound by applying the weak duality theorem which is also -part of this formalization. - - - Communicating Concurrent Kleene Algebra for Distributed Systems Specification - https://www.isa-afp.org/entries/C2KA_DistributedSystems.html - https://www.isa-afp.org/entries/C2KA_DistributedSystems.html - Maxime Buyse, Jason Jaskolka - 06 Aug 2019 00:00:00 +0000 - -Communicating Concurrent Kleene Algebra (C²KA) is a mathematical -framework for capturing the communicating and concurrent behaviour of -agents in distributed systems. It extends Hoare et al.'s -Concurrent Kleene Algebra (CKA) with communication actions through the -notions of stimuli and shared environments. C²KA has applications in -studying system-level properties of distributed systems such as -safety, security, and reliability. In this work, we formalize results -about C²KA and its application for distributed systems specification. -We first formalize the stimulus structure and behaviour structure -(CKA). Next, we combine them to formalize C²KA and its properties. -Then, we formalize notions and properties related to the topology of -distributed systems and the potential for communication via stimuli -and via shared environments of agents, all within the algebraic -setting of C²KA. - - - Selected Problems from the International Mathematical Olympiad 2019 - https://www.isa-afp.org/entries/IMO2019.html - https://www.isa-afp.org/entries/IMO2019.html - Manuel Eberl - 05 Aug 2019 00:00:00 +0000 - -<p>This entry contains formalisations of the answers to three of -the six problem of the International Mathematical Olympiad 2019, -namely Q1, Q4, and Q5.</p> <p>The reason why these -problems were chosen is that they are particularly amenable to -formalisation: they can be solved with minimal use of libraries. The -remaining three concern geometry and graph theory, which, in the -author's opinion, are more difficult to formalise resp. require a -more complex library.</p> - diff --git a/web/statistics.html b/web/statistics.html --- a/web/statistics.html +++ b/web/statistics.html @@ -1,303 +1,303 @@ Archive of Formal Proofs

 

 

 

 

 

 

Statistics

 

Statistics

- - - - + + + +
Number of Articles:518
Number of Authors:341
Number of lemmas:~141,600
Lines of Code:~2,462,100
Number of Articles:524
Number of Authors:344
Number of lemmas:~142,100
Lines of Code:~2,467,600

Most used AFP articles:

NameUsed by ? articles
1. List-Index 14
2. Coinductive 12
Collections 12
Regular-Sets 12
3. Landau_Symbols 11
4. Show 10
5. Abstract-Rewriting 9
Automatic_Refinement 9
Deriving 9
6. Jordan_Normal_Form 8
Native_Word 8

Growth in number of articles:

Growth in lines of code:

Growth in number of authors:

Size of articles:

\ No newline at end of file diff --git a/web/topics.html b/web/topics.html --- a/web/topics.html +++ b/web/topics.html @@ -1,838 +1,845 @@ Archive of Formal Proofs

 

 

 

 

 

 

Index by Topic

 

Computer Science

Automata and Formal Languages

Algorithms

Concurrency

Data Structures

Functional Programming

Hardware

SPARCv8  

Machine Learning

Networks

Programming Languages

Clean   Decl_Sem_Fun_PL   Language Definitions: CakeML   WebAssembly   pGCL   GPU_Kernel_PL   LightweightJava   CoreC++   FeatherweightJava   Jinja   JinjaThreads   Locally-Nameless-Sigma   AutoFocus-Stream   FocusStreamsCaseStudies   Isabelle_Meta_Model   Simpl   Complx   Safe_OCL   Isabelle_C   Lambda Calculi: Higher_Order_Terms   Launchbury   PCF   POPLmark-deBruijn   Lam-ml-Normalization   LambdaMu   Binding_Syntax_Theory   LambdaAuth   Type Systems: Name_Carrying_Type_Inference   MiniML   Possibilistic_Noninterference   SIFUM_Type_Systems   Dependent_SIFUM_Type_Systems   Strong_Security   WHATandWHERE_Security   VolpanoSmith   Logics: ConcurrentIMP   Refine_Monadic   Automatic_Refinement   MonoBoolTranAlgebra   Simpl   Separation_Algebra   Separation_Logic_Imperative_HOL   + Relational-Incorrectness-Logic   Abstract-Hoare-Logics   Kleene_Algebra   KAT_and_DRA   KAD   BytecodeLogicJmlTypes   DataRefinementIBP   RefinementReactive   SIFPL   TLA   Ribbon_Proofs   Separata   Complx   Differential_Dynamic_Logic   Hoare_Time   IMP2   UTP   QHLProver   Differential_Game_Logic   Compiling: CakeML_Codegen   Compiling-Exceptions-Correctly   NormByEval   Density_Compiler   + VeriComp   Static Analysis: RIPEMD-160-SPARK   Program-Conflict-Analysis   Shivers-CFA   Slicing   HRB-Slicing   InfPathElimination   Abs_Int_ITP2012   Transformations: Call_Arity   Refine_Imperative_HOL   WorkerWrapper   Monad_Memo_DP   Formal_SSA   Minimal_SSA   Misc: JiveDataStoreModel   Pop_Refinement   Case_Labeling  

Security

Semantics

System Description Languages

Logic

Philosophy

Rewriting

Mathematics

Order

Algebra

Analysis

Probability Theory

Number Theory

Games and Economics

Geometry

Topology

Graph Theory

Combinatorics

Category Theory

Physics

Set Theory

Misc

Tools

\ No newline at end of file