-
Notifications
You must be signed in to change notification settings - Fork 236
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
Universes for val
generalized independently of the corresponding let
#604
Comments
This seems to be caused by universe polymorphism. Replacing
makes this work. No longer sure whether this can be blamed on F* or on my bad understanding of universes.
|
Can you add I think I see the problem: When you write a That means, steps_preserves_red is polymorphic in at 3 universes; 1 for Of course, the definition is only polymorphic in 2 universes, since the result is in the same universe as hp. Hence the complaint. There are several fixes:
|
val
generalized independently of the corresponding let
@nikswamy Thanks for explaining. There are a couple of things F* could do better here:
|
@nikswamy Thanks for the explanations on #689
|
Hmm. This last bit seems to be an unrelated issue. It has more to do with instantiating implicit arguments in than universes. I'm looking into it ... will probably create a separate issue for it. |
You should be able to work around it in the mean time by making
|
Here's a more concise example: module M
#set-options "--print_universes --print_bound_var_types"
val foo: Type -> Type
let foo t = t
(*
(Error) Expected expression of type "Type('uu___17)"; got expression "t" of type "Type('uu___18)"
*) As expected, |
A partial fix for this is to be explicit about universes i.e. val foo: Type 'ua -> Type 'ua
let foo t = t |
Here's another instance, which does not work even naming the universe in the val. val poly2 : (#a:Type u#ua -> a -> list a) -> (list int & list bool)
let poly2 f = (f 1, f true) |
Sorry, that was silly, the problem with the above is that there is no higher-order universe polymorphism. It doesn't work even if one just uses a |
Since interfaces are checked and used separately from their definitions, there's no way in the current design to infer the universes annotation of vals while accounting for their corresponding definitions. Addressing this will require redesigning how interfaces work. |
Some of the stlc-norm proofs that used to cause F* to blow up because of #577 now fail in subtler ways. I could minimize it to this:
which fails as follows:
So in this case F* can apparently prove that
e == e'
, but it still cannot turn a proof ofpred e
into a proof ofpred e'
. This seems like a regression.The text was updated successfully, but these errors were encountered: