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

Special syntax for nested/sequence of sum_CASE constants #1276

Open
mn200 opened this issue Jul 23, 2024 · 0 comments
Open

Special syntax for nested/sequence of sum_CASE constants #1276

mn200 opened this issue Jul 23, 2024 · 0 comments

Comments

@mn200
Copy link
Member

mn200 commented Jul 23, 2024

So that

case x of
  | INL se => sexp_size se
  | INR (INL se) => sexp_size se
  | INR (INR (INL ses)) => list_size sexp_size ses
  | INR (INR (INR (INL ses))) => list_size sexp_size ses
  | INR (INR (INR (INR (INL ses)))) => list_size sexp_size ses
  | INR (INR (INR (INR (INR (INL ses))))) => list_size sexp_size ses
  | INR (INR (INR (INR (INR (INR (INL se_opt))))) => option_size se_opt
  | INR (INR (INR (INR (INR (INR (INR (INL se))))))) => sexp_size se
  | INR (INR (INR (INR (INR (INR (INR (INR ses))))))) => list_size sexp_size ses

could be written as

nested_sum_case x of
  | se => sexp_size se
  | se => sexp_size se
  | ses => list_size sexp_size ses
  | ses => list_size sexp_size ses
  | ses => list_size sexp_size ses
  | ses => list_size sexp_size ses
  | se_opt => option_size se_opt
  | se => sexp_size se
  | ses => list_size sexp_size ses

or similar. With the name nested_sum_case obviously up for bike-shedding. Thanks to @myreen and discussion at recent HOL workshop for idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant