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

Instant stack overflow upon defining type class instance #6258

Open
3 tasks done
FWuermse opened this issue Nov 29, 2024 · 0 comments
Open
3 tasks done

Instant stack overflow upon defining type class instance #6258

FWuermse opened this issue Nov 29, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@FWuermse
Copy link

Prerequisites

Please put an X between the brackets as you perform the following steps:

Description

When defining a type class instance (Proper), the program immediately runs into a stack overflow error. It may be related to #6229 but the error occurs instantly.

Context

I'm translating the Coq type classes and instances proposed in the paper "A New Look at Generalized Rewriting in Type
Theory" by Matthieu Sozeau.

This relates to this channel: https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/Rewriting.20congruent.20relations

Steps to Reproduce

def Relation (α : Sort u) := α → α → Prop

def respectful {α β : Sort u} (r : Relation α) (r' : Relation β) : Relation (α → β) :=
  fun f g => ∀ x y, r x y → r' (f x) (g y)

notation:55 r "" r' => respectful r r'

class Proper {α : Sort u} (r : Relation α) (m : α) where
  proper : r m m

class Subrel {α : Sort u} (q r : Relation α) : Prop where
  subrelation : ∀ x y, q x y → r x y

instance : Proper (@Subrel β ⟹ @Subrel (α → β)) sorry := sorry

Expected behaviour: Goal view shows types and assists me with implementing the instance.

Actual behavior: Lean Server crashes with "Lean server printed an error: Stack overflow detected. Aborting."

Versions

Lean 4.13.0, Lean 4.14.0-rc1, Lean 4.14.0-rc2, Lean 4.14.0-rc3
Target: arm64-apple-darwin23.6.0 macOS

live.lean-lang.org:
Lean 4.15.0-nightly-2024-11-28
Target: x86_64-unknown-linux-gnu

Additional Information

I tested this locally on linux as well and ran into the same issue.

Impact

Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.

@FWuermse FWuermse added the bug Something isn't working label Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant