Skip to content

synthesize with elpi#1

Open
gares wants to merge 41 commits intomainfrom
elpi-tag
Open

synthesize with elpi#1
gares wants to merge 41 commits intomainfrom
elpi-tag

Conversation

@gares
Copy link
Collaborator

@gares gares commented Oct 5, 2021

I test it using 8.14+rc1 and Elpi 1.11.2, it should work the same on 8.13 and Elpi 1.11.1, but I've no clue if it works on 8.12 + Elpi very old version...

@eponier
Copy link
Collaborator

eponier commented Oct 5, 2021

No std.fold-map nor coq.reduction.lazy.norm in coq 8.12.

@eponier
Copy link
Collaborator

eponier commented Oct 5, 2021

But it compiles fine with coq 8.13.

@gares
Copy link
Collaborator Author

gares commented Oct 5, 2021

Tomorrow I'll do fields_t/fields/construct, since there is a missing feature.
In particular deep pattern matching is not "automatic" because the compiler used by Coq is impossible to use (at the OCaml level).
So I'll write a build-match for positives < k, and then use it (it would call the continuation of the branch passing the positive number of the branch, and nest match behind the scenes...). Unless one of you wants to give it a try before... Not sure it will be fun.

@gares
Copy link
Collaborator Author

gares commented Oct 5, 2021

Also, questions are welcome if the code is unclear.

@eponier
Copy link
Collaborator

eponier commented Oct 5, 2021

These pattern-matchings exist because we manipulate positives, if we used native ints, we would have a cascade of if instead, and thus no problem of deep pattern-matching. We could use a cascade of if in the the positive case too, not sure of the performance impact.

@gares
Copy link
Collaborator Author

gares commented Oct 5, 2021

I tried with natives but construct does not type check well since you dont get the substitution for free anymore

@eponier
Copy link
Collaborator

eponier commented Oct 5, 2021

Indeed, it is probably better to begin with the positive case then.

@gares
Copy link
Collaborator Author

gares commented Oct 6, 2021

I wrote some code for fields_t and fields. It should also generate construct, since it is entangled, but I have no time for it. It should not be too hard... We can either do it together the next week I'm at the lab, or someone can try this on his own. I don't think I'll have time tomorrow or Friday.

@gares gares changed the title synthesize tag synthesize with elpi Oct 7, 2021
@gares
Copy link
Collaborator Author

gares commented Dec 7, 2021

it looks ok, the only bug I can see is the first one mentioned here: https://lpcic.github.io/coq-elpi/tutorial_elpi_lang.html#pitfalls

@gares
Copy link
Collaborator Author

gares commented Dec 7, 2021

Hint: you can directly construct (global (const C)) instead of just C (or P IIRC) in the first map2, so that you don't need to map again.

Hint: std.map L (x\ coq.mk-app x [t]) L1 is slightly better, another option is to just [t|L] and in the base case std.rev.

@eponier
Copy link
Collaborator

eponier commented Dec 8, 2021

A small bug that I've just discovered: as we use the name of the type in the name of the generated functions, there is an error if we give an absolute path, e.g. Elpi tag List.list..

@gares
Copy link
Collaborator Author

gares commented Dec 8, 2021

@gares
Copy link
Collaborator Author

gares commented Dec 10, 2021

hurray!

@gares
Copy link
Collaborator Author

gares commented Dec 11, 2021

👑

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

Successfully merging this pull request may close these issues.

3 participants