LAWS.bend source
LAWS.bend on the hub · documented module
# WhiteMagic & Mandala Governance Laws# Stated independently of proofs; verified by `bend PROOF.bend`.import Baseimport ./main.bend as WMimport ./SPEC.bend as Spec# LAW 1 (Monotonic Capability Attenuation):# If an attenuated child token possesses capability `c`, the parent token must also possess `c`.law capability_attenuation_monotone: for +parent: WM.ScopeToken for +mask: WM.ScopeToken for +c: WM.Cap child = WM.attenuate(parent, mask) {Spec.implies(Spec.has_cap(child, c), Spec.has_cap(parent, c)) == True{} : Bool}# LAW 2 (Scope Attenuation Idempotence):# Attenuating any capability token with itself preserves the exact token.law attenuation_idempotent: for +t: WM.ScopeToken {WM.attenuate(t, t) == t : WM.ScopeToken}# LAW 3 (Single-Use Pass Replay Rejection):# Once `consume_pass` transitions a Mandala slot, `can_execute` on the resulting slot is always False.law jti_replay_rejected: for slot: WM.PassSlot next = WM.consume_pass(slot) {Spec.can_execute(next) == False{} : Bool}# LAW 4 (Constitutional Pareto Non-Regression):# A candidate with any protected-vector regression (`has_regression == True`) is NEVER promoted,# regardless of scalar fitness gain or provenance.law pareto_never_promotes_regression: for fitness_gain: Bool for provenance_ok: Bool fate = WM.adjudicate(True{}, fitness_gain, provenance_ok) {Spec.is_promoted(fate) == False{} : Bool}# LAW 5 (Constitutional Pareto Dominance Liveness):# A candidate with zero regressions, positive utility, and valid provenance is ALWAYS promoted.law pareto_dominance_promotes: fate = WM.adjudicate(False{}, True{}, True{}) {Spec.is_promoted(fate) == True{} : Bool}# LAW 6 (64-Hexagram Yijing Line Involution):# Inverting all 6 Yin/Yang lines of any hexagram twice restores the exact original hexagram.law hexagram_involution: for h: WM.Hexagram6 {WM.invert_hex(WM.invert_hex(h)) == h : WM.Hexagram6}# LAW 7 (Sutra Superoptimizer Idempotent Absorption):# Applying a Sutra PRAY-phase operator twice before `rest` has the exact same denotation as applying it once.law superopt_idempotent_absorption: for +g: WM.PrayMask for +rest: WM.PrayMask {WM.superopt_step(g, WM.superopt_step(g, rest)) == WM.superopt_step(g, rest) : WM.PrayMask}# LAW 8 (Sutra PRAY Conjunction Commutativity):# Merging two Sutra PRAY denotations is commutative.law pray_mask_commutative: for +a: WM.PrayMask for +b: WM.PrayMask {WM.merge_pray(a, b) == WM.merge_pray(b, a) : WM.PrayMask}# LAW 9 (Citta Crystal Monotonic Epoch Step):# Advancing a revision epoch by 1n equals the strict successor of the identity revision.law crystal_anti_rollback_monotonicity: for rev: Nat {WM.advance_epoch(rev) == Spec.expected_next_epoch(rev) : Nat}