forked from CakeML/cakeml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwordcountProofScript.sml
32 lines (25 loc) · 1.28 KB
/
wordcountProofScript.sml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
open preamble
semanticsPropsTheory backendProofTheory x64_configProofTheory
wordcountProgTheory wordcountCompileTheory
val _ = new_theory"wordcountProof";
val _ = temp_clear_overloads_on"STRCAT";
val wordcount_io_events_def = new_specification("wordcount_io_events_def",["wordcount_io_events"],
wordcount_semantics |> Q.GENL[`pname`,`fname`,`fs`,`cl`,`contents`]
|> SIMP_RULE bool_ss [SKOLEM_THM,Once(GSYM RIGHT_EXISTS_IMP_THM)]);
val (wordcount_sem,wordcount_output) = wordcount_io_events_def |> SPEC_ALL |> UNDISCH |> CONJ_PAIR
val (wordcount_not_fail,wordcount_sem_sing) = MATCH_MP semantics_prog_Terminate_not_Fail wordcount_sem |> CONJ_PAIR
val compile_correct_applied =
MATCH_MP compile_correct wordcount_compiled
|> SIMP_RULE(srw_ss())[LET_THM,ml_progTheory.init_state_env_thm,GSYM AND_IMP_INTRO]
|> C MATCH_MP wordcount_not_fail
|> C MATCH_MP x64_backend_config_ok
|> REWRITE_RULE[wordcount_sem_sing,AND_IMP_INTRO]
|> REWRITE_RULE[Once (GSYM AND_IMP_INTRO)]
|> C MATCH_MP (CONJ(UNDISCH x64_machine_config_ok)(UNDISCH x64_init_ok))
|> DISCH(#1(dest_imp(concl x64_init_ok)))
|> REWRITE_RULE[AND_IMP_INTRO]
val wordcount_compiled_thm =
CONJ compile_correct_applied wordcount_output
|> DISCH_ALL
|> curry save_thm "wordcount_compiled_thm";
val _ = export_theory();