Skip to content

Wrong computation of non-uniform parameters breaks the generation of nested eliminators #21497

@thomas-lamiaux

Description

@thomas-lamiaux

Description of the problem

This code makes the new generation of the induction principle bug, it seems to be due to n being wrongfully computed as a uniform parameter

Small Rocq / Coq file to reproduce the bug

Set Debug "backtrace".
Set Debug "generate_eliminators".

(* Preliminary to be testable without the prelude *)
Notation "A -> B" := (forall (_ : A), B) (right associativity, at level 99).

(* This needs to be registered *)
Inductive unit : Set :=
    tt : unit.

Register unit as core.unit.type.
Register tt as core.unit.tt.

Inductive prod (A B : Type) : Type :=
pair : A -> B -> prod A B.

Arguments pair {_ _}.

#[universes(polymorphic)]
Inductive prod_all@{sa sb ; ua ub +} A (PA : A -> Type@{sa;ua}) B (PB : B -> Type@{sb;ub}) : prod A B -> Type :=
pair_all : forall a, PA a -> forall b, PB b -> prod_all A PA B PB (pair a b).

#[universes(polymorphic)]
Definition prod_all_forall@{sa sb ; ua ub +} A (PA : A -> Type@{sa;ua}) (HPA : forall a, PA a)
                    B (PB : B -> Type@{sb;ub}) (HPB : forall b, PB b) :
                    forall (x : prod A B), prod_all A PA B PB x :=
fun x => match x with
| pair a b => pair_all A PA B PB a (HPA a) b (HPB b)
end.

Register Scheme prod_all as All for prod.
Register Scheme prod_all_forall as AllForall for prod.

Variant Box (F  : unit -> Type) := .

Inductive Cut (x : unit) : Type :=
| triv : Box (fun n => prod (Cut n) unit) -> Cut x.

Version of Rocq / Coq where this bug occurs

master

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.needs: triageThe validity of this issue needs to be checked, or the issue itself updated.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions