boolean_derivative_zero
For any Boolean function f on (Fin n → ZMod 2), the directional derivative of f along the zero vector is the zero function.
Statement
theorem boolean_derivative_zero {n : ℕ} (f : (Fin n → ZMod 2) → ZMod 2) : boolean_derivative 0 f = 0- Source
- folklore
- Verified
- 27 Oct 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 1
- boolean_derivativeThe directional derivative of a Boolean function f on (Fin n → ZMod 2) along a vector v is the function x ↦ f(x) + f(x + v).
Read back from the Lean
For any natural number $n$ and any function $f : (\text{Fin } n \to \mathbb{Z}/2\mathbb{Z}) \to \mathbb{Z}/2\mathbb{Z}$, the Boolean derivative of $f$ with respect to the zero vector $0$ is equal to the constant zero function.
Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.
The proof, explained
To prove that the directional derivative of any Boolean function f along the zero vector is identically zero, we evaluate the derivative pointwise at an arbitrary input x. By definition, the derivative along 0 is f(x) + f(x + 0) = f(x) + f(x). In characteristic 2, adding any element to itself yields 0, so the expression simplifies to the zero function.
It suffices to show that the derivative evaluates to zero on an arbitrary input x.
By function extensionality (ext x), two functions on (Fin n → ZMod 2) are equal if they agree on all inputs. This reduces the goal to proving that (boolean_derivative 0 f) x = 0 x for an arbitrary vector x.
ext xThe directional derivative along the zero vector evaluates to 0 at x, completing the proof.
Unfolding the definition of boolean_derivative, the left-hand side is f x + f (x + 0). Since adding the zero vector leaves x unchanged, this expression is f x + f x. In ZMod 2, which has characteristic 2, adding any element to itself gives zero by CharTwo.add_self_eq_zero. The right-hand side is the zero function applied to x, which is also 0.
uses
boolean_derivative,CharTwo.add_self_eq_zerosimp [boolean_derivative, CharTwo.add_self_eq_zero]
boolean_derivative- The directional derivative of a Boolean function f along a direction vector v, defined by (fun x => f x + f (x + v)).
CharTwo.add_self_eq_zero- In any semiring of characteristic 2, adding any element to itself yields zero (x + x = 0).
Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.
Lean source view module on GitHub
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
/-- The directional derivative along zero is zero. -/theorem boolean_derivative_zero {n : ℕ} (f : (Fin n → ZMod 2) → ZMod 2) : boolean_derivative 0 f = 0 := by ext x simp [boolean_derivative, CharTwo.add_self_eq_zero]