Skip to content

Commit 1851010

Browse files
authored
Merge pull request #79 from CakeML/bye-triviality
Replace Triviality by local Theorem
2 parents ad34b0c + af3ee4f commit 1851010

File tree

79 files changed

+410
-410
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+410
-410
lines changed

compiler/backend/languages/properties/env_cexp_lemmasScript.sml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Proof
4848
metis_tac[]
4949
QED
5050

51-
Triviality MAPi_ID[simp]:
51+
Theorem MAPi_ID[local,simp]:
5252
∀l. MAPi (λn v. v) l = l
5353
Proof
5454
Induct >> rw[combinTheory.o_DEF]

compiler/backend/languages/relations/pure_presScript.sml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ Proof
807807
)
808808
QED
809809

810-
Triviality ALOOKUP_MAP_3':
810+
Theorem ALOOKUP_MAP_3'[local]:
811811
ALOOKUP (MAP (λ(k,v1,v2). (k,v1,f v1 v2)) l) =
812812
OPTION_MAP (λ(v1,v2). (v1, f v1 v2)) o ALOOKUP l
813813
Proof

compiler/backend/languages/semantics/pureLangScript.sml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Definition rows_of_def:
2525
(lets_for cn v (MAPi (λi v. (i,v)) vs) b) (rows_of v k rest)
2626
End
2727

28-
Triviality list_size_cepat_size_MAPi:
28+
Theorem list_size_cepat_size_MAPi[local]:
2929
list_size (λx. cepat_size (SND x)) (MAPi ( λi p. f i, p) ps) = list_size cepat_size ps
3030
Proof
3131
Induct_on ‘ps’ using SNOC_INDUCT >> rw[] >>

compiler/backend/languages/semantics/stateLangScript.sml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ Proof
692692
Induct_on ‘n’ >> rw[step,ADD1,step_n_add]
693693
QED
694694

695-
Triviality application_Action:
695+
Theorem application_Action[local]:
696696
application p vs st k = (Action channel content,st1,k1) ⇒
697697
p = FFI channel ∧ ∃st1. st = SOME st1
698698
Proof
@@ -1509,7 +1509,7 @@ Proof
15091509
\\ drule_all step'_append_cont \\ rw [] \\ gvs []
15101510
QED
15111511

1512-
Triviality step'_not_ForceK1:
1512+
Theorem step'_not_ForceK1[local]:
15131513
v1 ∉ avoid ∧
15141514
step' avoid s k x = (r0,r1,r2) ∧
15151515
(∀ts. x = Val v1 ⇒ k ≠ ForceK1::ts) ⇒
@@ -1544,7 +1544,7 @@ Proof
15441544
\\ gvs [GSYM ADD1, step'_n_def, FUNPOW]
15451545
QED
15461546

1547-
Triviality step'_n_not_halt_mul:
1547+
Theorem step'_n_not_halt_mul[local]:
15481548
∀m n avoid x s k.
15491549
(∀k1. ¬is_halt (x,s,k1)) ∧
15501550
(∀k. ∃k1. step'_n n avoid (x,s,k) = (x,s,k1)) ⇒

compiler/backend/passes/env_to_stateScript.sml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Definition update_delay_def:
4444
App (UpdateMutThunk NotEvaluated) [Var v; Lam NONE y])
4545
End
4646

47-
Triviality Letrec_split_MEM_funs:
47+
Theorem Letrec_split_MEM_funs[local]:
4848
∀xs delays funs m n x.
4949
(delays,funs) = Letrec_split ns xs ∧ MEM (m,n,x) funs ⇒
5050
cexp_size x ≤ list_size (pair_size mlstring_size cexp_size) xs
@@ -58,7 +58,7 @@ Proof
5858
\\ Cases_on ‘h1’ \\ gvs [dest_Lam_def,env_cexpTheory.cexp_size_def]
5959
QED
6060

61-
Triviality Letrec_split_MEM_delays:
61+
Theorem Letrec_split_MEM_delays[local]:
6262
∀xs delays funs m n x.
6363
(delays,funs) = Letrec_split ns xs ∧ MEM (m,n,x) delays ⇒
6464
cexp_size x ≤ list_size (pair_size mlstring_size cexp_size) xs

compiler/backend/passes/proofs/env_to_state_2ProofScript.sml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Proof
4949
\\ rpt $ first_x_assum $ irule_at Any
5050
QED
5151

52-
Triviality MEM_explode[simp]:
52+
Theorem MEM_explode[local,simp]:
5353
∀xs x. MEM (explode x) (MAP explode xs) = MEM x xs
5454
Proof
5555
Induct \\ fs []
@@ -233,14 +233,14 @@ Proof
233233
\\ fs []
234234
QED
235235

236-
Triviality Letrec_imm_0:
236+
Theorem Letrec_imm_0[local]:
237237
env_to_state$Letrec_imm ts m ⇒
238238
(∃v. m = Var v ∧ MEM v ts) ∨ ∃x y. m = Lam x y
239239
Proof
240240
Cases_on ‘m’ \\ fs [Letrec_imm_def]
241241
QED
242242

243-
Triviality Letrec_imm_1:
243+
Theorem Letrec_imm_1[local]:
244244
state_unthunkProof$Letrec_imm ts m ⇒
245245
(∃v. m = Var v ∧ MEM v ts) ∨ ∃x y. m = Lam (SOME x) y
246246
Proof
@@ -249,7 +249,7 @@ Proof
249249
\\ fs [state_unthunkProofTheory.Letrec_imm_def]
250250
QED
251251

252-
Triviality comp_Letrec_neq:
252+
Theorem comp_Letrec_neq[local]:
253253
comp_Letrec sfns se ≠ Var v ∧
254254
comp_Letrec sfns se ≠ Lam m n
255255
Proof
@@ -261,7 +261,7 @@ Proof
261261
\\ fs [state_unthunkProofTheory.Lets_def]
262262
QED
263263

264-
Triviality expand_Case_neq:
264+
Theorem expand_Case_neq[local]:
265265
state_caseProof$expand_Case v ses se ≠ Lam x t ∧
266266
state_caseProof$expand_Case v ses se ≠ False
267267
Proof
@@ -270,7 +270,7 @@ Proof
270270
\\ PairCases_on ‘h’ \\ fs [state_caseProofTheory.rows_of_def]
271271
QED
272272

273-
Triviality rows_of_neq:
273+
Theorem rows_of_neq[local]:
274274
rows_of x y z ≠ Lam a b ∧
275275
rows_of x y z ≠ Var c
276276
Proof

compiler/backend/passes/proofs/expof_caseProofScript.sml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ Proof
273273
\\ irule_at Any PAIR)
274274
QED
275275

