author | Cezary Kaliszyk <kaliszyk@in.tum.de> |
Wed, 04 Nov 2009 11:08:05 +0100 | |
changeset 276 | 783d6c940e45 |
parent 273 | b82e765ca464 |
child 285 | 8ebdef196fd5 |
permissions | -rw-r--r-- |
201
1ac36993cc71
added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1 |
theory LamEx |
1ac36993cc71
added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
2 |
imports Nominal QuotMain |
1ac36993cc71
added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
3 |
begin |
1ac36993cc71
added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
4 |
|
1ac36993cc71
added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
5 |
atom_decl name |
1ac36993cc71
added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
6 |
|
243 | 7 |
thm abs_fresh(1) |
8 |
||
201
1ac36993cc71
added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
9 |
nominal_datatype rlam = |
1ac36993cc71
added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
10 |
rVar "name" |
1ac36993cc71
added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
11 |
| rApp "rlam" "rlam" |
1ac36993cc71
added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
12 |
| rLam "name" "rlam" |
1ac36993cc71
added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
13 |
|
259 | 14 |
print_theorems |
201
1ac36993cc71
added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
15 |
|
243 | 16 |
function |
17 |
rfv :: "rlam \<Rightarrow> name set" |
|
18 |
where |
|
19 |
rfv_var: "rfv (rVar a) = {a}" |
|
20 |
| rfv_app: "rfv (rApp t1 t2) = (rfv t1) \<union> (rfv t2)" |
|
21 |
| rfv_lam: "rfv (rLam a t) = (rfv t) - {a}" |
|
22 |
sorry |
|
23 |
||
247 | 24 |
termination rfv sorry |
243 | 25 |
|
271
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
26 |
inductive |
246
6da7d538e5e0
changed the order of rfv and reformulated a3 with rfv
Christian Urban <urbanc@in.tum.de>
parents:
245
diff
changeset
|
27 |
alpha :: "rlam \<Rightarrow> rlam \<Rightarrow> bool" ("_ \<approx> _" [100, 100] 100) |
6da7d538e5e0
changed the order of rfv and reformulated a3 with rfv
Christian Urban <urbanc@in.tum.de>
parents:
245
diff
changeset
|
28 |
where |
6da7d538e5e0
changed the order of rfv and reformulated a3 with rfv
Christian Urban <urbanc@in.tum.de>
parents:
245
diff
changeset
|
29 |
a1: "a = b \<Longrightarrow> (rVar a) \<approx> (rVar b)" |
6da7d538e5e0
changed the order of rfv and reformulated a3 with rfv
Christian Urban <urbanc@in.tum.de>
parents:
245
diff
changeset
|
30 |
| a2: "\<lbrakk>t1 \<approx> t2; s1 \<approx> s2\<rbrakk> \<Longrightarrow> rApp t1 s1 \<approx> rApp t2 s2" |
6da7d538e5e0
changed the order of rfv and reformulated a3 with rfv
Christian Urban <urbanc@in.tum.de>
parents:
245
diff
changeset
|
31 |
| a3: "\<lbrakk>t \<approx> ([(a,b)]\<bullet>s); a \<notin> rfv (rLam b t)\<rbrakk> \<Longrightarrow> rLam a t \<approx> rLam b s" |
6da7d538e5e0
changed the order of rfv and reformulated a3 with rfv
Christian Urban <urbanc@in.tum.de>
parents:
245
diff
changeset
|
32 |
|
259 | 33 |
print_theorems |
34 |
||
271
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
35 |
lemma alpha_refl: |
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
36 |
shows "x \<approx> x" |
272
ddd2f209d0d2
Playing with alpha_refl.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
271
diff
changeset
|
37 |
apply (rule rlam.induct) |
ddd2f209d0d2
Playing with alpha_refl.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
271
diff
changeset
|
38 |
apply (simp_all add:a1 a2) |
ddd2f209d0d2
Playing with alpha_refl.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
271
diff
changeset
|
39 |
apply (rule a3) |
ddd2f209d0d2
Playing with alpha_refl.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
271
diff
changeset
|
40 |
apply (simp_all) |
273
b82e765ca464
Lifting 'fold1.simps(2)' and some cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
272
diff
changeset
|
41 |
(* apply (simp add: pt_swap_bij'') *) |
271
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
42 |
sorry |
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
43 |
|
201
1ac36993cc71
added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
44 |
quotient lam = rlam / alpha |
1ac36993cc71
added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
45 |
sorry |
1ac36993cc71
added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
46 |
|
203
7384115df9fd
added equiv-thm to the quot_info
Christian Urban <urbanc@in.tum.de>
parents:
201
diff
changeset
|
47 |
print_quotients |
7384115df9fd
added equiv-thm to the quot_info
Christian Urban <urbanc@in.tum.de>
parents:
201
diff
changeset
|
48 |
|
268
4d58c02289ca
simplified the quotient_def code; type of the defined constant must now be given; for-part eliminated
Christian Urban <urbanc@in.tum.de>
parents:
267
diff
changeset
|
49 |
quotient_def |
229
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
50 |
Var :: "name \<Rightarrow> lam" |
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
51 |
where |
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
52 |
"Var \<equiv> rVar" |
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
53 |
|
268
4d58c02289ca
simplified the quotient_def code; type of the defined constant must now be given; for-part eliminated
Christian Urban <urbanc@in.tum.de>
parents:
267
diff
changeset
|
54 |
quotient_def |
229
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
55 |
App :: "lam \<Rightarrow> lam \<Rightarrow> lam" |
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
56 |
where |
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
57 |
"App \<equiv> rApp" |
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
58 |
|
268
4d58c02289ca
simplified the quotient_def code; type of the defined constant must now be given; for-part eliminated
Christian Urban <urbanc@in.tum.de>
parents:
267
diff
changeset
|
59 |
quotient_def |
229
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
60 |
Lam :: "name \<Rightarrow> lam \<Rightarrow> lam" |
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
61 |
where |
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
62 |
"Lam \<equiv> rLam" |
201
1ac36993cc71
added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
63 |
|
218
df05cd030d2f
added infrastructure for defining lifted constants
Christian Urban <urbanc@in.tum.de>
parents:
203
diff
changeset
|
64 |
thm Var_def |
df05cd030d2f
added infrastructure for defining lifted constants
Christian Urban <urbanc@in.tum.de>
parents:
203
diff
changeset
|
65 |
thm App_def |
df05cd030d2f
added infrastructure for defining lifted constants
Christian Urban <urbanc@in.tum.de>
parents:
203
diff
changeset
|
66 |
thm Lam_def |
df05cd030d2f
added infrastructure for defining lifted constants
Christian Urban <urbanc@in.tum.de>
parents:
203
diff
changeset
|
67 |
|
268
4d58c02289ca
simplified the quotient_def code; type of the defined constant must now be given; for-part eliminated
Christian Urban <urbanc@in.tum.de>
parents:
267
diff
changeset
|
68 |
quotient_def |
243 | 69 |
fv :: "lam \<Rightarrow> name set" |
70 |
where |
|
71 |
"fv \<equiv> rfv" |
|
72 |
||
73 |
thm fv_def |
|
74 |
||
229
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
75 |
(* definition of overloaded permutation function *) |
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
76 |
(* for the lifted type lam *) |
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
77 |
overloading |
268
4d58c02289ca
simplified the quotient_def code; type of the defined constant must now be given; for-part eliminated
Christian Urban <urbanc@in.tum.de>
parents:
267
diff
changeset
|
78 |
perm_lam \<equiv> "perm :: 'x prm \<Rightarrow> lam \<Rightarrow> lam" (unchecked) |
229
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
79 |
begin |
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
80 |
|
268
4d58c02289ca
simplified the quotient_def code; type of the defined constant must now be given; for-part eliminated
Christian Urban <urbanc@in.tum.de>
parents:
267
diff
changeset
|
81 |
quotient_def |
229
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
82 |
perm_lam :: "'x prm \<Rightarrow> lam \<Rightarrow> lam" |
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
83 |
where |
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
84 |
"perm_lam \<equiv> (perm::'x prm \<Rightarrow> rlam \<Rightarrow> rlam)" |
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
85 |
|
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
86 |
end |
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
87 |
|
238
e9cc3a3aa5d1
Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
237
diff
changeset
|
88 |
(*quotient_def (for lam) |
e9cc3a3aa5d1
Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
237
diff
changeset
|
89 |
abs_fun_lam :: "'x prm \<Rightarrow> lam \<Rightarrow> lam" |
e9cc3a3aa5d1
Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
237
diff
changeset
|
90 |
where |
e9cc3a3aa5d1
Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
237
diff
changeset
|
91 |
"perm_lam \<equiv> (perm::'x prm \<Rightarrow> rlam \<Rightarrow> rlam)"*) |
e9cc3a3aa5d1
Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
237
diff
changeset
|
92 |
|
e9cc3a3aa5d1
Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
237
diff
changeset
|
93 |
|
229
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
94 |
thm perm_lam_def |
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
95 |
|
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
96 |
(* lemmas that need to lift *) |
234
811f17de4031
Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
233
diff
changeset
|
97 |
lemma pi_var_com: |
229
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
98 |
fixes pi::"'x prm" |
234
811f17de4031
Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
233
diff
changeset
|
99 |
shows "(pi\<bullet>rVar a) \<approx> rVar (pi\<bullet>a)" |
229
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
100 |
sorry |
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
101 |
|
234
811f17de4031
Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
233
diff
changeset
|
102 |
lemma pi_app_com: |
229
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
103 |
fixes pi::"'x prm" |
234
811f17de4031
Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
233
diff
changeset
|
104 |
shows "(pi\<bullet>rApp t1 t2) \<approx> rApp (pi\<bullet>t1) (pi\<bullet>t2)" |
229
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
105 |
sorry |
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
106 |
|
234
811f17de4031
Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
233
diff
changeset
|
107 |
lemma pi_lam_com: |
229
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
108 |
fixes pi::"'x prm" |
234
811f17de4031
Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
233
diff
changeset
|
109 |
shows "(pi\<bullet>rLam a t) \<approx> rLam (pi\<bullet>a) (pi\<bullet>t)" |
229
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
110 |
sorry |
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
111 |
|
243 | 112 |
lemma fv_var: |
113 |
shows "fv (Var a) = {a}" |
|
114 |
sorry |
|
115 |
||
116 |
lemma fv_app: |
|
117 |
shows "fv (App t1 t2) = (fv t1) \<union> (fv t2)" |
|
118 |
sorry |
|
119 |
||
120 |
lemma fv_lam: |
|
121 |
shows "fv (Lam a t) = (fv t) - {a}" |
|
252
e30997c88050
Regularize for equalities and a better tactic. "alpha.cases" now lifts.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
251
diff
changeset
|
122 |
sorry |
243 | 123 |
|
201
1ac36993cc71
added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
124 |
lemma real_alpha: |
242 | 125 |
assumes "t = [(a,b)]\<bullet>s" "a\<sharp>[b].s" |
201
1ac36993cc71
added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
126 |
shows "Lam a t = Lam b s" |
217
9cc87d02190a
First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
203
diff
changeset
|
127 |
sorry |
9cc87d02190a
First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
203
diff
changeset
|
128 |
|
234
811f17de4031
Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
233
diff
changeset
|
129 |
lemma perm_rsp: "(op = ===> alpha ===> alpha) op \<bullet> op \<bullet>" |
229
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
130 |
apply(auto) |
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
131 |
(* this is propably true if some type conditions are imposed ;o) *) |
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
132 |
sorry |
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
133 |
|
234
811f17de4031
Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
233
diff
changeset
|
134 |
lemma fresh_rsp: "(op = ===> alpha ===> op =) fresh fresh" |
229
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
135 |
apply(auto) |
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
136 |
(* this is probably only true if some type conditions are imposed *) |
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
137 |
sorry |
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
138 |
|
234
811f17de4031
Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
233
diff
changeset
|
139 |
lemma rVar_rsp: "(op = ===> alpha) rVar rVar" |
811f17de4031
Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
233
diff
changeset
|
140 |
apply(auto) |
811f17de4031
Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
233
diff
changeset
|
141 |
apply(rule a1) |
811f17de4031
Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
233
diff
changeset
|
142 |
apply(simp) |
811f17de4031
Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
233
diff
changeset
|
143 |
done |
811f17de4031
Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
233
diff
changeset
|
144 |
|
811f17de4031
Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
233
diff
changeset
|
145 |
lemma rApp_rsp: "(alpha ===> alpha ===> alpha) rApp rApp" |
811f17de4031
Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
233
diff
changeset
|
146 |
apply(auto) |
811f17de4031
Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
233
diff
changeset
|
147 |
apply(rule a2) |
811f17de4031
Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
233
diff
changeset
|
148 |
apply (assumption) |
811f17de4031
Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
233
diff
changeset
|
149 |
apply (assumption) |
811f17de4031
Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
233
diff
changeset
|
150 |
done |
811f17de4031
Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
233
diff
changeset
|
151 |
|
811f17de4031
Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
233
diff
changeset
|
152 |
lemma rLam_rsp: "(op = ===> alpha ===> alpha) rLam rLam" |
229
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
153 |
apply(auto) |
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
154 |
apply(rule a3) |
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
155 |
apply(rule_tac t="[(x,x)]\<bullet>y" and s="y" in subst) |
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
156 |
apply(rule sym) |
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
157 |
apply(rule trans) |
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
158 |
apply(rule pt_name3) |
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
159 |
apply(rule at_ds1[OF at_name_inst]) |
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
160 |
apply(simp add: pt_name1) |
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
161 |
apply(assumption) |
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
162 |
apply(simp add: abs_fresh) |
13f985a93dbc
fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents:
225
diff
changeset
|
163 |
done |
217
9cc87d02190a
First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
203
diff
changeset
|
164 |
|
247 | 165 |
lemma rfv_rsp: "(alpha ===> op =) rfv rfv" |
166 |
sorry |
|
217
9cc87d02190a
First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
203
diff
changeset
|
167 |
|
9cc87d02190a
First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
203
diff
changeset
|
168 |
ML {* val qty = @{typ "lam"} *} |
247 | 169 |
ML {* val defs = @{thms Var_def App_def Lam_def perm_lam_def fv_def} *} |
271
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
170 |
ML {* val rsp_thms = @{thms perm_rsp fresh_rsp rVar_rsp rApp_rsp rLam_rsp rfv_rsp} @ |
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
171 |
@{thms ho_all_prs ho_ex_prs} *} |
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
172 |
|
240 | 173 |
ML {* fun lift_thm_lam lthy t = lift_thm lthy qty "lam" rsp_thms defs t *} |
237 | 174 |
|
249
7dec34d12328
added some facts about fresh and support of lam
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
175 |
ML {* val pi_var = lift_thm_lam @{context} @{thm pi_var_com} *} |
7dec34d12328
added some facts about fresh and support of lam
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
176 |
ML {* val pi_app = lift_thm_lam @{context} @{thm pi_app_com} *} |
7dec34d12328
added some facts about fresh and support of lam
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
177 |
ML {* val pi_lam = lift_thm_lam @{context} @{thm pi_lam_com} *} |
7dec34d12328
added some facts about fresh and support of lam
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
178 |
|
7dec34d12328
added some facts about fresh and support of lam
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
179 |
ML {* val fv_var = lift_thm_lam @{context} @{thm rfv_var} *} |
7dec34d12328
added some facts about fresh and support of lam
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
180 |
ML {* val fv_app = lift_thm_lam @{context} @{thm rfv_app} *} |
7dec34d12328
added some facts about fresh and support of lam
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
181 |
ML {* val fv_lam = lift_thm_lam @{context} @{thm rfv_lam} *} |
7dec34d12328
added some facts about fresh and support of lam
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
182 |
|
7dec34d12328
added some facts about fresh and support of lam
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
183 |
ML {* val a1 = lift_thm_lam @{context} @{thm a1} *} |
259 | 184 |
ML {* val a2 = lift_thm_lam @{context} @{thm a2} *} |
249
7dec34d12328
added some facts about fresh and support of lam
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
185 |
ML {* val a3 = lift_thm_lam @{context} @{thm a3} *} |
7dec34d12328
added some facts about fresh and support of lam
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
186 |
|
252
e30997c88050
Regularize for equalities and a better tactic. "alpha.cases" now lifts.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
251
diff
changeset
|
187 |
ML {* val alpha_cases = lift_thm_lam @{context} @{thm alpha.cases} *} |
271
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
188 |
ML {* val alpha_induct = lift_thm_lam @{context} @{thm alpha.induct} *} |
252
e30997c88050
Regularize for equalities and a better tactic. "alpha.cases" now lifts.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
251
diff
changeset
|
189 |
|
249
7dec34d12328
added some facts about fresh and support of lam
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
190 |
local_setup {* |
7dec34d12328
added some facts about fresh and support of lam
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
191 |
Quotient.note (@{binding "pi_var"}, pi_var) #> snd #> |
7dec34d12328
added some facts about fresh and support of lam
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
192 |
Quotient.note (@{binding "pi_app"}, pi_app) #> snd #> |
7dec34d12328
added some facts about fresh and support of lam
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
193 |
Quotient.note (@{binding "pi_lam"}, pi_lam) #> snd #> |
7dec34d12328
added some facts about fresh and support of lam
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
194 |
Quotient.note (@{binding "a1"}, a1) #> snd #> |
7dec34d12328
added some facts about fresh and support of lam
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
195 |
Quotient.note (@{binding "a2"}, a2) #> snd #> |
252
e30997c88050
Regularize for equalities and a better tactic. "alpha.cases" now lifts.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
251
diff
changeset
|
196 |
Quotient.note (@{binding "a3"}, a3) #> snd #> |
271
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
197 |
Quotient.note (@{binding "alpha_cases"}, alpha_cases) #> snd #> |
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
198 |
Quotient.note (@{binding "alpha_induct"}, alpha_induct) #> snd |
249
7dec34d12328
added some facts about fresh and support of lam
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
199 |
*} |
237 | 200 |
|
249
7dec34d12328
added some facts about fresh and support of lam
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
201 |
thm alpha.cases |
252
e30997c88050
Regularize for equalities and a better tactic. "alpha.cases" now lifts.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
251
diff
changeset
|
202 |
thm alpha_cases |
271
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
203 |
thm alpha.induct |
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
204 |
thm alpha_induct |
249
7dec34d12328
added some facts about fresh and support of lam
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
205 |
|
271
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
206 |
lemma rvar_inject: "rVar a \<approx> rVar b = (a = b)" |
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
207 |
apply (auto) |
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
208 |
apply (erule alpha.cases) |
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
209 |
apply (simp_all add: rlam.inject alpha_refl) |
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
210 |
done |
249
7dec34d12328
added some facts about fresh and support of lam
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
211 |
|
271
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
212 |
ML {* val var_inject = Toplevel.program (fn () => lift_thm_lam @{context} @{thm rvar_inject}) *} |
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
213 |
|
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
214 |
local_setup {* |
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
215 |
Quotient.note (@{binding "var_inject"}, var_inject) #> snd |
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
216 |
*} |
247 | 217 |
|
249
7dec34d12328
added some facts about fresh and support of lam
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
218 |
lemma var_supp: |
7dec34d12328
added some facts about fresh and support of lam
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
219 |
shows "supp (Var a) = ((supp a)::name set)" |
7dec34d12328
added some facts about fresh and support of lam
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
220 |
apply(simp add: supp_def) |
7dec34d12328
added some facts about fresh and support of lam
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
221 |
apply(simp add: pi_var) |
7dec34d12328
added some facts about fresh and support of lam
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
222 |
apply(simp add: var_inject) |
7dec34d12328
added some facts about fresh and support of lam
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
223 |
done |
7dec34d12328
added some facts about fresh and support of lam
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
224 |
|
7dec34d12328
added some facts about fresh and support of lam
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
225 |
lemma var_fresh: |
7dec34d12328
added some facts about fresh and support of lam
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
226 |
fixes a::"name" |
7dec34d12328
added some facts about fresh and support of lam
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
227 |
shows "(a\<sharp>(Var b)) = (a\<sharp>b)" |
7dec34d12328
added some facts about fresh and support of lam
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
228 |
apply(simp add: fresh_def) |
7dec34d12328
added some facts about fresh and support of lam
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
229 |
apply(simp add: var_supp) |
7dec34d12328
added some facts about fresh and support of lam
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
230 |
done |
247 | 231 |
|
232 |
||
233 |
||
234 |
||
235 |
||
236 |
||
237 |
||
271
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
238 |
|
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
239 |
|
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
240 |
|
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
241 |
|
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
242 |
|
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
243 |
(* Construction Site code *) |
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
244 |
|
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
245 |
ML {* val (rty, rel, rel_refl, rel_eqv) = lookup_quot_data @{context} qty *} |
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
246 |
ML {* val consts = lookup_quot_consts defs *} |
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
247 |
ML {* val (trans2, reps_same, absrep, quot) = lookup_quot_thms @{context} "lam" *} |
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
248 |
|
253
e169a99c6ada
Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
252
diff
changeset
|
249 |
ML {* val t_a = atomize_thm @{thm alpha.induct} *} |
e169a99c6ada
Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
252
diff
changeset
|
250 |
(* prove {* build_regularize_goal t_a rty rel @{context} *} |
e169a99c6ada
Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
252
diff
changeset
|
251 |
ML_prf {* fun tac ctxt = |
e169a99c6ada
Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
252
diff
changeset
|
252 |
(FIRST' [ |
e169a99c6ada
Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
252
diff
changeset
|
253 |
rtac rel_refl, |
e169a99c6ada
Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
252
diff
changeset
|
254 |
atac, |
e169a99c6ada
Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
252
diff
changeset
|
255 |
rtac @{thm universal_twice}, |
e169a99c6ada
Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
252
diff
changeset
|
256 |
(rtac @{thm impI} THEN' atac), |
e169a99c6ada
Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
252
diff
changeset
|
257 |
rtac @{thm implication_twice}, |
e169a99c6ada
Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
252
diff
changeset
|
258 |
EqSubst.eqsubst_tac ctxt [0] |
e169a99c6ada
Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
252
diff
changeset
|
259 |
[(@{thm equiv_res_forall} OF [rel_eqv]), |
e169a99c6ada
Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
252
diff
changeset
|
260 |
(@{thm equiv_res_exists} OF [rel_eqv])], |
e169a99c6ada
Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
252
diff
changeset
|
261 |
(rtac @{thm impI} THEN' (asm_full_simp_tac (Simplifier.context ctxt HOL_ss)) THEN' rtac rel_refl), |
e169a99c6ada
Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
252
diff
changeset
|
262 |
(rtac @{thm RIGHT_RES_FORALL_REGULAR}) |
e169a99c6ada
Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
252
diff
changeset
|
263 |
]); |
e169a99c6ada
Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
252
diff
changeset
|
264 |
*} |
e169a99c6ada
Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
252
diff
changeset
|
265 |
apply (tactic {* tac @{context} 1 *}) *) |
251 | 266 |
ML {* val t_r = regularize t_a rty rel rel_eqv rel_refl @{context} *} |
259 | 267 |
|
258
93ea455b29f1
Map does not fully work yet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
257
diff
changeset
|
268 |
(*ML {* |
257
68bd5c2a1b96
Fixed quotdata_lookup.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
253
diff
changeset
|
269 |
val rt = build_repabs_term @{context} t_r consts rty qty |
68bd5c2a1b96
Fixed quotdata_lookup.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
253
diff
changeset
|
270 |
val rg = Logic.mk_equals ((Thm.prop_of t_r), rt); |
68bd5c2a1b96
Fixed quotdata_lookup.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
253
diff
changeset
|
271 |
*} |
68bd5c2a1b96
Fixed quotdata_lookup.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
253
diff
changeset
|
272 |
prove rg |
68bd5c2a1b96
Fixed quotdata_lookup.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
253
diff
changeset
|
273 |
apply(atomize(full)) |
68bd5c2a1b96
Fixed quotdata_lookup.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
253
diff
changeset
|
274 |
ML_prf {* |
68bd5c2a1b96
Fixed quotdata_lookup.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
253
diff
changeset
|
275 |
fun r_mk_comb_tac ctxt rty quot_thm reflex_thm trans_thm rsp_thms = |
68bd5c2a1b96
Fixed quotdata_lookup.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
253
diff
changeset
|
276 |
(FIRST' [ |
68bd5c2a1b96
Fixed quotdata_lookup.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
253
diff
changeset
|
277 |
rtac trans_thm, |
68bd5c2a1b96
Fixed quotdata_lookup.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
253
diff
changeset
|
278 |
LAMBDA_RES_TAC ctxt, |
68bd5c2a1b96
Fixed quotdata_lookup.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
253
diff
changeset
|
279 |
res_forall_rsp_tac ctxt, |
68bd5c2a1b96
Fixed quotdata_lookup.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
253
diff
changeset
|
280 |
res_exists_rsp_tac ctxt, |
68bd5c2a1b96
Fixed quotdata_lookup.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
253
diff
changeset
|
281 |
( |
68bd5c2a1b96
Fixed quotdata_lookup.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
253
diff
changeset
|
282 |
(simp_tac ((Simplifier.context ctxt HOL_ss) addsimps rsp_thms)) |
68bd5c2a1b96
Fixed quotdata_lookup.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
253
diff
changeset
|
283 |
THEN_ALL_NEW (fn _ => no_tac) |
68bd5c2a1b96
Fixed quotdata_lookup.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
253
diff
changeset
|
284 |
), |
68bd5c2a1b96
Fixed quotdata_lookup.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
253
diff
changeset
|
285 |
(instantiate_tac @{thm REP_ABS_RSP(1)} ctxt THEN' (RANGE [quotient_tac quot_thm])), |
68bd5c2a1b96
Fixed quotdata_lookup.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
253
diff
changeset
|
286 |
rtac refl, |
68bd5c2a1b96
Fixed quotdata_lookup.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
253
diff
changeset
|
287 |
(APPLY_RSP_TAC rty ctxt THEN' (RANGE [quotient_tac quot_thm, quotient_tac quot_thm])), |
68bd5c2a1b96
Fixed quotdata_lookup.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
253
diff
changeset
|
288 |
Cong_Tac.cong_tac @{thm cong}, |
68bd5c2a1b96
Fixed quotdata_lookup.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
253
diff
changeset
|
289 |
rtac @{thm ext}, |
68bd5c2a1b96
Fixed quotdata_lookup.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
253
diff
changeset
|
290 |
rtac reflex_thm, |
68bd5c2a1b96
Fixed quotdata_lookup.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
253
diff
changeset
|
291 |
atac, |
68bd5c2a1b96
Fixed quotdata_lookup.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
253
diff
changeset
|
292 |
( |
68bd5c2a1b96
Fixed quotdata_lookup.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
253
diff
changeset
|
293 |
(simp_tac ((Simplifier.context ctxt HOL_ss) addsimps @{thms FUN_REL.simps})) |
68bd5c2a1b96
Fixed quotdata_lookup.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
253
diff
changeset
|
294 |
THEN_ALL_NEW (fn _ => no_tac) |
68bd5c2a1b96
Fixed quotdata_lookup.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
253
diff
changeset
|
295 |
), |
68bd5c2a1b96
Fixed quotdata_lookup.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
253
diff
changeset
|
296 |
WEAK_LAMBDA_RES_TAC ctxt |
68bd5c2a1b96
Fixed quotdata_lookup.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
253
diff
changeset
|
297 |
]); |
68bd5c2a1b96
Fixed quotdata_lookup.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
253
diff
changeset
|
298 |
fun r_mk_comb_tac_lam lthy = r_mk_comb_tac lthy rty quot rel_refl trans2 rsp_thms |
68bd5c2a1b96
Fixed quotdata_lookup.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
253
diff
changeset
|
299 |
*} |
68bd5c2a1b96
Fixed quotdata_lookup.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
253
diff
changeset
|
300 |
apply (tactic {* REPEAT_ALL_NEW (r_mk_comb_tac_lam @{context}) 1 *}) |
258
93ea455b29f1
Map does not fully work yet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
257
diff
changeset
|
301 |
*) |
257
68bd5c2a1b96
Fixed quotdata_lookup.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
253
diff
changeset
|
302 |
|
251 | 303 |
ML {* val t_t = repabs @{context} t_r consts rty qty quot rel_refl trans2 rsp_thms *} |
253
e169a99c6ada
Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
252
diff
changeset
|
304 |
ML {* val abs = findabs rty (prop_of (atomize_thm @{thm alpha.induct})) *} |
e169a99c6ada
Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
252
diff
changeset
|
305 |
ML {* val aps = findaps rty (prop_of (atomize_thm @{thm alpha.induct})) *} |
267
3764566c1151
Automatic FORALL_PRS. 'list.induct' lifts automatically. Faster ALLEX_RSP
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
265
diff
changeset
|
306 |
ML {* val (alls, exs) = findallex rty qty (prop_of (atomize_thm @{thm alpha.induct})) *} |
3764566c1151
Automatic FORALL_PRS. 'list.induct' lifts automatically. Faster ALLEX_RSP
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
265
diff
changeset
|
307 |
ML {* val allthms = map (make_allex_prs_thm @{context} quot @{thm FORALL_PRS} ) alls *} |
3764566c1151
Automatic FORALL_PRS. 'list.induct' lifts automatically. Faster ALLEX_RSP
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
265
diff
changeset
|
308 |
ML {* val exthms = map (make_allex_prs_thm @{context} quot @{thm EXISTS_PRS} ) exs *} |
3764566c1151
Automatic FORALL_PRS. 'list.induct' lifts automatically. Faster ALLEX_RSP
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
265
diff
changeset
|
309 |
ML {* val t_a = MetaSimplifier.rewrite_rule allthms t_t *} |
265
5f3b364d4765
Preparing infrastructure for general FORALL_PRS
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
259
diff
changeset
|
310 |
ML {* val simp_app_prs_thms = map (make_simp_prs_thm @{context} quot @{thm APP_PRS}) aps *} |
5f3b364d4765
Preparing infrastructure for general FORALL_PRS
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
259
diff
changeset
|
311 |
ML {* val simp_lam_prs_thms = map (make_simp_prs_thm @{context} quot @{thm LAMBDA_PRS}) abs *} |
267
3764566c1151
Automatic FORALL_PRS. 'list.induct' lifts automatically. Faster ALLEX_RSP
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
265
diff
changeset
|
312 |
ML {* val t_l = repeat_eqsubst_thm @{context} (simp_lam_prs_thms) t_a *} |
3764566c1151
Automatic FORALL_PRS. 'list.induct' lifts automatically. Faster ALLEX_RSP
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
265
diff
changeset
|
313 |
ML {* val t_l1 = repeat_eqsubst_thm @{context} simp_app_prs_thms t_l *} |
252
e30997c88050
Regularize for equalities and a better tactic. "alpha.cases" now lifts.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
251
diff
changeset
|
314 |
ML {* val defs_sym = add_lower_defs @{context} defs; *} |
259 | 315 |
ML {* val defs_sym_eq = map (fn x => eq_reflection OF [x]) defs_sym *} |
267
3764566c1151
Automatic FORALL_PRS. 'list.induct' lifts automatically. Faster ALLEX_RSP
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
265
diff
changeset
|
316 |
ML {* val t_d0 = MetaSimplifier.rewrite_rule defs_sym_eq t_l1 *} |
259 | 317 |
ML {* val t_d = repeat_eqsubst_thm @{context} defs_sym t_d0 *} |
252
e30997c88050
Regularize for equalities and a better tactic. "alpha.cases" now lifts.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
251
diff
changeset
|
318 |
ML {* val t_r = MetaSimplifier.rewrite_rule [reps_same] t_d *} |
253
e169a99c6ada
Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
252
diff
changeset
|
319 |
ML {* val t_r1 = repeat_eqsubst_thm @{context} @{thms fun_map.simps} t_r *} |
259 | 320 |
ML {* val t_r2 = MetaSimplifier.rewrite_rule @{thms QUOT_TYPE_I_lam.thm10} t_r1 *} |
321 |
ML {* val t_r3 = MetaSimplifier.rewrite_rule @{thms eq_reflection[OF id_apply]} t_r2 *} |
|
253
e169a99c6ada
Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
252
diff
changeset
|
322 |
ML {* val alpha_induct = ObjectLogic.rulify t_r3 *} |
247 | 323 |
|
271
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
324 |
(*local_setup {* |
253
e169a99c6ada
Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
252
diff
changeset
|
325 |
Quotient.note (@{binding "alpha_induct"}, alpha_induct) #> snd |
271
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
326 |
*}*) |
247 | 327 |
|
259 | 328 |
thm alpha_induct |
329 |
thm alpha.induct |
|
330 |
||
271
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
331 |
|
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
332 |
|
259 | 333 |
|
334 |
||
335 |
||
336 |
||
271
1b57f99737fe
Alpha.induct now lifts automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
270
diff
changeset
|
337 |
|
237 | 338 |
fun |
339 |
option_map::"('a \<Rightarrow> 'b) \<Rightarrow> ('a noption) \<Rightarrow> ('b noption)" |
|
340 |
where |
|
341 |
"option_map f (nSome x) = nSome (f x)" |
|
342 |
| "option_map f nNone = nNone" |
|
343 |
||
344 |
fun |
|
345 |
option_rel |
|
346 |
where |
|
347 |
"option_rel r (nSome x) (nSome y) = r x y" |
|
348 |
| "option_rel r _ _ = False" |
|
349 |
||
350 |
declare [[map noption = (option_map, option_rel)]] |
|
351 |
||
352 |
lemma OPT_QUOTIENT: |
|
353 |
assumes q: "QUOTIENT R Abs Rep" |
|
354 |
shows "QUOTIENT (option_rel R) (option_map Abs) (option_map Rep)" |
|
355 |
apply (unfold QUOTIENT_def) |
|
356 |
apply (auto) |
|
357 |
using q |
|
358 |
apply (unfold QUOTIENT_def) |
|
359 |
apply (case_tac "a :: 'b noption") |
|
360 |
apply (simp) |
|
361 |
apply (simp) |
|
362 |
apply (case_tac "a :: 'b noption") |
|
363 |
apply (simp only: option_map.simps) |
|
364 |
apply (subst option_rel.simps) |
|
365 |
(* Simp starts hanging so don't know how to continue *) |
|
366 |
sorry |
|
367 |