Skip to content

Commit b25fe47

Browse files
committed
Added LAMl_ISUB, etc.
1 parent 9c51c88 commit b25fe47

File tree

4 files changed

+62
-32
lines changed

4 files changed

+62
-32
lines changed

examples/lambda/barendregt/boehmScript.sml

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2796,11 +2796,12 @@ QED
27962796

27972797
(* Definition 10.3.5 (ii) *)
27982798
Definition head_original_def :
2799-
head_original M0 = let n = LAMl_size M0;
2800-
vs = NEWS n (FV M0);
2801-
M1 = principle_hnf (M0 @* MAP VAR vs);
2802-
in
2803-
EVERY (\e. hnf_headvar M1 # e) (hnf_children M1)
2799+
head_original M0 =
2800+
let n = LAMl_size M0;
2801+
vs = NEWS n (FV M0);
2802+
M1 = principle_hnf (M0 @* MAP VAR vs)
2803+
in
2804+
EVERY (\e. hnf_headvar M1 # e) (hnf_children M1)
28042805
End
28052806

28062807
(* Definition 10.3.5 (iii)
@@ -2871,9 +2872,9 @@ QED
28712872
Definition subterm_width_def :
28722873
subterm_width M [] = 0 /\
28732874
subterm_width M (h::p) =
2874-
MAX_SET (IMAGE (hnf_children_size o principle_hnf)
2875-
{subterm' (FV M) M q 0 | q |
2876-
q <<= FRONT (h::p) /\ solvable (subterm' (FV M) M q 0)})
2875+
MAX_SET (IMAGE (hnf_children_size o principle_hnf)
2876+
{subterm' (FV M) M q 0 | q |
2877+
q <<= FRONT (h::p) /\ solvable (subterm' (FV M) M q 0)})
28772878
End
28782879

28792880
(* |- subterm_width M [] = 0 *)
@@ -3029,12 +3030,10 @@ Proof
30293030
>> Q.EXISTS_TAC ‘q’ >> rw []
30303031
QED
30313032

3032-
(* cf. unsolvable_subst *)
30333033
Theorem solvable_subst_permutator :
3034-
!X M M0 r v P d. FINITE X /\ FV M SUBSET X UNION RANK r /\ v IN X UNION RANK r /\
3035-
M0 = principle_hnf M /\
3036-
P = permutator d /\ hnf_children_size M0 <= d /\
3037-
solvable M ==> solvable ([P/v] M)
3034+
!X M r P v d. FINITE X /\ FV M SUBSET X UNION RANK r /\ v IN X UNION RANK r /\
3035+
P = permutator d /\ hnf_children_size (principle_hnf M) <= d /\
3036+
solvable M ==> solvable ([P/v] M)
30383037
Proof
30393038
RW_TAC std_ss []
30403039
>> qabbrev_tac ‘P = permutator d’
@@ -3078,24 +3077,26 @@ Proof
30783077
QED
30793078

30803079
Theorem solvable_subst_permutator_cong :
3081-
!X M M0 r v P d. FINITE X /\ FV M SUBSET X UNION RANK r /\ v IN X UNION RANK r /\
3082-
M0 = principle_hnf M /\
3083-
P = permutator d /\ hnf_children_size M0 <= d ==>
3084-
(solvable ([P/v] M) <=> solvable M)
3080+
!X M r P v d.
3081+
FINITE X /\ FV M SUBSET X UNION RANK r /\ v IN X UNION RANK r /\
3082+
P = permutator d /\ hnf_children_size (principle_hnf M) <= d
3083+
==> (solvable ([P/v] M) <=> solvable M)
30853084
Proof
30863085
rpt STRIP_TAC
30873086
>> EQ_TAC >- PROVE_TAC [unsolvable_subst]
30883087
>> DISCH_TAC
30893088
>> MATCH_MP_TAC solvable_subst_permutator
3090-
>> qexistsl_tac [‘X’, ‘M0’, ‘r’, ‘d’] >> rw []
3089+
>> qexistsl_tac [‘X’, ‘r’, ‘d’] >> art []
30913090
QED
30923091

30933092
(*
3094-
Theorem solvable_permutator_ISUB :
3095-
!X M M0 r v P d. FINITE X /\ FV M SUBSET X UNION RANK r /\ v IN X UNION RANK r /\
3096-
M0 = principle_hnf M /\
3097-
P = permutator d /\ hnf_children_size M0 <= d /\
3098-
solvable M ==> solvable ([P/v] M)
3093+
Theorem solvable_ISUB_permutator :
3094+
!X M M0 r ss d.
3095+
FINITE X /\ FV M SUBSET X UNION RANK r /\
3096+
M0 = principle_hnf M /\ hnf_children_size M0 <= d /\
3097+
DOM ss SUBSET X UNION RANK r /\
3098+
(!P. MEM P (MAP FST ss) ==> P = permutator d) ==>
3099+
solvable M ==> solvable (M ISUB ss)
30993100
Proof
31003101
RW_TAC std_ss []
31013102
>> qabbrev_tac ‘P = permutator d’
@@ -3109,8 +3110,8 @@ Proof
31093110
>> ‘TAKE n vs = vs’ by rw []
31103111
>> POP_ASSUM (rfs o wrap)
31113112
>> ‘M0 == M’ by rw [Abbr ‘M0’, lameq_principle_hnf']
3112-
>> ‘[P/v] M0 == [P/v] M’ by rw [lameq_sub_cong]
3113-
>> Suff ‘solvable ([P/v] M0)’ >- PROVE_TAC [lameq_solvable_cong]
3113+
>> ‘M0 ISUB ss == M ISUB ss’ by rw [lameq_isub_cong]
3114+
>> Suff ‘solvable (M0 ISUB ss)’ >- PROVE_TAC [lameq_solvable_cong]
31143115
>> ‘FV P = {}’ by rw [Abbr ‘P’, FV_permutator]
31153116
>> ‘DISJOINT (set vs) (FV P)’ by rw [DISJOINT_ALT']
31163117
>> Know ‘~MEM v vs’
@@ -3797,7 +3798,7 @@ Proof
37973798
*)
37983799
>> Know ‘solvable ([P/v] M)’
37993800
>- (MATCH_MP_TAC solvable_subst_permutator \\
3800-
qexistsl_tac [‘X’, ‘M0’, ‘r’, ‘d’] >> simp [])
3801+
qexistsl_tac [‘X’, ‘r’, ‘d’] >> simp [])
38013802
>> DISCH_TAC
38023803
(* Now we need to know the exact form of ‘principle_hnf ([P/v] M)’.
38033804
@@ -5445,7 +5446,7 @@ Proof
54455446
>> DISCH_TAC
54465447
>> Know ‘solvable ([P/v] M)’
54475448
>- (MATCH_MP_TAC solvable_subst_permutator \\
5448-
qexistsl_tac [‘X’,‘M0’, ‘r’, ‘d’] >> simp [] \\
5449+
qexistsl_tac [‘X’, ‘r’, ‘d’] >> simp [] \\
54495450
MP_TAC (Q.SPECL [‘X’, ‘M’, ‘h::p’, ‘r’] subterm_width_first) \\
54505451
simp [ltree_paths_def])
54515452
>> DISCH_TAC
@@ -6197,7 +6198,7 @@ Proof
61976198
>- (rpt STRIP_TAC \\
61986199
Know ‘MAP (\t. t ISUB ss) (MAP VAR xs) = MAP VAR xs’
61996200
>- (rw [LIST_EQ_REWRITE, EL_MAP] \\
6200-
MATCH_MP_TAC ISUB_VAR_FRESH >> rw [GSYM DOM_ALT_MAP_SND] \\
6201+
MATCH_MP_TAC ISUB_VAR_FRESH >> rw [GSYM DOM_ALT] \\
62016202
simp [IN_IMAGE, IN_COUNT, Once DISJ_SYM] \\
62026203
STRONG_DISJ_TAC (* push ‘a < k’ *) \\
62036204
rename1 ‘EL x xs <> y a’ \\

examples/lambda/barendregt/chap2Script.sml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
open HolKernel Parse boolLib bossLib BasicProvers;
66

77
open pred_setTheory pred_setLib listTheory rich_listTheory finite_mapTheory
8-
arithmeticTheory string_numTheory hurdUtils;
8+
arithmeticTheory string_numTheory hurdUtils pairTheory;
99

1010
open basic_swapTheory termTheory nomsetTheory binderLib appFOLDLTheory;
1111

@@ -213,6 +213,18 @@ val lameq_sub_cong = save_thm(
213213
"lameq_sub_cong",
214214
REWRITE_RULE [GSYM AND_IMP_INTRO] (last (CONJUNCTS lemma2_12)));
215215

216+
Theorem lameq_isub_cong :
217+
!ss M N. M == N ==> M ISUB ss == N ISUB ss
218+
Proof
219+
Induct_on ‘ss’
220+
>- rw []
221+
>> simp [FORALL_PROD]
222+
>> qx_genl_tac [‘P’, ‘v’]
223+
>> rpt STRIP_TAC
224+
>> FIRST_X_ASSUM MATCH_MP_TAC
225+
>> MATCH_MP_TAC (cj 1 lemma2_12) >> art []
226+
QED
227+
216228
val lemma2_13 = store_thm( (* p.20 *)
217229
"lemma2_13",
218230
``!c n n'. ctxt c ==> (n == n') ==> (c n == c n')``,

examples/lambda/basics/appFOLDLScript.sml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
open HolKernel Parse boolLib bossLib;
1010

1111
open arithmeticTheory listTheory rich_listTheory pred_setTheory finite_mapTheory
12-
hurdUtils listLib;
12+
hurdUtils listLib pairTheory;
1313

1414
open termTheory binderLib;
1515

@@ -277,6 +277,23 @@ Proof
277277
>> Induct_on ‘vs’ >> rw []
278278
QED
279279

280+
Theorem LAMl_ISUB :
281+
!ss vs M. DISJOINT (set vs) (FVS ss) /\
282+
DISJOINT (set vs) (DOM ss) ==>
283+
((LAMl vs M) ISUB ss = LAMl vs (M ISUB ss))
284+
Proof
285+
Induct_on ‘ss’ >- rw [DOM_DEF, FVS_DEF]
286+
>> simp [FORALL_PROD, DOM_ALT]
287+
>> qx_genl_tac [‘P’, ‘v’]
288+
>> rw [FVS_DEF, DISJOINT_UNION]
289+
>> Know ‘[P/v] (LAMl vs M) = LAMl vs ([P/v] M)’
290+
>- (MATCH_MP_TAC LAMl_SUB \\
291+
simp [Once DISJOINT_SYM])
292+
>> Rewr'
293+
>> FIRST_X_ASSUM MATCH_MP_TAC
294+
>> simp [Once DISJOINT_SYM, DOM_ALT]
295+
QED
296+
280297
(* LAMl_ssub = ssub_LAM + LAMl_SUB *)
281298
Theorem LAMl_ssub :
282299
!vs fm t. DISJOINT (FDOM fm) (set vs) /\

examples/lambda/basics/termScript.sml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ Definition DOM_DEF :
736736
(DOM ((x,y)::rst) = {y} UNION DOM rst)
737737
End
738738

739-
Theorem DOM_ALT_MAP_SND :
739+
Theorem DOM_ALT :
740740
!phi. DOM phi = set (MAP SND phi)
741741
Proof
742742
Induct_on ‘phi’ >- rw [DOM_DEF]
@@ -821,7 +821,7 @@ Proof
821821
QED
822822

823823
(* |- !y sub. y NOTIN DOM sub ==> VAR y ISUB sub = VAR y *)
824-
Theorem ISUB_unchanged = REWRITE_RULE [GSYM DOM_ALT_MAP_SND] ISUB_VAR_FRESH
824+
Theorem ISUB_unchanged = REWRITE_RULE [GSYM DOM_ALT] ISUB_VAR_FRESH
825825

826826
Theorem tpm1_ISUB_exists[local] :
827827
!M x y. ?ss. tpm [(x,y)] M = M ISUB ss

0 commit comments

Comments
 (0)