Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automation for defining from/to functions for cv_compute's cv type #1142

Merged
merged 15 commits into from
Aug 28, 2023
Merged
22 changes: 22 additions & 0 deletions src/num/theories/cv_compute/automation/Holmakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
all: $(DEFAULT_TARGETS) selftest.exe

.PHONY: all link-to-sigobj

ifdef HOLBUILD
all: link-to-sigobj
.PHONY: link-to-sigobj
link-to-sigobj: $(DEFAULT_TARGETS)
$(HOL_LNSIGOBJ)
endif

selftest.exe: selftest.uo
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mn200 should this line have more deps?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As long as selftest.sml clearly depends (via on open fooTheory type line) on what's needed, this should be fine.

$(HOLMOSMLC) -o $@ $<

EXTRA_CLEANS = selftest.exe selftest.log

ifdef HOLSELFTESTLEVEL
all: selftest.log

selftest.log: selftest.exe
$(tee ./$< 2>&1, $@)
endif
27 changes: 27 additions & 0 deletions src/num/theories/cv_compute/automation/cv_typesLib.sig
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
signature cv_typesLib =
sig
include Abbrev

(* --- main entry points --- *)

(* ask for from_to info (derives missing info automatically) *)
val from_to_thm_for : hol_type -> thm
val from_term_for : hol_type -> term
val to_term_for : hol_type -> term

(* --- less useful entry points --- *)

(* manually add a from_to theorem *)
val add_from_to_thm : thm -> unit

(* returns a list of all from_to theorems *)
val from_to_thms : unit -> thm list

(* automatically define new from/to functions for a user-defined datatype *)
val define_from_to : hol_type -> thm * thm * thm list
val rec_define_from_to : hol_type -> thm list

(* define_from_to can raise this *)
exception Missing_from_to of hol_type

end
Loading