field-cat 0.1.0

Finite field algebra shared across plonkish-cat, proof-cat, and stark-cat
Documentation
//! # field-cat
//!
//! Finite field algebra for the `*-cat` proof-system ecosystem.
//!
//! `field-cat` owns the [`Field`] trait, the [`FieldBytes`]
//! transcript-serialization trait, and a small library of concrete
//! prime fields used by downstream proof-system crates
//! ([`plonkish_cat`](https://github.com/MavenRain/plonkish-cat),
//! [`proof_cat`](https://github.com/MavenRain/proof-cat), and
//! `stark-cat`).
//!
//! Lifting [`Field`] out of `plonkish-cat` lets STARK-flavored
//! downstreams depend only on the algebra they need, without
//! inheriting the `PLONKish` constraint vocabulary
//! (`ConstraintSet`, `Expression`, `Wire`, `CopyConstraint`).
//!
//! # Fields
//!
//! - [`F101`]: toy field with modulus `101`, useful for tests and
//!   small inspectable examples.
//! - [`BabyBear`]: Mersenne prime field with modulus `2^31 - 1`,
//!   used by Plonky3 and SP1.
//! - [`BFieldElement`]: Goldilocks prime field with modulus
//!   `2^64 - 2^32 + 1`, used by Triton VM, Risc0, and Plonky3 in
//!   its wider-field modes.
//!
//! # Adding a field
//!
//! Define a newtype, implement the [`std::ops`] arithmetic traits
//! (`Add`, `Sub`, `Mul`, `Neg`), implement [`Field`] (`zero`,
//! `one`, `inv`), and implement [`FieldBytes`] if the element
//! will be absorbed into a Fiat-Shamir transcript.

pub mod baby_bear;
pub mod bfield;
pub mod bytes;
pub mod error;
pub mod f101;
pub mod field;

pub use baby_bear::BabyBear;
pub use bfield::BFieldElement;
pub use bytes::FieldBytes;
pub use error::Error;
pub use f101::F101;
pub use field::Field;