algebras¶
Abstract Algebras Representations
Infrastructure for implementing concrete representations for abstract algebras of various types.
Protocols¶
Abstract Base Classes¶
- class boring_math.abstract_algebra.algebras.BaseSet¶
-
- abstractmethod __call__(rep: H) BaseElement¶
add element
Add the unique element to the concrete algebra with the given, perhaps narrowed, rep in a uniquely deterministic way.
- param rep:
Representation to add if not already present.
- returns:
The unique element added.
- __eq__(right: object) bool¶
equality comparison
- param right:
Object being compared to.
- returns:
True only if right is the same concrete algebra.
- narrow_rep_type(rep: H) H¶
Narrow the rep with a concrete algebra’s many-to-one “narrowing” function.
- param rep:
Hashable value of type H.
- returns:
The narrowed coset representative.
- class boring_math.abstract_algebra.algebras.BaseElement¶
-
- __init__(rep: H, algebra: BaseSet[H]) None¶
abstract base class for algebra element
- param rep:
Coset element to be narrowed to a representative.
- param algebra:
Algebra to which element belongs
- __call__() H¶
call
- returns:
A reference to the element’s representation
Warning
A trade off is being made in favor of efficiency over encapsulation. An actual reference to the wrapped rep is returned to eliminate the overhead of a copy.
- __eq__(right: object) bool¶
equality comparison
- param right:
Object to be compared with.
- returns:
True if both are algebra elements and the reps compare as equal and are of the same invariant type.
Warning
Elements not necessarily from the same algebra.
Also, any sort of difference in rep narrowing is not taken into consideration.