-
Notifications
You must be signed in to change notification settings - Fork 694
Fix occurrence checker not checking evar insts #21009
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
base: master
Are you sure you want to change the base?
Conversation
@coqbot run full ci |
I am not sure I understand the third test in |
@coqbot run full ci |
pretyping/typing.ml
Outdated
let ty = EConstr.existential_type sigma ev in | ||
let sigma, jty = execute env sigma ty in | ||
let sigma, jty = assumption_of_judgment env sigma jty in | ||
let jty = Retyping.get_type_of env sigma ty in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong, retyping assume the argument to be well-typed but here we precisely don't know about ty
yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also maybe we should be checking the evar arguments instead of the substituted type? ie if we have an evar ?e : nat
with context x : nat
, S ?e@{x := true}
would be accepted by typing.ml in master but the (valid) instantiation ?e := x
would then turn it into an invalid term S true
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[at]SkySkimmer Is this (1d73de2) what you mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is closer but still not enough. You need to check that the telescope type associated to the evar is compatible with the argument types, i.e. basically the same as the application rule.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yes, thank you. I know about No, wait, nevermind, I did not look hard enough at existential_type
which if I understand correctly is the substituted type and evar_concl
which according to the code of existential_type
looks like it is the non-substituted type but without the telescope. Can I find the telescope somewhere?evar_info
, let me try again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No sorry, I am lost. I thought Evd.evar_context
might be it, but it does not have the correct length, I find more items in evar_context
than in the arguments list. May I ask for a hint?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Evd.evar_filtered_context I believe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that is it, thank you. I assume the Nevermind, I tested and they are not aligned. Are they not supposed to be?LocalDef
declarations are supposed to match the Default
from the arguments list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue in Case13.v
looks a lot like a bug in the compilation of matches. In prepare_predicate_from_arsign_tycon
, the let p = predicate 0 c in
line changes the argument of the evar c
by something else, but this argument can appear in the type of other arguments which are not changed, so p
is ill-typed.
More precisely,
env = [] [(z : ?X60) (Q : ?X61@{__:=z}) (y : K CSTR.bool._0._1 z) (f : forall z : bool, Q z)]
c = ?X64@{{__:=#4; __:=#3; __:=#2; __:=#1}
env' = [] [(z : ?X60) (Q : ?X61@{__:=z}) (y : K CSTR.bool._0._1 z) (f : forall z : bool, Q z) (_ _ : bool) (y : K #2 #1)]
p = ?X64@{__:=#2; __:=#6; __:=#5; __:=#4}
Reopening of #18966.
Fixes / closes #18965
make doc_gram_rsts
.