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
contradiction
does not unify universes enough
#18870
Labels
kind: bug
An error, flaw, fault or unintended behaviour.
part: universes
The universe system.
wellknown: universe polymorphism Ltac compat
Turning on universe polymorphism needlessly breaks some tactic scripts
Comments
andres-erbsen
added
part: universes
The universe system.
kind: bug
An error, flaw, fault or unintended behaviour.
needs: triage
The validity of this issue needs to be checked, or the issue itself updated.
wellknown: universe polymorphism Ltac compat
Turning on universe polymorphism needlessly breaks some tactic scripts
labels
Mar 30, 2024
What makes you think they're monomorphic? Aren't they just proof local universes? |
You're probably right; but in that case, how would you describe the issue? (Do you see an issue with this behavior at all?) |
contradiction doesn't unify universes enough |
andres-erbsen
changed the title
"
Mar 30, 2024
apply
.. in
.." creates monomorphic universescontradiction
does not unify universes enough
andres-erbsen
removed
the
needs: triage
The validity of this issue needs to be checked, or the issue itself updated.
label
Mar 30, 2024
Basically Polymorphic Axiom T : Type.
Goal T(*@{u}*) -> (T(*@{v}*) -> False) -> False.
intros.
contradiction.
(* no such contradiction *) |
A patch like modified tactics/contradiction.ml
@@ -49,8 +49,11 @@ let filter_hyp f tac =
| [] ->
let info = Exninfo.reify () in
Proofview.tclZERO ~info Not_found
- | d::rest when f (NamedDecl.get_type d) -> tac (NamedDecl.get_id d)
- | _::rest -> seek rest in
+ | d::rest -> begin match f (NamedDecl.get_type d) with
+ | Some sigma -> Proofview.Unsafe.tclEVARS sigma <*> tac (NamedDecl.get_id d)
+ | None -> seek rest
+ end
+ in
Proofview.Goal.enter begin fun gl ->
let hyps = Proofview.Goal.hyps gl in
seek hyps
@@ -88,7 +91,7 @@ let contradiction_context =
Tacticals.tclZEROMSG ~info (Pp.str"Not a negated unit type."))
(Proofview.tclORELSE
(Proofview.Goal.enter begin fun gl ->
- let is_conv_leq = Tacmach.pf_apply is_conv_leq gl in
+ let is_conv_leq = Tacmach.pf_apply (infer_conv ~pb:CUMUL) gl in
filter_hyp (fun typ -> is_conv_leq typ t)
(fun id' -> simplest_elim (mkApp (mkVar id,[|mkVar id'|])))
end)
@@ -105,8 +108,9 @@ let contradiction_context =
let is_negation_of env sigma typ t =
match EConstr.kind sigma (whd_all env sigma t) with
| Prod (na,t,u) ->
- is_empty_type env sigma u && is_conv_leq env sigma typ t
- | _ -> false
+ if is_empty_type env sigma u then infer_conv ~pb:CUMUL env sigma typ t
+ else None
+ | _ -> None
let contradiction_term (c,lbind as cl) =
Proofview.Goal.enter begin fun gl -> would make it work but not sure if that's what we want. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
kind: bug
An error, flaw, fault or unintended behaviour.
part: universes
The universe system.
wellknown: universe polymorphism Ltac compat
Turning on universe polymorphism needlessly breaks some tactic scripts
Description of the problem
I got curious what the situation with universe polymorphism is like these days, so I tried out what it would be like to use it for lists. Right in
List.v
I hit what looks like a real footgun. The positive side is that almost 2/3 of stdlib (by cloc) still builds with these changes 🙃Small Coq file to illustrate the bug
Cherry-pick the commit below for actual repro.
Version of Coq where this bug occurs
bd7a105
Last version of Coq where the bug did not occur
No response
The text was updated successfully, but these errors were encountered: