Re: [isabelle] datatype with custom admissibility proof
> Suppose I want a datatype for finitely-branching trees. I might write something like this:
> datatype 'a mytree = Lf 'a | Br "('a mytree) fset"
> where fset is the type of finite sets (defined by quotienting lists up to permutations and duplications). This doesn't work, because fset is not a datatype. The usual way to handle this is to use lists instead of fsets, but then deciding the equivalence of trees is more complicated than just checking equality of terms.
> Does there exist a way of making datatypes such as mytree?
In the repository version of Isabelle, and in the forthcoming Isabelle2013 (expected to come out in February), there's a definitional package for defining such types. The "BNF" package (BNF = Bounded Natural Functor) provides a command called "data" that generates all the characteristic lemmas you would expect from "datatype". It works as you would expect:
data 'a mytree = Lf 'a | Br "('a mytree) fset"
The long-term goal (for Isabelle2015 maybe) is to replace the existing "datatype" command.
> Is anybody working on such a thing? I feel it would be rather useful. I'm imagining an extension to the datatype package that allows the user to provide their own proof that the datatype is admissible -- rather like the way inductive definitions can be annotated with monotonicity lemmas, or the way functions can be annotated with a custom proof of termination.
Yes, this is exactly how the package work. You can register custom BNFs, as long as they have some properties; some type constructors (functors) are pre-registered, notably "fset"; and the "data" and "codata" commands introduce new inductive and coinductive datatypes (e.g. lazy lists) and registers them as BNFs. Another advantage of the BNF package is that it can be used within local contexts (e.g. locales).
The following papers describe the package in more detail:
Please let us [*] know if you have further questions. The package is brand new, and we'll happily help you get started with it.
[*] Dmitriy Traytel <traytel at in.tum.de>, Andrei Popescu <popescua at in.tum.de>, and me
This archive was generated by a fusion of
Pipermail (Mailman edition) and