Zulip Chat Archive

Stream: general

Topic: Seemingly obvious algebraic fact, unsolved by "ring" tactic.


Eric Chen (Mar 10 2024 at 22:13):

I'm trying to prove the following theorem, and I heard that the Ring tactic should solve the problem directly. However, the goal shows something that is purely an algebraic fact that I don't understand. Why doesn't Ring solve this, and how could I solve this?
Screenshot-2024-03-10-at-3.13.33PM.png
Thank you so much!

Eric Chen (Mar 10 2024 at 22:15):

My intuition is that it's something to do with the fact that we need n % 3 = 1, but I don't know how or where I could utilize this in the definition of A.

Ruben Van de Velde (Mar 10 2024 at 22:32):

Right, this is non-obvious because / rounds; (1 / 3) * 3 = 0 * 3 = 0, not 1

Ruben Van de Velde (Mar 10 2024 at 22:34):

I think you can rewrite with docs#Int.ediv_mul_cancel

Eric Chen (Mar 10 2024 at 22:42):

That worked :). However, now it wants me to show that 3 | -1 + n, which sounds like a direct application of h2. However, "apply" and "rw" both don't work for this task.

Matt Diamond (Mar 10 2024 at 22:44):

docs#Int.dvd_sub_of_emod_eq should help there

Matt Diamond (Mar 10 2024 at 22:45):

you might need to rewrite with add_comm (so that the goal is 3 | n + -1)

Eric Chen (Mar 10 2024 at 22:50):

Solved, thank you all so much :). I'm new to Lean, and this gives me some intuition about which tactics/theorems to use.

Kevin Buzzard (Mar 10 2024 at 23:19):

The answer to "why doesn't ring work" is "your goal is not a statement of commutative ring theory" (as it involves division)

Xiyu Zhai (Mar 11 2024 at 01:40):

Do we have field tactics?

Daniel Weber (Mar 11 2024 at 06:19):

Kevin Buzzard said:

The answer to "why doesn't ring work" is "your goal is not a statement of commutative ring theory" (as it involves division)

Why does example (x : ℝ) : x/3 * 3 = x := by ring work, then? I think it's a bit stronger

Daniel Weber (Mar 11 2024 at 06:20):

Xiyu Zhai said:

Do we have field tactics?

There's field_simp

Ruben Van de Velde (Mar 11 2024 at 06:20):

I'm surprised that it does

Ruben Van de Velde (Mar 11 2024 at 06:20):

Daniel Weber said:

Xiyu Zhai said:

Do we have field tactics?

There's field_simp

But note that your question didn't involve field division

Kevin Buzzard (Mar 11 2024 at 08:02):

A preprocessor changes x / (numerical constant c known to be nonzero) in a field to x * (c^{-1}). It won't work with x / y if y isn't numerical. It's like how omega only claims to work with goals without multiplication, but it works on 3 * n because it changes it to n + n + n.

Mario Carneiro (Mar 11 2024 at 08:25):

more specifically, ring works with multivariate polynomials over Q\mathbb{Q}, and 1/3Q1/3\in \mathbb{Q}

Kim Morrison (Mar 11 2024 at 23:44):

@Eric Chen, please read #mwe, and post questions with standalone code blocks, not screenshots. You'll get much better help.


Last updated: May 02 2025 at 03:31 UTC