← All papers
First page of Scalar actions in Lean's mathlib

Scalar actions in Lean's mathlib

Eric Wieser

cs.LO Aug 10, 2021 · v1
Analyzes the typeclass-based encoding of scalar actions throughout Lean's mathlib library.
Scalar actions are ubiquitous in mathematics, and therefore it is valuable to be able to write them succinctly when formalizing. This paper explores how Lean 3's typeclasses are used by mathlib for scalar actions, illustrates problems including compatibility of actions and non-definitionally-equal diamonds, and notes solutions and areas still needing more work.

Scalar actions are ubiquitous in mathematics, but formalizing them concisely in a proof assistant raises issues with typeclass design, compatibility of actions, and non-definitionally-equal diamonds.

The paper explores how Lean 3 typeclasses are used by mathlib for scalar actions. It documents the design patterns, illustrates problems including compatibility of multiple actions on the same type and diamond inheritance issues where different paths yield non-definitionally-equal instances.

The paper identifies key problems in mathlib scalar action design (compatibility conditions, non-definitional diamonds) and notes existing solutions along with areas still requiring more work.