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

simp failing with unexpected bound variable #3705

Closed
kim-em opened this issue Mar 17, 2024 · 0 comments · Fixed by #3819
Closed

simp failing with unexpected bound variable #3705

kim-em opened this issue Mar 17, 2024 · 0 comments · Fixed by #3819
Assignees
Labels
bug Something isn't working

Comments

@kim-em
Copy link
Collaborator

kim-em commented Mar 17, 2024

Initially reported as leanprover-community/mathlib4#11357, minimisation below due to @mattrobball:

structure MonoidHom (M : Type _) (N : Type _) [Mul M] [Mul N] where
  toFun : M → N
  map_mul' : ∀ x y, toFun (x * y) = toFun x * toFun y

class CommMagma (G : Type _) extends Mul G where
  mul_comm : ∀ a b : G, a * b = b * a

set_option quotPrecheck false
infixr:25 " →*' " => MonoidHom

instance [Mul M] [Mul N] : CoeFun (M →*' N) (fun _ => M → N) where
  coe := MonoidHom.toFun

open CommMagma

-- -- this instance needed
instance MonoidHom.commMonoid [Mul M] [Mul N] :
    CommMagma (M →*' N) where
  mul := fun f g => { toFun := fun x => f x * g x, map_mul' := sorry }
  mul_comm := sorry

example {M} [Mul M] [Mul G] [Pow G Int] :
    let zpow : Int → (M →*' G) → (M →*' G) := fun n f => { toFun := fun x => f x ^ n, map_mul' := sorry }
    ∀ (n : Nat) (a : M →*' G), zpow (Int.ofNat (Nat.succ n)) a = a * zpow (Int.ofNat n) a := by
  simp only [Int.ofNat_eq_coe] -- commenting out this line makes simp loop
  simp only [mul_comm] -- unexpected bound variable 2 
  sorry
@kim-em kim-em added the bug Something isn't working label Mar 17, 2024
leodemoura added a commit that referenced this issue Apr 1, 2024
github-merge-queue bot pushed a commit that referenced this issue Apr 1, 2024
Closes #3705 

This PR also fixes a performance issue at `ACLt` also exposed by example
at #3705
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

Successfully merging a pull request may close this issue.

2 participants