Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Lemma 20.4: on {±1}^k, ∧ᵢxᵢ = sign(1 − k + ∑ᵢxᵢ) and ∨ᵢxᵢ = sign(k − 1 + ∑ᵢxᵢ)

Proved
UnderstandingML.sign_and_or

by naimengye · Sep 24, 2026 · Mathlib 0df444a (Lean v4.33.1)

boolean-circuitshalfspacesneural-networks

Lemma 20.4. Suppose that a neuron vvv, that implements the sign activation function, has kkk incoming edges, connecting it to neurons whose outputs are in {±1}\{\pm1\}{±1}. Then, by adding one more edge, linking a "constant" neuron to vvv, and by adjusting the weights on the edges to vvv, the output of vvv can implement the conjunction or the disjunction of its inputs.

Formally (the proof's formulas): for x∈{±1}kx \in \{\pm1\}^kx∈{±1}k, 1−k+∑ixi>01 - k + \sum_i x_i > 01−k+∑i​xi​>0 iff all xi=1x_i = 1xi​=1, and k−1+∑ixi>0k - 1 + \sum_i x_i > 0k−1+∑i​xi​>0 iff some xi=1x_i = 1xi​=1.

Preamble
import Definitions.Def_UnderstandingML_NeuralNetworks

open MeasureTheory
Formal statement
namespace UnderstandingML

/-- **Lemma 20.4** (p. 273). Suppose that a neuron `v`, that implements the sign activation
function, has `k` incoming edges, connecting it to neurons whose outputs are in `{±1}`. Then,
by adding one more edge, linking a "constant" neuron to `v`, and by adjusting the weights on
the edges to `v`, the output of `v` can implement the conjunction or the disjunction of its
inputs: `∧ᵢ xᵢ = sign(1 − k + ∑ᵢ xᵢ)` and `∨ᵢ xᵢ = sign(k − 1 + ∑ᵢ xᵢ)`. -/
theorem sign_and_or (k : ℕ) (x : Fin k → Bool) :
    (0 < 1 - (k : ℝ) + ∑ i, (if x i then (1 : ℝ) else -1) ↔ ∀ i, x i = true) ∧
    (0 < (k : ℝ) - 1 + ∑ i, (if x i then (1 : ℝ) else -1) ↔ ∃ i, x i = true) := by sorry

end UnderstandingML
Source
Shalev-Shwartz and Ben-David, Understanding Machine Learning: From Theory to Algorithms, Cambridge University Press 2014, doi:10.1017/CBO9781107298019, §20.3 p. 273, Lemma 20.4 with its proof
Human review
  • Endorsed by Shuze Chen · Sep 25, 2026

    Confirmed by the moderator at approval.

  • Endorsed by naimengye · Sep 25, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me