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

More arguments for newtypeTools.rich_new_type #1215

Merged
merged 4 commits into from
Apr 9, 2024

Conversation

binghe
Copy link
Member

@binghe binghe commented Mar 22, 2024

Hi,

The (undocumented) tool newtypeTools.rich_new_type currently lacks the ability to specify the newly created function constants for converting between the abstraction and representation types (ABS and REP). The current workaround is to do overloading after calling it, e.g., in wellorderScript.sml:

val wellorder_results = newtypeTools.rich_new_type(
  "wellorder",
  prove(``?x. wellorder x``, qexists_tac `{}` >> simp[wellorder_EMPTY]))

val _ = overload_on ("mkWO", ``wellorder_ABS``)
val _ = overload_on ("destWO", ``wellorder_REP``)

In this PR, per our offline discussions, I have modified the signature of rich_new_type to allow providing ABS and REP constant names. The new signature is the following:

  val rich_new_type : {tyname: string,
                       exthm: thm,
                       ABS: string,
                       REP: string}
                       ->
                      {absrep_id: thm,
                       newty: hol_type,
                       repabs_pseudo_id: thm,
                       termP: term,
                       termP_exists: thm,
                       termP_term_REP: thm,
                       term_ABS_t: term,
                       term_ABS_pseudo11: thm,
                       term_REP_t: term,
                       term_REP_11: thm}

All existing uses in core theories and examples are updated with the extra ABS and REP parameters (NOTE: SML doesn't support optional record slot values).

NOTE: in wellorderScript.sml, although the two constants wellorder_ABS and wellorder_REP were overloaded, they are still used in many places. I have updated them all.

--Chun

@binghe binghe changed the title Newtype tools.rich new type More arguments for newtypeTools.rich_new_type Mar 22, 2024
@mn200
Copy link
Member

mn200 commented Apr 9, 2024

Many thanks! (I should get around to documenting this...)

@mn200 mn200 merged commit 190392c into HOL-Theorem-Prover:develop Apr 9, 2024
2 checks passed
@binghe binghe deleted the newtypeTools.rich_new_type branch April 14, 2024 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants