Skip to content
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

Structural recursion produces application type mismatch #2130

Closed
1 task done
fpfu opened this issue Mar 3, 2023 · 1 comment
Closed
1 task done

Structural recursion produces application type mismatch #2130

fpfu opened this issue Mar 3, 2023 · 1 comment

Comments

@fpfu
Copy link

fpfu commented Mar 3, 2023

Prerequisites

  • Put an X between the brackets on this line if you have done all of the following:
    • Checked that your issue isn't already filed.
    • Reduced the issue to a self-contained, reproducible test case.

Steps to Reproduce

inductive TyBox
| mk (ty: Type) : TyBox

inductive Foo: Type → Type
def Foo.ty_box (_: Foo α): TyBox := .mk α

mutual
  inductive Bar : Type → Type 1
  | mk (foo: Foo α) (box: BarBox foo.ty_box) : Bar α

  inductive BarBox : TyBox → Type 1
  | mk (bar: Bar α): BarBox (.mk α)
end

def toFoo : Bar α → Foo α
| ⟨_, .mk f ⟩ => toFoo f

Expected behavior: example works

Actual behavior: get an error message:

fail to show termination for
  toFoo
with errors
argument #2 was not used for structural recursion
  application type mismatch
    @Bar.brecOn (fun {α} x => Foo α) α
  argument
    α
  has type
    Type : Type 1
  but is expected to have type
    (a : TyBox) → BarBox a → Type : Type 1

structural recursion cannot be used

failed to prove termination, use `termination_by` to specify a well-founded relation

Reproduces how often: 100%

Versions

nightly-2023-03-01

@Kha
Copy link
Member

Kha commented Feb 18, 2025

Works in 4.16.0

@Kha Kha closed this as completed Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants