Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Binary phases and the elementary complex tensor transform

Definition
IntMul_BinaryQuadraticPhase

by raresbuhai · Oct 9, 2026 · Mathlib 0df444a (Lean v4.33.1)

algebrabinary-quadratic-formsinteger-multiplicationtensor-transforms

This interface defines the binary character (−1)a(-1)^a(−1)a, its doubled lift from F2\mathbb F_2F2​ to Z/4Z\mathbb Z/4\mathbb ZZ/4Z, and the exact Gaussian-integer phase iqi^qiq. It also defines the one-coordinate complex transform CCC with diagonal entries (1+i)/2(1+i)/2(1+i)/2 and off-diagonal entries (1−i)/2(1-i)/2(1−i)/2, its tensor-product kernel, the coordinatewise phase ∏jixj\prod_j i^{x_j}∏j​ixj​, and Hamming weight modulo four. The file contains only definitions, with no residual normal-form or machine-correctness assumptions. These are the objects in the complex binary residual interface used by the integer-multiplication κ construction.

Definition code
import Mathlib.Data.ZMod.Basic
import Mathlib.NumberTheory.Zsqrtd.GaussianInt

/-! Binary characters and exact fourth-root phases for the complex residual interface.
These definitions contain no algorithmic, analytic, or normal-form assumptions. -/

open scoped BigOperators

namespace IntMul.BinaryPhase

/-- The real-valued binary character, embedded in the complex numbers. -/
def sign (a : ZMod 2) : ℂ := if a.val = 0 then 1 else -1

/-- The canonical doubled lift from a binary value to a value modulo four. -/
def twice (a : ZMod 2) : ZMod 4 := 2 * (a.val : ZMod 4)

/-- An exact Gaussian-integer fourth root, using the canonical residue modulo four. -/
def phase (a : ZMod 4) : GaussianInt := (Zsqrtd.sqrtd : GaussianInt) ^ a.val

/-- The canonical bit lifted to a residue modulo four. -/
def liftBit (a : ZMod 2) : ZMod 4 := (a.val : ZMod 4)

/-- The elementary complex transform on one binary coordinate. -/
noncomputable def cEntry (a b : ZMod 2) : ℂ :=
  if a.val = b.val then (1 + Complex.I) / 2 else (1 - Complex.I) / 2

/-- The tensor product of the elementary complex transform, expressed by entries. -/
noncomputable def tensorKernel {ι : Type*} [Fintype ι] (x y : ι → ZMod 2) : ℂ :=
  ∏ i, cEntry (x i) (y i)

/-- Coordinatewise fourth-root phases. -/
def coordinatePhase {ι : Type*} [Fintype ι] (x : ι → ZMod 2) : ℂ :=
  ∏ i, (phase (liftBit (x i)) : ℂ)

/-- Hamming weight reduced modulo four. -/
def quadraticWeight {ι : Type*} [Fintype ι] (x : ι → ZMod 2) : ZMod 4 :=
  ∑ i, liftBit (x i)

end IntMul.BinaryPhase
Source
CrocSwap/integer-mult-bounds, commit 3b6b66891c0ac888521cf591fe306c6286601d4f, notes/endpoint-gauge-complex.tex, subsection “A normal form for every nondegenerate binary residual”. https://github.com/CrocSwap/integer-mult-bounds/blob/3b6b66891c0ac888521cf591fe306c6286601d4f/notes/endpoint-gauge-complex.tex

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