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