Surjective and Injective Functions: The Math Behind Verifying ML Kernel Equivalence

AI4Code · x · 2026-10-05

A UPenn professor shares how the "surjective" and "injective" functions from CS foundations came back to life while proving equivalence of tensor programs with PhD student Paul Biberstein and colleague Joe Devietti.

Checking if tensor programs P and Q are equivalent is decidable but intractable. Since 90% of time is spent in 10% of code, one can express P and Q as F ∘ R ∘ G and F ∘ S ∘ G, making the check of R == S tractable — with surjectivity/injectivity playing a key role.

Original post →

More from Research

Research channel →