Zulip Chat Archive

Stream: new members

Topic: Hypotheses on a group


Joey Lupo (Jul 01 2021 at 16:19):

What is the canonical way to say "Let G be a finite, cyclic group of order q with generator g"? Right now I have

variables (G : Type) [group G] [is_cyclic G] [fintype G]

but I'm not sure how to get a hold of variables q or gfor the rest of the file and not have to unpack the definition of G in every proof.

Yakov Pechersky (Jul 01 2021 at 16:27):

That's good, now do

obtain g, hg := is_cyclic.exists_generator

or something akin to it

Kevin Buzzard (Jul 01 2021 at 16:43):

you could just add variables (q : nat) (hGq : fintype.card G = q)

Eric Wieser (Jul 01 2021 at 16:44):

Or even something silly like local notation `q` := fintype.card

Yakov Pechersky (Jul 01 2021 at 16:46):

There is docs#order_eq_card_gpowers

Yakov Pechersky (Jul 01 2021 at 16:47):

Seemingly missing an [is_cyclic G] subgroup.gpowers g = \top lemma.

Yakov Pechersky (Jul 01 2021 at 16:48):

There is the inverse, in docs#is_cyclic_of_order_of_eq_card

Joey Lupo (Jul 01 2021 at 16:58):

Okay, thank you for the help. Right now I have

variables {G : Type} [fintype G] [group G] [is_cyclic G]
variables (g : G) (hGg :  (x : G), x  subgroup.gpowers g)
variables (q : ) (q_pos : 0 < q) (hGq : fintype.card G = q)

I guess my question now is the [is_cyclic G] seems redundant given that I manually defined the equivalent hGg, i.e. I'm not really taking advantage of the typeclass system by doing this. I am not exactly sure how to use the is_cyclic.exists_generator G proposition to get a hold of the particular g since the obtain tactic isn't working in this scope.

Mario Carneiro (Jul 01 2021 at 16:59):

If a typeclass argument is implied by a hypothesis, you should remove the typeclass argument only if it isn't used in the statement of the lemma

Joey Lupo (Jul 01 2021 at 17:01):

Yea, I guess my point was it seems (to me) like it would be better practice (or cleaner at least) to use the typeclass and then get the g from the is_cyclic rather than just manually writing the definition.

Mario Carneiro (Jul 01 2021 at 17:01):

It seems like you want g to be fixed, though?

Mario Carneiro (Jul 01 2021 at 17:02):

is_cyclic says only that there exists a generator, so there is no g to refer to

Mario Carneiro (Jul 01 2021 at 17:03):

If g doesn't appear in the statement of the lemma though, then you should just use obtain ⟨g, hg⟩ := is_cyclic.exists_generator G at the start of the proof

Mario Carneiro (Jul 01 2021 at 17:03):

it might help to give a #mwe

Joey Lupo (Jul 01 2021 at 17:06):

Interesting, wouldn't the "there exists" imply we should be able to say okay, call the thing that exists "g"?

Yakov Pechersky (Jul 01 2021 at 17:07):

That's precisely what obtain does.

Mario Carneiro (Jul 01 2021 at 17:09):

Joey Lupo said:

Interesting, wouldn't the "there exists" imply we should be able to say okay, call the thing that exists "g"?

Yes, but you can't refer to g outside the scope of that part of the proof, so in particular it can't appear in the theorem statement

Joey Lupo (Jul 01 2021 at 17:10):

btw, I don't have a MWE yet so sorry about that. I am basically trying to write these hypotheses at the beginning of the file so as to say, "for the rest of this file, let G be a finite, cyclic group with order q and generator g"

Mario Carneiro (Jul 01 2021 at 17:11):

That's just what you wrote, except you don't need [is_cyclic G]

Mario Carneiro (Jul 01 2021 at 17:12):

you don't need (q_pos : 0 < q), that's implied by the fact that q is the cardinality of a group

Mario Carneiro (Jul 01 2021 at 17:13):

But if the theorems you want to state don't use q and/or g in them, it will be more convenient for users of your theorem to have the [is_cyclic G] assumption instead of q and g

Mario Carneiro (Jul 01 2021 at 17:14):

but they are equivalent, since users can always use obtain ⟨g, hg⟩ := is_cyclic.exists_generator G before applying your lemma

Joey Lupo (Jul 01 2021 at 17:14):

