### 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.

### License

BSD License

### Topics

- Computer science/Data structures

### Session Deriving

- Derive_Manager
- Generator_Aux
- Comparator
- Compare
- RBT_Compare_Order_Impl
- RBT_Comparator_Impl
- Comparator_Generator
- Compare_Generator
- Compare_Instances
- Compare_Order_Instances
- Compare_Rat
- Compare_Real
- Equality_Generator
- Equality_Instances
- Hash_Generator
- Hash_Instances
- Countable_Generator
- Derive
- Derive_Examples

### Depends on

- Collections Framework

### Used by

- Labeled Transition Systems
- Making Arbitrary Relational Calculus Queries Safe-Range
- van Emde Boas Trees
- A Compositional and Unified Translation of LTL into ω-Automata
- Gröbner Bases Theory
- Derivatives of Logical Formulas
- Haskell’s Show Class in Isabelle/HOL
- Decision Procedures for MSO on Words Based on Derivatives of Regular Expressions
- The CAVA Automata Library
- Affine Arithmetic
- Implementing field extensions of the form Q[sqrt(b)]
- Light-weight Containers
- Generating linear orders for datatypes
- Ordinary Differential Equations

### Auto-related entries

- Generating linear orders for datatypes
- Certification Monads
- XML
- Executable Transitive Closures
- Executable Transitive Closures of Finite Relations

## Cite

×

Deriving-AFP

    @article{Deriving-AFP,
      author  = {Christian Sternagel and René Thiemann},
      title   = {Deriving class instances for datatypes},
      journal = {Archive of Formal Proofs},
      month   = {March},
      year    = {2015},
      note    = {\url{https://isa-afp.org/entries/Deriving.html},
                 Formal proof development},
      ISSN    = {2150-914x},
    }

Download

## Download

× Download latest

Older releases:

- Sep 13, 2023 : Isabelle2023
- Oct 27, 2022 : Isabelle2022
- Dec 14, 2021 : Isabelle2021-1
- Feb 23, 2021 : Isabelle2021
- Apr 18, 2020 : Isabelle2020
- Jun 11, 2019 : Isabelle2019
- Aug 16, 2018 : Isabelle2018
- Oct 10, 2017 : Isabelle2017
- Dec 17, 2016 : Isabelle2016-1
- Feb 22, 2016 : Isabelle2016
- May 27, 2015 : Isabelle2015