1911
|
1 |
theory SingleLet
|
2024
|
2 |
imports "../NewParser"
|
1596
|
3 |
begin
|
|
4 |
|
|
5 |
atom_decl name
|
|
6 |
|
2338
|
7 |
declare [[STEPS = 16]]
|
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 |
|
2384
|
24 |
thm alpha_bn_imps
|
|
25 |
thm distinct
|
|
26 |
thm eq_iff
|
|
27 |
thm fv_defs
|
|
28 |
thm perm_simps
|
|
29 |
thm perm_laws
|
|
30 |
|
|
31 |
|
2359
|
32 |
typ trm
|
|
33 |
typ assg
|
2338
|
34 |
term Var
|
|
35 |
term App
|
|
36 |
term Baz
|
2339
|
37 |
term bn
|
|
38 |
term fv_trm
|
2384
|
39 |
term alpha_bn
|
2338
|
40 |
|
2384
|
41 |
|
2361
|
42 |
|
|
43 |
lemma a2:
|
|
44 |
shows "alpha_trm_raw x1 y1 \<Longrightarrow> fv_trm_raw x1 = fv_trm_raw y1"
|
|
45 |
and "alpha_assg_raw x2 y2 \<Longrightarrow> fv_assg_raw x2 = fv_assg_raw y2 \<and> bn_raw x2 = bn_raw y2"
|
|
46 |
and "alpha_bn_raw x3 y3 \<Longrightarrow> fv_bn_raw x3 = fv_bn_raw y3"
|
|
47 |
apply(induct rule: alpha_trm_raw_alpha_assg_raw_alpha_bn_raw.inducts)
|
2385
|
48 |
apply(simp_all only: fv_trm_raw.simps fv_assg_raw.simps fv_bn_raw.simps bn_raw.simps alphas prod_fv.simps prod_alpha_def ex_simps Un_assoc set.simps append.simps Un_insert_left Un_empty_right Un_empty_left simp_thms)
|
2361
|
49 |
done
|
|
50 |
|
2359
|
51 |
lemma [quot_respect]:
|
2361
|
52 |
"(op= ===> alpha_trm_raw) Var_raw Var_raw"
|
2359
|
53 |
"(alpha_trm_raw ===> alpha_trm_raw ===> alpha_trm_raw) App_raw App_raw"
|
2361
|
54 |
"(op= ===> alpha_trm_raw ===> alpha_trm_raw) Lam_raw Lam_raw"
|
|
55 |
"(alpha_assg_raw ===> alpha_trm_raw ===> alpha_trm_raw) Let_raw Let_raw"
|
|
56 |
"(op= ===> op= ===> alpha_trm_raw ===> alpha_trm_raw ===> alpha_trm_raw ===> alpha_trm_raw)
|
|
57 |
Foo_raw Foo_raw"
|
|
58 |
"(op= ===> op= ===> alpha_trm_raw ===> alpha_trm_raw) Bar_raw Bar_raw"
|
|
59 |
"(op= ===> alpha_trm_raw ===> alpha_trm_raw ===> alpha_trm_raw) Baz_raw Baz_raw"
|
|
60 |
"(op = ===> op = ===> alpha_trm_raw ===> alpha_assg_raw) As_raw As_raw"
|
2359
|
61 |
apply(auto)
|
|
62 |
apply(rule alpha_trm_raw_alpha_assg_raw_alpha_bn_raw.intros)
|
|
63 |
apply(rule refl)
|
|
64 |
apply(rule alpha_trm_raw_alpha_assg_raw_alpha_bn_raw.intros)
|
|
65 |
apply(assumption)
|
|
66 |
apply(assumption)
|
2361
|
67 |
apply(rule alpha_trm_raw_alpha_assg_raw_alpha_bn_raw.intros)
|
|
68 |
apply(rule_tac x="0" in exI)
|
|
69 |
apply(simp add: alphas fresh_star_def fresh_zero_perm a2)
|
|
70 |
apply(rule alpha_trm_raw_alpha_assg_raw_alpha_bn_raw.intros)
|
|
71 |
apply(rule_tac x="0" in exI)
|
|
72 |
apply(simp add: alphas fresh_star_def fresh_zero_perm a2)
|
|
73 |
apply(simp add: a1)
|
|
74 |
apply(rule alpha_trm_raw_alpha_assg_raw_alpha_bn_raw.intros)
|
|
75 |
apply(rule_tac x="0" in exI)
|
|
76 |
apply(simp add: alphas fresh_star_def fresh_zero_perm a2 prod_alpha_def)
|
|
77 |
apply(rule alpha_trm_raw_alpha_assg_raw_alpha_bn_raw.intros)
|
|
78 |
apply(rule_tac x="0" in exI)
|
|
79 |
apply(simp add: alphas fresh_star_def fresh_zero_perm a2 prod_alpha_def)
|
|
80 |
apply(rule alpha_trm_raw_alpha_assg_raw_alpha_bn_raw.intros)
|
|
81 |
apply(rule_tac x="0" in exI)
|
|
82 |
apply(simp add: alphas fresh_star_def fresh_zero_perm a2 prod_alpha_def)
|
|
83 |
apply(rule_tac x="0" in exI)
|
|
84 |
apply(simp add: alphas fresh_star_def fresh_zero_perm a2 prod_alpha_def)
|
|
85 |
apply(rule alpha_trm_raw_alpha_assg_raw_alpha_bn_raw.intros)
|
|
86 |
apply(rule_tac x="0" in exI)
|
|
87 |
apply(simp add: alphas fresh_star_def fresh_zero_perm a2 prod_alpha_def)
|
|
88 |
apply(rule refl)
|
2359
|
89 |
done
|
|
90 |
|
2361
|
91 |
lemma [quot_respect]:
|
|
92 |
"(alpha_trm_raw ===> op =) fv_trm_raw fv_trm_raw"
|
|
93 |
"(alpha_assg_raw ===> op =) fv_bn_raw fv_bn_raw"
|
|
94 |
"(alpha_assg_raw ===> op =) bn_raw bn_raw"
|
|
95 |
"(alpha_assg_raw ===> op =) fv_assg_raw fv_assg_raw"
|
|
96 |
"(op = ===> alpha_trm_raw ===> alpha_trm_raw) permute permute"
|
|
97 |
apply(simp_all add: a2 a1)
|
|
98 |
sorry
|
|
99 |
|
|
100 |
ML {*
|
|
101 |
val thms_d = map (lift_thm [@{typ trm}, @{typ assg}] @{context}) @{thms distinct}
|
|
102 |
*}
|
|
103 |
|
|
104 |
ML {*
|
|
105 |
val thms_i = map (lift_thm [@{typ trm}, @{typ assg}] @{context}) @{thms trm_raw_assg_raw.inducts}
|
|
106 |
*}
|
|
107 |
|
|
108 |
ML {*
|
|
109 |
val thms_f = map (lift_thm [@{typ trm}, @{typ assg}] @{context}) @{thms fv_defs}
|
|
110 |
*}
|
|
111 |
|
|
112 |
thm perm_defs[no_vars]
|
|
113 |
|
|
114 |
instance trm :: pt sorry
|
|
115 |
instance assg :: pt sorry
|
|
116 |
|
2365
|
117 |
lemma b1:
|
2361
|
118 |
"p \<bullet> Var name = Var (p \<bullet> name)"
|
|
119 |
"p \<bullet> App trm1 trm2 = App (p \<bullet> trm1) (p \<bullet> trm2)"
|
|
120 |
"p \<bullet> Lam name trm = Lam (p \<bullet> name) (p \<bullet> trm)"
|
|
121 |
"p \<bullet> Let assg trm = Let (p \<bullet> assg) (p \<bullet> trm)"
|
|
122 |
"p \<bullet> Foo name1 name2 trm1 trm2 trm3 =
|
|
123 |
Foo (p \<bullet> name1) (p \<bullet> name2) (p \<bullet> trm1) (p \<bullet> trm2) (p \<bullet> trm3)"
|
|
124 |
"p \<bullet> Bar name1 name2 trm = Bar (p \<bullet> name1) (p \<bullet> name2) (p \<bullet> trm)"
|
|
125 |
"p \<bullet> Baz name trm1 trm2 = Baz (p \<bullet> name) (p \<bullet> trm1) (p \<bullet> trm2)"
|
|
126 |
"p \<bullet> As name1 name2 trm = As (p \<bullet> name1) (p \<bullet> name2) (p \<bullet> trm)"
|
|
127 |
sorry
|
|
128 |
|
|
129 |
|
|
130 |
(*
|
|
131 |
ML {*
|
|
132 |
val thms_p = map (lift_thm [@{typ trm}, @{typ assg}] @{context}) @{thms perm_defs}
|
|
133 |
*}
|
|
134 |
*)
|
|
135 |
|
2365
|
136 |
thm eq_iff[no_vars]
|
|
137 |
|
|
138 |
ML {*
|
|
139 |
val q1 = lift_thm [@{typ trm}, @{typ assg}] @{context} @{thm "eq_iff"(1)}
|
|
140 |
*}
|
|
141 |
|
2361
|
142 |
local_setup {* Local_Theory.note ((@{binding d1}, []), thms_d) #> snd *}
|
|
143 |
local_setup {* Local_Theory.note ((@{binding i1}, []), thms_i) #> snd *}
|
|
144 |
local_setup {* Local_Theory.note ((@{binding f1}, []), thms_f) #> snd *}
|
2365
|
145 |
local_setup {* Local_Theory.note ((@{binding q1}, []), [q1]) #> snd *}
|
|
146 |
|
2361
|
147 |
|
|
148 |
thm perm_defs
|
|
149 |
thm perm_simps
|
|
150 |
|
|
151 |
lemma supp_fv:
|
|
152 |
"supp t = fv_trm t"
|
|
153 |
"supp b = fv_bn b"
|
|
154 |
apply(induct t and b rule: i1)
|
|
155 |
apply(simp_all add: f1)
|
|
156 |
apply(simp_all add: supp_def)
|
2365
|
157 |
apply(simp_all add: b1)
|
|
158 |
sorry
|
|
159 |
|
|
160 |
consts perm_bn_trm :: "perm \<Rightarrow> trm \<Rightarrow> trm"
|
|
161 |
consts perm_bn_assg :: "perm \<Rightarrow> assg \<Rightarrow> assg"
|
|
162 |
|
|
163 |
lemma y:
|
|
164 |
"perm_bn_trm p (Var x) = (Var x)"
|
|
165 |
"perm_bn_trm p (App t1 t2) = (App t1 t2)"
|
|
166 |
"perm_bn_trm p ("
|
|
167 |
|
|
168 |
|
2361
|
169 |
|
|
170 |
ML {*
|
|
171 |
map (lift_thm [@{typ trm}, @{typ assg}] @{context}) @{thms eq_iff}
|
|
172 |
*}
|
|
173 |
|
|
174 |
|
|
175 |
|
2359
|
176 |
|
|
177 |
|
|
178 |
lemma "Var x \<noteq> App y1 y2"
|
|
179 |
apply(descending)
|
|
180 |
apply(simp add: trm_raw.distinct)
|
|
181 |
|
|
182 |
|
|
183 |
|
|
184 |
ML {*
|
|
185 |
map (lift_thm [@{typ trm}, @{typ assg}] @{context}) @{thms trm_raw.distinct(1)}
|
|
186 |
*}
|
|
187 |
|
|
188 |
|
|
189 |
|
2338
|
190 |
|
2336
|
191 |
typ trm
|
|
192 |
typ assg
|
|
193 |
|
1911
|
194 |
thm trm_assg.fv
|
|
195 |
thm trm_assg.supp
|
2024
|
196 |
thm trm_assg.eq_iff
|
1911
|
197 |
thm trm_assg.bn
|
|
198 |
thm trm_assg.perm
|
|
199 |
thm trm_assg.induct
|
|
200 |
thm trm_assg.inducts
|
|
201 |
thm trm_assg.distinct
|
|
202 |
ML {* Sign.of_sort @{theory} (@{typ trm}, @{sort fs}) *}
|
2024
|
203 |
|
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
|
204 |
(* TEMPORARY
|
2024
|
205 |
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
|
206 |
*)
|
2064
2725853f43b9
solved the problem with equivariance by first eta-normalising the goal
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
207 |
|
1596
|
208 |
end
|
|
209 |
|
|
210 |
|
|
211 |
|