Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Continuous piecewise linear functions, nnn-order hinges, and hinging-hyperplane sums

Definition
WangSunCPWL

by carlok · Sep 7, 2026 · Mathlib 0df444a (Lean v4.33.1)

approximation-theoryconvex-analysislattice-theorypiecewise-linear

Fix a dimension nnn and work with real-valued functions on Rn\mathbb{R}^nRn, identified with Fin n → ℝ. This file sets up the three notions used by the Wang–Sun representation theorem for continuous piecewise linear functions.

Continuous piecewise linear functions. CPWL is defined inductively as the sublattice of RRn\mathbb{R}^{\mathbb{R}^n}RRn generated by the affine maps: every affine T:Rn→RT : \mathbb{R}^n \to \mathbb{R}T:Rn→R is CPWL, and the class is closed under the pointwise operations f∨g=max⁡(f,g)f \vee g = \max(f,g)f∨g=max(f,g) and f∧g=min⁡(f,g)f \wedge g = \min(f,g)f∧g=min(f,g). This lattice-theoretic presentation is equivalent to the usual geometric one — continuous and affine on each cell of a finite polyhedral subdivision of Rn\mathbb{R}^nRn — and it is the presentation that makes structural induction available.

nnn-order hinges. Following Wang and Sun, a hinge is indexed by one less than its number of affine arguments, so an nnn-order hinge on Rn\mathbb{R}^nRn takes n+1n+1n+1 of them: IsHinge h holds when there are a sign σ∈{+1,−1}\sigma \in \{+1,-1\}σ∈{+1,−1} and affine maps ℓ0,…,ℓn\ell_0, \dots, \ell_nℓ0​,…,ℓn​ with

h(x)  =  σ⋅max⁡0≤i≤nℓi(x)(x∈Rn).h(x) \;=\; \sigma \cdot \max_{0 \le i \le n} \ell_i(x) \qquad (x \in \mathbb{R}^n).h(x)=σ⋅0≤i≤nmax​ℓi​(x)(x∈Rn).

Hinging hyperplane sums. IsHH f holds when fff is a finite sum ∑k=1Khk\sum_{k=1}^{K} h_k∑k=1K​hk​ of nnn-order hinges. The Wang–Sun theorem asserts that every CPWL function is an IsHH function; these definitions are the vocabulary in which that theorem and its supporting lemmas are stated.

Definition code
import Mathlib

open Finset

variable {n : ℕ}

/-- Continuous piecewise linear functions on `ℝⁿ`, presented as the sublattice of
`ℝⁿ → ℝ` generated by the affine maps. -/
inductive CPWL : ((Fin n → ℝ) → ℝ) → Prop
  | affine (T : (Fin n → ℝ) →ᵃ[ℝ] ℝ) : CPWL ⇑T
  | sup {f g} (hf : CPWL f) (hg : CPWL g) : CPWL (f ⊔ g)
  | inf {f g} (hf : CPWL f) (hg : CPWL g) : CPWL (f ⊓ g)

/-- Wang and Sun index hinges by one less than the number of affine arguments, so an
`n`-order hinge on `ℝⁿ` takes `n + 1` of them. -/
def IsHinge (h : (Fin n → ℝ) → ℝ) : Prop :=
  ∃ (σ : ℝ) (L : Fin (n + 1) → ((Fin n → ℝ) →ᵃ[ℝ] ℝ)),
    (σ = 1 ∨ σ = -1) ∧
      h = fun x => σ * ((univ : Finset (Fin (n + 1))).sup' univ_nonempty fun i => L i x)

/-- A finite sum of `n`-order hinges. -/
def IsHH (f : (Fin n → ℝ) → ℝ) : Prop :=
  ∃ (K : ℕ) (h : Fin K → ((Fin n → ℝ) → ℝ)), (∀ k, IsHinge (h k)) ∧ f = ∑ k, h k
Source
Definitions transcribed verbatim from the preamble of the Prove2Me theorem WangSun.Main (theorem_id 63eec3c9-377a-4237-8fe6-f5d41ac2d0e2), whose natural-language statement attributes the result to S. Wang and X. Sun, Generalization of hinging hyperplanes, IEEE Transactions on Information Theory 51 (2005), 4425-4431.

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