Zulip Chat Archive

Stream: lean4

Topic: Help prove a Lemma in Lean 4


Kajani Kaunda (Aug 16 2024 at 19:27):

Hello,

I need help proving the following Lemma. The lemma tries to prove that every prime > 3 is not divisible by 2. An elementally task for a seasoned Leaner!

lemma theo1 (p : ℕ) (hp : p > 3) (hprime : Nat.Prime p) : ¬ (2 ∣ p) := by

Ruben Van de Velde (Aug 16 2024 at 21:32):

First step:

import Mathlib
lemma theo1 (p : ) (hp : p > 3) (hprime : Nat.Prime p) : ¬ (2  p) := by
  -- rw? finds:
  rw [propext (Nat.dvd_prime hprime)]

(Not sure why it puts propext in there)

Kajani Kaunda (Aug 17 2024 at 10:58):

Ruben Van de Velde said:

First step:

import Mathlib
lemma theo1 (p : ) (hp : p > 3) (hprime : Nat.Prime p) : ¬ (2  p) := by
  -- rw? finds:
  rw [propext (Nat.dvd_prime hprime)]

(Not sure why it puts propext in there)

Looks like some kind of transformation ...

Ruben Van de Velde (Aug 17 2024 at 13:02):

No, I know what it does, but I don't know why rw? suggests it

Kajani Kaunda (Aug 17 2024 at 13:31):

Ruben Van de Velde said:

First step:

import Mathlib
lemma theo1 (p : ) (hp : p > 3) (hprime : Nat.Prime p) : ¬ (2  p) := by
  -- rw? finds:
  rw [propext (Nat.dvd_prime hprime)]

(Not sure why it puts propext in there)

Thank you very much for the code. I am working on a certain known result about primes. Proof that all primes > 3 can be expressed in the form 6n - 1 or 6n + 1.

Kajani Kaunda (Aug 17 2024 at 13:32):

So this result was the first step. I am new to lean so I have kind of dived into the deep end ...

Kajani Kaunda (Aug 17 2024 at 13:32):

:smile:

Kim Morrison (Aug 18 2024 at 00:03):

Ruben Van de Velde said:

No, I know what it does, but I don't know why rw? suggests it

Good question. @Ruben Van de Velde, do you want to open an issue for that? We should try to fix it at some point (it shouldn't be hard, PR welcome :-).

Ruben Van de Velde (Aug 18 2024 at 08:23):

https://github.com/leanprover/lean4/issues/5082


Last updated: May 02 2025 at 03:31 UTC