-
Notifications
You must be signed in to change notification settings - Fork 37
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
[determinacy] big refactor #290
Draft
FissoreD
wants to merge
43
commits into
LPCIC:master
Choose a base branch
from
FissoreD:scoped-term-wip
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FissoreD
force-pushed
the
scoped-term-wip
branch
4 times, most recently
from
November 27, 2024 14:23
6cf6c26
to
597abd9
Compare
gares
reviewed
Nov 28, 2024
please run |
gares
reviewed
Nov 28, 2024
overall looks good |
FissoreD
force-pushed
the
scoped-term-wip
branch
2 times, most recently
from
December 3, 2024 18:47
75009b3
to
c2e5dae
Compare
FissoreD
force-pushed
the
scoped-term-wip
branch
from
December 10, 2024 09:24
40b4daf
to
76a7964
Compare
…ue_type_id - AST has no modes - in the old representation the predicate `type p int -> prop.` did not produce a mode for p. - therefore, Structured.program has no more a modes field - we delegate the computation of modes to Scoped_Quotation_Macro.run - flatten_arrows - objects with type `TArr (l, r)` where `r` has Prop as rightmost type, is transformed into `TPred (...)` by flatten_arrows. - the result of this call to flatten_arrows is used next to build modes and determinacy relations of predicates - IdPos.t - IdPos is a new module representing unique identifiers for elpi objects. - using integers is not possible due to the potential fusion of different units - therefore we use the position of a parsed terms as its id - unique ids are used by the typechecker which sets a unique id to the type of global constants - type of bound variables - the type of bound variables is attached to the lam node by the typechecker - determinacy checker - input arguments functionality setting - body premise inference and check
…` in the head of clauses
spilling is performend in Check.check this allows determinacy check to be performed on spilled terms
It is not known a priori the functionality of a fresh unification variable, for example: the variable `X` in `t1 :- pi x\ u (y\ X x y), std.assert! (X 1 2 = 2) "bug".` cannot be deduced from `u` without typechecking. We reuse the type assignment given by the typechecker to the term `X x y` to deduce the functionality of `X` New: - typeassignment translation to functionality - get_functionality_of_term instead returning none if a variable is not in the env, returns the conversion of its type assignment to functionality -
- add get_name api to MutableOnce module - check if Uvar is set before calling get - if the Uvar is unset return a Functionality.BoundVar
… relational - fold_left_partial loops over its arguments and modes, if the former is shorter than the latter: partial application if the two lists have same length: full application NEW: if the former is longer than then second: we deal with variadic function -> all exceeding arguments are considered in output - comparison between two functionality `f1` and `f2` when `f1` = Any and `f2` <> Any, is ok if `f1` does not contain Functional or AssumedFunctional subterm
- Modes are wrong if the pred is variadic. New: In fold_left_partial if there are more args than modes, we suppose the exceeding args are in output mode - Change unify_func algo: New: instead of looking on functionalities, we look on terms if one of them is flex we unify their functionalities - Correct pattern match in infer
New: cmp f1 f2 compares two functionalities. raise an error if f1 and f2 are not comparable, i.e. when f1 <<= f2 = false and f1 <<= f2 = false Bug correction: the min and max of two functionalities was wrong if the functionalities were not comparable: now the use of cmp raises the error if a wrong comparison is performed. Bug in sintax: corrected the syntax of some functionality/test files: `:functional pred` becomes `func` Refactor: change functionality_leq with the infix operator (<<=)
…m ScopedTypeExpression - The typechecker assigns types to terms, this types have modes: the node arrow has carries the mode - To simplify translation from ScopeTypeExpression to TypeAssignement, the node Pred has disappeard in favour of a combination of Arrow with mode and Prop - The type mode_arg and all the related auxiliary functions have been replaced with Mode.t where Mode is a global module in Utils used by Ast, Compiler, Runtime etc... the goal is to have a easier way to work with modes - The DeterminacyChecker benefits from modes attached to types since it has no more to find them into the mode map: they are already referenced in the type of terms taken into account - TODO: check if variable representing partial application of predicates have correct mode: e.g. in `X = map []`, the variable `X` has the type of `X` ha good associated mode?
- remove modes from program - modes are deduced from types - modes are added to the symbol map during the creation of the indexing - add clone function for terms, this is needed since terms contains pointers: memory sharing cannot be performed - macro are cloned before doing beta reduction this avoids type assignments to be wrongly assigned by side effects (add test for this: see macro_type.elpi) - typechecker does not perform typechecking if the ty projection of a ScopedTerm has been already set (this means that the term has already been typechecked) - pretty printer of scoped term takes a function printing values carried by Uvar (Uvar carries a polymorphic object)
- add pretty_raw allowing to print raw types, i.e. types with modes and functionality
FissoreD
force-pushed
the
scoped-term-wip
branch
from
December 16, 2024 09:09
54952f0
to
5e9862e
Compare
Type checker makes mode inference and raises error if mode mismatch is detected
FissoreD
force-pushed
the
scoped-term-wip
branch
5 times, most recently
from
December 19, 2024 09:25
dcba75e
to
6630341
Compare
FissoreD
force-pushed
the
scoped-term-wip
branch
from
December 19, 2024 09:28
6630341
to
259241a
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.