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

Defining multiple independent functions in the same definition block. #1324

Open
Eric-C-Hall opened this issue Oct 17, 2024 · 4 comments
Open

Comments

@Eric-C-Hall
Copy link

It would be good to be able to tell HOL to allow you to define multiple independent functions in one definition block without it complaining, because this would make it easier to debug when you are defining mutually recursive functions, if, for example, you want to write it one part at a time instead of all at once, or if you want to comment out parts of it to see which parts of the definition are broken. It will mean you will not have to correctly define the entire set of possibly many functions correctly all at once.

The default should be for HOL to complain, because this will avoid bugs where recursion is not happening where recursion is expected, but it would be good to disable HOL's complaints.

Maybe use the attribute [multi] to indicate that it is ok to define multiple functions in the same block.

@konrad-slind
Copy link
Contributor

konrad-slind commented Oct 17, 2024 via email

@Eric-C-Hall
Copy link
Author

That sounds good! I'll have to check it out next time I need to write a recursive function. Would be good to have it incorporated into the Definition ... End syntax.

@Eric-C-Hall
Copy link
Author

Eric-C-Hall commented Oct 17, 2024

I, too, like to replace parts of my definition with ARB to ensure that the rest of the definition is being type-checked correctly, and then fill in the ARBs later. However, when attempting to do this in mutually recursive functions, if you replace the mutually recursive call with an ARB, then the function becomes no-longer-mutually-recursive, and HOL complains because you can't have multiple definitions in a non-mutually-recursive definition block.

Now that I think about it, though, in the case that this happens, it is possible to split the definition up into multiple single definitions, and work with those. However, this is needlessly labour-intensive, if you're going to have to combine the definitions again when they become mutually recursive, anyway.

@konrad-slind
Copy link
Contributor

konrad-slind commented Oct 17, 2024 via email

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