Skip to content

Commit fa10dff

Browse files
committed
Move some lemmas
1 parent 93a13df commit fa10dff

10 files changed

+294
-295
lines changed

language/pure_eval_oldScript.sml

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
open HolKernel Parse boolLib bossLib term_tactic;
33
open arithmeticTheory listTheory stringTheory alistTheory
44
optionTheory pairTheory ltreeTheory llistTheory bagTheory;
5-
open pure_expTheory pure_valueTheory pure_limitTheory;
5+
open pure_expTheory pure_valueTheory pure_limitTheory pure_miscTheory;
66

77
val _ = new_theory "pure_eval_old";
88

@@ -1266,22 +1266,6 @@ Proof
12661266
\\ fs[v_rel'_refl]
12671267
QED
12681268

1269-
Triviality LIST_REL_SYM:
1270-
(∀x y. R x y ⇔ R y x) ⇒
1271-
∀xs ys. LIST_REL R xs ys ⇔ LIST_REL R ys xs
1272-
Proof
1273-
strip_tac \\ Induct
1274-
\\ fs [] \\ rw [] \\ eq_tac \\ rw [] \\ fs [] \\ metis_tac []
1275-
QED
1276-
1277-
Triviality LIST_REL_TRANS:
1278-
(∀x y z. R x y ∧ R y z ⇒ R x z) ⇒
1279-
∀xs ys zs. LIST_REL R xs ys ∧ LIST_REL R ys zs ⇒ LIST_REL R xs zs
1280-
Proof
1281-
strip_tac \\ Induct
1282-
\\ fs [] \\ rw [] \\ fs [] \\ rw [] \\ fs [] \\ metis_tac []
1283-
QED
1284-
12851269
Triviality v_rel'_sym:
12861270
∀n x y. v_rel' n x y ⇔ v_rel' n y x
12871271
Proof

language/pure_valueScript.sml

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
open HolKernel Parse boolLib bossLib term_tactic;
33
open arithmeticTheory listTheory stringTheory alistTheory optionTheory
44
ltreeTheory llistTheory quotient_llistTheory
5-
pure_configTheory pure_expTheory;
5+
pure_configTheory pure_expTheory pure_miscTheory;
66

77
val _ = new_theory "pure_value";
88

@@ -104,16 +104,6 @@ Definition Error_def:
104104
Error = v_abs Error_rep
105105
End
106106

107-
(*
108-
* TODO: Move to llist?
109-
*)
110-
Theorem LSET_fromList:
111-
∀l. LSET (fromList l) = set l
112-
Proof
113-
Induct \\ rw [fromList_def]
114-
QED
115-
116-
117107
Theorem v_rep_ok_Atom[local]:
118108
∀b. v_rep_ok (Atom_rep b)
119109
Proof
@@ -353,17 +343,6 @@ Proof
353343
rw [boolTheory.DATATYPE_TAG_THM]
354344
QED
355345

356-
(* TODO: move to ltreeTheory *)
357-
Theorem ltree_lookup_APPEND:
358-
∀ path1 path2 t.
359-
ltree_lookup t (path1 ++ path2) =
360-
OPTION_BIND (ltree_lookup t path1) (λsubtree. ltree_lookup subtree path2)
361-
Proof
362-
Induct >> rw[optionTheory.OPTION_BIND_def] >>
363-
Cases_on `t` >> fs[ltree_lookup_def] >>
364-
Cases_on `LNTH h ts` >> fs[optionTheory.OPTION_BIND_def]
365-
QED
366-
367346
Theorem v_rep_ok_ltree_el:
368347
∀ vtree subtree.
369348
v_rep_ok vtree ∧
@@ -590,24 +569,6 @@ Definition make_v_rep_def:
590569
| (Error', _) => (Error', SOME 0))
591570
End
592571

593-
(* TODO move to ltreeTheory *)
594-
Theorem ltree_lookup_SOME_gen_ltree:
595-
∀ path f a ts.
596-
ltree_lookup (gen_ltree f) path = SOME (Branch a ts)
597-
⇒ f path = (a, LLENGTH ts)
598-
Proof
599-
Induct >> rw[]
600-
>- (
601-
Cases_on `f []` >> fs[] >>
602-
gvs[Once gen_ltree, ltree_lookup_def]
603-
) >>
604-
Cases_on `f []` >> fs[] >> rename1 `f [] = (e1, e2)` >>
605-
gvs[Once gen_ltree, ltree_lookup_def] >>
606-
fs[LNTH_LGENLIST] >>
607-
Cases_on `e2` >> gvs[] >>
608-
Cases_on `h < x` >> fs[]
609-
QED
610-
611572
Triviality v_rep_ok_make_v_rep:
612573
∀f. v_rep_ok (make_v_rep f)
613574
Proof

