The Problem
Let $p$ be a prime. Does there exist a $p^3$-variable polynomial $P$ over $\mathbb{Z}_p[x_1,\dots,x_{p^3}]$ such that
- $P(\boldsymbol{0}) \equiv 0 \ (p)$
- $P(\boldsymbol{x}) \equiv 1 \ (p)$ for any $\boldsymbol{x} \ne \boldsymbol{0}$.
- $\deg{P} \in O{(p^2)}$ (its degree is at most some $2$-degree polynomial in $p$)
Meaning that $P$ is equivalent to the indicator function (or $1-$ the indicator function) over $\mathbb{Z}_p[x_1,\dots,x_{p^3}]$, and has degree of at most $O(p^2)$.
Fermat's Little Theorem
Due to Fermat's little theorem, for any prime $p$:
$$a^{p-1} \equiv \begin{cases}1 \quad \text{ if } a \not\equiv 0 \\ 0 \quad \text{ if } a\equiv 0\end{cases} \quad (p)$$
Trial and error
I have tried the following potential candidates, but they all fail in at least one of these aspects:
Trial 1:
$$P(\boldsymbol{x}) \stackrel{?}{=} \left(\sum_{i=1}^{p^3} x_i^{p-1}\right)^{p-1}$$
- $P(\boldsymbol{0}) \equiv 0 \ (p) \quad \checkmark$
- But if $\boldsymbol{x} = (\underbrace{1,\dots,1}_p,\underbrace{0,\dots,0}_{p^3-p})$, then
$$P(\boldsymbol{x}) = \left(\sum_{i=1}^{p} 1 + \sum_{i=p+1}^{p^3} 0 \right)^{p-1} = p^{p-1} \equiv 0^{p-1} \equiv 0 \quad (p)$$
So in this case, condition 2 fails to hold.
Trial 2:
$$P(\boldsymbol{x}) \stackrel{?}{=} 1-\prod_{i=1}^{p^3} (1-x_i)^{p-1}$$
Clearly holds in this case. $\quad \checkmark$
Also holds, $P(\boldsymbol{x}) = 1$ exactly if none of the $x_i$'s are $0$, a.k.a., if $\boldsymbol{x} \ne \boldsymbol{0}$. $\quad \checkmark$
However Condition 3 fails here. The polynomial's degree is $p^3(p-1) = O(p^4)$.
Trial 3:
$$P(\boldsymbol{x}) \stackrel{?}{=} \left(\sum_{\begin{matrix}I \subseteq \{1,\dots,p^3\} \\ |I| = kp \\ k \in \{1,\dots,p^2\}\end{matrix}} \left( \sum_{i\in I} x_i^{p-1} \right)^{p-1}\right)^{p-1} + \left(\sum_{i=1}^{p^3} x_i^{p-1}\right)^{p-1}$$
- $P(\boldsymbol{0}) \equiv 0 \ (p) \quad \checkmark$
- $P(\boldsymbol{x}) \equiv 1 \ (p)$ also holds here. The right term is the exact same as the entire polynomial in Trial 1; and the left term equals $1$ for exactly the $\boldsymbol{x}^{p-1}$'s where number of $1$'s it contains is divisible by $p$. $\quad \checkmark$
- However $\deg{P} = (p-1)^3 \in O(p^3)$. (But, we're getting closer. The last example was $O(p^4)$.)
Note:
$$P(\boldsymbol{x}) \stackrel{?}{=} 1-I(\boldsymbol{x} = 0)$$
where $I$ is the real indicator function.
However, $P$ needs to be a polynomial, so I can't just use the "regular" indicator function.
Context
I am trying to prove a theorem using the Chevalley-Warning theorem, which requires certain conditions for the degrees polynomials. The main issue is actually to construct such a polynomial, and once that's done, the theorem would basically "prove itself". However, it is possible, that such a polynomial doesn't exist.