Zulip Chat Archive

Stream: new members

Topic: finite field


Alex Zhang (Jul 19 2021 at 19:18):

import tactic.gptf
import data.fintype.card
import data.finset.basic
import field_theory.finite.basic

variables {F : Type*} [field F] [fintype F] [decidable_eq F] {p : } [char_p F p]
example (a : F) :  b : , coe b = a := by {sorry}

Is this proved in mathlib? If not, does anyone know how to prove it? :sweat:

Yakov Pechersky (Jul 19 2021 at 19:22):

Instead of constantly working with existentials, you can use the existing ring_homs and ring_isos. Try zmod.cast_hom

Yakov Pechersky (Jul 19 2021 at 19:23):

That goes in the other direction, but maybe it is useful

Eric Wieser (Jul 19 2021 at 19:26):

docs#zmod.cast_hom

Eric Wieser (Jul 19 2021 at 19:28):

docs#zmod.ring_equiv is stronger, but I don't think you can satisfy the hypothesis

Kevin Buzzard (Jul 19 2021 at 19:33):

The statement you want to prove is not true

Kevin Buzzard (Jul 19 2021 at 19:34):

Not every finite field is Z/pZ

Alex Zhang (Jul 19 2021 at 19:37):

Kevin reminded me of the right thing!!

Alex Zhang (Jul 21 2021 at 15:09):

F is a finite filed of char p, is it true that (∃ (a : F), a ^ 2 = -1) → (∃ (y : zmod p), y ^ 2 = -1).
If so, how to get this?

Adam Topaz (Jul 21 2021 at 15:11):

This is not true. If you take a prime pp such that 1-1 is not a square mod pp, you can always adjoin a square-root of 1-1 to Fp\mathbb{F}_p to get a finite extesion where Y2=1Y^2 = -1 has a solution.

Alex Zhang (Jul 21 2021 at 15:41):

Is the following lemma proved in mathlib? I only noticed a weaker version for zmod p

import tactic
import field_theory.finite.basic
import number_theory.quadratic_reciprocity

variables {F : Type*} [field F] [fintype F] [decidable_eq F] (p : ) [char_p F p]

lemma finite_field.exists_sq_eq_neg_one_iff_mod_four_ne_three :
 a : F, a ^ 2 = -1  fintype.card F % 4  3 := sorry

#check zmod.exists_sq_eq_neg_one_iff_mod_four_ne_three

zmod.exists_sq_eq_neg_one_iff_mod_four_ne_three is here
https://leanprover-community.github.io/mathlib_docs/number_theory/quadratic_reciprocity.html#zmod.exists_sq_eq_neg_one_iff_mod_four_ne_three

Kevin Buzzard (Jul 21 2021 at 15:46):

AFAIK everything we have about finite fields in general (i.e. not stuff about just Z/p) will be in src.field_theory.finite.*

Kevin Buzzard (Jul 21 2021 at 15:48):

and apparently there are also things which aren't about finite fields at all in there too, like Fermat-Euler and mv_polynomial.evalₗ (which seems to be proved under a superfluous fintype K assumption unless I'm missing something)

Kevin Buzzard (Jul 21 2021 at 15:49):

The result is pretty straightforward mathematically if you know the multiplicative group is finite, and we have a more general statement that a finite subgroup of the units of any ID is cyclic somewhere in mathlib.

Alex Zhang (Jul 21 2021 at 15:52):

Yeah, I saw the cyclic lemma somewhere before. If this lemma is not there, I am to do it myself :)

Alex Zhang (Jul 21 2021 at 15:53):

The result is pretty straightforward mathematically. Indeed, no sure whether it is still straightforward when implementing.

Alex Zhang (Jul 21 2021 at 16:30):

I just wanna pre-check here to see if I can save some effort.

Alex Zhang (Jul 25 2021 at 18:49):

Is there another quick way to prove that fintype.card F % 4 =1 → ∃ a : F, a ^ 2 = -1 for a finite field F without using the fact that the unit group is cyclic? @Kevin Buzzard

Kevin Buzzard (Jul 25 2021 at 19:01):

We have that the unit group is cyclic in Lean. If all you know about F×F^\times is that it's a group of order 0 mod 4 then this isn't enough because it could be isomorphic to Z/2Z×Z/nZ\Z/2\Z\times\Z/n\Z with the generator of the Z/2Z\Z/2\Z being 1-1.

Kevin Buzzard (Jul 26 2021 at 07:12):

There's a trick for Z/pZ\Z/p\Z because then using Wilson's theorem you have the explicit solution a=(p12)!a=(\frac{p-1}{2})! but this doesn't work for general finite FF.

David Wärn (Jul 26 2021 at 08:05):

Generalising this trick, I guess for general finite F you can pick one of {x, -x} for each nonzero such pair and multiply them.

Kevin Buzzard (Jul 26 2021 at 08:25):

