Zulip Chat Archive
Stream: general
Topic: push coe
Johan Commelin (Sep 19 2019 at 06:47):
I've complained that ring didn't do its job (sorry @Mario Carneiro) but I figured out what's wrong.
Here's the example that I had:
example (k : ℕ) {x y : ℕ} : (x * x + y * y : ℤ) - ↑((x * y + 1) * k) = ↑y * ↑y - ↑k * ↑x * ↑y + (↑x * ↑x - ↑k) := begin ring, end
The reason that ring fails, is that the coercion ↑((x * y + 1) * k) first needs to be pushed through the products and sum.
Johan Commelin (Sep 19 2019 at 06:48):
simp can do that, but you end up with a non-terminal simp, or an ugly simp only line.
Mario Carneiro (Sep 19 2019 at 06:48):
does norm_cast help?
Johan Commelin (Sep 19 2019 at 06:48):
Nope
Mario Carneiro (Sep 19 2019 at 06:49):
I forget if I've said this before, but nonterminal simp is fine if it is followed by a "blasty" tactic, which doesn't care so much about the exact form of the goal
Johan Commelin (Sep 19 2019 at 06:49):
I guess the hom tactic would help. But it is still under construction.
Scott Morrison (Sep 19 2019 at 06:49):
This has nothing to do with hom, I thought.
Scott Morrison (Sep 19 2019 at 06:50):
Isn't this exactly the sort of thing that norm_cast and friends are for?
Scott Morrison (Sep 19 2019 at 06:50):
Maybe we're just missing some attributes on lemmas.
Johan Commelin (Sep 19 2019 at 06:54):
Ok, maybe we need to add attributes to int.coe_mul or something like that...
Johan Commelin (Sep 19 2019 at 06:54):
Anyway, I've pushed again. For the moment I'll just prove them with simp, ring
Kevin Buzzard (Sep 19 2019 at 07:06):
you can find simp, ring in complex.lean in mathlib IIRC
Rob Lewis (Sep 19 2019 at 08:12):
Yeah, this looks like exactly what norm_cast should do, so there's probably a missing attribute. simp, ring is fine here but norm_cast, ring would be better.
Last updated: May 02 2025 at 03:31 UTC