Skip to content

port to elpi 3.0 #527

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

Draft
wants to merge 35 commits into
base: master
Choose a base branch
from
Draft

port to elpi 3.0 #527

wants to merge 35 commits into from

Conversation

gares
Copy link
Member

@gares gares commented Apr 15, 2025

Since elpi 3.0 is still in development this is very preliminary.
The main visible change is that functional predicates can be flagged as such and the static checker complains if they are not detected to be functional. CFR https://inria.hal.science/hal-05026472
CC @FissoreD

@CohenCyril

This comment was marked as outdated.

@gares

This comment was marked as outdated.

FissoreD and others added 6 commits April 15, 2025 21:22
since there was a findall we use 'from' to generate all inputs,
but this way it could contain duplicates. the right solution is
to have a predicate listing (once) each HB generated constant.
@FissoreD
Copy link
Contributor

There are some predicates with the comment remove when coq-elpi > 1.9.3, such as copy-indt-decl, copy-fields, and copy-constructor. I assume these are included for compatibility reasons.

However, I can’t keep them in the code as-is, because they break determinacy. For instance, a successful call to copy-indt-decl leaves a choice point, which is unexpected since copy-indt-decl is meant to be deterministic.

@CohenCyril — would it be a major issue if I comment out these three predicates and change the comment from remove when coq-elpi > 1.9.3 to add when coq-elpi <= 1.9.3?

@gares
Copy link
Member Author

gares commented Apr 16, 2025

HB seems to dépend on coq elpi >= 2.0, sothey should be removed

@@ -2,7 +2,7 @@
This software is released under the terms of the MIT license */

% runs P in a context where Coq #[attributes] are parsed
pred with-attributes i:prop.
func with-attributes fprop.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefere (func) to fprop

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I changed here: 54a5138

@gares
Copy link
Member Author

gares commented Apr 17, 2025

$ for b in master HEAD; do git grep '^func ' $b | wc -l ; git grep '^pred ' $b | wc -l; done
0
482
292
200

Comment on lines +102 to 103
func compute-filter.aux list string, list string -> list string.
compute-filter.aux [S|_] [S] [S] :- !.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it intentional that this predicate is also declared identically in utils-synter.elpi?

bulletize1 F X (glue [str "- ", M]) :- F X M.

pred bulletize i:list A, i:(A -> coq.pp -> prop), o:coq.pp.
bulletize [] _ empty.
func bulletize list A, (func A -> coq.pp) -> coq.pp.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be sure, bulletize is a function?
If it is not the case, the cut in the rule below should be removed...

toposort ES XS XS'' :-
toporec ES XS [] [] _ XS',
std.filter XS' (std.mem XS) XS''.
std.filter XS' (std.mem! XS) XS''.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think toposort is a function, am I right?
If that’s the case, then we should use std.mem! instead of std.mem to avoid unnecessary
(and horrible) choice points.


% [join C1 C2 C3] means that C3 inherits from both C1 and C2
pred join o:classname, o:classname, o:classname.

% Section local memory of names for mixins, so that we can reuse them
% and build terms with simpler conversion problems (less unfolding
% in order to discover two mixins are the same)
pred mixin-mem i:term, o:gref.
func mixin-mem term -> gref.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it really a function?
I think it is, but mixin-mem rules are built as a list and loaded via flex clauses (e.g., Clauses =>).
These clauses are constructed, for example, in the third rule of declare-all:
→ infer-class → optimize-class-body → declare-mixin-name → std.append CL1 CL2 Clauses.
Tracking this information seems difficult.

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