Skip to content

Weird behaviour of reduction of coq terms #639

@FissoreD

Description

@FissoreD

Minimal example with the error:

From elpi Require Import elpi.

Elpi Tactic A.

Section S.

  Inductive Foo (N : Type) (N : Type).
  Context (A : Type).

  Elpi Accumulate  lp:{{
    solve (goal Ctx _ (prod _ T Bo) _ _) _ :- !,
      @pi-decl `A` T x\ solve (goal Ctx _ (Bo x) _ _) _.
    solve (goal _ _ T _ _) _ :- 
      % ====> I expect that T1 is the same term as T
      @redflags! coq.redflags.nored => coq.reduction.lazy.norm T T1,
      std.assert! (T = T1) "should be equal".
  }}.
  Elpi Typecheck.

  Goal forall a, Foo A a.
    elpi A.
  Abort.

End S.

Error message due to std.assert!:

should be equal: app [global (indt «Foo»), global (const «A»), c0] = app [global (indt «Foo»), c0, c0]

Note that the first argument of Foo in the result is not A but c0
Similar APIs like coq.reduction.lazy.whd give the same problem
Moreover, the same error happens for any kind of reduction passed to @redflags!, e.g. @redflags! coq.redflags.beta => coq.reduction.lazy.whd T T1 is also broken

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions