-
Notifications
You must be signed in to change notification settings - Fork 640
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
Universe minimization failure during typeclass search #11252
Comments
Here is a more minimized version of this bug, doesn't seem to have anything to do with indices-matter specifically, just the number of universe variables that gives. Set Universe Polymorphism.
(** Relations *)
Definition Relation (A : Type) := A -> A -> Type.
Class Symmetric {A} (R : Relation A) :=
symmetry : forall x y, R x y -> R y x.
(** Paths *)
Axiom paths_indmat@{u} : forall {A : Type@{u}}, A -> A -> Type@{u}.
Axiom paths@{u v} : forall {A : Type@{u}}, A -> A -> Type@{v}.
Axiom Equiv@{u v} : Type@{u} -> Type@{v} -> Type@{max(u,v)}.
Global Instance symmetric_equiv : Symmetric Equiv | 0. Proof. Admitted.
(** Bug *)
Set Typeclasses Debug.
Axiom A : Type.
Axiom B : Type.
(** Indices don't matter *)
Goal Equiv A (paths A B).
Proof.
(* symmetry. *)
let R := match goal with |- ?R ?x ?y => constr:(R) end in
let x := match goal with |- ?R ?x ?y => constr:(x) end in
let y := match goal with |- ?R ?x ?y => constr:(y) end in
let t := constr:(@symmetry _ R _) in
let t' := (eval cbn in t) in
refine (t' y x _); change (R y x).
Abort.
Definition foo {X Y : Type}
: Equiv X (paths X Y).
Proof.
(* symmetry. *)
let R := match goal with |- ?R ?x ?y => constr:(R) end in
let x := match goal with |- ?R ?x ?y => constr:(x) end in
let y := match goal with |- ?R ?x ?y => constr:(y) end in
let t := constr:(@symmetry _ R _) in
let t' := (eval cbn in t) in
refine (t' y x _); change (R y x).
Abort.
(** Indices do matter *)
Goal Equiv A (paths_indmat A B).
Proof.
(* symmetry. *)
let R := match goal with |- ?R ?x ?y => constr:(R) end in
let x := match goal with |- ?R ?x ?y => constr:(x) end in
let y := match goal with |- ?R ?x ?y => constr:(y) end in
let t := constr:(@symmetry _ R _) in
let t' := (eval cbn in t) in
refine (t' y x _); change (R y x).
Abort.
Definition foo {X Y : Type}
: Equiv X (paths_indmat X Y).
Proof.
(* symmetry. *)
let R := match goal with |- ?R ?x ?y => constr:(R) end in
let x := match goal with |- ?R ?x ?y => constr:(x) end in
let y := match goal with |- ?R ?x ?y => constr:(y) end in
let t := constr:(@symmetry _ R _) in
let t' := (eval cbn in t) in
refine (t' y x _); change (R y x).
Abort.
|
Hmm but after minimizing this a bit more, it seems that it is really an issue of design then a bug. Having |
What's the failure exactly? |
The |
Why can't the univs be unified? |
In general they can, but in this example there was a constraint causing one to be larger than the other. |
Description of the problem
We noticed the following in the HoTT library in HoTT/Coq-HoTT#1153.
The following code fails when compiling with -indices-matter:
Jason observed the following:
The thing you are missing is
-indices-matter
. If I addand put this all in
bar.v
then withcoqc -q bar.v
I getand no error at the bottom, while with
coqc -q -indices-matter bar.v
I getCoq Version
The text was updated successfully, but these errors were encountered: