Zulip Chat Archive

Stream: new members

Topic: Expressing a problem about positive integers


Nathan (Oct 30 2025 at 16:00):

Is this the best way to express this problem? I thought I should use def Zp := {n : ℕ // n ≠ 0} but this led to a lot of problems.

image.png

import Mathlib.Algebra.BigOperators.Group.Finset.Defs
import Mathlib.Order.Interval.Finset.Defs
import Mathlib.Order.Interval.Finset.Nat

theorem POTD2411 (a :   )
    (h₁ :  n : , a n  2025)
    (h₂ :  n : , n  0   k : , k^n =  i : Fin n, a i) :
     c N : , c  0  N  0   n : , n  N  a n = c := by
  sorry

Kenny Lau (Oct 30 2025 at 16:02):

do you have to start with 1?

Nathan (Oct 30 2025 at 16:03):

i started with a_0 but it would be better if i could start with a_1 so i could be as close to the problem as possible

Kenny Lau (Oct 30 2025 at 16:06):

Nathan said:

def Zp := {n : ℕ // n ≠ 0} but this led to a lot of problems

we have PNat, and what problems did it lead to?

Kenny Lau (Oct 30 2025 at 16:06):

note that your first step, if you do use PNat, should be to convert it to Nat

Weiyi Wang (Oct 30 2025 at 16:08):

If your goal is formalizing a proof, not just the statement, I suggest formalizing the proof with the shifted index starting from 0 because it will be easier to work with Nat, then write a thin layer to translate the statement to PNat

Nathan (Oct 30 2025 at 16:11):

i can do something like this but i have trouble with the product

import Mathlib.Algebra.BigOperators.Group.Finset.Defs
import Mathlib.Data.PNat.Notation
import Mathlib.Order.Interval.Finset.Nat

theorem POTD2411 (a : PNat  PNat)
    (h₁ :  n : PNat, (a n).val  2025)
    (h₂ :  n : PNat,  k : , k^n.val =  i : Fin n, a i) :
     c N : PNat,  n : PNat, n.val  N.val  a n = c := by
  sorry

Ruben Van de Velde (Oct 30 2025 at 16:15):

I would suggest ∏ i ∈ Finset.range n, a i instead of dealing with Fin

Nathan (Oct 30 2025 at 16:18):

i think i might want a Finset of PNat

Nathan (Oct 30 2025 at 16:19):

but i think i need to tell it somehow that the set is finite

Nathan (Oct 30 2025 at 16:20):

or alternatively use Finset.range and convert the index into a PNat

Weiyi Wang (Oct 30 2025 at 16:21):

You can use Finset.Icc and friends

Nathan (Oct 30 2025 at 16:23):

ohhh Finset.Icc works

Nathan (Oct 30 2025 at 16:27):

yeah i think maybe the problem was that range was including 0

Nathan (Oct 30 2025 at 16:28):

thanks folks :pray:

Nathan (Oct 30 2025 at 21:12):

how do i get the power of a prime in a natural number? for example the power of 3 in 18 is 2 because 3^2 divides 18 but 3^3 doesn't.

I found Int.padicValuation, but why does #eval Int.padicValuation 3 18 evaluate to some (-2) rather than 2?

Nathan (Oct 30 2025 at 21:31):

oh i found it: #eval padicValNat 3 18

Vlad (Nov 06 2025 at 15:17):

It may be easier to state the theorem by casting to real numbers. Number 2025 can be replaced by arbitrary natural number.

example {r : } {a :   } (h₁ :  n, a n  0) (h₂ :  n, a n  r)
    (h₃ :  n,  (k : ), ( i  range n, a i : ) ^ (n : )⁻¹ = k) :
     c N,  n, N  n  a n = c := by
  sorry

Proof


Last updated: Dec 20 2025 at 21:32 UTC