~/bend-docscommunity

LAWS.bend open laws/TODOs

raw source on the hub · import 0xe7cbe6684dd31616b6b8e2f83096a120/LAWS.bend as LAWS

WhiteMagic & Mandala Governance Laws Stated independently of proofs; verified by bend PROOF.bend.

3 imports
import Base
import ./main.bend as WM
import ./SPEC.bend as Spec

Laws

law capability_attenuation_monotone provedin PROOF.bendsource · line 10 · raw

@+parent:0xe7cbe6684dd31616b6b8e2f83096a120/main.ScopeToken -> @+mask:0xe7cbe6684dd31616b6b8e2f83096a120/main.ScopeToken -> @+c:0xe7cbe6684dd31616b6b8e2f83096a120/main.Cap -> (child = 0xe7cbe6684dd31616b6b8e2f83096a120/main.attenuate(parent, mask); {0xe7cbe6684dd31616b6b8e2f83096a120/SPEC.implies(0xe7cbe6684dd31616b6b8e2f83096a120/SPEC.has_cap(child, c), 0xe7cbe6684dd31616b6b8e2f83096a120/SPEC.has_cap(parent, c)) == True{} : Bool})

LAW 1 (Monotonic Capability Attenuation): If an attenuated child token possesses capability c, the parent token must also possess c.

law attenuation_idempotent provedin PROOF.bendsource · line 19 · raw

@+t:0xe7cbe6684dd31616b6b8e2f83096a120/main.ScopeToken -> {0xe7cbe6684dd31616b6b8e2f83096a120/main.attenuate(t, t) == t : 0xe7cbe6684dd31616b6b8e2f83096a120/main.ScopeToken}

LAW 2 (Scope Attenuation Idempotence): Attenuating any capability token with itself preserves the exact token.

law jti_replay_rejected provedin PROOF.bendsource · line 25 · raw

@slot:0xe7cbe6684dd31616b6b8e2f83096a120/main.PassSlot -> (next = 0xe7cbe6684dd31616b6b8e2f83096a120/main.consume_pass(slot); {0xe7cbe6684dd31616b6b8e2f83096a120/SPEC.can_execute(next) == False{} : Bool})

LAW 3 (Single-Use Pass Replay Rejection): Once consume_pass transitions a Mandala slot, can_execute on the resulting slot is always False.

law pareto_never_promotes_regression provedin PROOF.bendsource · line 33 · raw

@fitness_gain:Bool -> @provenance_ok:Bool -> (fate = 0xe7cbe6684dd31616b6b8e2f83096a120/main.adjudicate(True{}, fitness_gain, provenance_ok); {0xe7cbe6684dd31616b6b8e2f83096a120/SPEC.is_promoted(fate) == 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_dominance_promotes provedin PROOF.bendsource · line 41 · raw

fate = 0xe7cbe6684dd31616b6b8e2f83096a120/main.adjudicate(False{}, True{}, True{}); {0xe7cbe6684dd31616b6b8e2f83096a120/SPEC.is_promoted(fate) == True{} : Bool}

LAW 5 (Constitutional Pareto Dominance Liveness): A candidate with zero regressions, positive utility, and valid provenance is ALWAYS promoted.

law hexagram_involution provedin PROOF.bendsource · line 47 · raw

@h:0xe7cbe6684dd31616b6b8e2f83096a120/main.Hexagram6 -> {0xe7cbe6684dd31616b6b8e2f83096a120/main.invert_hex(0xe7cbe6684dd31616b6b8e2f83096a120/main.invert_hex(h)) == h : 0xe7cbe6684dd31616b6b8e2f83096a120/main.Hexagram6}

LAW 6 (64-Hexagram Yijing Line Involution): Inverting all 6 Yin/Yang lines of any hexagram twice restores the exact original hexagram.

law superopt_idempotent_absorption provedin PROOF.bendsource · line 53 · raw

@+g:0xe7cbe6684dd31616b6b8e2f83096a120/main.PrayMask -> @+rest:0xe7cbe6684dd31616b6b8e2f83096a120/main.PrayMask -> {0xe7cbe6684dd31616b6b8e2f83096a120/main.superopt_step(g, 0xe7cbe6684dd31616b6b8e2f83096a120/main.superopt_step(g, rest)) == 0xe7cbe6684dd31616b6b8e2f83096a120/main.superopt_step(g, rest) : 0xe7cbe6684dd31616b6b8e2f83096a120/main.PrayMask}

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 pray_mask_commutative provedin PROOF.bendsource · line 60 · raw

@+a:0xe7cbe6684dd31616b6b8e2f83096a120/main.PrayMask -> @+b:0xe7cbe6684dd31616b6b8e2f83096a120/main.PrayMask -> {0xe7cbe6684dd31616b6b8e2f83096a120/main.merge_pray(a, b) == 0xe7cbe6684dd31616b6b8e2f83096a120/main.merge_pray(b, a) : 0xe7cbe6684dd31616b6b8e2f83096a120/main.PrayMask}

LAW 8 (Sutra PRAY Conjunction Commutativity): Merging two Sutra PRAY denotations is commutative.

law crystal_anti_rollback_monotonicity provedin PROOF.bendsource · line 67 · raw

@rev:Nat -> {0xe7cbe6684dd31616b6b8e2f83096a120/main.advance_epoch(rev) == 0xe7cbe6684dd31616b6b8e2f83096a120/SPEC.expected_next_epoch(rev) : Nat}

LAW 9 (Citta Crystal Monotonic Epoch Step): Advancing a revision epoch by 1n equals the strict successor of the identity revision.