SNAPKITTYWEST's picture
push from SNAPKITTYWEST/hyperkitty-constraint-dsl
224e773 verified
|
Raw History Blame Contribute Delete
1.36 kB
# Lean 4 Formal Proofs
Two policy kernels formalized in Lean 4.
## policy-kernel/
Sovereign Policy Kernel β€” verdict algebra and policy DSL.
**Key types:**
- `Verdict` β€” canonical verdict algebra (`approve | reject | defer | escalate | human_required`)
- `Context` β€” policy evaluation context (actor DID, task type, evidence, nonce)
- `Evidence` β€” hash URIs, signatures, byte arrays
- `Policy Ο€` β€” typeclass: any policy ID β†’ `Context β†’ Verdict`
- `Verdict.combine` β€” priority-based combination (escalate > human_required > reject > defer > approve)
**Build:**
```bash
cd policy-kernel && lake build
```
## bifrost-policy/
Bifrost event validity β€” formal propositions + Boolean decision procedure.
**Key definitions:**
- `validJitCompile` β€” SoulIR sealed ∧ WASM fresh
- `validCapTransfer` β€” policyCid sealed ∨ zero, capHash in map ∨ zero
- `validAttestation` β€” epoch root matches state
- `decide` β€” computable Bool (single source of truth for `bifrost-policy/src/lib.rs::policy_decide`)
- `decide_sound` β€” soundness theorem: `decide e s = true β†’ validEvent e s` (**sorry** β€” Week 3 P0)
**Note:** `bifrost-policy/` imports `Bifrost.State` which lives in the `snap-os` workspace.
Full build requires `snap-os/bifrost-policy/lean/`. This directory contains the policy proofs only.