-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Compile more of ink_env.v 13 - experimental #225
Draft
bartlomiejkrolikowski
wants to merge
13
commits into
main
Choose a base branch
from
bk@compile-more-of-ink_env-13-experimental
base: main
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
Compile more of ink_env.v 13 - experimental #225
bartlomiejkrolikowski
wants to merge
13
commits into
main
from
bk@compile-more-of-ink_env-13-experimental
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
I tried to use tactics to automatically extract instances (with instances of related superclasses) related to associated types from other instances. |
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.
The continuation of #222.
Trying to use tactics to define instances of traits of associated types:
Problem:
The associated types and their bounds are now translated to fields of a typeclass.
This causes a problem because Coq cannot automatically find the instances places inside those fields when they are needed.
For example:
will be translated to
and later in a function
Definition some_fn {T : Set} `{SomeTrait.Trait T} : SomeStruct SomeTrait.AssocTy := ...
Coq is not aware of the instance of
OtherTrait.Trait AssocTy
and the code above does not compile.My solution to this was to define an alias for the instance outside the typeclass in the following way:
The problem I tried to solve in this PR was that sometimes traits have supertraits, that are translated into superclasses which are just parameters of the class constructor.
Because they are parameters they have to be provided in order to use the class constructor in place of the type in instance definition:
but because the only instance of the class avaliable to us is the one in a field of another class we have to extract them first.
My solutoin to that is to use tactics to automatically write the type of the instance we want to define, so an instance of
OtherTrait AssocTy
would be defined in the following way:Unfortunately, it slows down the compilation by Coq and eats all the avaliable memory.
Another problem with it is that, although that code creates instances of desired classes (what I checked with
Check I ?[H] : OtherTrait (AssocTy (Trait := H)).
) Coq still doesn't apply this instance in places where it is necessary.
Unfortunatelly I wasn't able to find a better solution.
I uploaded the file in which I was testing out different solutions and marked the place that simulates the problem.
It may serve as a further clarification of what I am trying to do.
It is named
experiment.v
and I put it intmp
directory.