Skip to content

Guard checking regression #17062

@mattam82

Description

@mattam82

Description of the problem

The following is no longer accepted in Coq 8.16:

Inductive box P := box_intro : P -> box P.
Inductive P := P_intro : box P -> P.

Fixpoint size (d : P) {struct d} : nat :=
  let 'P_intro p := d in
  match tt as t
  return box (match t with tt => P end) -> nat
  with
  | tt => fun tu =>
      size (let 'box_intro _ tu' := tu in tu')
  end p. 

With a quite strange error message:

Recursive definition of size is ill-formed.
In environment
size : P -> nat
d : P
p : box P
tu : box match tt with
         | tt => P
         end
Recursive call to size has principal argument equal to "let 'box_intro _ tu' := tu in tu'" instead of one of the following variables: "p" "tu".
Recursive definition is: "fun '(P_intro p) => match tt as t return (box match t with
                                                                        | tt => P
                                                                        end -> nat) with
                                              | tt => fun tu : box match tt with
                                                                   | tt => P
                                                                   end => size (let 'box_intro _ tu' := tu in tu')
                                              end p".

Obviously tu' is a subterm of tu. This might be interacting with the restriction on eliminations (due to the return (box (match t with tt P end -> nat) presumably. But it used to work in 8.15, so it is more likely to have been introduced by the changes of @herbelin

Coq Version

= 8.16

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind: regressionProblems that were not present in previous versions.part: fixpointsAbout Fixpoint, fix and mutual statementspart: inductivesInductive types, fixpoints, etc.
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions