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

Deprecate adjoin_to_theory #1383

Open
xrchz opened this issue Jan 7, 2025 · 8 comments
Open

Deprecate adjoin_to_theory #1383

xrchz opened this issue Jan 7, 2025 · 8 comments
Assignees

Comments

@xrchz
Copy link
Member

xrchz commented Jan 7, 2025

Adjoin to theory is a pain when trying to better modularise HOL4 theories and libraries, and isn't really a necessity: better practice is to put the code in a library and expect that library to be loaded alongside the theory as a matter of convention.

See further discussion in #381 to which this issue can be considered a prerequisite.

This issue is to remove adjoin_to_theory by deleting the API entry and revising the small number of uses in the repository to a cleaner convention.

xrchz added a commit that referenced this issue Feb 1, 2025
@xrchz
Copy link
Member Author

xrchz commented Feb 1, 2025

@mn200 How would you suggest to remove the use of adjoin_to_theory and adjoin_after_completion in Parse.sml specficially Parse.setup_grammars?

@mn200
Copy link
Member

mn200 commented Feb 2, 2025

Good question. This facility is used to give every theory a binding of val <thyname>_grammars in the signature and structure file so that it's easy to refer to the value of the grammars belonging to the given theory. These values are available through API calls so it's a "nice to have" rather than a "must have".

If you do

grep -r --include="*.sml" --exclude='*Theory.sml' _grammars *

from the head of the HOL repo you'll see that that it's used quite a lot.

In the short term, I'd let the parser be privileged and leave its uses of the calls.

@xrchz
Copy link
Member Author

xrchz commented Feb 2, 2025

What's the long term solution? Use the Parse APIs where these bindings were used? I'd rather jump straight to that (or something else that allows me to remove adjoin_to_theory API entirely).

@mn200
Copy link
Member

mn200 commented Feb 2, 2025

I think that's right. The call to use is grammarDB {thyname="foo"}

@xrchz xrchz self-assigned this Feb 6, 2025
xrchz added a commit that referenced this issue Feb 6, 2025
@xrchz
Copy link
Member Author

xrchz commented Feb 7, 2025

OK the adjoin branch currently builds up to big use of adjoin_to_theory in pairScript.sml -- I think the plan for that one is to move it to pairLib.sml and make sure that's open whenever it's needed?

EDIT: I have gone ahead in this way and it seems to work.

xrchz added a commit that referenced this issue Feb 7, 2025
xrchz added a commit that referenced this issue Feb 7, 2025
xrchz added a commit that referenced this issue Feb 7, 2025
xrchz added a commit that referenced this issue Feb 7, 2025
Also more progress on removing setup_grammars. Progress on #1383.
xrchz added a commit that referenced this issue Feb 7, 2025
@xrchz
Copy link
Member Author

xrchz commented Feb 7, 2025

OK so now the problem is src/ring/src/abstraction.sml -- would love any pointers/suggestions on how to get rid of that one. @mn200 looks like you're the git blame for it so might remember what it's about.

xrchz added a commit that referenced this issue Feb 8, 2025
Its uses most likely still need to be fixed. Work on #1383
@xrchz
Copy link
Member Author

xrchz commented Mar 5, 2025

What are we doing with EmitML here? Should we also get rid of it?

@mn200
Copy link
Member

mn200 commented Mar 6, 2025

I haven't looked at what it's trying to do yet. If possible, I think it might be nice to keep it.

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

No branches or pull requests

2 participants