276-
Triviality freevars_lets_for':
276+
Theorem freevars_lets_for'[local]:
277277
∀xs n x y.
278278
freevars (exp_of' p_2) = freevars (exp_of p_2) ⇒
279279
freevars (lets_for' n x y xs (exp_of' p_2)) =

compiler/backend/passes/proofs/pure_demands_analysisProofScript.sml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2642,7 +2642,7 @@ Proof
26422642
simp[]
26432643
QED
26442644

2645-
Triviality find_IfDisj:
2645+
Theorem find_IfDisj[local]:
26462646
find e1 c ∅ ds e2 NONE
26472647
find (IfDisj s p1 e1) c ∅ ds (IfDisj s p1 e2) NONE
26482648
Proof
@@ -3611,7 +3611,7 @@ QED
36113611

36123612
(********** Prove that analysis only inserts well-defined Seqs **********)
36133613

3614-
Triviality empty_map_simps[simp]:
3614+
Theorem empty_map_simps[local,simp]:
36153615
map_ok (empty compare) ∧
36163616
cmp_of (empty compare) = compare ∧
36173617
to_fmap (empty compare) = FEMPTY ∧

compiler/backend/passes/proofs/pure_freshenProofScript.sml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ Proof
156156
gvs[SUBSET_DEF] >> metis_tac[]
157157
QED
158158

159-
Triviality boundvars_FOLDR_Let_SUBSET:
159+
Theorem boundvars_FOLDR_Let_SUBSET[local]:
160160
boundvars (FOLDR (λ(u,e) A. Let (explode u) e A) acc binds) ⊆
161161
boundvars acc ∪ IMAGE explode (set (MAP FST binds)) ∪
162162
BIGUNION (set $ MAP (boundvars o SND) binds)
@@ -200,7 +200,7 @@ Proof
200200
Induct_on `cnars` >> rw[IfDisj_def, letrecs_distinct_def]
201201
QED
202202

203-
Triviality ALOOKUP_MAP_3':
203+
Theorem ALOOKUP_MAP_3'[local]:
204204
ALOOKUP (MAP (λ(k,v1,v2). (k,v1,f v1 v2)) l) =
205205
OPTION_MAP (λ(v1,v2). (v1, f v1 v2)) o ALOOKUP l
206206
Proof
@@ -962,7 +962,7 @@ Proof
962962
simp[freshen_bind_def, combinTheory.o_DEF, UNCURRY]
963963
QED
964964

965-
Triviality freshen_aux_list_LENGTH:
965+
Theorem freshen_aux_list_LENGTH[local]:
966966
∀l m avoid l' avoid'.
967967
freshen_aux_list m l avoid = (l', avoid')
968968
⇒ LENGTH l' = LENGTH l
@@ -1640,7 +1640,7 @@ Definition varmap_rel_def:
16401640
FLOOKUP fmap (explode k) = SOME (explode v))
16411641
End
16421642

