| /-!
|
| # SovMonster Knowledge — WORM-attested semantic chunks
|
|
|
| Ahmad Ali Parr · SnapKitty Collective · 2026
|
|
|
| Runtime knowledge layer formal sketch. Inherits Blake3 / WORM chain
|
| invariants from the kernel; does not introduce new `sorry`s into the
|
| closed Jordan fixed-point development.
|
|
|
| PAR-021: Sovereign knowledge integrity
|
| -/
|
|
|
| namespace SovMonster.Knowledge
|
|
|
| /
|
| def φ_inv : Float := 0.6180339887498948
|
|
|
| /
|
| def knowledge_tau (tau0 : Float) (k : Nat) : Float :=
|
| let rec pow (n : Nat) (acc : Float) : Float :=
|
| match n with
|
| | 0 => acc
|
| | n + 1 => pow n (acc * φ_inv)
|
| max (pow k tau0) 1e-12
|
|
|
| /
|
| def knowledge_penalty_scale (nTotal nUnverified : Nat) : Float :=
|
| if nTotal = 0 then 1.0
|
| else
|
| let penalty := (nUnverified.toFloat) / (nTotal.toFloat)
|
| max (1.0 - φ_inv * penalty) φ_inv
|
|
|
| /
|
| structure KnowledgeChunk where
|
| chunkId : String
|
| sourceSig : String
|
| createdAt : Nat
|
| content : String
|
| isVerified : Bool
|
|
|
| /
|
| def worm_attested (c : KnowledgeChunk) : Prop :=
|
| c.isVerified = true ∧ c.chunkId.length = 64 ∧ c.sourceSig.length = 64
|
|
|
| theorem knowledge_tau_positive (tau0 : Float) (k : Nat) (h : tau0 > 0) :
|
| knowledge_tau tau0 k > 0 := by
|
|
|
|
|
| simp [knowledge_tau]
|
|
|
| trivial
|
|
|
| theorem knowledge_penalty_bounded (nT nU : Nat) :
|
| knowledge_penalty_scale nT nU ≥ φ_inv ∨ knowledge_penalty_scale nT nU = 1.0 := by
|
| simp [knowledge_penalty_scale]
|
| split <;> first | exact Or.inr rfl | exact Or.inl (by trivial)
|
|
|
| /
|
| def search_sound (chunks : List KnowledgeChunk) : Prop :=
|
| chunks.all (fun c => c.isVerified)
|
|
|
| end SovMonster.Knowledge
|
|
|