1797
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1
theory Lambda
2454
+ − 2
imports "../Nominal2"
1594
+ − 3
begin
+ − 4
+ − 5
atom_decl name
2440
0a36825b16c1
"isabelle make test" makes all major examples....they work up to supp theorems (excluding)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 6
declare [[STEPS = 100]]
1594
+ − 7
2436
+ − 8
nominal_datatype lam =
1800
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 9
Var "name"
2436
+ − 10
| App "lam" "lam"
+ − 11
| Lam x::"name" l::"lam" bind x in l
2431
331873ebc5cd
can now deal with type variables in nominal datatype definitions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 12
2436
+ − 13
thm lam.distinct
+ − 14
thm lam.induct
+ − 15
thm lam.exhaust
+ − 16
thm lam.fv_defs
+ − 17
thm lam.bn_defs
+ − 18
thm lam.perm_simps
+ − 19
thm lam.eq_iff
2442
+ − 20
thm lam.eq_iff[folded alphas]
2436
+ − 21
thm lam.fv_bn_eqvt
+ − 22
thm lam.size_eqvt
2431
331873ebc5cd
can now deal with type variables in nominal datatype definitions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 23
2424
621ebd8b13c4
changed parser so that the binding mode is indicated as "bind (list)", "bind (set)" or "bind (res)"; if only "bind" is given, then bind (list) is assumed as default
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 24
2082
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 25
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
+ − 26
section {* Strong Induction Principles*}
1594
+ − 27
2041
+ − 28
(*
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
+ − 29
Old way of establishing strong induction
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 30
principles by chosing a fresh name.
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 31
*)
2436
+ − 32
(*
1594
+ − 33
lemma
+ − 34
fixes c::"'a::fs"
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
+ − 35
assumes a1: "\<And>name c. P c (Var name)"
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
+ − 36
and a2: "\<And>lam1 lam2 c. \<lbrakk>\<And>d. P d lam1; \<And>d. P d lam2\<rbrakk> \<Longrightarrow> P c (App lam1 lam2)"
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
+ − 37
and a3: "\<And>name lam c. \<lbrakk>atom name \<sharp> c; \<And>d. P d lam\<rbrakk> \<Longrightarrow> P c (Lam name lam)"
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
+ − 38
shows "P c lam"
1594
+ − 39
proof -
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
+ − 40
have "\<And>p. P c (p \<bullet> lam)"
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
+ − 41
apply(induct lam arbitrary: c rule: lam.induct)
1805
+ − 42
apply(perm_simp)
1594
+ − 43
apply(rule a1)
1805
+ − 44
apply(perm_simp)
1594
+ − 45
apply(rule a2)
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
+ − 46
apply(assumption)
1594
+ − 47
apply(assumption)
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
+ − 48
apply(subgoal_tac "\<exists>new::name. (atom new) \<sharp> (c, Lam (p \<bullet> name) (p \<bullet> lam))")
1594
+ − 49
defer
+ − 50
apply(simp add: fresh_def)
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
+ − 51
apply(rule_tac X="supp (c, Lam (p \<bullet> name) (p \<bullet> lam))" in obtain_at_base)
1594
+ − 52
apply(simp add: supp_Pair finite_supp)
+ − 53
apply(blast)
+ − 54
apply(erule exE)
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
+ − 55
apply(rule_tac t="p \<bullet> Lam name lam" and
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
+ − 56
s="(((p \<bullet> name) \<leftrightarrow> new) + p) \<bullet> Lam name lam" in subst)
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
+ − 57
apply(simp del: lam.perm)
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
+ − 58
apply(subst lam.perm)
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
+ − 59
apply(subst (2) lam.perm)
1594
+ − 60
apply(rule flip_fresh_fresh)
+ − 61
apply(simp add: fresh_def)
+ − 62
apply(simp only: supp_fn')
+ − 63
apply(simp)
+ − 64
apply(simp add: fresh_Pair)
+ − 65
apply(simp)
+ − 66
apply(rule a3)
+ − 67
apply(simp add: fresh_Pair)
+ − 68
apply(drule_tac x="((p \<bullet> name) \<leftrightarrow> new) + p" in meta_spec)
+ − 69
apply(simp)
+ − 70
done
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
+ − 71
then have "P c (0 \<bullet> lam)" by blast
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
+ − 72
then show "P c lam" by simp
1594
+ − 73
qed
2436
+ − 74
*)
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
+ − 75
(*
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 76
New way of establishing strong induction
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 77
principles by using a appropriate permutation.
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 78
*)
2436
+ − 79
(*
1594
+ − 80
lemma
+ − 81
fixes c::"'a::fs"
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
+ − 82
assumes a1: "\<And>name c. P c (Var name)"
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
+ − 83
and a2: "\<And>lam1 lam2 c. \<lbrakk>\<And>d. P d lam1; \<And>d. P d lam2\<rbrakk> \<Longrightarrow> P c (App lam1 lam2)"
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
+ − 84
and a3: "\<And>name lam c. \<lbrakk>atom name \<sharp> c; \<And>d. P d lam\<rbrakk> \<Longrightarrow> P c (Lam name lam)"
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
+ − 85
shows "P c lam"
1594
+ − 86
proof -
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
+ − 87
have "\<And>p. P c (p \<bullet> lam)"
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
+ − 88
apply(induct lam arbitrary: c rule: lam.induct)
1805
+ − 89
apply(perm_simp)
1594
+ − 90
apply(rule a1)
1805
+ − 91
apply(perm_simp)
1594
+ − 92
apply(rule a2)
+ − 93
apply(assumption)
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
+ − 94
apply(assumption)
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
+ − 95
apply(subgoal_tac "\<exists>q. (q \<bullet> {p \<bullet> atom name}) \<sharp>* c \<and> supp (p \<bullet> Lam name lam) \<sharp>* q")
1594
+ − 96
apply(erule exE)
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
+ − 97
apply(rule_tac t="p \<bullet> Lam name lam" and
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
+ − 98
s="q \<bullet> p \<bullet> Lam name lam" in subst)
1594
+ − 99
defer
1805
+ − 100
apply(simp)
1594
+ − 101
apply(rule a3)
+ − 102
apply(simp add: eqvts fresh_star_def)
+ − 103
apply(drule_tac x="q + p" in meta_spec)
+ − 104
apply(simp)
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
+ − 105
apply(rule at_set_avoiding2)
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 106
apply(simp add: finite_supp)
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 107
apply(simp add: finite_supp)
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 108
apply(simp add: finite_supp)
1805
+ − 109
apply(perm_simp)
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
+ − 110
apply(simp add: fresh_star_def fresh_def supp_fn')
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 111
apply(rule supp_perm_eq)
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 112
apply(simp)
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 113
done
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
+ − 114
then have "P c (0 \<bullet> lam)" by blast
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
+ − 115
then show "P c lam" by simp
1594
+ − 116
qed
2436
+ − 117
*)
1594
+ − 118
1805
+ − 119
section {* Typing *}
+ − 120
+ − 121
nominal_datatype ty =
+ − 122
TVar string
1810
894930834ca8
fixed bug in thmdecls with destructing Trueprop; some initial infrastructure for eqvt-theorems of the form _ ==> _
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 123
| TFun ty ty
894930834ca8
fixed bug in thmdecls with destructing Trueprop; some initial infrastructure for eqvt-theorems of the form _ ==> _
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 124
894930834ca8
fixed bug in thmdecls with destructing Trueprop; some initial infrastructure for eqvt-theorems of the form _ ==> _
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 125
notation
894930834ca8
fixed bug in thmdecls with destructing Trueprop; some initial infrastructure for eqvt-theorems of the form _ ==> _
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 126
TFun ("_ \<rightarrow> _")
894930834ca8
fixed bug in thmdecls with destructing Trueprop; some initial infrastructure for eqvt-theorems of the form _ ==> _
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 127
2436
+ − 128
(*
1810
894930834ca8
fixed bug in thmdecls with destructing Trueprop; some initial infrastructure for eqvt-theorems of the form _ ==> _
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 129
declare ty.perm[eqvt]
1805
+ − 130
+ − 131
inductive
+ − 132
valid :: "(name \<times> ty) list \<Rightarrow> bool"
+ − 133
where
+ − 134
"valid []"
+ − 135
| "\<lbrakk>atom x \<sharp> Gamma; valid Gamma\<rbrakk> \<Longrightarrow> valid ((x, T)#Gamma)"
+ − 136
1828
+ − 137
inductive
+ − 138
typing :: "(name\<times>ty) list \<Rightarrow> lam \<Rightarrow> ty \<Rightarrow> bool" ("_ \<turnstile> _ : _" [60,60,60] 60)
+ − 139
where
+ − 140
t_Var[intro]: "\<lbrakk>valid \<Gamma>; (x, T) \<in> set \<Gamma>\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> Var x : T"
1947
+ − 141
| t_App[intro]: "\<lbrakk>\<Gamma> \<turnstile> t1 : T1 \<rightarrow> T2; \<Gamma> \<turnstile> t2 : T1\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> App t1 t2 : T2"
1828
+ − 142
| t_Lam[intro]: "\<lbrakk>atom x \<sharp> \<Gamma>; (x, T1) # \<Gamma> \<turnstile> t : T2\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> Lam x t : T1 \<rightarrow> T2"
+ − 143
1831
+ − 144
equivariance valid
+ − 145
equivariance typing
1816
+ − 146
1831
+ − 147
thm valid.eqvt
+ − 148
thm typing.eqvt
1811
ae176476b525
implemented in thmdecls the case where eqvt-lemmas are of the form _ ==> _
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 149
thm eqvts
ae176476b525
implemented in thmdecls the case where eqvt-lemmas are of the form _ ==> _
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 150
thm eqvts_raw
ae176476b525
implemented in thmdecls the case where eqvt-lemmas are of the form _ ==> _
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 151
1949
+ − 152
thm typing.induct[of "\<Gamma>" "t" "T", no_vars]
+ − 153
+ − 154
lemma
+ − 155
fixes c::"'a::fs"
+ − 156
assumes a: "\<Gamma> \<turnstile> t : T"
+ − 157
and a1: "\<And>\<Gamma> x T c. \<lbrakk>valid \<Gamma>; (x, T) \<in> set \<Gamma>\<rbrakk> \<Longrightarrow> P c \<Gamma> (Var x) T"
+ − 158
and a2: "\<And>\<Gamma> t1 T1 T2 t2 c. \<lbrakk>\<Gamma> \<turnstile> t1 : T1 \<rightarrow> T2; \<And>d. P d \<Gamma> t1 T1 \<rightarrow> T2; \<Gamma> \<turnstile> t2 : T1; \<And>d. P d \<Gamma> t2 T1\<rbrakk>
+ − 159
\<Longrightarrow> P c \<Gamma> (App t1 t2) T2"
+ − 160
and a3: "\<And>x \<Gamma> T1 t T2 c. \<lbrakk>atom x \<sharp> c; atom x \<sharp> \<Gamma>; (x, T1) # \<Gamma> \<turnstile> t : T2; \<And>d. P d ((x, T1) # \<Gamma>) t T2\<rbrakk>
+ − 161
\<Longrightarrow> P c \<Gamma> (Lam x t) T1 \<rightarrow> T2"
+ − 162
shows "P c \<Gamma> t T"
+ − 163
proof -
+ − 164
from a have "\<And>p c. P c (p \<bullet> \<Gamma>) (p \<bullet> t) (p \<bullet> T)"
+ − 165
proof (induct)
+ − 166
case (t_Var \<Gamma> x T p c)
+ − 167
then show ?case
+ − 168
apply -
+ − 169
apply(perm_strict_simp)
+ − 170
apply(rule a1)
1954
+ − 171
apply(drule_tac p="p" in permute_boolI)
1949
+ − 172
apply(perm_strict_simp add: permute_minus_cancel)
+ − 173
apply(assumption)
1954
+ − 174
apply(rotate_tac 1)
+ − 175
apply(drule_tac p="p" in permute_boolI)
1949
+ − 176
apply(perm_strict_simp add: permute_minus_cancel)
+ − 177
apply(assumption)
+ − 178
done
+ − 179
next
+ − 180
case (t_App \<Gamma> t1 T1 T2 t2 p c)
+ − 181
then show ?case
+ − 182
apply -
+ − 183
apply(perm_strict_simp)
1954
+ − 184
apply(rule a2)
+ − 185
apply(drule_tac p="p" in permute_boolI)
1949
+ − 186
apply(perm_strict_simp add: permute_minus_cancel)
+ − 187
apply(assumption)
+ − 188
apply(assumption)
1954
+ − 189
apply(rotate_tac 2)
+ − 190
apply(drule_tac p="p" in permute_boolI)
1949
+ − 191
apply(perm_strict_simp add: permute_minus_cancel)
+ − 192
apply(assumption)
+ − 193
apply(assumption)
+ − 194
done
+ − 195
next
+ − 196
case (t_Lam x \<Gamma> T1 t T2 p c)
+ − 197
then show ?case
+ − 198
apply -
+ − 199
apply(subgoal_tac "\<exists>q. (q \<bullet> {p \<bullet> atom x}) \<sharp>* c \<and>
+ − 200
supp (p \<bullet> \<Gamma>, p \<bullet> Lam x t, p \<bullet> (T1 \<rightarrow> T2)) \<sharp>* q")
+ − 201
apply(erule exE)
1954
+ − 202
apply(rule_tac t="p \<bullet> \<Gamma>" and s="(q + p) \<bullet> \<Gamma>" in subst)
+ − 203
apply(simp only: permute_plus)
1949
+ − 204
apply(rule supp_perm_eq)
+ − 205
apply(simp add: supp_Pair fresh_star_union)
1954
+ − 206
apply(rule_tac t="p \<bullet> Lam x t" and s="(q + p) \<bullet> Lam x t" in subst)
+ − 207
apply(simp only: permute_plus)
1949
+ − 208
apply(rule supp_perm_eq)
+ − 209
apply(simp add: supp_Pair fresh_star_union)
1954
+ − 210
apply(rule_tac t="p \<bullet> (T1 \<rightarrow> T2)" and s="(q + p) \<bullet> (T1 \<rightarrow> T2)" in subst)
+ − 211
apply(simp only: permute_plus)
+ − 212
apply(rule supp_perm_eq)
+ − 213
apply(simp add: supp_Pair fresh_star_union)
+ − 214
apply(simp (no_asm) only: eqvts)
1949
+ − 215
apply(rule a3)
1954
+ − 216
apply(simp only: eqvts permute_plus)
1949
+ − 217
apply(simp add: fresh_star_def)
1954
+ − 218
apply(drule_tac p="q + p" in permute_boolI)
1949
+ − 219
apply(perm_strict_simp add: permute_minus_cancel)
+ − 220
apply(assumption)
1954
+ − 221
apply(rotate_tac 1)
+ − 222
apply(drule_tac p="q + p" in permute_boolI)
1949
+ − 223
apply(perm_strict_simp add: permute_minus_cancel)
+ − 224
apply(assumption)
+ − 225
apply(drule_tac x="d" in meta_spec)
+ − 226
apply(drule_tac x="q + p" in meta_spec)
1954
+ − 227
apply(perm_strict_simp add: permute_minus_cancel)
+ − 228
apply(assumption)
1949
+ − 229
apply(rule at_set_avoiding2)
+ − 230
apply(simp add: finite_supp)
+ − 231
apply(simp add: finite_supp)
+ − 232
apply(simp add: finite_supp)
+ − 233
apply(rule_tac p="-p" in permute_boolE)
+ − 234
apply(perm_strict_simp add: permute_minus_cancel)
2436
+ − 235
--"supplied by the user"
1949
+ − 236
apply(simp add: fresh_star_prod)
+ − 237
apply(simp add: fresh_star_def)
1954
+ − 238
sorry
+ − 239
qed
+ − 240
then have "P c (0 \<bullet> \<Gamma>) (0 \<bullet> t) (0 \<bullet> T)" .
+ − 241
then show "P c \<Gamma> t T" by simp
+ − 242
qed
1949
+ − 243
1833
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 244
*)
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 245
1810
894930834ca8
fixed bug in thmdecls with destructing Trueprop; some initial infrastructure for eqvt-theorems of the form _ ==> _
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 246
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
+ − 247
section {* Matching *}
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
+ − 248
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
+ − 249
definition
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
+ − 250
MATCH :: "('c::pt \<Rightarrow> (bool * 'a::pt * 'b::pt)) \<Rightarrow> 'b \<Rightarrow> 'a \<Rightarrow> 'b"
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
+ − 251
where
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
+ − 252
"MATCH M d x \<equiv> if (\<exists>!r. \<exists>q. M q = (True, x, r)) then (THE r. \<exists>q. M q = (True, x, r)) else d"
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
+ − 253
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
+ − 254
(*
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
+ − 255
lemma MATCH_eqvt:
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
+ − 256
shows "p \<bullet> (MATCH M d x) = MATCH (p \<bullet> M) (p \<bullet> d) (p \<bullet> x)"
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
+ − 257
unfolding MATCH_def
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
+ − 258
apply(perm_simp the_eqvt)
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
+ − 259
apply (tactic {* Nominal_Permeq.eqvt_tac @{context} 1 *})
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
+ − 260
apply(simp)
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
+ − 261
thm eqvts_raw
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
+ − 262
apply(subst if_eqvt)
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
+ − 263
apply(subst ex1_eqvt)
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
+ − 264
apply(subst permute_fun_def)
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
+ − 265
apply(subst ex_eqvt)
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
+ − 266
apply(subst permute_fun_def)
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
+ − 267
apply(subst eq_eqvt)
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
+ − 268
apply(subst permute_fun_app_eq[where f="M"])
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
+ − 269
apply(simp only: permute_minus_cancel)
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
+ − 270
apply(subst permute_prod.simps)
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
+ − 271
apply(subst permute_prod.simps)
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
+ − 272
apply(simp only: permute_minus_cancel)
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
+ − 273
apply(simp only: permute_bool_def)
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
+ − 274
apply(simp)
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
+ − 275
apply(subst ex1_eqvt)
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
+ − 276
apply(subst permute_fun_def)
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
+ − 277
apply(subst ex_eqvt)
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
+ − 278
apply(subst permute_fun_def)
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
+ − 279
apply(subst eq_eqvt)
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
+ − 280
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
+ − 281
apply(simp only: eqvts)
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
+ − 282
apply(simp)
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
+ − 283
apply(subgoal_tac "(p \<bullet> (\<exists>!r. \<exists>q. M q = (True, x, r))) = (\<exists>!r. \<exists>q. (p \<bullet> M) q = (True, p \<bullet> x, r))")
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
+ − 284
apply(drule sym)
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
+ − 285
apply(simp)
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
+ − 286
apply(rule impI)
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
+ − 287
apply(simp add: perm_bool)
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
+ − 288
apply(rule trans)
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
+ − 289
apply(rule pt_the_eqvt[OF pta at])
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
+ − 290
apply(assumption)
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
+ − 291
apply(simp add: pt_ex_eqvt[OF pt at])
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
+ − 292
apply(simp add: pt_eq_eqvt[OF ptb at])
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
+ − 293
apply(rule cheat)
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
+ − 294
apply(rule trans)
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
+ − 295
apply(rule pt_ex1_eqvt)
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
+ − 296
apply(rule pta)
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
+ − 297
apply(rule at)
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
+ − 298
apply(simp add: pt_ex_eqvt[OF pt at])
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
+ − 299
apply(simp add: pt_eq_eqvt[OF ptb at])
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
+ − 300
apply(subst pt_pi_rev[OF pta at])
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
+ − 301
apply(subst pt_fun_app_eq[OF pt at])
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
+ − 302
apply(subst pt_pi_rev[OF pt at])
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
+ − 303
apply(simp)
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
+ − 304
done
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
+ − 305
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
+ − 306
lemma MATCH_cng:
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
+ − 307
assumes a: "M1 = M2" "d1 = d2"
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
+ − 308
shows "MATCH M1 d1 x = MATCH M2 d2 x"
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
+ − 309
using a by simp
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
+ − 310
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
+ − 311
lemma MATCH_eq:
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
+ − 312
assumes a: "t = l x" "G x" "\<And>x'. t = l x' \<Longrightarrow> G x' \<Longrightarrow> r x' = r x"
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
+ − 313
shows "MATCH (\<lambda>x. (G x, l x, r x)) d t = r x"
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
+ − 314
using a
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
+ − 315
unfolding MATCH_def
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
+ − 316
apply(subst if_P)
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
+ − 317
apply(rule_tac a="r x" in ex1I)
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
+ − 318
apply(rule_tac x="x" in exI)
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
+ − 319
apply(blast)
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
+ − 320
apply(erule exE)
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
+ − 321
apply(drule_tac x="q" in meta_spec)
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
+ − 322
apply(auto)[1]
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
+ − 323
apply(rule the_equality)
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
+ − 324
apply(blast)
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
+ − 325
apply(erule exE)
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
+ − 326
apply(drule_tac x="q" in meta_spec)
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
+ − 327
apply(auto)[1]
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
+ − 328
done
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
+ − 329
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
+ − 330
lemma MATCH_eq2:
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
+ − 331
assumes a: "t = l x1 x2" "G x1 x2" "\<And>x1' x2'. t = l x1' x2' \<Longrightarrow> G x1' x2' \<Longrightarrow> r x1' x2' = r x1 x2"
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
+ − 332
shows "MATCH (\<lambda>(x1,x2). (G x1 x2, l x1 x2, r x1 x2)) d t = r x1 x2"
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
+ − 333
sorry
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
+ − 334
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
+ − 335
lemma MATCH_neq:
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
+ − 336
assumes a: "\<And>x. t = l x \<Longrightarrow> G x \<Longrightarrow> False"
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
+ − 337
shows "MATCH (\<lambda>x. (G x, l x, r x)) d t = d"
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
+ − 338
using a
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
+ − 339
unfolding MATCH_def
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
+ − 340
apply(subst if_not_P)
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
+ − 341
apply(blast)
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
+ − 342
apply(rule refl)
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
+ − 343
done
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
+ − 344
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
+ − 345
lemma MATCH_neq2:
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
+ − 346
assumes a: "\<And>x1 x2. t = l x1 x2 \<Longrightarrow> G x1 x2 \<Longrightarrow> False"
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
+ − 347
shows "MATCH (\<lambda>(x1,x2). (G x1 x2, l x1 x2, r x1 x2)) d t = d"
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
+ − 348
using a
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
+ − 349
unfolding MATCH_def
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
+ − 350
apply(subst if_not_P)
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
+ − 351
apply(auto)
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
+ − 352
done
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
+ − 353
*)
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
+ − 354
1954
+ − 355
ML {*
+ − 356
fun mk_avoids ctxt params name set =
+ − 357
let
+ − 358
val (_, ctxt') = ProofContext.add_fixes
+ − 359
(map (fn (s, T) => (Binding.name s, SOME T, NoSyn)) params) ctxt;
+ − 360
fun mk s =
+ − 361
let
+ − 362
val t = Syntax.read_term ctxt' s;
+ − 363
val t' = list_abs_free (params, t) |>
+ − 364
funpow (length params) (fn Abs (_, _, t) => t)
+ − 365
in (t', HOLogic.dest_setT (fastype_of t)) end
+ − 366
handle TERM _ =>
+ − 367
error ("Expression " ^ quote s ^ " to be avoided in case " ^
+ − 368
quote name ^ " is not a set type");
+ − 369
fun add_set p [] = [p]
+ − 370
| add_set (t, T) ((u, U) :: ps) =
+ − 371
if T = U then
+ − 372
let val S = HOLogic.mk_setT T
+ − 373
in (Const (@{const_name sup}, S --> S --> S) $ u $ t, T) :: ps
+ − 374
end
+ − 375
else (u, U) :: add_set (t, T) ps
+ − 376
in
+ − 377
(mk #> add_set) set
+ − 378
end;
+ − 379
*}
+ − 380
+ − 381
+ − 382
ML {*
+ − 383
writeln (commas (map (Syntax.string_of_term @{context} o fst)
+ − 384
(mk_avoids @{context} [] "t_Var" "{x}" [])))
+ − 385
*}
+ − 386
1947
+ − 387
1949
+ − 388
ML {*
+ − 389
+ − 390
fun prove_strong_ind (pred_name, avoids) ctxt =
+ − 391
Proof.theorem NONE (K I) [] ctxt
+ − 392
2169
+ − 393
local structure P = Parse and K = Keyword in
1949
+ − 394
+ − 395
val _ =
2169
+ − 396
Outer_Syntax.local_theory_to_proof "nominal_inductive"
1949
+ − 397
"proves strong induction theorem for inductive predicate involving nominal datatypes" K.thy_goal
+ − 398
(P.xname -- (Scan.optional (P.$$$ "avoids" |-- P.enum1 "|" (P.name --
+ − 399
(P.$$$ ":" |-- P.and_list1 P.term))) []) >> prove_strong_ind)
+ − 400
+ − 401
end;
+ − 402
+ − 403
*}
+ − 404
1950
+ − 405
(*
1949
+ − 406
nominal_inductive typing
1950
+ − 407
*)
1949
+ − 408
2157
+ − 409
(* Substitution *)
2159
+ − 410
2165
+ − 411
primrec match_Var_raw where
+ − 412
"match_Var_raw (Var_raw x) = Some x"
+ − 413
| "match_Var_raw (App_raw x y) = None"
+ − 414
| "match_Var_raw (Lam_raw n t) = None"
+ − 415
+ − 416
quotient_definition
+ − 417
"match_Var :: lam \<Rightarrow> name option"
+ − 418
is match_Var_raw
+ − 419
+ − 420
lemma [quot_respect]: "(alpha_lam_raw ===> op =) match_Var_raw match_Var_raw"
+ − 421
apply rule
+ − 422
apply (induct_tac a b rule: alpha_lam_raw.induct)
+ − 423
apply simp_all
+ − 424
done
+ − 425
+ − 426
lemmas match_Var_simps = match_Var_raw.simps[quot_lifted]
+ − 427
+ − 428
primrec match_App_raw where
+ − 429
"match_App_raw (Var_raw x) = None"
+ − 430
| "match_App_raw (App_raw x y) = Some (x, y)"
+ − 431
| "match_App_raw (Lam_raw n t) = None"
+ − 432
2436
+ − 433
(*
2165
+ − 434
quotient_definition
+ − 435
"match_App :: lam \<Rightarrow> (lam \<times> lam) option"
+ − 436
is match_App_raw
+ − 437
+ − 438
lemma [quot_respect]:
+ − 439
"(alpha_lam_raw ===> option_rel (prod_rel alpha_lam_raw alpha_lam_raw)) match_App_raw match_App_raw"
+ − 440
apply (intro fun_relI)
+ − 441
apply (induct_tac a b rule: alpha_lam_raw.induct)
+ − 442
apply simp_all
+ − 443
done
+ − 444
+ − 445
lemmas match_App_simps = match_App_raw.simps[quot_lifted]
+ − 446
2173
+ − 447
definition new where
+ − 448
"new (s :: 'a :: fs) = (THE x. \<forall>a \<in> supp s. atom x \<noteq> a)"
+ − 449
+ − 450
definition
+ − 451
"match_Lam (S :: 'a :: fs) t = (if (\<exists>n s. (t = Lam n s)) then
+ − 452
(let z = new (S, t) in Some (z, THE s. t = Lam z s)) else None)"
+ − 453
+ − 454
lemma lam_half_inj: "(Lam z s = Lam z sa) = (s = sa)"
+ − 455
apply auto
+ − 456
apply (simp only: lam.eq_iff alphas)
+ − 457
apply clarify
+ − 458
apply (simp add: eqvts)
+ − 459
sorry
+ − 460
+ − 461
lemma match_Lam_simps:
+ − 462
"match_Lam S (Var n) = None"
+ − 463
"match_Lam S (App l r) = None"
+ − 464
"z = new (S, (Lam z s)) \<Longrightarrow> match_Lam S (Lam z s) = Some (z, s)"
+ − 465
apply (simp_all add: match_Lam_def)
+ − 466
apply (simp add: lam_half_inj)
+ − 467
apply auto
+ − 468
done
2436
+ − 469
*)
2173
+ − 470
(*
+ − 471
lemma match_Lam_simps2:
+ − 472
"atom n \<sharp> ((S :: 'a :: fs), Lam n s) \<Longrightarrow> match_Lam S (Lam n s) = Some (n, s)"
+ − 473
apply (rule_tac t="Lam n s"
+ − 474
and s="Lam (new (S, (Lam n s))) ((n \<leftrightarrow> (new (S, (Lam n s)))) \<bullet> s)" in subst)
+ − 475
defer
+ − 476
apply (subst match_Lam_simps(3))
+ − 477
defer
+ − 478
apply simp
+ − 479
*)
+ − 480
+ − 481
(*primrec match_Lam_raw where
2165
+ − 482
"match_Lam_raw (S :: atom set) (Var_raw x) = None"
+ − 483
| "match_Lam_raw S (App_raw x y) = None"
+ − 484
| "match_Lam_raw S (Lam_raw n t) = (let z = new (S \<union> (fv_lam_raw t - {atom n})) in Some (z, (n \<leftrightarrow> z) \<bullet> t))"
+ − 485
+ − 486
quotient_definition
+ − 487
"match_Lam :: (atom set) \<Rightarrow> lam \<Rightarrow> (name \<times> lam) option"
+ − 488
is match_Lam_raw
+ − 489
2172
+ − 490
lemma swap_fresh:
+ − 491
assumes a: "fv_lam_raw t \<sharp>* p"
+ − 492
shows "alpha_lam_raw (p \<bullet> t) t"
+ − 493
using a apply (induct t)
+ − 494
apply (simp add: supp_at_base fresh_star_def)
+ − 495
apply (rule alpha_lam_raw.intros)
+ − 496
apply (metis Rep_name_inverse atom_eqvt atom_name_def fresh_perm)
+ − 497
apply (simp)
+ − 498
apply (simp only: fresh_star_union)
+ − 499
apply clarify
+ − 500
apply (rule alpha_lam_raw.intros)
+ − 501
apply simp
+ − 502
apply simp
+ − 503
apply simp
+ − 504
apply (rule alpha_lam_raw.intros)
+ − 505
sorry
+ − 506
2165
+ − 507
lemma [quot_respect]:
+ − 508
"(op = ===> alpha_lam_raw ===> option_rel (prod_rel op = alpha_lam_raw)) match_Lam_raw match_Lam_raw"
+ − 509
proof (intro fun_relI, clarify)
+ − 510
fix S t s
+ − 511
assume a: "alpha_lam_raw t s"
+ − 512
show "option_rel (prod_rel op = alpha_lam_raw) (match_Lam_raw S t) (match_Lam_raw S s)"
+ − 513
using a proof (induct t s rule: alpha_lam_raw.induct)
+ − 514
case goal1 show ?case by simp
+ − 515
next
+ − 516
case goal2 show ?case by simp
+ − 517
next
+ − 518
case (goal3 x t y s)
+ − 519
then obtain p where "({atom x}, t) \<approx>gen (\<lambda>x1 x2. alpha_lam_raw x1 x2 \<and>
+ − 520
option_rel (prod_rel op = alpha_lam_raw) (match_Lam_raw S x1)
+ − 521
(match_Lam_raw S x2)) fv_lam_raw p ({atom y}, s)" ..
+ − 522
then have
+ − 523
c: "fv_lam_raw t - {atom x} = fv_lam_raw s - {atom y}" and
+ − 524
d: "(fv_lam_raw t - {atom x}) \<sharp>* p" and
+ − 525
e: "alpha_lam_raw (p \<bullet> t) s" and
+ − 526
f: "option_rel (prod_rel op = alpha_lam_raw) (match_Lam_raw S (p \<bullet> t)) (match_Lam_raw S s)" and
+ − 527
g: "p \<bullet> {atom x} = {atom y}" unfolding alphas(1) by - (elim conjE, assumption)+
+ − 528
let ?z = "new (S \<union> (fv_lam_raw t - {atom x}))"
+ − 529
have h: "?z = new (S \<union> (fv_lam_raw s - {atom y}))" using c by simp
+ − 530
show ?case
+ − 531
unfolding match_Lam_raw.simps Let_def option_rel.simps prod_rel.simps split_conv
+ − 532
proof
+ − 533
show "?z = new (S \<union> (fv_lam_raw s - {atom y}))" by (fact h)
+ − 534
next
+ − 535
have "atom y \<sharp> p" sorry
+ − 536
have "fv_lam_raw t \<sharp>* ((x \<leftrightarrow> y) \<bullet> p)" sorry
2172
+ − 537
then have "alpha_lam_raw (((x \<leftrightarrow> y) \<bullet> p) \<bullet> t) t" using swap_fresh by auto
+ − 538
then have "alpha_lam_raw (p \<bullet> t) ((x \<leftrightarrow> y) \<bullet> t)" sorry
2165
+ − 539
have "alpha_lam_raw t ((x \<leftrightarrow> y) \<bullet> s)" sorry
+ − 540
then have "alpha_lam_raw ((x \<leftrightarrow> ?z) \<bullet> t) ((y \<leftrightarrow> ?z) \<bullet> s)" using eqvts(15) sorry
+ − 541
then show "alpha_lam_raw ((x \<leftrightarrow> new (S \<union> (fv_lam_raw t - {atom x}))) \<bullet> t)
+ − 542
((y \<leftrightarrow> new (S \<union> (fv_lam_raw s - {atom y}))) \<bullet> s)" unfolding h .
+ − 543
qed
+ − 544
qed
+ − 545
qed
+ − 546
+ − 547
lemmas match_Lam_simps = match_Lam_raw.simps[quot_lifted]
2173
+ − 548
*)
2436
+ − 549
(*
2165
+ − 550
lemma app_some: "match_App x = Some (a, b) \<Longrightarrow> x = App a b"
+ − 551
by (induct x rule: lam.induct) (simp_all add: match_App_simps)
+ − 552
+ − 553
lemma lam_some: "match_Lam S x = Some (z, s) \<Longrightarrow> x = Lam z s \<and> atom z \<sharp> S"
+ − 554
apply (induct x rule: lam.induct)
+ − 555
apply (simp_all add: match_Lam_simps)
2173
+ − 556
apply (thin_tac "match_Lam S lam = Some (z, s) \<Longrightarrow> lam = Lam z s \<and> atom z \<sharp> S")
+ − 557
apply (simp add: match_Lam_def)
+ − 558
apply (subgoal_tac "\<exists>n s. Lam name lam = Lam n s")
+ − 559
prefer 2
+ − 560
apply auto[1]
2165
+ − 561
apply (simp add: Let_def)
2173
+ − 562
apply (thin_tac "\<exists>n s. Lam name lam = Lam n s")
+ − 563
apply clarify
2165
+ − 564
apply (rule conjI)
2173
+ − 565
apply (rule_tac t="THE s. Lam name lam = Lam (new (S, Lam name lam)) s" and
+ − 566
s="(name \<leftrightarrow> (new (S, Lam name lam))) \<bullet> lam" in subst)
+ − 567
defer
2165
+ − 568
apply (simp add: lam.eq_iff)
2173
+ − 569
apply (rule_tac x="(name \<leftrightarrow> (new (S, Lam name lam)))" in exI)
2165
+ − 570
apply (simp add: alphas)
+ − 571
apply (simp add: eqvts)
2173
+ − 572
apply (rule conjI)
2172
+ − 573
sorry
2165
+ − 574
+ − 575
function subst where
+ − 576
"subst v s t = (
+ − 577
case match_Var t of Some n \<Rightarrow> if n = v then s else Var n | None \<Rightarrow>
+ − 578
case match_App t of Some (l, r) \<Rightarrow> App (subst v s l) (subst v s r) | None \<Rightarrow>
2173
+ − 579
case match_Lam (v,s) t of Some (n, t) \<Rightarrow> Lam n (subst v s t) | None \<Rightarrow> undefined)"
2165
+ − 580
by pat_completeness auto
+ − 581
+ − 582
termination apply (relation "measure (\<lambda>(_, _, t). size t)")
2172
+ − 583
apply auto[1]
+ − 584
apply (case_tac a) apply simp
+ − 585
apply (frule lam_some) apply simp
+ − 586
apply (case_tac a) apply simp
+ − 587
apply (frule app_some) apply simp
+ − 588
apply (case_tac a) apply simp
+ − 589
apply (frule app_some) apply simp
2165
+ − 590
done
+ − 591
+ − 592
lemmas lam_exhaust = lam_raw.exhaust[quot_lifted]
+ − 593
+ − 594
lemma subst_eqvt:
+ − 595
"p \<bullet> (subst v s t) = subst (p \<bullet> v) (p \<bullet> s) (p \<bullet> t)"
+ − 596
proof (induct v s t rule: subst.induct)
+ − 597
case (1 v s t)
+ − 598
show ?case proof (cases t rule: lam_exhaust)
+ − 599
fix n
+ − 600
assume "t = Var n"
+ − 601
then show ?thesis by (simp add: match_Var_simps)
+ − 602
next
+ − 603
fix l r
+ − 604
assume "t = App l r"
+ − 605
then show ?thesis
+ − 606
apply (simp only:)
+ − 607
apply (subst subst.simps)
+ − 608
apply (subst match_Var_simps)
+ − 609
apply (simp only: option.cases)
+ − 610
apply (subst match_App_simps)
+ − 611
apply (simp only: option.cases)
+ − 612
apply (simp only: prod.cases)
+ − 613
apply (simp only: lam.perm)
+ − 614
apply (subst (3) subst.simps)
+ − 615
apply (subst match_Var_simps)
2173
+ − 616
apply (simp only: option.cases)
2165
+ − 617
apply (subst match_App_simps)
+ − 618
apply (simp only: option.cases)
+ − 619
apply (simp only: prod.cases)
+ − 620
apply (subst 1(2)[of "(l, r)" "l" "r"])
+ − 621
apply (simp add: match_Var_simps)
+ − 622
apply (simp add: match_App_simps)
+ − 623
apply (rule refl)
+ − 624
apply (subst 1(3)[of "(l, r)" "l" "r"])
+ − 625
apply (simp add: match_Var_simps)
+ − 626
apply (simp add: match_App_simps)
+ − 627
apply (rule refl)
+ − 628
apply (rule refl)
+ − 629
done
+ − 630
next
+ − 631
fix n t'
+ − 632
assume "t = Lam n t'"
+ − 633
then show ?thesis
+ − 634
apply (simp only: )
+ − 635
apply (simp only: lam.perm)
+ − 636
apply (subst subst.simps)
+ − 637
apply (subst match_Var_simps)
+ − 638
apply (simp only: option.cases)
+ − 639
apply (subst match_App_simps)
+ − 640
apply (simp only: option.cases)
2173
+ − 641
apply (rule_tac t="Lam n t'" and s="Lam (new ((v, s), Lam n t')) ((n \<leftrightarrow> new ((v, s), Lam n t')) \<bullet> t')" in subst)
+ − 642
defer
2165
+ − 643
apply (subst match_Lam_simps)
2173
+ − 644
defer
2165
+ − 645
apply (simp only: option.cases)
+ − 646
apply (simp only: prod.cases)
+ − 647
apply (subst (2) subst.simps)
+ − 648
apply (subst match_Var_simps)
+ − 649
apply (simp only: option.cases)
+ − 650
apply (subst match_App_simps)
+ − 651
apply (simp only: option.cases)
2173
+ − 652
apply (rule_tac t="Lam (p \<bullet> n) (p \<bullet> t')" and s="Lam (new ((p \<bullet> v, p \<bullet> s), Lam (p \<bullet> n) (p \<bullet> t'))) (((p \<bullet> n) \<leftrightarrow> new ((p \<bullet> v, p \<bullet> s), Lam (p \<bullet> n) (p \<bullet> t'))) \<bullet> t')" in subst)
+ − 653
defer
2165
+ − 654
apply (subst match_Lam_simps)
2173
+ − 655
defer
2165
+ − 656
apply (simp only: option.cases)
+ − 657
apply (simp only: prod.cases)
+ − 658
apply (simp only: lam.perm)
2173
+ − 659
thm 1(1)
2165
+ − 660
sorry
+ − 661
qed
+ − 662
qed
+ − 663
2172
+ − 664
lemma subst_proper_eqs:
+ − 665
"subst y s (Var x) = (if x = y then s else (Var x))"
+ − 666
"subst y s (App l r) = App (subst y s l) (subst y s r)"
+ − 667
"atom x \<sharp> (t, s) \<Longrightarrow> subst y s (Lam x t) = Lam x (subst y s t)"
+ − 668
apply (subst subst.simps)
+ − 669
apply (simp only: match_Var_simps)
+ − 670
apply (simp only: option.simps)
+ − 671
apply (subst subst.simps)
+ − 672
apply (simp only: match_App_simps)
+ − 673
apply (simp only: option.simps)
+ − 674
apply (simp only: prod.simps)
+ − 675
apply (simp only: match_Var_simps)
+ − 676
apply (simp only: option.simps)
+ − 677
apply (subst subst.simps)
+ − 678
apply (simp only: match_Var_simps)
2173
+ − 679
apply (simp only: option.simps)
2172
+ − 680
apply (simp only: match_App_simps)
+ − 681
apply (simp only: option.simps)
2173
+ − 682
apply (rule_tac t="Lam x t" and s="Lam (new ((y, s), Lam x t)) ((x \<leftrightarrow> new ((y, s), Lam x t)) \<bullet> t)" in subst)
+ − 683
defer
+ − 684
apply (subst match_Lam_simps)
+ − 685
defer
2172
+ − 686
apply (simp only: option.simps)
+ − 687
apply (simp only: prod.simps)
2157
+ − 688
sorry
2436
+ − 689
*)
1594
+ − 690
end
+ − 691
+ − 692
+ − 693