---
title: 'Function-Correcting Codes: Theory & Applications'
url: https://www.emergentmind.com/topics/function-correcting-codes-fccs
type: topic
---

# Function-Correcting Codes: Theory & Applications

Function-Correcting Codes (FCCs) are a novel class of error-correcting codes designed to guarantee the reliable recovery of prescribed function values computed on a message, while minimizing the redundancy compared to classical codes. In contrast to traditional error-correcting codes (ECCs), which require all distinct message codewords to be separated by a fixed metric distance, FCCs only impose distance constraints between codewords with nonequivalent function values. This fundamental relaxation can dramatically reduce redundancy when the function of interest is many-to-one. FCCs admit a general, function- and metric-dependent combinatorial framework, and have been explicitly studied for various algebraic and combinatorial metrics, including Hamming, Lee, pair, and homogeneous distances.

## 1. Formal Definition and Framework

Consider messages $u \in \mathbb{Z}_q^k$ and a target function $f: \mathbb{Z}_q^k \rightarrow \operatorname{Im}(f)$. A **systematic function-correcting code** (FCC) for $f$ and $t$-error correction in a metric $d$ is an encoding map $\operatorname{Enc}(u) = (u, p(u)) \in \mathbb{Z}_q^{k+r}$ such that if $f(u_1) \neq f(u_2)$, then $d(\operatorname{Enc}(u_1), \operatorname{Enc}(u_2)) \geq 2t+1$ [2508.01702]. The smallest $r$ for which such an encoder exists is the **optimal redundancy** $r^f(q,k,t)$.

### FCCs in the Lee Metric

The Lee metric for $a,b \in \mathbb{Z}_q$ is $d_L(a,b) = \min(|a-b|, q-|a-b|)$. For vectors, $d_L(x,y) = \sum_{i=1}^n d_L(x_i, y_i)$. The systematic FCC for $f$ in the Lee metric (a Function-Correcting Lee Code, FCLC) satisfies $d_L(\operatorname{Enc}(u_1), \operatorname{Enc}(u_2)) \geq 2t+1$ when $f(u_1) \neq f(u_2)$ [2508.01702].

A central tool is the **distance requirement matrix** $D_f$ of size $M = |\mathbb{Z}_q^k|$ with entries $[D_f]_{ij} = [2t+1 - d_L(u_i, u_j)]^+$ for $f(u_i) \neq f(u_j)$, else $0$. The minimal $r$ such that a set of redundancy vectors $\{p_1, ..., p_M\} \subset \mathbb{Z}_q^r$ exists with $d_L(p_i, p_j) \geq [D_f]_{ij}$ for all $i \neq j$ is denoted $N_L(D_f)$. The optimal redundancy is $r_L^f(q,k,t) = N_L(D_f)$ [2508.01702].

## 2. Core Principles and Theoretical Bounds

FCC design reduces to constructing **irregular-distance codes**: vector sets subject to a matrix of minimum distance constraints reflecting function preimages. Two main types of bounds result:

- **Plotkin-like Lower Bound**: For even $q$, $N_L(D) \geq (8/(M^2 q)) \sum_{i<j} [D]_{ij}$. For odd $q$, $N_L(D) \geq (4/(M^2 \lfloor q/2 \rfloor)) (q/(q+1)) \sum_{i<j} [D]_{ij}$. The denominator adjusts for parity in $M$ and $q$ [2508.01702].
- **Gilbert–Varshamov Upper Bound**: $N_L(D) \leq \min \{r : q^r > \max_j \sum_{i < j} V_L(r, D_{ij} - 1)\}$, with $V_L(r, \rho)$ the size of a Lee ball of radius $\rho$ [2507.17654].

These generalize bounds for classical codes. For any function, the redundancy obeys
$$
N_L(2, 2t) \leq r_L^f(q,k,t) \leq N_L(|\operatorname{Im}(f)|, 2t).
$$

## 3. Explicit FCC Constructions and Function Classes

Explicit and often optimal FCLCs have been constructed for several function classes [2508.01702, 2507.17654]:

### 3.1 Lee Weight ($f(u) = \mathrm{wt}_L(u)$)

Let $E = k \lfloor q/2 \rfloor + 1$; consider representative vectors of weights $0, 1, ..., E$. The code distance matrix is $[D_{wt}]_{ij} = [2t+1 - |i-j|]^+$.