Right! So the first observation is that the product of all the units is 1-1 (we have this in Lean too, IIRC, indeed I just fixed the proof so that it didn't use is_monoid_hom yesterday), and this is because every unit other than ±1\pm1 has an inverse which is distinct from it so it cancels with it. Now you consider the involution xxx\mapsto -x on the units; now every orbit has size 2, so sharing them equally into two subsets with products aa and bb we have ab=1ab=-1 and b=(1)(q1)/2ab=(-1)^{(q-1)/2}a which is aa under the hypothesis q1q\equiv1 mod 44 (here qq is the size of the field). This might be longer to formalise than the cyclic proof though.

Alex Zhang (Aug 05 2021 at 20:06):

Is the existence of finite fields proved in mathlib?

import field_theory.finiteness

example {n p : } (hp : p.prime) :  {F : Type*} [c : fintype F] [d : field F],
@fintype.card F c = p^(n.succ) :=
begin
  sorry
end

Alex Zhang (Aug 05 2021 at 20:30):

(deleted)

Eric Wieser (Aug 05 2021 at 20:42):

(an unrelated tip: if you replace the , with , by exactI you don't need the @)

Eric Rodriguez (Aug 05 2021 at 20:46):

https://leanprover-community.github.io/mathlib_docs/field_theory/finite/basic.html

Eric Wieser (Aug 05 2021 at 20:55):

I couldn't see a proof of existence that looks like Alex's statement there

Ruben Van de Velde (Aug 05 2021 at 20:56):

https://leanprover-community.github.io/mathlib_docs/data/zmod/basic.html#zmod.field is a start, at least

Alex Zhang (Aug 05 2021 at 20:57):

I think the finite filed basic file can't have it as the existence requires the use of splitting field in my memory.

Eric Rodriguez (Aug 05 2021 at 21:10):

ah I see the issue! do we have that there exists an irreducible polynomial of any degree? (is that even true in general - I know it's true in ℤ/pℤ but that's in turn due to the finite field construction)

Eric Rodriguez (Aug 05 2021 at 21:10):

because then docs#adjoin_root.field probably gives us thie result instantly

Eric Rodriguez (Aug 05 2021 at 21:12):

that still may not be the best way to do it, though; we'd probably want a primitive polynomial if we could, because that's closer to the "canonical" finite field and it's nice that the root generates

Alex Zhang (Aug 05 2021 at 21:15):

to construct a field F of order p^n = q, we want it to be the splitting field of x^q - x over GF(p).

Alex Zhang (Aug 05 2021 at 21:17):

If the existence hasn't been established or there isn't an instant solution. I guess https://leanprover-community.github.io/mathlib_docs/field_theory/splitting_field.html#polynomial.is_splitting_field
is the file to start with. Some lemmas there can help.

Eric Rodriguez (Aug 05 2021 at 21:20):

yes, that's one way — i think we can also do what I said too though, right? splitting fields seem more tricky, as we then have to toy a little to get the number of elements, whilst my idea gets it for free, I think

Alex J. Best (Aug 05 2021 at 21:36):

A long time ago (in mathlib terms) a few people worked on this at https://github.com/leanprover-community/mathlib/tree/finite-fields-exist but i don't think it made it to mathlib in the end for some reason. Maybe you can find the thread here on Julio somewhere

Eric Wieser (Aug 05 2021 at 21:45):

Specifically this line: https://github.com/leanprover-community/mathlib/compare/finite-fields-exist#diff-2a88a230cdd2ba9936dfcce670803cf356cb6ab2ed303ef41aa74b8e9730979fR222

Eric Wieser (Aug 05 2021 at 21:47):

I guess the thing to do is try merging master into that branch and work out which bits are now already merged; maybe with the help of the people who worked on it!

Eric Rodriguez (Aug 05 2021 at 21:48):

should this thread be moved to #maths?

Ruben Van de Velde (Aug 15 2021 at 19:46):

Eric Wieser said:

I guess the thing to do is try merging master into that branch and work out which bits are now already merged; maybe with the help of the people who worked on it!

You nerd-sniped me into PRing this: https://github.com/leanprover-community/mathlib/pull/8692

Eric Rodriguez (Aug 15 2021 at 23:24):

okay... so the finrank thing isn't true

Eric Rodriguez (Aug 15 2021 at 23:25):

splitting field of n=0 is some nonsense, I assume probably just zmod p itself

Eric Rodriguez (Aug 15 2021 at 23:26):

im too tired to figure out whether that's a big deal or not

Eric Rodriguez (Aug 15 2021 at 23:26):

probably not and we'll have to carry around an (n ≠ 0) everywhere

Eric Rodriguez (Aug 21 2021 at 18:39):

it's now merged into master @Alex Zhang

Alex Zhang (Aug 21 2021 at 18:44):

Thanks for letting me know Eric @Eric Rodriguez. Could you point me where the lemma lies?

Ruben Van de Velde (Aug 21 2021 at 18:47):

https://leanprover-community.github.io/mathlib_docs/field_theory/finite/galois_field.html

Ruben Van de Velde (Aug 21 2021 at 18:47):

The actual \exists isn't there yet, but should be simple to write


Last updated: Dec 20 2023 at 11:08 UTC