Zulip Chat Archive

Stream: general

Topic: Divisibility of big product over Finsets


Adam Kurkiewicz (Oct 02 2024 at 09:18):

Hi all, I'm working on Compfiles IMO 1970 P4

I'm still learning about Finset API and relevant tactics.

I would like to show that if a prime number divides a product of all natural numebrs in a Finset , then it also divides one natural number in a Finset.

I found a proof in Mathlib, which is almost exactly what I need, and it works with some kind of abstract definition of primality, but it doesn't work with a normal definition of primality:

This works:

import Mathlib.Tactic

theorem prime_dvd_elem_of (p : ) (pp : Prime p) (s : Finset ) : p  ( m  s, m)   x  s, p  x := by
  exact Prime.exists_mem_finset_dvd pp

But this doesn't:

import Mathlib.Tactic

theorem prime_dvd_elem_of (p : ) (pp : Nat.Prime p) (s : Finset ) : p  ( m  s, m)   x  s, p  x := by
  exact Prime.exists_mem_finset_dvd pp

Is there a different lemma I should use?

Riccardo Brasca (Oct 02 2024 at 09:21):

Just use Nat.prime_iff to connect the two notions.

Adam Kurkiewicz (Oct 02 2024 at 09:22):

Perfect, thank you!

Riccardo Brasca (Oct 02 2024 at 09:23):

Note that you can use dot notation nicely: if pp : Nat.Prime p then pp.Prime : Prime p (this is why we have Nat.Prime.prime as a separate lemma)

Adam Kurkiewicz (Oct 02 2024 at 09:24):

Oh yes, that's very nice

Yaël Dillies (Oct 02 2024 at 09:29):

Typo: It should be pp.prime : Prime p

Adam Kurkiewicz (Oct 02 2024 at 09:29):

I've worked out this much :)


Last updated: May 02 2025 at 03:31 UTC