Zulip Chat Archive

Stream: general

Topic: setext


view this post on Zulip Patrick Massot (Apr 16 2018 at 16:14):

Core lib has a funext tactic which allows to replace apply funext, intro x by funext x. Would it be a good idea to copy the definition of this tactic to get a setext tactic?

view this post on Zulip Kenny Lau (Apr 16 2018 at 16:14):

the funext tactic is really repeat {apply funext, intro x} though

view this post on Zulip Kenny Lau (Apr 16 2018 at 16:15):

but right, set.ext can only be used once

view this post on Zulip Kenny Lau (Apr 16 2018 at 16:15):

well you can just set setext to be apply set.ext; intro x

view this post on Zulip Patrick Massot (Apr 16 2018 at 16:16):

I want x to be an argument of the tactic

view this post on Zulip Kenny Lau (Apr 16 2018 at 16:16):

sure

view this post on Zulip Patrick Massot (Apr 16 2018 at 16:16):

It's mostly a cosmetic question, but also about consistency

view this post on Zulip Patrick Massot (Apr 16 2018 at 16:17):

Because I keep trying setext x before remembering it doesn't work yet

view this post on Zulip Mario Carneiro (Apr 16 2018 at 17:35):

@Simon Hudon I recall discussing a generic ext tactic as a complement to the monotonicity tactic, perhaps it would help here

view this post on Zulip Simon Hudon (Apr 16 2018 at 17:38):

Yes, I have it in lean-lib. I can create a pull request. I have a extensionality attribute that I used to tag extentionality on sets, stream and maybe other things too

view this post on Zulip Patrick Massot (Apr 16 2018 at 20:02):

nice

view this post on Zulip Simon Hudon (Apr 16 2018 at 20:53):

I just submitted a pull request: https://github.com/leanprover/mathlib/pull/104

view this post on Zulip Simon Hudon (Apr 16 2018 at 20:54):

In tests/examples.lean you should see a bunch of situations where ext is useful.

view this post on Zulip Simon Hudon (Apr 16 2018 at 20:54):

Let me know if you think there should be more extensionality lemmas

view this post on Zulip Patrick Massot (Apr 16 2018 at 20:55):

Thanks!

view this post on Zulip Patrick Massot (Apr 16 2018 at 20:55):

Can you give it names like with funext?

view this post on Zulip Patrick Massot (Apr 16 2018 at 20:56):

Oh, you put sorries in tests again :disappointed:

view this post on Zulip Simon Hudon (Apr 16 2018 at 20:57):

Yes. ext will apply all extensionality lemmas that make sense while ext a b c will only apply three (not necessarily the same) and name the introduced locals a,b, c,

view this post on Zulip Patrick Massot (Apr 16 2018 at 20:57):

What is this ext1 I see in tests? Apply it only once?

view this post on Zulip Patrick Massot (Apr 16 2018 at 20:57):

like congr_n 1?

view this post on Zulip Simon Hudon (Apr 16 2018 at 20:57):

It shouldn't affect the built because the final proof is just trivial

view this post on Zulip Patrick Massot (Apr 16 2018 at 20:57):

Ahah

view this post on Zulip Simon Hudon (Apr 16 2018 at 20:58):

I don't know of congr_n 1 but it sounds like you got the right idea

view this post on Zulip Simon Hudon (Apr 16 2018 at 20:59):

(I'm so glad congr_n exists! I'll be able to use that now!)

view this post on Zulip Patrick Massot (Apr 16 2018 at 21:00):

I was looking to my mathlib tactics docs to point to and, shame on me, I didn't include congr_n! :disappointed:

view this post on Zulip Simon Hudon (Apr 16 2018 at 21:00):

shake head in disapproval

view this post on Zulip Simon Hudon (Apr 16 2018 at 21:03):

Would it be useful to have a monoid and add_monoid instance for fin n in mathlib?

view this post on Zulip Patrick Massot (Apr 16 2018 at 21:06):

What would be the law? Again some truncation thing?

view this post on Zulip Simon Hudon (Apr 16 2018 at 21:07):

Yes. It would be modulo arithmetic with the modulo baked into the type

view this post on Zulip Patrick Massot (Apr 16 2018 at 21:08):

Oh, modulo

view this post on Zulip Patrick Massot (Apr 16 2018 at 21:08):

That's a bit sneaky

view this post on Zulip Patrick Massot (Apr 16 2018 at 21:08):

https://github.com/leanprover/mathlib/pull/105

view this post on Zulip Simon Hudon (Apr 16 2018 at 21:09):

What kind of sneaky? Evil-sneaky or just effective-sneaky?

view this post on Zulip Patrick Massot (Apr 16 2018 at 21:10):

I don't know. People could be taken off guard. But who would want to add elements of fin n anyway?

view this post on Zulip Simon Hudon (Apr 16 2018 at 21:10):

After a quick survey, there's me

view this post on Zulip Simon Hudon (Apr 16 2018 at 21:13):

The other alternative I see is the p ≡ q [MOD k] notation but that looks more restricted. fin n is usable in other contexts that congruences or equalities.

