Skip to content

feat(Crypto): Generalize encryption schemes over arbitrary monads#581

Open
dtumad wants to merge 6 commits into
leanprover:mainfrom
dtumad:dtumad/monad-generic-encryption-schemes
Open

feat(Crypto): Generalize encryption schemes over arbitrary monads#581
dtumad wants to merge 6 commits into
leanprover:mainfrom
dtumad:dtumad/monad-generic-encryption-schemes

Conversation

@dtumad
Copy link
Copy Markdown

@dtumad dtumad commented May 20, 2026

This PR modifies the definition of encScheme to allow the computations to happen in any monad m, and defines correctness in terms of a MonadLiftT m PMF instance (and further a LawfulMonadLiftT instance for some proofs). Also adds an example of a runnable version of otp by taking m to be FreeM (PFunctor.Obj {A := ℕ, B := BitVec}) with custom private lifting instances.

Also adds a new HasUniformBitVec m/LawfulUniformBitVec m typeclass asserting the m can model uniform selection of bitvectors, which is needed for the proof of Shanon's theorem in particular, as well as similar classes for finite sets and finite types.

@SamuelSchlesinger
Copy link
Copy Markdown
Contributor

Thanks for the PR, though I'm not sure I understand the goal here yet: Are you planning to add a new variant of a perfectly secret encryption scheme? Did you plan to extract these for execution? Or did you plan to use this for computationally secure encryption schemes?

I believe, following Katz-Lindell, the latter would be best handled by a new definition altogether. It would be nice if the PR description contained a justification for the change along with a description.

Copy link
Copy Markdown
Contributor

@SamuelSchlesinger SamuelSchlesinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't do a full review, curious to hear your response to my question before I do so.

Comment thread Cslib/Probability/HasUniform.lean Outdated
Comment thread Cslib/Probability/HasUniform.lean
@dtumad
Copy link
Copy Markdown
Author

dtumad commented May 23, 2026

Did you plan to extract these for execution?

This was my main goal, I've pushed an actual example of making this runnable, although it involved some further refactoring to seperate PMF noncomputability. I just picked OTP as the example for this since it's simpler than the secret sharing construction.

Are you planning to add a new variant of a perfectly secret encryption scheme?

This seems unneeded I think given the uniqueness theorem.

I believe, following Katz-Lindell, the latter would be best handled by a new definition altogether. It would be nice if the PR description contained a justification for the change along with a description.

Agreed, I don't think this can really stretch to fit that.

@SamuelSchlesinger
Copy link
Copy Markdown
Contributor

Fantastic, thank you for explaining! I'll make some time to review this in the coming week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants