-
Notifications
You must be signed in to change notification settings - Fork 143
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
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
deeb905
Define from/to functions for basic library types
myreen 81a0006
First sketch of automation
myreen cd47742
Refine automation
myreen 5e3b58e
Avoid t and f params for unused tyvars
myreen ad34f28
Use long names for non-local types
myreen 59b4477
Support more basic types
myreen 27e564b
Split from_to development into several files
myreen 0fbb667
Remove redundant checks in decoding (to) functions
myreen ab7d763
Support basic memory lookups
myreen b59c507
Improve support for tyvars
myreen 0056f87
Handle non-recursive datatypes
myreen 8eb06e4
Add recursive definition of from/to functions
myreen c94e9cc
Change demo script into a selftest.sml
myreen 5d5e37e
Include cv_types automation in HOL bin/build
myreen c0726a2
Add some entry points
myreen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -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 | ||
$(HOLMOSMLC) -o $@ $< | ||
|
||
EXTRA_CLEANS = selftest.exe selftest.log | ||
|
||
ifdef HOLSELFTESTLEVEL | ||
all: selftest.log | ||
|
||
selftest.log: selftest.exe | ||
$(tee ./$< 2>&1, $@) | ||
endif |
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,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 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.