Multiple-inheritance hazards in dependently-typed algebraic hierarchies

06/01/2023
by   Eric Wieser, et al.
0

Abstract algebra provides a large hierarchy of properties that a collection of objects can satisfy, such as forming an abelian group or a semiring. These classifications can arranged into a broad and typically acyclic directed graph. This graph perspective encodes naturally in the typeclass system of theorem provers such as Lean, where nodes can be represented as structures (or records) containing the requisite axioms. This design inevitably needs some form of multiple inheritance; a ring is both a semiring and an abelian group. In the presence of dependently-typed typeclasses that themselves consume typeclasses as type-parameters, such as a vector space typeclass which assumes the presence of an existing additive structure, the implementation details of structure multiple inheritance matter. The type of the outer typeclass is influenced by the path taken to resolve the typeclasses it consumes. Unless all possible paths are considered judgmentally equal, this is a recipe for disaster. This paper provides a concrete explanation of how these situations arise (reduced from real examples in mathlib), compares implementation approaches for multiple inheritance by whether judgmental equality is preserved, and outlines solutions (notably: kernel support for η-reduction of structures) to the problems discovered.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
03/02/2018

On the Use of Computational Paths in Path Spaces of Homotopy Type Theory

The treatment of equality as a type in type theory gives rise to an inte...
research
02/05/2020

Knowledge representation and update in hierarchies of graphs

A mathematical theory is presented for the representation of knowledge i...
research
05/18/2023

Clifford Group Equivariant Neural Networks

We introduce Clifford Group Equivariant Neural Networks: a novel approac...
research
04/03/2018

On the Calculation of Fundamental Groups in Homotopy Type Theory by Means of Computational Paths

One of the most interesting entities of homotopy type theory is the iden...
research
09/13/2022

Stable finiteness of twisted group rings and noisy linear cellular automata

For linear non-uniform cellular automata (NUCA) which are local perturba...
research
11/23/2022

Improved Elekes-Szabó type estimates using proximity

We prove a new Elekes-Szabó type estimate on the size of the intersectio...

Please sign up or login with your details

Forgot password? Click here to reset