1643-
Triviality fresh_boundvar_rel:
1643+
Theorem fresh_boundvar_rel[local]:
16441644
varmap_rel varmap m ∧
16451645
vars_ok avoid ∧
16461646
fresh_boundvar x varmap avoid = ((y,varmap'), avoid')
@@ -1654,14 +1654,14 @@ Proof
16541654
drule_all fresh_boundvar_varmap >> strip_tac >> simp[FLOOKUP_SIMP] >> rw[]
16551655
QED
16561656

1657-
Triviality ALOOKUP_MAP_explode_FST:
1657+
Theorem ALOOKUP_MAP_explode_FST[local]:
16581658
ALOOKUP (MAP (λ(a,b). (explode a,b)) l) (explode k) = ALOOKUP l k
16591659
Proof
16601660
Induct_on `l` >> rw[] >>
16611661
pairarg_tac >> gvs[]
16621662
QED
16631663

1664-
Triviality fresh_boundvars_rel:
1664+
Theorem fresh_boundvars_rel[local]:
16651665
∀xs varmap avoid ys varmap' avoid' m.
16661666
varmap_rel varmap m ∧
16671667
vars_ok avoid ∧

compiler/backend/passes/proofs/pure_inline_cexpProofScript.sml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ Proof
355355
\\ metis_tac []
356356
QED
357357

358-
Triviality NOT_NONE_UNIT:
358+
Theorem NOT_NONE_UNIT[local]:
359359
(x ≠ NONE) ⇔ x = SOME ()
360360
Proof
361361
Cases_on ‘x’ \\ fs []
@@ -629,7 +629,7 @@ Proof
629629
\\ metis_tac []
630630
QED
631631

632-
Triviality App_Lam_to_Lets_allvars:
632+
Theorem App_Lam_to_Lets_allvars[local]:
633633
App_Lam_to_Lets exp = SOME exp1 ⇒
634634
allvars (exp_of exp) = allvars (exp_of exp1)
635635
Proof
@@ -655,7 +655,7 @@ Proof
655655
\\ res_tac \\ fs []
656656
QED
657657

658-
Triviality MAP2_lemma:
658+
Theorem MAP2_lemma[local]:
659659
∀vbs vbs1.
660660
LENGTH vbs = LENGTH vbs1 ⇒
661661
MAP FST (MAP2 (λ(v,_) x. (v,x)) vbs vbs1) = MAP FST vbs ∧
@@ -832,7 +832,7 @@ Definition wf_mem_def:
832832
cexp_wf ce ∧ letrecs_distinct (exp_of ce)
833833
End
834834

835-
Triviality BIGUNION_set_SUBSET:
835+
Theorem BIGUNION_set_SUBSET[local]:
836836
BIGUNION (set xs) ⊆ z ⇔ EVERY (λx. x ⊆ z) xs
837837
Proof
838838
Induct_on ‘xs’ \\ gvs []
@@ -847,7 +847,7 @@ Proof
847847
\\ gvs [AC UNION_COMM UNION_ASSOC]
848848
QED
849849

850-
Triviality cexp_Lets_append:
850+
Theorem cexp_Lets_append[local]:
851851
∀xs ys x. Lets a (xs ++ ys) x = Lets a xs (Lets a ys x)
852852
Proof
853853
Induct \\ gvs [Lets_def,FORALL_PROD]
@@ -946,7 +946,7 @@ Proof
946946
\\ metis_tac []
947947
QED
948948

949-
Triviality freevars_Disj:
949+
Theorem freevars_Disj[local]:
950950
freevars (Disj v xs) ⊆ {v}
951951
Proof
952952
Induct_on ‘xs’ \\ gvs [Disj_def]
@@ -970,7 +970,7 @@ Proof
970970
metis_tac[avoid_set_ok_subset]
971971
QED
972972

973-
Triviality App_Lam_to_Lets_avoid_set_ok:
973+
Theorem App_Lam_to_Lets_avoid_set_ok[local]:
974974
App_Lam_to_Lets e = SOME e' ⇒
975975
avoid_set_ok vars e = avoid_set_ok vars e'
976976
Proof
@@ -1627,7 +1627,7 @@ Proof
16271627
dxrule_all freshen_global_boundvars >> simp[]
16281628
QED
16291629

1630-
Triviality freshen_cexp_disjoint_lemma:
1630+
Theorem freshen_cexp_disjoint_lemma[local]:
16311631
freshen_cexp e ns = (e1,ns1) ∧ avoid_set_ok ns e ∧
16321632
cexp_wf e ∧ NestedCase_free e ∧ letrecs_distinct (exp_of e) ∧
16331633
s ⊆ set_of ns
@@ -1647,7 +1647,7 @@ Proof
16471647
\\ gvs [cexp_wf_def]
16481648
QED
16491649

1650-
Triviality if_lemma:
1650+
Theorem if_lemma[local]:
16511651
boundvars (if b then Seq Fail x else x) = boundvars x ∧
16521652
barendregt (if b then Seq Fail x else x) = barendregt x ∧
16531653
letrecs_distinct (if b then Seq Fail x else x) = letrecs_distinct x
@@ -1666,7 +1666,7 @@ Proof
16661666
rw [] \\ irule inline_rel_Prim \\ gvs [inline_rel_refl]
16671667
QED
16681668

1669-
Triviality inline_rel_rows_of:
1669+
Theorem inline_rel_rows_of[local]:
16701670
∀xs1 ys1.
16711671
inline_rel xs x y ∧
16721672
MAP FST xs1 = MAP FST ys1 ∧

0 commit comments

Comments
 (0)