Nominal/Ex/NBE.thy
author Christian Urban <urbanc@in.tum.de>
Sat, 16 Jul 2011 21:36:43 +0100
changeset 2968 ddb69d9f45d0
parent 2967 d7e8b9b78e28
child 2969 0f1b44c9c5a0
permissions -rw-r--r--
more one the NBE example
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2952
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
theory Lambda
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
imports 
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
  "../Nominal2"
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
begin
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
atom_decl name
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
nominal_datatype lam =
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
  Var "name"
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
| App "lam" "lam"
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
| Lam x::"name" l::"lam"  binds x in l ("Lam [_]. _" [100, 100] 100)
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
nominal_datatype sem =
2956
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
    16
  L e::"env" x::"name" l::"lam" binds x "bn e" in l
2952
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
| N "neu"
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
and neu = 
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
  V "name"
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
| A "neu" "sem"
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
and env =
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
  ENil
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
| ECons "env" "name" "sem"
2955
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
    24
binder
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
    25
  bn
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
    26
where
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
    27
  "bn ENil = []"
2956
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
    28
| "bn (ECons env x v) = (atom x) # (bn env)" 
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
    29
2968
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
    30
nominal_primrec  (invariant "\<lambda>x y. case x of Inl (x1, y1) \<Rightarrow> 
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
    31
  supp y \<subseteq> (supp y1 - set (bn x1)) \<union> (fv_bn x1) | Inr (x2, y2) \<Rightarrow> supp y \<subseteq> supp x2 \<union> supp y2")
2952
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
  evals :: "env \<Rightarrow> lam \<Rightarrow> sem" and
2967
d7e8b9b78e28 some improvements to the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2956
diff changeset
    33
  evals_aux :: "sem \<Rightarrow> sem \<Rightarrow> sem"
2952
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
where
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
  "evals ENil (Var x) = N (V x)"
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
| "evals (ECons tail y v) (Var x) = (if x = y then v else evals tail (Var x))" 
2967
d7e8b9b78e28 some improvements to the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2956
diff changeset
    37
| "atom x \<sharp> env \<Longrightarrow> evals env (Lam [x]. t) = L env x t"
d7e8b9b78e28 some improvements to the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2956
diff changeset
    38
| "evals env (App t1 t2) = evals_aux (evals env t1) (evals env t2)"
d7e8b9b78e28 some improvements to the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2956
diff changeset
    39
| "evals_aux (L cenv x t) t' = evals (ECons cenv x t') t"
d7e8b9b78e28 some improvements to the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2956
diff changeset
    40
| "evals_aux (N n) t' = N (A n t')"
d7e8b9b78e28 some improvements to the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2956
diff changeset
    41
apply(simp add: eqvt_def  evals_evals_aux_graph_def)
2955
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
    42
apply(perm_simp)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
    43
apply(simp)
2968
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
    44
apply(erule evals_evals_aux_graph.induct)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
    45
apply(simp add: sem_neu_env.supp lam.supp sem_neu_env.bn_defs)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
    46
apply(simp add: sem_neu_env.supp lam.supp sem_neu_env.bn_defs)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
    47
apply(rule conjI)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
    48
apply(rule impI)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
    49
apply(blast)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
    50
apply(rule impI)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
    51
apply(simp add: supp_at_base)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
    52
apply(blast)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
    53
apply(simp add: sem_neu_env.supp lam.supp sem_neu_env.bn_defs)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
    54
apply(blast)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
    55
apply(simp add: sem_neu_env.supp lam.supp sem_neu_env.bn_defs)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
    56
apply(blast)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
    57
apply(simp add: sem_neu_env.supp lam.supp sem_neu_env.bn_defs)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
    58
apply(blast)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
    59
apply(simp add: sem_neu_env.supp lam.supp sem_neu_env.bn_defs)
2952
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    60
--"completeness"
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    61
apply(case_tac x)
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    62
apply(simp)
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    63
apply(case_tac a)
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    64
apply(simp)
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    65
apply(case_tac aa rule: sem_neu_env.exhaust(3))
2967
d7e8b9b78e28 some improvements to the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2956
diff changeset
    66
apply(simp add: sem_neu_env.fresh)
2952
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    67
apply(case_tac b rule: lam.exhaust)
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    68
apply(metis)+
2967
d7e8b9b78e28 some improvements to the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2956
diff changeset
    69
apply(case_tac aa rule: sem_neu_env.exhaust(3))
d7e8b9b78e28 some improvements to the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2956
diff changeset
    70
apply(rule_tac y="b" and c="env" in lam.strong_exhaust)
2952
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    71
apply(metis)+
2967
d7e8b9b78e28 some improvements to the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2956
diff changeset
    72
apply(simp add: fresh_star_def)
d7e8b9b78e28 some improvements to the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2956
diff changeset
    73
apply(simp)
d7e8b9b78e28 some improvements to the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2956
diff changeset
    74
apply(rule_tac y="b" and c="ECons env name sem" in lam.strong_exhaust)
d7e8b9b78e28 some improvements to the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2956
diff changeset
    75
apply(metis)+
d7e8b9b78e28 some improvements to the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2956
diff changeset
    76
apply(simp add: fresh_star_def)
2952
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    77
apply(simp)
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    78
apply(case_tac b)
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    79
apply(simp)
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    80
apply(case_tac a rule: sem_neu_env.exhaust(1))
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    81
apply(metis)+
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    82
--"compatibility"
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    83
apply(all_trivials)
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    84
apply(simp)
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    85
apply(simp)
2955
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
    86
defer
2952
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    87
apply(simp)
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    88
apply(simp)
2953
80f01215d1a6 Setup eqvt_at for first goal
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2952
diff changeset
    89
apply (simp add: meta_eq_to_obj_eq[OF evals_def, symmetric, unfolded fun_eq_iff])
2967
d7e8b9b78e28 some improvements to the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2956
diff changeset
    90
apply (subgoal_tac "eqvt_at (\<lambda>(a, b). evals a b) (ECons cenv x t'a, t)")
d7e8b9b78e28 some improvements to the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2956
diff changeset
    91
apply (subgoal_tac "eqvt_at (\<lambda>(a, b). evals a b) (ECons cenva xa t'a, ta)")
d7e8b9b78e28 some improvements to the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2956
diff changeset
    92
apply (thin_tac "eqvt_at evals_evals_aux_sumC (Inl (ECons cenv x t'a, t))")
d7e8b9b78e28 some improvements to the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2956
diff changeset
    93
apply (thin_tac "eqvt_at evals_evals_aux_sumC (Inl (ECons cenva xa t'a, ta))")
2954
dc6007dd9c30 a little further with NBE
Christian Urban <urbanc@in.tum.de>
parents: 2953
diff changeset
    94
apply(erule conjE)+
2952
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    95
defer
2953
80f01215d1a6 Setup eqvt_at for first goal
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2952
diff changeset
    96
apply (simp_all add: eqvt_at_def evals_def)[3]
2967
d7e8b9b78e28 some improvements to the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2956
diff changeset
    97
apply(simp add: sem_neu_env.alpha_refl)
d7e8b9b78e28 some improvements to the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2956
diff changeset
    98
apply(erule conjE)+
d7e8b9b78e28 some improvements to the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2956
diff changeset
    99
apply(erule_tac c="(env, enva)" in Abs_lst1_fcb2)
d7e8b9b78e28 some improvements to the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2956
diff changeset
   100
apply(simp add: Abs_fresh_iff)
d7e8b9b78e28 some improvements to the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2956
diff changeset
   101
apply(simp add: fresh_star_def)
d7e8b9b78e28 some improvements to the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2956
diff changeset
   102
apply(perm_simp)
d7e8b9b78e28 some improvements to the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2956
diff changeset
   103
apply(simp add: fresh_star_Pair perm_supp_eq)
d7e8b9b78e28 some improvements to the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2956
diff changeset
   104
apply(perm_simp)
d7e8b9b78e28 some improvements to the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2956
diff changeset
   105
apply(simp add: fresh_star_Pair perm_supp_eq)
2968
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   106
apply(simp add: sem_neu_env.bn_defs sem_neu_env.supp)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   107
using at_set_avoiding3
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   108
apply -
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   109
apply(drule_tac x="set (atom x # bn cenv)" in meta_spec)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   110
apply(drule_tac x="(cenv, cenva, x, xa, t, ta, t'a)" in meta_spec)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   111
apply(drule_tac x="[atom x # bn cenv]lst. t" in meta_spec)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   112
apply(simp (no_asm_use) add: finite_supp Abs_fresh_star_iff)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   113
apply(drule meta_mp)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   114
apply(simp add: fresh_star_def)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   115
apply(erule exE)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   116
apply(erule conjE)+
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   117
thm Abs_fresh_star_iff
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   118
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   119
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   120
apply(subgoal_tac "\<exists>c::name. atom c \<sharp> (x, xa, cenv, cenva, t, ta, t'a)")
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   121
prefer 2
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   122
apply(rule obtain_fresh)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   123
apply(blast)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   124
apply(erule exE)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   125
apply(drule trans)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   126
apply(rule sym)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   127
apply(rule_tac a="xa" and b="c" in flip_fresh_fresh)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   128
apply(simp add: Abs_fresh_iff)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   129
apply(simp add: Abs_fresh_iff fresh_Pair fresh_at_base)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   130
apply(perm_simp)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   131
apply(simp)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   132
apply(rotate_tac 4)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   133
apply(drule sym)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   134
apply(rotate_tac 5)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   135
apply(drule trans)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   136
apply(rule sym)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   137
apply(rule_tac a="x" and b="c" in flip_fresh_fresh)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   138
apply(simp add: Abs_fresh_iff)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   139
apply(simp add: Abs_fresh_iff fresh_Pair fresh_at_base)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   140
apply(perm_simp)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   141
apply(simp)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   142
(* HERE *)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   143
apply(auto)[1]
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   144
apply(rule fresh_eqvt_at)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   145
back
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   146
apply(assumption)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   147
apply(simp add: finite_supp)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   148
apply(rule_tac S="supp (env, y, x, t)" in supports_fresh)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   149
apply(simp add: supports_def fresh_def[symmetric])
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   150
apply(perm_simp)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   151
apply(simp add: swap_fresh_fresh fresh_Pair)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   152
apply(simp add: finite_supp)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   153
apply(simp add: fresh_def[symmetric])
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   154
apply(simp add: eqvt_at_def)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   155
apply(simp add: eqvt_at_def[symmetric])
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   156
apply(perm_simp)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   157
apply(simp add: flip_fresh_fresh)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   158
apply(rule sym)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   159
apply(rule trans)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   160
2952
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   161
sorry
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   162
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   163
(* can probably not proved by a trivial size argument *)
2968
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   164
termination apply(lexicographic_order)
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   165
ddb69d9f45d0 more one the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2967
diff changeset
   166
sorry
2952
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   167
2955
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   168
lemma [eqvt]:
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   169
  shows "(p \<bullet> evals env t) = evals (p \<bullet> env) (p \<bullet> t)"
2967
d7e8b9b78e28 some improvements to the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2956
diff changeset
   170
  and "(p \<bullet> evals_aux v s) = evals_aux (p \<bullet> v) (p \<bullet> s)"
2955
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   171
sorry
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   172
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   173
(* fixme: should be a provided lemma *)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   174
lemma fv_bn_finite:
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   175
  shows "finite (fv_bn env)"
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   176
apply(induct env rule: sem_neu_env.inducts(3))
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   177
apply(auto simp add: sem_neu_env.supp finite_supp)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   178
done
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   179
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   180
lemma test:
2956
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   181
  fixes env::"env"
2955
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   182
  shows "supp (evals env t) \<subseteq> (supp t - set (bn env)) \<union> (fv_bn env)"
2967
d7e8b9b78e28 some improvements to the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2956
diff changeset
   183
  and "supp (evals_aux s v) \<subseteq> (supp s) \<union> (supp v)"
d7e8b9b78e28 some improvements to the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2956
diff changeset
   184
apply(induct env t and s v rule: evals_evals_aux.induct)
2955
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   185
apply(simp add: sem_neu_env.supp lam.supp supp_Nil sem_neu_env.bn_defs)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   186
apply(simp add: sem_neu_env.supp lam.supp supp_Nil supp_Cons sem_neu_env.bn_defs)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   187
apply(rule conjI)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   188
apply(auto)[1]
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   189
apply(rule impI)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   190
apply(simp)
2956
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   191
apply(simp add: supp_at_base)
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   192
apply(blast)
2955
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   193
apply(simp)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   194
apply(subst sem_neu_env.supp)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   195
apply(simp add: sem_neu_env.supp lam.supp)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   196
apply(auto)[1]
2956
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   197
apply(simp add: lam.supp sem_neu_env.supp)
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   198
apply(blast)
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   199
apply(simp add: sem_neu_env.supp sem_neu_env.bn_defs)
2967
d7e8b9b78e28 some improvements to the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2956
diff changeset
   200
apply(blast)
2956
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   201
apply(simp add: sem_neu_env.supp)
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   202
done
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   203
2955
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   204
2954
dc6007dd9c30 a little further with NBE
Christian Urban <urbanc@in.tum.de>
parents: 2953
diff changeset
   205
nominal_primrec
dc6007dd9c30 a little further with NBE
Christian Urban <urbanc@in.tum.de>
parents: 2953
diff changeset
   206
  reify :: "sem \<Rightarrow> lam" and
dc6007dd9c30 a little further with NBE
Christian Urban <urbanc@in.tum.de>
parents: 2953
diff changeset
   207
  reifyn :: "neu \<Rightarrow> lam"
dc6007dd9c30 a little further with NBE
Christian Urban <urbanc@in.tum.de>
parents: 2953
diff changeset
   208
where
2955
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   209
  "atom x \<sharp> (env, y, t) \<Longrightarrow> reify (L env y t) = Lam [x]. (reify (evals (ECons env y (N (V x))) t))"
2954
dc6007dd9c30 a little further with NBE
Christian Urban <urbanc@in.tum.de>
parents: 2953
diff changeset
   210
| "reify (N n) = reifyn n"
dc6007dd9c30 a little further with NBE
Christian Urban <urbanc@in.tum.de>
parents: 2953
diff changeset
   211
| "reifyn (V x) = Var x"
dc6007dd9c30 a little further with NBE
Christian Urban <urbanc@in.tum.de>
parents: 2953
diff changeset
   212
| "reifyn (A n d) = App (reifyn n) (reify d)"
2955
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   213
apply(subgoal_tac "\<And>p x y. reify_reifyn_graph x y \<Longrightarrow> reify_reifyn_graph (p \<bullet> x) (p \<bullet> y)")
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   214
apply(simp add: eqvt_def)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   215
apply(simp add: permute_fun_def)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   216
apply(rule allI)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   217
apply(rule ext)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   218
apply(rule ext)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   219
apply(rule iffI)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   220
apply(drule_tac x="p" in meta_spec)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   221
apply(drule_tac x="- p \<bullet> x" in meta_spec)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   222
apply(drule_tac x="- p \<bullet> xa" in meta_spec)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   223
apply(simp add: permute_bool_def)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   224
apply(simp add: permute_bool_def)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   225
apply(erule reify_reifyn_graph.induct)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   226
apply(perm_simp)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   227
apply(rule reify_reifyn_graph.intros)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   228
apply(rule_tac p="-p" in permute_boolE)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   229
apply(perm_simp add: permute_minus_cancel)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   230
apply(simp)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   231
apply(simp)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   232
apply(perm_simp)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   233
apply(rule reify_reifyn_graph.intros)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   234
apply(simp)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   235
apply(perm_simp)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   236
apply(rule reify_reifyn_graph.intros)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   237
apply(perm_simp)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   238
apply(rule reify_reifyn_graph.intros)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   239
apply(simp)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   240
apply(simp)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   241
apply(rule TrueI)
2954
dc6007dd9c30 a little further with NBE
Christian Urban <urbanc@in.tum.de>
parents: 2953
diff changeset
   242
--"completeness"
dc6007dd9c30 a little further with NBE
Christian Urban <urbanc@in.tum.de>
parents: 2953
diff changeset
   243
apply(case_tac x)
dc6007dd9c30 a little further with NBE
Christian Urban <urbanc@in.tum.de>
parents: 2953
diff changeset
   244
apply(simp)
dc6007dd9c30 a little further with NBE
Christian Urban <urbanc@in.tum.de>
parents: 2953
diff changeset
   245
apply(case_tac a rule: sem_neu_env.exhaust(1))
2955
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   246
apply(subgoal_tac "\<exists>x::name. atom x \<sharp> (env, name, lam)")
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   247
apply(metis)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   248
apply(rule obtain_fresh)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   249
apply(blast)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   250
apply(blast)
2954
dc6007dd9c30 a little further with NBE
Christian Urban <urbanc@in.tum.de>
parents: 2953
diff changeset
   251
apply(case_tac b rule: sem_neu_env.exhaust(2))
dc6007dd9c30 a little further with NBE
Christian Urban <urbanc@in.tum.de>
parents: 2953
diff changeset
   252
apply(simp)
dc6007dd9c30 a little further with NBE
Christian Urban <urbanc@in.tum.de>
parents: 2953
diff changeset
   253
apply(simp)
dc6007dd9c30 a little further with NBE
Christian Urban <urbanc@in.tum.de>
parents: 2953
diff changeset
   254
apply(metis)
dc6007dd9c30 a little further with NBE
Christian Urban <urbanc@in.tum.de>
parents: 2953
diff changeset
   255
--"compatibility"
dc6007dd9c30 a little further with NBE
Christian Urban <urbanc@in.tum.de>
parents: 2953
diff changeset
   256
apply(all_trivials)
dc6007dd9c30 a little further with NBE
Christian Urban <urbanc@in.tum.de>
parents: 2953
diff changeset
   257
defer
dc6007dd9c30 a little further with NBE
Christian Urban <urbanc@in.tum.de>
parents: 2953
diff changeset
   258
apply(simp)
dc6007dd9c30 a little further with NBE
Christian Urban <urbanc@in.tum.de>
parents: 2953
diff changeset
   259
apply(simp)
2955
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   260
apply(simp)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   261
apply(erule conjE)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   262
apply (simp add: meta_eq_to_obj_eq[OF reify_def, symmetric, unfolded fun_eq_iff])
2956
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   263
apply (subgoal_tac "eqvt_at (\<lambda>t. reify t) (evals (ECons env y (N (V x))) t)")
2955
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   264
apply (subgoal_tac "eqvt_at (\<lambda>t. reify t) (evals (ECons enva ya (N (V xa))) ta)")
2956
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   265
apply (thin_tac "eqvt_at reify_reifyn_sumC (Inl (evals (ECons env y (N (V x))) t))")
2955
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   266
apply (thin_tac "eqvt_at reify_reifyn_sumC (Inl (evals (ECons enva ya (N (V xa))) ta))")
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   267
defer
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   268
apply (simp_all add: eqvt_at_def reify_def)[2]
2956
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   269
apply(subgoal_tac "\<exists>c::name. atom c \<sharp> (x, xa, env, enva, y, ya, t, ta)")
2955
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   270
prefer 2
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   271
apply(rule obtain_fresh)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   272
apply(blast)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   273
apply(erule exE)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   274
apply(rule trans)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   275
apply(rule sym)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   276
apply(rule_tac a="x" and b="c" in flip_fresh_fresh)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   277
apply(simp add: Abs_fresh_iff)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   278
apply(simp add: Abs_fresh_iff fresh_Pair)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   279
apply(auto)[1]
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   280
apply(rule fresh_eqvt_at)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   281
back
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   282
apply(assumption)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   283
apply(simp add: finite_supp)
2956
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   284
apply(rule_tac S="supp (env, y, x, t)" in supports_fresh)
2955
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   285
apply(simp add: supports_def fresh_def[symmetric])
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   286
apply(perm_simp)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   287
apply(simp add: swap_fresh_fresh fresh_Pair)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   288
apply(simp add: finite_supp)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   289
apply(simp add: fresh_def[symmetric])
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   290
apply(simp add: eqvt_at_def)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   291
apply(simp add: eqvt_at_def[symmetric])
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   292
apply(perm_simp)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   293
apply(simp add: flip_fresh_fresh)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   294
apply(rule sym)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   295
apply(rule trans)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   296
apply(rule sym)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   297
apply(rule_tac a="xa" and b="c" in flip_fresh_fresh)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   298
apply(simp add: Abs_fresh_iff)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   299
apply(simp add: Abs_fresh_iff fresh_Pair)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   300
apply(auto)[1]
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   301
apply(rule fresh_eqvt_at)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   302
back
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   303
apply(assumption)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   304
apply(simp add: finite_supp)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   305
apply(rule_tac S="supp (enva, ya, xa, ta)" in supports_fresh)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   306
apply(simp add: supports_def fresh_def[symmetric])
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   307
apply(perm_simp)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   308
apply(simp add: swap_fresh_fresh fresh_Pair)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   309
apply(simp add: finite_supp)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   310
apply(simp add: fresh_def[symmetric])
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   311
apply(simp add: eqvt_at_def)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   312
apply(simp add: eqvt_at_def[symmetric])
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   313
apply(perm_simp)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   314
apply(simp add: flip_fresh_fresh)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   315
apply(simp (no_asm) add: Abs1_eq_iff)
2956
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   316
thm at_set_avoiding3
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   317
using at_set_avoiding3
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   318
apply -
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   319
apply(drule_tac x="set (atom y # bn env)" in meta_spec)
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   320
apply(drule_tac x="(env, enva)" in meta_spec)
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   321
apply(drule_tac x="[atom y # bn env]lst. t" in meta_spec)
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   322
apply(simp (no_asm_use) add: finite_supp)
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   323
apply(drule meta_mp)
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   324
apply(rule Abs_fresh_star)
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   325
apply(auto)[1]
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   326
apply(erule exE)
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   327
apply(erule conjE)+
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   328
apply(drule_tac q="(x \<leftrightarrow> c)" in eqvt_at_perm)
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   329
apply(perm_simp)
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   330
apply(simp add: flip_fresh_fresh fresh_Pair)
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   331
apply(drule_tac q="(xa \<leftrightarrow> c)" in eqvt_at_perm)
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   332
apply(perm_simp)
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   333
apply(simp add: flip_fresh_fresh fresh_Pair)
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   334
apply(drule sym)
2967
d7e8b9b78e28 some improvements to the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2956
diff changeset
   335
(* HERE *)
d7e8b9b78e28 some improvements to the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2956
diff changeset
   336
apply(rotate_tac 9)
d7e8b9b78e28 some improvements to the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2956
diff changeset
   337
apply(drule sym)
2956
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   338
apply(rotate_tac 9)
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   339
apply(drule trans)
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   340
apply(rule sym)
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   341
apply(rule_tac p="p" in supp_perm_eq)
2967
d7e8b9b78e28 some improvements to the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2956
diff changeset
   342
apply(assumption)
2956
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   343
apply(simp)
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   344
apply(perm_simp)
2967
d7e8b9b78e28 some improvements to the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2956
diff changeset
   345
apply(simp (no_asm_use) add: Abs_eq_iff2 alphas)
d7e8b9b78e28 some improvements to the NBE example
Christian Urban <urbanc@in.tum.de>
parents: 2956
diff changeset
   346
apply(erule conjE | erule exE)+
2956
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   347
apply(clarify)
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   348
apply(rule trans)
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   349
apply(rule sym)
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   350
apply(rule_tac p="pa" in perm_supp_eq)
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   351
defer
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   352
apply(rule sym)
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   353
apply(rule trans)
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   354
apply(rule sym)
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   355
apply(rule_tac p="p" in perm_supp_eq)
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   356
defer
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   357
apply(simp add: atom_eqvt)
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   358
apply(drule_tac q="(x \<leftrightarrow> c)" in eqvt_at_perm)
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   359
apply(perm_simp)
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   360
apply(simp add: flip_fresh_fresh fresh_Pair)
7e1c309bf820 more on NBE
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
   361
2955
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   362
apply(rule sym)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   363
apply(erule_tac Abs_lst1_fcb2')
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   364
apply(rule fresh_eqvt_at)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   365
back
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   366
apply(drule_tac q="(c \<leftrightarrow> x)" in eqvt_at_perm)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   367
apply(perm_simp)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   368
apply(simp add: flip_fresh_fresh)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   369
apply(simp add: finite_supp)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   370
apply(rule supports_fresh)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   371
apply(rule_tac S="supp (enva, ya, xa, ta)" in supports_fresh)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   372
apply(simp add: supports_def fresh_def[symmetric])
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   373
apply(perm_simp)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   374
apply(simp add: swap_fresh_fresh fresh_Pair)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   375
apply(simp add: finite_supp)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   376
apply(simp add: fresh_def[symmetric])
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   377
apply(simp add: eqvt_at_def)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   378
apply(simp add: eqvt_at_def[symmetric])
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   379
apply(perm_simp)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   380
apply(rule fresh_eqvt_at)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   381
back
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   382
apply(drule_tac q="(c \<leftrightarrow> x)" in eqvt_at_perm)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   383
apply(perm_simp)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   384
apply(simp add: flip_fresh_fresh)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   385
apply(assumption)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2954
diff changeset
   386
apply(simp add: finite_supp)
2954
dc6007dd9c30 a little further with NBE
Christian Urban <urbanc@in.tum.de>
parents: 2953
diff changeset
   387
sorry
2952
e4c2854833ad attempt for NBE
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   388
2954
dc6007dd9c30 a little further with NBE
Christian Urban <urbanc@in.tum.de>
parents: 2953
diff changeset
   389
termination sorry
dc6007dd9c30 a little further with NBE
Christian Urban <urbanc@in.tum.de>
parents: 2953
diff changeset
   390
dc6007dd9c30 a little further with NBE
Christian Urban <urbanc@in.tum.de>
parents: 2953
diff changeset
   391
definition
dc6007dd9c30 a little further with NBE
Christian Urban <urbanc@in.tum.de>
parents: 2953
diff changeset
   392
  eval :: "lam \<Rightarrow> sem"
dc6007dd9c30 a little further with NBE
Christian Urban <urbanc@in.tum.de>
parents: 2953
diff changeset
   393
where
dc6007dd9c30 a little further with NBE
Christian Urban <urbanc@in.tum.de>
parents: 2953
diff changeset
   394
  "eval t = evals ENil t"
dc6007dd9c30 a little further with NBE
Christian Urban <urbanc@in.tum.de>
parents: 2953
diff changeset
   395
dc6007dd9c30 a little further with NBE
Christian Urban <urbanc@in.tum.de>
parents: 2953
diff changeset
   396
definition
dc6007dd9c30 a little further with NBE
Christian Urban <urbanc@in.tum.de>
parents: 2953
diff changeset
   397
  normalize :: "lam \<Rightarrow> lam"
dc6007dd9c30 a little further with NBE
Christian Urban <urbanc@in.tum.de>
parents: 2953
diff changeset
   398
where
dc6007dd9c30 a little further with NBE
Christian Urban <urbanc@in.tum.de>
parents: 2953
diff changeset
   399
  "normalize t = reify (eval t)"
dc6007dd9c30 a little further with NBE
Christian Urban <urbanc@in.tum.de>
parents: 2953
diff changeset
   400
dc6007dd9c30 a little further with NBE
Christian Urban <urbanc@in.tum.de>
parents: 2953
diff changeset
   401
end