⚙️ ISABELLE RUNE DIFFICULTY: Apprentice Structural

The Decorator

Attach additional responsibilities to a theorem or function dynamically without modifying its core truth.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Decorator
ARCANUM SCHOOL: Transmutation // Enhancement
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// ISABELLE PATTERN //
theory Decorator
  imports Main
begin

type_synonym spell = "nat \<Rightarrow> nat"

definition base_spell :: spell where
  "base_spell mana = mana * 2"

definition empower_decorator :: "spell \<Rightarrow> spell" where
  "empower_decorator s = (\<lambda>mana. s mana + 50)"

definition echoing_decorator :: "spell \<Rightarrow> spell" where
  "echoing_decorator s = (\<lambda>mana. s (s mana))"

end
Runic Tags: #isabelle #hol #transmutation #design-patterns