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

[functionality] add functionality field to program #280

Merged
merged 9 commits into from
Nov 6, 2024

Conversation

FissoreD
Copy link
Collaborator

@FissoreD FissoreD commented Oct 30, 2024

Yet no functionality check but we have the infrastructure to know what predicates are functional and what is the functionality relation of its arguments.

This partially works with type abbreviations, a wrong compiled functionality is given by the following program:

typeabbrev (x A) (:functional pred i:A).
:functional pred p i:(x (:functional pred i:int)).

where the functionality of the argument A of x is forgotten

To solve this issue we need an abstraction constructor in the functionality type $\to$ done

src/compiler.ml Outdated
kinds, type_abbrevs, types
let kinds, type_abbrevs, types, functional_preds =
if hash = base_hash then
precomputed_kinds, precomputed_type_abbrevs, precomputed_types, functional_preds
Copy link
Contributor

Choose a reason for hiding this comment

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

The idea is that type checkig requires to merge some stuff. the precomputed_stuff is already merged.
I have some use cases in which the base used for type checking is not the base used for linking (a bit unsafe at the moment).
If the base is the same for both steps, the already merged stuff can be used. If not, one has to merge since the base changed and the precomputed values are wrong.

If it is also the case for functional_preds, follow the name schema/field positions a the other stuff.
If not, don't computed functional_preds in this if-then-else.

% In the implementation using the input mode of elpi this is no more true.
f X Y :- q X, r X Y.

main :- std.findall (f _ _) L, print L.
Copy link
Contributor

Choose a reason for hiding this comment

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

assert the length

@gares
Copy link
Contributor

gares commented Nov 4, 2024

nice test suite. I think all the tests that pass you should run a findall and assert the length of the returned list is < 2

@gares gares merged commit 4a14048 into LPCIC:scoped-term Nov 6, 2024
gares added a commit that referenced this pull request Nov 21, 2024
[functionality] add functionality field to program
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.

2 participants