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

Binder-like syntax for {PROD,SUM}_IMAGE #51

Open
mn200 opened this issue Jan 11, 2012 · 1 comment
Open

Binder-like syntax for {PROD,SUM}_IMAGE #51

mn200 opened this issue Jan 11, 2012 · 1 comment

Comments

@mn200
Copy link
Member

mn200 commented Jan 11, 2012

Πx ∈ s. x + 1 should parse to PROD_IMAGE (λx. x + 1) s. This is very similar to the transformation done in handling restricted quantifiers (which should also have their syntax extended to allow for as well as ::).

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@mn200
Copy link
Member Author

mn200 commented Jan 27, 2016

It's possible to almost get there already with the following:

new_constant("sigma", ``:'a -> num``);
set_fixity "sigma" Binder;
associate_restriction ("sigma", "rsigma");
overload_on ("rsigma", ``\s f. SUM_IMAGE f s``)

You can then write sigma n::s. n * 2 and get back the term SUM_IMAGE (\n. n * 2) s. Unfortunately, the pretty-printer dies, but the parser does the right thing.

The sigma constant is entirely fake and unnecessary. It's possible that the new_constant line could be entirely omitted.

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