Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start on refactoring the CakeML compset infrastructure
In each directory dirname, there should be a file compute_dirnameLib.sml It should contain functions add_whatever_compset that adds theorems and conversion relevant to the whatever to a given compset. It should also contain a definition the_dirname_compset that creates a compset with everything needed to run the various whatevers in dirname. It doesn't work currently, because label removal in bytecode relies on el_check which is defined in compiler, but the directories depend the other way around. The unify and label removal infrastructure had global state, I've refactored so that the state is created locally to the add_..._compset call.
- Loading branch information
Showing
13 changed files
with
532 additions
and
320 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
INCLUDES = $(HOLDIR)/examples/parsing | ||
OPTIONS = QUIT_ON_FAILURE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
structure compute_basicLib = struct | ||
open HolKernel boolLib bossLib lcsymtacs | ||
|
||
fun add_datatype tm compset = | ||
(computeLib.add_datatype_info compset o valOf o TypeBase.fetch) tm | ||
|
||
(* compset needs to have at least wordsLib.words_compset in it *) | ||
fun add_basic_compset compset = | ||
let | ||
(* good libraries which provide compsets :) *) | ||
val () = intReduce.add_int_compset compset | ||
(* included in words_compset | ||
val () = listLib.list_rws compset | ||
val () = numposrepLib.add_numposrep_compset compset | ||
val () = ASCIInumbersLib.add_ASCIInumbers_compset compset | ||
*) | ||
val () = stringLib.add_string_compset compset | ||
val () = sumSimps.SUM_rws compset | ||
val () = optionLib.OPTION_rws compset | ||
val () = pred_setLib.add_pred_set_compset compset | ||
val () = combinLib.add_combin_compset compset | ||
val () = pairLib.add_pair_compset compset | ||
val () = finite_mapLib.add_finite_map_compset compset | ||
val () = pegLib.add_peg_compset compset | ||
(* rich_list doesnt' provide a compset :( *) | ||
val () = computeLib.add_thms | ||
[rich_listTheory.SPLITP_compute | ||
,rich_listTheory.SPLITP_AUX_def | ||
] compset | ||
(* sptree doesn't provide a compset :( *) | ||
val () = computeLib.add_thms | ||
[sptreeTheory.lookup_compute | ||
,sptreeTheory.insert_compute | ||
,sptreeTheory.delete_compute | ||
,sptreeTheory.lrnext_thm | ||
,sptreeTheory.wf_def | ||
,sptreeTheory.mk_BN_def | ||
,sptreeTheory.mk_BS_def | ||
,sptreeTheory.fromList_def | ||
,sptreeTheory.size_def | ||
,sptreeTheory.union_def | ||
,sptreeTheory.inter_def | ||
,sptreeTheory.domain_def | ||
,sptreeTheory.foldi_def | ||
,sptreeTheory.toListA_def | ||
,sptreeTheory.toList_def | ||
,sptreeTheory.mk_wf_def | ||
] compset | ||
val () = computeLib.add_thms | ||
[miscTheory.find_index_def | ||
,miscTheory.LEAST_thm | ||
,miscTheory.least_from_thm | ||
] compset | ||
val () = add_datatype ``:'a spt`` compset | ||
in | ||
() | ||
end | ||
|
||
val the_basic_compset = | ||
let | ||
val c = wordsLib.words_compset () | ||
val () = add_basic_compset c | ||
in | ||
c | ||
end | ||
|
||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
structure compute_inferenceLib = struct | ||
open HolKernel boolLib bossLib lcsymtacs | ||
|
||
fun add_inference_compset compset = | ||
let | ||
|
||
open inferTheory | ||
val () = computeLib.add_thms | ||
[infer_prog_def | ||
,infer_top_def | ||
,infer_d_def | ||
,infer_ds_def | ||
,infer_e_def | ||
,infer_p_def | ||
,st_ex_bind_def | ||
,st_ex_return_def | ||
,lookup_tenvC_st_ex_def | ||
,lookup_st_ex_def | ||
,init_state_def | ||
,get_next_uvar_def | ||
,fresh_uvar_def | ||
,n_fresh_uvar_def | ||
,guard_def | ||
,add_constraint_def | ||
,add_constraints_def | ||
,read_def | ||
,generalise_def | ||
,apply_subst_list_def | ||
,append_decls_def | ||
,constrain_op_def | ||
,infer_deBruijn_subst_def | ||
,Infer_Tfn_def | ||
,Infer_Tint_def | ||
,Infer_Tbool_def | ||
,Infer_Tref_def | ||
,Infer_Tunit_def | ||
,infer_type_subst_def | ||
,check_signature_def | ||
] compset | ||
|
||
val () = compute_basicLib.add_datatype ``:infer_t`` compset | ||
val () = compute_basicLib.add_datatype ``:atom`` compset | ||
val () = compute_basicLib.add_datatype ``:('a,'b)exc`` compset | ||
val () = compute_basicLib.add_datatype ``:'a infer_st`` compset | ||
in | ||
() | ||
end | ||
|
||
val the_infer_compset = let | ||
val c = wordsLib.words_compset () | ||
val () = compute_basicLib.add_basic_compset c | ||
val () = compute_semanticsLib.add_ast_compset c | ||
val get_wfs = unifyLib.add_unify_compset c | ||
val () = add_inference_compset c | ||
in | ||
() | ||
end | ||
|
||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.