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
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
+ − 2
imports "../NewParser"
1594
+ − 3
begin
+ − 4
+ − 5
atom_decl name
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
+ − 6
declare [[STEPS = 20]]
1594
+ − 7
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
+ − 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"
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
+ − 10
| App "lam" "lam"
2311
+ − 11
| Lam x::"name" l::"lam" bind x in l
1594
+ − 12
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
+ − 13
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
+ − 14
thm eq_iff
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
+ − 15
1845
b7423c6b5564
deleted offending [eqvt]-attribute in Abs; Lambda works again, but there is now a problem in CoreHaskell
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 16
thm lam.fv
b7423c6b5564
deleted offending [eqvt]-attribute in Abs; Lambda works again, but there is now a problem in CoreHaskell
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 17
thm lam.supp
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
+ − 18
lemmas supp_fn' = lam.fv[simplified lam.supp]
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
+ − 19
1805
+ − 20
declare lam.perm[eqvt]
+ − 21
2082
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 22
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
+ − 23
section {* Strong Induction Principles*}
1594
+ − 24
2041
+ − 25
(*
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
+ − 26
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
+ − 27
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
+ − 28
*)
1594
+ − 29
lemma
+ − 30
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
+ − 31
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
+ − 32
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
+ − 33
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
+ − 34
shows "P c lam"
1594
+ − 35
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
+ − 36
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
+ − 37
apply(induct lam arbitrary: c rule: lam.induct)
1805
+ − 38
apply(perm_simp)
1594
+ − 39
apply(rule a1)
1805
+ − 40
apply(perm_simp)
1594
+ − 41
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
+ − 42
apply(assumption)
1594
+ − 43
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
+ − 44
apply(subgoal_tac "\<exists>new::name. (atom new) \<sharp> (c, Lam (p \<bullet> name) (p \<bullet> lam))")
1594
+ − 45
defer
+ − 46
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
+ − 47
apply(rule_tac X="supp (c, Lam (p \<bullet> name) (p \<bullet> lam))" in obtain_at_base)
1594
+ − 48
apply(simp add: supp_Pair finite_supp)
+ − 49
apply(blast)
+ − 50
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
+ − 51
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
+ − 52
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
+ − 53
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
+ − 54
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
+ − 55
apply(subst (2) lam.perm)
1594
+ − 56
apply(rule flip_fresh_fresh)
+ − 57
apply(simp add: fresh_def)
+ − 58
apply(simp only: supp_fn')
+ − 59
apply(simp)
+ − 60
apply(simp add: fresh_Pair)
+ − 61
apply(simp)
+ − 62
apply(rule a3)
+ − 63
apply(simp add: fresh_Pair)
+ − 64
apply(drule_tac x="((p \<bullet> name) \<leftrightarrow> new) + p" in meta_spec)
+ − 65
apply(simp)
+ − 66
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
+ − 67
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
+ − 68
then show "P c lam" by simp
1594
+ − 69
qed
+ − 70
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
+ − 71
(*
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 72
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
+ − 73
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
+ − 74
*)
1594
+ − 75
lemma
+ − 76
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
+ − 77
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
+ − 78
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
+ − 79
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
+ − 80
shows "P c lam"
1594
+ − 81
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
+ − 82
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
+ − 83
apply(induct lam arbitrary: c rule: lam.induct)
1805
+ − 84
apply(perm_simp)
1594
+ − 85
apply(rule a1)
1805
+ − 86
apply(perm_simp)
1594
+ − 87
apply(rule a2)
+ − 88
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
+ − 89
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
+ − 90
apply(subgoal_tac "\<exists>q. (q \<bullet> {p \<bullet> atom name}) \<sharp>* c \<and> supp (p \<bullet> Lam name lam) \<sharp>* q")
1594
+ − 91
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
+ − 92
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
+ − 93
s="q \<bullet> p \<bullet> Lam name lam" in subst)
1594
+ − 94
defer
1805
+ − 95
apply(simp)
1594
+ − 96
apply(rule a3)
+ − 97
apply(simp add: eqvts fresh_star_def)
+ − 98
apply(drule_tac x="q + p" in meta_spec)
+ − 99
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
+ − 100
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
+ − 101
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
+ − 102
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
+ − 103
apply(simp add: finite_supp)
1805
+ − 104
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
+ − 105
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
+ − 106
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
+ − 107
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
+ − 108
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
+ − 109
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
+ − 110
then show "P c lam" by simp
1594
+ − 111
qed
+ − 112
1805
+ − 113
section {* Typing *}
+ − 114
+ − 115
nominal_datatype ty =
+ − 116
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
+ − 117
| 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
+ − 118
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
+ − 119
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
+ − 120
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
+ − 121
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
+ − 122
declare ty.perm[eqvt]
1805
+ − 123
+ − 124
inductive
+ − 125
valid :: "(name \<times> ty) list \<Rightarrow> bool"
+ − 126
where
+ − 127
"valid []"
+ − 128
| "\<lbrakk>atom x \<sharp> Gamma; valid Gamma\<rbrakk> \<Longrightarrow> valid ((x, T)#Gamma)"
+ − 129
1828
+ − 130
inductive
+ − 131
typing :: "(name\<times>ty) list \<Rightarrow> lam \<Rightarrow> ty \<Rightarrow> bool" ("_ \<turnstile> _ : _" [60,60,60] 60)
+ − 132
where
+ − 133
t_Var[intro]: "\<lbrakk>valid \<Gamma>; (x, T) \<in> set \<Gamma>\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> Var x : T"
1947
+ − 134
| t_App[intro]: "\<lbrakk>\<Gamma> \<turnstile> t1 : T1 \<rightarrow> T2; \<Gamma> \<turnstile> t2 : T1\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> App t1 t2 : T2"
1828
+ − 135
| t_Lam[intro]: "\<lbrakk>atom x \<sharp> \<Gamma>; (x, T1) # \<Gamma> \<turnstile> t : T2\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> Lam x t : T1 \<rightarrow> T2"
+ − 136
1831
+ − 137
equivariance valid
+ − 138
equivariance typing
1816
+ − 139
1831
+ − 140
thm valid.eqvt
+ − 141
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
+ − 142
thm eqvts
ae176476b525
implemented in thmdecls the case where eqvt-lemmas are of the form _ ==> _
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 143
thm eqvts_raw
ae176476b525
implemented in thmdecls the case where eqvt-lemmas are of the form _ ==> _
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 144
1949
+ − 145
thm typing.induct[of "\<Gamma>" "t" "T", no_vars]
+ − 146
+ − 147
lemma
+ − 148
fixes c::"'a::fs"
+ − 149
assumes a: "\<Gamma> \<turnstile> t : T"
+ − 150
and a1: "\<And>\<Gamma> x T c. \<lbrakk>valid \<Gamma>; (x, T) \<in> set \<Gamma>\<rbrakk> \<Longrightarrow> P c \<Gamma> (Var x) T"
+ − 151
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>
+ − 152
\<Longrightarrow> P c \<Gamma> (App t1 t2) T2"
+ − 153
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>
+ − 154
\<Longrightarrow> P c \<Gamma> (Lam x t) T1 \<rightarrow> T2"
+ − 155
shows "P c \<Gamma> t T"
+ − 156
proof -
+ − 157
from a have "\<And>p c. P c (p \<bullet> \<Gamma>) (p \<bullet> t) (p \<bullet> T)"
+ − 158
proof (induct)
+ − 159
case (t_Var \<Gamma> x T p c)
+ − 160
then show ?case
+ − 161
apply -
+ − 162
apply(perm_strict_simp)
+ − 163
apply(rule a1)
1954
+ − 164
apply(drule_tac p="p" in permute_boolI)
1949
+ − 165
apply(perm_strict_simp add: permute_minus_cancel)
+ − 166
apply(assumption)
1954
+ − 167
apply(rotate_tac 1)
+ − 168
apply(drule_tac p="p" in permute_boolI)
1949
+ − 169
apply(perm_strict_simp add: permute_minus_cancel)
+ − 170
apply(assumption)
+ − 171
done
+ − 172
next
+ − 173
case (t_App \<Gamma> t1 T1 T2 t2 p c)
+ − 174
then show ?case
+ − 175
apply -
+ − 176
apply(perm_strict_simp)
1954
+ − 177
apply(rule a2)
+ − 178
apply(drule_tac p="p" in permute_boolI)
1949
+ − 179
apply(perm_strict_simp add: permute_minus_cancel)
+ − 180
apply(assumption)
+ − 181
apply(assumption)
1954
+ − 182
apply(rotate_tac 2)
+ − 183
apply(drule_tac p="p" in permute_boolI)
1949
+ − 184
apply(perm_strict_simp add: permute_minus_cancel)
+ − 185
apply(assumption)
+ − 186
apply(assumption)
+ − 187
done
+ − 188
next
+ − 189
case (t_Lam x \<Gamma> T1 t T2 p c)
+ − 190
then show ?case
+ − 191
apply -
+ − 192
apply(subgoal_tac "\<exists>q. (q \<bullet> {p \<bullet> atom x}) \<sharp>* c \<and>
+ − 193
supp (p \<bullet> \<Gamma>, p \<bullet> Lam x t, p \<bullet> (T1 \<rightarrow> T2)) \<sharp>* q")
+ − 194
apply(erule exE)
1954
+ − 195
apply(rule_tac t="p \<bullet> \<Gamma>" and s="(q + p) \<bullet> \<Gamma>" in subst)
+ − 196
apply(simp only: permute_plus)
1949
+ − 197
apply(rule supp_perm_eq)
+ − 198
apply(simp add: supp_Pair fresh_star_union)
1954
+ − 199
apply(rule_tac t="p \<bullet> Lam x t" and s="(q + p) \<bullet> Lam x t" in subst)
+ − 200
apply(simp only: permute_plus)
1949
+ − 201
apply(rule supp_perm_eq)
+ − 202
apply(simp add: supp_Pair fresh_star_union)
1954
+ − 203
apply(rule_tac t="p \<bullet> (T1 \<rightarrow> T2)" and s="(q + p) \<bullet> (T1 \<rightarrow> T2)" in subst)
+ − 204
apply(simp only: permute_plus)
+ − 205
apply(rule supp_perm_eq)
+ − 206
apply(simp add: supp_Pair fresh_star_union)
+ − 207
apply(simp (no_asm) only: eqvts)
1949
+ − 208
apply(rule a3)
1954
+ − 209
apply(simp only: eqvts permute_plus)
1949
+ − 210
apply(simp add: fresh_star_def)
1954
+ − 211
apply(drule_tac p="q + p" in permute_boolI)
1949
+ − 212
apply(perm_strict_simp add: permute_minus_cancel)
+ − 213
apply(assumption)
1954
+ − 214
apply(rotate_tac 1)
+ − 215
apply(drule_tac p="q + p" in permute_boolI)
1949
+ − 216
apply(perm_strict_simp add: permute_minus_cancel)
+ − 217
apply(assumption)
+ − 218
apply(drule_tac x="d" in meta_spec)
+ − 219
apply(drule_tac x="q + p" in meta_spec)
1954
+ − 220
apply(perm_strict_simp add: permute_minus_cancel)
+ − 221
apply(assumption)
1949
+ − 222
apply(rule at_set_avoiding2)
+ − 223
apply(simp add: finite_supp)
+ − 224
apply(simp add: finite_supp)
+ − 225
apply(simp add: finite_supp)
+ − 226
apply(rule_tac p="-p" in permute_boolE)
+ − 227
apply(perm_strict_simp add: permute_minus_cancel)
+ − 228
(* supplied by the user *)
+ − 229
apply(simp add: fresh_star_prod)
+ − 230
apply(simp add: fresh_star_def)
1954
+ − 231
sorry
+ − 232
qed
+ − 233
then have "P c (0 \<bullet> \<Gamma>) (0 \<bullet> t) (0 \<bullet> T)" .
+ − 234
then show "P c \<Gamma> t T" by simp
+ − 235
qed
1949
+ − 236
+ − 237
+ − 238
+ − 239
+ − 240
+ − 241
1833
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 242
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 243
inductive
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 244
tt :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> 'a \<Rightarrow> bool)"
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 245
for r :: "('a \<Rightarrow> 'a \<Rightarrow> bool)"
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 246
where
1835
+ − 247
aa: "tt r a a"
+ − 248
| bb: "tt r a b ==> tt r a c"
1833
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 249
1835
+ − 250
(* PROBLEM: derived eqvt-theorem does not conform with [eqvt]
1833
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 251
equivariance tt
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 252
*)
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 253
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
+ − 254
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
+ − 255
inductive
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
+ − 256
alpha_lam_raw'
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
+ − 257
where
1861
+ − 258
a1: "name = namea \<Longrightarrow> alpha_lam_raw' (Var_raw name) (Var_raw namea)"
+ − 259
| a2: "\<lbrakk>alpha_lam_raw' lam_raw1 lam_raw1a; alpha_lam_raw' lam_raw2 lam_raw2a\<rbrakk> \<Longrightarrow>
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
+ − 260
alpha_lam_raw' (App_raw lam_raw1 lam_raw2) (App_raw lam_raw1a lam_raw2a)"
1865
+ − 261
| a3: "\<exists>pi. ({atom name}, lam_raw) \<approx>gen alpha_lam_raw' fv_lam_raw pi ({atom namea}, lam_rawa) \<Longrightarrow>
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
+ − 262
alpha_lam_raw' (Lam_raw name lam_raw) (Lam_raw namea lam_rawa)"
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
+ − 263
1866
+ − 264
equivariance alpha_lam_raw'
1947
+ − 265
1861
+ − 266
thm eqvts_raw
+ − 267
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
+ − 268
section {* size function *}
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
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
lemma size_eqvt_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
+ − 271
fixes t::"lam_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
+ − 272
shows "size (pi \<bullet> t) = size t"
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 (induct rule: lam_raw.inducts)
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_all
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
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
+ − 276
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
instantiation lam :: size
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
begin
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
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
quotient_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
+ − 281
"size_lam :: lam \<Rightarrow> nat"
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
is
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
"size :: lam_raw \<Rightarrow> nat"
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
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
lemma size_rsp:
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
"alpha_lam_raw x y \<Longrightarrow> size x = size y"
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 (induct rule: alpha_lam_raw.inducts)
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 (simp_all only: lam_raw.size)
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 (simp_all only: alphas)
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 clarify
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_all only: size_eqvt_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
+ − 292
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
+ − 293
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
lemma [quot_respect]:
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
"(alpha_lam_raw ===> op =) size size"
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
by (simp_all add: size_rsp)
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
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
lemma [quot_preserve]:
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
"(rep_lam ---> id) size = size"
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
by (simp_all add: size_lam_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
+ − 301
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
instance
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
by default
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
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
end
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
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
lemmas size_lam[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
+ − 308
lam_raw.size(4)[quot_lifted]
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
lam_raw.size(5)[quot_lifted]
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
lam_raw.size(6)[quot_lifted]
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
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
(* is this needed? *)
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
lemma [measure_function]:
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
"is_measure (size::lam\<Rightarrow>nat)"
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
by (rule is_measure_trivial)
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
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
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
+ − 318
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
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
+ − 320
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
+ − 321
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
+ − 322
"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
+ − 323
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
(*
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
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
+ − 326
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
+ − 327
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
+ − 328
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
+ − 329
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
+ − 330
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
+ − 331
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
+ − 332
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
+ − 333
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
+ − 334
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
+ − 335
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
+ − 336
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
+ − 337
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
+ − 338
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
+ − 339
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
+ − 340
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
+ − 341
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
+ − 342
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
+ − 343
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
+ − 344
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
+ − 345
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
+ − 346
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
+ − 347
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
+ − 348
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
+ − 349
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
+ − 350
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(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
+ − 352
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
+ − 353
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
+ − 354
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
+ − 355
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
+ − 356
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
+ − 357
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
+ − 358
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
+ − 359
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
+ − 360
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
+ − 361
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
+ − 362
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
+ − 363
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
+ − 364
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
+ − 365
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
+ − 366
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
+ − 367
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
+ − 368
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
+ − 369
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
+ − 370
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
+ − 371
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
+ − 372
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
+ − 373
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
+ − 374
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
+ − 375
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
+ − 376
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
+ − 377
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
+ − 378
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
+ − 379
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
+ − 380
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
+ − 381
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
+ − 382
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
+ − 383
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
+ − 384
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
+ − 385
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
+ − 386
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
+ − 387
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
+ − 388
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
+ − 389
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
+ − 390
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
+ − 391
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
+ − 392
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
+ − 393
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
+ − 394
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
+ − 395
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
+ − 396
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
+ − 397
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
+ − 398
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
+ − 399
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
+ − 400
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
+ − 401
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
+ − 402
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
+ − 403
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
+ − 404
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
+ − 405
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
+ − 406
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
+ − 407
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
+ − 408
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
+ − 409
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
+ − 410
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
+ − 411
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
+ − 412
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
+ − 413
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
+ − 414
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
+ − 415
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
+ − 416
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
+ − 417
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
+ − 418
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
+ − 419
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
+ − 420
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
+ − 421
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
+ − 422
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
+ − 423
*)
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
+ − 424
1954
+ − 425
ML {*
+ − 426
fun mk_avoids ctxt params name set =
+ − 427
let
+ − 428
val (_, ctxt') = ProofContext.add_fixes
+ − 429
(map (fn (s, T) => (Binding.name s, SOME T, NoSyn)) params) ctxt;
+ − 430
fun mk s =
+ − 431
let
+ − 432
val t = Syntax.read_term ctxt' s;
+ − 433
val t' = list_abs_free (params, t) |>
+ − 434
funpow (length params) (fn Abs (_, _, t) => t)
+ − 435
in (t', HOLogic.dest_setT (fastype_of t)) end
+ − 436
handle TERM _ =>
+ − 437
error ("Expression " ^ quote s ^ " to be avoided in case " ^
+ − 438
quote name ^ " is not a set type");
+ − 439
fun add_set p [] = [p]
+ − 440
| add_set (t, T) ((u, U) :: ps) =
+ − 441
if T = U then
+ − 442
let val S = HOLogic.mk_setT T
+ − 443
in (Const (@{const_name sup}, S --> S --> S) $ u $ t, T) :: ps
+ − 444
end
+ − 445
else (u, U) :: add_set (t, T) ps
+ − 446
in
+ − 447
(mk #> add_set) set
+ − 448
end;
+ − 449
*}
+ − 450
+ − 451
+ − 452
ML {*
+ − 453
writeln (commas (map (Syntax.string_of_term @{context} o fst)
+ − 454
(mk_avoids @{context} [] "t_Var" "{x}" [])))
+ − 455
*}
+ − 456
1947
+ − 457
1949
+ − 458
ML {*
+ − 459
+ − 460
fun prove_strong_ind (pred_name, avoids) ctxt =
+ − 461
Proof.theorem NONE (K I) [] ctxt
+ − 462
2169
+ − 463
local structure P = Parse and K = Keyword in
1949
+ − 464
+ − 465
val _ =
2169
+ − 466
Outer_Syntax.local_theory_to_proof "nominal_inductive"
1949
+ − 467
"proves strong induction theorem for inductive predicate involving nominal datatypes" K.thy_goal
+ − 468
(P.xname -- (Scan.optional (P.$$$ "avoids" |-- P.enum1 "|" (P.name --
+ − 469
(P.$$$ ":" |-- P.and_list1 P.term))) []) >> prove_strong_ind)
+ − 470
+ − 471
end;
+ − 472
+ − 473
*}
+ − 474
1950
+ − 475
(*
1949
+ − 476
nominal_inductive typing
1950
+ − 477
*)
1949
+ − 478
2157
+ − 479
(* Substitution *)
2159
+ − 480
2165
+ − 481
primrec match_Var_raw where
+ − 482
"match_Var_raw (Var_raw x) = Some x"
+ − 483
| "match_Var_raw (App_raw x y) = None"
+ − 484
| "match_Var_raw (Lam_raw n t) = None"
+ − 485
+ − 486
quotient_definition
+ − 487
"match_Var :: lam \<Rightarrow> name option"
+ − 488
is match_Var_raw
+ − 489
+ − 490
lemma [quot_respect]: "(alpha_lam_raw ===> op =) match_Var_raw match_Var_raw"
+ − 491
apply rule
+ − 492
apply (induct_tac a b rule: alpha_lam_raw.induct)
+ − 493
apply simp_all
+ − 494
done
+ − 495
+ − 496
lemmas match_Var_simps = match_Var_raw.simps[quot_lifted]
+ − 497
+ − 498
primrec match_App_raw where
+ − 499
"match_App_raw (Var_raw x) = None"
+ − 500
| "match_App_raw (App_raw x y) = Some (x, y)"
+ − 501
| "match_App_raw (Lam_raw n t) = None"
+ − 502
+ − 503
quotient_definition
+ − 504
"match_App :: lam \<Rightarrow> (lam \<times> lam) option"
+ − 505
is match_App_raw
+ − 506
+ − 507
lemma [quot_respect]:
+ − 508
"(alpha_lam_raw ===> option_rel (prod_rel alpha_lam_raw alpha_lam_raw)) match_App_raw match_App_raw"
+ − 509
apply (intro fun_relI)
+ − 510
apply (induct_tac a b rule: alpha_lam_raw.induct)
+ − 511
apply simp_all
+ − 512
done
+ − 513
+ − 514
lemmas match_App_simps = match_App_raw.simps[quot_lifted]
+ − 515
2173
+ − 516
definition new where
+ − 517
"new (s :: 'a :: fs) = (THE x. \<forall>a \<in> supp s. atom x \<noteq> a)"
+ − 518
+ − 519
definition
+ − 520
"match_Lam (S :: 'a :: fs) t = (if (\<exists>n s. (t = Lam n s)) then
+ − 521
(let z = new (S, t) in Some (z, THE s. t = Lam z s)) else None)"
+ − 522
+ − 523
lemma lam_half_inj: "(Lam z s = Lam z sa) = (s = sa)"
+ − 524
apply auto
+ − 525
apply (simp only: lam.eq_iff alphas)
+ − 526
apply clarify
+ − 527
apply (simp add: eqvts)
+ − 528
sorry
+ − 529
+ − 530
lemma match_Lam_simps:
+ − 531
"match_Lam S (Var n) = None"
+ − 532
"match_Lam S (App l r) = None"
+ − 533
"z = new (S, (Lam z s)) \<Longrightarrow> match_Lam S (Lam z s) = Some (z, s)"
+ − 534
apply (simp_all add: match_Lam_def)
+ − 535
apply (simp add: lam_half_inj)
+ − 536
apply auto
+ − 537
done
+ − 538
+ − 539
(*
+ − 540
lemma match_Lam_simps2:
+ − 541
"atom n \<sharp> ((S :: 'a :: fs), Lam n s) \<Longrightarrow> match_Lam S (Lam n s) = Some (n, s)"
+ − 542
apply (rule_tac t="Lam n s"
+ − 543
and s="Lam (new (S, (Lam n s))) ((n \<leftrightarrow> (new (S, (Lam n s)))) \<bullet> s)" in subst)
+ − 544
defer
+ − 545
apply (subst match_Lam_simps(3))
+ − 546
defer
+ − 547
apply simp
+ − 548
*)
+ − 549
+ − 550
(*primrec match_Lam_raw where
2165
+ − 551
"match_Lam_raw (S :: atom set) (Var_raw x) = None"
+ − 552
| "match_Lam_raw S (App_raw x y) = None"
+ − 553
| "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))"
+ − 554
+ − 555
quotient_definition
+ − 556
"match_Lam :: (atom set) \<Rightarrow> lam \<Rightarrow> (name \<times> lam) option"
+ − 557
is match_Lam_raw
+ − 558
2172
+ − 559
lemma swap_fresh:
+ − 560
assumes a: "fv_lam_raw t \<sharp>* p"
+ − 561
shows "alpha_lam_raw (p \<bullet> t) t"
+ − 562
using a apply (induct t)
+ − 563
apply (simp add: supp_at_base fresh_star_def)
+ − 564
apply (rule alpha_lam_raw.intros)
+ − 565
apply (metis Rep_name_inverse atom_eqvt atom_name_def fresh_perm)
+ − 566
apply (simp)
+ − 567
apply (simp only: fresh_star_union)
+ − 568
apply clarify
+ − 569
apply (rule alpha_lam_raw.intros)
+ − 570
apply simp
+ − 571
apply simp
+ − 572
apply simp
+ − 573
apply (rule alpha_lam_raw.intros)
+ − 574
sorry
+ − 575
2165
+ − 576
lemma [quot_respect]:
+ − 577
"(op = ===> alpha_lam_raw ===> option_rel (prod_rel op = alpha_lam_raw)) match_Lam_raw match_Lam_raw"
+ − 578
proof (intro fun_relI, clarify)
+ − 579
fix S t s
+ − 580
assume a: "alpha_lam_raw t s"
+ − 581
show "option_rel (prod_rel op = alpha_lam_raw) (match_Lam_raw S t) (match_Lam_raw S s)"
+ − 582
using a proof (induct t s rule: alpha_lam_raw.induct)
+ − 583
case goal1 show ?case by simp
+ − 584
next
+ − 585
case goal2 show ?case by simp
+ − 586
next
+ − 587
case (goal3 x t y s)
+ − 588
then obtain p where "({atom x}, t) \<approx>gen (\<lambda>x1 x2. alpha_lam_raw x1 x2 \<and>
+ − 589
option_rel (prod_rel op = alpha_lam_raw) (match_Lam_raw S x1)
+ − 590
(match_Lam_raw S x2)) fv_lam_raw p ({atom y}, s)" ..
+ − 591
then have
+ − 592
c: "fv_lam_raw t - {atom x} = fv_lam_raw s - {atom y}" and
+ − 593
d: "(fv_lam_raw t - {atom x}) \<sharp>* p" and
+ − 594
e: "alpha_lam_raw (p \<bullet> t) s" and
+ − 595
f: "option_rel (prod_rel op = alpha_lam_raw) (match_Lam_raw S (p \<bullet> t)) (match_Lam_raw S s)" and
+ − 596
g: "p \<bullet> {atom x} = {atom y}" unfolding alphas(1) by - (elim conjE, assumption)+
+ − 597
let ?z = "new (S \<union> (fv_lam_raw t - {atom x}))"
+ − 598
have h: "?z = new (S \<union> (fv_lam_raw s - {atom y}))" using c by simp
+ − 599
show ?case
+ − 600
unfolding match_Lam_raw.simps Let_def option_rel.simps prod_rel.simps split_conv
+ − 601
proof
+ − 602
show "?z = new (S \<union> (fv_lam_raw s - {atom y}))" by (fact h)
+ − 603
next
+ − 604
have "atom y \<sharp> p" sorry
+ − 605
have "fv_lam_raw t \<sharp>* ((x \<leftrightarrow> y) \<bullet> p)" sorry
2172
+ − 606
then have "alpha_lam_raw (((x \<leftrightarrow> y) \<bullet> p) \<bullet> t) t" using swap_fresh by auto
+ − 607
then have "alpha_lam_raw (p \<bullet> t) ((x \<leftrightarrow> y) \<bullet> t)" sorry
2165
+ − 608
have "alpha_lam_raw t ((x \<leftrightarrow> y) \<bullet> s)" sorry
+ − 609
then have "alpha_lam_raw ((x \<leftrightarrow> ?z) \<bullet> t) ((y \<leftrightarrow> ?z) \<bullet> s)" using eqvts(15) sorry
+ − 610
then show "alpha_lam_raw ((x \<leftrightarrow> new (S \<union> (fv_lam_raw t - {atom x}))) \<bullet> t)
+ − 611
((y \<leftrightarrow> new (S \<union> (fv_lam_raw s - {atom y}))) \<bullet> s)" unfolding h .
+ − 612
qed
+ − 613
qed
+ − 614
qed
+ − 615
+ − 616
lemmas match_Lam_simps = match_Lam_raw.simps[quot_lifted]
2173
+ − 617
*)
2165
+ − 618
+ − 619
lemma app_some: "match_App x = Some (a, b) \<Longrightarrow> x = App a b"
+ − 620
by (induct x rule: lam.induct) (simp_all add: match_App_simps)
+ − 621
+ − 622
lemma lam_some: "match_Lam S x = Some (z, s) \<Longrightarrow> x = Lam z s \<and> atom z \<sharp> S"
+ − 623
apply (induct x rule: lam.induct)
+ − 624
apply (simp_all add: match_Lam_simps)
2173
+ − 625
apply (thin_tac "match_Lam S lam = Some (z, s) \<Longrightarrow> lam = Lam z s \<and> atom z \<sharp> S")
+ − 626
apply (simp add: match_Lam_def)
+ − 627
apply (subgoal_tac "\<exists>n s. Lam name lam = Lam n s")
+ − 628
prefer 2
+ − 629
apply auto[1]
2165
+ − 630
apply (simp add: Let_def)
2173
+ − 631
apply (thin_tac "\<exists>n s. Lam name lam = Lam n s")
+ − 632
apply clarify
2165
+ − 633
apply (rule conjI)
2173
+ − 634
apply (rule_tac t="THE s. Lam name lam = Lam (new (S, Lam name lam)) s" and
+ − 635
s="(name \<leftrightarrow> (new (S, Lam name lam))) \<bullet> lam" in subst)
+ − 636
defer
2165
+ − 637
apply (simp add: lam.eq_iff)
2173
+ − 638
apply (rule_tac x="(name \<leftrightarrow> (new (S, Lam name lam)))" in exI)
2165
+ − 639
apply (simp add: alphas)
+ − 640
apply (simp add: eqvts)
2173
+ − 641
apply (rule conjI)
2172
+ − 642
sorry
2165
+ − 643
+ − 644
function subst where
+ − 645
"subst v s t = (
+ − 646
case match_Var t of Some n \<Rightarrow> if n = v then s else Var n | None \<Rightarrow>
+ − 647
case match_App t of Some (l, r) \<Rightarrow> App (subst v s l) (subst v s r) | None \<Rightarrow>
2173
+ − 648
case match_Lam (v,s) t of Some (n, t) \<Rightarrow> Lam n (subst v s t) | None \<Rightarrow> undefined)"
2165
+ − 649
by pat_completeness auto
+ − 650
+ − 651
termination apply (relation "measure (\<lambda>(_, _, t). size t)")
2172
+ − 652
apply auto[1]
+ − 653
apply (case_tac a) apply simp
+ − 654
apply (frule lam_some) apply simp
+ − 655
apply (case_tac a) apply simp
+ − 656
apply (frule app_some) apply simp
+ − 657
apply (case_tac a) apply simp
+ − 658
apply (frule app_some) apply simp
2165
+ − 659
done
+ − 660
+ − 661
lemmas lam_exhaust = lam_raw.exhaust[quot_lifted]
+ − 662
+ − 663
lemma subst_eqvt:
+ − 664
"p \<bullet> (subst v s t) = subst (p \<bullet> v) (p \<bullet> s) (p \<bullet> t)"
+ − 665
proof (induct v s t rule: subst.induct)
+ − 666
case (1 v s t)
+ − 667
show ?case proof (cases t rule: lam_exhaust)
+ − 668
fix n
+ − 669
assume "t = Var n"
+ − 670
then show ?thesis by (simp add: match_Var_simps)
+ − 671
next
+ − 672
fix l r
+ − 673
assume "t = App l r"
+ − 674
then show ?thesis
+ − 675
apply (simp only:)
+ − 676
apply (subst subst.simps)
+ − 677
apply (subst match_Var_simps)
+ − 678
apply (simp only: option.cases)
+ − 679
apply (subst match_App_simps)
+ − 680
apply (simp only: option.cases)
+ − 681
apply (simp only: prod.cases)
+ − 682
apply (simp only: lam.perm)
+ − 683
apply (subst (3) subst.simps)
+ − 684
apply (subst match_Var_simps)
2173
+ − 685
apply (simp only: option.cases)
2165
+ − 686
apply (subst match_App_simps)
+ − 687
apply (simp only: option.cases)
+ − 688
apply (simp only: prod.cases)
+ − 689
apply (subst 1(2)[of "(l, r)" "l" "r"])
+ − 690
apply (simp add: match_Var_simps)
+ − 691
apply (simp add: match_App_simps)
+ − 692
apply (rule refl)
+ − 693
apply (subst 1(3)[of "(l, r)" "l" "r"])
+ − 694
apply (simp add: match_Var_simps)
+ − 695
apply (simp add: match_App_simps)
+ − 696
apply (rule refl)
+ − 697
apply (rule refl)
+ − 698
done
+ − 699
next
+ − 700
fix n t'
+ − 701
assume "t = Lam n t'"
+ − 702
then show ?thesis
+ − 703
apply (simp only: )
+ − 704
apply (simp only: lam.perm)
+ − 705
apply (subst subst.simps)
+ − 706
apply (subst match_Var_simps)
+ − 707
apply (simp only: option.cases)
+ − 708
apply (subst match_App_simps)
+ − 709
apply (simp only: option.cases)
2173
+ − 710
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)
+ − 711
defer
2165
+ − 712
apply (subst match_Lam_simps)
2173
+ − 713
defer
2165
+ − 714
apply (simp only: option.cases)
+ − 715
apply (simp only: prod.cases)
+ − 716
apply (subst (2) subst.simps)
+ − 717
apply (subst match_Var_simps)
+ − 718
apply (simp only: option.cases)
+ − 719
apply (subst match_App_simps)
+ − 720
apply (simp only: option.cases)
2173
+ − 721
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)
+ − 722
defer
2165
+ − 723
apply (subst match_Lam_simps)
2173
+ − 724
defer
2165
+ − 725
apply (simp only: option.cases)
+ − 726
apply (simp only: prod.cases)
+ − 727
apply (simp only: lam.perm)
2173
+ − 728
thm 1(1)
2165
+ − 729
sorry
+ − 730
qed
+ − 731
qed
+ − 732
2172
+ − 733
lemma subst_proper_eqs:
+ − 734
"subst y s (Var x) = (if x = y then s else (Var x))"
+ − 735
"subst y s (App l r) = App (subst y s l) (subst y s r)"
+ − 736
"atom x \<sharp> (t, s) \<Longrightarrow> subst y s (Lam x t) = Lam x (subst y s t)"
+ − 737
apply (subst subst.simps)
+ − 738
apply (simp only: match_Var_simps)
+ − 739
apply (simp only: option.simps)
+ − 740
apply (subst subst.simps)
+ − 741
apply (simp only: match_App_simps)
+ − 742
apply (simp only: option.simps)
+ − 743
apply (simp only: prod.simps)
+ − 744
apply (simp only: match_Var_simps)
+ − 745
apply (simp only: option.simps)
+ − 746
apply (subst subst.simps)
+ − 747
apply (simp only: match_Var_simps)
2173
+ − 748
apply (simp only: option.simps)
2172
+ − 749
apply (simp only: match_App_simps)
+ − 750
apply (simp only: option.simps)
2173
+ − 751
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)
+ − 752
defer
+ − 753
apply (subst match_Lam_simps)
+ − 754
defer
2172
+ − 755
apply (simp only: option.simps)
+ − 756
apply (simp only: prod.simps)
2157
+ − 757
sorry
+ − 758
1594
+ − 759
end
+ − 760
+ − 761
+ − 762