# Field
## Metadata
**Status**:: #x
**Zettel**:: #zettel/literature
**Created**:: [[2024-03-27]]
**Topic**:: [[♯ Math]]
## Synopsis
A field is a set with two binary operators ⨁ and ⨂。
- The set under the operation ⨁ form an [[Abelian Group]].
- The set excluding the identity in the ⨁ abelian group under the operation ⨂ form an [[Abelian Group]].
## Analogy for Programmer
A field can be thought of as a type with two defined operators. The operators determine the operations can be performed on the type.
```rust
pub trait Field {
// identity of ⨁
const ZERO: Self;
// ⨁ is closed
fn add(self, rhs: Self) -> Self;
// ⨁ inverse
fn negate(self) -> Self;
// identity of ⨂
const ONE: Self;
// ⨂ is closed
fn multiply(self, rhs: Self) -> Self;
// ⨂ inverse, returns error when self is ZERO
fn inverse(self) -> Result<Self>;
}
```
There are constraints cannot be defined through the programming interface, see [[Group#Analogy for Programmer]] for reference.
## References
- [[RareSkills Authors - Rings and Fields A Programmer's Perspective (Highlights)]]