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