author | Christian Urban <christian dot urban at kcl dot ac dot uk> |
Mon, 19 May 2014 16:45:46 +0100 | |
changeset 3236 | e2da10806a34 |
parent 3235 | 5ebd327ffb96 |
permissions | -rw-r--r-- |
3140 | 1 |
theory Lambda imports "../Nominal2" begin |
2 |
||
3 |
atom_decl name |
|
4 |
||
5 |
nominal_datatype lam = |
|
6 |
Var "name" |
|
7 |
| App "lam" "lam" |
|
8 |
| Lam x::"name" l::"lam" binds x in l ("Lam [_]. _" [100, 100] 100) |
|
9 |
||
3235
5ebd327ffb96
changed nominal_primrec into the more appropriate nominal_function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3149
diff
changeset
|
10 |
nominal_function lookup where |
3143
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
11 |
"lookup (n :: name) m [] \<longleftrightarrow> (n = m)" |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
12 |
| "lookup n m ((hn, hm) # t) \<longleftrightarrow> |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
13 |
(n, m) = (hn, hm) \<or> (n \<noteq> hn \<and> m \<noteq> hm \<and> lookup n m t)" |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
14 |
apply (simp add: eqvt_def lookup_graph_def) |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
15 |
apply (rule, perm_simp, rule, rule) |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
16 |
by pat_completeness auto |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
17 |
|
3236
e2da10806a34
changed nominal_primrec to nominal_function and termination to nominal_termination
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3235
diff
changeset
|
18 |
nominal_termination (eqvt) by lexicographic_order |
3143
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
19 |
|
3235
5ebd327ffb96
changed nominal_primrec into the more appropriate nominal_function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3149
diff
changeset
|
20 |
nominal_function lam2_rec where |
3143
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
21 |
"lam2_rec faa fll xs (Var n) (Var m) = lookup n m xs" |
3140 | 22 |
| "lam2_rec faa fll xs (Var n) (App l r) = False" |
23 |
| "lam2_rec faa fll xs (Var n) (Lam [x]. t) = False" |
|
24 |
| "lam2_rec faa fll xs (App l r) (Var n) = False" |
|
25 |
| "lam2_rec faa fll xs (App l1 r1) (App l2 r2) = faa l1 r1 l2 r2" |
|
26 |
| "lam2_rec faa fll xs (App l r) (Lam [x]. t) = False" |
|
27 |
| "lam2_rec faa fll xs (Lam [x]. t) (Var n) = False" |
|
28 |
| "lam2_rec faa fll xs (Lam [x]. t) (App l1 r1) = False" |
|
29 |
| "(atom x \<sharp> (xs, Lam [y]. s) \<and> atom y \<sharp> (x, xs, Lam [x]. t) \<and> |
|
30 |
(\<forall>x' y' t' s'. atom x' \<sharp> (xs, Lam [y']. s') \<longrightarrow> atom y' \<sharp> (x', xs, Lam [x']. t') \<longrightarrow> Lam [x]. t = Lam [x']. t' \<longrightarrow> Lam [y]. s = Lam [y']. s' |
|
31 |
\<longrightarrow> fll x t y s = fll x' t' y' s')) \<Longrightarrow> |
|
32 |
lam2_rec faa fll xs (Lam [x]. t) (Lam [y]. s) = fll x t y s" |
|
33 |
| "(atom x \<sharp> (xs, Lam [y]. s) \<and> atom y \<sharp> (x, xs, Lam [x]. t) \<and> |
|
34 |
\<not>(\<forall>x' y' t' s'. atom x' \<sharp> (xs, Lam [y']. s') \<longrightarrow> atom y' \<sharp> (x', xs, Lam [x']. t') \<longrightarrow> Lam [x]. t = Lam [x']. t' \<longrightarrow> Lam [y]. s = Lam [y']. s' |
|
35 |
\<longrightarrow> fll x t y s = fll x' t' y' s')) \<Longrightarrow> |
|
36 |
lam2_rec faa fll xs (Lam [x]. t) (Lam [y]. s) = False" |
|
37 |
apply (simp add: eqvt_def lam2_rec_graph_def) |
|
38 |
apply (rule, perm_simp, rule, rule) |
|
39 |
apply (case_tac x) |
|
40 |
apply (rule_tac y="d" and c="(c, e)" in lam.strong_exhaust) |
|
41 |
apply (rule_tac y="e" and c="(c, d)" in lam.strong_exhaust) |
|
3147
d24e70483051
Clean the proof of Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3146
diff
changeset
|
42 |
apply simp_all[3] apply (metis, metis, metis) |
3140 | 43 |
apply (rule_tac y="e" and c="(c, d)" in lam.strong_exhaust) |
3147
d24e70483051
Clean the proof of Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3146
diff
changeset
|
44 |
apply simp_all[3] apply (metis, metis, metis) |
3140 | 45 |
apply (rule_tac y="e" and c="(name, c, d)" in lam.strong_exhaust) |
3147
d24e70483051
Clean the proof of Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3146
diff
changeset
|
46 |
apply simp_all[2] apply (metis, metis) |
3148 | 47 |
unfolding fresh_star_def |
3140 | 48 |
apply (thin_tac "\<And>faa fll xs n m. x = (faa, fll, xs, Var n, Var m) \<Longrightarrow> P") |
49 |
apply (thin_tac "\<And>faa fll xs n l r. x = (faa, fll, xs, Var n, App l r) \<Longrightarrow> P") |
|
50 |
apply (thin_tac "\<And>faa fll xs n xa t. x = (faa, fll, xs, Var n, Lam [xa]. t) \<Longrightarrow> P") |
|
51 |
apply (thin_tac "\<And>faa fll xs l1 r1 l2 r2. x = (faa, fll, xs, App l1 r1, App l2 r2) \<Longrightarrow> P") |
|
52 |
apply (thin_tac "\<And>faa fll xs l r n. x = (faa, fll, xs, App l r, Var n) \<Longrightarrow> P") |
|
53 |
apply (thin_tac "\<And>faa fll xs l r xa t. x = (faa, fll, xs, App l r, Lam [xa]. t) \<Longrightarrow> P") |
|
54 |
apply (thin_tac "\<And>faa fll xs xa t n. x = (faa, fll, xs, Lam [xa]. t, Var n) \<Longrightarrow> P") |
|
55 |
apply (thin_tac "\<And>faa fll xs xa t l1 r1. x = (faa, fll, xs, Lam [xa]. t, App l1 r1) \<Longrightarrow> P") |
|
56 |
apply (drule_tac x="name" in meta_spec)+ |
|
57 |
apply (drule_tac x="c" in meta_spec)+ |
|
58 |
apply (drule_tac x="namea" in meta_spec)+ |
|
59 |
apply (drule_tac x="lama" in meta_spec) |
|
60 |
apply (drule_tac x="lama" in meta_spec) |
|
61 |
apply (drule_tac x="lam" in meta_spec)+ |
|
62 |
apply (drule_tac x="b" in meta_spec)+ |
|
63 |
apply (drule_tac x="a" in meta_spec)+ |
|
3148 | 64 |
apply (case_tac "(\<forall>x' y' t' s'. atom x' \<sharp> (c, Lam [y']. s') \<longrightarrow> |
65 |
atom y' \<sharp> (x', c, Lam [x']. t') \<longrightarrow> Lam [name]. lam = Lam [x']. t' \<longrightarrow> |
|
66 |
Lam [namea]. lama = Lam [y']. s' \<longrightarrow> b name lam namea lama = b x' t' y' s')") |
|
3140 | 67 |
apply clarify |
3147
d24e70483051
Clean the proof of Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3146
diff
changeset
|
68 |
apply (simp) |
3148 | 69 |
apply (simp only: fresh_Pair_elim) |
70 |
apply blast |
|
3147
d24e70483051
Clean the proof of Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3146
diff
changeset
|
71 |
apply (simp_all)[53] |
d24e70483051
Clean the proof of Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3146
diff
changeset
|
72 |
apply clarify |
d24e70483051
Clean the proof of Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3146
diff
changeset
|
73 |
apply metis |
d24e70483051
Clean the proof of Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3146
diff
changeset
|
74 |
apply simp |
3140 | 75 |
done |
76 |
||
3236
e2da10806a34
changed nominal_primrec to nominal_function and termination to nominal_termination
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3235
diff
changeset
|
77 |
nominal_termination (eqvt) by lexicographic_order |
3140 | 78 |
|
79 |
lemma lam_rec2_cong[fundef_cong]: |
|
80 |
"(\<And>s1 s2 s3 s4. l = App s1 s2 \<Longrightarrow> l2 = App s3 s4 \<Longrightarrow> faa s1 s2 s3 s4 = faa' s1 s2 s3 s4) \<Longrightarrow> |
|
81 |
(\<And>n t n' t'. l = Lam [n]. t \<Longrightarrow> l2 = Lam [n']. t' \<Longrightarrow> fll n t n' t' = fll' n t n' t') \<Longrightarrow> |
|
82 |
lam2_rec faa fll xs l l2 = lam2_rec faa' fll' xs l l2" |
|
83 |
apply (rule_tac y="l" and c="(xs, l2)" in lam.strong_exhaust) |
|
84 |
apply (rule_tac y="l2" and c="(xs, l)" in lam.strong_exhaust) apply auto[3] |
|
85 |
apply (rule_tac y="l2" and c="(xs, l)" in lam.strong_exhaust) apply auto[3] |
|
86 |
apply (rule_tac y="l2" and c="(name, xs, l)" in lam.strong_exhaust) |
|
87 |
apply auto[2] |
|
88 |
apply clarify |
|
3148 | 89 |
apply (case_tac "(\<forall>x' y' t' s'. atom x' \<sharp> (xs, Lam [y']. s') \<longrightarrow> |
90 |
atom y' \<sharp> (x', xs, Lam [x']. t') \<longrightarrow> Lam [name]. lam = Lam [x']. t' \<longrightarrow> |
|
91 |
Lam [namea]. lama = Lam [y']. s' \<longrightarrow> fll name lam namea lama = fll x' t' y' s')") |
|
92 |
unfolding fresh_star_def |
|
93 |
apply (subst lam2_rec.simps) apply simp |
|
94 |
apply (subst lam2_rec.simps) apply simp |
|
3147
d24e70483051
Clean the proof of Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3146
diff
changeset
|
95 |
apply metis |
3140 | 96 |
apply (subst lam2_rec.simps(10)) apply (simp add: fresh_star_def) |
3148 | 97 |
apply (subst lam2_rec.simps(10)) apply (simp_all add: fresh_star_def) |
3140 | 98 |
done |
99 |
||
3235
5ebd327ffb96
changed nominal_primrec into the more appropriate nominal_function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3149
diff
changeset
|
100 |
nominal_function aux :: "lam \<Rightarrow> lam \<Rightarrow> (name \<times> name) list \<Rightarrow> bool" |
3140 | 101 |
where |
102 |
[simp del]: "aux l r xs = lam2_rec |
|
103 |
(%t1 t2 t3 t4. (aux t1 t3 xs) \<and> (aux t2 t4 xs)) |
|
104 |
(%x t y s. aux t s ((x, y) # xs)) xs l r" |
|
105 |
unfolding eqvt_def aux_graph_def |
|
106 |
apply (rule, perm_simp, rule, rule) |
|
107 |
by pat_completeness auto |
|
108 |
||
3236
e2da10806a34
changed nominal_primrec to nominal_function and termination to nominal_termination
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3235
diff
changeset
|
109 |
nominal_termination (eqvt) |
3140 | 110 |
by (relation "measure (\<lambda>(l, r, xs). size l + size r)") simp_all |
111 |
||
3141
319964ecf1f6
Change definition of Aux to include alpha-convertibility for non-closed terms.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3140
diff
changeset
|
112 |
lemma aux_simps[simp]: |
3143
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
113 |
"aux (Var x) (Var y) xs = lookup x y xs" |
3140 | 114 |
"aux (App t1 t2) (App s1 s2) xs = (aux t1 s1 xs \<and> aux t2 s2 xs)" |
115 |
"aux (Var x) (App t1 t2) xs = False" |
|
116 |
"aux (Var x) (Lam [y].t) xs = False" |
|
117 |
"aux (App t1 t2) (Var x) xs = False" |
|
118 |
"aux (App t1 t2) (Lam [x].t) xs = False" |
|
119 |
"aux (Lam [x].t) (Var y) xs = False" |
|
120 |
"aux (Lam [x].t) (App t1 t2) xs = False" |
|
121 |
"\<lbrakk>atom x \<sharp> (s, xs); atom y \<sharp> (x, t, xs)\<rbrakk> \<Longrightarrow> aux (Lam [x].t) (Lam [y].s) xs = aux t s ((x, y) # xs)" |
|
122 |
apply (subst aux.simps, simp) |
|
123 |
apply (subst aux.simps, simp) |
|
124 |
apply (subst aux.simps, simp) |
|
125 |
apply (subst aux.simps, simp) |
|
126 |
apply (subst aux.simps, simp) |
|
127 |
apply (subst aux.simps, simp) |
|
128 |
apply (subst aux.simps, simp) |
|
129 |
apply (subst aux.simps, simp) |
|
130 |
apply (subst aux.simps) |
|
131 |
apply (subst lam2_rec.simps) |
|
132 |
apply (rule, simp add: lam.fresh) |
|
133 |
apply (rule, simp add: lam.fresh) |
|
134 |
apply (intro allI impI) |
|
135 |
apply (rule_tac x="(x, x', y, y', t, t', s, s', xs)" and ?'a="name" in obtain_fresh) |
|
136 |
apply (rule_tac x="(a, x, x', y, y', t, t', s, s', xs)" and ?'a="name" in obtain_fresh) |
|
137 |
apply (rule_tac s="aux ((atom x \<rightleftharpoons> atom a) \<bullet> t) s ((a, y) # xs)" in trans) |
|
138 |
apply (rule_tac s="(atom x \<rightleftharpoons> atom a) \<bullet> aux t s ((x, y) # xs)" in trans) |
|
139 |
apply (rule permute_pure[symmetric]) |
|
140 |
apply (simp add: eqvts swap_fresh_fresh) |
|
141 |
apply (simp add: lam.fresh fresh_at_base fresh_Pair_elim) |
|
142 |
apply (rename_tac b) |
|
143 |
apply (rule_tac s="aux ((atom x \<rightleftharpoons> atom a) \<bullet> t) ((atom y \<rightleftharpoons> atom b) \<bullet> s) ((a, b) # xs)" in trans) |
|
144 |
apply (rule_tac s="(atom y \<rightleftharpoons> atom b) \<bullet> aux ((atom x \<rightleftharpoons> atom a) \<bullet> t) s ((a, y) # xs)" in trans) |
|
145 |
apply (rule permute_pure[symmetric]) |
|
146 |
apply (simp add: eqvts swap_fresh_fresh) |
|
147 |
apply (simp add: lam.fresh fresh_at_base fresh_Pair_elim) |
|
148 |
apply (subst permute_eqvt) |
|
149 |
apply (simp add: eqvts swap_fresh_fresh) |
|
150 |
apply (rule sym) |
|
151 |
apply (rule_tac s="aux ((atom x' \<rightleftharpoons> atom a) \<bullet> t') s' ((a, y') # xs)" in trans) |
|
152 |
apply (rule_tac s="(atom x' \<rightleftharpoons> atom a) \<bullet> aux t' s' ((x', y') # xs)" in trans) |
|
153 |
apply (rule permute_pure[symmetric]) |
|
154 |
apply (simp add: eqvts swap_fresh_fresh) |
|
155 |
apply (simp add: lam.fresh fresh_at_base fresh_Pair_elim swap_fresh_fresh) |
|
156 |
apply (rule_tac s="aux ((atom x' \<rightleftharpoons> atom a) \<bullet> t') ((atom y' \<rightleftharpoons> atom b) \<bullet> s') ((a, b) # xs)" in trans) |
|
157 |
apply (rule_tac s="(atom y' \<rightleftharpoons> atom b) \<bullet> aux ((atom x' \<rightleftharpoons> atom a) \<bullet> t') s' ((a, y') # xs)" in trans) |
|
158 |
apply (rule permute_pure[symmetric]) |
|
159 |
apply (simp add: eqvts swap_fresh_fresh) |
|
160 |
apply (simp add: lam.fresh fresh_at_base fresh_Pair_elim swap_fresh_fresh) |
|
161 |
apply (subst permute_eqvt) |
|
162 |
apply (simp add: eqvts swap_fresh_fresh) |
|
163 |
apply (subgoal_tac "(atom x' \<rightleftharpoons> atom a) \<bullet> t' = (atom x \<rightleftharpoons> atom a) \<bullet> t") |
|
164 |
apply (subgoal_tac "(atom y' \<rightleftharpoons> atom b) \<bullet> s' = (atom y \<rightleftharpoons> atom b) \<bullet> s") |
|
165 |
apply simp |
|
166 |
apply (subgoal_tac "Lam [y]. s = Lam [b]. ((atom y \<rightleftharpoons> atom b) \<bullet> s)") |
|
167 |
apply (subgoal_tac "Lam [y']. s' = Lam [b]. ((atom y' \<rightleftharpoons> atom b) \<bullet> s')") |
|
168 |
apply (auto simp add: fresh_Pair_elim Abs1_eq_iff)[1] |
|
169 |
apply (rule sym) |
|
170 |
apply (simp add: Abs1_eq_iff fresh_Pair_elim fresh_at_base swap_commute) |
|
171 |
apply (rule sym) |
|
172 |
apply (simp add: Abs1_eq_iff fresh_Pair_elim fresh_at_base swap_commute) |
|
173 |
apply (subgoal_tac "Lam [x]. t = Lam [a]. ((atom x \<rightleftharpoons> atom a) \<bullet> t)") |
|
174 |
apply (subgoal_tac "Lam [x']. t' = Lam [a]. ((atom x' \<rightleftharpoons> atom a) \<bullet> t')") |
|
175 |
apply (auto simp add: fresh_Pair_elim Abs1_eq_iff)[1] |
|
176 |
apply (rule sym) |
|
177 |
apply (simp add: Abs1_eq_iff fresh_Pair_elim fresh_at_base swap_commute) |
|
178 |
apply (rule sym) |
|
179 |
apply (simp add: Abs1_eq_iff fresh_Pair_elim fresh_at_base swap_commute) |
|
3148 | 180 |
apply (rule refl) |
3140 | 181 |
done |
182 |
||
3142
4d01d1056e22
Induction for Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3141
diff
changeset
|
183 |
lemma aux_induct: "\<lbrakk>\<And>xs n m. P xs (Var n) (Var m); \<And>xs n l r. P xs (Var n) (App l r); |
4d01d1056e22
Induction for Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3141
diff
changeset
|
184 |
\<And>xs n x t. P xs (Var n) (Lam [x]. t); |
4d01d1056e22
Induction for Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3141
diff
changeset
|
185 |
\<And>xs l r n. P xs (App l r) (Var n); |
4d01d1056e22
Induction for Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3141
diff
changeset
|
186 |
(\<And>xs l1 r1 l2 r2. P xs l1 l2 \<Longrightarrow> P xs r1 r2 \<Longrightarrow> P xs (App l1 r1) (App l2 r2)); |
4d01d1056e22
Induction for Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3141
diff
changeset
|
187 |
\<And>xs l r x t. P xs (App l r) (Lam [x]. t); |
4d01d1056e22
Induction for Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3141
diff
changeset
|
188 |
\<And>xs x t n. P xs (Lam [x]. t) (Var n); |
4d01d1056e22
Induction for Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3141
diff
changeset
|
189 |
\<And>xs x t l1 r1. P xs (Lam [x]. t) (App l1 r1); |
4d01d1056e22
Induction for Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3141
diff
changeset
|
190 |
\<And>x xs y s t. |
4d01d1056e22
Induction for Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3141
diff
changeset
|
191 |
atom x \<sharp> (xs, Lam [y]. s) \<and> |
4d01d1056e22
Induction for Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3141
diff
changeset
|
192 |
atom y \<sharp> (x, xs, Lam [x]. t) \<Longrightarrow> P ((x, y) # xs) t s \<Longrightarrow> P xs (Lam [x]. t) (Lam [y]. s)\<rbrakk> |
4d01d1056e22
Induction for Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3141
diff
changeset
|
193 |
\<Longrightarrow> P (a :: (name \<times> name) list) b c" |
4d01d1056e22
Induction for Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3141
diff
changeset
|
194 |
apply (induction_schema) |
4d01d1056e22
Induction for Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3141
diff
changeset
|
195 |
apply (rule_tac y="b" and c="(a, c)" in lam.strong_exhaust) |
4d01d1056e22
Induction for Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3141
diff
changeset
|
196 |
apply (rule_tac y="c" and c="(name, a, b)" in lam.strong_exhaust) |
4d01d1056e22
Induction for Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3141
diff
changeset
|
197 |
apply simp_all[3] apply (metis) |
4d01d1056e22
Induction for Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3141
diff
changeset
|
198 |
apply (rule_tac y="c" and c="(name, a, b)" in lam.strong_exhaust) |
4d01d1056e22
Induction for Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3141
diff
changeset
|
199 |
apply simp_all[3] apply (metis, metis, metis) |
4d01d1056e22
Induction for Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3141
diff
changeset
|
200 |
apply (rule_tac y="c" and c="(name, a, b)" in lam.strong_exhaust) |
4d01d1056e22
Induction for Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3141
diff
changeset
|
201 |
apply simp_all[3] apply (metis) |
4d01d1056e22
Induction for Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3141
diff
changeset
|
202 |
apply (simp add: fresh_star_def) |
4d01d1056e22
Induction for Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3141
diff
changeset
|
203 |
apply metis |
4d01d1056e22
Induction for Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3141
diff
changeset
|
204 |
apply lexicographic_order |
4d01d1056e22
Induction for Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3141
diff
changeset
|
205 |
done |
4d01d1056e22
Induction for Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3141
diff
changeset
|
206 |
|
3235
5ebd327ffb96
changed nominal_primrec into the more appropriate nominal_function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3149
diff
changeset
|
207 |
nominal_function swapequal :: "lam \<Rightarrow> lam \<Rightarrow> (name \<times> name) list \<Rightarrow> bool" where |
3143
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
208 |
"swapequal l r [] \<longleftrightarrow> l = r" |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
209 |
| "atom x \<sharp> (l, r, hl, hr, t) \<Longrightarrow> |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
210 |
swapequal l r ((hl, hr) # t) \<longleftrightarrow> swapequal ((hl \<leftrightarrow> x) \<bullet> l) ((hr \<leftrightarrow> x) \<bullet> r) t" |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
211 |
unfolding eqvt_def swapequal_graph_def |
3148 | 212 |
apply (rule, perm_simp, rule, rule TrueI) |
3143
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
213 |
apply (case_tac x) |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
214 |
apply (case_tac c) |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
215 |
apply metis |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
216 |
apply (case_tac aa) |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
217 |
apply (rename_tac l r lst h t hl hr) |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
218 |
apply (rule_tac x="(l, r, hl, hr, t)" and ?'a="name" in obtain_fresh) |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
219 |
apply simp |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
220 |
apply simp |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
221 |
apply simp |
3146
556fcd0e5fcb
Finish all subgoals about Aux.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3145
diff
changeset
|
222 |
apply clarify |
556fcd0e5fcb
Finish all subgoals about Aux.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3145
diff
changeset
|
223 |
apply (rule_tac s="(x \<leftrightarrow> xa) \<bullet> swapequal_sumC ((hla \<leftrightarrow> x) \<bullet> la, (hra \<leftrightarrow> x) \<bullet> ra, ta)" in trans) |
556fcd0e5fcb
Finish all subgoals about Aux.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3145
diff
changeset
|
224 |
apply (simp only: permute_pure) |
556fcd0e5fcb
Finish all subgoals about Aux.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3145
diff
changeset
|
225 |
apply (simp add: eqvt_at_def fresh_Pair_elim) |
556fcd0e5fcb
Finish all subgoals about Aux.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3145
diff
changeset
|
226 |
apply (simp add: flip_fresh_fresh) |
556fcd0e5fcb
Finish all subgoals about Aux.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3145
diff
changeset
|
227 |
apply (subgoal_tac "(x \<leftrightarrow> xa) \<bullet> (hla \<leftrightarrow> x) \<bullet> la = (hla \<leftrightarrow> xa) \<bullet> la") |
556fcd0e5fcb
Finish all subgoals about Aux.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3145
diff
changeset
|
228 |
apply (subgoal_tac "(x \<leftrightarrow> xa) \<bullet> (hra \<leftrightarrow> x) \<bullet> ra = (hra \<leftrightarrow> xa) \<bullet> ra") |
556fcd0e5fcb
Finish all subgoals about Aux.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3145
diff
changeset
|
229 |
apply simp |
556fcd0e5fcb
Finish all subgoals about Aux.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3145
diff
changeset
|
230 |
apply (subst permute_eqvt) |
556fcd0e5fcb
Finish all subgoals about Aux.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3145
diff
changeset
|
231 |
apply (simp add: flip_fresh_fresh flip_eqvt) |
556fcd0e5fcb
Finish all subgoals about Aux.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3145
diff
changeset
|
232 |
apply (subst permute_eqvt) |
556fcd0e5fcb
Finish all subgoals about Aux.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3145
diff
changeset
|
233 |
apply (simp add: flip_fresh_fresh flip_eqvt) |
556fcd0e5fcb
Finish all subgoals about Aux.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3145
diff
changeset
|
234 |
done |
3143
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
235 |
|
3236
e2da10806a34
changed nominal_primrec to nominal_function and termination to nominal_termination
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3235
diff
changeset
|
236 |
nominal_termination (eqvt) by lexicographic_order |
3143
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
237 |
|
3144
57dcb5c0d5db
Close some of the obvious subgoals in Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3143
diff
changeset
|
238 |
lemma var_eq_swapequal: "atom ab \<sharp> xs \<Longrightarrow> swapequal (Var ab) (Var ab) xs" |
57dcb5c0d5db
Close some of the obvious subgoals in Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3143
diff
changeset
|
239 |
apply (induct xs) |
57dcb5c0d5db
Close some of the obvious subgoals in Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3143
diff
changeset
|
240 |
apply simp |
57dcb5c0d5db
Close some of the obvious subgoals in Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3143
diff
changeset
|
241 |
apply (case_tac a) |
57dcb5c0d5db
Close some of the obvious subgoals in Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3143
diff
changeset
|
242 |
apply (simp add: fresh_Cons) |
57dcb5c0d5db
Close some of the obvious subgoals in Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3143
diff
changeset
|
243 |
apply (rule_tac x="(ab, aa, b, xs)" and ?'a="name" in obtain_fresh) |
57dcb5c0d5db
Close some of the obvious subgoals in Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3143
diff
changeset
|
244 |
apply (subst swapequal.simps) |
57dcb5c0d5db
Close some of the obvious subgoals in Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3143
diff
changeset
|
245 |
apply (simp add: fresh_Pair lam.fresh) |
57dcb5c0d5db
Close some of the obvious subgoals in Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3143
diff
changeset
|
246 |
apply (simp add: fresh_Pair_elim) |
57dcb5c0d5db
Close some of the obvious subgoals in Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3143
diff
changeset
|
247 |
by (metis flip_at_base_simps(3) fresh_Pair fresh_at_base(2)) |
57dcb5c0d5db
Close some of the obvious subgoals in Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3143
diff
changeset
|
248 |
|
3148 | 249 |
lemma var_neq_swapequal: |
250 |
"atom ab \<sharp> xs \<Longrightarrow> ab \<noteq> m \<Longrightarrow> \<not> swapequal (Var ab) (Var m) xs" |
|
251 |
"atom ab \<sharp> xs \<Longrightarrow> ab \<noteq> m \<Longrightarrow> \<not> swapequal (Var m) (Var ab) xs" |
|
3144
57dcb5c0d5db
Close some of the obvious subgoals in Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3143
diff
changeset
|
252 |
apply (induct xs arbitrary: m) |
3148 | 253 |
apply simp_all[2] |
254 |
apply (case_tac [!] a) |
|
255 |
apply (simp_all add: fresh_Cons) |
|
256 |
apply (rule_tac [!] x="(ab, aa, b, m, xs)" and ?'a="name" in obtain_fresh) |
|
3144
57dcb5c0d5db
Close some of the obvious subgoals in Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3143
diff
changeset
|
257 |
apply (subst swapequal.simps) |
3148 | 258 |
apply (auto simp add: fresh_Pair lam.fresh)[1] |
3144
57dcb5c0d5db
Close some of the obvious subgoals in Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3143
diff
changeset
|
259 |
apply (elim conjE) |
3148 | 260 |
apply (simp add: fresh_Pair_elim fresh_at_base permute_flip_at) |
3144
57dcb5c0d5db
Close some of the obvious subgoals in Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3143
diff
changeset
|
261 |
apply (subst swapequal.simps) |
3148 | 262 |
apply (auto simp add: fresh_Pair lam.fresh)[1] |
3144
57dcb5c0d5db
Close some of the obvious subgoals in Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3143
diff
changeset
|
263 |
apply (elim conjE) |
3148 | 264 |
apply (simp add: fresh_Pair_elim fresh_at_base permute_flip_at) |
265 |
done |
|
3144
57dcb5c0d5db
Close some of the obvious subgoals in Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3143
diff
changeset
|
266 |
|
3143
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
267 |
lemma lookup_swapequal: "lookup n m xs = swapequal (Var n) (Var m) xs" |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
268 |
apply (induct xs arbitrary: m n) |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
269 |
apply simp |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
270 |
apply (case_tac a) |
3148 | 271 |
apply (rule_tac x="(n, m, aa, b, xs)" and ?'a="name" in obtain_fresh) |
3143
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
272 |
apply simp |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
273 |
apply (subst swapequal.simps) |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
274 |
apply (simp add: fresh_Pair lam.fresh fresh_Nil) |
3148 | 275 |
by (metis (hide_lams, mono_tags) flip_at_base_simps(3) flip_at_simps(1) fresh_Pair fresh_at_base(2) lam.perm_simps(1) var_eq_swapequal var_neq_swapequal(1) var_neq_swapequal(2)) |
3143
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
276 |
|
3144
57dcb5c0d5db
Close some of the obvious subgoals in Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3143
diff
changeset
|
277 |
lemma swapequal_reorder: " |
3143
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
278 |
a \<noteq> x \<Longrightarrow> a \<noteq> y \<Longrightarrow> b \<noteq> x \<Longrightarrow> b \<noteq> y \<Longrightarrow> |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
279 |
swapequal t s ((x, y) # (a, b) # xs) = swapequal t s ((a, b) # (x, y) # xs)" |
3146
556fcd0e5fcb
Finish all subgoals about Aux.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3145
diff
changeset
|
280 |
apply (rule_tac x="(a, b, x, y, t, s, xs)" and ?'a="name" in obtain_fresh) |
556fcd0e5fcb
Finish all subgoals about Aux.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3145
diff
changeset
|
281 |
apply (rule_tac x="(a, b, x, y, t, s, xs, aa)" and ?'a="name" in obtain_fresh) |
556fcd0e5fcb
Finish all subgoals about Aux.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3145
diff
changeset
|
282 |
apply (rename_tac f g) |
556fcd0e5fcb
Finish all subgoals about Aux.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3145
diff
changeset
|
283 |
apply (simp add: fresh_Pair_elim fresh_at_base) |
556fcd0e5fcb
Finish all subgoals about Aux.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3145
diff
changeset
|
284 |
apply (subst swapequal.simps) |
556fcd0e5fcb
Finish all subgoals about Aux.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3145
diff
changeset
|
285 |
apply (auto simp add: fresh_Pair fresh_Cons fresh_at_base)[1] |
556fcd0e5fcb
Finish all subgoals about Aux.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3145
diff
changeset
|
286 |
apply (subgoal_tac "(x \<leftrightarrow> f) \<bullet> atom g \<sharp> t") |
556fcd0e5fcb
Finish all subgoals about Aux.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3145
diff
changeset
|
287 |
apply (subst swapequal.simps) |
556fcd0e5fcb
Finish all subgoals about Aux.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3145
diff
changeset
|
288 |
apply (simp add: fresh_Pair fresh_Cons fresh_permute_left) |
556fcd0e5fcb
Finish all subgoals about Aux.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3145
diff
changeset
|
289 |
apply rule apply assumption |
556fcd0e5fcb
Finish all subgoals about Aux.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3145
diff
changeset
|
290 |
apply (simp add: flip_at_base_simps fresh_at_base flip_def) |
556fcd0e5fcb
Finish all subgoals about Aux.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3145
diff
changeset
|
291 |
apply (subst swapequal.simps) |
556fcd0e5fcb
Finish all subgoals about Aux.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3145
diff
changeset
|
292 |
apply (simp add: fresh_Pair fresh_Cons fresh_at_base) |
556fcd0e5fcb
Finish all subgoals about Aux.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3145
diff
changeset
|
293 |
apply rule apply (rotate_tac 12) |
556fcd0e5fcb
Finish all subgoals about Aux.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3145
diff
changeset
|
294 |
apply assumption |
556fcd0e5fcb
Finish all subgoals about Aux.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3145
diff
changeset
|
295 |
apply (simp add: fresh_Pair fresh_Cons fresh_at_base) |
556fcd0e5fcb
Finish all subgoals about Aux.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3145
diff
changeset
|
296 |
apply (subst swapequal.simps) |
556fcd0e5fcb
Finish all subgoals about Aux.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3145
diff
changeset
|
297 |
apply (simp add: fresh_Pair fresh_Cons fresh_at_base fresh_permute_left) |
556fcd0e5fcb
Finish all subgoals about Aux.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3145
diff
changeset
|
298 |
apply (subgoal_tac "(a \<leftrightarrow> g) \<bullet> atom f \<sharp> t") |
3147
d24e70483051
Clean the proof of Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3146
diff
changeset
|
299 |
apply rule apply assumption |
3146
556fcd0e5fcb
Finish all subgoals about Aux.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3145
diff
changeset
|
300 |
apply (simp add: flip_at_base_simps fresh_at_base flip_def) |
556fcd0e5fcb
Finish all subgoals about Aux.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3145
diff
changeset
|
301 |
apply (simp add: flip_at_base_simps fresh_at_base flip_def) |
556fcd0e5fcb
Finish all subgoals about Aux.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3145
diff
changeset
|
302 |
apply (subgoal_tac "(a \<leftrightarrow> g) \<bullet> (x \<leftrightarrow> f) \<bullet> t = (x \<leftrightarrow> f) \<bullet> (a \<leftrightarrow> g) \<bullet> t") |
556fcd0e5fcb
Finish all subgoals about Aux.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3145
diff
changeset
|
303 |
apply (subgoal_tac "(b \<leftrightarrow> g) \<bullet> (y \<leftrightarrow> f) \<bullet> s = (y \<leftrightarrow> f) \<bullet> (b \<leftrightarrow> g) \<bullet> s") |
556fcd0e5fcb
Finish all subgoals about Aux.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3145
diff
changeset
|
304 |
apply simp |
3149
78c0a707fb2d
remove smt calls
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3148
diff
changeset
|
305 |
apply (subst permute_eqvt) apply (simp add: flip_eqvt) |
78c0a707fb2d
remove smt calls
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3148
diff
changeset
|
306 |
apply (subst permute_eqvt) apply (simp add: flip_eqvt) |
3147
d24e70483051
Clean the proof of Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3146
diff
changeset
|
307 |
apply (simp add: flip_at_base_simps fresh_at_base flip_def) |
3146
556fcd0e5fcb
Finish all subgoals about Aux.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3145
diff
changeset
|
308 |
done |
3143
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
309 |
|
3144
57dcb5c0d5db
Close some of the obvious subgoals in Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3143
diff
changeset
|
310 |
lemma swapequal_lambda: |
3143
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
311 |
assumes "distinct xs \<and> atom x \<sharp> xs \<and> atom y \<sharp> xs" |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
312 |
shows "swapequal (Lam [x]. t) (Lam [y]. s) xs = swapequal t s ((x, y) # xs)" |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
313 |
using assms |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
314 |
apply (induct xs arbitrary: t s x y) |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
315 |
apply (rule_tac x="(x, y, t, s)" and ?'a="name" in obtain_fresh) |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
316 |
apply (simp add: fresh_Pair_elim fresh_Nil) |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
317 |
apply (subst swapequal.simps) |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
318 |
apply (simp add: fresh_Pair fresh_Nil) |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
319 |
apply auto[1] |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
320 |
apply simp |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
321 |
apply (subgoal_tac "[[atom x]]lst. t = [[atom a]]lst. ((x \<leftrightarrow> a) \<bullet> t)") |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
322 |
apply (subgoal_tac "[[atom y]]lst. s = [[atom a]]lst. ((y \<leftrightarrow> a) \<bullet> s)") |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
323 |
apply simp |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
324 |
apply (simp add: Abs1_eq_iff) |
3148 | 325 |
apply (auto simp add: Abs1_eq_iff flip_def fresh_at_base)[2] |
3149
78c0a707fb2d
remove smt calls
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3148
diff
changeset
|
326 |
apply (simp add: fresh_permute_left) |
78c0a707fb2d
remove smt calls
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3148
diff
changeset
|
327 |
apply (simp add: fresh_permute_left) |
3143
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
328 |
apply clarify |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
329 |
apply (simp add: fresh_Cons fresh_Pair fresh_at_base) |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
330 |
apply clarify |
3148 | 331 |
apply (simp add: swapequal_reorder) |
3143
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
332 |
apply (rule_tac x="(x, y, t, s, a, b, xs)" and ?'a="name" in obtain_fresh) |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
333 |
apply (rename_tac f) |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
334 |
apply (subst (2) swapequal.simps) |
3148 | 335 |
apply (auto simp add: lam.fresh fresh_Pair fresh_at_base fresh_Cons)[1] |
3143
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
336 |
apply (subst swapequal.simps) |
3148 | 337 |
apply (auto simp add: lam.fresh fresh_Pair fresh_at_base fresh_Cons)[1] |
338 |
apply (simp add: flip_def fresh_Pair_elim fresh_at_base) |
|
3143
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
339 |
done |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
340 |
|
3145 | 341 |
lemma distinct_swapequal: "\<forall>p q. p \<bullet> l \<noteq> q \<bullet> r \<Longrightarrow> \<not>swapequal l r xs" |
342 |
apply (induct xs rule:swapequal.induct) |
|
3148 | 343 |
apply auto[1] |
3145 | 344 |
apply (simp add: fresh_Pair_elim) |
345 |
apply (subgoal_tac "\<forall>(p\<Colon>perm) q\<Colon>perm. p \<bullet> (hl \<leftrightarrow> x) \<bullet> l \<noteq> q \<bullet> (hr \<leftrightarrow> x) \<bullet> r") |
|
346 |
apply simp |
|
347 |
apply (intro allI) |
|
348 |
apply (drule_tac x="p + (hl \<leftrightarrow> x)" in spec) |
|
349 |
apply (drule_tac x="q + (hr \<leftrightarrow> x)" in spec) |
|
350 |
apply simp |
|
351 |
done |
|
352 |
||
353 |
lemma swapequal_app: "(swapequal l1 l2 xs \<and> swapequal r1 r2 xs) = swapequal (App l1 r1) (App l2 r2) xs" |
|
354 |
apply (induct xs arbitrary: l1 l2 r1 r2) |
|
355 |
apply simp |
|
356 |
apply (case_tac a) |
|
357 |
apply simp |
|
358 |
apply (rule_tac x="(l1, l2, r1, r2, aa, b, xs)" and ?'a="name" in obtain_fresh) |
|
359 |
apply (simp add: fresh_Pair_elim) |
|
3148 | 360 |
apply (subst swapequal.simps) apply (auto simp add: fresh_Pair)[1] |
361 |
apply (subst swapequal.simps) apply (auto simp add: fresh_Pair lam.fresh) |
|
3145 | 362 |
done |
363 |
||
364 |
lemma [simp]: "distinct (map fst xs) \<Longrightarrow> distinct xs" |
|
365 |
by (induct xs) auto |
|
366 |
||
367 |
lemma [simp]: |
|
368 |
"atom x \<sharp> xs \<Longrightarrow> x \<notin> fst ` set xs" |
|
369 |
"atom x \<sharp> xs \<Longrightarrow> x \<notin> snd ` set xs" |
|
370 |
apply (induct xs) |
|
371 |
apply simp_all |
|
372 |
apply (case_tac [!] a) |
|
373 |
apply (simp_all add: fresh_Cons fresh_Pair fresh_at_base) |
|
374 |
done |
|
375 |
||
3143
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
376 |
lemma aux_alphaish: |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
377 |
assumes "distinct (map fst xs @ map snd xs)" |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
378 |
shows "aux x y xs \<longleftrightarrow> swapequal x y xs" |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
379 |
using assms |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
380 |
apply (induct xs x y rule: aux_induct) |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
381 |
apply (simp add: lookup_swapequal) |
3148 | 382 |
apply (simp, rule distinct_swapequal, simp)+ |
3145 | 383 |
apply (simp add: swapequal_app) |
3148 | 384 |
apply (simp, rule distinct_swapequal, simp)+ |
385 |
apply (simp add: fresh_Pair_elim lam.fresh fresh_at_base conjE) |
|
3143
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
386 |
apply (elim conjE) |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
387 |
apply (simp add: fresh_Pair_elim lam.fresh fresh_at_base) |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
388 |
apply (subgoal_tac "x \<notin> fst ` set xs \<and> |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
389 |
x \<notin> snd ` set xs \<and> y \<notin> snd ` set xs \<and> y \<notin> fst ` set xs") |
3144
57dcb5c0d5db
Close some of the obvious subgoals in Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3143
diff
changeset
|
390 |
apply (subst swapequal_lambda) |
3145 | 391 |
apply auto[2] |
392 |
apply simp |
|
393 |
done |
|
3143
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
394 |
|
3147
d24e70483051
Clean the proof of Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3146
diff
changeset
|
395 |
lemma aux_is_alpha: |
3143
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
396 |
"aux x y [] \<longleftrightarrow> (x = y)" |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
397 |
by (simp_all add: supp_Nil aux_alphaish) |
1da802bd2ab1
Correct Aux and proof sketch that it's same as alpha-equality, following Dan Synek's proof.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
3142
diff
changeset
|
398 |
|
3140 | 399 |
end |
400 |
||
401 |
||
402 |