Okay, then I think I have something that works for my purpose. But to push the point a little further- how come I was able to use fintype in the hypothesis of q, but can't use is_cyclic in the hypothesis of g? Does that just come down to the typeclass code not including that functionality?
Also, Yakor, I wasn't able to get this basic line to work

 variables {G : Type} [fintype G] [group G] [is_cyclic G]
obtain g, hg := is_cyclic.exists_generator G

Joey Lupo (Jul 01 2021 at 17:15):

Yea I guess the obtain should be in the context of a proof

Mario Carneiro (Jul 01 2021 at 17:15):

obtain is a tactic, it is supposed to go in a proof

Mario Carneiro (Jul 01 2021 at 17:15):

the things that appear at the top level are things like theorem, lemma, def, variable (aka "commands")

Mario Carneiro (Jul 01 2021 at 17:17):

how come I was able to use fintype in the hypothesis of q, but can't use is_cyclic in the hypothesis of g? Does that just come down to the typeclass code not including that functionality?

I don't understand what you mean by this. For fintype.card G to be well formed, fintype G has to be a previous typeclass argument

Mario Carneiro (Jul 01 2021 at 17:18):

Nothing in your variables similarly needs is_cyclic G for well formedness, so it can be safely removed

Mario Carneiro (Jul 01 2021 at 17:18):

you might need it for the lemmas though, you haven't shown any theorem statements yet

Joey Lupo (Jul 01 2021 at 17:22):

Yes, I understand that I can remove is_cyclic.

What I mean is that it would be nice to be able to use the is_cyclic typeclass to get a hypothesis on a g defined at the top-level in the same way that I use the fintype typeclass to get a hypothesis on a q defined at the top-level.

Mario Carneiro (Jul 01 2021 at 17:23):

If g is a random element and is_cyclic G, that doesn't say anything about whether g is a cyclic generator

Mario Carneiro (Jul 01 2021 at 17:24):

is_cyclic is a property of the whole group, not any particular element

Mario Carneiro (Jul 01 2021 at 17:24):

What you would need is some kind of is_cyclic_generator g class or hypothesis, defined to be ∀ (x : G), x ∈ subgroup.gpowers g. So far, this has not been useful enough to need

Joey Lupo (Jul 01 2021 at 17:24):

I guess I was envisioning something along the lines of

variables (G : Type) [group G] [is_cyclic G]
                    (g : G) (hG : g = G.generator)

Mario Carneiro (Jul 01 2021 at 17:25):

G.generator is not a function

Mario Carneiro (Jul 01 2021 at 17:25):

If a group is cyclic, there is not necessarily any distinguished generator

Mario Carneiro (Jul 01 2021 at 17:26):

and is_cyclic is defined using an existential so you can't extract a particular witness from it

Mario Carneiro (Jul 01 2021 at 17:26):

By contrast, when fintype G, there is a unique number q which is the cardinality of G, which is why the fintype.card function can exist

Mario Carneiro (Jul 01 2021 at 17:27):

if a finite group could have multiple witnesses to finiteness then that function wouldn't exist

Mario Carneiro (Jul 01 2021 at 17:28):

So if you want to refer to a particular generator, you have to explicitly unpack it into the two assumptions "g is an element of G" and "g is a cyclic generator of G"

Mario Carneiro (Jul 01 2021 at 17:29):

and the conjunction of these two is stronger than the original is_cyclic G assumption

Joey Lupo (Jul 01 2021 at 17:38):

Interesting. I agree that equals was not the right idea. So are you arguing in the last two lines that having something like

variables (G : Type) [group G] [is_cyclic G]
                    (g : G) (hG : G.generator g)

where hG is equivalent to (hGg : ∀ (x : G), x ∈ subgroup.gpowers g) should be outside the scope of the is_cyclictypeclass functionality?

Yakov Pechersky (Jul 01 2021 at 18:05):

If you have [is_cyclic G], then (hG : G.generator g) is true for any g : G, so you don't need that hypothesis. Do you have an example of a theorem statement you want to make regarding such gs?

Mario Carneiro (Jul 01 2021 at 18:24):

Yakov Pechersky said:

If you have [is_cyclic G], then (hG : G.generator g) is true for any g : G, so you don't need that hypothesis. Do you have an example of a theorem statement you want to make regarding such gs?

Not every element of a cyclic group is a generator. The identity almost never is

Yakov Pechersky (Jul 01 2021 at 18:28):

Ah yes, apologies.


Last updated: Dec 20 2023 at 11:08 UTC