@@ -52,20 +52,14 @@ Proof
52
52
\\ rw [] \\ res_tac \\ fs []
53
53
QED
54
54
55
- Triviality LIST_REL_opp: (* TODO: move *)
56
- ∀xs ys. LIST_REL R xs ys ⇒ LIST_REL (λx y. R y x) ys xs
57
- Proof
58
- Induct \\ fs [PULL_EXISTS]
59
- QED
60
-
61
55
Theorem letrec_binds_opp:
62
56
letrec_binds binds2 binds1 = (λx y. letrec_binds binds1 binds2 y x)
63
57
Proof
64
58
qsuff_tac ‘∀b2 b1 x y. letrec_binds b2 b1 x y ⇒ letrec_binds b1 b2 y x’
65
59
>- (rw [FUN_EQ_THM] \\ eq_tac \\ fs [])
66
60
\\ ho_match_mp_tac letrec_binds_ind \\ rw []
67
61
\\ simp [Once letrec_binds_cases]
68
- \\ imp_res_tac LIST_REL_opp \\ fs [SF ETA_ss]
62
+ \\ once_rewrite_tac [LIST_REL_SWAP] \\ fs [SF ETA_ss]
69
63
QED
70
64
71
65
Theorem letrec_binds_freevars:
@@ -145,12 +139,6 @@ Proof
145
139
\\ metis_tac []
146
140
QED
147
141
148
- Triviality MAP_ID: (* TODO: move *)
149
- ∀xs f. (MAP f xs = xs) ⇔ ∀x. MEM x xs ⇒ f x = x
150
- Proof
151
- Induct \\ fs [] \\ metis_tac []
152
- QED
153
-
154
142
Theorem subst_letrec_binds:
155
143
∀b1 b2 x y m1 m2.
156
144
letrec_binds b1 b2 x y ∧
@@ -165,7 +153,7 @@ Proof
165
153
(fs [subst_def]
166
154
\\ simp [Once letrec_binds_cases]
167
155
\\ disj1_tac
168
- \\ fs [MAP_ID ,FORALL_PROD]
156
+ \\ fs [MAP_ID_EQ ,FORALL_PROD]
169
157
\\ reverse (rw [])
170
158
>-
171
159
(last_x_assum irule \\ fs [FDOM_FDIFF,EXTENSION,SUBSET_DEF]
@@ -235,21 +223,6 @@ Proof
235
223
fs [FDOM_FUPDATE_LIST,MAP_MAP_o,combinTheory.o_DEF,UNCURRY,SF ETA_ss]
236
224
QED
237
225
238
- Triviality FORALL_FRANGE: (* TODO: move *)
239
- (∀v. v ∈ FRANGE m ⇒ P v) ⇔ ∀k v. FLOOKUP m k = SOME v ⇒ P v
240
- Proof
241
- fs [FRANGE_DEF,FLOOKUP_DEF,PULL_EXISTS]
242
- QED
243
-
244
- Triviality MEM_IMP_EQ: (* TODO: move *)
245
- ∀b1 k p1 p2.
246
- MEM (k,p1) b1 ∧ MEM (k,p2) b1 ∧ ALL_DISTINCT (MAP FST b1) ⇒ p1 = p2
247
- Proof
248
- Induct \\ fs [FORALL_PROD] \\ rw []
249
- \\ fs [MEM_MAP,EXISTS_PROD]
250
- \\ res_tac \\ fs []
251
- QED
252
-
253
226
Triviality EVERY_FLOOKUP_closed_lemma:
254
227
EVERY (λe. freevars e ⊆ set (MAP FST ys)) (MAP SND ys) ⇒
255
228
(∀n v.
@@ -262,12 +235,6 @@ Proof
262
235
\\ res_tac \\ fs []
263
236
QED
264
237
265
- Triviality FORALL_FRANGE: (* TODO: move *)
266
- (∀x. x IN FRANGE v ⇒ p x) ⇔ ∀k x. FLOOKUP v k = SOME x ⇒ p x
267
- Proof
268
- fs [FRANGE_DEF,FLOOKUP_DEF,PULL_EXISTS]
269
- QED
270
-
271
238
Theorem ALOOKUP_REVERSE_LIST_REL:
272
239
∀bs ys.
273
240
LIST_REL p (MAP SND bs) (MAP SND ys) ∧
@@ -285,42 +252,21 @@ Proof
285
252
\\ metis_tac []
286
253
QED
287
254
288
- Theorem MEM_LIST_REL: (* TODO: move *)
255
+ Theorem MEM_LIST_REL[ local ]:
289
256
∀xs ys P y. LIST_REL P xs ys ∧ MEM y ys ⇒ ∃x. MEM x xs ∧ P x y
290
257
Proof
291
- Induct \\ fs [PULL_EXISTS]
292
- \\ rw [] \\ fs [] \\ res_tac \\ fs []
293
- \\ metis_tac []
258
+ metis_tac [LIST_REL_MEM_ALT]
294
259
QED
295
260
296
- Theorem MEM_LIST_REL1: (* TODO: move *)
261
+ Theorem MEM_LIST_REL1:
297
262
∀xs ys P x. LIST_REL P xs ys ∧ MEM x xs ⇒ ∃y. MEM y ys ∧ P x y
298
263
Proof
299
- Induct \\ fs [PULL_EXISTS]
300
- \\ rw [] \\ fs [] \\ res_tac \\ fs []
301
- \\ metis_tac []
302
- QED
303
-
304
- Theorem LIST_REL_COMP: (* TODO: move *)
305
- ∀xs ys zs.
306
- LIST_REL f xs ys ∧ LIST_REL g ys zs ⇒
307
- LIST_REL (λx z. ∃y. f x y ∧ g y z) xs zs
308
- Proof
309
- Induct \\ fs [PULL_EXISTS]
310
- \\ metis_tac []
264
+ metis_tac [LIST_REL_MEM]
311
265
QED
312
266
313
267
Triviality eval_wh_Constructor_NIL_bisim =
314
268
eval_wh_Constructor_bisim |> Q.GEN ‘xs’ |> Q.SPEC ‘[]’ |> SIMP_RULE (srw_ss()) [];
315
269
316
- Triviality LIST_REL_IMP_MAP_EQ: (* TODO: move *)
317
- ∀xs ys P f g.
318
- (∀x y. MEM x xs ∧ MEM y ys ∧ P x y ⇒ f x = g y) ⇒
319
- LIST_REL P xs ys ⇒ MAP g ys = MAP f xs
320
- Proof
321
- Induct \\ fs [PULL_EXISTS,SF DNF_ss] \\ metis_tac []
322
- QED
323
-
324
270
Theorem eval_forward_letrec_binds:
325
271
ALL_DISTINCT (MAP FST binds2) ∧
326
272
MAP FST binds1 = MAP FST binds2 ∧
@@ -811,27 +757,13 @@ Proof
811
757
\\ irule_at Any eval_forward_letrec_binds
812
758
\\ fs []
813
759
\\ pop_assum kall_tac
814
- \\ drule LIST_REL_opp \\ fs []
760
+ \\ pop_assum mp_tac \\ simp [Once LIST_REL_SWAP] \\ fs []
815
761
\\ fs [UNCURRY,LAMBDA_PROD]
816
762
\\ match_mp_tac LIST_REL_mono
817
763
\\ fs [FORALL_PROD]
818
764
\\ metis_tac [app_bisimilarity_sym]
819
765
QED
820
766
821
- Triviality FST_LAM: (* TODO: move *)
822
- FST = λ(p1,p2). p1
823
- Proof
824
- fs [FUN_EQ_THM,FORALL_PROD]
825
- QED
826
-
827
- Triviality LIST_REL_MAP_CONG: (* TODO: move *)
828
- ∀xs ys R Q f.
829
- (∀x y. R x y ∧ MEM x xs ∧ MEM y ys ⇒ Q (f x) (f y)) ∧ LIST_REL R xs ys ⇒
830
- LIST_REL Q (MAP f xs) (MAP f ys)
831
- Proof
832
- Induct \\ fs [PULL_EXISTS] \\ metis_tac []
833
- QED
834
-
835
767
Triviality LIST_REL_IMP_same_keys:
836
768
∀binds1 binds2.
837
769
LIST_REL (λ(v1,e1) (v2,e2). v1 = v2) binds1 binds2 ⇒
@@ -860,7 +792,7 @@ Proof
860
792
(rw [] \\ irule pure_exp_lemmasTheory.IMP_closed_bind \\ fs [])
861
793
\\ rw [bind_def] \\ fs [subst_def,bind_def] \\ fs [SF SFY_ss]
862
794
\\ irule exp_eq_Letrec_change_lemma
863
- \\ gs [MAP_MAP_o,combinTheory.o_DEF,LAMBDA_PROD,GSYM FST_LAM ]
795
+ \\ gs [MAP_MAP_o,combinTheory.o_DEF,LAMBDA_PROD,FST_INTRO ]
864
796
\\ conj_tac
865
797
>-
866
798
(irule LIST_REL_MAP_CONG \\ fs []
0 commit comments