leanprover-community / mathlib4

The math library of Lean 4
https://leanprover-community.github.io/mathlib4_docs
Apache License 2.0
1.51k stars 332 forks source link

`to_additive` feature requests / issues #1074

Open fpvandoorn opened 1 year ago

fpvandoorn commented 1 year ago

This is a single issue for new features or feature requests for to_additive, that I'll try to keep up-to-date. Feel free to comment with other suggestions

YaelDillies commented 10 months ago

to_additive does not seem to support the auxiliary lemmas generated by norm_cast: See #8916

fpvandoorn commented 10 months ago

Can you please minimize the example?

YaelDillies commented 10 months ago

Is this minimal enough?

import Mathlib.Data.Finset.Pointwise

open scoped Pointwise

@[to_additive]
lemma mul_foo {α : Type*} [DecidableEq α] [Mul α] (s t : Finset α) :
    (↑(s * t) : Set α) = ↑s * ↑t := by norm_cast
/-
application type mismatch
  Mathlib.Data.Finset.Pointwise._auxLemma.9
argument has type
  Add α
but function has type
  ∀ [inst : Mul α] (s t : Finset α), ↑s * ↑t = ↑(s * t)
-/
fpvandoorn commented 10 months ago

Yes, thanks! This was actually already a todo in the code. I will see if I can find a more systematic way to additivize new declarations generated attributes.

fpvandoorn commented 3 months ago

norm_cast handling is fixed in #14628