Nominal/Ex/NoneExamples.thy
author Christian Urban <urbanc@in.tum.de>
Mon, 20 Sep 2010 21:52:45 +0800
changeset 2480 ac7dff1194e8
parent 2454 9ffee4eb1ae1
child 2622 e6e6a3da81aa
permissions -rw-r--r--
introduced a general procedure for structural inductions; simplified reflexivity proof
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 NoneExamples
2454
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
     2
imports "../Nominal2"
1589
6542026b95cd Move Non-respectful examples to NotRsp
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     3
begin
6542026b95cd Move Non-respectful examples to NotRsp
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     4
2454
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
     5
text {*
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
     6
  This example is not covered by our binding 
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
     7
  specification.
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
     8
*}
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
     9
1589
6542026b95cd Move Non-respectful examples to NotRsp
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    10
atom_decl name
6542026b95cd Move Non-respectful examples to NotRsp
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    11
2436
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2083
diff changeset
    12
text {* 
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2083
diff changeset
    13
  "Weirdo" example from Peter Sewell's bestiary. 
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2083
diff changeset
    14
2454
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    15
  p2 occurs in two bodies
2436
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2083
diff changeset
    16
*}
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2083
diff changeset
    17
2454
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    18
(*
2436
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2083
diff changeset
    19
nominal_datatype weird =
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2083
diff changeset
    20
  Foo_var "name"
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2083
diff changeset
    21
| Foo_pair "weird" "weird" 
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2083
diff changeset
    22
| Foo x::"name" y::"name" p1::"weird" p2::"weird" p3::"weird"
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2083
diff changeset
    23
    bind x in p1 p2, 
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2083
diff changeset
    24
    bind y in p2 p3
2454
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    25
*)
2436
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2083
diff changeset
    26
2454
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    27
text {* 
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    28
  this example binds bound names and therefore the 
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    29
  fv-function is not respectful - the proof just fails.
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    30
*}
2436
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2083
diff changeset
    31
2082
0854af516f14 cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
    32
(*
0854af516f14 cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
    33
nominal_datatype trm =
2454
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    34
  Var "name"
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    35
| Lam x::"name" t::"trm"         bind x in t
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    36
| Let left::"trm" right::"trm"   bind (set) "bv left" in right
1589
6542026b95cd Move Non-respectful examples to NotRsp
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    37
binder
2082
0854af516f14 cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
    38
  bv
1589
6542026b95cd Move Non-respectful examples to NotRsp
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    39
where
2454
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    40
  "bv (Var n) = {}"
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    41
| "bv (Lam n t) = {atom n} \<union> bv t"
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    42
| "bv (Let l r) = bv l \<union> bv r"
1589
6542026b95cd Move Non-respectful examples to NotRsp
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    43
*)
6542026b95cd Move Non-respectful examples to NotRsp
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    44
2454
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    45
text {* 
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    46
  this example uses "-" in the binding function; 
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    47
  at the moment this is unsupported 
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    48
*}
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    49
2082
0854af516f14 cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
    50
(*
0854af516f14 cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
    51
nominal_datatype trm' =
2454
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    52
  Var "name"
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    53
| Lam l::"name" r::"trm'"   bind l in r
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    54
| Let l::"trm'" r::"trm'"   bind (set) "bv' l" in r
1589
6542026b95cd Move Non-respectful examples to NotRsp
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    55
binder
2082
0854af516f14 cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
    56
  bv'
1589
6542026b95cd Move Non-respectful examples to NotRsp
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    57
where
2454
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    58
  "bv' (Var n) = {atom n}"
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    59
| "bv' (Lam n t) = bv' t - {atom n}"
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    60
| "bv' (Let l r) = bv' l \<union> bv' r"
2082
0854af516f14 cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
    61
*)
0854af516f14 cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
    62
2454
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    63
text {* 
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    64
  again this example binds bound names - so not respectful
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    65
*}
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    66
2082
0854af516f14 cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
    67
(*
2454
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    68
nominal_datatype trm =
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    69
  Var "name"
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    70
| Lam n::"name" l::"trm" bind n in l
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    71
and bla =
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    72
  Bla f::"trm" s::"trm" bind (set) "bv f" in s
2082
0854af516f14 cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
    73
binder
2454
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    74
  bv :: "trm \<Rightarrow> atom set"
2082
0854af516f14 cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
    75
where
2454
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    76
  "bv (Vam x) = {}"
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    77
| "bv (Lam x b) = {atom x}"
2082
0854af516f14 cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
    78
*)
1589
6542026b95cd Move Non-respectful examples to NotRsp
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    79
6542026b95cd Move Non-respectful examples to NotRsp
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    80
end
6542026b95cd Move Non-respectful examples to NotRsp
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    81
6542026b95cd Move Non-respectful examples to NotRsp
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    82
6542026b95cd Move Non-respectful examples to NotRsp
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    83