Nominal/Ex/Datatypes.thy
author Christian Urban <urbanc@in.tum.de>
Fri, 07 Jan 2011 02:30:00 +0000
changeset 2650 e5fa8de0e4bd
parent 2617 e44551d067e6
child 2777 75a95431cd8b
permissions -rw-r--r--
derived equivariance for the function graph and function relation
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
2617
e44551d067e6 properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents: 2559
diff changeset
    20
thm Maybe.strong_exhaust
2485
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
thm Maybe.fv_defs
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
thm Maybe.bn_defs
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
thm Maybe.perm_simps
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
thm Maybe.eq_iff
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
thm Maybe.fv_bn_eqvt
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
thm Maybe.size_eqvt
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
thm Maybe.supp
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
  using a datatype inside a nominal_datatype
2617
e44551d067e6 properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents: 2559
diff changeset
    31
e44551d067e6 properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents: 2559
diff changeset
    32
  the datatype needs to be shown to be an instance
e44551d067e6 properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents: 2559
diff changeset
    33
  of the pure class (this is usually trivial)
2485
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
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
atom_decl name
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
datatype foo = Foo | Bar
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
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    41
instantiation foo :: pure
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
begin
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
definition
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
  "p \<bullet> (f::foo) = f"
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    47
instance
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
apply(default)
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    49
apply(simp_all add:  permute_foo_def)
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
done
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
end
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
nominal_datatype baz =
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    56
  Baz x::name t::foo bind x in t
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    57
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    58
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    59
thm baz.distinct
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    60
thm baz.induct
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    61
thm baz.exhaust
2617
e44551d067e6 properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents: 2559
diff changeset
    62
thm baz.strong_exhaust
2485
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    63
thm baz.fv_defs
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    64
thm baz.bn_defs
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    65
thm baz.perm_simps
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    66
thm baz.eq_iff
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    67
thm baz.fv_bn_eqvt
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    68
thm baz.size_eqvt
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    69
thm baz.supp
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    70
  
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    71
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    72
end
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    73
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    74
6bab47906dbe added example about datatypes
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    75