Zulip Chat Archive

Stream: lean4

Topic: Defining a set of primes and their additive inverses


Kajani Kaunda (Aug 03 2024 at 13:27):

What would be the LEAN4 code to define the following;

the set J = (..., -p$$_{n+2}$$, -p$$_{n+1}$$, -p$$_n$$, p$$_n$$, p$$_{n+1}$$, p$$_{n+2}$$, ...) which would give us: J = (..., -5, -3, -2, 2, 3, 5, ...).

Note: the elements of the set J are all the primes and their additive inverses.
I would like to be able to test it on the site: https://live.lean-lang.org/

Kajani Kaunda (Aug 03 2024 at 13:28):

Kajani Kaunda said:

What would be the LEAN4 code to define the following;

the set J = (..., -p$$_{n+2}$$, -p$$_{n+1}$$, -p$$_n$$, p$$_n$$, p$$_{n+1}$$, p$$_{n+2}$$, ...) which would give us: J = (..., -5, -3, -2, 2, 3, 5, ...).

Note: the elements of the set J are all the primes and their additive inverses.
I would like to be able to test it on the site: https://live.lean-lang.org/

Oops!, I did not get the subscripts right! sorry!

Yaël Dillies (Aug 03 2024 at 13:29):

What about

import Mathlib

#check {n :  | Prime n}

Kajani Kaunda (Aug 03 2024 at 13:30):

Yaël Dillies said:

What about

import Mathlib

#check {n :  | Prime n}

Does that include the additive inverses...

Yaël Dillies (Aug 03 2024 at 13:30):

Yes it does. Prime numbers in the integers correspond to prime numbers in the natural numbers and their negations

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

Yaël Dillies said:

Yes it does. Prime numbers in the integers correspond to prime numbers in the natural numbers and their negations

Ah , Ok!

Yaël Dillies (Aug 03 2024 at 13:31):

example : -2  {n :  | Prime n} := Int.prime_two.neg

Kajani Kaunda (Aug 03 2024 at 13:44):

Yaël Dillies said:

example : -2  {n :  | Prime n} := Int.prime_two.neg

Thank you!


Last updated: May 02 2025 at 03:31 UTC