1797
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1
theory Lambda
2454
+ − 2
imports "../Nominal2"
1594
+ − 3
begin
+ − 4
2784
+ − 5
1594
+ − 6
atom_decl name
+ − 7
2436
+ − 8
nominal_datatype lam =
1800
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 9
Var "name"
2436
+ − 10
| App "lam" "lam"
2683
+ − 11
| Lam x::"name" l::"lam" bind x in l ("Lam [_]. _" [100, 100] 100)
2431
331873ebc5cd
can now deal with type variables in nominal datatype definitions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 12
2779
+ − 13
2765
7ac5e5c86c7d
introduced framework for finetuning eqvt-rules; this solves problem with permute_pure called in nominal_inductive
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 14
inductive
7ac5e5c86c7d
introduced framework for finetuning eqvt-rules; this solves problem with permute_pure called in nominal_inductive
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 15
triv :: "lam \<Rightarrow> nat \<Rightarrow> bool"
7ac5e5c86c7d
introduced framework for finetuning eqvt-rules; this solves problem with permute_pure called in nominal_inductive
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 16
where
7ac5e5c86c7d
introduced framework for finetuning eqvt-rules; this solves problem with permute_pure called in nominal_inductive
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 17
Var: "triv (Var x) n"
2779
+ − 18
| App: "\<lbrakk>triv t1 n; triv t2 n\<rbrakk> \<Longrightarrow> triv (App t1 t2) n"
2765
7ac5e5c86c7d
introduced framework for finetuning eqvt-rules; this solves problem with permute_pure called in nominal_inductive
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 19
2777
75a95431cd8b
proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 20
lemma
75a95431cd8b
proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 21
"p \<bullet> (triv t x) = triv (p \<bullet> t) (p \<bullet> x)"
75a95431cd8b
proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 22
unfolding triv_def
75a95431cd8b
proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 23
apply(perm_simp)
2779
+ − 24
apply(rule refl)
2777
75a95431cd8b
proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 25
oops
75a95431cd8b
proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 26
(*apply(perm_simp)*)
75a95431cd8b
proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 27
2779
+ − 28
ML {*
+ − 29
Inductive.the_inductive @{context} "Lambda.triv"
+ − 30
*}
+ − 31
+ − 32
thm triv_def
+ − 33
2765
7ac5e5c86c7d
introduced framework for finetuning eqvt-rules; this solves problem with permute_pure called in nominal_inductive
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 34
equivariance triv
2768
639979b7fa6e
added permute_pure back into the nominal_inductive procedure; updated to Isabelle 17 April
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 35
nominal_inductive triv avoids Var: "{}::name set"
639979b7fa6e
added permute_pure back into the nominal_inductive procedure; updated to Isabelle 17 April
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 36
apply(auto simp add: fresh_star_def)
639979b7fa6e
added permute_pure back into the nominal_inductive procedure; updated to Isabelle 17 April
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 37
done
639979b7fa6e
added permute_pure back into the nominal_inductive procedure; updated to Isabelle 17 April
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 38
639979b7fa6e
added permute_pure back into the nominal_inductive procedure; updated to Isabelle 17 April
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 39
inductive
639979b7fa6e
added permute_pure back into the nominal_inductive procedure; updated to Isabelle 17 April
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 40
triv2 :: "lam \<Rightarrow> nat \<Rightarrow> bool"
639979b7fa6e
added permute_pure back into the nominal_inductive procedure; updated to Isabelle 17 April
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 41
where
639979b7fa6e
added permute_pure back into the nominal_inductive procedure; updated to Isabelle 17 April
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 42
Var1: "triv2 (Var x) 0"
639979b7fa6e
added permute_pure back into the nominal_inductive procedure; updated to Isabelle 17 April
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 43
| Var2: "triv2 (Var x) (n + n)"
639979b7fa6e
added permute_pure back into the nominal_inductive procedure; updated to Isabelle 17 April
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 44
| Var3: "triv2 (Var x) n"
639979b7fa6e
added permute_pure back into the nominal_inductive procedure; updated to Isabelle 17 April
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 45
639979b7fa6e
added permute_pure back into the nominal_inductive procedure; updated to Isabelle 17 April
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 46
equivariance triv2
639979b7fa6e
added permute_pure back into the nominal_inductive procedure; updated to Isabelle 17 April
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 47
nominal_inductive triv2 .
2765
7ac5e5c86c7d
introduced framework for finetuning eqvt-rules; this solves problem with permute_pure called in nominal_inductive
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 48
2767
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 49
lemma Abs1_eq_fdest:
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 50
fixes x y :: "'a :: at_base"
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 51
and S T :: "'b :: fs"
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 52
assumes "(Abs_lst [atom x] T) = (Abs_lst [atom y] S)"
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 53
and "x \<noteq> y \<Longrightarrow> atom y \<sharp> T \<Longrightarrow> atom x \<sharp> f x T"
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 54
and "x \<noteq> y \<Longrightarrow> atom y \<sharp> T \<Longrightarrow> atom y \<sharp> f x T"
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 55
and "x \<noteq> y \<Longrightarrow> atom y \<sharp> T \<Longrightarrow> (atom x \<rightleftharpoons> atom y) \<bullet> T = S \<Longrightarrow> (atom x \<rightleftharpoons> atom y) \<bullet> (f x T) = f y S"
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 56
and "sort_of (atom x) = sort_of (atom y)"
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 57
shows "f x T = f y S"
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 58
using assms apply -
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 59
apply (subst (asm) Abs1_eq_iff')
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 60
apply simp_all
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 61
apply (elim conjE disjE)
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 62
apply simp
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 63
apply(rule trans)
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 64
apply (rule_tac p="(atom x \<rightleftharpoons> atom y)" in supp_perm_eq[symmetric])
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 65
apply(rule fresh_star_supp_conv)
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 66
apply(simp add: supp_swap fresh_star_def)
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 67
apply(simp add: swap_commute)
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 68
done
2765
7ac5e5c86c7d
introduced framework for finetuning eqvt-rules; this solves problem with permute_pure called in nominal_inductive
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 69
2683
+ − 70
text {* height function *}
2431
331873ebc5cd
can now deal with type variables in nominal datatype definitions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 71
2666
+ − 72
nominal_primrec
2678
+ − 73
height :: "lam \<Rightarrow> int"
2666
+ − 74
where
2678
+ − 75
"height (Var x) = 1"
2683
+ − 76
| "height (App t1 t2) = max (height t1) (height t2) + 1"
+ − 77
| "height (Lam [x].t) = height t + 1"
2791
+ − 78
unfolding eqvt_def height_graph_def
+ − 79
apply (rule, perm_simp, rule)
2666
+ − 80
apply(rule_tac y="x" in lam.exhaust)
2683
+ − 81
apply(auto simp add: lam.distinct lam.eq_iff)
2767
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 82
apply (erule Abs1_eq_fdest)
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 83
apply(simp_all add: fresh_def pure_supp eqvt_at_def)
2666
+ − 84
done
+ − 85
+ − 86
termination
2683
+ − 87
by (relation "measure size") (simp_all add: lam.size)
2666
+ − 88
2707
+ − 89
thm height.simps
+ − 90
2683
+ − 91
+ − 92
text {* free name function - returns atom lists *}
2666
+ − 93
+ − 94
nominal_primrec
+ − 95
frees_lst :: "lam \<Rightarrow> atom list"
+ − 96
where
+ − 97
"frees_lst (Var x) = [atom x]"
2683
+ − 98
| "frees_lst (App t1 t2) = frees_lst t1 @ frees_lst t2"
+ − 99
| "frees_lst (Lam [x]. t) = removeAll (atom x) (frees_lst t)"
2791
+ − 100
unfolding eqvt_def frees_lst_graph_def
+ − 101
apply (rule, perm_simp, rule)
2666
+ − 102
apply(rule_tac y="x" in lam.exhaust)
2793
+ − 103
apply(auto)
2767
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 104
apply (erule Abs1_eq_fdest)
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 105
apply(simp add: supp_removeAll fresh_def)
2666
+ − 106
apply(drule supp_eqvt_at)
+ − 107
apply(simp add: finite_supp)
2767
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 108
apply(auto simp add: fresh_def supp_removeAll eqvts eqvt_at_def)
2666
+ − 109
done
+ − 110
+ − 111
termination
2793
+ − 112
by (relation "measure size") (simp_all add: lam.size)
2666
+ − 113
2683
+ − 114
text {* a small test lemma *}
2666
+ − 115
lemma
2683
+ − 116
shows "supp t = set (frees_lst t)"
+ − 117
apply(induct t rule: frees_lst.induct)
2666
+ − 118
apply(simp_all add: lam.supp supp_at_base)
+ − 119
done
+ − 120
2683
+ − 121
text {* capture - avoiding substitution *}
+ − 122
2675
+ − 123
nominal_primrec
2683
+ − 124
subst :: "lam \<Rightarrow> name \<Rightarrow> lam \<Rightarrow> lam" ("_ [_ ::= _]" [90, 90, 90] 90)
2675
+ − 125
where
2683
+ − 126
"(Var x)[y ::= s] = (if x = y then s else (Var x))"
+ − 127
| "(App t1 t2)[y ::= s] = App (t1[y ::= s]) (t2[y ::= s])"
+ − 128
| "atom x \<sharp> (y, s) \<Longrightarrow> (Lam [x]. t)[y ::= s] = Lam [x].(t[y ::= s])"
2791
+ − 129
unfolding eqvt_def subst_graph_def
+ − 130
apply (rule, perm_simp, rule)
2683
+ − 131
apply(auto simp add: lam.distinct lam.eq_iff)
+ − 132
apply(rule_tac y="a" and c="(aa, b)" in lam.strong_exhaust)
+ − 133
apply(blast)+
2767
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 134
apply(simp_all add: fresh_star_def fresh_Pair_elim)
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 135
apply (erule Abs1_eq_fdest)
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 136
apply(simp_all add: Abs_fresh_iff)
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 137
apply(drule_tac a="atom (xa)" in fresh_eqvt_at)
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 138
apply(simp_all add: finite_supp fresh_Pair)
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 139
apply(subgoal_tac "(atom x \<rightleftharpoons> atom xa) \<bullet> sa = sa")
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 140
apply(subgoal_tac "(atom x \<rightleftharpoons> atom xa) \<bullet> ya = ya")
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 141
apply(simp add: eqvt_at_def)
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 142
apply(rule perm_supp_eq,simp add: fresh_star_def fresh_Pair supp_swap)+
2675
+ − 143
done
+ − 144
2678
+ − 145
termination
2793
+ − 146
by (relation "measure (\<lambda>(t,_,_). size t)") (simp_all add: lam.size)
2683
+ − 147
+ − 148
lemma subst_eqvt[eqvt]:
+ − 149
shows "(p \<bullet> t[x ::= s]) = (p \<bullet> t)[(p \<bullet> x) ::= (p \<bullet> s)]"
+ − 150
by (induct t x s rule: subst.induct) (simp_all)
+ − 151
+ − 152
lemma forget:
+ − 153
shows "atom x \<sharp> t \<Longrightarrow> t[x ::= s] = t"
+ − 154
apply(nominal_induct t avoiding: x s rule: lam.strong_induct)
+ − 155
apply(auto simp add: lam.fresh fresh_at_base)
+ − 156
done
+ − 157
+ − 158
text {* same lemma but with subst.induction *}
+ − 159
lemma forget2:
+ − 160
shows "atom x \<sharp> t \<Longrightarrow> t[x ::= s] = t"
+ − 161
apply(induct t x s rule: subst.induct)
+ − 162
apply(auto simp add: lam.fresh fresh_at_base fresh_Pair)
+ − 163
done
+ − 164
+ − 165
lemma fresh_fact:
+ − 166
fixes z::"name"
+ − 167
assumes a: "atom z \<sharp> s"
+ − 168
and b: "z = y \<or> atom z \<sharp> t"
+ − 169
shows "atom z \<sharp> t[y ::= s]"
+ − 170
using a b
+ − 171
apply (nominal_induct t avoiding: z y s rule: lam.strong_induct)
+ − 172
apply (auto simp add: lam.fresh fresh_at_base)
+ − 173
done
+ − 174
+ − 175
lemma substitution_lemma:
+ − 176
assumes a: "x \<noteq> y" "atom x \<sharp> u"
+ − 177
shows "t[x ::= s][y ::= u] = t[y ::= u][x ::= s[y ::= u]]"
+ − 178
using a
+ − 179
by (nominal_induct t avoiding: x y s u rule: lam.strong_induct)
+ − 180
(auto simp add: fresh_fact forget)
+ − 181
+ − 182
lemma subst_rename:
+ − 183
assumes a: "atom y \<sharp> t"
+ − 184
shows "t[x ::= s] = ((y \<leftrightarrow> x) \<bullet>t)[y ::= s]"
+ − 185
using a
+ − 186
apply (nominal_induct t avoiding: x y s rule: lam.strong_induct)
+ − 187
apply (auto simp add: lam.fresh fresh_at_base)
+ − 188
done
+ − 189
2767
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 190
lemma height_ge_one:
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 191
shows "1 \<le> (height e)"
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 192
by (induct e rule: lam.induct) (simp_all)
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 193
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 194
theorem height_subst:
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 195
shows "height (e[x::=e']) \<le> ((height e) - 1) + (height e')"
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 196
proof (nominal_induct e avoiding: x e' rule: lam.strong_induct)
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 197
case (Var y)
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 198
have "1 \<le> height e'" by (rule height_ge_one)
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 199
then show "height (Var y[x::=e']) \<le> height (Var y) - 1 + height e'" by simp
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 200
next
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 201
case (Lam y e1)
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 202
hence ih: "height (e1[x::=e']) \<le> ((height e1) - 1) + (height e')" by simp
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 203
moreover
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 204
have vc: "atom y\<sharp>x" "atom y\<sharp>e'" by fact+ (* usual variable convention *)
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 205
ultimately show "height ((Lam [y]. e1)[x::=e']) \<le> height (Lam [y]. e1) - 1 + height e'" by simp
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 206
next
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 207
case (App e1 e2)
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 208
hence ih1: "height (e1[x::=e']) \<le> ((height e1) - 1) + (height e')"
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 209
and ih2: "height (e2[x::=e']) \<le> ((height e2) - 1) + (height e')" by simp_all
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 210
then show "height ((App e1 e2)[x::=e']) \<le> height (App e1 e2) - 1 + height e'" by simp
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 211
qed
2683
+ − 212
+ − 213
subsection {* single-step beta-reduction *}
+ − 214
+ − 215
inductive
+ − 216
beta :: "lam \<Rightarrow> lam \<Rightarrow> bool" (" _ \<longrightarrow>b _" [80,80] 80)
+ − 217
where
+ − 218
b1[intro]: "t1 \<longrightarrow>b t2 \<Longrightarrow> App t1 s \<longrightarrow>b App t2 s"
+ − 219
| b2[intro]: "s1 \<longrightarrow>b s2 \<Longrightarrow> App t s1 \<longrightarrow>b App t s2"
+ − 220
| b3[intro]: "t1 \<longrightarrow>b t2 \<Longrightarrow> Lam [x]. t1 \<longrightarrow>b Lam [x]. t2"
+ − 221
| b4[intro]: "atom x \<sharp> s \<Longrightarrow> App (Lam [x]. t) s \<longrightarrow>b t[x ::= s]"
+ − 222
+ − 223
equivariance beta
+ − 224
+ − 225
nominal_inductive beta
+ − 226
avoids b4: "x"
+ − 227
by (simp_all add: fresh_star_def fresh_Pair lam.fresh fresh_fact)
+ − 228
+ − 229
text {* One-Reduction *}
+ − 230
+ − 231
inductive
+ − 232
One :: "lam \<Rightarrow> lam \<Rightarrow> bool" (" _ \<longrightarrow>1 _" [80,80] 80)
+ − 233
where
+ − 234
o1[intro]: "Var x \<longrightarrow>1 Var x"
+ − 235
| o2[intro]: "\<lbrakk>t1 \<longrightarrow>1 t2; s1 \<longrightarrow>1 s2\<rbrakk> \<Longrightarrow> App t1 s1 \<longrightarrow>1 App t2 s2"
+ − 236
| o3[intro]: "t1 \<longrightarrow>1 t2 \<Longrightarrow> Lam [x].t1 \<longrightarrow>1 Lam [x].t2"
+ − 237
| o4[intro]: "\<lbrakk>atom x \<sharp> (s1, s2); t1 \<longrightarrow>1 t2; s1 \<longrightarrow>1 s2\<rbrakk> \<Longrightarrow> App (Lam [x].t1) s1 \<longrightarrow>1 t2[x ::= s2]"
+ − 238
+ − 239
equivariance One
+ − 240
+ − 241
nominal_inductive One
+ − 242
avoids o3: "x"
+ − 243
| o4: "x"
+ − 244
by (simp_all add: fresh_star_def fresh_Pair lam.fresh fresh_fact)
+ − 245
+ − 246
lemma One_refl:
+ − 247
shows "t \<longrightarrow>1 t"
+ − 248
by (nominal_induct t rule: lam.strong_induct) (auto)
+ − 249
+ − 250
lemma One_subst:
+ − 251
assumes a: "t1 \<longrightarrow>1 t2" "s1 \<longrightarrow>1 s2"
+ − 252
shows "t1[x ::= s1] \<longrightarrow>1 t2[x ::= s2]"
+ − 253
using a
+ − 254
apply(nominal_induct t1 t2 avoiding: s1 s2 x rule: One.strong_induct)
+ − 255
apply(auto simp add: substitution_lemma fresh_at_base fresh_fact fresh_Pair)
+ − 256
done
+ − 257
+ − 258
lemma better_o4_intro:
+ − 259
assumes a: "t1 \<longrightarrow>1 t2" "s1 \<longrightarrow>1 s2"
+ − 260
shows "App (Lam [x]. t1) s1 \<longrightarrow>1 t2[ x ::= s2]"
+ − 261
proof -
2685
+ − 262
obtain y::"name" where fs: "atom y \<sharp> (x, t1, s1, t2, s2)" by (rule obtain_fresh)
2683
+ − 263
have "App (Lam [x]. t1) s1 = App (Lam [y]. ((y \<leftrightarrow> x) \<bullet> t1)) s1" using fs
+ − 264
by (auto simp add: lam.eq_iff Abs1_eq_iff' flip_def fresh_Pair fresh_at_base)
+ − 265
also have "\<dots> \<longrightarrow>1 ((y \<leftrightarrow> x) \<bullet> t2)[y ::= s2]" using fs a by (auto simp add: One.eqvt)
+ − 266
also have "\<dots> = t2[x ::= s2]" using fs by (simp add: subst_rename[symmetric])
+ − 267
finally show "App (Lam [x].t1) s1 \<longrightarrow>1 t2[x ::= s2]" by simp
+ − 268
qed
+ − 269
+ − 270
+ − 271
+ − 272
section {* Locally Nameless Terms *}
2678
+ − 273
2669
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 274
nominal_datatype ln =
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 275
LNBnd nat
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 276
| LNVar name
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 277
| LNApp ln ln
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 278
| LNLam ln
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 279
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 280
fun
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 281
lookup :: "name list \<Rightarrow> nat \<Rightarrow> name \<Rightarrow> ln"
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 282
where
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 283
"lookup [] n x = LNVar x"
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 284
| "lookup (y # ys) n x = (if x = y then LNBnd n else (lookup ys (n + 1) x))"
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 285
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 286
lemma [eqvt]:
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 287
shows "(p \<bullet> lookup xs n x) = lookup (p \<bullet> xs) (p \<bullet> n) (p \<bullet> x)"
2767
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 288
by (induct xs arbitrary: n) (simp_all add: permute_pure)
2669
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 289
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 290
nominal_primrec
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 291
trans :: "lam \<Rightarrow> name list \<Rightarrow> ln"
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 292
where
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 293
"trans (Var x) xs = lookup xs 0 x"
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 294
| "trans (App t1 t2) xs = LNApp (trans t1 xs) (trans t2 xs)"
2685
+ − 295
| "atom x \<sharp> xs \<Longrightarrow> trans (Lam [x]. t) xs = LNLam (trans t (x # xs))"
2791
+ − 296
unfolding eqvt_def trans_graph_def
+ − 297
apply (rule, perm_simp, rule)
2669
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 298
apply(case_tac x)
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 299
apply(simp)
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 300
apply(rule_tac y="a" and c="b" in lam.strong_exhaust)
2729
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 301
apply(simp_all add: fresh_star_def)[3]
2669
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 302
apply(blast)
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 303
apply(blast)
2767
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 304
apply(simp_all add: lam.distinct lam.eq_iff)
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 305
apply(elim conjE)
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 306
apply clarify
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 307
apply (erule Abs1_eq_fdest)
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 308
apply (simp_all add: ln.fresh)
2675
+ − 309
prefer 2
2767
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 310
apply(drule supp_eqvt_at)
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 311
apply (auto simp add: finite_supp supp_Pair fresh_def supp_Cons supp_at_base)[2]
2729
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 312
prefer 2
2767
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 313
apply (subgoal_tac "(atom x \<rightleftharpoons> atom xa) \<bullet> xsa = xsa")
2729
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 314
apply (simp add: eqvt_at_def)
2767
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 315
apply (metis atom_name_def swap_fresh_fresh)
2669
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 316
oops
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 317
2729
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 318
(* lemma helpr: "atom x \<sharp> ta \<Longrightarrow> Lam [xa]. ta = Lam [x]. ((xa \<leftrightarrow> x) \<bullet> ta)"
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 319
apply (case_tac "x = xa")
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 320
apply simp
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 321
apply (simp add: lam.eq_iff Abs1_eq_iff flip_def[symmetric])
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 322
by (metis atom_eqvt flip_at_simps(2) fresh_permute_iff)
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 323
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 324
lemma supp_lookup: "supp (lookup l n name) = {atom name} - supp l"
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 325
apply (induct l arbitrary: n)
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 326
apply (simp_all add: ln.supp supp_at_base supp_Nil supp_Cons pure_supp)
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 327
done
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 328
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 329
lemma trans_eqvt[eqvt]: "p \<bullet> (trans t l) = trans (p \<bullet> t) (p \<bullet> l)"
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 330
apply (induct t l rule: trans.induct)
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 331
apply simp_all
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 332
apply (simp add: eqvts permute_pure)
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 333
done
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 334
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 335
lemma diff_un: "a - (b \<union> c) = a - b - c"
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 336
by blast
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 337
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 338
lemma supp_trans: "supp (trans t l) = supp t - supp l"
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 339
apply (induct t arbitrary: l rule: lam.induct)
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 340
apply (simp_all add: lam.supp supp_at_base supp_lookup ln.supp)
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 341
apply blast
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 342
apply (rule_tac x="(lam, l)" and ?'a="name" in obtain_fresh)
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 343
apply (simp add: fresh_Pair)
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 344
apply clarify
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 345
apply (subgoal_tac "supp (Lambda.trans (Lam [a]. ((name \<leftrightarrow> a) \<bullet> lam)) l) =
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 346
supp lam - {atom name} - supp l")
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 347
using helpr
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 348
apply simp
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 349
apply (simp add: ln.supp)
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 350
apply (subgoal_tac "supp ((name \<leftrightarrow> a) \<bullet> (Lambda.trans lam ((name \<leftrightarrow> a) \<bullet> (a # l)))) = supp lam - {atom name} - supp l")
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 351
apply (simp add: trans_eqvt)
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 352
apply (simp add: supp_eqvt[symmetric])
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 353
apply (simp add: Diff_eqvt)
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 354
apply (simp add: supp_eqvt supp_Cons union_eqvt)
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 355
apply (simp add: diff_un)
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 356
apply (tactic {* Cong_Tac.cong_tac @{thm cong} 1*})
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 357
apply (tactic {* Cong_Tac.cong_tac @{thm cong} 1*})
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 358
apply rule
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 359
prefer 2
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 360
apply rule
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 361
apply (simp add: supp_at_base)
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 362
apply (subgoal_tac "(name \<leftrightarrow> a) \<bullet> (supp lam - {atom name}) = supp lam - {atom name}")
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 363
apply (simp add: eqvts)
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 364
unfolding flip_def
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 365
apply (rule swap_fresh_fresh)
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 366
apply (metis fresh_at_base fresh_def fresh_minus_atom_set lam.fsupp supp_at_base)
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 367
by (metis fresh_def fresh_finite_atom_set fresh_minus_atom_set lam.fsupp)
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 368
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 369
lemma "atom x \<sharp> trans_sumC (t, x # xsa)"
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 370
by (simp add: fresh_def meta_eq_to_obj_eq[OF trans_def, symmetric, unfolded fun_eq_iff] supp_trans supp_Cons supp_at_base)
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 371
*)
337748e9b6b5
Reduce the definition of trans to FCB; test that FCB can be proved with simp rules.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 372
2667
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 373
nominal_datatype db =
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 374
DBVar nat
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 375
| DBApp db db
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 376
| DBLam db
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 377
2792
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 378
fun dbapp_in where
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 379
"dbapp_in None _ = None"
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 380
| "dbapp_in (Some _ ) None = None"
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 381
| "dbapp_in (Some x) (Some y) = Some (DBApp x y)"
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 382
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 383
fun dblam_in where
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 384
"dblam_in None = None"
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 385
| "dblam_in (Some x) = Some (DBLam x)"
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 386
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 387
lemma [eqvt]:
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 388
"p \<bullet> (dbapp_in x y) = dbapp_in (p \<bullet> x) (p \<bullet> y)"
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 389
"p \<bullet> (dblam_in x) = dblam_in (p \<bullet> x)"
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 390
apply (case_tac [!] x)
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 391
apply (simp_all add: eqvts)
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 392
apply (case_tac y)
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 393
apply (simp_all add: eqvts)
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 394
done
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 395
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 396
instance db :: pure
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 397
apply default
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 398
apply (induct_tac x rule: db.induct)
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 399
apply (simp_all add: permute_pure)
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 400
done
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 401
nominal_primrec
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 402
trans :: "lam \<Rightarrow> name list \<Rightarrow> nat \<Rightarrow> db option"
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 403
where
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 404
"trans (Var x) [] n = None"
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 405
| "trans (Var x) (h # t) n =
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 406
(if h = x then Some (DBVar n) else trans (Var x) t (n + 1))"
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 407
| "trans (App t1 t2) xs n = dbapp_in (trans t1 xs n) (trans t2 xs n)"
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 408
| "atom x \<sharp> xs \<Longrightarrow> trans (Lam [x].t) xs n = dblam_in (trans t (x # xs) n)"
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 409
unfolding eqvt_def trans_graph_def
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 410
apply (rule, perm_simp, rule)
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 411
apply (case_tac x)
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 412
apply (rule_tac y="a" and c="b" in lam.strong_exhaust)
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 413
apply (case_tac b)
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 414
apply (auto simp add: fresh_star_def)
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 415
apply (rule_tac f="dblam_in" in arg_cong)
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 416
apply (erule Abs1_eq_fdest)
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 417
apply (simp_all add: pure_fresh)
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 418
apply (subgoal_tac "(atom x \<rightleftharpoons> atom xa) \<bullet> xsa = xsa")
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 419
apply (subgoal_tac "(atom x \<rightleftharpoons> atom xa) \<bullet> na = na")
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 420
apply (simp add: eqvt_at_def)
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 421
apply (simp add: permute_pure)
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 422
apply (metis atom_name_def swap_fresh_fresh)
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 423
done
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 424
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 425
termination
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 426
apply (relation "measure (\<lambda>(t,l,_). size t + size t + length l)")
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 427
apply (simp_all add: lam.size)
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 428
done
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 429
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 430
lemma db_trans_test:
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 431
assumes a: "y \<noteq> x"
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 432
shows "trans (Lam [x]. Lam [y]. App (Var x) (Var y)) [] 0 = Some (DBLam (DBLam (DBApp (DBVar 1) (DBVar 0))))"
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 433
apply (subst trans.simps)
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 434
apply (simp add: fresh_def supp_Nil)
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 435
apply (subst trans.simps)
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 436
apply (simp add: fresh_def supp_Nil supp_Cons supp_at_base a)
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 437
apply (simp add: a)
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 438
done
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 439
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 440
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 441
2667
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 442
abbreviation
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 443
mbind :: "'a option => ('a => 'b option) => 'b option" ("_ \<guillemotright>= _" [65,65] 65)
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 444
where
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 445
"c \<guillemotright>= f \<equiv> case c of None => None | (Some v) => f v"
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 446
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 447
lemma mbind_eqvt:
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 448
fixes c::"'a::pt option"
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 449
shows "(p \<bullet> (c \<guillemotright>= f)) = ((p \<bullet> c) \<guillemotright>= (p \<bullet> f))"
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 450
apply(cases c)
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 451
apply(simp_all)
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 452
apply(perm_simp)
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 453
apply(rule refl)
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 454
done
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 455
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 456
lemma mbind_eqvt_raw[eqvt_raw]:
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 457
shows "(p \<bullet> option_case) \<equiv> option_case"
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 458
apply(rule eq_reflection)
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 459
apply(rule ext)+
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 460
apply(case_tac xb)
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 461
apply(simp_all)
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 462
apply(rule_tac p="-p" in permute_boolE)
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 463
apply(perm_simp add: permute_minus_cancel)
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 464
apply(simp)
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 465
apply(rule_tac p="-p" in permute_boolE)
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 466
apply(perm_simp add: permute_minus_cancel)
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 467
apply(simp)
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 468
done
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 469
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 470
fun
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 471
index :: "atom list \<Rightarrow> nat \<Rightarrow> atom \<Rightarrow> nat option"
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 472
where
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 473
"index [] n x = None"
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 474
| "index (y # ys) n x = (if x = y then (Some n) else (index ys (n + 1) x))"
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 475
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 476
lemma [eqvt]:
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 477
shows "(p \<bullet> index xs n x) = index (p \<bullet> xs) (p \<bullet> n) (p \<bullet> x)"
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 478
apply(induct xs arbitrary: n)
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 479
apply(simp_all add: permute_pure)
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 480
done
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 481
2789
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 482
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 483
text {* tests of functions containing if and case *}
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 484
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 485
consts P :: "lam \<Rightarrow> bool"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 486
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 487
nominal_primrec
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 488
A :: "lam => lam"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 489
where
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 490
"A (App M N) = (if (True \<or> P M) then (A M) else (A N))"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 491
| "A (Var x) = (Var x)"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 492
| "A (App M N) = (if True then M else A N)"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 493
oops
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 494
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 495
nominal_primrec
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 496
C :: "lam => lam"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 497
where
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 498
"C (App M N) = (case (True \<or> P M) of True \<Rightarrow> (A M) | False \<Rightarrow> (A N))"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 499
| "C (Var x) = (Var x)"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 500
| "C (App M N) = (if True then M else C N)"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 501
oops
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 502
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 503
nominal_primrec
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 504
map_term :: "(lam \<Rightarrow> lam) \<Rightarrow> lam \<Rightarrow> lam"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 505
where
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 506
"map_term f (Var x) = f (Var x)"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 507
| "map_term f (App t1 t2) = App (f t1) (f t2)"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 508
| "map_term f (Lam [x].t) = Lam [x].(f t)"
2793
+ − 509
unfolding eqvt_def map_term_graph_def
+ − 510
apply (rule, perm_simp, rule)
+ − 511
apply (case_tac x, case_tac b rule: lam.exhaust)
+ − 512
apply auto
+ − 513
(*apply (erule Abs1_eq_fdest)*)
2789
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 514
oops
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 515
2794
+ − 516
nominal_primrec
+ − 517
map_term :: "(lam \<Rightarrow> lam) \<Rightarrow> lam \<Rightarrow> lam"
+ − 518
where
+ − 519
"eqvt f \<Longrightarrow> map_term f (Var x) = f (Var x)"
+ − 520
| "eqvt f \<Longrightarrow> map_term f (App t1 t2) = App (f t1) (f t2)"
+ − 521
| "eqvt f \<Longrightarrow> map_term f (Lam [x].t) = Lam [x].(f t)"
+ − 522
| "\<not>eqvt f \<Longrightarrow> map_term f t = t"
+ − 523
apply (simp add: eqvt_def map_term_graph_def)
+ − 524
apply (rule, perm_simp, rule)
+ − 525
apply (case_tac x, case_tac "eqvt a", case_tac b rule: lam.exhaust)
+ − 526
apply auto
+ − 527
apply (simp add: Abs1_eq_iff)
+ − 528
apply (auto)
+ − 529
apply (simp add: eqvt_def permute_fun_app_eq)
+ − 530
apply (drule supp_fun_app_eqvt)
+ − 531
apply (simp add: fresh_def )
+ − 532
apply blast
+ − 533
apply (simp add: eqvt_def permute_fun_app_eq)
+ − 534
apply (drule supp_fun_app_eqvt)
+ − 535
apply (simp add: fresh_def )
+ − 536
apply blast
+ − 537
done
+ − 538
+ − 539
termination
+ − 540
by (relation "measure (\<lambda>(_,t). size t)") (simp_all add: lam.size)
+ − 541
2789
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 542
nominal_primrec
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 543
A :: "lam => lam"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 544
where
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 545
"A (Lam [x].M) = (Lam [x].M)"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 546
| "A (Var x) = (Var x)"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 547
| "A (App M N) = (if True then M else A N)"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 548
oops
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 549
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 550
nominal_primrec
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 551
B :: "lam => lam"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 552
where
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 553
"B (Lam [x].M) = (Lam [x].M)"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 554
| "B (Var x) = (Var x)"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 555
| "B (App M N) = (if True then M else (B N))"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 556
unfolding eqvt_def
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 557
unfolding B_graph_def
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 558
apply(perm_simp)
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 559
apply(rule allI)
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 560
apply(rule refl)
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 561
oops
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 562
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 563
text {* not working yet *}
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 564
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 565
(* not working yet
2667
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 566
nominal_primrec
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 567
trans :: "lam \<Rightarrow> atom list \<Rightarrow> db option"
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 568
where
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 569
"trans (Var x) xs = (index xs 0 (atom x) \<guillemotright>= (\<lambda>n. Some (DBVar n)))"
2707
+ − 570
| "trans (App t1 t2) xs = ((trans t1 xs) \<guillemotright>= (\<lambda>db1. (trans t2 xs) \<guillemotright>= (\<lambda>db2. Some (DBApp db1 db2))))"
+ − 571
| "trans (Lam [x].t) xs = (trans t (atom x # xs) \<guillemotright>= (\<lambda>db. Some (DBLam db)))"
2667
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 572
*)
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 573
2789
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 574
(* not working yet
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 575
nominal_primrec
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 576
CPS :: "lam \<Rightarrow> (lam \<Rightarrow> lam) \<Rightarrow> lam"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 577
where
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 578
"CPS (Var x) k = Var x"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 579
| "CPS (App M N) k = CPS M (\<lambda>m. CPS N (\<lambda>n. n))"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 580
*)
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 581
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 582
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 583
(* function tests *)
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 584
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 585
(* similar problem with function package *)
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 586
function
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 587
f :: "int list \<Rightarrow> int"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 588
where
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 589
"f [] = 0"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 590
| "f [e] = e"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 591
| "f (l @ m) = f l + f m"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 592
apply(simp_all)
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 593
oops
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 594
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 595
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 596
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 597
2675
+ − 598
2666
+ − 599
1594
+ − 600
end
+ − 601
+ − 602
+ − 603