Skip to content

eapply fails where simple eapply succeeds (universes and primitive arrays) #21674

@fpottier

Description

@fpottier

Description of the problem

I am writing (the beginning of) a library that is supposed to help make Rocq's primitive arrays more usable. I am using Rocq 9.1. I have run into situations where eapply fails with a unification error that involves universe levels, yet simple eapply succeeds.

I have asked for help in this Zulip thread. @Janno has been able to simplify my problem into this minimal example:

Require Import Corelib.Array.PrimArray.
Axiom P : forall A t i (a:A), get t i = a.
Axiom Q : forall A a i, @length@{length.u0} A a = i.
Lemma test : forall A a i, @length@{P.u0} A a = i.
Proof.
  intros A a i.
  Succeed refine (Q _ _ _).
  Succeed simple eapply Q.
  Fail eapply Q.
  Constraint P.u0 = length.u0.
  Succeed eapply Q.
Abort.

Apparently eapply should introduce a universe constraint but does not (and fails). This seems to be a bug.

A separate question is whether primitive arrays should be universe-polymorphic.

Small Rocq / Coq file to reproduce the bug

Version of Rocq / Coq where this bug occurs

No response

Interface of Rocq / Coq where this bug occurs

No response

Last version of Rocq / Coq where the bug did not occur

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind: bugAn error, flaw, fault or unintended behaviour.part: unificationThe unification mechanism.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions