1911
|
1 |
theory SingleLet
|
2024
|
2 |
imports "../NewParser"
|
1596
|
3 |
begin
|
|
4 |
|
|
5 |
atom_decl name
|
|
6 |
|
2388
|
7 |
declare [[STEPS = 17]]
|
2294
|
8 |
|
2336
|
9 |
nominal_datatype trm =
|
1911
|
10 |
Var "name"
|
|
11 |
| App "trm" "trm"
|
2024
|
12 |
| Lam x::"name" t::"trm" bind_set x in t
|
|
13 |
| Let a::"assg" t::"trm" bind_set "bn a" in t
|
2311
|
14 |
| Foo x::"name" y::"name" t::"trm" t1::"trm" t2::"trm" bind_set x in y t t1 t2
|
2296
|
15 |
| Bar x::"name" y::"name" t::"trm" bind y x in t x y
|
2316
|
16 |
| Baz x::"name" t1::"trm" t2::"trm" bind x in t1, bind x in t2
|
1911
|
17 |
and assg =
|
2320
|
18 |
As "name" x::"name" t::"trm" bind x in t
|
1596
|
19 |
binder
|
1911
|
20 |
bn::"assg \<Rightarrow> atom set"
|
1596
|
21 |
where
|
2320
|
22 |
"bn (As x y t) = {atom x}"
|
1911
|
23 |
|
2389
|
24 |
thm alpha_sym_thms
|
|
25 |
thm alpha_trans_thms
|
2388
|
26 |
thm size_eqvt
|
2384
|
27 |
thm alpha_bn_imps
|
|
28 |
thm distinct
|
|
29 |
thm eq_iff
|
2387
|
30 |
thm eq_iff_simps
|
2384
|
31 |
thm fv_defs
|
|
32 |
thm perm_simps
|
|
33 |
thm perm_laws
|
2388
|
34 |
thm funs_rsp
|
2384
|
35 |
|
|
36 |
|
2359
|
37 |
typ trm
|
|
38 |
typ assg
|
2338
|
39 |
term Var
|
|
40 |
term App
|
|
41 |
term Baz
|
2339
|
42 |
term bn
|
|
43 |
term fv_trm
|
2384
|
44 |
term alpha_bn
|
2338
|
45 |
|
2384
|
46 |
|
2388
|
47 |
lemma exi_zero: "P 0 \<Longrightarrow> \<exists>(x::perm). P x" by auto
|
|
48 |
|
|
49 |
ML {*
|
|
50 |
val pre_ss = @{thms fun_rel_def}
|
|
51 |
val post_ss = @{thms alphas prod_alpha_def prod_rel.simps
|
|
52 |
prod_fv.simps fresh_star_zero permute_zero funs_rsp prod.cases alpha_bn_imps}
|
|
53 |
|
|
54 |
val tac =
|
|
55 |
asm_full_simp_tac (HOL_ss addsimps pre_ss)
|
|
56 |
THEN' REPEAT o (resolve_tac @{thms allI impI})
|
|
57 |
THEN' resolve_tac @{thms alpha_trm_raw_alpha_assg_raw_alpha_bn_raw.intros}
|
|
58 |
THEN_ALL_NEW (TRY o (rtac @{thm exi_zero}) THEN' asm_full_simp_tac (HOL_ss addsimps post_ss))
|
|
59 |
*}
|
2361
|
60 |
|
2359
|
61 |
lemma [quot_respect]:
|
2361
|
62 |
"(op= ===> alpha_trm_raw) Var_raw Var_raw"
|
2359
|
63 |
"(alpha_trm_raw ===> alpha_trm_raw ===> alpha_trm_raw) App_raw App_raw"
|
2361
|
64 |
"(op= ===> alpha_trm_raw ===> alpha_trm_raw) Lam_raw Lam_raw"
|
|
65 |
"(alpha_assg_raw ===> alpha_trm_raw ===> alpha_trm_raw) Let_raw Let_raw"
|
2388
|
66 |
"(op= ===> op= ===> alpha_trm_raw ===> alpha_trm_raw ===> alpha_trm_raw ===> alpha_trm_raw)
|
2361
|
67 |
Foo_raw Foo_raw"
|
|
68 |
"(op= ===> op= ===> alpha_trm_raw ===> alpha_trm_raw) Bar_raw Bar_raw"
|
|
69 |
"(op= ===> alpha_trm_raw ===> alpha_trm_raw ===> alpha_trm_raw) Baz_raw Baz_raw"
|
|
70 |
"(op = ===> op = ===> alpha_trm_raw ===> alpha_assg_raw) As_raw As_raw"
|
2388
|
71 |
apply(tactic {* ALLGOALS tac *})
|
2359
|
72 |
done
|
|
73 |
|
2361
|
74 |
lemma [quot_respect]:
|
|
75 |
"(alpha_trm_raw ===> op =) fv_trm_raw fv_trm_raw"
|
|
76 |
"(alpha_assg_raw ===> op =) fv_bn_raw fv_bn_raw"
|
|
77 |
"(alpha_assg_raw ===> op =) bn_raw bn_raw"
|
|
78 |
"(alpha_assg_raw ===> op =) fv_assg_raw fv_assg_raw"
|
|
79 |
"(op = ===> alpha_trm_raw ===> alpha_trm_raw) permute permute"
|
2388
|
80 |
apply(simp_all add: alpha_bn_imps funs_rsp)
|
2361
|
81 |
sorry
|
|
82 |
|
|
83 |
ML {*
|
|
84 |
val thms_d = map (lift_thm [@{typ trm}, @{typ assg}] @{context}) @{thms distinct}
|
|
85 |
*}
|
|
86 |
|
|
87 |
ML {*
|
|
88 |
val thms_i = map (lift_thm [@{typ trm}, @{typ assg}] @{context}) @{thms trm_raw_assg_raw.inducts}
|
|
89 |
*}
|
|
90 |
|
|
91 |
ML {*
|
|
92 |
val thms_f = map (lift_thm [@{typ trm}, @{typ assg}] @{context}) @{thms fv_defs}
|
|
93 |
*}
|
|
94 |
|
|
95 |
thm perm_defs[no_vars]
|
|
96 |
|
|
97 |
instance trm :: pt sorry
|
|
98 |
instance assg :: pt sorry
|
|
99 |
|
2365
|
100 |
lemma b1:
|
2361
|
101 |
"p \<bullet> Var name = Var (p \<bullet> name)"
|
|
102 |
"p \<bullet> App trm1 trm2 = App (p \<bullet> trm1) (p \<bullet> trm2)"
|
|
103 |
"p \<bullet> Lam name trm = Lam (p \<bullet> name) (p \<bullet> trm)"
|
|
104 |
"p \<bullet> Let assg trm = Let (p \<bullet> assg) (p \<bullet> trm)"
|
|
105 |
"p \<bullet> Foo name1 name2 trm1 trm2 trm3 =
|
|
106 |
Foo (p \<bullet> name1) (p \<bullet> name2) (p \<bullet> trm1) (p \<bullet> trm2) (p \<bullet> trm3)"
|
|
107 |
"p \<bullet> Bar name1 name2 trm = Bar (p \<bullet> name1) (p \<bullet> name2) (p \<bullet> trm)"
|
|
108 |
"p \<bullet> Baz name trm1 trm2 = Baz (p \<bullet> name) (p \<bullet> trm1) (p \<bullet> trm2)"
|
|
109 |
"p \<bullet> As name1 name2 trm = As (p \<bullet> name1) (p \<bullet> name2) (p \<bullet> trm)"
|
|
110 |
sorry
|
|
111 |
|
|
112 |
|
|
113 |
(*
|
|
114 |
ML {*
|
|
115 |
val thms_p = map (lift_thm [@{typ trm}, @{typ assg}] @{context}) @{thms perm_defs}
|
|
116 |
*}
|
|
117 |
*)
|
|
118 |
|
2365
|
119 |
thm eq_iff[no_vars]
|
|
120 |
|
|
121 |
ML {*
|
|
122 |
val q1 = lift_thm [@{typ trm}, @{typ assg}] @{context} @{thm "eq_iff"(1)}
|
|
123 |
*}
|
|
124 |
|
2361
|
125 |
local_setup {* Local_Theory.note ((@{binding d1}, []), thms_d) #> snd *}
|
|
126 |
local_setup {* Local_Theory.note ((@{binding i1}, []), thms_i) #> snd *}
|
|
127 |
local_setup {* Local_Theory.note ((@{binding f1}, []), thms_f) #> snd *}
|
2365
|
128 |
local_setup {* Local_Theory.note ((@{binding q1}, []), [q1]) #> snd *}
|
|
129 |
|
2361
|
130 |
|
|
131 |
thm perm_defs
|
|
132 |
thm perm_simps
|
|
133 |
|
|
134 |
lemma supp_fv:
|
|
135 |
"supp t = fv_trm t"
|
|
136 |
"supp b = fv_bn b"
|
|
137 |
apply(induct t and b rule: i1)
|
|
138 |
apply(simp_all add: f1)
|
|
139 |
apply(simp_all add: supp_def)
|
2365
|
140 |
apply(simp_all add: b1)
|
|
141 |
sorry
|
|
142 |
|
|
143 |
consts perm_bn_trm :: "perm \<Rightarrow> trm \<Rightarrow> trm"
|
|
144 |
consts perm_bn_assg :: "perm \<Rightarrow> assg \<Rightarrow> assg"
|
|
145 |
|
|
146 |
lemma y:
|
|
147 |
"perm_bn_trm p (Var x) = (Var x)"
|
|
148 |
"perm_bn_trm p (App t1 t2) = (App t1 t2)"
|
|
149 |
"perm_bn_trm p ("
|
|
150 |
|
|
151 |
|
2361
|
152 |
|
|
153 |
ML {*
|
|
154 |
map (lift_thm [@{typ trm}, @{typ assg}] @{context}) @{thms eq_iff}
|
|
155 |
*}
|
|
156 |
|
|
157 |
|
|
158 |
|
2359
|
159 |
|
|
160 |
|
|
161 |
lemma "Var x \<noteq> App y1 y2"
|
|
162 |
apply(descending)
|
|
163 |
apply(simp add: trm_raw.distinct)
|
|
164 |
|
|
165 |
|
|
166 |
|
|
167 |
ML {*
|
|
168 |
map (lift_thm [@{typ trm}, @{typ assg}] @{context}) @{thms trm_raw.distinct(1)}
|
|
169 |
*}
|
|
170 |
|
|
171 |
|
|
172 |
|
2338
|
173 |
|
2336
|
174 |
typ trm
|
|
175 |
typ assg
|
|
176 |
|
1911
|
177 |
thm trm_assg.fv
|
|
178 |
thm trm_assg.supp
|
2024
|
179 |
thm trm_assg.eq_iff
|
1911
|
180 |
thm trm_assg.bn
|
|
181 |
thm trm_assg.perm
|
|
182 |
thm trm_assg.induct
|
|
183 |
thm trm_assg.inducts
|
|
184 |
thm trm_assg.distinct
|
|
185 |
ML {* Sign.of_sort @{theory} (@{typ trm}, @{sort fs}) *}
|
2024
|
186 |
|
2288
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
187 |
(* TEMPORARY
|
2024
|
188 |
thm trm_assg.fv[simplified trm_assg.supp(1-2)]
|
2288
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
189 |
*)
|
2064
2725853f43b9
solved the problem with equivariance by first eta-normalising the goal
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
190 |
|
1596
|
191 |
end
|
|
192 |
|
|
193 |
|
|
194 |
|