Nominal/Test_compat1.thy
author Cezary Kaliszyk <kaliszyk@in.tum.de>
Tue, 09 Mar 2010 11:06:57 +0100
changeset 1373 3effda0eeb04
parent 1371 75f1d7681a24
child 1374 d39ca37e526a
permissions -rw-r--r--
fv_bi and alpha_bi
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1371
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
theory Test_compat
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
imports "Parser" "../Attic/Prove"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
begin
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
text {* 
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
  example 1 
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
  
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
  single let binding
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
*}
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
nominal_datatype lam =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
  VAR "name"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
| APP "lam" "lam"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
| LET bp::"bp" t::"lam"   bind "bi bp" in t
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
and bp = 
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
  BP "name" "lam" 
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
binder
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
  bi::"bp \<Rightarrow> atom set"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
where
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
  "bi (BP x t) = {atom x}"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
thm alpha_lam_raw_alpha_bp_raw.intros[no_vars]
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
abbreviation "VAR \<equiv> VAR_raw"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
abbreviation "APP \<equiv> APP_raw"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
abbreviation "LET \<equiv> LET_raw"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
abbreviation "BP \<equiv> BP_raw"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
abbreviation "bi \<equiv> bi_raw"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
(* non-recursive case *)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
1373
3effda0eeb04 fv_bi and alpha_bi
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1371
diff changeset
    32
fun
3effda0eeb04 fv_bi and alpha_bi
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1371
diff changeset
    33
    fv_lam
3effda0eeb04 fv_bi and alpha_bi
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1371
diff changeset
    34
and fv_bi
3effda0eeb04 fv_bi and alpha_bi
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1371
diff changeset
    35
and fv_bp
3effda0eeb04 fv_bi and alpha_bi
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1371
diff changeset
    36
where
3effda0eeb04 fv_bi and alpha_bi
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1371
diff changeset
    37
  "fv_lam (VAR name) = {atom name}"
3effda0eeb04 fv_bi and alpha_bi
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1371
diff changeset
    38
| "fv_lam (APP lam1 lam2) = fv_lam lam1 \<union> fv_lam lam2"
3effda0eeb04 fv_bi and alpha_bi
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1371
diff changeset
    39
| "fv_lam (LET bp lam) = (fv_bi bp) \<union> (fv_lam lam - bi bp)"
3effda0eeb04 fv_bi and alpha_bi
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1371
diff changeset
    40
| "fv_bi (BP name lam) = fv_lam lam"
3effda0eeb04 fv_bi and alpha_bi
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1371
diff changeset
    41
| "fv_bp (BP name lam) = {atom name} \<union> fv_lam lam"
3effda0eeb04 fv_bi and alpha_bi
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1371
diff changeset
    42
1371
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
inductive
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
  alpha_lam :: "lam_raw \<Rightarrow> lam_raw \<Rightarrow> bool" and
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
  alpha_bp  :: "bp_raw \<Rightarrow> bp_raw \<Rightarrow> bool" and
1373
3effda0eeb04 fv_bi and alpha_bi
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1371
diff changeset
    46
  alpha_bi  :: "bp_raw \<Rightarrow> perm \<Rightarrow> bp_raw \<Rightarrow> bool"
1371
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    47
where
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
  "x = y \<Longrightarrow> alpha_lam (VAR x) (VAR y)"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    49
| "alpha_lam l1 s1 \<and> alpha_lam l2 s2 \<Longrightarrow> alpha_lam (APP l1 l2) (APP s1 s2)"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
| "\<exists>pi. (bi bp, lam) \<approx>gen alpha_lam fv_lam_raw pi (bi bp', lam') \<and> (pi \<bullet> (bi bp)) = bi bp' 
1373
3effda0eeb04 fv_bi and alpha_bi
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1371
diff changeset
    51
   \<and> alpha_bi bp pi bp' 
1371
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    52
   \<Longrightarrow> alpha_lam (LET bp lam) (LET bp' lam')"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    53
| "alpha_lam lam lam' \<and> name = name' \<Longrightarrow> alpha_bp (BP name lam) (BP name' lam')"
1373
3effda0eeb04 fv_bi and alpha_bi
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1371
diff changeset
    54
