Nominal/Ex/Datatypes.thy
author Christian Urban <urbanc@in.tum.de>
Sat, 25 Sep 2010 02:53:39 +0200
changeset 2485 6bab47906dbe
child 2556 8ed62410236e
permissions -rw-r--r--
added example about datatypes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2485
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
theory Datatypes
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
imports "../Nominal2" 
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
begin
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
(* 
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
  plain nominal_datatype definition without an 
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
  atom_decl - example by John Matthews
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
*)
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
nominal_datatype 'a Maybe = 
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
  Nothing 
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
| Just 'a
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
thm Maybe.distinct
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
thm Maybe.induct
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
thm Maybe.exhaust
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
thm Maybe.fv_defs
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
thm Maybe.bn_defs
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
thm Maybe.perm_simps
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
thm Maybe.eq_iff
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
thm Maybe.fv_bn_eqvt
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
thm Maybe.size_eqvt
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
thm Maybe.supp
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
(*
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
  using a datatype inside a nominal_datatype
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
*)
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
atom_decl name
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
datatype foo = Foo | Bar
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
instantiation foo :: pure
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
begin
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
definition
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    39
  "p \<bullet> (f::foo) = f"
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    40
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    41
instance
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
apply(default)
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
apply(simp_all add:  permute_foo_def)
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
done
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
end
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    47
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    49
nominal_datatype baz =
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
  Baz x::name t::foo bind x in t
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    51
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    52
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    53
thm baz.distinct
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    54
thm baz.induct
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    55
thm baz.exhaust
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    56
thm baz.fv_defs
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    57
thm baz.bn_defs
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    58
thm baz.perm_simps
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    59
thm baz.eq_iff
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    60
thm baz.fv_bn_eqvt
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    61
thm baz.size_eqvt
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    62
thm baz.supp
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    63
  
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    64
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    65
end
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    66
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    67
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    68