-
Notifications
You must be signed in to change notification settings - Fork 0
Add support for finite fields #90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| from frame.tools.z3_template import Z3Template | ||
| import galois | ||
|
|
||
| DEFAULT_FIELD = galois.GF(27) |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
No description provided.