| "alpha_lam t t' \<Longrightarrow> alpha_bi (BP x t) pi (BP x' t')" 
1371
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    55
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    56
lemma test1:
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    57
  assumes "distinct [x, y]"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    58
  shows "alpha_lam (LET (BP x (VAR x)) (VAR x))
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    59
                   (LET (BP y (VAR x)) (VAR y))"
1373
3effda0eeb04 fv_bi and alpha_bi
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1371
diff changeset
    60
apply(rule alpha_lam_alpha_bp_alpha_bi.intros)
1371
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    61
apply(rule_tac x="(x \<leftrightarrow> y)" in exI)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    62
apply(simp add: alpha_gen fresh_star_def)
1373
3effda0eeb04 fv_bi and alpha_bi
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1371
diff changeset
    63
apply(simp add: alpha_lam_alpha_bp_alpha_bi.intros(1))
1371
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    64
apply(rule conjI)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    65
defer
1373
3effda0eeb04 fv_bi and alpha_bi
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1371
diff changeset
    66
apply(rule alpha_lam_alpha_bp_alpha_bi.intros)
3effda0eeb04 fv_bi and alpha_bi
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1371
diff changeset
    67
apply(simp add: alpha_lam_alpha_bp_alpha_bi.intros(1))
1371
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    68
apply(simp add: permute_set_eq atom_eqvt)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    69
done
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    70
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    71
lemma test2:
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    72
  assumes asm: "distinct [x, y]"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    73
  shows "\<not> alpha_lam (LET (BP x (VAR x)) (VAR x))
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    74
                     (LET (BP y (VAR y)) (VAR y))"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    75
using asm
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    76
apply(clarify)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    77
apply(erule alpha_lam.cases)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    78
apply(simp_all)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    79
apply(erule exE)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    80
apply(clarify)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    81
apply(simp add: alpha_gen fresh_star_def)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    82
apply(erule alpha_lam.cases)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    83
apply(simp_all)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    84
apply(clarify)
1373
3effda0eeb04 fv_bi and alpha_bi
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1371
diff changeset
    85
apply(erule alpha_bi.cases)
1371
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    86
apply(simp_all)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    87
apply(clarify)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    88
apply(erule alpha_lam.cases)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    89
apply(simp_all)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    90
done
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    91
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    92
(* recursive case where we have also bind "bi bp" in bp *)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    93
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    94
inductive
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    95
  Alpha_lam :: "lam_raw \<Rightarrow> lam_raw \<Rightarrow> bool" and
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    96
  Alpha_bp  :: "bp_raw \<Rightarrow> bp_raw \<Rightarrow> bool" and
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    97
  Compat_bp :: "bp_raw \<Rightarrow> perm \<Rightarrow> bp_raw \<Rightarrow> bool"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    98
where
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    99
  "x = y \<Longrightarrow> Alpha_lam (VAR x) (VAR y)"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   100
| "Alpha_lam l1 s1 \<and> Alpha_lam l2 s2 \<Longrightarrow> Alpha_lam (APP l1 l2) (APP s1 s2)"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   101
| "\<exists>pi. (bi bp, lam) \<approx>gen Alpha_lam fv_lam_raw pi (bi bp', lam') \<and> Compat_bp bp pi bp' 
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   102
   \<and> (pi \<bullet> (bi bp)) = bi bp'
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   103
   \<Longrightarrow> Alpha_lam (LET bp lam) (LET bp' lam')"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   104
| "Alpha_lam lam lam' \<and> name = name' \<Longrightarrow> Alpha_bp (BP name lam) (BP name' lam')"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   105
| "Alpha_lam (pi \<bullet> t) t' \<Longrightarrow> Compat_bp (BP x t) pi (BP x' t')"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   106
1373
3effda0eeb04 fv_bi and alpha_bi
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1371
diff changeset
   107
3effda0eeb04 fv_bi and alpha_bi
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1371
diff changeset
   108
1371
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   109
lemma Test1:
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   110
  assumes "distinct [x, y]"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   111
  shows "Alpha_lam (LET (BP x (VAR x)) (VAR x))
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   112
                   (LET (BP y (VAR y)) (VAR y))"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   113