meta-theory/pure_alpha_equivScript.sml

Lines changed: 1 addition & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ open fixedPointTheory arithmeticTheory listTheory stringTheory alistTheory
77
BasicProvers pred_setTheory relationTheory rich_listTheory finite_mapTheory
88
dep_rewrite;
99
open pure_expTheory pure_valueTheory pure_evalTheory pure_eval_lemmasTheory
10-
pure_exp_lemmasTheory pure_limitTheory pure_exp_relTheory;
10+
pure_exp_lemmasTheory pure_limitTheory pure_exp_relTheory pure_miscTheory;
1111

1212
val _ = new_theory "pure_alpha_equiv";
1313

@@ -743,13 +743,6 @@ Inductive exp_alpha:
743743
(Letrec (funs1 ++ (y,perm_exp x y e)::funs2) e1))
744744
End
745745

746-
Triviality MAP_PAIR_MAP:
747-
MAP FST (MAP (f ## g) l) = MAP f (MAP FST l) ∧
748-
MAP SND (MAP (f ## g) l) = MAP g (MAP SND l)
749-
Proof
750-
rw[MAP_MAP_o,combinTheory.o_DEF,MAP_EQ_f]
751-
QED
752-
753746
Triviality MAP_PAIR_MAP':
754747
MAP (λ(x,y). h x) (MAP (f ## g) l) = MAP h (MAP f (MAP FST l)) ∧
755748
MAP (λ(x,y). h y) (MAP (f ## g) l) = MAP h (MAP g (MAP SND l))
@@ -777,29 +770,6 @@ Proof
777770
Induct_on ‘l’ >> rw[]
778771
QED
779772

780-
Theorem closed_subst_freevars:
781-
∀s x y.
782-
closed x ∧ closed(subst s x y) ⇒
783-
set(freevars y) ⊆ {s}
784-
Proof
785-
rw[] >> pop_assum mp_tac >> drule freevars_subst_single >>
786-
disch_then(qspecl_then [‘s’,‘y’] mp_tac) >> rw[] >>
787-
gvs[closed_def, DELETE_DEF, SUBSET_DIFF_EMPTY]
788-
QED
789-
790-
Theorem closed_freevars_subst:
791-
∀s x y.
792-
closed x ∧ set(freevars y) ⊆ {s} ⇒
793-
closed(subst s x y)
794-
Proof
795-
rw[] >>
796-
drule freevars_subst_single >> disch_then (qspecl_then [‘s’,‘y’] mp_tac) >>
797-
gvs[DELETE_DEF, closed_def] >> rw[] >>
798-
`freevars (subst s x y) = {}` suffices_by gvs[] >>
799-
pop_assum SUBST_ALL_TAC >>
800-
rw[SUBSET_DIFF_EMPTY]
801-
QED
802-
803773
Theorem perm1_simps:
804774
perm1 x y x = y ∧
805775
perm1 x x y = y ∧
@@ -882,20 +852,6 @@ Proof
882852
rw[]
883853
QED
884854

885-
Theorem EVERY2_refl_EQ:
886-
LIST_REL R ls ls ⇔ (∀x. MEM x ls ⇒ R x x)
887-
Proof
888-
simp[EQ_IMP_THM,EVERY2_refl] >>
889-
Induct_on ‘ls’ >> rw[] >>
890-
metis_tac[]
891-
QED
892-
893-
Theorem MAP_ID_ON:
894-
(∀x. MEM x l ⇒ f x = x) ⇒ MAP f l = l
895-
Proof
896-
Induct_on ‘l’ >> rw[]
897-
QED
898-
899855
Theorem MEM_PERM_IMP:
900856
MEM x l ⇒
901857
MEM y (MAP (perm1 x y) l)
@@ -1170,12 +1126,6 @@ Proof
11701126
metis_tac[PAIR,FST,SND])
11711127
QED
11721128

1173-
Theorem fresh_list:
1174-
∀s. FINITE s ⇒ ∃x. x ∉ s:('a list set)
1175-
Proof
1176-
metis_tac[GSYM INFINITE_LIST_UNIV,NOT_IN_FINITE]
1177-
QED
1178-
11791129
Theorem exp_alpha_sym:
11801130
∀e e'.
11811131
exp_alpha e e' ⇒ exp_alpha e' e
@@ -1508,20 +1458,6 @@ Proof
15081458
simp[FORALL_PROD,perm1_simps,perm_exp_id]
15091459
QED
15101460

1511-
Theorem FDIFF_MAP_KEYS_BIJ:
1512-
BIJ f 𝕌(:α) 𝕌(:β) ⇒
1513-
FDIFF (MAP_KEYS f fm) (IMAGE f s) = MAP_KEYS f (FDIFF fm s)
1514-
Proof
1515-
rpt strip_tac >>
1516-
simp[FDIFF_def] >>
1517-
‘COMPL(IMAGE f s) = IMAGE f (COMPL s)’
1518-
by(rw[COMPL_DEF,IMAGE_DEF,SET_EQ_SUBSET,SUBSET_DEF] >>
1519-
gvs[BIJ_DEF,INJ_DEF,SURJ_DEF] >> metis_tac[]) >>
1520-
pop_assum SUBST_ALL_TAC >>
1521-
gvs[BIJ_DEF] >>
1522-
simp[DRESTRICT_MAP_KEYS_IMAGE]
1523-
QED
1524-
15251461
Theorem exp_alpha_subst_closed:
15261462
∀x y s e.
15271463
x ≠ y ∧ y ∉ freevars e ∧
@@ -3572,13 +3508,6 @@ Proof
35723508
goal_assum drule >> fs[] >> goal_assum drule >> fs[]
35733509
QED
35743510

3575-
Triviality LIST_REL_mono:
3576-
(∀x y. R x y ∧ MEM x xs ∧ MEM y ys ⇒ R1 x y) ==>
3577-
LIST_REL R xs ys ⇒ LIST_REL R1 xs ys
3578-
Proof
3579-
qid_spec_tac ‘ys’ \\ Induct_on ‘xs’ \\ fs [] \\ rw []
3580-
QED
3581-
35823511
Theorem eval_wh_Closure_closed:
35833512
eval_wh e = wh_Closure v body ∧ closed e ⇒ freevars body SUBSET {v}
35843513
Proof

meta-theory/pure_congruenceScript.sml

Lines changed: 2 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ open fixedPointTheory arithmeticTheory listTheory stringTheory alistTheory
88
BasicProvers pred_setTheory relationTheory rich_listTheory finite_mapTheory
99
dep_rewrite;
1010
open pure_expTheory pure_valueTheory pure_evalTheory pure_eval_lemmasTheory
11-
pure_exp_lemmasTheory pure_limitTheory
12-
pure_exp_relTheory pure_alpha_equivTheory;
11+
pure_exp_lemmasTheory pure_limitTheory pure_exp_relTheory
12+
pure_alpha_equivTheory pure_miscTheory;
1313

1414
val _ = new_theory "pure_congruence";
1515

@@ -513,13 +513,6 @@ Proof
513513
\\ fs [Cus_def,open_bisimilarity_eq]
514514
QED
515515

516-
Triviality DIFF_SUBSET:
517-
a DIFF b ⊆ c ⇔ a ⊆ b ∪ c
518-
Proof
519-
rw[SUBSET_DEF, EXTENSION] >>
520-
eq_tac >> rw[] >> metis_tac[]
521-
QED
522-
523516
Theorem IMP_Howe_Sub: (* 5.5.3 *)
524517
Ref R ∧ Tra R ∧ Cus R ∧ term_rel R ⇒ Sub (Howe R)
525518
Proof
@@ -801,19 +794,6 @@ Proof
801794
\\ fs [closed_def]
802795
QED
803796

804-
Triviality SUBSET_SINGLETON:
805-
x ⊆ {y} ⇒ (x = {y} ∨ x = {})
806-
Proof
807-
rw[EXTENSION, SUBSET_DEF] >>
808-
metis_tac[]
809-
QED
810-
811-
Triviality DISJOINT_DRESTRICT_FEMPTY:
812-
∀m s. DISJOINT s (FDOM m) ⇒ DRESTRICT m s = FEMPTY
813-
Proof
814-
Induct >> rw[]
815-
QED
816-
817797
Theorem Sub_lift:
818798
∀R. Sub R ⇒
819799
∀f f' e1 e1' e2 e2' vars.
@@ -901,18 +881,6 @@ Proof
901881
>- (gvs[] >> metis_tac[UNION_COMM, UNION_ASSOC, INSERT_SING_UNION])
902882
QED
903883

904-
Triviality UNION_DIFF_DISTRIBUTE:
905-
∀A B C. A ∪ B DIFF C = (A DIFF C) ∪ (B DIFF C)
906-
Proof
907-
rw[EXTENSION] >> metis_tac[]
908-
QED
909-
910-
Triviality UNION_DIFF_EMPTY:
911-
∀A B C. A ∪ B DIFF C = {} ⇒ B DIFF C = {}
912-
Proof
913-
rw[EXTENSION] >> metis_tac[]
914-
QED
915-
916884
Triviality closed_Letrec_funs:
917885
∀ fs e f.
918886
closed (Letrec fs e) ∧
@@ -923,12 +891,6 @@ Proof
923891
gvs[MEM_MAP, PULL_EXISTS]
924892
QED
925893

926-
Triviality FST_THM:
927-
FST = λ(x,y). x
928-
Proof
929-
irule EQ_EXT >> Cases >> simp[]
930-
QED
931-
932894
Theorem open_similarity_larger:
933895
∀vars e1 e2 vars1.
934896
open_similarity vars e1 e2 ∧ vars SUBSET vars1 ⇒ open_similarity vars1 e1 e2
@@ -1065,38 +1027,6 @@ Proof
10651027
goal_assum drule >> simp[]
10661028
QED
10671029

1068-
Theorem ALOOKUP_SOME_EL:
1069-
∀l k v. ALOOKUP l k = SOME v ⇒ ∃n. n < LENGTH l ∧ EL n l = (k,v)
1070-
Proof
1071-
Induct >> rw[] >>
1072-
PairCases_on `h` >> gvs[] >>
1073-
FULL_CASE_TAC >> gvs[]
1074-
>- (qexists_tac `0` >> gvs[]) >>
1075-
first_x_assum drule >> strip_tac >>
1076-
qexists_tac `SUC n` >> gvs[]
1077-
QED
1078-
1079-
Theorem ALOOKUP_SOME_EL_2:
1080-
∀l1 l2 k (v:'a).
1081-
ALOOKUP l1 k = SOME v ∧
1082-
MAP FST l1 = MAP FST l2
1083-
⇒ ∃v'. ALOOKUP l2 k = SOME (v':'a) ∧
1084-
∃n. n < LENGTH l1 ∧ EL n l1 = (k,v) ∧ EL n l2 = (k,v')
1085-
Proof
1086-
Induct >> rw[] >>
1087-
PairCases_on `h` >> gvs[] >>
1088-
FULL_CASE_TAC >> gvs[]
1089-
>- (
1090-
qexists_tac `SND (EL 0 l2)` >>
1091-
Cases_on `l2` >> gvs[] >> PairCases_on `h` >> gvs[] >>
1092-
qexists_tac `0` >> gvs[]
1093-
) >>
1094-
first_x_assum drule >> Cases_on `l2` >> gvs[] >>
1095-
disch_then (qspec_then `t` assume_tac) >> gvs[] >>
1096-
PairCases_on `h` >> gvs[] >>
1097-
qexists_tac `SUC n` >> gvs[]
1098-
QED
1099-
11001030
Theorem Sub_subst_funs:
11011031
∀R f1 f2 e1 e2.
11021032
Sub R ∧

meta-theory/pure_eval_surjScript.sml

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ open HolKernel Parse boolLib bossLib term_tactic BasicProvers dep_rewrite;
66
open arithmeticTheory listTheory stringTheory alistTheory optionTheory
77
pairTheory ltreeTheory llistTheory bagTheory cardinalTheory
88
pred_setTheory rich_listTheory combinTheory finite_mapTheory
9-
open pure_evalTheory pure_expTheory pure_valueTheory pure_exp_lemmasTheory;
9+
open pure_evalTheory pure_expTheory pure_valueTheory pure_exp_lemmasTheory
10+
pure_miscTheory;
1011

1112
val _ = new_theory "pure_eval_surj";
1213

@@ -302,20 +303,6 @@ Proof
302303
first_x_assum (qspec_then `h::path'` assume_tac) >> gvs[]
303304
QED
304305

305-
Theorem IS_PREFIX_NOT_EQ:
306-
∀x y.
307-
IS_PREFIX x y ∧
308-
x ≠ y ⇒
309-
LENGTH y < LENGTH x
310-
Proof
311-
rpt strip_tac >>
312-
spose_not_then strip_assume_tac >>
313-
gvs[NOT_LESS] >>
314-
imp_res_tac IS_PREFIX_LENGTH >>
315-
‘LENGTH x = LENGTH y’ by DECIDE_TAC >>
316-
metis_tac[IS_PREFIX_LENGTH_ANTI]
317-
QED
318-
319306
Theorem v_uncountable:
320307
𝕌(:num -> bool) ≼ 𝕌(:v)
321308
Proof
@@ -577,14 +564,6 @@ Proof
577564
Cases_on `path` >> gvs[v_lookup]
578565
QED
579566

580-
Triviality REPLICATE_11:
581-
∀n m e. REPLICATE n e = REPLICATE m e ⇒ n = m
582-
Proof
583-
Induct >> rw[] >>
584-
Cases_on `m` >> gvs[] >>
585-
first_x_assum irule >> goal_assum drule
586-
QED
587-
588567
Theorem cons_names_v_exists_INFINITE:
589568
∃v. INFINITE (cons_names_v v)
590569
Proof

0 commit comments

Comments
 (0)