Nominal/Ex/Modules.thy
author Christian Urban <urbanc@in.tum.de>
Sun, 29 Aug 2010 12:14:40 +0800
changeset 2452 39f8d405d7a2
parent 2436 3885dc2669f9
child 2454 9ffee4eb1ae1
permissions -rw-r--r--
updated todos
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2083
9568f9f31822 tuned file names for examples
Christian Urban <urbanc@in.tum.de>
parents: 2082
diff changeset
     1
theory Modules
2042
495b6feb76a8 Move ExLeroy to New Parser
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1773
diff changeset
     2
imports "../NewParser"
1599
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     3
begin
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     4
2083
9568f9f31822 tuned file names for examples
Christian Urban <urbanc@in.tum.de>
parents: 2082
diff changeset
     5
(* example from Leroy'96 about modules; 
9568f9f31822 tuned file names for examples
Christian Urban <urbanc@in.tum.de>
parents: 2082
diff changeset
     6
   see OTT example by Owens *)
1599
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     7
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     8
atom_decl name
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     9
2436
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2120
diff changeset
    10
nominal_datatype modules: 
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2120
diff changeset
    11
 mexp =
1599
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    12
  Acc "path"
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    13
| Stru "body"
2436
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2120
diff changeset
    14
| Funct x::"name" "sexp" m::"mexp"    bind (set) x in m
1599
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    15
| FApp "mexp" "path"
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    16
| Ascr "mexp" "sexp"
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    17
and body =
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    18
  Empty
2436
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2120
diff changeset
    19
| Seq c::"defn" d::"body"     bind (set) "cbinders c" in d
1599
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    20
and defn =
2082
0854af516f14 cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents: 2042
diff changeset
    21
  Type "name" "ty"
1599
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    22
| Dty "name"
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    23
| DStru "name" "mexp"
2082
0854af516f14 cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents: 2042
diff changeset
    24
| Val "name" "trm"
1599
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    25
and sexp =
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    26
  Sig sbody
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    27
| SFunc "name" "sexp" "sexp"
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    28
and sbody =
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    29
  SEmpty
2436
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2120
diff changeset
    30
| SSeq C::"spec" D::"sbody"    bind (set) "Cbinders C" in D
1599
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    31
and spec =
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    32
  Type1 "name"
2082
0854af516f14 cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents: 2042
diff changeset
    33
| Type2 "name" "ty"
1599
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    34
| SStru "name" "sexp"
2082
0854af516f14 cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents: 2042
diff changeset
    35
| SVal "name" "ty"
0854af516f14 cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents: 2042
diff changeset
    36
and ty =
1599
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    37
  Tyref1 "name"
2082
0854af516f14 cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents: 2042
diff changeset
    38
| Tyref2 "path" "ty"
0854af516f14 cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents: 2042
diff changeset
    39
| Fun "ty" "ty"
1599
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    40
and path =
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    41
  Sref1 "name"
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    42
| Sref2 "path" "name"
2082
0854af516f14 cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents: 2042
diff changeset
    43
and trm =
1599
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    44
  Tref1 "name"
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    45
| Tref2 "path" "name"
2436
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2120
diff changeset
    46
| Lam' v::"name" "ty" M::"trm"  bind (set) v in M
2082
0854af516f14 cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents: 2042
diff changeset
    47
| App' "trm" "trm"
0854af516f14 cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents: 2042
diff changeset
    48
| Let' "body" "trm"
1599
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    49
binder
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    50
    cbinders :: "defn \<Rightarrow> atom set"
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    51
and Cbinders :: "spec \<Rightarrow> atom set"
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    52
where
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    53
  "cbinders (Type t T) = {atom t}"
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    54
| "cbinders (Dty t) = {atom t}"
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    55
| "cbinders (DStru x s) = {atom x}"
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    56
| "cbinders (Val v M) = {atom v}"
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    57
| "Cbinders (Type1 t) = {atom t}"
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    58
| "Cbinders (Type2 t T) = {atom t}"
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    59
| "Cbinders (SStru x S) = {atom x}"
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    60
| "Cbinders (SVal v T) = {atom v}"
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    61
2436
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2120
diff changeset
    62
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2120
diff changeset
    63
thm modules.distinct
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2120
diff changeset
    64
thm modules.induct
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2120
diff changeset
    65
thm modules.exhaust
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2120
diff changeset
    66
thm modules.fv_defs
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2120
diff changeset
    67
thm modules.bn_defs
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2120
diff changeset
    68
thm modules.perm_simps
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2120
diff changeset
    69
thm modules.eq_iff
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2120
diff changeset
    70
thm modules.fv_bn_eqvt
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2120
diff changeset
    71
thm modules.size_eqvt
2082
0854af516f14 cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents: 2042
diff changeset
    72
0854af516f14 cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents: 2042
diff changeset
    73
1599
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    74
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    75
end
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    76
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    77
8b5a1ad60487 Move Leroy out of Test, rename accordingly.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    78