apply(rule Alpha_lam_Alpha_bp_Compat_bp.intros)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   114
apply(rule_tac x="(x \<leftrightarrow> y)" in exI)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   115
apply(simp add: alpha_gen fresh_star_def)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   116
apply(simp add: Alpha_lam_Alpha_bp_Compat_bp.intros(1))
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   117
apply(rule conjI)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   118
apply(rule Alpha_lam_Alpha_bp_Compat_bp.intros)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   119
apply(simp add: Alpha_lam_Alpha_bp_Compat_bp.intros(1))
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   120
apply(simp add: permute_set_eq atom_eqvt)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   121
done
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   122
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   123
lemma Test2:
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   124
  assumes asm: "distinct [x, y]"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   125
  shows "\<not> Alpha_lam (LET (BP x (VAR x)) (VAR x))
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   126
                     (LET (BP y (VAR x)) (VAR y))"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   127
using asm
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   128
apply(clarify)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   129
apply(erule Alpha_lam.cases)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   130
apply(simp_all)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   131
apply(erule exE)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   132
apply(clarify)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   133
apply(simp add: alpha_gen fresh_star_def)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   134
apply(erule Alpha_lam.cases)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   135
apply(simp_all)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   136
apply(clarify)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   137
apply(erule Compat_bp.cases)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   138
apply(simp_all)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   139
apply(clarify)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   140
apply(erule Alpha_lam.cases)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   141
apply(simp_all)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   142
done
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   143
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   144
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   145
text {* example 2 *}
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   146
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   147
nominal_datatype trm' =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   148
  Var "name"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   149
| App "trm'" "trm'"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   150
| Lam x::"name" t::"trm'"          bind x in t 
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   151
| Let p::"pat'" "trm'" t::"trm'"   bind "f p" in t
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   152
and pat' =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   153
  PN
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   154
| PS "name"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   155
| PD "name" "name"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   156
binder
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   157
  f::"pat' \<Rightarrow> atom set"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   158
where 
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   159
  "f PN = {}"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   160
| "f (PS x) = {atom x}"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   161
| "f (PD x y) = {atom x} \<union> {atom y}"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   162
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   163
thm alpha_trm'_raw_alpha_pat'_raw.intros[no_vars]
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   164
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   165
abbreviation "Var \<equiv> Var_raw"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   166
abbreviation "App \<equiv> App_raw"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   167
abbreviation "Lam \<equiv> Lam_raw"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   168
abbreviation "Lett \<equiv> Let_raw"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   169
abbreviation "PN \<equiv> PN_raw"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   170
abbreviation "PS \<equiv> PS_raw"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   171
abbreviation "PD \<equiv> PD_raw"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   172
abbreviation "f \<equiv> f_raw"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   173
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   174
(* not_yet_done *)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   175
inductive 
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   176
  alpha_trm' :: "trm'_raw \<Rightarrow> trm'_raw \<Rightarrow> bool" and
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   177
  alpha_pat'  :: "pat'_raw \<Rightarrow> pat'_raw \<Rightarrow> bool" and
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   178
  compat_pat' :: "pat'_raw \<Rightarrow> perm \<Rightarrow> pat'_raw \<Rightarrow> bool"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   179
where
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   180
  "name = name' \<Longrightarrow> alpha_trm' (Var name) (Var name')"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   181
| "alpha_trm' t2 t2' \<and> alpha_trm' t1 t1' \<Longrightarrow> alpha_trm' (App t1 t2) (App t1' t2')"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   182
| "\<exists>pi. ({atom x}, t) \<approx>gen alpha_trm' fv_trm'_raw pi ({atom x'}, t') \<Longrightarrow> alpha_trm' (Lam x t) (Lam x' t')"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   183
| "\<exists>pi. (f p, t) \<approx>gen alpha_trm' fv_trm'_raw pi (f p', t') \<and> alpha_trm' s s' \<and> (pi \<bullet> f p) = f p' \<and>
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   184
        compat_pat' p pi p' \<Longrightarrow> alpha_trm' (Lett p s t) (Lett p' s' t')"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   185