**Construction**: For $q \geq 5$, $t \leq (q-3)/2$:
- Odd $q$: $p_s = 2s \bmod q$.
- Even $q$: $p_s = 2s \bmod q$ for $s < q/2$, $p_s = 2s+1 \bmod q$ for $s \geq q/2$.
- Redundancy is $t$ ($r = t$).
  
This is optimal for many small $q, k$. Applying the Plotkin bound to $D_{wt}$ gives explicit lower bounds [2508.01702].

### 3.2 Lee-Weight Distribution ($f(u) = \lfloor \mathrm{wt}_L(u)/T \rfloor$)

Divide weight into $T$-bins. If $T$ divides $E$, then image size is $E' = E / T$.

- Upper bound: $r_L^\Delta(q,k,t) \leq N_L(D_\Delta)$, with $D_\Delta$ reflecting minimum bin differences.
- For $t \leq T$, redundancy $r \leq t$.

### 3.3 Modular Sum ($f(u) = \sum_{i} u_i \bmod q$)

Image size $E=q$. Assign each modular sum $s$ a parity $p_s$ as above. Redundancy requirements mirror those for Lee weight.

### 3.4 Locally $(2t,\lambda)_L$-Bounded Functions

If $f$ is locally $(2t,\lambda)_L$, i.e., the value set of $f$ within any Lee-ball of radius $2t$ is $\leq \lambda$, assign a coloring $\operatorname{Col}_f$ with $\lambda$ colors, then use a code with parameters adapted to $\lambda$. For $\lambda \leq q/2$, $r = \lceil t / \lfloor q/(2\lambda) \rfloor \rceil$. This is sometimes optimal by matching lower bounds.

## 4. Redundancy Analysis and Comparative Performance

Lower and upper bounds can often be explicitly calculated for concrete function classes using matrix methods and combinatorial arguments [2508.01702]. In the most studied cases, explicit constructions achieve minimal redundancy.

A comparative summary:

| Method                 | Redundancy Lower Bound             | Typical Redundancy Achieved        |
|------------------------|------------------------------------|------------------------------------|
| Classical Lee ECC      | $\geq \log_q V_t^{(n)}$           | Sphere-packing dominated           |
| ECC on function values | $\geq \log_q (|\operatorname{Im}(f)| \cdot V_t^{(n)})$ | Function-image size dominates      |
| FCLC                   | $t, 2t-1$ (varies by class)        | Often $r = t$ (see Lee weight)     |

In the Lee-weight example with $q=5,k=2,t=1$, ECC on data needs $r \geq 2$, ECC on function values $r \geq 3$, but FCLC achieves $r=1$. For large $k$ and functions with small image size, $r$ can be substantially smaller with FCLCs.

## 5. Graph-Theoretic and Algorithmic Perspectives

FCC construction is equivalent to finding large independent sets in a function-dependent graph where vertices encode messages and their redundancy and edges correspond to forbidden pairs under the metric and $f$ constraints [2508.01702]. The problem reduces to constructing a code with a prescribed irregular-distance matrix, leveraging coloring and code-assignment techniques. Greedy and coloring-based algorithms derive from Brooks' theorem and sphere-packing ideas.

## 6. Specializations, Metric Extensions, and Open Problems

The FCC paradigm generalizes readily to other metrics (b-symbol, symbol-pair, homogeneous, Hamming). Reed–Muller, Gray-code, and parity-repetition constructions have broad applicability [2508.01702][2507.17654]. Tight Plotkin-type bounds have been extended to the Lee metric, improving upon prior results in the homogeneous metric [2507.17654].

Open problems include:
- Tightening bounds for specific $f, t, q$.
- Explicit constructions for more general algebraic and combinatorial $f$.
- Extensions to list decoding, probabilistic decoding, and channels with additional error models.

## 7. Significance and Applications

FCCs, particularly in the Lee metric, provide a rigorous method to optimize and minimize redundancy when only a function of a message matters for downstream reliability—central to data aggregation, hash verification, machine learning inference in storage, and error-resilient distributed computations [2508.01702]. Their design paradigm offers a strict generalization of error-correcting codes, interpolating between function-value and data protection, and enables significant improvements in code rate for a wide spectrum of practical coding scenarios.

Source: https://www.emergentmind.com/topics/function-correcting-codes-fccs