//! strata-core โ algebraic trait hierarchy for verifiable computation.
//!
//! four tiers of traits organized by consumer need:
//!
//! ## tier 1: universal (this crate)
//!
//! every algebra implements at least one of these.
//!
//! ```text
//! Codec encode, decode โ serialization
//! Semiring add, mul, zero, one โ tropical lives here
//! Ring + sub, neg โ polynomial rings live here
//! Field + inv, sqrt, double, pow โ finite fields live here
//! ```
//!
//! ## tier 2: proof system (`strata-proof`)
//!
//! traits needed by lens (commitment) and zheng (verification).
//!
//! ```text
//! Reduce reduce(bytes) โ element โ Fiat-Shamir challenges
//! Dot dot(a, b) โ scalar โ inner product for constraint evaluation
//! ```
//!
//! ## tier 3: computation (`strata-compute`)
//!
//! traits needed by nox (execution) and jali (ring arithmetic).
//!
//! ```text
//! Spectral roots_of_unity, two_adicity โ fields with NTT/transform domain
//! Bits to_bits, from_bits โ bit decomposition for binary operations
//! ```
//!
//! ## tier 4: structure (`strata-ext`)
//!
//! traits for specific algebraic structures.
//!
//! ```text
//! Extension<Base> base field, degree, frobenius โ tower fields
//! Batch batch_inv โ Montgomery's trick
//! Blind ct_eq, ct_select โ timing-safe operations
//! ```
//!
//! ## the five algebras
//!
//! | type | crate | tiers |
//! |------|-------|-------|
//! | Goldilocks | nebu | Field + Reduce + Dot + Spectral + Bits + Extension + Batch |
//! | Fโยนยฒโธ | kuro | Field + Reduce + Dot + Bits + Extension + Batch |
//! | RingElement | jali | (uses Goldilocks for scalar ops) |
//! | Tropical | trop | Semiring + Codec |
//! | Fq | genies | Field + Reduce + Dot + Batch + Blind |
use ;
// โโ tier 1: universal โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
/// serialize algebraic elements to and from bytes.
///
/// `encode` produces canonical bytes. `decode` rejects non-canonical input
/// (returns None) โ it NEVER silently reduces. this is critical for soundness:
/// a verifier accepting non-canonical elements can break proof security.
/// semiring: two operations with identities. no subtraction.
///
/// addition and multiplication are associative and commutative.
/// multiplication distributes over addition. zero annihilates (a * 0 = 0).
///
/// the tropical semiring (min, +) satisfies this โ min has no inverse.
/// ring: semiring with subtraction and negation.
///
/// the additive structure is a group (every element has an additive inverse).
/// polynomial ring R_q = F_p[x]/(x^n+1) satisfies this.
/// field: ring with multiplicative inverse and related operations.
///
/// every nonzero element has a unique multiplicative inverse.
/// Goldilocks (nebu), Fโยนยฒโธ (kuro), F_q (genies) satisfy this.