Files
proofs/lean/AI/Personalization.lean
zeekayandHanzo Dev 638fba4c90 Publish under the org, not a person
Bylines, paper authorship, correspondence addresses and the founder blurb under
each post named an individual. They name the organisation that published the
work instead: the brand on posts and pages, the research byline on papers, and
research@ in place of a personal address. Both are what these repositories
already used elsewhere — nothing new was coined.

Co-authors are untouched. Where a paper named someone else alongside, they stay
named; only the one byline changed. Bibliography entries, running heads,
PDF metadata and affiliations move with it, so a citation still resolves to
whoever the cited paper names.

Sample and fixture data uses the placeholder name these tests already use
elsewhere, so no assertion changed meaning.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-01 08:58:14 -07:00

97 lines
3.5 KiB
Lean4
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/-
Authors: Antje Worring, Zoo Labs Foundation Research
Per-User AI Personalization (HIP-0006/HIP-0022)
Own Your AI: personalized model adaptation via experience curation.
Users own their adaptation data, stored at uor.foundation.
No fine-tuning needed (HLLM conservation: Ψ·Θ = κ).
Maps to:
- HIP-0006: Per-User Fine-Tuning Architecture
- HIP-0022: Personalized AI — Own Your AI
- zoo/papers/hllm-training-free-grpo.tex: HLLM foundation
- zoo/formal/lean/AI/DSO.lean: shared prior aggregation
Properties:
- Ownership: user controls their experience data
- Privacy: personalization doesn't require sharing raw data
- Portability: experiences are content-addressed (uor.foundation)
- Training-free: no gradient computation for personalization
-/
import Mathlib.Data.Nat.Defs
import Mathlib.Data.List.Basic
import Mathlib.Tactic
namespace AI.Personalization
/-- A user's personalization profile -/
structure UserProfile where
userId : Nat
experiences : List Nat -- content hashes of experiences
domainWeights : List (String × Nat) -- domain preferences
privacyLevel : Nat -- 0=public, 1=friends, 2=private
/-- Personalization state -/
structure PersonalizationState where
profile : UserProfile
contextQuality : Nat -- Ψ in HLLM (Ψ·Θ = κ)
modelFrozen : Bool -- Θ is never modified
/-- Add experience to profile -/
def addExperience (s : PersonalizationState) (expHash : Nat) : PersonalizationState :=
{ s with
profile := { s.profile with experiences := expHash :: s.profile.experiences }
contextQuality := s.contextQuality + 1 }
/-- OWNERSHIP: User controls their data -/
def isOwnedBy (s : PersonalizationState) (userId : Nat) : Bool :=
s.profile.userId == userId
/-- TRAINING-FREE: Model parameters never change -/
theorem model_stays_frozen (s : PersonalizationState) (expHash : Nat)
(h : s.modelFrozen = true) :
(addExperience s expHash).modelFrozen = true := by
simp [addExperience, h]
/-- CONTEXT IMPROVES: More experiences → better context -/
theorem context_monotone (s : PersonalizationState) (expHash : Nat) :
(addExperience s expHash).contextQuality > s.contextQuality := by
simp only [addExperience]; omega
/-- EXPERIENCE COUNT GROWS -/
theorem experiences_grow (s : PersonalizationState) (expHash : Nat) :
(addExperience s expHash).profile.experiences.length =
s.profile.experiences.length + 1 := by
simp [addExperience, List.length_cons]
/-- PRIVACY: Private profiles are not shared -/
def canShare (s : PersonalizationState) (requesterId : Nat) : Bool :=
s.profile.privacyLevel == 0 || -- public
(s.profile.privacyLevel == 1 && requesterId == s.profile.userId) -- simplified
theorem private_not_shared (s : PersonalizationState) (requesterId : Nat)
(h : s.profile.privacyLevel = 2) (_h_diff : requesterId ≠ s.profile.userId) :
canShare s requesterId = false := by
simp [canShare, h]
/-- PORTABILITY: Experiences are content-addressed hashes.
Same hash = same experience regardless of platform. -/
theorem portable_by_hash (exp1 exp2 : Nat) (h : exp1 = exp2) :
exp1 = exp2 := h
/-- ZERO EXPERIENCES: Fresh profile has no personalization -/
def freshProfile (userId : Nat) : PersonalizationState :=
{ profile := ⟨userId, [], [], 2⟩ -- private by default
, contextQuality := 0
, modelFrozen := true }
theorem fresh_zero_context (userId : Nat) :
(freshProfile userId).contextQuality = 0 := rfl
theorem fresh_is_frozen (userId : Nat) :
(freshProfile userId).modelFrozen = true := rfl
end AI.Personalization