| "alpha_pat' PN PN"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   186
| "name = name' \<Longrightarrow> alpha_pat' (PS name) (PS name')"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   187
| "name2 = name2' \<and> name1 = name1' \<Longrightarrow> alpha_pat' (PD name1 name2) (PD name1' name2')"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   188
| "compat_pat' PN pi PN"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   189
| "compat_pat' (PS x) pi (PS x')"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   190
| "compat_pat' (PD p1 p2) pi (PD p1' p2')"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   191
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   192
lemma
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   193
  assumes a: "distinct [x, y, z, u]"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   194
  shows "alpha_trm' (Lett (PD x u) t (App (Var x) (Var y)))
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   195
                    (Lett (PD z u) t (App (Var z) (Var y)))"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   196
using a
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   197
apply -
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   198
apply(rule alpha_trm'_alpha_pat'_compat_pat'.intros)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   199
apply(auto simp add: alpha_gen)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   200
apply(rule_tac x="(x \<leftrightarrow> z)" in exI)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   201
apply(auto simp add: fresh_star_def permute_set_eq atom_eqvt)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   202
defer
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   203
apply(rule alpha_trm'_alpha_pat'_compat_pat'.intros)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   204
apply(simp add: alpha_trm'_alpha_pat'_compat_pat'.intros)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   205
prefer 4
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   206
apply(rule alpha_trm'_alpha_pat'_compat_pat'.intros)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   207
(* they can be proved *)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   208
oops
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   209
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   210
lemma
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   211
  assumes a: "distinct [x, y, z, u]"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   212
  shows "alpha_trm' (Lett (PD x u) t (App (Var x) (Var y)))
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   213
                    (Lett (PD z z) t (App (Var z) (Var y)))"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   214
using a
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   215
apply -
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   216
apply(rule alpha_trm'_alpha_pat'_compat_pat'.intros)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   217
apply(auto simp add: alpha_gen)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   218
apply(rule_tac x="(x \<leftrightarrow> z)" in exI)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   219
apply(auto simp add: fresh_star_def permute_set_eq atom_eqvt)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   220
defer
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   221
apply(rule alpha_trm'_alpha_pat'_compat_pat'.intros)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   222
apply(simp add: alpha_trm'_alpha_pat'_compat_pat'.intros)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   223
prefer 4
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   224
apply(rule alpha_trm'_alpha_pat'_compat_pat'.intros)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   225
(* they can be proved *)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   226
oops
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   227
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   228
using a
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   229
apply(clarify)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   230
apply(erule alpha_trm'.cases)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   231
apply(simp_all)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   232
apply(auto simp add: alpha_gen)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   233
apply(erule alpha_trm'.cases)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   234
apply(simp_all)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   235
apply(clarify)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   236
apply(erule compat_pat'.cases)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   237
apply(simp_all)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   238
apply(clarify)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   239
apply(erule alpha_trm'.cases)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   240
apply(simp_all)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   241
done
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   242
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   243
nominal_datatype trm0 =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   244
  Var0 "name"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   245
| App0 "trm0" "trm0"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   246
| Lam0 x::"name" t::"trm0"          bind x in t 
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   247
| Let0 p::"pat0" "trm0" t::"trm0"   bind "f0 p" in t
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   248
and pat0 =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   249
  PN0
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   250
| PS0 "name"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   251
| PD0 "pat0" "pat0"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   252
binder
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   253
  f0::"pat0 \<Rightarrow> atom set"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   254
where 
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   255
  "f0 PN0 = {}"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   256
| "f0 (PS0 x) = {atom x}"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   257
| "f0 (PD0 p1 p2) = (f0 p1) \<union> (f0 p2)"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   258
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   259
thm f0_raw.simps
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   260
(*thm trm0_pat0_induct
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   261
thm trm0_pat0_perm
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   262
thm trm0_pat0_fv
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   263
thm trm0_pat0_bn*)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   264
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   265
text {* example type schemes *}
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   266
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   267
(* does not work yet
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   268
nominal_datatype t =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   269
  Var "name"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   270
| Fun "t" "t"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   271
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   272
nominal_datatype tyS =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   273
  All xs::"name list" ty::"t_raw" bind xs in ty
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   274
*)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   275
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   276
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   277
nominal_datatype t = 
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   278
  Var "name" 
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   279
| Fun "t" "t"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   280
and  tyS = 
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   281
  All xs::"name set" ty::"t" bind xs in ty
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   282
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   283
(* example 1 from Terms.thy *)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   284
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   285
nominal_datatype trm1 =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   286
  Vr1 "name"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   287
| Ap1 "trm1" "trm1"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   288
| Lm1 x::"name" t::"trm1"       bind x in t 
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   289
| Lt1 p::"bp1" "trm1" t::"trm1" bind "bv1 p" in t 
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   290
and bp1 =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   291
  BUnit1
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   292
| BV1 "name"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   293
| BP1 "bp1" "bp1"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   294
binder
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   295
  bv1
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   296
where
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   297
  "bv1 (BUnit1) = {}"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   298
| "bv1 (BV1 x) = {atom x}"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   299
| "bv1 (BP1 bp1 bp2) = (bv1 bp1) \<union> (bv1 bp2)"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   300
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   301
thm bv1_raw.simps
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   302
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   303
(* example 2 from Terms.thy *)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   304
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   305
nominal_datatype trm2 =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   306
  Vr2 "name"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   307
| Ap2 "trm2" "trm2"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   308
| Lm2 x::"name" t::"trm2"       bind x in t
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   309
| Lt2 r::"assign" t::"trm2"    bind "bv2 r" in t
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   310
and assign = 
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   311
  As "name" "trm2"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   312
binder
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   313
  bv2
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   314
where
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   315
  "bv2 (As x t) = {atom x}"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   316
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   317
(* compat should be
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   318
compat (As x t) pi (As x' t') == pi o x = x' & alpha t t'
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   319
*)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   320
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   321
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   322
thm fv_trm2_raw_fv_assign_raw.simps[no_vars]
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   323
thm alpha_trm2_raw_alpha_assign_raw.intros[no_vars]
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   324
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   325
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   326
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   327
text {* example 3 from Terms.thy *}
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   328
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   329
nominal_datatype trm3 =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   330
  Vr3 "name"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   331
| Ap3 "trm3" "trm3"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   332
| Lm3 x::"name" t::"trm3"        bind x in t
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   333
| Lt3 r::"rassigns3" t::"trm3"   bind "bv3 r" in t
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   334
and rassigns3 =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   335
  ANil
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   336
| ACons "name" "trm3" "rassigns3"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   337
binder
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   338
  bv3
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   339
where
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   340
  "bv3 ANil = {}"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   341
| "bv3 (ACons x t as) = {atom x} \<union> (bv3 as)"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   342
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   343
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   344
(* compat should be
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   345
compat (ANil) pi (PNil) \<equiv> TRue
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   346
compat (ACons x t ts) pi (ACons x' t' ts') \<equiv> pi o x = x' \<and> alpha t t' \<and> compat ts pi ts'
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   347
*)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   348
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   349
(* example 4 from Terms.thy *)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   350
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   351
(* fv_eqvt does not work, we need to repaire defined permute functions
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   352
   defined fv and defined alpha... *)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   353
nominal_datatype trm4 =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   354
  Vr4 "name"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   355
| Ap4 "trm4" "trm4 list"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   356
| Lm4 x::"name" t::"trm4"  bind x in t
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   357
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   358
thm alpha_trm4_raw_alpha_trm4_raw_list.intros[no_vars]
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   359
thm fv_trm4_raw_fv_trm4_raw_list.simps[no_vars]
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   360
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   361
(* example 5 from Terms.thy *)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   362
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   363
nominal_datatype trm5 =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   364
  Vr5 "name"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   365
| Ap5 "trm5" "trm5"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   366
| Lt5 l::"lts" t::"trm5"  bind "bv5 l" in t
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   367
and lts =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   368
  Lnil
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   369
| Lcons "name" "trm5" "lts"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   370
binder
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   371
  bv5
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   372
where
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   373
  "bv5 Lnil = {}"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   374
| "bv5 (Lcons n t ltl) = {atom n} \<union> (bv5 ltl)"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   375
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   376
(* example 6 from Terms.thy *)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   377
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   378
(* BV is not respectful, needs to fail*)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   379
nominal_datatype trm6 =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   380
  Vr6 "name"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   381
| Lm6 x::"name" t::"trm6"         bind x in t
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   382
| Lt6 left::"trm6" right::"trm6"  bind "bv6 left" in right
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   383
binder
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   384
  bv6
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   385
where
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   386
  "bv6 (Vr6 n) = {}"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   387
| "bv6 (Lm6 n t) = {atom n} \<union> bv6 t"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   388
| "bv6 (Lt6 l r) = bv6 l \<union> bv6 r"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   389
(* example 7 from Terms.thy *)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   390
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   391
(* BV is not respectful, needs to fail*)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   392
nominal_datatype trm7 =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   393
  Vr7 "name"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   394
| Lm7 l::"name" r::"trm7"   bind l in r
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   395
| Lt7 l::"trm7" r::"trm7"   bind "bv7 l" in r
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   396
binder 
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   397
  bv7 
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   398
where
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   399
  "bv7 (Vr7 n) = {atom n}"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   400
| "bv7 (Lm7 n t) = bv7 t - {atom n}"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   401
| "bv7 (Lt7 l r) = bv7 l \<union> bv7 r"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   402
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   403
(* example 8 from Terms.thy *)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   404
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   405
nominal_datatype foo8 =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   406
  Foo0 "name"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   407
| Foo1 b::"bar8" f::"foo8" bind "bv8 b" in f --"check fo error if this is called foo"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   408
and bar8 =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   409
  Bar0 "name"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   410
| Bar1 "name" s::"name" b::"bar8" bind s in b
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   411
binder 
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   412
  bv8
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   413
where
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   414
  "bv8 (Bar0 x) = {}"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   415
| "bv8 (Bar1 v x b) = {atom v}"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   416
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   417
(* example 9 from Terms.thy *)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   418
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   419
(* BV is not respectful, needs to fail*)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   420
nominal_datatype lam9 =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   421
  Var9 "name"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   422
| Lam9 n::"name" l::"lam9" bind n in l
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   423
and bla9 =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   424
  Bla9 f::"lam9" s::"lam9" bind "bv9 f" in s
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   425
binder
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   426
  bv9
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   427
where
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   428
  "bv9 (Var9 x) = {}"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   429
| "bv9 (Lam9 x b) = {atom x}"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   430
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   431
(* example from my PHD *)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   432
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   433
atom_decl coname
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   434
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   435
nominal_datatype phd =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   436
   Ax "name" "coname"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   437
|  Cut n::"coname" t1::"phd" c::"coname" t2::"phd"              bind n in t1, bind c in t2
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   438
|  AndR c1::"coname" t1::"phd" c2::"coname" t2::"phd" "coname"  bind c1 in t1, bind c2 in t2
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   439
|  AndL1 n::"name" t::"phd" "name"                              bind n in t
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   440
|  AndL2 n::"name" t::"phd" "name"                              bind n in t
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   441
|  ImpL c::"coname" t1::"phd" n::"name" t2::"phd" "name"        bind c in t1, bind n in t2
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   442
|  ImpR c::"coname" n::"name" t::"phd" "coname"                 bind n in t, bind c in t
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   443
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   444
thm alpha_phd_raw.intros[no_vars]
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   445
thm fv_phd_raw.simps[no_vars]
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   446
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   447
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   448
(* example form Leroy 96 about modules; OTT *)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   449
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   450
nominal_datatype mexp =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   451
  Acc "path"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   452
| Stru "body"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   453
| Funct x::"name" "sexp" m::"mexp"    bind x in m
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   454
| FApp "mexp" "path"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   455
| Ascr "mexp" "sexp"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   456
and body =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   457
  Empty
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   458
| Seq c::defn d::"body"     bind "cbinders c" in d
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   459
and defn =  
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   460
  Type "name" "tyty"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   461
| Dty "name"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   462
| DStru "name" "mexp"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   463
| Val "name" "trmtrm"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   464
and sexp =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   465
  Sig sbody
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   466
| SFunc "name" "sexp" "sexp"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   467
and sbody = 
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   468
  SEmpty
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   469
| SSeq C::spec D::sbody    bind "Cbinders C" in D
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   470
and spec =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   471
  Type1 "name" 
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   472
| Type2 "name" "tyty"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   473
| SStru "name" "sexp"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   474
| SVal "name" "tyty"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   475
and tyty =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   476
  Tyref1 "name"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   477
| Tyref2 "path" "tyty"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   478
| Fun "tyty" "tyty"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   479
and path =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   480
  Sref1 "name"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   481
| Sref2 "path" "name"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   482
and trmtrm =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   483
  Tref1 "name"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   484
| Tref2 "path" "name"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   485
| Lam' v::"name" "tyty" M::"trmtrm"  bind v in M
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   486
| App' "trmtrm" "trmtrm"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   487
| Let' "body" "trmtrm"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   488
binder
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   489
    cbinders :: "defn \<Rightarrow> atom set"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   490
and Cbinders :: "spec \<Rightarrow> atom set"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   491
where
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   492
  "cbinders (Type t T) = {atom t}"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   493
| "cbinders (Dty t) = {atom t}"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   494
| "cbinders (DStru x s) = {atom x}"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   495
| "cbinders (Val v M) = {atom v}"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   496
| "Cbinders (Type1 t) = {atom t}"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   497
| "Cbinders (Type2 t T) = {atom t}"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   498
| "Cbinders (SStru x S) = {atom x}"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   499
| "Cbinders (SVal v T) = {atom v}"  
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   500
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   501
(* core haskell *)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   502
print_theorems
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   503
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   504
atom_decl var
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   505
atom_decl tvar
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   506
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   507
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   508
(* there are types, coercion types and regular types *)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   509
nominal_datatype tkind = 
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   510
  KStar
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   511
| KFun "tkind" "tkind"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   512
and ckind =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   513
  CKEq "ty" "ty" 
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   514
and ty =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   515
  TVar "tvar"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   516
| TC "string"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   517
| TApp "ty" "ty"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   518
| TFun "string" "ty list"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   519
| TAll tv::"tvar" "tkind" T::"ty"  bind tv in T
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   520
| TEq "ty" "ty" "ty"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   521
and co =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   522
  CC "string"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   523
| CApp "co" "co"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   524
| CFun "string" "co list"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   525
| CAll tv::"tvar" "ckind" C::"co"  bind tv in C
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   526
| CEq "co" "co" "co"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   527
| CSym "co"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   528
| CCir "co" "co"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   529
| CLeft "co"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   530
| CRight "co"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   531
| CSim "co"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   532
| CRightc "co"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   533
| CLeftc "co"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   534
| CCoe "co" "co"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   535
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   536
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   537
typedecl ty --"hack since ty is not yet defined"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   538
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   539
abbreviation 
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   540
  "atoms A \<equiv> atom ` A"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   541
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   542
nominal_datatype trm =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   543
  Var "var"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   544
| C "string"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   545
| LAM tv::"tvar" "kind" t::"trm"   bind tv in t 
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   546
| APP "trm" "ty"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   547
| Lam v::"var" "ty" t::"trm"       bind v in t
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   548
| App "trm" "trm"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   549
| Let x::"var" "ty" "trm" t::"trm" bind x in t
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   550
| Case "trm" "assoc list"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   551
| Cast "trm" "ty"                   --"ty is supposed to be a coercion type only"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   552
and assoc = 
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   553
  A p::"pat" t::"trm" bind "bv p" in t 
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   554
and pat = 
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   555
  K "string" "(tvar \<times> kind) list" "(var \<times> ty) list"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   556
binder
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   557
 bv :: "pat \<Rightarrow> atom set"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   558
where
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   559
 "bv (K s ts vs) = (atoms (set (map fst ts))) \<union> (atoms (set (map fst vs)))"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   560
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   561
(*
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   562
compat (K s ts vs) pi (K s' ts' vs') ==
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   563
  s = s' & 
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   564
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   565
*)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   566
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   567
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   568
(*thm bv_raw.simps*)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   569
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   570
(* example 3 from Peter Sewell's bestiary *)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   571
nominal_datatype exp =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   572
  VarP "name"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   573
| AppP "exp" "exp"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   574
| LamP x::"name" e::"exp" bind x in e
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   575
| LetP x::"name" p::"pat" e1::"exp" e2::"exp" bind x in e2, bind "bp p" in e1
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   576
and pat =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   577
  PVar "name"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   578
| PUnit
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   579
| PPair "pat" "pat"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   580
binder
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   581
  bp :: "pat \<Rightarrow> atom set"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   582
where
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   583
  "bp (PVar x) = {atom x}"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   584
| "bp (PUnit) = {}"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   585
| "bp (PPair p1 p2) = bp p1 \<union> bp p2"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   586
thm alpha_exp_raw_alpha_pat_raw.intros
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   587
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   588
(* example 6 from Peter Sewell's bestiary *)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   589
nominal_datatype exp6 =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   590
  EVar name
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   591
| EPair exp6 exp6
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   592
| ELetRec x::name p::pat6 e1::exp6 e2::exp6 bind x in e1, bind x in e2, bind "bp6 p" in e1
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   593
and pat6 =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   594
  PVar' name
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   595
| PUnit'
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   596
| PPair' pat6 pat6
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   597
binder
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   598
  bp6 :: "pat6 \<Rightarrow> atom set"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   599
where
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   600
  "bp6 (PVar' x) = {atom x}"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   601
| "bp6 (PUnit') = {}"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   602
| "bp6 (PPair' p1 p2) = bp6 p1 \<union> bp6 p2"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   603
thm alpha_exp6_raw_alpha_pat6_raw.intros
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   604
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   605
(* example 7 from Peter Sewell's bestiary *)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   606
nominal_datatype exp7 =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   607
  EVar name
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   608
| EUnit
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   609
| EPair exp7 exp7
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   610
| ELetRec l::lrbs e::exp7 bind "b7s l" in e, bind "b7s l" in l
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   611
and lrb =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   612
  Assign name exp7
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   613
and lrbs =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   614
  Single lrb
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   615
| More lrb lrbs
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   616
binder
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   617
  b7 :: "lrb \<Rightarrow> atom set" and
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   618
  b7s :: "lrbs \<Rightarrow> atom set"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   619
where
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   620
  "b7 (Assign x e) = {atom x}"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   621
| "b7s (Single a) = b7 a"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   622
| "b7s (More a as) = (b7 a) \<union> (b7s as)"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   623
thm alpha_exp7_raw_alpha_lrb_raw_alpha_lrbs_raw.intros
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   624
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   625
(* example 8 from Peter Sewell's bestiary *)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   626
nominal_datatype exp8 =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   627
  EVar name
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   628
| EUnit
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   629
| EPair exp8 exp8
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   630
| ELetRec l::lrbs8 e::exp8 bind "b_lrbs8 l" in e, bind "b_lrbs8 l" in l
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   631
and fnclause =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   632
  K x::name p::pat8 e::exp8 bind "b_pat p" in e
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   633
and fnclauses =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   634
  S fnclause
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   635
| ORs fnclause fnclauses
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   636
and lrb8 =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   637
  Clause fnclauses
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   638
and lrbs8 =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   639
  Single lrb8
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   640
| More lrb8 lrbs8
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   641
and pat8 =
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   642
  PVar name
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   643
| PUnit
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   644
| PPair pat8 pat8
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   645
binder
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   646
  b_lrbs8 :: "lrbs8 \<Rightarrow> atom set" and
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   647
  b_pat :: "pat8 \<Rightarrow> atom set" and
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   648
  b_fnclauses :: "fnclauses \<Rightarrow> atom set" and
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   649
  b_fnclause :: "fnclause \<Rightarrow> atom set" and
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   650
  b_lrb8 :: "lrb8 \<Rightarrow> atom set"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   651
where
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   652
  "b_lrbs8 (Single l) = b_lrb8 l"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   653
| "b_lrbs8 (More l ls) = b_lrb8 l \<union> b_lrbs8 ls"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   654
| "b_pat (PVar x) = {atom x}"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   655
| "b_pat (PUnit) = {}"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   656
| "b_pat (PPair p1 p2) = b_pat p1 \<union> b_pat p2"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   657
| "b_fnclauses (S fc) = (b_fnclause fc)"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   658
| "b_fnclauses (ORs fc fcs) = (b_fnclause fc) \<union> (b_fnclauses fcs)"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   659
| "b_lrb8 (Clause fcs) = (b_fnclauses fcs)"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   660
| "b_fnclause (K x pat exp8) = {atom x}"
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   661
thm alpha_exp8_raw_alpha_fnclause_raw_alpha_fnclauses_raw_alpha_lrb8_raw_alpha_lrbs8_raw_alpha_pat8_raw.intros
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   662
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   663
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   664
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   665
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   666
(* example 9 from Peter Sewell's bestiary *)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   667
(* run out of steam at the moment *)
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   668
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   669
end
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   670
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   671
75f1d7681a24 added first test about new compat
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   672