Part I · Executable Specifications Ch 03 · 30 min · ProveIt/Ch03.lean

Compile-Time Exhaustion & Boolean Reflection

Verifying finite RBAC permission matrices automatically with `Decidable`, `decide`, and `Bool ↔ Prop` bridges.

5-Line Engineering Puzzle · Two Worlds of Truth (`Bool` vs `Prop`)
inductive Role | admin | ops | reader deriving DecidableEq
inductive Action | view | restart | wipeProd deriving DecidableEq
def evalRbac (r : Role) (a : Action) : Bool := ...
-- Production runs `evalRbac : Bool` at 2M req/sec.
-- Security auditors write logical specs `PolicySpec r a : Prop`. Can they drift?
Socratic Gate · Commit to a Prediction Unanswered · Locks on commit

There are `3 × 3 = 9` `(Role, Action)` pairs. If `PolicySpec r a` is decidable for every finite `Role` and `Action`, what can Lean do at compile time?

Why Lean Distinguishes `Bool` (Data) from `Prop` (Specifications)

At first glance, having both Bool (true / false) and Prop (logical statements like ∀ n : Nat, n + 0 = n) feels redundant. Here is why systems verification needs both: a Prop can quantify over infinitely many inputs (∀ epoch : Nat, ...), which no runtime Bool function could ever finish looping over!

Conversely, your HTTP router cannot branch on an uncomputable Prop at runtime; it needs a concrete bit (Bool, 0 or 1). The Decidable P typeclass is the bridge: it packages either a proof isTrue (h : P) or a refutation isFalse (h : ¬P) that executes like a Bool while carrying a kernel-checked certificate.

Finite Exhaustion in 1 Line

For finite enumerations (Role, Action, Region, Environment), case-splitting every enum constructor reduces an entire security matrix to concrete ground propositions that decide checks inside the kernel with zero external axioms.

⊢ ProveIt/Ch03.lean · Bridging Runtime `Bool` to `Prop` Policy
Step 1 / 1
Lean Infoview Open Goal
Hands-On Exercise (ProveIt/Ch03.lean):

In `ProveIt/Ch03.lean`, verify a multi-role cloud RBAC evaluator against explicit security invariants (`ExplicitDeny`, `LeastPrivilege`) using `Decidable` reflection.

Finished the Socratic gate, Infoview trace, and playground run?
Record completion in local browser storage to track your 20-unit progress.