view this post on Zulip Patrick Massot (Apr 16 2018 at 21:14):

I notice your ext PR doesn't include documentation :unamused:

view this post on Zulip Simon Hudon (Apr 16 2018 at 21:15):

What's this documentation thing?

view this post on Zulip Simon Hudon (Apr 16 2018 at 21:15):

Alright, I'll add a comment :)

view this post on Zulip Simon Hudon (Apr 16 2018 at 21:15):

Is that better?

view this post on Zulip Patrick Massot (Apr 16 2018 at 21:16):

By the way, you told me we found a bug in wlog when I asked questions about it. Did you manage to fix it?

view this post on Zulip Simon Hudon (Apr 16 2018 at 21:17):

That's true! I forgot about it. It was pretty tricky. I'll get back to it.

view this post on Zulip Simon Hudon (Apr 16 2018 at 21:17):

Sorry for the delay

view this post on Zulip Patrick Massot (Apr 16 2018 at 21:17):

Adding a docstring to tactic/interactive.lean would be good enough. Then I can copy it to tactic.md

view this post on Zulip Patrick Massot (Apr 16 2018 at 21:17):

But in this case I could also write the docstring I guess

view this post on Zulip Patrick Massot (Apr 16 2018 at 21:18):

The problem is I could write nonsense

view this post on Zulip Patrick Massot (Apr 16 2018 at 21:19):

There is no delay problem with wlog, I was only asking so you don't forget

view this post on Zulip Simon Hudon (Apr 16 2018 at 21:19):

Thanks for reminding me

view this post on Zulip Patrick Massot (Apr 16 2018 at 21:20):

Speaking of documentation, I wonder if @Sebastian Ullrich of @Gabriel Ebner could answer Kevin's questions in https://github.com/leanprover/mathlib/blob/master/docs/extras/calc.md (you only need to search for "Kevin" in this file)

view this post on Zulip Simon Hudon (Apr 16 2018 at 21:20):

I'll write both no worries. I was joking.

view this post on Zulip Kevin Buzzard (Apr 16 2018 at 21:22):

I'm not at a computer right now, but IIRC I think fin n already has an + but it is not very well behaved!

view this post on Zulip Simon Hudon (Apr 16 2018 at 21:23):

Actually, I think - is more problematic. And we don't have laws for them

view this post on Zulip Kevin Buzzard (Apr 16 2018 at 21:24):

My memory is that these structures on fin n are defined in core and didn't make it into a sensible mathematical object

view this post on Zulip Kevin Buzzard (Apr 16 2018 at 21:24):

I think 2+2 wasn't 2-2 in fin 4 for example

view this post on Zulip Kevin Buzzard (Apr 16 2018 at 21:25):

Docs -- yes I'd forgotten I'd left those in!

view this post on Zulip Patrick Massot (Apr 16 2018 at 21:25):

#reduce (2 : fin 4) - (2 : fin 4) -- ⟨0, _⟩

view this post on Zulip Patrick Massot (Apr 16 2018 at 21:26):

#reduce (2 : fin 4) + (2 : fin 4) -- ⟨0, _⟩

view this post on Zulip Kevin Buzzard (Apr 16 2018 at 21:26):

Try 1+2 and 1-2

view this post on Zulip Kevin Buzzard (Apr 16 2018 at 21:26):

Maybe that was it

view this post on Zulip Patrick Massot (Apr 16 2018 at 21:27):

1+2 is 3 and 1 - 2 is 0

view this post on Zulip Kevin Buzzard (Apr 16 2018 at 21:27):

2+2=0 so adding 2 and subtracting 2 should be the same

view this post on Zulip Kevin Buzzard (Apr 16 2018 at 21:27):

Thanks

view this post on Zulip Patrick Massot (Apr 16 2018 at 21:27):

hard to tell what is the rule here

view this post on Zulip Patrick Massot (Apr 16 2018 at 21:27):

it seems substration is truncated at zero

view this post on Zulip Kevin Buzzard (Apr 16 2018 at 21:27):

Subtracting is just subtraction on nat I think

view this post on Zulip Patrick Massot (Apr 16 2018 at 21:28):

and addition wraps

view this post on Zulip Kevin Buzzard (Apr 16 2018 at 21:28):

Right

view this post on Zulip Kevin Buzzard (Apr 16 2018 at 21:28):

Does that make it a monoid?

view this post on Zulip Kevin Buzzard (Apr 16 2018 at 21:28):

:simple_smile:

view this post on Zulip Patrick Massot (Apr 16 2018 at 21:28):

I think I remember reading this discussion in the past

view this post on Zulip Kevin Buzzard (Apr 16 2018 at 21:28):

Right

view this post on Zulip Simon Hudon (Apr 16 2018 at 21:29):

What was the conclusion?

view this post on Zulip Patrick Massot (Apr 16 2018 at 21:30):

Current definitions are... odd

view this post on Zulip Kenny Lau (Apr 20 2018 at 05:29):

https://github.com/leanprover/mathlib/pull/109/commits

view this post on Zulip Kenny Lau (Apr 20 2018 at 05:29):

ext is in PR


Last updated: May 18 2021 at 17:44 UTC