Zulip Chat Archive

Stream: Is there code for X?

Topic: 1 ≠ -1 in ℤˣ?


Alex Kontorovich (Oct 27 2022 at 18:56):

This one is quite stupid. Help please?

example : (1 : ˣ)  -1 :=
begin
  sorry,
end

Adam Topaz (Oct 27 2022 at 19:02):

I'm not next to Lean, but will dec_trivial do it?

Julian Berman (Oct 27 2022 at 19:06):

Seems like yes -- and hint looks like it indeed suggests dec_trivial (saying it solves the goal) which is sometimes a good thing to try for silly looking things.

Ruben Van de Velde (Oct 27 2022 at 19:08):

I would have tried norm_num

Junyan Xu (Oct 27 2022 at 19:30):

example : (1 : ˣ)  -1 := λ h, by cases h

Adam Topaz (Oct 27 2022 at 19:31):

The ultimate golf:

example : (1 : ˣ)  -1 .

Alex Kontorovich (Oct 27 2022 at 19:40):

What is that??? The dot does something like dec_trivial?...

Junyan Xu (Oct 27 2022 at 19:41):

A single dot generates the same term as my version, which is much longer than the term generated by dec_trivial (when printed with set_option pp.implicit true. dec_trivial uses existing instances so it only needs to check the units.val agree, but it might take more time to find those instances.

Martin Dvořák (Oct 27 2022 at 19:43):

Is there a documentation for . please?

Junyan Xu (Oct 27 2022 at 19:43):

example : (1 : ℤˣ) ≠ -1 . is a pattern matching proof but since there's no pattern to be matched you need to append a dot.

Junyan Xu (Oct 27 2022 at 19:44):

The same reason as why cases h solves the goal (because it generates zero goals).

Jason Rute (Oct 27 2022 at 19:46):

I would also like to see the dot proofs explained better in documentation or a blog post. Does something like this also work for Lean 4?

Antoine Chambert-Loir (Oct 27 2022 at 19:54):

While dec_trivial and other easy proofs exist, I had to make a proof by contradiction in permutation group theory, where the contradiction came from 1 \neq -1. Therefore, I believe that it should be in mathlib so that we can apply it and get the contradiction.

Junyan Xu (Oct 27 2022 at 19:59):

The dot (period) has the effect of instructing Lean to stop parsing (and possibly more), which is also useful when e.g. you are writing a new proof but want to keep the old proof around without commenting it out: you can insert a period (surrounded by one whitespace each side) between the new proof and the old proof, and then the old proof won't interfere with the new proof. (Mostly useful for term-mode proofs.)

Junyan Xu (Oct 27 2022 at 20:00):

where the contradiction came from 1 \neq -1

If you have h : 1 = -1 in the context, you can just do cases h to close the goal (or apply absurd h, dec_trivial). But maybe I didn't imagine your situation correctly.

Antoine Chambert-Loir (Oct 27 2022 at 20:02):

I'll check if that suffices!

Mario Carneiro (Oct 27 2022 at 20:05):

Jason Rute said:

I would also like to see the dot proofs explained better in documentation or a blog post. Does something like this also work for Lean 4?

Lean 4 doesn't support exactly this syntax, but since I like this proof so much I added a similar syntax for it. With Std.Tactic.NoMatch you can write

example : (1 : ˣ)  -1 := fun.

to similar effect.

Mario Carneiro (Oct 27 2022 at 20:06):

There isn't that much to explain: it's an empty pattern match, exactly the same as other equation compiler definitions except there are zero match arms

Julian Berman (Oct 27 2022 at 20:08):

They're called auto_params in case it's helpful for searching (I thought I remembered a thread where I asked about them and got linked something in TPiL but seems I'm misremembering)

Mario Carneiro (Oct 27 2022 at 20:08):

that's the wrong "dot proof"

Julian Berman (Oct 27 2022 at 20:08):

Oh is it? Like they're not related to the ones in structures?

Mario Carneiro (Oct 27 2022 at 20:08):

you are thinking of (x : A . tac) syntax


Last updated: Dec 20 2023 at 11:08 UTC