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

function symbols without implementation? #12

Closed
jwaldmann opened this issue Mar 23, 2017 · 6 comments
Closed

function symbols without implementation? #12

jwaldmann opened this issue Mar 23, 2017 · 6 comments

Comments

@jwaldmann
Copy link
Contributor

(request for discussion of feature)

It seems an identifier can only be used in axioms and goals if it has a definition (that is, equations).

I would love to be able to have exercises "prove this about f, using only that axioms" - where f's implementation is not given.

Of course, f's type should be declared (see issue #10) but I could also imagine f = undefined

@jwaldmann
Copy link
Contributor Author

jwaldmann commented Mar 25, 2017

a work-around is to write a definition

append xs ys = append xs ys

cf. https://gitlab.imn.htwk-leipzig.de/waldmann/cyp/commit/88d20eb6cbab06e681bf24339426b845e65893f4

@jwaldmann
Copy link
Contributor Author

jwaldmann commented Mar 27, 2017

since #22 , we could write

undefined = undefined
append = undefined
reverse = undefined

but I am thinking now that we should not, because by transitivity, we can prove append .=. reverse, which looks dangerous.

https://gitlab.imn.htwk-leipzig.de/waldmann/cyp/commit/59eb3371a844eaf1e0fd160e0475bda9b9dc3f7c

@larsrh
Copy link
Contributor

larsrh commented Mar 27, 2017

We can treat undefined as a function and define append and reverse as undefined <some-unique-number>.

@jwaldmann
Copy link
Contributor Author

jwaldmann commented Mar 27, 2017

Or, some built-in magic: undefined can be used, but it has no "def undefined" rule (or no declaration at all).

I think the ultimate solution is to allow identifiers without implementation (but with type declaration). Then we don't need undefined.

@larsrh
Copy link
Contributor

larsrh commented Mar 27, 2017

I'll take a stab.

@larsrh
Copy link
Contributor

larsrh commented Mar 29, 2017

Turns out that this is already implemented and you can write

declare_sym append
declare_sym reverse

I forgot that we had this. See 7cb8e90 for the updated bintree test case.

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