⚙️ LEAN RUNE DIFFICULTY: Apprentice Creational

The Singleton

A singular absolute mathematical truth from which all local wards derive.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Singleton
ARCANUM SCHOOL: Divination // Truth
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// LEAN PATTERN //
namespace MathematicalWards

inductive AbsoluteTruth where
  | uniqueInstance : AbsoluteTruth

def getTruth : AbsoluteTruth :=
  AbsoluteTruth.uniqueInstance

def Truth.axiom (t : AbsoluteTruth) : String :=
  "1 + 1 = 2"

end MathematicalWards

The Singleton pattern in Lean 4 is naturally expressed by defining a type with exactly one constructor, ensuring that mathematically only one instance can ever exist.

Runic Tags: #creational #lean4 #singleton #wards