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
2950
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2
imports
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 3
"../Nominal2"
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 4
"~~/src/HOL/Library/Monad_Syntax"
1594
+ − 5
begin
+ − 6
2885
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 7
1594
+ − 8
atom_decl name
+ − 9
2436
+ − 10
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
+ − 11
Var "name"
2436
+ − 12
| App "lam" "lam"
2950
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 13
| Lam x::"name" l::"lam" binds 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
+ − 14
2885
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 15
ML {* Method.SIMPLE_METHOD' *}
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 16
ML {* Sign.intern_const *}
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 17
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 18
ML {*
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 19
val test:((Proof.context -> Method.method) context_parser) =
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 20
Scan.succeed (fn ctxt =>
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 21
let
2891
304dfe6cc83a
the simplifier can simplify "sort (atom a)" if a is a concrete atom type declared with atom_decl
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 22
val _ = Inductive.the_inductive ctxt "local.frees_lst_graph"
2885
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 23
in
2948
+ − 24
Method.SIMPLE_METHOD' (K (all_tac))
2885
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 25
end)
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 26
*}
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 27
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 28
method_setup test = {* test *} {* test *}
2868
+ − 29
2951
+ − 30
section {* Simple examples from Norrish 2004 *}
+ − 31
+ − 32
nominal_primrec
+ − 33
is_app :: "lam \<Rightarrow> bool"
+ − 34
where
+ − 35
"is_app (Var x) = False"
+ − 36
| "is_app (App t1 t2) = True"
+ − 37
| "is_app (Lam [x]. t) = False"
+ − 38
apply(simp add: eqvt_def is_app_graph_def)
+ − 39
apply (rule, perm_simp, rule)
+ − 40
apply(rule TrueI)
+ − 41
apply(rule_tac y="x" in lam.exhaust)
+ − 42
apply(auto)[3]
+ − 43
apply(all_trivials)
+ − 44
done
+ − 45
2973
d1038e67923a
added a flag (eqvt) to termination proofs arising fron nominal_primrecs
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 46
termination (eqvt) by lexicographic_order
d1038e67923a
added a flag (eqvt) to termination proofs arising fron nominal_primrecs
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 47
2974
+ − 48
thm is_app_def
2975
c62e26830420
preliminary version of automatically generation the eqvt-lemmas for functions defined with nominal_primrec
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 49
thm is_app.eqvt
2973
d1038e67923a
added a flag (eqvt) to termination proofs arising fron nominal_primrecs
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 50
2975
c62e26830420
preliminary version of automatically generation the eqvt-lemmas for functions defined with nominal_primrec
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 51
thm eqvts
2951
+ − 52
+ − 53
nominal_primrec
+ − 54
rator :: "lam \<Rightarrow> lam option"
+ − 55
where
+ − 56
"rator (Var x) = None"
+ − 57
| "rator (App t1 t2) = Some t1"
+ − 58
| "rator (Lam [x]. t) = None"
+ − 59
apply(simp add: eqvt_def rator_graph_def)
+ − 60
apply (rule, perm_simp, rule)
+ − 61
apply(rule TrueI)
+ − 62
apply(rule_tac y="x" in lam.exhaust)
+ − 63
apply(auto)[3]
+ − 64
apply(simp_all)
+ − 65
done
+ − 66
2973
d1038e67923a
added a flag (eqvt) to termination proofs arising fron nominal_primrecs
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 67
termination (eqvt) by lexicographic_order
2951
+ − 68
+ − 69
nominal_primrec
+ − 70
rand :: "lam \<Rightarrow> lam option"
+ − 71
where
+ − 72
"rand (Var x) = None"
+ − 73
| "rand (App t1 t2) = Some t2"
+ − 74
| "rand (Lam [x]. t) = None"
+ − 75
apply(simp add: eqvt_def rand_graph_def)
+ − 76
apply (rule, perm_simp, rule)
+ − 77
apply(rule TrueI)
+ − 78
apply(rule_tac y="x" in lam.exhaust)
+ − 79
apply(auto)[3]
+ − 80
apply(simp_all)
+ − 81
done
+ − 82
2973
d1038e67923a
added a flag (eqvt) to termination proofs arising fron nominal_primrecs
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 83
termination (eqvt) by lexicographic_order
2951
+ − 84
+ − 85
nominal_primrec
+ − 86
is_eta_nf :: "lam \<Rightarrow> bool"
+ − 87
where
+ − 88
"is_eta_nf (Var x) = True"
+ − 89
| "is_eta_nf (App t1 t2) = (is_eta_nf t1 \<and> is_eta_nf t2)"
+ − 90
| "is_eta_nf (Lam [x]. t) = (is_eta_nf t \<and>
+ − 91
((is_app t \<and> rand t = Some (Var x)) \<longrightarrow> atom x \<in> supp (rator t)))"
+ − 92
apply(simp add: eqvt_def is_eta_nf_graph_def)
+ − 93
apply (rule, perm_simp, rule)
+ − 94
apply(rule TrueI)
+ − 95
apply(rule_tac y="x" in lam.exhaust)
+ − 96
apply(auto)[3]
+ − 97
apply(simp_all)
+ − 98
apply(erule_tac c="()" in Abs_lst1_fcb2')
+ − 99
apply(simp_all add: pure_fresh fresh_star_def)[3]
+ − 100
apply(simp add: eqvt_at_def conj_eqvt)
+ − 101
apply(perm_simp)
+ − 102
apply(rule refl)
+ − 103
apply(simp add: eqvt_at_def conj_eqvt)
+ − 104
apply(perm_simp)
+ − 105
apply(rule refl)
+ − 106
done
+ − 107
2973
d1038e67923a
added a flag (eqvt) to termination proofs arising fron nominal_primrecs
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 108
termination (eqvt) by lexicographic_order
2951
+ − 109
+ − 110
nominal_datatype path = Left | Right | In
+ − 111
+ − 112
section {* Paths to a free variables *}
+ − 113
+ − 114
instance path :: pure
+ − 115
apply(default)
+ − 116
apply(induct_tac "x::path" rule: path.induct)
+ − 117
apply(simp_all)
+ − 118
done
+ − 119
+ − 120
nominal_primrec
+ − 121
var_pos :: "name \<Rightarrow> lam \<Rightarrow> (path list) set"
+ − 122
where
+ − 123
"var_pos y (Var x) = (if y = x then {[]} else {})"
+ − 124
| "var_pos y (App t1 t2) = (Cons Left ` (var_pos y t1)) \<union> (Cons Right ` (var_pos y t2))"
+ − 125
| "atom x \<sharp> y \<Longrightarrow> var_pos y (Lam [x]. t) = (Cons In ` (var_pos y t))"
+ − 126
apply(simp add: eqvt_def var_pos_graph_def)
+ − 127
apply (rule, perm_simp, rule)
+ − 128
apply(rule TrueI)
+ − 129
apply(case_tac x)
+ − 130
apply(rule_tac y="b" and c="a" in lam.strong_exhaust)
+ − 131
apply(auto simp add: fresh_star_def)[3]
+ − 132
apply(simp_all)
+ − 133
apply(erule conjE)+
+ − 134
apply(erule_tac Abs_lst1_fcb2)
+ − 135
apply(simp add: pure_fresh)
+ − 136
apply(simp add: fresh_star_def)
+ − 137
apply(simp add: eqvt_at_def image_eqvt perm_supp_eq)
+ − 138
apply(perm_simp)
+ − 139
apply(rule refl)
+ − 140
apply(simp add: eqvt_at_def image_eqvt perm_supp_eq)
+ − 141
apply(perm_simp)
+ − 142
apply(rule refl)
+ − 143
done
+ − 144
2973
d1038e67923a
added a flag (eqvt) to termination proofs arising fron nominal_primrecs
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 145
termination (eqvt) by lexicographic_order
2951
+ − 146
+ − 147
lemma var_pos1:
+ − 148
assumes "atom y \<notin> supp t"
+ − 149
shows "var_pos y t = {}"
+ − 150
using assms
+ − 151
apply(induct t rule: var_pos.induct)
+ − 152
apply(simp_all add: lam.supp supp_at_base fresh_at_base)
+ − 153
done
+ − 154
+ − 155
lemma var_pos2:
+ − 156
shows "var_pos y (Lam [y].t) = {}"
+ − 157
apply(rule var_pos1)
+ − 158
apply(simp add: lam.supp)
+ − 159
done
+ − 160
+ − 161
+ − 162
text {* strange substitution operation *}
+ − 163
+ − 164
nominal_primrec
+ − 165
subst' :: "lam \<Rightarrow> name \<Rightarrow> lam \<Rightarrow> lam" ("_ [_ ::== _]" [90, 90, 90] 90)
+ − 166
where
+ − 167
"(Var x)[y ::== s] = (if x = y then s else (Var x))"
+ − 168
| "(App t1 t2)[y ::== s] = App (t1[y ::== s]) (t2[y ::== s])"
+ − 169
| "atom x \<sharp> (y, s) \<Longrightarrow> (Lam [x]. t)[y ::== s] = Lam [x].(t[y ::== (App (Var y) s)])"
+ − 170
apply(simp add: eqvt_def subst'_graph_def)
+ − 171
apply (rule, perm_simp, rule)
+ − 172
apply(rule TrueI)
+ − 173
apply(case_tac x)
+ − 174
apply(rule_tac y="a" and c="(b, c)" in lam.strong_exhaust)
+ − 175
apply(auto simp add: fresh_star_def)[3]
+ − 176
apply(simp_all)
+ − 177
apply(erule conjE)+
+ − 178
apply (erule_tac c="(ya,sa)" in Abs_lst1_fcb2)
+ − 179
apply(simp_all add: Abs_fresh_iff)
+ − 180
apply(simp add: fresh_star_def fresh_Pair)
+ − 181
apply(simp add: eqvt_at_def atom_eqvt fresh_star_Pair perm_supp_eq)
+ − 182
apply(simp add: eqvt_at_def atom_eqvt fresh_star_Pair perm_supp_eq)
+ − 183
done
+ − 184
2973
d1038e67923a
added a flag (eqvt) to termination proofs arising fron nominal_primrecs
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 185
termination (eqvt) by lexicographic_order
2951
+ − 186
+ − 187
2868
+ − 188
section {* free name function *}
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 189
2860
+ − 190
text {* first returns an atom list *}
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 191
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 192
nominal_primrec
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 193
frees_lst :: "lam \<Rightarrow> atom list"
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 194
where
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 195
"frees_lst (Var x) = [atom x]"
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 196
| "frees_lst (App t1 t2) = frees_lst t1 @ frees_lst t2"
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 197
| "frees_lst (Lam [x]. t) = removeAll (atom x) (frees_lst t)"
2868
+ − 198
unfolding eqvt_def
+ − 199
unfolding frees_lst_graph_def
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 200
apply (rule, perm_simp, rule)
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 201
apply(rule TrueI)
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 202
apply(rule_tac y="x" in lam.exhaust)
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 203
apply(auto)
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 204
apply (erule_tac c="()" in Abs_lst1_fcb2)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 205
apply(simp add: supp_removeAll fresh_def)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 206
apply(simp add: fresh_star_def fresh_Unit)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 207
apply(simp add: eqvt_at_def removeAll_eqvt atom_eqvt)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 208
apply(simp add: eqvt_at_def removeAll_eqvt atom_eqvt)
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 209
done
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 210
2973
d1038e67923a
added a flag (eqvt) to termination proofs arising fron nominal_primrecs
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 211
termination (eqvt) by lexicographic_order
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 212
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 213
text {* a small test lemma *}
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 214
lemma shows "supp t = set (frees_lst t)"
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 215
by (induct t rule: frees_lst.induct) (simp_all add: lam.supp supp_at_base)
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 216
2860
+ − 217
text {* second returns an atom set - therefore needs an invariant *}
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 218
2821
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 219
nominal_primrec (invariant "\<lambda>x (y::atom set). finite y")
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 220
frees_set :: "lam \<Rightarrow> atom set"
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 221
where
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 222
"frees_set (Var x) = {atom x}"
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 223
| "frees_set (App t1 t2) = frees_set t1 \<union> frees_set t2"
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 224
| "frees_set (Lam [x]. t) = (frees_set t) - {atom x}"
2845
+ − 225
apply(simp add: eqvt_def frees_set_graph_def)
+ − 226
apply(rule, perm_simp, rule)
+ − 227
apply(erule frees_set_graph.induct)
+ − 228
apply(auto)[9]
+ − 229
apply(rule_tac y="x" in lam.exhaust)
+ − 230
apply(auto)[3]
+ − 231
apply(simp)
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 232
apply(erule_tac c="()" in Abs_lst1_fcb2)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 233
apply(simp add: fresh_minus_atom_set)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 234
apply(simp add: fresh_star_def fresh_Unit)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 235
apply(simp add: Diff_eqvt eqvt_at_def, perm_simp, rule refl)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 236
apply(simp add: Diff_eqvt eqvt_at_def, perm_simp, rule refl)
2845
+ − 237
done
2821
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 238
2973
d1038e67923a
added a flag (eqvt) to termination proofs arising fron nominal_primrecs
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 239
termination (eqvt)
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 240
by lexicographic_order
2821
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 241
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 242
lemma "frees_set t = supp t"
2845
+ − 243
by (induct rule: frees_set.induct) (simp_all add: lam.supp supp_at_base)
2821
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 244
2868
+ − 245
section {* height function *}
2431
331873ebc5cd
can now deal with type variables in nominal datatype definitions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 246
2666
+ − 247
nominal_primrec
2678
+ − 248
height :: "lam \<Rightarrow> int"
2666
+ − 249
where
2678
+ − 250
"height (Var x) = 1"
2683
+ − 251
| "height (App t1 t2) = max (height t1) (height t2) + 1"
+ − 252
| "height (Lam [x].t) = height t + 1"
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 253
apply(simp add: eqvt_def height_graph_def)
2791
+ − 254
apply (rule, perm_simp, rule)
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 255
apply(rule TrueI)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 256
apply(rule_tac y="x" in lam.exhaust)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 257
apply(auto)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 258
apply (erule_tac c="()" in Abs_lst1_fcb2)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 259
apply(simp_all add: fresh_def pure_supp eqvt_at_def fresh_star_def)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 260
done
2666
+ − 261
2973
d1038e67923a
added a flag (eqvt) to termination proofs arising fron nominal_primrecs
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 262
termination (eqvt)
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 263
by lexicographic_order
2666
+ − 264
2707
+ − 265
thm height.simps
+ − 266
2683
+ − 267
2868
+ − 268
section {* capture-avoiding substitution *}
2683
+ − 269
2675
+ − 270
nominal_primrec
2683
+ − 271
subst :: "lam \<Rightarrow> name \<Rightarrow> lam \<Rightarrow> lam" ("_ [_ ::= _]" [90, 90, 90] 90)
2675
+ − 272
where
2683
+ − 273
"(Var x)[y ::= s] = (if x = y then s else (Var x))"
+ − 274
| "(App t1 t2)[y ::= s] = App (t1[y ::= s]) (t2[y ::= s])"
+ − 275
| "atom x \<sharp> (y, s) \<Longrightarrow> (Lam [x]. t)[y ::= s] = Lam [x].(t[y ::= s])"
2791
+ − 276
unfolding eqvt_def subst_graph_def
+ − 277
apply (rule, perm_simp, rule)
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 278
apply(rule TrueI)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 279
apply(auto simp add: lam.distinct lam.eq_iff)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 280
apply(rule_tac y="a" and c="(aa, b)" in lam.strong_exhaust)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 281
apply(blast)+
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 282
apply(simp_all add: fresh_star_def fresh_Pair_elim)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 283
apply (erule_tac c="(ya,sa)" in Abs_lst1_fcb2)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 284
apply(simp_all add: Abs_fresh_iff)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 285
apply(simp add: fresh_star_def fresh_Pair)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 286
apply(simp add: eqvt_at_def atom_eqvt fresh_star_Pair perm_supp_eq)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 287
apply(simp add: eqvt_at_def atom_eqvt fresh_star_Pair perm_supp_eq)
2675
+ − 288
done
+ − 289
2973
d1038e67923a
added a flag (eqvt) to termination proofs arising fron nominal_primrecs
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 290
termination (eqvt)
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 291
by lexicographic_order
2683
+ − 292
2975
c62e26830420
preliminary version of automatically generation the eqvt-lemmas for functions defined with nominal_primrec
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 293
thm subst.eqvt
2683
+ − 294
+ − 295
lemma forget:
+ − 296
shows "atom x \<sharp> t \<Longrightarrow> t[x ::= s] = t"
2845
+ − 297
by (nominal_induct t avoiding: x s rule: lam.strong_induct)
+ − 298
(auto simp add: lam.fresh fresh_at_base)
2683
+ − 299
+ − 300
text {* same lemma but with subst.induction *}
+ − 301
lemma forget2:
+ − 302
shows "atom x \<sharp> t \<Longrightarrow> t[x ::= s] = t"
2845
+ − 303
by (induct t x s rule: subst.induct)
+ − 304
(auto simp add: lam.fresh fresh_at_base fresh_Pair)
2683
+ − 305
+ − 306
lemma fresh_fact:
+ − 307
fixes z::"name"
+ − 308
assumes a: "atom z \<sharp> s"
2845
+ − 309
and b: "z = y \<or> atom z \<sharp> t"
2683
+ − 310
shows "atom z \<sharp> t[y ::= s]"
2845
+ − 311
using a b
+ − 312
by (nominal_induct t avoiding: z y s rule: lam.strong_induct)
+ − 313
(auto simp add: lam.fresh fresh_at_base)
2683
+ − 314
+ − 315
lemma substitution_lemma:
+ − 316
assumes a: "x \<noteq> y" "atom x \<sharp> u"
+ − 317
shows "t[x ::= s][y ::= u] = t[y ::= u][x ::= s[y ::= u]]"
+ − 318
using a
+ − 319
by (nominal_induct t avoiding: x y s u rule: lam.strong_induct)
+ − 320
(auto simp add: fresh_fact forget)
+ − 321
+ − 322
lemma subst_rename:
+ − 323
assumes a: "atom y \<sharp> t"
+ − 324
shows "t[x ::= s] = ((y \<leftrightarrow> x) \<bullet>t)[y ::= s]"
+ − 325
using a
+ − 326
apply (nominal_induct t avoiding: x y s rule: lam.strong_induct)
+ − 327
apply (auto simp add: lam.fresh fresh_at_base)
+ − 328
done
+ − 329
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
+ − 330
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
+ − 331
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
+ − 332
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
+ − 333
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 334
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
+ − 335
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
+ − 336
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
+ − 337
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
+ − 338
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
+ − 339
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
+ − 340
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
+ − 341
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
+ − 342
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
+ − 343
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
+ − 344
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
+ − 345
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
+ − 346
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
+ − 347
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
+ − 348
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
+ − 349
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
+ − 350
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
+ − 351
qed
2683
+ − 352
+ − 353
subsection {* single-step beta-reduction *}
+ − 354
+ − 355
inductive
+ − 356
beta :: "lam \<Rightarrow> lam \<Rightarrow> bool" (" _ \<longrightarrow>b _" [80,80] 80)
+ − 357
where
+ − 358
b1[intro]: "t1 \<longrightarrow>b t2 \<Longrightarrow> App t1 s \<longrightarrow>b App t2 s"
+ − 359
| b2[intro]: "s1 \<longrightarrow>b s2 \<Longrightarrow> App t s1 \<longrightarrow>b App t s2"
+ − 360
| b3[intro]: "t1 \<longrightarrow>b t2 \<Longrightarrow> Lam [x]. t1 \<longrightarrow>b Lam [x]. t2"
+ − 361
| b4[intro]: "atom x \<sharp> s \<Longrightarrow> App (Lam [x]. t) s \<longrightarrow>b t[x ::= s]"
+ − 362
+ − 363
equivariance beta
+ − 364
+ − 365
nominal_inductive beta
+ − 366
avoids b4: "x"
+ − 367
by (simp_all add: fresh_star_def fresh_Pair lam.fresh fresh_fact)
+ − 368
+ − 369
text {* One-Reduction *}
+ − 370
+ − 371
inductive
+ − 372
One :: "lam \<Rightarrow> lam \<Rightarrow> bool" (" _ \<longrightarrow>1 _" [80,80] 80)
+ − 373
where
+ − 374
o1[intro]: "Var x \<longrightarrow>1 Var x"
+ − 375
| o2[intro]: "\<lbrakk>t1 \<longrightarrow>1 t2; s1 \<longrightarrow>1 s2\<rbrakk> \<Longrightarrow> App t1 s1 \<longrightarrow>1 App t2 s2"
+ − 376
| o3[intro]: "t1 \<longrightarrow>1 t2 \<Longrightarrow> Lam [x].t1 \<longrightarrow>1 Lam [x].t2"
+ − 377
| 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]"
+ − 378
+ − 379
equivariance One
+ − 380
+ − 381
nominal_inductive One
+ − 382
avoids o3: "x"
+ − 383
| o4: "x"
+ − 384
by (simp_all add: fresh_star_def fresh_Pair lam.fresh fresh_fact)
+ − 385
+ − 386
lemma One_refl:
+ − 387
shows "t \<longrightarrow>1 t"
+ − 388
by (nominal_induct t rule: lam.strong_induct) (auto)
+ − 389
+ − 390
lemma One_subst:
+ − 391
assumes a: "t1 \<longrightarrow>1 t2" "s1 \<longrightarrow>1 s2"
+ − 392
shows "t1[x ::= s1] \<longrightarrow>1 t2[x ::= s2]"
+ − 393
using a
+ − 394
apply(nominal_induct t1 t2 avoiding: s1 s2 x rule: One.strong_induct)
+ − 395
apply(auto simp add: substitution_lemma fresh_at_base fresh_fact fresh_Pair)
+ − 396
done
+ − 397
+ − 398
lemma better_o4_intro:
+ − 399
assumes a: "t1 \<longrightarrow>1 t2" "s1 \<longrightarrow>1 s2"
+ − 400
shows "App (Lam [x]. t1) s1 \<longrightarrow>1 t2[ x ::= s2]"
+ − 401
proof -
2685
+ − 402
obtain y::"name" where fs: "atom y \<sharp> (x, t1, s1, t2, s2)" by (rule obtain_fresh)
2683
+ − 403
have "App (Lam [x]. t1) s1 = App (Lam [y]. ((y \<leftrightarrow> x) \<bullet> t1)) s1" using fs
+ − 404
by (auto simp add: lam.eq_iff Abs1_eq_iff' flip_def fresh_Pair fresh_at_base)
+ − 405
also have "\<dots> \<longrightarrow>1 ((y \<leftrightarrow> x) \<bullet> t2)[y ::= s2]" using fs a by (auto simp add: One.eqvt)
+ − 406
also have "\<dots> = t2[x ::= s2]" using fs by (simp add: subst_rename[symmetric])
+ − 407
finally show "App (Lam [x].t1) s1 \<longrightarrow>1 t2[x ::= s2]" by simp
+ − 408
qed
+ − 409
+ − 410
section {* Locally Nameless Terms *}
2678
+ − 411
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
+ − 412
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
+ − 413
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
+ − 414
| 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
+ − 415
| 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
+ − 416
| 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
+ − 417
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
+ − 418
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
+ − 419
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
+ − 420
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
+ − 421
"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
+ − 422
| "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
+ − 423
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 424
lemma supp_lookup:
2824
+ − 425
shows "supp (lookup xs n x) \<subseteq> {atom x}"
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 426
apply(induct arbitrary: n rule: lookup.induct)
2824
+ − 427
apply(simp add: ln.supp supp_at_base)
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 428
apply(simp add: ln.supp pure_supp)
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 429
done
2824
+ − 430
+ − 431
lemma supp_lookup_in:
+ − 432
shows "x \<in> set xs \<Longrightarrow> supp (lookup xs n x) = {}"
+ − 433
by (induct arbitrary: n rule: lookup.induct)(auto simp add: ln.supp pure_supp)
+ − 434
+ − 435
lemma supp_lookup_notin:
+ − 436
shows "x \<notin> set xs \<Longrightarrow> supp (lookup xs n x) = {atom x}"
+ − 437
by (induct arbitrary: n rule: lookup.induct) (auto simp add: ln.supp pure_supp supp_at_base)
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 438
2829
+ − 439
lemma supp_lookup_fresh:
+ − 440
shows "atom ` set xs \<sharp>* lookup xs n x"
+ − 441
by (case_tac "x \<in> set xs") (auto simp add: fresh_star_def fresh_def supp_lookup_in supp_lookup_notin)
+ − 442
+ − 443
lemma lookup_eqvt[eqvt]:
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
+ − 444
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
+ − 445
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
+ − 446
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 447
text {* Function that translates lambda-terms into locally nameless terms *}
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 448
2826
+ − 449
nominal_primrec (invariant "\<lambda>(_, xs) y. atom ` set xs \<sharp>* y")
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
+ − 450
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
+ − 451
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
+ − 452
"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
+ − 453
| "trans (App t1 t2) xs = LNApp (trans t1 xs) (trans t2 xs)"
2685
+ − 454
| "atom x \<sharp> xs \<Longrightarrow> trans (Lam [x]. t) xs = LNLam (trans t (x # xs))"
2829
+ − 455
apply (simp add: eqvt_def trans_graph_def)
+ − 456
apply (rule, perm_simp, rule)
2824
+ − 457
apply (erule trans_graph.induct)
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 458
apply (auto simp add: ln.fresh)[3]
2829
+ − 459
apply (simp add: supp_lookup_fresh)
2824
+ − 460
apply (simp add: fresh_star_def ln.fresh)
+ − 461
apply (simp add: ln.fresh fresh_star_def)
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 462
apply(auto)[1]
2829
+ − 463
apply (rule_tac y="a" and c="b" in lam.strong_exhaust)
+ − 464
apply (auto simp add: fresh_star_def)[3]
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 465
apply(simp_all)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 466
apply(erule conjE)+
2948
+ − 467
apply (erule_tac c="xsa" in Abs_lst1_fcb2')
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 468
apply (simp add: fresh_star_def)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 469
apply (simp add: fresh_star_def)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 470
apply(simp add: eqvt_at_def atom_eqvt fresh_star_Pair perm_supp_eq)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 471
apply(simp add: eqvt_at_def atom_eqvt fresh_star_Pair perm_supp_eq)
2829
+ − 472
done
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
+ − 473
2973
d1038e67923a
added a flag (eqvt) to termination proofs arising fron nominal_primrecs
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 474
termination (eqvt)
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 475
by lexicographic_order
2827
394664816e24
defined the "count-bound-variables-occurences" function which has an accumulator like trans
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 476
2950
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 477
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 478
text {* count the occurences of lambdas in a term *}
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 479
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 480
nominal_primrec
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 481
cntlams :: "lam \<Rightarrow> nat"
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 482
where
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 483
"cntlams (Var x) = 0"
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 484
| "cntlams (App t1 t2) = (cntlams t1) + (cntlams t2)"
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 485
| "cntlams (Lam [x]. t) = Suc (cntlams t)"
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 486
apply(simp add: eqvt_def cntlams_graph_def)
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 487
apply(rule, perm_simp, rule)
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 488
apply(rule TrueI)
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 489
apply(rule_tac y="x" in lam.exhaust)
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 490
apply(auto)[3]
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 491
apply(all_trivials)
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 492
apply(simp)
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 493
apply(simp)
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 494
apply(erule_tac c="()" in Abs_lst1_fcb2')
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 495
apply(simp add: pure_fresh)
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 496
apply(simp add: fresh_star_def pure_fresh)
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 497
apply(simp add: eqvt_at_def atom_eqvt fresh_star_Pair perm_supp_eq)
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 498
apply(simp add: eqvt_at_def atom_eqvt fresh_star_Pair perm_supp_eq)
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 499
done
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 500
2973
d1038e67923a
added a flag (eqvt) to termination proofs arising fron nominal_primrecs
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 501
termination (eqvt)
2950
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 502
by lexicographic_order
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 503
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 504
2860
+ − 505
text {* count the bound-variable occurences in a lambda-term *}
2827
394664816e24
defined the "count-bound-variables-occurences" function which has an accumulator like trans
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 506
2828
+ − 507
nominal_primrec
2950
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 508
cntbvs :: "lam \<Rightarrow> name list \<Rightarrow> nat"
2827
394664816e24
defined the "count-bound-variables-occurences" function which has an accumulator like trans
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 509
where
2950
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 510
"cntbvs (Var x) xs = (if x \<in> set xs then 1 else 0)"
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 511
| "cntbvs (App t1 t2) xs = (cntbvs t1 xs) + (cntbvs t2 xs)"
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 512
| "atom x \<sharp> xs \<Longrightarrow> cntbvs (Lam [x]. t) xs = cntbvs t (x # xs)"
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 513
apply(simp add: eqvt_def cntbvs_graph_def)
2828
+ − 514
apply(rule, perm_simp, rule)
2950
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 515
apply(rule TrueI)
2828
+ − 516
apply(case_tac x)
+ − 517
apply(rule_tac y="a" and c="b" in lam.strong_exhaust)
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 518
apply(auto simp add: fresh_star_def)[3]
2950
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 519
apply(all_trivials)
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 520
apply(simp)
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 521
apply(simp)
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 522
apply(simp)
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 523
apply(erule conjE)
2912
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 524
apply(erule Abs_lst1_fcb2')
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 525
apply(simp add: pure_fresh fresh_star_def)
2950
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 526
apply(simp add: fresh_star_def)
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 527
apply(simp add: eqvt_at_def atom_eqvt fresh_star_Pair perm_supp_eq)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 528
apply(simp add: eqvt_at_def atom_eqvt fresh_star_Pair perm_supp_eq)
2828
+ − 529
done
2827
394664816e24
defined the "count-bound-variables-occurences" function which has an accumulator like trans
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 530
2973
d1038e67923a
added a flag (eqvt) to termination proofs arising fron nominal_primrecs
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 531
termination (eqvt)
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 532
by lexicographic_order
2827
394664816e24
defined the "count-bound-variables-occurences" function which has an accumulator like trans
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 533
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 534
section {* De Bruijn Terms *}
2827
394664816e24
defined the "count-bound-variables-occurences" function which has an accumulator like trans
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 535
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
+ − 536
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
+ − 537
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
+ − 538
| 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
+ − 539
| 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
+ − 540
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
+ − 541
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
+ − 542
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
+ − 543
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
+ − 544
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
+ − 545
done
2795
+ − 546
+ − 547
lemma fresh_at_list: "atom x \<sharp> xs \<longleftrightarrow> x \<notin> set xs"
+ − 548
unfolding fresh_def supp_set[symmetric]
2845
+ − 549
by (induct xs) (auto simp add: supp_of_finite_insert supp_at_base supp_set_empty)
2795
+ − 550
2800
+ − 551
fun
+ − 552
vindex :: "name list \<Rightarrow> name \<Rightarrow> nat \<Rightarrow> db option"
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
+ − 553
where
2800
+ − 554
"vindex [] v n = None"
+ − 555
| "vindex (h # t) v n = (if v = h then (Some (DBVar n)) else (vindex t v (Suc n)))"
+ − 556
+ − 557
lemma vindex_eqvt[eqvt]:
+ − 558
"(p \<bullet> vindex l v n) = vindex (p \<bullet> l) (p \<bullet> v) (p \<bullet> n)"
+ − 559
by (induct l arbitrary: n) (simp_all add: permute_pure)
+ − 560
+ − 561
nominal_primrec
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 562
transdb :: "lam \<Rightarrow> name list \<Rightarrow> db option"
2800
+ − 563
where
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 564
"transdb (Var x) l = vindex l x 0"
2950
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 565
| "transdb (App t1 t2) xs =
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 566
Option.bind (transdb t1 xs) (\<lambda>d1. Option.bind (transdb t2 xs) (\<lambda>d2. Some (DBApp d1 d2)))"
2942
fac8895b109a
Express trans_db with Option.map and Option.bind. Possibly mbind is a copy of bind?
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 567
| "x \<notin> set xs \<Longrightarrow> transdb (Lam [x].t) xs = Option.map DBLam (transdb t (x # xs))"
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 568
unfolding eqvt_def transdb_graph_def
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
+ − 569
apply (rule, perm_simp, rule)
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 570
apply(rule TrueI)
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
+ − 571
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
+ − 572
apply (rule_tac y="a" and c="b" in lam.strong_exhaust)
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 573
apply (auto simp add: fresh_star_def fresh_at_list)[3]
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 574
apply(simp_all)
2942
fac8895b109a
Express trans_db with Option.map and Option.bind. Possibly mbind is a copy of bind?
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 575
apply(elim conjE)
2912
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 576
apply (erule_tac c="xsa" in Abs_lst1_fcb2')
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 577
apply (simp add: pure_fresh)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 578
apply(simp add: fresh_star_def fresh_at_list)
2942
fac8895b109a
Express trans_db with Option.map and Option.bind. Possibly mbind is a copy of bind?
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 579
apply(simp add: eqvt_at_def atom_eqvt fresh_star_Pair perm_supp_eq eqvts eqvts_raw)+
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
+ − 580
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
+ − 581
2973
d1038e67923a
added a flag (eqvt) to termination proofs arising fron nominal_primrecs
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 582
termination (eqvt)
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 583
by lexicographic_order
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
+ − 584
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 585
lemma transdb_eqvt[eqvt]:
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 586
"p \<bullet> transdb t l = transdb (p \<bullet>t) (p \<bullet>l)"
2942
fac8895b109a
Express trans_db with Option.map and Option.bind. Possibly mbind is a copy of bind?
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 587
apply (nominal_induct t avoiding: l rule: lam.strong_induct)
2800
+ − 588
apply (simp add: vindex_eqvt)
+ − 589
apply (simp_all add: permute_pure)
2797
+ − 590
apply (simp add: fresh_at_list)
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 591
apply (subst transdb.simps)
2797
+ − 592
apply (simp add: fresh_at_list[symmetric])
2800
+ − 593
apply (drule_tac x="name # l" in meta_spec)
+ − 594
apply auto
2797
+ − 595
done
+ − 596
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
+ − 597
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
+ − 598
assumes a: "y \<noteq> x"
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 599
shows "transdb (Lam [x]. Lam [y]. App (Var x) (Var y)) [] =
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 600
Some (DBLam (DBLam (DBApp (DBVar 1) (DBVar 0))))"
2795
+ − 601
using a by simp
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
+ − 602
2841
+ − 603
lemma supp_subst:
2972
+ − 604
shows "supp (t[x ::= s]) \<subseteq> (supp t - {atom x}) \<union> supp s"
+ − 605
by (induct t x s rule: subst.induct) (auto simp add: lam.supp supp_at_base)
2841
+ − 606
+ − 607
lemma var_fresh_subst:
+ − 608
"atom x \<sharp> s \<Longrightarrow> atom x \<sharp> (t[x ::= s])"
+ − 609
by (induct t x s rule: subst.induct) (auto simp add: lam.supp lam.fresh fresh_at_base)
+ − 610
2834
+ − 611
(* function that evaluates a lambda term *)
+ − 612
nominal_primrec
+ − 613
eval :: "lam \<Rightarrow> lam" and
2860
+ − 614
apply_subst :: "lam \<Rightarrow> lam \<Rightarrow> lam"
2834
+ − 615
where
+ − 616
"eval (Var x) = Var x"
+ − 617
| "eval (Lam [x].t) = Lam [x].(eval t)"
2860
+ − 618
| "eval (App t1 t2) = apply_subst (eval t1) (eval t2)"
+ − 619
| "apply_subst (Var x) t2 = App (Var x) t2"
+ − 620
| "apply_subst (App t0 t1) t2 = App (App t0 t1) t2"
+ − 621
| "atom x \<sharp> t2 \<Longrightarrow> apply_subst (Lam [x].t1) t2 = eval (t1[x::= t2])"
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 622
apply(simp add: eval_apply_subst_graph_def eqvt_def)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 623
apply(rule, perm_simp, rule)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 624
apply(rule TrueI)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 625
apply (case_tac x)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 626
apply (case_tac a rule: lam.exhaust)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 627
apply simp_all[3]
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 628
apply blast
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 629
apply (case_tac b)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 630
apply (rule_tac y="a" and c="ba" in lam.strong_exhaust)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 631
apply simp_all[3]
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 632
apply blast
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 633
apply blast
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 634
apply (simp add: Abs1_eq_iff fresh_star_def)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 635
apply(simp_all)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 636
apply(erule_tac c="()" in Abs_lst1_fcb2)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 637
apply (simp add: Abs_fresh_iff)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 638
apply(simp add: fresh_star_def fresh_Unit)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 639
apply(simp add: eqvt_at_def atom_eqvt fresh_star_Pair perm_supp_eq)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 640
apply(simp add: eqvt_at_def atom_eqvt fresh_star_Pair perm_supp_eq)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 641
apply(erule conjE)
2912
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 642
apply(erule_tac c="t2a" in Abs_lst1_fcb2')
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 643
apply (erule fresh_eqvt_at)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 644
apply (simp add: finite_supp)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 645
apply (simp add: fresh_Inl var_fresh_subst)
2912
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 646
apply(simp add: fresh_star_def)
2982
4a00077c008f
completed the eqvt-proofs for functions; they are stored under the name function_name.eqvt and added to the eqvt-list
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 647
apply(simp add: eqvt_at_def atom_eqvt fresh_star_Pair perm_supp_eq subst.eqvt)
4a00077c008f
completed the eqvt-proofs for functions; they are stored under the name function_name.eqvt and added to the eqvt-list
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 648
apply(simp add: eqvt_at_def atom_eqvt fresh_star_Pair perm_supp_eq subst.eqvt)
2860
+ − 649
done
+ − 650
+ − 651
+ − 652
(* a small test
2973
d1038e67923a
added a flag (eqvt) to termination proofs arising fron nominal_primrecs
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 653
termination (eqvt) sorry
2845
+ − 654
2860
+ − 655
lemma
+ − 656
assumes "x \<noteq> y"
+ − 657
shows "eval (App (Lam [x].App (Var x) (Var x)) (Var y)) = App (Var y) (Var y)"
+ − 658
using assms
+ − 659
apply(simp add: lam.supp fresh_def supp_at_base)
+ − 660
done
+ − 661
*)
+ − 662
2852
+ − 663
+ − 664
text {* TODO: eqvt_at for the other side *}
+ − 665
nominal_primrec q where
+ − 666
"atom c \<sharp> (x, M) \<Longrightarrow> q (Lam [x]. M) (N :: lam) = Lam [x]. (Lam [c]. (App M (q (Var c) N)))"
+ − 667
| "q (Var x) N = Var x"
+ − 668
| "q (App l r) N = App l r"
+ − 669
unfolding eqvt_def q_graph_def
+ − 670
apply (rule, perm_simp, rule)
+ − 671
apply (rule TrueI)
+ − 672
apply (case_tac x)
+ − 673
apply (rule_tac y="a" in lam.exhaust)
+ − 674
apply simp_all
+ − 675
apply blast
+ − 676
apply blast
+ − 677
apply (rule_tac x="(name, lam)" and ?'a="name" in obtain_fresh)
+ − 678
apply blast
+ − 679
apply clarify
+ − 680
apply (rule_tac x="(x, xa, M, Ma, c, ca, Na)" and ?'a="name" in obtain_fresh)
+ − 681
apply (subgoal_tac "eqvt_at q_sumC (Var ca, Na)") --"Could come from nominal_function?"
+ − 682
apply (subgoal_tac "Lam [c]. App M (q_sumC (Var c, Na)) = Lam [a]. App M (q_sumC (Var a, Na))")
+ − 683
apply (subgoal_tac "Lam [ca]. App Ma (q_sumC (Var ca, Na)) = Lam [a]. App Ma (q_sumC (Var a, Na))")
+ − 684
apply (simp only:)
+ − 685
apply (erule Abs_lst1_fcb)
+ − 686
oops
+ − 687
2846
+ − 688
text {* Working Examples *}
+ − 689
+ − 690
nominal_primrec
+ − 691
map_term :: "(lam \<Rightarrow> lam) \<Rightarrow> lam \<Rightarrow> lam"
+ − 692
where
+ − 693
"eqvt f \<Longrightarrow> map_term f (Var x) = f (Var x)"
+ − 694
| "eqvt f \<Longrightarrow> map_term f (App t1 t2) = App (f t1) (f t2)"
+ − 695
| "eqvt f \<Longrightarrow> map_term f (Lam [x].t) = Lam [x].(f t)"
+ − 696
| "\<not>eqvt f \<Longrightarrow> map_term f t = t"
+ − 697
apply (simp add: eqvt_def map_term_graph_def)
+ − 698
apply (rule, perm_simp, rule)
+ − 699
apply(rule TrueI)
+ − 700
apply (case_tac x, case_tac "eqvt a", case_tac b rule: lam.exhaust)
+ − 701
apply auto
+ − 702
apply (erule Abs_lst1_fcb)
+ − 703
apply (simp_all add: Abs_fresh_iff fresh_fun_eqvt_app)
+ − 704
apply (simp add: eqvt_def permute_fun_app_eq)
+ − 705
done
+ − 706
2973
d1038e67923a
added a flag (eqvt) to termination proofs arising fron nominal_primrecs
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 707
termination (eqvt)
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 708
by lexicographic_order
2846
+ − 709
2950
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 710
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 711
(*
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 712
abbreviation
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 713
mbind :: "'a option => ('a => 'b option) => 'b option" ("_ \<guillemotright>= _" [65,65] 65)
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 714
where
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 715
"c \<guillemotright>= f \<equiv> case c of None => None | (Some v) => f v"
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 716
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 717
lemma mbind_eqvt:
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 718
fixes c::"'a::pt option"
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 719
shows "(p \<bullet> (c \<guillemotright>= f)) = ((p \<bullet> c) \<guillemotright>= (p \<bullet> f))"
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 720
apply(cases c)
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 721
apply(simp_all)
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 722
apply(perm_simp)
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 723
apply(rule refl)
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 724
done
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 725
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 726
lemma mbind_eqvt_raw[eqvt_raw]:
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 727
shows "(p \<bullet> option_case) \<equiv> option_case"
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 728
apply(rule eq_reflection)
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 729
apply(rule ext)+
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 730
apply(case_tac xb)
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 731
apply(simp_all)
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 732
apply(rule_tac p="-p" in permute_boolE)
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 733
apply(perm_simp add: permute_minus_cancel)
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 734
apply(simp)
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 735
apply(rule_tac p="-p" in permute_boolE)
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 736
apply(perm_simp add: permute_minus_cancel)
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 737
apply(simp)
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 738
done
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 739
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 740
fun
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 741
index :: "atom list \<Rightarrow> nat \<Rightarrow> atom \<Rightarrow> nat option"
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 742
where
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 743
"index [] n x = None"
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 744
| "index (y # ys) n x = (if x = y then (Some n) else (index ys (n + 1) x))"
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 745
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 746
lemma [eqvt]:
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 747
shows "(p \<bullet> index xs n x) = index (p \<bullet> xs) (p \<bullet> n) (p \<bullet> x)"
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 748
apply(induct xs arbitrary: n)
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 749
apply(simp_all add: permute_pure)
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 750
done
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 751
*)
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 752
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 753
(*
2846
+ − 754
nominal_primrec
+ − 755
trans2 :: "lam \<Rightarrow> atom list \<Rightarrow> db option"
+ − 756
where
2950
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 757
"trans2 (Var x) xs = (index xs 0 (atom x) \<guillemotright>= (\<lambda>n::nat. Some (DBVar n)))"
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 758
| "trans2 (App t1 t2) xs =
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 759
((trans2 t1 xs) \<guillemotright>= (\<lambda>db1::db. (trans2 t2 xs) \<guillemotright>= (\<lambda>db2::db. Some (DBApp db1 db2))))"
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 760
| "trans2 (Lam [x].t) xs = (trans2 t (atom x # xs) \<guillemotright>= (\<lambda>db::db. Some (DBLam db)))"
2846
+ − 761
oops
2950
0911cb7bf696
changed bind to binds in specifications; bind will cause trouble with Monad_Syntax
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 762
*)
2846
+ − 763
+ − 764
nominal_primrec
+ − 765
CPS :: "lam \<Rightarrow> (lam \<Rightarrow> lam) \<Rightarrow> lam"
+ − 766
where
+ − 767
"CPS (Var x) k = Var x"
+ − 768
| "CPS (App M N) k = CPS M (\<lambda>m. CPS N (\<lambda>n. n))"
+ − 769
oops
+ − 770
+ − 771
consts b :: name
+ − 772
nominal_primrec
+ − 773
Z :: "lam \<Rightarrow> (lam \<Rightarrow> lam) \<Rightarrow> lam"
+ − 774
where
+ − 775
"Z (App M N) k = Z M (%m. (Z N (%n.(App m n))))"
+ − 776
| "Z (App M N) k = Z M (%m. (Z N (%n.(App (App m n) (Abs b (k (Var b)))))))"
+ − 777
unfolding eqvt_def Z_graph_def
+ − 778
apply (rule, perm_simp, rule)
+ − 779
oops
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
+ − 780
2937
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 781
lemma test:
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 782
assumes "t = s"
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 783
and "supp p \<sharp>* t" "supp p \<sharp>* x"
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 784
and "(p \<bullet> t) = s \<Longrightarrow> (p \<bullet> x) = y"
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 785
shows "x = y"
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 786
using assms by (simp add: perm_supp_eq)
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 787
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 788
lemma test2:
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 789
assumes "cs \<subseteq> as \<union> bs"
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 790
and "as \<sharp>* x" "bs \<sharp>* x"
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 791
shows "cs \<sharp>* x"
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 792
using assms
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 793
by (auto simp add: fresh_star_def)
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 794
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 795
lemma test3:
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 796
assumes "cs \<subseteq> as"
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 797
and "as \<sharp>* x"
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 798
shows "cs \<sharp>* x"
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 799
using assms
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 800
by (auto simp add: fresh_star_def)
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 801
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 802
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 803
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 804
nominal_primrec (invariant "\<lambda>(_, _, xs) y. atom ` fst ` set xs \<sharp>* y \<and> atom ` snd ` set xs \<sharp>* y")
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 805
aux :: "lam \<Rightarrow> lam \<Rightarrow> (name \<times> name) list \<Rightarrow> bool"
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 806
where
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 807
"aux (Var x) (Var y) xs = ((x, y) \<in> set xs)"
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 808
| "aux (App t1 t2) (App s1 s2) xs = (aux t1 s1 xs \<and> aux t2 s2 xs)"
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 809
| "aux (Var x) (App t1 t2) xs = False"
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 810
| "aux (Var x) (Lam [y].t) xs = False"
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 811
| "aux (App t1 t2) (Var x) xs = False"
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 812
| "aux (App t1 t2) (Lam [x].t) xs = False"
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 813
| "aux (Lam [x].t) (Var y) xs = False"
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 814
| "aux (Lam [x].t) (App t1 t2) xs = False"
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 815
| "\<lbrakk>{atom x} \<sharp>* (s, xs); {atom y} \<sharp>* (t, xs); x \<noteq> y\<rbrakk> \<Longrightarrow>
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 816
aux (Lam [x].t) (Lam [y].s) xs = aux t s ((x, y) # xs)"
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 817
apply (simp add: eqvt_def aux_graph_def)
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 818
apply (rule, perm_simp, rule)
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 819
apply(erule aux_graph.induct)
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 820
apply(simp_all add: fresh_star_def pure_fresh)[9]
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 821
apply(case_tac x)
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 822
apply(simp)
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 823
apply(rule_tac y="a" and c="(b, c)" in lam.strong_exhaust)
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 824
apply(simp)
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 825
apply(rule_tac y="b" and c="c" in lam.strong_exhaust)
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 826
apply(metis)+
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 827
apply(simp)
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 828
apply(rule_tac y="b" and c="c" in lam.strong_exhaust)
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 829
apply(metis)+
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 830
apply(simp)
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 831
apply(rule_tac y="b" and c="(lam, c, name)" in lam.strong_exhaust)
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 832
apply(metis)+
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 833
apply(simp)
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 834
apply(drule_tac x="name" in meta_spec)
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 835
apply(drule_tac x="lama" in meta_spec)
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 836
apply(drule_tac x="c" in meta_spec)
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 837
apply(drule_tac x="namea" in meta_spec)
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 838
apply(drule_tac x="lam" in meta_spec)
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 839
apply(simp add: fresh_star_Pair)
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 840
apply(simp add: fresh_star_def fresh_at_base lam.fresh)
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 841
apply(auto)[1]
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 842
apply(simp_all)[44]
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 843
apply(simp del: Product_Type.prod.inject)
2948
+ − 844
oops
2937
a56d422e17f6
added an example that recurses over two arguments; the interesting proof-obligation is not yet done
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 845
2941
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 846
lemma abs_same_binder:
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 847
fixes t ta s sa :: "_ :: fs"
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 848
assumes "sort_of (atom x) = sort_of (atom y)"
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 849
shows "[[atom x]]lst. t = [[atom y]]lst. ta \<and> [[atom x]]lst. s = [[atom y]]lst. sa
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 850
\<longleftrightarrow> [[atom x]]lst. (t, s) = [[atom y]]lst. (ta, sa)"
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 851
by (cases "atom x = atom y") (auto simp add: Abs1_eq_iff assms fresh_Pair)
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 852
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 853
nominal_primrec
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 854
aux2 :: "lam \<Rightarrow> lam \<Rightarrow> bool"
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 855
where
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 856
"aux2 (Var x) (Var y) = (x = y)"
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 857
| "aux2 (App t1 t2) (App s1 s2) = (aux2 t1 s1 \<and> aux2 t2 s2)"
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 858
| "aux2 (Var x) (App t1 t2) = False"
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 859
| "aux2 (Var x) (Lam [y].t) = False"
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 860
| "aux2 (App t1 t2) (Var x) = False"
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 861
| "aux2 (App t1 t2) (Lam [x].t) = False"
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 862
| "aux2 (Lam [x].t) (Var y) = False"
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 863
| "aux2 (Lam [x].t) (App t1 t2) = False"
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 864
| "x = y \<Longrightarrow> aux2 (Lam [x].t) (Lam [y].s) = aux2 t s"
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 865
apply(simp add: eqvt_def aux2_graph_def)
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 866
apply(rule, perm_simp, rule, rule)
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 867
apply(case_tac x)
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 868
apply(rule_tac y="a" and c="b" in lam.strong_exhaust)
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 869
apply(rule_tac y="b" in lam.exhaust)
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 870
apply(auto)[3]
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 871
apply(rule_tac y="b" in lam.exhaust)
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 872
apply(auto)[3]
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 873
apply(rule_tac y="b" and c="(name, lam)" in lam.strong_exhaust)
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 874
apply(auto)[3]
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 875
apply(drule_tac x="name" in meta_spec)
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 876
apply(drule_tac x="name" in meta_spec)
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 877
apply(drule_tac x="lam" in meta_spec)
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 878
apply(drule_tac x="(name \<leftrightarrow> namea) \<bullet> lama" in meta_spec)
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 879
apply(simp add: Abs1_eq_iff fresh_star_def fresh_Pair_elim fresh_at_base lam.fresh flip_def)
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 880
apply (metis Nominal2_Base.swap_commute fresh_permute_iff sort_of_atom_eq swap_atom_simps(2))
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 881
apply simp_all
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 882
apply (simp add: abs_same_binder)
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 883
apply (erule_tac c="()" in Abs_lst1_fcb2)
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 884
apply (simp_all add: pure_fresh fresh_star_def eqvt_at_def)
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 885
done
40991ebcda12
Define a version of aux only for same binders. Completeness is fine.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 886
2940
+ − 887
text {* tests of functions containing if and case *}
+ − 888
2995
6d2859aeebba
Comment out examples with 'True' that do not work because function still does not work
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 889
(*consts P :: "lam \<Rightarrow> bool"
2940
+ − 890
+ − 891
nominal_primrec
+ − 892
A :: "lam => lam"
+ − 893
where
+ − 894
"A (App M N) = (if (True \<or> P M) then (A M) else (A N))"
+ − 895
| "A (Var x) = (Var x)"
+ − 896
| "A (App M N) = (if True then M else A N)"
+ − 897
oops
+ − 898
+ − 899
nominal_primrec
+ − 900
C :: "lam => lam"
+ − 901
where
+ − 902
"C (App M N) = (case (True \<or> P M) of True \<Rightarrow> (A M) | False \<Rightarrow> (A N))"
+ − 903
| "C (Var x) = (Var x)"
+ − 904
| "C (App M N) = (if True then M else C N)"
+ − 905
oops
+ − 906
+ − 907
nominal_primrec
+ − 908
A :: "lam => lam"
+ − 909
where
+ − 910
"A (Lam [x].M) = (Lam [x].M)"
+ − 911
| "A (Var x) = (Var x)"
+ − 912
| "A (App M N) = (if True then M else A N)"
+ − 913
oops
+ − 914
+ − 915
nominal_primrec
+ − 916
B :: "lam => lam"
+ − 917
where
+ − 918
"B (Lam [x].M) = (Lam [x].M)"
+ − 919
| "B (Var x) = (Var x)"
+ − 920
| "B (App M N) = (if True then M else (B N))"
+ − 921
unfolding eqvt_def
+ − 922
unfolding B_graph_def
+ − 923
apply(perm_simp)
+ − 924
apply(rule allI)
+ − 925
apply(rule refl)
2995
6d2859aeebba
Comment out examples with 'True' that do not work because function still does not work
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 926
oops*)
2940
+ − 927
1594
+ − 928
end
+ − 929
+ − 930
+ − 931