Urgent.News

What's breaking now, across hundreds of outlets.

Tech

the algebra of dependent types (2025)

The algebra of dependent types, as explored in a recent learning experience, sheds light on the usage of Greek letters Π and Σ in type theory notation. These symbols, typically understood from context, have a more intuitive explanation when connected to algebraic data types.

For instance, the unit type () has only one inhabitant, denoted as (), akin to the number 1. The boolean type, bool, contains two inhabitants, false and true, reminiscent of the number 2. Similarly, pairing or tuple types, such as pairs or records, follow a multiplication rule for the number of possible values, reflecting their algebraic nature.

Dependent pairs, or Σ-types, introduce an additional layer of complexity. Here, the type of the second element hinges on the value of the first. A classic example is a slice, where an array [i64; N] requires its size to be specified, while an IntSlice type knows its size inherently. In type theory, a dependent pair is often written as Σ (i64; N), binding a variable with a type annotation.

The number of potential values in a dependent pair is the sum of possibilities for each case, akin to a summation operation. Conversely, when the second element does not depend on the first, the count of inhabitants reduces to a product type, mirroring the conventional multiplication rule.

The term "telescope" for multi-part dependent tuples or records, derived from AUTOMATH, a pioneering computerized proof assistant, adds further depth to this algebraic approach. The return type of a dependent function, depending on the passed argument, can be viewed as a large lookup table, akin to the product of multiple functions, denoted as BA. Functions, as exponential types, can be counted by considering each as a tuple of possible outputs, or BA.

While terms like "dependent sum" and "dependent product" might seem intuitive, they can be confusing when discussing variants, records, or functions. Thus, the preference for "sum type" persists, despite its limitations.

Rewritten by urgent.news; may contain errors — check the original.

Source: dotat.at

Read the original at dotat.at →

Report a problem with this story

More in Tech

Kalshi pauses operations in Utah, where it has 177K+ users, citing a federal court loss over a state gambling law; Kalshi also faces criminal charges in Utah (Alixel Cabrera/Utah News Dispatch)

Amid multiple legal disputes between Utah leaders and Kalshi, the prediction market platform has paused operations in the state.

  • Kalshi halts operations in Utah due to federal court loss over gambling law
  • Company faces 12 felony charges for online gambling promotion in Utah
  • Utah Attorney General pleased with Kalshi's decision to block operations

More from Tuesday 24 November →