Skip to content

Conversation

@GeorgeTsoukalas
Copy link
Collaborator

No description provided.

from frame.tools.z3_template import Z3Template
import galois

DEFAULT_FIELD = galois.GF(27)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we import this from one file, so we don't have to change it every time in the future when we generalize?


DEFAULT_FIELD = galois.GF(27)

def get_order(a: FiniteFieldElement) -> int:
Copy link
Collaborator

@rah4927 rah4927 Jul 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would just be DEFAULT_FIELD.multiplicative_order(a.value) using the library's in-built function

canonical_name="ff_is_primitive_element",
entity_type=EntityType.CONCEPT,
description="True if the element is a generator of the multiplicative group",
computational_implementation=lambda a: get_order(a) == (DEFAULT_FIELD.order - 1) if int(a.value) != 0 else False,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alternatively, return a in DEFAULT_FIELD.primitive_elements

ff_one_concept = create_finite_field_one_concept()
ff_addition_concept = create_finite_field_addition_concept()
ff_multiplication_concept = create_finite_field_multiplication_concept()
ff_equality_concept = create_finite_field_equality_concept()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we also need the concept of generators. The way to get all the generators is the following.

generator = DEFAULT_FIELD.primitive_element
generators_list = [generator**i for i in range(DEFAULT_FIELD.order)]

Then you need to make a concept out of each of these generators.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree this makes sense, if we can specify the field somewhere we can add a set of the generators here. Probably better to do this generally, but we can also just hardcode it if that takes too much work

@rah4927 rah4927 merged commit a50c227 into main Jul 26, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants