The Composite of Ward Networks
Treating individual wards and networks of wards uniformly.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Composite
ARCANUM SCHOOL: Abjuration // Warding
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
module Composite
type ward_component =
| LeafWard : power:nat -> ward_component
| WardNode : left:ward_component -> right:ward_component -> ward_component
let rec total_power (w: ward_component) : nat =
match w with
| LeafWard p -> p
| WardNode l r -> total_power l + total_power r
A unified recursive type for warding networks, easily reasoning over the total defensive power using F*’s structural induction.
Runic Tags:
#composite
#wards
#trees