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