-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HB.saturate: saturating instances on new structure declaration
When a new structure `S` is created it may be the case that some type which is already equipped with some mixins is an instance of `S`, but was not declared as such since `S` was not declared yet. Similarly, mixin instances which have parameters may not be available on a single type until there is a structure for the parameter which is rich enough. We store in the predicate `has-mixin-instance` the list of types which have mixin instances, so that we can reconsider them later. Out of these we craft `mixin-src` clauses (used by `HB/common/inference.elpi`) which have premises using Coq's unifyer (which in turn can compute the smallest structure having all requirements thanks to the hints we declare on joins). Example: When such an instance is declared: ```coq HB.instance Definition I1 (X:t1) : mixin1 (list X) := ... . ``` a clause of this form is generated: ```coq has-mixin-instance (cs-gref (indt «list»)) (indt «mixin1.axioms_») (const «I1») ``` When `HB.saturate` is called, we generate conditional `mixin-src` clauses with conditions on parameters (via the function `has-mixin-instance->mixin-src`). Then for each type constructor mentioned in a `has-mixin-src` clause we try to declare new instances with the new clauses via `declare-all-on-type-constructor`. Unresolved parameters are abstracted out. Their type is the smallest structure which can satisfy all the constraints coming from single mixins.
- Loading branch information
1 parent
7d4f095
commit 17784b9
Showing
22 changed files
with
713 additions
and
35 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,3 +58,4 @@ _minted-* | |
*.vtc | ||
|
||
*.dot | ||
*.json |
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
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
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
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
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
Oops, something went wrong.