Nominal/Ex/Datatypes.thy
author Christian Urban <urbanc@in.tum.de>
Wed, 08 Dec 2010 17:07:08 +0000
changeset 2603 90779aefbf1a
parent 2559 add799cf0817
child 2617 e44551d067e6
permissions -rw-r--r--
first tests about exhaust
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2559
add799cf0817 adapted to changes by Florian on the quotient package and removed local fix for function package
Christian Urban <urbanc@in.tum.de>
parents: 2557
diff changeset
     1
2485
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
theory Datatypes
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
imports "../Nominal2" 
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
begin
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
(* 
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
  plain nominal_datatype definition without an 
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
  atom_decl - example by John Matthews
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
2557
781fbc8c0591 fixed locally the problem with the function package; all tests work again
Christian Urban <urbanc@in.tum.de>
parents: 2556
diff changeset
    11
2485
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
nominal_datatype 'a Maybe = 
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
  Nothing 
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
| Just 'a
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
thm Maybe.distinct
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
thm Maybe.induct
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
thm Maybe.exhaust
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
thm Maybe.fv_defs
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
thm Maybe.bn_defs
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
thm Maybe.perm_simps
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
thm Maybe.eq_iff
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
thm Maybe.fv_bn_eqvt
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
thm Maybe.size_eqvt
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
thm Maybe.supp
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
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
  using a datatype inside a nominal_datatype
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
*)
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
atom_decl name
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
datatype foo = Foo | Bar
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
instantiation foo :: pure
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
begin
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    39
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    40
definition
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    41
  "p \<bullet> (f::foo) = f"
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
instance
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
apply(default)
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
apply(simp_all add:  permute_foo_def)
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
done
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
end
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    49
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    51
nominal_datatype baz =
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    52
  Baz x::name t::foo bind x in t
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    53
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    54
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    55
thm baz.distinct
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    56
thm baz.induct
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    57
thm baz.exhaust
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    58
thm baz.fv_defs
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    59
thm baz.bn_defs
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    60
thm baz.perm_simps
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    61
thm baz.eq_iff
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    62
thm baz.fv_bn_eqvt
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    63
thm baz.size_eqvt
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    64
thm baz.supp
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    65
  
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
end
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    68
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    69
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    70