Zulip Chat Archive

Stream: general

Topic: simp puzzles


Floris van Doorn (Apr 19 2021 at 01:42):

Consider the following proof:

import data.set.basic
example {α β} (f g : α  β) (h :  x, f x = g x) (s : set α) : f '' s = g '' s :=
by simp*

Puzzle 1: Explain why simp succesfully proves this. (I will post the solution below.)
Puzzle 2: Is there any simp only [h, ...] invocation that solves this, using only lemmas that simp* used? simp only [h, set.image] works but doesn't count, because simp* didn't unfold set.image. (I have no idea how to do it / whether this is possible.)

This came up in #7250.

Floris van Doorn (Apr 19 2021 at 01:44):

Solution to puzzle 1

Floris van Doorn (Apr 19 2021 at 01:49):

Thoughts on puzzle 2

Mario Carneiro (Apr 19 2021 at 01:52):

congr lemmas aren't part of the simp set

Floris van Doorn (Apr 19 2021 at 02:02):

But simp [h, - set.image_congr] removes set.image_congr from something (the congr-set?). Can we make it so that simp only [h, set.image_congr] adds set.image_congr to that set?

Mario Carneiro (Apr 19 2021 at 02:02):

isn't that ambiguous? set.image_congr is a very bad simp lemma

Mario Carneiro (Apr 19 2021 at 02:03):

actually it's probably ineligible

Floris van Doorn (Apr 19 2021 at 02:06):

Maybe it is ambiguous, but can we allow simp to use congr-lemmas from the provided names? Currently it seems like we have a thing that simp can do but no simp only [...] invocation can do, which is bad when using squeeze_simp.

Mario Carneiro (Apr 19 2021 at 02:31):

I think the functionality is a good idea but I'm not sure how to make the syntax work

Mario Carneiro (Apr 19 2021 at 02:32):

we could do something like simp only [lemmas...] using congr [lemmas...]?


Last updated: Dec 20 2023 at 11:08 UTC