JPYC.allowlist_wf
名称・種別
- 名称:
JPYC.allowlist_wf - 種別: theorem
- モジュール:
JpycFormalVerification.AccessControlTheorems - ソース:
JpycFormalVerification/AccessControlTheorems.lean:623-625 - 概要: allowlist は健全性不変条件 WF を保つ、という定理。
- 仕様: 対象
型シグネチャ
lean
∀ {s s' : JPYC.State} {ctx : JPYC.CallContext} {account : JPYC.Address}, JPYC.WF s → Eq (JPYC.allowlist s ctx account) (Except.ok s') → JPYC.WF s'allowlist が成功するなら、結果状態も WF を満たす、という不変条件保存の定理です。
解説
何を述べているか。 事前状態 s が WF を満たし、allowlist が成功して s' になったとき、s' もまた WF を満たします。
直感。 WF はフラグ(blocklisted/allowlisted/authorizationStates)が 0/1 のみ、initializedVersion ∈ {0,1,2} を要求します。allowlisted に書くのは 1 だけなので、フラグが 0/1 値であることは崩れません(WF_setAllowlisted)。
なぜ安全性に効くか。 すべての操作が WF を保つので、「正規の操作を続ける限りフラグが壊れた値にならない」が帰納的に保証されます。フラグに依存する判定ロジック全体の前提が、操作後も成り立ち続けます。
図解
Lean ソースコード
lean
theorem allowlist_wf {s s' : State} {ctx : CallContext} {account : Address}
(hwf : WF s) (h : allowlist s ctx account = .ok s') : WF s' := by
obtain ⟨_, _, rfl⟩ := allowlist_ok h; exact WF_setAllowlisted hwf account (Or.inr rfl)