2485
|
1 |
theory Datatypes
|
|
2 |
imports "../Nominal2"
|
|
3 |
begin
|
|
4 |
|
|
5 |
(*
|
|
6 |
plain nominal_datatype definition without an
|
|
7 |
atom_decl - example by John Matthews
|
|
8 |
*)
|
|
9 |
|
|
10 |
nominal_datatype 'a Maybe =
|
|
11 |
Nothing
|
|
12 |
| Just 'a
|
|
13 |
|
|
14 |
|
|
15 |
thm Maybe.distinct
|
|
16 |
thm Maybe.induct
|
|
17 |
thm Maybe.exhaust
|
|
18 |
thm Maybe.fv_defs
|
|
19 |
thm Maybe.bn_defs
|
|
20 |
thm Maybe.perm_simps
|
|
21 |
thm Maybe.eq_iff
|
|
22 |
thm Maybe.fv_bn_eqvt
|
|
23 |
thm Maybe.size_eqvt
|
|
24 |
thm Maybe.supp
|
|
25 |
|
|
26 |
(*
|
|
27 |
using a datatype inside a nominal_datatype
|
|
28 |
*)
|
|
29 |
|
|
30 |
atom_decl name
|
|
31 |
|
|
32 |
datatype foo = Foo | Bar
|
|
33 |
|
|
34 |
|
|
35 |
instantiation foo :: pure
|
|
36 |
begin
|
|
37 |
|
|
38 |
definition
|
|
39 |
"p \<bullet> (f::foo) = f"
|
|
40 |
|
|
41 |
instance
|
|
42 |
apply(default)
|
|
43 |
apply(simp_all add: permute_foo_def)
|
|
44 |
done
|
|
45 |
|
|
46 |
end
|
|
47 |
|
|
48 |
|
|
49 |
nominal_datatype baz =
|
|
50 |
Baz x::name t::foo bind x in t
|
|
51 |
|
|
52 |
|
|
53 |
thm baz.distinct
|
|
54 |
thm baz.induct
|
|
55 |
thm baz.exhaust
|
|
56 |
thm baz.fv_defs
|
|
57 |
thm baz.bn_defs
|
|
58 |
thm baz.perm_simps
|
|
59 |
thm baz.eq_iff
|
|
60 |
thm baz.fv_bn_eqvt
|
|
61 |
thm baz.size_eqvt
|
|
62 |
thm baz.supp
|
|
63 |
|
|
64 |
|
|
65 |
end
|
|
66 |
|
|
67 |
|
|
68 |
|